[teiid-commits] teiid SVN: r1544 - in branches/JCA: build and 137 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Mon Nov 2 14:41:35 EST 2009


Author: rareddy
Date: 2009-11-02 14:41:28 -0500 (Mon, 02 Nov 2009)
New Revision: 1544

Added:
   branches/JCA/build.xml
   branches/JCA/build/assembly/jboss-container/
   branches/JCA/build/assembly/jboss-container/connectors.xml
   branches/JCA/build/assembly/jboss-container/dependencies.xml
   branches/JCA/build/assembly/jboss-container/dist.xml
   branches/JCA/build/kit-jboss-container/
   branches/JCA/build/kit-jboss-container/conf/
   branches/JCA/build/kit-jboss-container/conf/jboss-cache-configuration.xml
   branches/JCA/build/kit-jboss-container/deploy/
   branches/JCA/build/kit-jboss-container/deploy/teiid-bindings-ds.xml
   branches/JCA/build/kit-jboss-container/deploy/teiid-connector-metadata.rar
   branches/JCA/build/kit-jboss-container/deploy/teiid-runtime-ds.xml
   branches/JCA/build/kit-jboss-container/deploy/teiid-runtime.rar
   branches/JCA/build/kit-jboss-container/deploy/teiidsources-xa-ds.xml
   branches/JCA/common-internal/src/main/java/com/metamatrix/common/queue/StatsCapturingWorkManager.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnection.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnectionFactory.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/BasicResourceAdapter.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/ConnectionRequestInfoWrapper.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/DefaultConnectorLogger.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/TypeFacilityImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/WrappedConnection.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/WrappedConnector.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/AggregateImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/BaseLanguageObject.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/BatchedUpdatesImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/CompareCriteriaImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/CompoundCriteriaImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/DeleteImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/ElementImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/ExistsCriteriaImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/FromImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/FunctionImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/GroupByImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/GroupImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/InCriteriaImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/InlineViewImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/InsertImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/InsertValueExpressionsImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/IsNullCriteriaImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/JoinImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/LanguageFactoryImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/LikeCriteriaImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/LimitImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/LiteralImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/NotCriteriaImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/OrderByImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/OrderByItemImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/ParameterImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/ProcedureImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/QueryCommandImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/QueryImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/ScalarSubqueryImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SearchedCaseExpressionImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SelectImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SelectSymbolImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SetClauseImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SetClauseListImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SetQueryImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SubqueryCompareCriteriaImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SubqueryInCriteriaImpl.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/UpdateImpl.java
   branches/JCA/connector-api/src/test/java/org/teiid/connector/TestWrappedConnector.java
   branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCManagedConnectionFactory.java
   branches/JCA/connectors/connector-jdbc/src/main/rar/
   branches/JCA/connectors/connector-jdbc/src/main/rar/META-INF/
   branches/JCA/connectors/connector-jdbc/src/main/rar/META-INF/ra.xml
   branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/FakeMetadataFactory.java
   branches/JCA/engine/src/main/java/com/metamatrix/dqp/service/TransactionContext.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/AsyncRequestWorkItem.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/transaction/ContainerTransactionProvider.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/transaction/XidFactory.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/FakeWorkManager.java
   branches/JCA/jboss-integration/
   branches/JCA/jboss-integration/pom.xml
   branches/JCA/jboss-integration/src/
   branches/JCA/jboss-integration/src/main/
   branches/JCA/jboss-integration/src/main/java/
   branches/JCA/jboss-integration/src/main/java/com/
   branches/JCA/jboss-integration/src/main/java/com/metamatrix/
   branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/
   branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/embedded/
   branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/embedded/admin/
   branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java
   branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java
   branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/embedded/admin/DQPLogListener.java
   branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/embedded/admin/DQPMonitoringAdminImpl.java
   branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/embedded/admin/DQPRuntimeStateAdminImpl.java
   branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/embedded/admin/DQPSecurityAdminImpl.java
   branches/JCA/jboss-integration/src/main/resources/
   branches/JCA/jboss-integration/src/test/
   branches/JCA/jboss-integration/src/test/java/
   branches/JCA/jboss-integration/src/test/java/com/
   branches/JCA/jboss-integration/src/test/java/com/metamatrix/
   branches/JCA/jboss-integration/src/test/java/com/metamatrix/dqp/
   branches/JCA/jboss-integration/src/test/java/com/metamatrix/dqp/embedded/
   branches/JCA/jboss-integration/src/test/java/com/metamatrix/dqp/embedded/admin/
   branches/JCA/jboss-integration/src/test/java/com/metamatrix/dqp/embedded/admin/TestBaseAdmin.java
   branches/JCA/jboss-integration/src/test/resources/
   branches/JCA/runtime/src/main/java/org/teiid/ConnectionInfo.java
   branches/JCA/runtime/src/main/java/org/teiid/TeiidManagedConnection.java
   branches/JCA/runtime/src/main/java/org/teiid/TeiidManagedConnectionFactory.java
   branches/JCA/runtime/src/main/java/org/teiid/TeiidResourceAdapter.java
   branches/JCA/runtime/src/main/java/org/teiid/WrappedTeiidConnection.java
   branches/JCA/test-integration/db/src/main/resources/datasources/derby/connection.properties
   branches/JCA/test-integration/db/src/main/resources/datasources/mysql/connection.properties
Removed:
   branches/JCA/client/src/main/java/com/metamatrix/dqp/internal/datamgr/ConnectorID.java
   branches/JCA/client/src/main/java/com/metamatrix/jdbc/api/ConnectionProperties.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/api/ConnectorIdentity.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/api/ConnectorPropertyNames.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/api/CredentialMap.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/api/MappedUserIdentity.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/api/SingleIdentity.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/xa/api/TransactionContext.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/xa/api/XAConnection.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/xa/api/XAConnector.java
   branches/JCA/connector-api/src/test/java/org/teiid/connector/TestCredentialMap.java
   branches/JCA/connector-metadata/src/test/java/com/metamatrix/connector/metadata/internal/TestConnectorHost.java
   branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCSourceXAConnection.java
   branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/MetadataFactory.java
   branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCSourceConnection.java
   branches/JCA/engine/src/main/java/com/metamatrix/common/application/AbstractClassLoaderManager.java
   branches/JCA/engine/src/main/java/com/metamatrix/common/application/ClassLoaderManager.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorEnvironmentImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWrapper.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/DefaultConnectorLogger.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/TypeFacilityImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/AggregateImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/BaseLanguageObject.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/BatchedUpdatesImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/CompareCriteriaImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/CompoundCriteriaImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/DeleteImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/ElementImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/ExistsCriteriaImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/FromImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/FunctionImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/GroupByImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/GroupImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/InCriteriaImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/InlineViewImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/InsertImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/InsertValueExpressionsImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/IsNullCriteriaImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/JoinImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/LanguageFactoryImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/LikeCriteriaImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/LimitImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/LiteralImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/NotCriteriaImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/OrderByImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/OrderByItemImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/ParameterImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/ProcedureImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/QueryCommandImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/QueryImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/ScalarSubqueryImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SearchedCaseExpressionImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SelectImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SelectSymbolImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SetClauseImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SetClauseListImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SetQueryImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SubqueryCompareCriteriaImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SubqueryInCriteriaImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/UpdateImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/pooling/connector/ConnectionPool.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/pooling/connector/ConnectionPoolException.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/pooling/connector/ConnectionWrapper.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/pooling/connector/PooledConnector.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/transaction/TransactionContextImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/pooling/connector/FakeSourceConnectionFactory.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/pooling/connector/FakeUserIdentityConnectionFactory.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/pooling/connector/TestConnectionPool.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/pooling/connector/TestConnectionWrapper.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/pooling/connector/TestPerUserPool.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/pooling/connector/TestPooledConnector.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/transaction/TestTransactionContextImpl.java
   branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java
   branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java
   branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPLogListener.java
   branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPMonitoringAdminImpl.java
   branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPRuntimeStateAdminImpl.java
   branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPSecurityAdminImpl.java
   branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/configuration/ExtensionModuleReader.java
   branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/configuration/ExtensionModuleWriter.java
   branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/configuration/ServerConfigFileReader.java
   branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/configuration/ServerConfigFileWriter.java
   branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/services/DefaultIndexConnectorBinding.java
   branches/JCA/runtime/src/main/java/com/metamatrix/jdbc/CacheProvider.java
   branches/JCA/runtime/src/test/java/com/metamatrix/dqp/embedded/admin/TestBaseAdmin.java
Modified:
   branches/JCA/build/pom.xml
   branches/JCA/cache-jbosscache/pom.xml
   branches/JCA/cache-jbosscache/src/main/java/com/metamatrix/cache/jboss/JBossCacheFactory.java
   branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/BaseDataSource.java
   branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java
   branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDataSource.java
   branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDriver.java
   branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMStatement.java
   branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/util/MMJDBCURL.java
   branches/JCA/client-jdbc/src/main/java/org/teiid/jdbc/EmbeddedProfile.java
   branches/JCA/client-jdbc/src/main/java/org/teiid/jdbc/SocketProfile.java
   branches/JCA/client-jdbc/src/main/java/org/teiid/jdbc/TeiidDataSource.java
   branches/JCA/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMDriver.java
   branches/JCA/client-jdbc/src/test/java/com/metamatrix/jdbc/util/TestMMJDBCURL.java
   branches/JCA/client-jdbc/src/test/java/org/teiid/jdbc/TestTeiidDriver.java
   branches/JCA/client/src/main/java/com/metamatrix/admin/objects/TransactionImpl.java
   branches/JCA/client/src/main/java/com/metamatrix/common/api/MMURL.java
   branches/JCA/client/src/main/java/com/metamatrix/common/comm/api/ServerConnection.java
   branches/JCA/client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionFactory.java
   branches/JCA/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java
   branches/JCA/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java
   branches/JCA/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java
   branches/JCA/client/src/main/java/com/metamatrix/platform/security/api/SessionToken.java
   branches/JCA/client/src/main/java/org/teiid/adminapi/SecurityAdmin.java
   branches/JCA/client/src/main/java/org/teiid/adminapi/Transaction.java
   branches/JCA/client/src/test/java/com/metamatrix/common/comm/platform/client/TestSeverAdminFactory.java
   branches/JCA/common-core/src/main/java/com/metamatrix/core/util/StringUtil.java
   branches/JCA/common-internal/pom.xml
   branches/JCA/common-internal/src/main/java/com/metamatrix/common/queue/WorkerPoolFactory.java
   branches/JCA/common-internal/src/test/java/com/metamatrix/common/queue/TestQueueWorkerPool.java
   branches/JCA/connector-api/pom.xml
   branches/JCA/connector-api/src/main/java/org/teiid/connector/api/Connection.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/api/Connector.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/api/ConnectorAnnotations.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/api/ConnectorEnvironment.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/api/ConnectorException.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/api/ConnectorLogger.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/api/ExecutionContext.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/BasicConnection.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/BasicConnector.java
   branches/JCA/connector-api/src/main/java/org/teiid/connector/metadata/runtime/MetadataFactory.java
   branches/JCA/connector-metadata/pom.xml
   branches/JCA/connector-metadata/src/main/java/com/metamatrix/connector/metadata/IndexConnector.java
   branches/JCA/connector-metadata/src/main/java/com/metamatrix/connector/metadata/adapter/ObjectConnection.java
   branches/JCA/connector-metadata/src/main/java/com/metamatrix/connector/metadata/adapter/ObjectConnector.java
   branches/JCA/connector-metadata/src/main/java/com/metamatrix/connector/metadata/adapter/ObjectSynchExecution.java
   branches/JCA/connector-metadata/src/test/java/com/metamatrix/connector/metadata/TestIndexConnector.java
   branches/JCA/connector-metadata/src/test/java/com/metamatrix/connector/metadata/adapter/TestObjectConnector.java
   branches/JCA/connector-sdk/src/main/java/com/metamatrix/cdk/CommandBuilder.java
   branches/JCA/connector-sdk/src/main/java/com/metamatrix/cdk/api/ConnectorHost.java
   branches/JCA/connector-sdk/src/main/java/com/metamatrix/cdk/api/EnvironmentUtility.java
   branches/JCA/connectors/connector-jdbc/pom.xml
   branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCBaseExecution.java
   branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCConnector.java
   branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCMetdataProcessor.java
   branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCProcedureExecution.java
   branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCQueryExecution.java
   branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCSourceConnection.java
   branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCUpdateExecution.java
   branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/db2/DB2SQLTranslator.java
   branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/derby/DerbySQLTranslator.java
   branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/informix/InformixSQLTranslator.java
   branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQLTranslator.java
   branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleSQLTranslator.java
   branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/PostgreSQLTranslator.java
   branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/SybaseSQLTranslator.java
   branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/Translator.java
   branches/JCA/connectors/connector-jdbc/src/main/resources/org/teiid/connector/jdbc/i18n.properties
   branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCProcedureExecution.java
   branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCUpdateExecution.java
   branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/access/TestAccessSQLTranslator.java
   branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/db2/TestDB2ConvertModifier.java
   branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/db2/TestDB2SqlTranslator.java
   branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/derby/TestDerbySQLTranslator.java
   branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/extension/impl/TestEscapeSyntaxModifier.java
   branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/mysql/TestMySQLTranslator.java
   branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestDayWeekQuarterFunctionModifier.java
   branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestLeftOrRightFunctionModifier.java
   branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestLog10FunctionModifier.java
   branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestMonthOrDayNameFunctionModifier.java
   branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestOracleConvertModifier.java
   branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestOracleSQLConversionVisitor.java
   branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestOracleTranslator.java
   branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestSubstringFunctionModifier.java
   branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/postgresql/TestPostgreSQLTranslator.java
   branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/sqlserver/TestSqlServerConversionVisitor.java
   branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/sybase/TestSybaseConvertModifier.java
   branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/sybase/TestSybaseSQLConversionVisitor.java
   branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/translator/TestExtractFunctionModifier.java
   branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/translator/TestLocateFunctionModifier.java
   branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/translator/TestModFunctionModifier.java
   branches/JCA/connectors/pom.xml
   branches/JCA/engine/pom.xml
   branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferManagerImpl.java
   branches/JCA/engine/src/main/java/com/metamatrix/dqp/message/AtomicRequestMessage.java
   branches/JCA/engine/src/main/java/com/metamatrix/dqp/service/ConfigurationService.java
   branches/JCA/engine/src/main/java/com/metamatrix/dqp/service/DataService.java
   branches/JCA/engine/src/main/java/com/metamatrix/dqp/service/TransactionService.java
   branches/JCA/engine/src/main/java/com/metamatrix/dqp/util/LogConstants.java
   branches/JCA/engine/src/main/java/com/metamatrix/platform/security/api/MetaMatrixSessionInfo.java
   branches/JCA/engine/src/main/java/com/metamatrix/platform/security/api/service/AuthenticationToken.java
   branches/JCA/engine/src/main/java/com/metamatrix/platform/security/api/service/MembershipServiceInterface.java
   branches/JCA/engine/src/main/java/com/metamatrix/platform/security/api/service/SessionServiceInterface.java
   branches/JCA/engine/src/main/java/com/metamatrix/platform/security/api/service/SuccessfulAuthenticationToken.java
   branches/JCA/engine/src/main/java/com/metamatrix/server/serverapi/RequestInfo.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/AsynchConnectorWorkItem.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWorkItem.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ExecutionContextImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/SynchConnectorWorkItem.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/LanguageBridgeFactory.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/AbstractWorkItem.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/CachedRequestWorkItem.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/LobWorkItem.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/capabilities/ConnectorCapabilitiesFinder.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/transaction/TransactionProvider.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/transaction/TransactionServerImpl.java
   branches/JCA/engine/src/main/resources/com/metamatrix/dqp/i18n.properties
   branches/JCA/engine/src/test/java/com/metamatrix/dqp/message/TestAtomicRequestMessage.java
   branches/JCA/engine/src/test/java/com/metamatrix/dqp/service/AutoGenDataService.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/FakeConnector.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/FakeExecutionContextImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/FakeTransactionService.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorManagerImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorStateManager.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorWorkItem.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestExecutionContextImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestTypeFacilityImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestAggregateImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestBatchedUpdatesImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestCompareCriteriaImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestCompoundCriteriaImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestDeleteImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestElementImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestExistsCriteriaImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestFromImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestFunctionImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestGroupByImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestGroupImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestInCriteriaImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestInlineViewImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestInsertImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestIsNullCriteriaImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestJoinImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestLikeCriteriaImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestLiteralImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestNotCriteriaImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestOrderByImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestParameterImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestProcedureImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestQueryImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestScalarSubqueryImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSearchedCaseExpressionImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSelectImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSelectSymbolImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSetQueryImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSubqueryCompareCriteriaImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSubqueryInCriteriaImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestUpdateImpl.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TstLanguageBridgeFactory.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCoreRequestHandling.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPWorkContext.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/capabilities/TestConnectorCapabilitiesFinder.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/transaction/TestTransactionServer.java
   branches/JCA/metadata/pom.xml
   branches/JCA/metadata/src/main/java/org/teiid/metadata/QueryMetadataCache.java
   branches/JCA/pom.xml
   branches/JCA/runtime/pom.xml
   branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedBaseDQPService.java
   branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java
   branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedDataService.java
   branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedTransactionService.java
   branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedVDBService.java
   branches/JCA/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java
   branches/JCA/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedGuiceModule.java
   branches/JCA/runtime/src/main/java/com/metamatrix/platform/security/membership/service/MembershipServiceImpl.java
   branches/JCA/runtime/src/main/java/com/metamatrix/platform/security/membership/spi/MembershipDomain.java
   branches/JCA/runtime/src/main/java/com/metamatrix/platform/security/membership/spi/file/FileMembershipDomain.java
   branches/JCA/runtime/src/main/java/com/metamatrix/platform/security/membership/spi/ldap/LDAPMembershipDomain.java
   branches/JCA/runtime/src/main/java/com/metamatrix/platform/security/session/service/SessionServiceImpl.java
   branches/JCA/runtime/src/main/java/org/teiid/Server.java
   branches/JCA/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java
   branches/JCA/runtime/src/main/java/org/teiid/transport/LogonImpl.java
   branches/JCA/runtime/src/main/java/org/teiid/transport/ServerWorkItem.java
   branches/JCA/runtime/src/main/java/org/teiid/transport/SocketClientInstance.java
   branches/JCA/runtime/src/main/java/org/teiid/transport/SocketListener.java
   branches/JCA/runtime/src/main/java/org/teiid/transport/SocketTransport.java
   branches/JCA/runtime/src/test/java/com/metamatrix/dqp/embedded/EmbeddedTestUtil.java
   branches/JCA/runtime/src/test/java/com/metamatrix/dqp/embedded/TestEmbeddedConfigSource.java
   branches/JCA/runtime/src/test/java/com/metamatrix/dqp/embedded/services/TestEmbeddedConfigurationService.java
   branches/JCA/runtime/src/test/java/com/metamatrix/dqp/embedded/services/TestEmbeddedVDBService.java
   branches/JCA/runtime/src/test/java/com/metamatrix/platform/security/membership/service/TestMembershipServiceImpl.java
   branches/JCA/runtime/src/test/java/com/metamatrix/platform/security/membership/spi/file/TestFileMembershipDomain.java
   branches/JCA/runtime/src/test/java/com/metamatrix/platform/security/session/service/TestSessionServiceImpl.java
   branches/JCA/runtime/src/test/java/org/teiid/transport/TestCommSockets.java
   branches/JCA/runtime/src/test/java/org/teiid/transport/TestLogonImpl.java
   branches/JCA/test-integration/db/src/main/resources/ddl/mysql/create_tables.sql
   branches/JCA/test-integration/db/src/main/resources/default-config.properties
   branches/JCA/test-integration/pom.xml
   branches/JCA/txn-jbossts/src/main/java/com/metamatrix/xa/arjuna/ArjunaTransactionProvider.java
   branches/JCA/txn-jbossts/src/test/java/com/metamatrix/xa/arjuna/FakeXAConnection.java
Log:
TEIID-833, TEIID-859, TEIID-861, TEIID-862, TEIID-863, TEIID-864: initial check in to save stuff on branch. Fixing connector-api and JDBC connector were top priorities. 

Added: branches/JCA/build/assembly/jboss-container/connectors.xml
===================================================================
--- branches/JCA/build/assembly/jboss-container/connectors.xml	                        (rev 0)
+++ branches/JCA/build/assembly/jboss-container/connectors.xml	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,30 @@
+<!--This script builds a JAR for the Embedded Server Installation -->
+<assembly>
+  
+  <id>connector-rar</id>
+  
+  <formats>
+    <format>dir</format>
+  </formats>
+  
+  <includeBaseDirectory>false</includeBaseDirectory>
+  <baseDirectory>teiid</baseDirectory>
+    
+  <moduleSets>
+    <moduleSet>
+        <includeSubModules>true</includeSubModules>
+               
+        <includes>
+            <include>org.jboss.teiid.connectors:connector-jdbc:rar</include>
+        </includes>
+
+        <binaries>        
+          <includeDependencies>false</includeDependencies>
+          <unpack>false</unpack>
+        </binaries>
+      
+    </moduleSet>
+
+  </moduleSets>
+    
+</assembly>
\ No newline at end of file


Property changes on: branches/JCA/build/assembly/jboss-container/connectors.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: branches/JCA/build/assembly/jboss-container/dependencies.xml
===================================================================
--- branches/JCA/build/assembly/jboss-container/dependencies.xml	                        (rev 0)
+++ branches/JCA/build/assembly/jboss-container/dependencies.xml	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,58 @@
+<!--This script builds a JAR for the Embedded Server Installation -->
+<assembly>
+  
+  <id>runtime-dependencies</id>
+  
+  <formats>
+    <format>dir</format>
+  </formats>
+  
+  <includeBaseDirectory>false</includeBaseDirectory>
+  <baseDirectory>teiid</baseDirectory>
+    
+  <moduleSets>
+    <moduleSet>
+        <includeSubModules>true</includeSubModules>
+               
+        <includes>
+            <include>org.jboss.teiid:teiid-cache-jbosscache</include>
+            <include>org.jboss.teiid:teiid-common-internal</include>
+    	
+        	<include>org.jboss.teiid:teiid-connector-api</include>
+        	<include>org.jboss.teiid:teiid-connector-metadata</include>
+            <include>org.jboss.teiid:teiid-runtime</include>
+        	<include>org.jboss.teiid:teiid-engine</include>
+        	<include>org.jboss.teiid:teiid-metadata</include>
+        </includes>
+        
+        <binaries>        
+          <includeDependencies>true</includeDependencies>
+          <unpack>false</unpack>
+                                    
+          <dependencySets>
+            <dependencySet>
+              <useProjectArtifact>true</useProjectArtifact>
+              <unpack>false</unpack>
+              <useTransitiveDependencies>true</useTransitiveDependencies>
+              <useDefaultExcludes>true</useDefaultExcludes>
+              <excludes>
+                <exclude>teiid*</exclude>
+              </excludes>              
+            </dependencySet>
+          </dependencySets>
+          
+        </binaries>
+      
+    </moduleSet>
+    <moduleSet>
+      <includes>
+      	<include>org.jboss.teiid:teiid-hibernate-dialect</include>
+      </includes>
+      <binaries>
+		<includeDependencies>false</includeDependencies>
+		<unpack>false</unpack>
+      </binaries>
+    </moduleSet>
+  </moduleSets>
+    
+</assembly>
\ No newline at end of file


Property changes on: branches/JCA/build/assembly/jboss-container/dependencies.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: branches/JCA/build/assembly/jboss-container/dist.xml
===================================================================
--- branches/JCA/build/assembly/jboss-container/dist.xml	                        (rev 0)
+++ branches/JCA/build/assembly/jboss-container/dist.xml	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,46 @@
+<!--This script builds a JAR for the Embedded Server Installation -->
+<assembly>
+  
+  <id>jboss-dist</id>
+  
+  <formats>
+    <format>zip</format>
+  </formats>
+  
+  <includeBaseDirectory>false</includeBaseDirectory>
+  <baseDirectory>teiid-${version}</baseDirectory>
+
+  <fileSets>
+                
+    <fileSet>
+      <directory>target/distribution</directory>
+      <includes>
+        <include>teiid-${version}-client.jar</include>
+      </includes>
+      <outputDirectory>lib</outputDirectory>      
+    </fileSet>
+      
+    <fileSet>
+      <directory>target/distribution/teiid-${version}-runtime-dependencies.dir</directory>
+      <includes>
+        <include>*.jar</include>
+      </includes>
+      <outputDirectory>lib</outputDirectory>      
+    </fileSet>
+     
+    <fileSet>
+      <directory>target/distribution/teiid-${version}-connector-rar.dir</directory>
+      <includes>
+        <include>*.rar</include>
+      </includes>
+      <outputDirectory>deploy</outputDirectory>      
+    </fileSet>     
+        
+    <fileSet>
+        <directory>build/kit-jboss-container</directory>       
+        <outputDirectory>/</outputDirectory>     
+    </fileSet>
+            
+  </fileSets>
+
+</assembly>
\ No newline at end of file


Property changes on: branches/JCA/build/assembly/jboss-container/dist.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: branches/JCA/build/kit-jboss-container/conf/jboss-cache-configuration.xml
===================================================================
--- branches/JCA/build/kit-jboss-container/conf/jboss-cache-configuration.xml	                        (rev 0)
+++ branches/JCA/build/kit-jboss-container/conf/jboss-cache-configuration.xml	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbosscache xmlns="urn:jboss:jbosscache-core:config:3.1">
+ 
+    <locking isolationLevel="READ_COMMITTED" lockAcquisitionTimeout="15000" lockParentForChildInsertRemove="true" />
+    <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup" />
+   
+    <shutdown hookBehavior="DEFAULT" />
+    
+    <loaders passivation="true" shared="false">
+        <loader class="org.jboss.cache.loader.FileCacheLoader" fetchPersistentState="true" purgeOnStartup="true">
+            <properties>location=./teiid/cache</properties>
+        </loader>
+    </loaders>
+    
+    <eviction wakeUpInterval="15000">
+        <default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm" eventQueueSize="100000">
+            <property name="maxNodes" value="10000" />
+            <!-- 0 = immediate eviction, -1 = no limit -->
+            <property name="timeToLive" value="-1" />
+        </default>
+    </eviction>
+    
+</jbosscache>


Property changes on: branches/JCA/build/kit-jboss-container/conf/jboss-cache-configuration.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: branches/JCA/build/kit-jboss-container/deploy/teiid-bindings-ds.xml
===================================================================
--- branches/JCA/build/kit-jboss-container/deploy/teiid-bindings-ds.xml	                        (rev 0)
+++ branches/JCA/build/kit-jboss-container/deploy/teiid-bindings-ds.xml	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<connection-factories>
+
+   <no-tx-connection-factory>
+      <jndi-name>mysql-connector-binding</jndi-name>
+      <rar-name>connector-jdbc-6.3.0-SNAPSHOT.rar</rar-name>
+      <connection-definition>org.teiid.connector.api.Connector</connection-definition>
+      
+      <config-property name="CapabilitiesClass" type="java.lang.String">org.teiid.connector.jdbc.mysql.MySQLCapabilities</config-property>
+      <config-property name="XaCapable" type="java.lang.Boolean">true</config-property>
+
+      <config-property name="ExtensionTranslationClassName" type="java.lang.String">org.teiid.connector.jdbc.mysql.MySQLTranslator</config-property>
+      <config-property name="SourceJNDIName" type="java.lang.String">java:MySQLDS</config-property>
+      <config-property name="ImportUseFullSchemaName" type="java.lang.Boolean">false</config-property>
+      <config-property name="ImportIndexes" type="java.lang.Boolean">false</config-property>
+      <config-property name="ImportKeys" type="java.lang.Boolean">false</config-property>
+      <config-property name="ImportProcedures" type="java.lang.Boolean">false</config-property>
+            
+      <max-pool-size>20</max-pool-size>
+      <!-- security-domain-and-application>teiid-realm</security-domain-and-application --> 
+    </no-tx-connection-factory>
+    
+    
+   <no-tx-connection-factory>
+      <jndi-name>derby-connector-binding</jndi-name>
+      <rar-name>connector-jdbc-6.3.0-SNAPSHOT.rar</rar-name>
+      <connection-definition>org.teiid.connector.api.Connector</connection-definition>
+      
+      <config-property name="CapabilitiesClass" type="java.lang.String">org.teiid.connector.jdbc.derby.DerbyCapabilities</config-property>
+      <config-property name="XaCapable" type="java.lang.Boolean">true</config-property>
+
+      <config-property name="ExtensionTranslationClassName" type="java.lang.String">org.teiid.connector.jdbc.derby.DerbySQLTranslator</config-property>
+      <config-property name="SourceJNDIName" type="java.lang.String">java:DerbyDS</config-property>
+      <config-property name="ImportUseFullSchemaName" type="java.lang.Boolean">false</config-property>
+      <config-property name="ImportIndexes" type="java.lang.Boolean">false</config-property>
+      <config-property name="ImportKeys" type="java.lang.Boolean">false</config-property>
+      <config-property name="ImportProcedures" type="java.lang.Boolean">false</config-property>
+            
+      <max-pool-size>20</max-pool-size>
+      <!-- security-domain-and-application>teiid-realm</security-domain-and-application--> 
+    </no-tx-connection-factory>    
+
+</connection-factories>


Property changes on: branches/JCA/build/kit-jboss-container/deploy/teiid-bindings-ds.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: branches/JCA/build/kit-jboss-container/deploy/teiid-connector-metadata.rar
===================================================================
(Binary files differ)


Property changes on: branches/JCA/build/kit-jboss-container/deploy/teiid-connector-metadata.rar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/JCA/build/kit-jboss-container/deploy/teiid-runtime-ds.xml
===================================================================
--- branches/JCA/build/kit-jboss-container/deploy/teiid-runtime-ds.xml	                        (rev 0)
+++ branches/JCA/build/kit-jboss-container/deploy/teiid-runtime-ds.xml	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<connection-factories>
+
+    <no-tx-connection-factory>
+      <jndi-name>index-connector-binding</jndi-name>
+      <rar-name>teiid-connector-metadata.rar</rar-name>
+      <connection-definition>org.teiid.connector.api.Connector</connection-definition>
+      <max-pool-size>20</max-pool-size>
+    </no-tx-connection-factory>
+    
+    <no-tx-connection-factory>
+      <jndi-name>teiid-runtime-engine</jndi-name>
+      <rar-name>teiid-runtime.rar</rar-name>
+      <connection-definition>com.metamatrix.common.comm.api.ServerConnectionFactory</connection-definition>
+      <config-property name="DeployPropertiesFile" type="java.lang.String">/home/rareddy/teiid/teiid-6.3.0/deploy.properties</config-property>
+      <config-property name="TeiidHome" type="java.lang.String">/home/rareddy/teiid/teiid-6.3.0/</config-property>
+
+      <max-pool-size>20</max-pool-size>
+      <!-- security-domain-and-application>teiid-realm</security-domain-and-application--> 
+    </no-tx-connection-factory>
+    
+</connection-factories>


Property changes on: branches/JCA/build/kit-jboss-container/deploy/teiid-runtime-ds.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: branches/JCA/build/kit-jboss-container/deploy/teiid-runtime.rar
===================================================================
(Binary files differ)


Property changes on: branches/JCA/build/kit-jboss-container/deploy/teiid-runtime.rar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/JCA/build/kit-jboss-container/deploy/teiidsources-xa-ds.xml
===================================================================
--- branches/JCA/build/kit-jboss-container/deploy/teiidsources-xa-ds.xml	                        (rev 0)
+++ branches/JCA/build/kit-jboss-container/deploy/teiidsources-xa-ds.xml	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ===================================================================== -->
+<!--                                                                       -->
+<!--  JBoss DataSource Configuration                                       -->
+<!--                                                                       -->
+<!-- ===================================================================== -->
+
+<!-- $Id: derby-xa-ds.xml 77479 2008-08-26 10:33:09Z alex.loubyansky at jboss.com $ -->
+
+<datasources>
+   <xa-datasource>
+      <jndi-name>DerbyDS</jndi-name>
+
+      <!-- uncomment to enable interleaving <interleaving/> -->
+
+        <isSameRM-override-value>false</isSameRM-override-value>
+        <xa-datasource-class>org.apache.derby.jdbc.ClientXADataSource</xa-datasource-class>
+        <xa-datasource-property name="DatabaseName">teiid/txntest</xa-datasource-property>
+        <xa-datasource-property name="User">rareddy</xa-datasource-property>
+        <xa-datasource-property name="Password">mm</xa-datasource-property>
+        <xa-datasource-property name="PortNumber">1527</xa-datasource-property>
+        <xa-datasource-property name="ServerName">localhost</xa-datasource-property>
+
+        <track-connection-by-tx>true</track-connection-by-tx>
+        <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
+
+        <max-pool-size>5</max-pool-size>
+        <min-pool-size>1</min-pool-size>
+      <metadata>
+         <type-mapping>Derby</type-mapping>
+      </metadata>
+   </xa-datasource>
+
+    <xa-datasource>
+        <jndi-name>MySQLDS</jndi-name>
+
+        <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
+        <xa-datasource-property name="DatabaseName">txntest</xa-datasource-property>
+        <xa-datasource-property name="PortNumber">3306</xa-datasource-property>
+        <xa-datasource-property name="ServerName">localhost</xa-datasource-property>
+        <user-name>rareddy</user-name>
+        <password>mm</password>
+
+        <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
+
+        <max-pool-size>5</max-pool-size>
+        <min-pool-size>1</min-pool-size>
+
+        <blocking-timeout-millis>2000</blocking-timeout-millis>
+        <idle-timeout-minutes>2</idle-timeout-minutes>
+        <track-connection-by-tx>true</track-connection-by-tx>
+        <new-connection-sql>set autocommit=1</new-connection-sql>
+        <no-tx-separate-pools>true</no-tx-separate-pools>
+        <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
+      <metadata>
+         <type-mapping>mySQL</type-mapping>
+      </metadata>
+    </xa-datasource>
+
+
+</datasources>


Property changes on: branches/JCA/build/kit-jboss-container/deploy/teiidsources-xa-ds.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: branches/JCA/build/pom.xml
===================================================================
--- branches/JCA/build/pom.xml	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/build/pom.xml	2009-11-02 19:41:28 UTC (rev 1544)
@@ -10,6 +10,7 @@
   <packaging>pom</packaging>
   <name>Build</name>
   <description>Teiid Build</description>
+  <!-- 
     <build>
         <plugins>
             <plugin>
@@ -24,7 +25,6 @@
                         </goals>
                         <configuration>
                             <artifactItems>
-                                <!--  addition of a new connector goes here as an bundle -->
                                 <artifactItem>
                                     <groupId>org.jboss.teiid</groupId>
                                     <artifactId>teiid-connector-api</artifactId>
@@ -115,4 +115,5 @@
             </plugin>
         </plugins>
     </build>
+     -->
 </project>
\ No newline at end of file

Added: branches/JCA/build.xml
===================================================================
--- branches/JCA/build.xml	                        (rev 0)
+++ branches/JCA/build.xml	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,11 @@
+<project name="jboss-jca-spec-api" default="deploy" basedir=".">
+
+  <property name="jboss-as" value="/home/rareddy/apps/jboss-5.1.0.GA/server/default"/>
+  <property name="version" value="6.3.0-SNAPSHOT"/>
+  <property name="kit-dir" value="${basedir}/target/distribution"/>
+	
+  <target name="deploy">  	
+	<unzip dest="${jboss-as}" src="${kit-dir}/teiid-${version}-jboss-dist.zip" overwrite="true">
+	</unzip>  	
+  </target>
+</project>


Property changes on: branches/JCA/build.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: branches/JCA/cache-jbosscache/pom.xml
===================================================================
--- branches/JCA/cache-jbosscache/pom.xml	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/cache-jbosscache/pom.xml	2009-11-02 19:41:28 UTC (rev 1544)
@@ -19,9 +19,5 @@
 			<groupId>org.jboss.cache</groupId>
 			<artifactId>jbosscache-core</artifactId>
 		</dependency>
-		<dependency>
-			<groupId>com.google.code.guice</groupId>
-			<artifactId>guice</artifactId>
-		</dependency>
 	</dependencies>
 </project>
\ No newline at end of file

Modified: branches/JCA/cache-jbosscache/src/main/java/com/metamatrix/cache/jboss/JBossCacheFactory.java
===================================================================
--- branches/JCA/cache-jbosscache/src/main/java/com/metamatrix/cache/jboss/JBossCacheFactory.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/cache-jbosscache/src/main/java/com/metamatrix/cache/jboss/JBossCacheFactory.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,11 +22,16 @@
 
 package com.metamatrix.cache.jboss;
 
+import java.util.List;
+import java.util.Properties;
+
+import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.Node;
 import org.jboss.cache.Region;
 import org.jboss.cache.config.EvictionAlgorithmConfig;
 import org.jboss.cache.config.EvictionRegionConfig;
+import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
 import org.jboss.cache.eviction.FIFOAlgorithmConfig;
 import org.jboss.cache.eviction.LFUAlgorithmConfig;
 import org.jboss.cache.eviction.LRUAlgorithmConfig;
@@ -44,6 +49,7 @@
 import com.metamatrix.common.util.JMXUtil;
 import com.metamatrix.common.util.JMXUtil.FailedToRegisterException;
 import com.metamatrix.core.MetaMatrixRuntimeException;
+import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
 
 @Singleton
 public class JBossCacheFactory implements CacheFactory {
@@ -52,11 +58,17 @@
 	private volatile boolean destroyed = false;
 	JmxRegistrationManager jmxManager;
 	
+	private Properties props;
+	
 	@Inject
-	public JBossCacheFactory(org.jboss.cache.Cache cacheStore, @Named("jmx") JMXUtil jmx) {
-		this.cacheStore =  cacheStore;
+	public JBossCacheFactory(@Named("jmx") JMXUtil jmx, @Named("DQPProperties") Properties props) {
+		
+		this.props = props;
+		
+		if (this.cacheStore == null) {
+			this.cacheStore =  initCache();
+		}
 		try {
-			this.cacheStore =  cacheStore;
 			jmxManager = new JmxRegistrationManager(jmx.getMBeanServer(), cacheStore, jmx.buildName(JMXUtil.MBeanType.SERVICE, NAME));
 			jmxManager.registerAllMBeans();
 		} catch (FailedToRegisterException e) {
@@ -64,6 +76,18 @@
 		}
 	}
 
+	private org.jboss.cache.Cache initCache() {
+		org.jboss.cache.Cache cache = new DefaultCacheFactory().createCache("jboss-cache-configuration.xml", false); //$NON-NLS-1$
+		List<IndividualCacheLoaderConfig> configs = cache.getConfiguration().getCacheLoaderConfig().getIndividualCacheLoaderConfigs();
+		Properties p = configs.get(0).getProperties();
+		String workspaceDir = this.props.getProperty(DQPEmbeddedProperties.DQP_WORKDIR);
+		p.setProperty("location", workspaceDir + "/cache"); //$NON-NLS-1$ //$NON-NLS-2$
+		configs.get(0).setProperties(p);
+		cache.create();
+		cache.start();
+		return cache;
+	}	
+	
 	/**
 	 * {@inheritDoc}
 	 */

Modified: branches/JCA/client/src/main/java/com/metamatrix/admin/objects/TransactionImpl.java
===================================================================
--- branches/JCA/client/src/main/java/com/metamatrix/admin/objects/TransactionImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/client/src/main/java/com/metamatrix/admin/objects/TransactionImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -35,7 +35,6 @@
 	private String associatedSession;
 	private String scope;
 	private MMXid xid;
-	private String status;
 	
 	public TransactionImpl(String ... id) {
 		super(id);
@@ -65,21 +64,12 @@
 		this.xid = xid;
 	}
 
-	public String getStatus() {
-		return status;
-	}
-
-	public void setStatus(String status) {
-		this.status = status;
-	}
-
 	@Override
 	public String toString() {
         StringBuffer result = new StringBuffer();
         result.append(AdminPlugin.Util.getString("TransactionImpl.identifier")).append(getIdentifier());  //$NON-NLS-1$
         result.append(AdminPlugin.Util.getString("TransactionImpl.associatedSession")).append(associatedSession); //$NON-NLS-1$
         result.append(AdminPlugin.Util.getString("TransactionImpl.scope")).append(scope); //$NON-NLS-1$
-        result.append(AdminPlugin.Util.getString("TransactionImpl.status")).append(status); //$NON-NLS-1$
         result.append(AdminPlugin.Util.getString("TransactionImpl.xid")).append(xid); //$NON-NLS-1$
         return result.toString();
 	}

Modified: branches/JCA/client/src/main/java/com/metamatrix/common/api/MMURL.java
===================================================================
--- branches/JCA/client/src/main/java/com/metamatrix/common/api/MMURL.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/client/src/main/java/com/metamatrix/common/api/MMURL.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -45,8 +45,6 @@
 	    public static final String VDB_VERSION = "VirtualDatabaseVersion"; //$NON-NLS-1$
 	    // constant for vdb version part of serverURL
 	    public static final String VERSION = "version"; //$NON-NLS-1$
-
-	    public static final String CREDENTIALS = "credentials"; //$NON-NLS-1$
 	}
 
 	public static interface CONNECTION {
@@ -83,7 +81,6 @@
 		public static final String USER_NAME = "user"; //$NON-NLS-1$
 		// constant for password part of url
 		public static final String PASSWORD = "password"; //$NON-NLS-1$
-		public static final String CLIENT_TOKEN_PROP = "clientToken"; //$NON-NLS-1$ 
 	}
 
 	public static final String DOT_DELIMITER = "."; //$NON-NLS-1$

Modified: branches/JCA/client/src/main/java/com/metamatrix/common/comm/api/ServerConnection.java
===================================================================
--- branches/JCA/client/src/main/java/com/metamatrix/common/comm/api/ServerConnection.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/client/src/main/java/com/metamatrix/common/comm/api/ServerConnection.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -31,7 +31,7 @@
 
 	<T> T getService(Class<T> iface);
 	
-	void shutdown();
+	void close();
 	
 	boolean isOpen();
 	

Modified: branches/JCA/client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionFactory.java
===================================================================
--- branches/JCA/client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionFactory.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/client/src/main/java/com/metamatrix/common/comm/api/ServerConnectionFactory.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -41,7 +41,7 @@
      * @throws CommunicationException If an error occurs in connecting, typically due to 
      * problems with the connection properties (bad user name, bad password, bad host name, etc)
      */
-	ServerConnection createConnection(Properties connectionProperties) throws CommunicationException, ConnectionException;
+	ServerConnection getConnection(Properties connectionProperties) throws CommunicationException, ConnectionException;
 
 	
 	/**

Modified: branches/JCA/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java
===================================================================
--- branches/JCA/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -63,7 +63,7 @@
     	
     	public ReconnectingProxy(Properties p) throws ConnectionException, CommunicationException {
     		this.p = p;
-    		this.registry = serverConnectionFactory.createConnection(p);
+    		this.registry = serverConnectionFactory.getConnection(p);
 		}
     	
     	private synchronized Admin getTarget() throws AdminComponentException, CommunicationException {
@@ -74,7 +74,7 @@
     			return target;
     		}
     		try {
-    			registry = serverConnectionFactory.createConnection(p);
+    			registry = serverConnectionFactory.getConnection(p);
     		} catch (ConnectionException e) {
     			throw new AdminComponentException(e.getMessage());
     		}
@@ -119,7 +119,7 @@
 			}
 			this.closed = true;
 			if (registry != null) {
-				registry.shutdown();
+				registry.close();
 			}
 		}
 		

Modified: branches/JCA/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java
===================================================================
--- branches/JCA/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -110,7 +110,7 @@
     				} catch (InvalidSessionException e) {
     					shutdown(false);
     				} catch (MetaMatrixComponentException e) {
-    					shutdown();
+    					close();
     				} 
     				this.cancel();
     			}
@@ -244,7 +244,7 @@
 	public <T> T getService(Class<T> iface) {
 		return (T)Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] {iface}, new ServerConnectionInvocationHandler(iface));
 	}
-	public synchronized void shutdown() {
+	public synchronized void close() {
 		shutdown(true);
 	}
 	private synchronized void shutdown(boolean logoff) {

Modified: branches/JCA/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java
===================================================================
--- branches/JCA/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -237,7 +237,7 @@
 	/**
 	 * @param connectionProperties will be updated with additional information before logon
 	 */
-	public SocketServerConnection createConnection(Properties connectionProperties) throws CommunicationException, ConnectionException {
+	public SocketServerConnection getConnection(Properties connectionProperties) throws CommunicationException, ConnectionException {
 		
 		updateConnectionProperties(connectionProperties);
 		

Deleted: branches/JCA/client/src/main/java/com/metamatrix/dqp/internal/datamgr/ConnectorID.java
===================================================================
--- branches/JCA/client/src/main/java/com/metamatrix/dqp/internal/datamgr/ConnectorID.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/client/src/main/java/com/metamatrix/dqp/internal/datamgr/ConnectorID.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,86 +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.dqp.internal.datamgr;
-
-import java.io.Serializable;
-
-/**
- * Used to uniquely identify a connector.
- */
-public class ConnectorID implements Serializable {
-    private static final long serialVersionUID = -3507451286236400399L;
-
-    private String id;
-
-    /**
-     * Construct a new instance.
-     */
-    public ConnectorID(String id) {
-        this.id = id;
-    }
-
-    /**
-     * Return the id that identifies this connector instance.
-     * @return Unique ID for the connector
-     */
-    public String getID() {
-        return id;
-    }
-
-    /**
-     * Compare two ConnectorID's for equality.
-     * Return true if instanceName == instanceName and
-     * serviceName == serviceName.
-     * @param obj ConnectorID to compare to.
-     * @return true if ConnectorID's are equal
-     */
-    public boolean equals(Object obj) {
-
-    	// Quick same object test
-    	if(this == obj) {
-    		return true;
-		}
-    	
-    	if (!(obj instanceof ConnectorID)) {
-    		return false;
-    	}
-
-        ConnectorID other = (ConnectorID) obj;
-
-        // compare service name
-        return getID().equals(other.getID());
-    }
-
-    public int hashCode() {
-        return this.id.hashCode();
-    }
-
-    /**
-     * Return a String representation of this instance.
-     */
-    public String toString() {
-        return "ConnectorID<"+getID()+">"; //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-}
-

Deleted: branches/JCA/client/src/main/java/com/metamatrix/jdbc/api/ConnectionProperties.java
===================================================================
--- branches/JCA/client/src/main/java/com/metamatrix/jdbc/api/ConnectionProperties.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/client/src/main/java/com/metamatrix/jdbc/api/ConnectionProperties.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,80 +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.jdbc.api;
-
-import com.metamatrix.common.api.MMURL;
-
-
-/**
- * MetaMatrix-specific connection properties.  These connection properties can 
- * be set via the java.sql.DriverManager.getConnection(jdbcUrl, connectionProps)
- * method.
- *    
- * WARNING: This class does not contain all possible properties.
- */
-public interface ConnectionProperties {
-
-    // constant defined for connection properties indicating the value is a Serializable token
-    // that may be used in the connector for this client's requests
-    
-    /** 
-     * Connection property name for trusted session payload.
-     * The <i>optional</i> client token that will be passed directly through to connectors,
-     * which may use it and/or pass it down to their underlying data source.
-     * <p>
-     * The form and type of the client payload object is up to the client but it <i>must</i>
-     * implement the <code>Serializable</code> interface.  MetaMatrix does nothing with this 
-     * object except to make it available for authentication/augmentation/replacement upon 
-     * authentication to the system and to connectors that may require it at the data source 
-     * level.</p> 
-     */
-    public static final String PROP_CLIENT_SESSION_PAYLOAD = MMURL.CONNECTION.CLIENT_TOKEN_PROP;
-
-    /**
-     * <p>Data source credential sets.  The credentials will be decoded and passed in a 
-     * CredentialMap object as the session payload.  It is an error to use this property
-     * in conjunction with {@link #PROP_CLIENT_SESSION_PAYLOAD} as the CredentialMap
-     * is used as the payload.  If a per-user connection factory is used with the 
-     * ConnectionPool in the Connector API, the CredentialMap can be used to obtain
-     * per-system credentials and use per-user connection pooling.  In particular, the 
-     * MetaMatrix JDBC Connectors have pre-built connection factories that can be 
-     * used with credentials for this purpose. </p>
-     * 
-     * <p>Credentials take the following basic form: <code>credentials=(system=sys1,user=u1,password=p1/
-     * system=sys2,user=u2,password=p2)</code>.  Each set of system credentials <b>must</b>
-     * contain a system property.  The properties "user" and "password" are also well-known
-     * property names used by the connection factory although any property name is allowed
-     * and may be used by a connector to extract credentials.</>
-     * 
-     * <p>Additionally, the credentials property allows an additional attribute before the 
-     * credentials list: <code>defaultToLogon</code> as follows:  <code>credentials=defaultToLogon</code
-     * or <code>credentials=defaultToLogon,(system=sys1,user=u1,password=p2)</code>.  When this attribute
-     * is used, the user's logon credentials are used as defaults when a connector asks for 
-     * credentials from the CredentialMap.
-     * </p>
-     */
-    public static final String PROP_CREDENTIALS = MMURL.JDBC.CREDENTIALS;
-    
-    public static final String DEFAULT_TO_LOGON = "defaultToLogon"; //$NON-NLS-1$
-
-}

Modified: branches/JCA/client/src/main/java/com/metamatrix/platform/security/api/SessionToken.java
===================================================================
--- branches/JCA/client/src/main/java/com/metamatrix/platform/security/api/SessionToken.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/client/src/main/java/com/metamatrix/platform/security/api/SessionToken.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -25,6 +25,8 @@
 import java.io.Serializable;
 import java.util.UUID;
 
+import javax.security.auth.Subject;
+
 /**
  * This class is an immutable identifier for a unique session that also
  * maintains the name of the principal for that session.
@@ -98,6 +100,11 @@
 		return this.userName;
 	}
 
+	public Subject getSubject() {
+		// TODO: this need to be mapped with subject created.
+		return null;
+	}
+	
 	/**
 	 * Returns true if the specified object is semantically equal to this
 	 * instance. Note: this method is consistent with <code>compareTo()</code>.

Modified: branches/JCA/client/src/main/java/org/teiid/adminapi/SecurityAdmin.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/SecurityAdmin.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/client/src/main/java/org/teiid/adminapi/SecurityAdmin.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -127,21 +127,6 @@
     char[] exportDataRoles(String vdbName, String vdbVersion) throws AdminException;
     
     /**
-     * Authenticate a user with the specified user name and credentials
-     * for use with the specified application. The application name may also
-     * be used by the Membership Service to determine the appropriate authentication
-     * mechanism.
-     * @param username the user name that is to be authenticated
-     * @param credential
-     * @param trustePayload
-     * @param applicationName the name of the application for which the user
-     * is authenticating
-     * @return true if the authentication is successful
-     * @throws AdminException
-     */
-    boolean authenticateUser(String username, char[] credentials, Serializable trustePayload, String applicationName) throws AdminException;
-    
-    /**
      * Returns the active authorization provider domain names, in authentication order.
      * @return List<String>
      * @throws AdminException

Modified: branches/JCA/client/src/main/java/org/teiid/adminapi/Transaction.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/Transaction.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/client/src/main/java/org/teiid/adminapi/Transaction.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -47,12 +47,6 @@
 	 */
 	Xid getXid();
 	
-	/**
-	 * Get the current status.  See {@link javax.transaction.Status} for
-	 * possible values.
-	 * @return
-	 */
-	String getStatus();
 	
 	/**
 	 * Get the date the transaction was created.

Modified: branches/JCA/client/src/test/java/com/metamatrix/common/comm/platform/client/TestSeverAdminFactory.java
===================================================================
--- branches/JCA/client/src/test/java/com/metamatrix/common/comm/platform/client/TestSeverAdminFactory.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/client/src/test/java/com/metamatrix/common/comm/platform/client/TestSeverAdminFactory.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -47,7 +47,7 @@
 		Admin sa = mock(Admin.class);
 		stubVoid(sa).toThrow(new AdminComponentException(new SingleInstanceCommunicationException())).on().restart();
 		stub(sc.getService(Admin.class)).toReturn(sa);
-		stub(scf.createConnection((Properties)anyObject())).toReturn(sc);
+		stub(scf.getConnection((Properties)anyObject())).toReturn(sc);
 		
 		ServerAdminFactory saf = new ServerAdminFactory(scf, 1);
 		Admin admin = saf.createAdmin("foo", "bar".toCharArray(), "mm://test:1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

Modified: branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/BaseDataSource.java
===================================================================
--- branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/BaseDataSource.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/BaseDataSource.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -23,7 +23,6 @@
 package com.metamatrix.jdbc;
 
 import java.io.PrintWriter;
-import java.io.Serializable;
 import java.sql.Connection;
 import java.sql.SQLException;
 import java.text.MessageFormat;
@@ -141,18 +140,6 @@
      */
     private String description;
 
-    /**
-     * The <code>Serializable</code> client token that will be passed directly
-     * through to the connectors, which may use it and/or pass it down to their underlying data source.
-     * This property is <i>optional</i>.
-     * <p>
-     * The form and type of the client token is up to the client but it <i>must</i> implement the
-     * <code>Serializabe</code> interface.  MetaMatrix does nothing with this token except to make it
-     * available for authentication/augmentation/replacement upon authentication to the system and to
-     * connectors that may require it at the data source level.
-     * </p>
-     */
-    private Serializable clientToken;
 
     /**
      * The user's name.
@@ -321,12 +308,6 @@
             props.setProperty(BaseDataSource.APP_NAME,this.getApplicationName());
         }
         
-        Serializable token = this.getClientToken();
-        if ( token != null ) {
-            // Special case: token is a Serializable, not necessarily a String
-            props.put(MMURL.CONNECTION.CLIENT_TOKEN_PROP, token);
-        }
-
         if (this.getPartialResultsMode() != null && this.getPartialResultsMode().trim().length() != 0) {
             props.setProperty(ExecutionProperties.PROP_PARTIAL_RESULTS_MODE, this.getPartialResultsMode());
         }
@@ -364,11 +345,6 @@
             throw new SQLException(reason);
         }
 
-        reason = reasonWhyInvalidClientToken(this.clientToken);
-        if ( reason != null ) {
-            throw new SQLException(reason);
-        }
-
         reason = reasonWhyInvalidDatabaseName(this.databaseName);
         if ( reason != null ) {
             throw new SQLException(reason);
@@ -600,22 +576,6 @@
     }
 
     /**
-     * Get the <code>Serializable</code> client token that will be passed directly
-     * through to the connectors, which may use it and/or pass it down to their underlying data source.
-     * This property is <i>optional</i>.
-     * <p>
-     * The form and type of the client token is up to the client but it <i>must</i> implement the
-     * <code>Serializabe</code> interface.  MetaMatrix does nothing with this token except to make it
-     * available for authentication/augmentation/replacement upon authentication to the system and to
-     * connectors that may require it at the data source level.
-     * </p>
-     * @return The client token that was supplied by the client at system connection time; may be <code>null</code>.
-     */
-    public Serializable getClientToken() {
-        return clientToken;
-    }
-
-    /**
      * Sets the name of the application.  Supplying this property may allow an administrator of a
      * MetaMatrix Server to better identify individual connections and usage patterns.
      * This property is <i>optional</i>.
@@ -668,22 +628,6 @@
     }
 
     /**
-     * Set the <code>Serializable</code> client token that will be passed directly
-     * through to the connectors, which may use it and/or pass it down to their underlying data source.
-     * This property is <i>optional</i>.
-     * <p>
-     * The form and type of the client token is up to the client but it <i>must</i> implement the
-     * <code>Serializabe</code> interface.  MetaMatrix does nothing with this token except to make it
-     * available for authentication/augmentation/replacement upon authentication to the system and to
-     * connectors that may require it at the data source level.
-     * </p>
-     * @param clientToken The client token that will be passed with this user's requests.
-     */
-    public void setClientToken(Serializable clientToken) {
-        this.clientToken = clientToken;
-    }
-
-    /**
      * Sets the description of this data source.
      * @param description The description for this data source; may be null
      */
@@ -802,17 +746,8 @@
         return null;        // anything is valid
     }
 
-    /**
-     * Return the reason why the supplied client token may be invalid, or null
-     * if it is considered valid.
-     * @param clientToken a possible value for the property
-     * @return the reason why the property is invalid, or null if it is considered valid
-     * @see #setClientToken(Serializable)
-     */
-    public static String reasonWhyInvalidClientToken(final Serializable clientToken) {
-        return null;        // it is optional
-    }
 
+
     /**
      * Return the reason why the supplied virtual database name may be invalid, or null
      * if it is considered valid.

Modified: branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java
===================================================================
--- branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -221,7 +221,7 @@
                 String key = (String)enumeration.nextElement();
                 Object anObj = info.get(key);
                 // Log each property except for password and token.
-                if (!MMURL.JDBC.CREDENTIALS.equalsIgnoreCase(key) && !MMURL.CONNECTION.PASSWORD.equalsIgnoreCase(key) && !MMURL.CONNECTION.CLIENT_TOKEN_PROP.equalsIgnoreCase(key)) { 
+                if (!MMURL.CONNECTION.PASSWORD.equalsIgnoreCase(key)) { 
                     logger.fine(key+"="+anObj); //$NON-NLS-1$
                 }
             }
@@ -293,7 +293,7 @@
         	} catch (SQLException se) {
         		firstException = se;
         	} finally {
-        		this.serverConn.shutdown();
+        		this.serverConn.close();
                 if ( firstException != null )
                 	throw (SQLException)firstException;
         	}

Modified: branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDataSource.java
===================================================================
--- branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDataSource.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDataSource.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -68,11 +68,6 @@
      */
     private String serverName;
      
-    /**
-     * Specify a set of data source credentials to pass to the connectors as defined in 
-     * {@link MMURL.JDBC.CREDENTIALS}.  
-     */
-    private String credentials; 
     
     /**
      * Specify whether to make a secure (SSL, mms:) connection or a normal non-SSL mm: connection.
@@ -115,10 +110,6 @@
             props.setProperty(MMURL.CONNECTION.AUTO_FAILOVER, this.getAutoFailover());
         }
         
-        if (this.getCredentials() != null) {
-            props.setProperty(MMURL.JDBC.CREDENTIALS, this.getCredentials());
-        }
-        
         if (this.getDiscoveryStrategy() != null) {
         	props.setProperty(MMURL.CONNECTION.DISCOVERY_STRATEGY, this.getDiscoveryStrategy());
         }
@@ -248,14 +239,6 @@
     }
     
     /**
-     * Returns the credentials string defining credentials to use with connectors for per-user logon.
-     * @since 4.3.2
-     */
-    public String getCredentials() {
-        return credentials;
-    }
-    
-    /**
      * Returns a flag indicating whether to create a secure connection or not. 
      * @return True if using secure mms: protocol, false for normal mm: protocol.
      * @since 5.0.2
@@ -297,14 +280,6 @@
     }
     
     /**
-     * Sets the credentials string defining credentials to use with connectors for per-user logon.
-     * @since 4.3.2
-     */
-    public void setCredentials(final String credentials) {
-        this.credentials = credentials;
-    }
-    
-    /**
      * Sets the secure flag to use mms: protocol instead of the default mm: protocol. 
      * @param secure True to use mms:
      * @since 5.0.2

Modified: branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDriver.java
===================================================================
--- branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDriver.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDriver.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -43,7 +43,6 @@
 import com.metamatrix.common.util.ApplicationInfo;
 import com.metamatrix.common.util.PropertiesUtils;
 import com.metamatrix.core.MetaMatrixCoreException;
-import com.metamatrix.jdbc.api.ConnectionProperties;
 import com.metamatrix.jdbc.util.MMJDBCURL;
 
 /**
@@ -140,7 +139,7 @@
     MMConnection createMMConnection(String url, Properties info)
         throws ConnectionException, CommunicationException {
 
-        ServerConnection serverConn = SocketServerConnectionFactory.getInstance().createConnection(info);
+        ServerConnection serverConn = SocketServerConnectionFactory.getInstance().getConnection(info);
 
         // construct a MMConnection object.
         MMConnection connection = new MMConnection(serverConn, info, url);
@@ -238,7 +237,6 @@
         dpis.add(dpi);
         dpis.add(new DriverPropertyInfo(BaseDataSource.USER_NAME, info.getProperty(BaseDataSource.USER_NAME)));
         dpis.add(new DriverPropertyInfo(BaseDataSource.PASSWORD, info.getProperty(BaseDataSource.PASSWORD)));
-        dpis.add(new DriverPropertyInfo(ConnectionProperties.PROP_CLIENT_SESSION_PAYLOAD, info.getProperty(BaseDataSource.PASSWORD)));
         return dpis;
     }
     

Modified: branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMStatement.java
===================================================================
--- branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMStatement.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMStatement.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -434,6 +434,15 @@
             for (int i = 0; i < results.length; i++) {
             	updateCounts[i] = (Integer)results[i].get(0);
             }
+            
+            // In update scenarios close the statement implicitly
+            try {
+				getDQP().closeRequest(getCurrentRequestID());
+			} catch (MetaMatrixProcessingException e) {
+				throw MMSQLException.create(e);
+			} catch (MetaMatrixComponentException e) {
+				throw MMSQLException.create(e);
+			}            
         } else {
             createResultSet(resultsMsg);
         }

Modified: branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/util/MMJDBCURL.java
===================================================================
--- branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/util/MMJDBCURL.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/util/MMJDBCURL.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -31,7 +31,6 @@
 
 import com.metamatrix.common.api.MMURL;
 import com.metamatrix.jdbc.BaseDataSource;
-import com.metamatrix.jdbc.api.ConnectionProperties;
 import com.metamatrix.jdbc.api.ExecutionProperties;
 
 
@@ -59,8 +58,6 @@
         ExecutionProperties.PROP_XML_FORMAT,
         ExecutionProperties.PROP_XML_VALIDATION,
         ExecutionProperties.DISABLE_LOCAL_TRANSACTIONS,
-        ConnectionProperties.PROP_CLIENT_SESSION_PAYLOAD,
-        ConnectionProperties.PROP_CREDENTIALS,
         MMURL.CONNECTION.AUTO_FAILOVER,
         MMURL.CONNECTION.DISCOVERY_STRATEGY,
         MMURL.CONNECTION.SHUTDOWN

Modified: branches/JCA/client-jdbc/src/main/java/org/teiid/jdbc/EmbeddedProfile.java
===================================================================
--- branches/JCA/client-jdbc/src/main/java/org/teiid/jdbc/EmbeddedProfile.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/client-jdbc/src/main/java/org/teiid/jdbc/EmbeddedProfile.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -433,7 +433,7 @@
                 current = Thread.currentThread().getContextClassLoader();             
                 Thread.currentThread().setContextClassLoader(classLoader);       
                 try {
-					ServerConnection conn = connectionFactory.createConnection(info);
+					ServerConnection conn = connectionFactory.getConnection(info);
 					return new MMConnection(conn, info, url.toExternalForm());
 				} catch (CommunicationException e) {
 					throw MMSQLException.create(e);

Modified: branches/JCA/client-jdbc/src/main/java/org/teiid/jdbc/SocketProfile.java
===================================================================
--- branches/JCA/client-jdbc/src/main/java/org/teiid/jdbc/SocketProfile.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/client-jdbc/src/main/java/org/teiid/jdbc/SocketProfile.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -105,7 +105,7 @@
     static MMConnection createConnection(String url, Properties info)
         throws ConnectionException, CommunicationException {
 
-        ServerConnection serverConn = SocketServerConnectionFactory.getInstance().createConnection(info);
+        ServerConnection serverConn = SocketServerConnectionFactory.getInstance().getConnection(info);
 
         // construct a MMConnection object.
         MMConnection connection = new MMConnection(serverConn, info, url);

Modified: branches/JCA/client-jdbc/src/main/java/org/teiid/jdbc/TeiidDataSource.java
===================================================================
--- branches/JCA/client-jdbc/src/main/java/org/teiid/jdbc/TeiidDataSource.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/client-jdbc/src/main/java/org/teiid/jdbc/TeiidDataSource.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -75,12 +75,6 @@
     private String serverName;
      
     /**
-     * Specify a set of data source credentials to pass to the connectors as defined in 
-     * {@link MMURL.JDBC.CREDENTIALS}.  
-     */
-    private String credentials; 
-    
-    /**
      * Specify whether to make a secure (SSL, mms:) connection or a normal non-SSL mm: connection.
      * the default is to use a non-secure connection.
      * @since 5.0.2
@@ -121,10 +115,6 @@
             props.setProperty(MMURL.CONNECTION.AUTO_FAILOVER, this.getAutoFailover());
         }
         
-        if (this.getCredentials() != null) {
-            props.setProperty(MMURL.JDBC.CREDENTIALS, this.getCredentials());
-        }
-        
         if (this.getDiscoveryStrategy() != null) {
         	props.setProperty(MMURL.CONNECTION.DISCOVERY_STRATEGY, this.getDiscoveryStrategy());
         }
@@ -287,14 +277,6 @@
     }
     
     /**
-     * Returns the credentials string defining credentials to use with connectors for per-user logon.
-     * @since 4.3.2
-     */
-    public String getCredentials() {
-        return credentials;
-    }
-    
-    /**
      * Returns a flag indicating whether to create a secure connection or not. 
      * @return True if using secure mms: protocol, false for normal mm: protocol.
      * @since 5.0.2
@@ -336,14 +318,6 @@
     }
     
     /**
-     * Sets the credentials string defining credentials to use with connectors for per-user logon.
-     * @since 4.3.2
-     */
-    public void setCredentials(final String credentials) {
-        this.credentials = credentials;
-    }
-    
-    /**
      * Sets the secure flag to use mms: protocol instead of the default mm: protocol. 
      * @param secure True to use mms:
      * @since 5.0.2

Modified: branches/JCA/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMDriver.java
===================================================================
--- branches/JCA/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMDriver.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMDriver.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -128,7 +128,7 @@
     public void testGetPropertyInfo1() throws Exception {        
         DriverPropertyInfo info[] = drv.getPropertyInfo("jdbc:metamatrix:vdb at mm://localhost:12345", null); //$NON-NLS-1$
 
-        assertEquals(6, info.length);
+        assertEquals(5, info.length);
         assertEquals(true, info[0].required);
         assertEquals("VirtualDatabaseName", info[0].name); //$NON-NLS-1$
         assertEquals("vdb", info[0].value); //$NON-NLS-1$

Modified: branches/JCA/client-jdbc/src/test/java/com/metamatrix/jdbc/util/TestMMJDBCURL.java
===================================================================
--- branches/JCA/client-jdbc/src/test/java/com/metamatrix/jdbc/util/TestMMJDBCURL.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/client-jdbc/src/test/java/com/metamatrix/jdbc/util/TestMMJDBCURL.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -29,7 +29,6 @@
 
 import com.metamatrix.common.api.MMURL;
 import com.metamatrix.jdbc.BaseDataSource;
-import com.metamatrix.jdbc.api.ConnectionProperties;
 import com.metamatrix.jdbc.api.ExecutionProperties;
 
 
@@ -265,7 +264,6 @@
         MMJDBCURL.normalizeProperties(props);
         assertEquals("myuser", props.getProperty(BaseDataSource.USER_NAME)); //$NON-NLS-1$
         assertEquals("mypassword", props.getProperty(BaseDataSource.PASSWORD)); //$NON-NLS-1$
-        assertEquals(new Integer(1), props.get(ConnectionProperties.PROP_CLIENT_SESSION_PAYLOAD));
     }
     
     public final void testEncodedPropertyProperties() throws Exception {

Modified: branches/JCA/client-jdbc/src/test/java/org/teiid/jdbc/TestTeiidDriver.java
===================================================================
--- branches/JCA/client-jdbc/src/test/java/org/teiid/jdbc/TestTeiidDriver.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/client-jdbc/src/test/java/org/teiid/jdbc/TestTeiidDriver.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -35,7 +35,7 @@
     
     @Test public void testGetPropertyInfo1() throws Exception {        
         DriverPropertyInfo info[] = drv.getPropertyInfo("jdbc:teiid:vdb at mm://localhost:12345", null); //$NON-NLS-1$
-        assertEquals(20, info.length);
+        assertEquals(18, info.length);
     }
     
     @Test public void testAccepts() throws Exception {

Modified: branches/JCA/common-core/src/main/java/com/metamatrix/core/util/StringUtil.java
===================================================================
--- branches/JCA/common-core/src/main/java/com/metamatrix/core/util/StringUtil.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/common-core/src/main/java/com/metamatrix/core/util/StringUtil.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -880,6 +880,9 @@
     public static boolean isLetterOrDigit(char c) {
         return isBasicLatinLetter(c) || isBasicLatinDigit(c) || Character.isLetterOrDigit(c);
     }
+    public static boolean isValid(String str) {
+    	return (!(str == null || str.trim().length() == 0));
+    }
     
     public static String toUpperCase(String str) {
         String newStr = convertBasicLatinToUpper(str);

Modified: branches/JCA/common-internal/pom.xml
===================================================================
--- branches/JCA/common-internal/pom.xml	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/common-internal/pom.xml	2009-11-02 19:41:28 UTC (rev 1544)
@@ -54,6 +54,11 @@
           <artifactId>guice</artifactId>
         </dependency>  
         
+        <dependency>
+          <groupId>javax.resource</groupId>
+          <artifactId>connector-api</artifactId>
+          <scope>provided</scope>
+        </dependency>        
 	</dependencies>
 	
 </project>
\ No newline at end of file

Added: branches/JCA/common-internal/src/main/java/com/metamatrix/common/queue/StatsCapturingWorkManager.java
===================================================================
--- branches/JCA/common-internal/src/main/java/com/metamatrix/common/queue/StatsCapturingWorkManager.java	                        (rev 0)
+++ branches/JCA/common-internal/src/main/java/com/metamatrix/common/queue/StatsCapturingWorkManager.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,197 @@
+/*
+ * 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.common.queue;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.IdentityHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Queue;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.resource.spi.work.ExecutionContext;
+import javax.resource.spi.work.Work;
+import javax.resource.spi.work.WorkException;
+import javax.resource.spi.work.WorkListener;
+import javax.resource.spi.work.WorkManager;
+import javax.resource.spi.work.WorkRejectedException;
+
+import com.metamatrix.common.CommonPlugin;
+import com.metamatrix.common.log.LogManager;
+import com.metamatrix.common.util.LogConstants;
+import com.metamatrix.core.log.MessageLevel;
+
+public class StatsCapturingWorkManager implements WorkManager {
+	private WorkManager delegate;
+	private volatile int activeCount;
+	private volatile int highestActiveCount;
+	private volatile int highestQueueSize;
+	private volatile boolean terminated;
+	private volatile int submittedCount;
+	private volatile int completedCount;
+	private Object poolLock = new Object();
+	private AtomicInteger threadCounter = new AtomicInteger();
+	private String poolName;
+	private int maximumPoolSize;
+	private Queue<Work> queue = new LinkedList<Work>();
+	private Set<Thread> threads = Collections.synchronizedSet(Collections.newSetFromMap(new IdentityHashMap<Thread, Boolean>()));
+		
+	public StatsCapturingWorkManager(String name,WorkManager workManager, int maximumPoolSize) {
+		this.maximumPoolSize = maximumPoolSize;
+		this.poolName = name;
+		this.delegate = workManager;
+	}
+	
+	@Override
+	public void doWork(Work arg0) throws WorkException {
+		this.delegate.doWork(new StatuscapableWork(arg0));
+	}
+
+	@Override
+	public void doWork(Work arg0, long arg1, ExecutionContext arg2, WorkListener arg3) throws WorkException {
+		this.delegate.doWork(new StatuscapableWork(arg0), arg1, arg2, arg3);
+	}
+
+	@Override
+	public void scheduleWork(Work arg0) throws WorkException {
+		this.delegate.scheduleWork(new StatuscapableWork(arg0));
+	}
+
+	@Override
+	public void scheduleWork(Work arg0, long arg1, ExecutionContext arg2,WorkListener arg3) throws WorkException {
+		this.delegate.scheduleWork(new StatuscapableWork(arg0), arg1, arg2, arg3);
+	}
+
+	@Override
+	public long startWork(Work arg0) throws WorkException {
+		return this.delegate.startWork(new StatuscapableWork(arg0));
+	}
+
+	@Override
+	public long startWork(Work arg0, long arg1, ExecutionContext arg2, WorkListener arg3) throws WorkException {
+		return this.delegate.startWork(new StatuscapableWork(arg0), arg1, arg2, arg3);
+	}
+	
+	
+	class StatuscapableWork implements Work{
+		
+		public StatuscapableWork(Work work) throws WorkRejectedException {
+			boolean atMaxThreads = false;
+			boolean newMaxQueueSize = false;
+			synchronized (poolLock) {
+				checkForTermination();
+				submittedCount++;
+				atMaxThreads = activeCount == maximumPoolSize;
+				queue.add(work);
+				if (atMaxThreads) {
+					int queueSize = queue.size();
+					if (queueSize > highestQueueSize) {
+						atMaxThreads = true;
+						highestQueueSize = queueSize;
+					}
+				} else {
+					activeCount++;
+					highestActiveCount = Math.max(activeCount, highestActiveCount);
+				}
+			}
+			if (atMaxThreads) {
+				if (newMaxQueueSize && maximumPoolSize > 1) {
+					throw new WorkRejectedException( CommonPlugin.Util.getString("WorkerPool.Max_thread", maximumPoolSize, poolName, highestQueueSize)); //$NON-NLS-1$
+				}
+			}			
+		}
+		
+		@Override
+		public void release() {
+		}
+
+		@Override
+		public void run() {
+			Thread t = Thread.currentThread();
+			threads.add(t);
+			String name = t.getName();
+			t.setName(name + "_" + poolName + threadCounter.getAndIncrement()); //$NON-NLS-1$
+			if (LogManager.isMessageToBeRecorded(LogConstants.CTX_POOLING, MessageLevel.TRACE)) {
+				LogManager.logTrace(LogConstants.CTX_POOLING, "Beginning work with virtual worker", t.getName()); //$NON-NLS-1$ 
+			}
+			
+			Work r = queue.poll();
+			if (r != null) {
+				boolean success = false;
+				try {
+					r.run();
+					success = true;
+				} finally {
+					synchronized (poolLock) {
+						if (success) {
+							completedCount++;
+						}
+						threads.remove(t);
+						activeCount--;
+					}
+					t.setName(name);
+				}
+			}
+		}
+	}
+
+	private void checkForTermination() throws WorkRejectedException {
+		if (terminated) {
+			throw new WorkRejectedException();
+		}
+	}
+		
+	public WorkerPoolStats getStats() {
+		WorkerPoolStats stats = new WorkerPoolStats();
+		stats.name = poolName;
+		stats.queued = queue.size();
+		stats.highestQueued = highestQueueSize;
+		stats.activeThreads = this.activeCount;
+		stats.maxThreads = this.maximumPoolSize;
+		stats.totalSubmitted = this.submittedCount;
+		stats.highestActiveThreads = this.highestActiveCount;
+		stats.totalCompleted = this.completedCount;
+		return stats;
+	}
+	
+	public void shutdown() {
+		this.terminated = true;
+	}
+	
+	public List<Runnable> shutdownNow() {
+		this.shutdown();
+		synchronized (poolLock) {
+			synchronized (threads) {
+				for (Thread t : threads) {
+					t.interrupt();
+				}
+			}
+			List<Runnable> result = new ArrayList<Runnable>(queue);
+			queue.clear();
+			return result;
+		}
+	}
+
+}


Property changes on: branches/JCA/common-internal/src/main/java/com/metamatrix/common/queue/StatsCapturingWorkManager.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: branches/JCA/common-internal/src/main/java/com/metamatrix/common/queue/WorkerPoolFactory.java
===================================================================
--- branches/JCA/common-internal/src/main/java/com/metamatrix/common/queue/WorkerPoolFactory.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/common-internal/src/main/java/com/metamatrix/common/queue/WorkerPoolFactory.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -30,6 +30,7 @@
 import java.util.Queue;
 import java.util.Set;
 import java.util.concurrent.Delayed;
+import java.util.concurrent.Executor;
 import java.util.concurrent.FutureTask;
 import java.util.concurrent.RejectedExecutionException;
 import java.util.concurrent.ScheduledFuture;
@@ -162,10 +163,12 @@
 		private String poolName;
 		private int maximumPoolSize;
 		private Queue<Runnable> queue = new LinkedList<Runnable>();
+		private Executor thread;
 		
-		public StatsCapturingSharedThreadPoolExecutor(String name, int maximumPoolSize) {
+		public StatsCapturingSharedThreadPoolExecutor(String name, int maximumPoolSize, Executor thread) {
 			this.maximumPoolSize = maximumPoolSize;
 			this.poolName = name;
+			this.thread = thread;
 		}
 		
 		@Override
@@ -194,7 +197,7 @@
 				}
 				return;
 			}
-			tpe.execute(new Runnable() {
+			this.thread.execute(new Runnable() {
 				@Override
 				public void run() {
 					Thread t = Thread.currentThread();
@@ -357,7 +360,12 @@
 	 * @return 
 	 */
 	public static WorkerPool newWorkerPool(String name, int numThreads) {
-		return new StatsCapturingSharedThreadPoolExecutor(name, numThreads);
+		return new StatsCapturingSharedThreadPoolExecutor(name, numThreads, tpe);
 	}
+
+	
+	public static WorkerPool newWorkerPool(String name, int numThreads, final Executor executor) {
+		return new StatsCapturingSharedThreadPoolExecutor(name, numThreads, executor);
+	}
     
 }

Modified: branches/JCA/common-internal/src/test/java/com/metamatrix/common/queue/TestQueueWorkerPool.java
===================================================================
--- branches/JCA/common-internal/src/test/java/com/metamatrix/common/queue/TestQueueWorkerPool.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/common-internal/src/test/java/com/metamatrix/common/queue/TestQueueWorkerPool.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -163,7 +163,7 @@
     			throw new RuntimeException();
     		}
     	});
-    	Thread.sleep(10);
+    	Thread.sleep(100);
     	assertEquals(1, count.get());
     }
         

Modified: branches/JCA/connector-api/pom.xml
===================================================================
--- branches/JCA/connector-api/pom.xml	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connector-api/pom.xml	2009-11-02 19:41:28 UTC (rev 1544)
@@ -31,10 +31,11 @@
       <type>test-jar</type>
       <scope>test</scope>
     </dependency>
-    
+       
     <dependency>
-      <groupId>javax.transaction</groupId>
-      <artifactId>jta</artifactId>
+      <groupId>javax.resource</groupId>
+      <artifactId>connector-api</artifactId>
+      <scope>provided</scope>
     </dependency>
     
   </dependencies>

Modified: branches/JCA/connector-api/src/main/java/org/teiid/connector/api/Connection.java
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/api/Connection.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/api/Connection.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,15 +22,20 @@
 
 package org.teiid.connector.api;
 
+import java.util.Map;
+
+import javax.resource.spi.LocalTransaction;
+import javax.transaction.xa.XAResource;
+
 import org.teiid.connector.language.ICommand;
+import org.teiid.connector.metadata.runtime.ConnectorMetadata;
+import org.teiid.connector.metadata.runtime.DatatypeRecordImpl;
 import org.teiid.connector.metadata.runtime.RuntimeMetadata;
 
 /**
  * <p>Represents a connection to this connector.  A connection will be obtained
  * from the connector for every query that is executed, then closed after the query has completed.
  * </p>
- * <p>If pooling is enabled, see {@link PoolAwareConnection} to optionally implement pooling specific behavior.
- * </p>  
  */
 public interface Connection {
 
@@ -39,20 +44,20 @@
      * queries (and other commands) will be sent to the connector.
      * @return Connector capabilities, may return null if the Connector returns globally scoped capabilities {@link Connector#getCapabilities()}
      */
-    ConnectorCapabilities getCapabilities();
+    ConnectorCapabilities getCapabilities() throws ConnectorException;
 
     /**
      * Create an execution object for the specified command  
      * @param command the command
      * @param executionContext Provides information about the context that this command is
-     * executing within, such as the identifiers for the MetaMatrix command being executed
+     * executing within, such as the identifiers for the command being executed
      * @param metadata Access to runtime metadata if needed to translate the command
-     * @return An execution object that MetaMatrix can use to execute the command
+     * @return An execution object that can use to execute the command
      */
     Execution createExecution(ICommand command, ExecutionContext executionContext, RuntimeMetadata metadata ) throws ConnectorException;
 
     /**
-     * Release the connection.  This will be called when MetaMatrix has completed 
+     * Release the connection.  This will be called when system has completed 
      * using the connection for an execution.
      */
     void close();
@@ -62,20 +67,23 @@
      * @return true if open, false if there is a source error.
      */    
     boolean isAlive();
+         
+    /**
+     * Get the local transaction for the connector.
+     * @return null if local transactions are not supported
+     */
+    LocalTransaction getLocalTransaction() throws ConnectorException;
     
-	/**
-	 * 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
-	 */
-	void setConnectorIdentity(ConnectorIdentity context)
-			throws ConnectorException;
-	
     /**
-     * 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.
+     * If Connector supports participating in XA Connections, return the XAResurce associated with this connection.
+     * @return null if not supported
      */
-    void closeCalled();
+    XAResource 	getXAResource() throws ConnectorException;  
+    
+    /**
+     *  Gets the metadata information for this connection's underlying Connector instance.
+     * @return
+     */
+    ConnectorMetadata getModelMetaData(String modelName, Map<String, DatatypeRecordImpl> dataTypes) throws ConnectorException;
 }
 

Modified: branches/JCA/connector-api/src/main/java/org/teiid/connector/api/Connector.java
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/api/Connector.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/api/Connector.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -27,62 +27,39 @@
  * <p>The primary entry point for a Connector.  This interface should be implemented
  * by the connector writer.</p>
  * 
- * <p>The Connector Manager will instantiate the implementation
- * of this class by reflection in an isolated classloader.  Once the class has been 
+ * <p>The JCA Container will instantiate the implementation of this class. Once the class has been 
  * instantiated, the {@link #initialize(ConnectorEnvironment)} method will be called
- * with all necessary connector properties.  The {@link #start()} and {@link #stop()} 
- * methods are lifecycle methods called when starting or stopping the connector.</p>  
+ * with all necessary connector properties. </p>  
  */
 public interface Connector {
 
+	/**
+	 * Initialize the connector with supplied configuration
+	 * @param config
+	 */
+	void initialize(ConnectorEnvironment config) throws ConnectorException;
+	
     /**
-     * Start the connector with the connector environment.  The environment
-     * provides access to external resources the connector implementation may
-     * need to use.  
-     * @param environment The connector environment, provided by the Connector Manager
-     * @throws ConnectorException
-     */
-    void start(ConnectorEnvironment environment) throws ConnectorException;
-
-    /**
-     * Stop the connector.  No commands will be executed on the connector when it is
-     * stopped.
-     */
-    void stop();
-
-    /**
      * Obtain a connection with the connector.  The connection typically is associated
-     * with a particular security context.  The connection is assumed to be pooled in 
-     * the underlying source if pooling is necessary - the connection will be closed 
-     * when execution has completed against it.  
-     * @param context The context of the current user that will be using this connection, 
-     * may be null if this connection is for an administrative operation. 
+     * with a particular security context.  The connection is assumed to be pooled by container 
+     * if pooling is necessary - the connection will be closed when execution has completed against it.
+     *   
      * @return A Connection, created by the Connector
      * @throws ConnectorException If an error occurred obtaining a connection
      */
-    Connection getConnection( ExecutionContext context ) throws ConnectorException;
+    Connection getConnection() throws ConnectorException;
     
     /**
      * Get the capabilities of this connector.  The capabilities affect what kinds of 
      * queries (and other commands) will be sent to the connector.
      * @return ConnectorCapabilities, may return null if the Connector provides User scoped capabilities {@link Connection#getCapabilities()}
      */
-    ConnectorCapabilities getCapabilities();
+    ConnectorCapabilities getCapabilities() throws ConnectorException;
     
-	/**
-	 * Create an identity object based on a security context.
-	 * 
-	 * If single identity is not supported then an exception should be thrown when a
-	 * null context is supplied.
-	 * 
-	 * Implementors of this class may use a different implementation of the 
-	 * {@link ConnectorIdentity} interface to similarly affect pooling.
-	 *  
-	 * @param context The context provided by the Connector Manager
-	 * @return The associated connector identity
-	 * @throws ConnectorException If a null context is not accepted or an error occurs while creating the identity.
-	 */
-	ConnectorIdentity createIdentity(ExecutionContext context)
-			throws ConnectorException;
-
+    /**
+     * Get the ConnectorEnvironment that this connector is initialized with.
+     * @return
+     * @throws ConnectorException
+     */
+    ConnectorEnvironment getConnectorEnvironment();
 }

Modified: branches/JCA/connector-api/src/main/java/org/teiid/connector/api/ConnectorAnnotations.java
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/api/ConnectorAnnotations.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/api/ConnectorAnnotations.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -31,22 +31,8 @@
 
 public class ConnectorAnnotations {
 	
-	/**
-	 * The Pooling Annotation can be used to enable/suppress automatic pooling.
-	 * 
-	 * This is especially useful in situations where legacy ConnectionPool properties 
-	 * are still in use and thus {@link ConnectorPropertyNames#CONNECTION_POOL_ENABLED}
-	 * is set to true or when a connector cannot possibly provide a proper implementation
-	 * of a {@link ConnectorIdentityFactory}.
-	 */
 	@Retention(RetentionPolicy.RUNTIME)
 	@Target({ElementType.TYPE})
-	public @interface ConnectionPooling {
-		boolean enabled() default true;
-	}
-	
-	@Retention(RetentionPolicy.RUNTIME)
-	@Target({ElementType.TYPE})
 	public @interface SynchronousWorkers {
 		boolean enabled() default true;
 	}

Modified: branches/JCA/connector-api/src/main/java/org/teiid/connector/api/ConnectorEnvironment.java
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/api/ConnectorEnvironment.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/api/ConnectorEnvironment.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -23,10 +23,6 @@
 package org.teiid.connector.api;
 
 import java.util.Properties;
-import java.util.concurrent.Executor;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
 
 import org.teiid.connector.language.ILanguageFactory;
 
@@ -36,24 +32,52 @@
  * environment provides access to external resources the Connector writer may
  * need.
  */
-public interface ConnectorEnvironment extends Executor {
+public interface ConnectorEnvironment {
 
-    /**
-     * Get all configuration properties provided in the Connector Binding 
-     * for this connector instance.
-     * @return Properties for initializing the connector
-     */
-    Properties getProperties();
+	/**
+	 * Capabilities Class Name
+	 * @return
+	 */
+	public String getCapabilitiesClass();
+	
+	/**
+	 * Defines if the Connector is read-only connector 
+	 * @return
+	 */
+	public boolean isImmutable();
+	
+	/**
+	 * Throw exception if there are more rows in the result set than specified in the MaxResultRows setting.
+	 * @return
+	 */
+	public boolean isExceptionOnMaxRows();
 
+	/**
+	 * Maximum result set rows to fetch
+	 * @return
+	 */
+	public int getMaxResultRows();
+	
+	/**
+	 * Shows the XA transaction capability of the Connector.
+	 * @return
+	 */
+	public boolean isXaCapable();
+	
+	boolean isResultSetCacheEnabled();
+	int getResultSetCacheMaxSize();
+	int getResultSetCacheMaxAge();
+	String getResultSetCacheScope();
+	
     /**
-     * Get the name of the connector binding, as exposed in the console.
-     * @return Connector binding name
+     * Indicates whether the connector represents a pooled resource.  If it does, then
+     * synchronous workers will be used.
      */
-    String getConnectorName();
-
+	boolean isSynchWorkers();
+	
     /**
      * Obtain a reference to the logger that can be used to add messages to the 
-     * MetaMatrix log files for debugging and error recovery.
+     * log files for debugging and error recovery.
      * @return The {@link ConnectorLogger} 
      */
     ConnectorLogger getLogger();
@@ -72,40 +96,8 @@
     TypeFacility getTypeFacility();
     
     /**
-     * Schedule a command for repeated execution with the same contract as 
-     * {@link ScheduledThreadPoolExecutor#scheduleAtFixedRate(Runnable, long, long, TimeUnit)}
-     * Executions will not happen concurrently.  If an execution takes longer than a period,
-     * the next execution will take place on the first period interval after completion.
-     * @param command
-     * @param initialDelay
-     * @param period
-     * @param unit
+     * Get the Override capabilities for the connector
      * @return
      */
-	ScheduledFuture<?> scheduleAtFixedRate(Runnable command,
-            long initialDelay,
-            long period,
-            TimeUnit unit);
-
-
-	/**
-	 * Get the item from cache based on the scope provided; The required information like session-id, or vdb-name etc 
-	 * are gleaned from runtime context. If such information is not available then error will be raised.
-	 * @param scope - scope of the cache; {@link CacheScope.REQUEST}, scope is not supported, as request information is not
-     * visible. use ExecutionContext. 
-	 * on {@link ExecutionContext}
-	 * @param key
-	 * @return
-	 */
-	Object getFromCache(CacheScope scope, Object key);
-
-	/**
-	 * Store the item in the cache based on the scope provided.The required information like session-id, or vdb-name etc 
-	 * are gleaned from runtime context. If such information is not available then error will be raised.
-	 * @param scope  - scope of the cache; {@link CacheScope.REQUEST}, scope is not supported. 
-	 * on {@link ExecutionContext}
-	 * @param key
-	 * @param value
-	 */
-	void storeInCache(CacheScope scope, Object key, Object value);
+    Properties getOverrideCapabilities() throws ConnectorException;
 }

Modified: branches/JCA/connector-api/src/main/java/org/teiid/connector/api/ConnectorException.java
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/api/ConnectorException.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/api/ConnectorException.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,13 +22,13 @@
 
 package org.teiid.connector.api;
 
-import com.metamatrix.core.MetaMatrixCoreException;
+import javax.resource.ResourceException;
 
 /**
  * An exception the connector writer can return in case of an 
  * error while using the connector.
  */
-public class ConnectorException extends MetaMatrixCoreException{
+public class ConnectorException extends ResourceException{
 
 	private static final long serialVersionUID = -5980862789340592219L;
 
@@ -49,11 +49,11 @@
     }
     
     public ConnectorException( String errorCode, String message ) {
-        super( errorCode, message );
+        super( message, errorCode);
     }
     
     public ConnectorException( int errorCode, String message ) {
-        super( Integer.toString(errorCode), message );
+        super(message, Integer.toString(errorCode));
     }    
     
 
@@ -64,7 +64,7 @@
      * @param e An exception to nest within this one
      */
     public ConnectorException( Throwable e, String message ) {
-        super( e, message );
+        super(message,e);
     }  
     
     /**

Deleted: branches/JCA/connector-api/src/main/java/org/teiid/connector/api/ConnectorIdentity.java
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/api/ConnectorIdentity.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/api/ConnectorIdentity.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,34 +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 org.teiid.connector.api;
-
-
-/**
- * Represents the identity of a connection in the pool.  Identities are 
- * used to determine whether two connections can be put in the same pool.
- * Implementors must supply appropriate {@link java.lang.Object#equals(java.lang.Object)} and
- * {@link java.lang.Object#hashCode()} methods.  
- */
-public interface ConnectorIdentity {
-	
-}

Modified: branches/JCA/connector-api/src/main/java/org/teiid/connector/api/ConnectorLogger.java
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/api/ConnectorLogger.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/api/ConnectorLogger.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -23,7 +23,7 @@
 package org.teiid.connector.api;
 
 /**
- * Provide access to write messages to the MetaMatrix logs.
+ * Provide access to write messages to the logs.
  */
 public interface ConnectorLogger {
 

Deleted: branches/JCA/connector-api/src/main/java/org/teiid/connector/api/ConnectorPropertyNames.java
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/api/ConnectorPropertyNames.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/api/ConnectorPropertyNames.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,114 +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 org.teiid.connector.api;
-
-public class ConnectorPropertyNames {
-
-   /**
-    * The property that specifies the class name of the custom connector class
-    * that connects to the data source.  This property is required.
-    */
-    public static final String CONNECTOR_CLASS = "ConnectorClass"; //$NON-NLS-1$
-
-    /**
-     * The environment property name whose value defines the maximum number
-     * of processor threads.  This property is required.
-     */
-    public static final String MAX_CONNECTIONS = "ConnectorMaxConnections"; //$NON-NLS-1$
-
-	/**
-	 * This property can be used to specify the maximum number of rows to be returned
-	 * from the datasource of this connector. The connector should stop adding records
-	 * to the ResultsCollector when the rows collected is equal to this value.  This
-	 * property is optional and if no value is specified, we should return all the rows.
-	 * @since 3.0
-	 */
-	public static final String MAX_RESULT_ROWS = "MaxResultRows"; //$NON-NLS-1$
-
-    /**
-     * This property can be used to specify whether or not an exception should be thrown
-     * if the number of rows for a query exceeds the value of MAX_RESULT_ROWS.  If this
-     * flag is set to false, then no more than MAX_RESULT_ROWS values will be returned but
-     * no exception will be thrown.
-     */
-    public static final String EXCEPTION_ON_MAX_ROWS = "ExceptionOnMaxRows"; //$NON-NLS-1$
-    
-    /**
-     * This property can be used to specify whether or not Connection Pooling is enabled.
-     * If this flag is set to false, then connection pooling is disabled.
-     */
-    public static final String CONNECTION_POOL_ENABLED = "ConnectionPoolEnabled"; //$NON-NLS-1$
-
-    /**
-     * The environment property used to identify a <i>type</i> of connector binding.
-     * This property is required and is a component used to uniquely identify a
-     * connector instance.
-     * @since 4.0
-     */
-    public static final String CONNECTOR_BINDING_NAME = "ConnectorBindingName"; //$NON-NLS-1$
-
-    /**
-     * 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$
-    
-    /**
-     * 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$
-
-    /**
-     * 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 CONNECTOR_TYPE_CLASSPATH = "ConnectorTypeClassPath"; //$NON-NLS-1$
-    
-    public static final String IS_XA = "IsXA"; //$NON-NLS-1$
-    
-    public static final String USE_CREDENTIALS_MAP = "UseCredentialMap"; //$NON-NLS-1$
-    
-    public static final String ADMIN_CONNECTIONS_ALLOWED = "AdminConnectionsAllowed"; //$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$
-    
-    /**
-     * This property can be used to bypass the normal logic that throws an exception when a command
-     * is about to be executed by a non-XA compatible connector, but there is a global transaction.
-     */
-    public static final String IS_IMMUTABLE = "Immutable"; //$NON-NLS-1$
-    
-    public static final String USE_POST_DELEGATION = "UsePostDelegation"; //$NON-NLS-1$
-
-}

Deleted: branches/JCA/connector-api/src/main/java/org/teiid/connector/api/CredentialMap.java
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/api/CredentialMap.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/api/CredentialMap.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,377 +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 org.teiid.connector.api;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.teiid.connector.DataPlugin;
-
-import com.metamatrix.core.util.StringUtil;
-
-/**
- * Allows credentials to be passed on a per user basis to a connector.  
- *
- * A CredentialsMap object is produced based on information provided in the JDBC
- * URL.  The static method parseCredentials() is used for this purpose.
- *
- * This CredentialMap serves as the session "trusted payload".
- *
- * It is the responsibility of a Connector to call
- * {@link ExecutionContext#getTrustedPayload()} to retrieve the CredentialMap.
- * 
- * The system name should be the same as the Connector Binding Name retrieved from
- * {@link ConnectorEnvironment#getConnectorName()}.
- * 
- * To get the keyword/value pairs use getSystemCredentials(systemName), this will
- * return a Map that contains the properties for the specified system.
- * 
- * Specific user and password values can be retrieved with 
- * getUser(systemName) and getPassword(systemName)
- */
-public class CredentialMap implements Serializable {
-	//Parsing keywords for system, user, and password.  Comparison is done
-	//ignoring case.
-	public final static String SYSTEM_KEYWORD = "system"; //$NON-NLS-1$
-    public final static String USER_KEYWORD = "user"; //$NON-NLS-1$
-    public final static String PASSWORD_KEYWORD = "password"; //$NON-NLS-1$
-	public final static String ESCAPE_CHAR = "\\"; //$NON-NLS-1$
-    public final static String DEFAULT_SYSTEM = "default"; //$NON-NLS-1$
-
-	private final static String ESCAPE_SLASH = "ESCAPE_SLASH";	    	// forward slash //$NON-NLS-1$
-	private final static String ESCAPE_COMMA = "ESCAPE_COMMA";			// comma //$NON-NLS-1$
-	private final static String ESCAPE_EQUAL = "ESCAPE_EQUAL";			// equals //$NON-NLS-1$
-//	private final static String ESCAPE_SEMI  = "ESCAPE_SEMI";			// semicolon
-//	private final static String ESCAPE_CLOSE_PAREN = "ESCAPE_CLOSE_PAREN";	// closing paren
-
-
-    private final static String[] escape_chars = {
-    	                                      ESCAPE_CHAR + "/",    // forward slash //$NON-NLS-1$
-                                              ESCAPE_CHAR + ",",	// comma //$NON-NLS-1$
-                                              ESCAPE_CHAR + "="};	// equals //$NON-NLS-1$
-//                                              ESCAPE_CHAR + ";",	// semicolon
-//                                              ESCAPE_CHAR + ")"};	// closing paren
-
-    private final static String[] escape_strings = {
-    	                                      ESCAPE_SLASH,    	// forward slash
-                                              ESCAPE_COMMA,		// comma
-                                              ESCAPE_EQUAL };	    // equals
-//                                              ESCAPE_SEMI,		// semicolon
-//                                              ESCAPE_CLOSE_PAREN };	// closing paren
-
-    /**
-     * In this mode, the CredentialMap will ignore the default credentials
-     * and only credentials set for a system will be exposed.  This is the 
-     * default setting for the CredentialMap.
-     */
-    public static final short MODE_IGNORE_DEFAULTS = 0;
-    
-    /**
-     * In this mode, the default credentials will be returned for any system, 
-     * overlaid with any system-specific credentials.  If a system is unknown,
-     * all default credentials are returned for that system. 
-     */
-    public static final short MODE_USE_DEFAULTS_GLOBALLY = 1;
-    
-    /**
-     * In this mode, the default credentials will be returned for any system,
-     * overlaid with any system-specific credentials.  If a system is unknown,
-     * the default credentials are NOT used.  
-     */
-    public static final short MODE_USE_DEFAULTS_ON_EXISTING = 2;
-
-    /**
-     * The map of map of credentials (keyed by system name, upper case).  
-     */
-    private Map map = new HashMap();
-    
-    private short defaultCredentialMode = MODE_IGNORE_DEFAULTS;
-    private Map defaultCredentials;
-
-
-	/**
-	 * Method to parse a credentials substring extracted from a JDBC URL.  The
-	 * presumed command line syntax is ...;credentials=(...);...
-	 * Only the substring starting and ending with the parentheses is passed to
-	 * this method.  That is, the first non-blank character must be a '(' and the
-	 * last non-blank character must be a ')', or an exception will be thrown.
-	 *
-	 * Syntax is: (credentialspec1/credentialspec2/.../credentialspecn)
-	 *
-	 * Any number one or greater of credential specifications may be included,
-	 * separated by '/' characters.
-	 *
-	 * Each credentials spec will be specified in the following way:
-	 * 	Keyword-specified, order-independent name-value pairs of the form
-	 * 		keyword=value.  The only required keyword is "system", which must be specified
-	 *  for each credentials spec, and must have a value corresponding to the name of an EIS
-	 *  already known to the system.
-	 *
-	 * 	Ex: system=sys1,user=sys1un,pass=sys1pw, whatever=somevalue.
-	 *     Each of the keywords must be unique.
-	 *
-	 * All blank space is ignored, except within a keyword or value.
-	 *
-	 * Any syntax error will cause an Exception to be thrown.
-	 *
-	 * @param inputStr		the string to be parsed;  first non-blank must be a '(', last non-blank must be a ')'
-	 * @return             a CredentialMap containing the input
-	 * @throws ConnectorException   upon any syntax error;  descriptive text included
-	 */
-	public static CredentialMap parseCredentials(String inputStr) throws ConnectorException {
-
-		for (int i = 0; i < escape_chars.length; i++) {
-			inputStr = StringUtil.replaceAll(inputStr, escape_chars[i], escape_strings[i]);
-		}
-
-		if (inputStr == null) {
-			throw new ConnectorException(DataPlugin.Util.getString("CredentialMap.Null_input")); //$NON-NLS-1$
-		}
-
-		inputStr = inputStr.trim();
-
-		CredentialMap credentialMap = new CredentialMap(); // map of maps keyed on system
-		int strLen = inputStr.length();
-
-		//Check that not empty
-
-		if (strLen == 0) {
-			throw new ConnectorException(DataPlugin.Util.getString("CredentialMap.Empty_input")); //$NON-NLS-1$
-		}
-
-		//Check that first non-blank char is left paren
-		if (!inputStr.startsWith("(")|| !inputStr.endsWith(")")) { //$NON-NLS-1$ //$NON-NLS-2$
-			throw new ConnectorException(DataPlugin.Util.getString("CredentialMap.Missing_parens")); //$NON-NLS-1$
-		}
-
-		// strip of ()'s
-		inputStr = inputStr.substring(1, inputStr.length()-1);
-
-		List credentials = StringUtil.getTokens(inputStr, "/"); //$NON-NLS-1$
-		Iterator credentialIter = credentials.iterator();
-
-		while (credentialIter.hasNext()) {
-			String credential = (String) credentialIter.next();
-
-			// Convert the escaped "/" since we already parsed on the "/"
-			credential = StringUtil.replaceAll(credential, escape_strings[0], "/"); //$NON-NLS-1$
-
-			Map newMap = getCredentialMap(credential.trim());
-			String system = (String) newMap.get(SYSTEM_KEYWORD);
-			if (system == null || system.length() == 0) {
-				throw new ConnectorException(DataPlugin.Util.getString("CredentialMap.Missing_system_prop")); //$NON-NLS-1$
-			}
-			credentialMap.addSystemCredentials(system, newMap); // add to Map of Maps.
-		}
-		return credentialMap;
-	}
-
-
-	/**
-	 * Takes a string containing key/value pairs.
-	 *  Example "propName1=propValue1,propName2,propValue2,....."
-	 * and returns a map of key/value pairs.
-	 */
-	private static Map getCredentialMap(String credential) {
-		List propList = StringUtil.getTokens(credential, ","); //$NON-NLS-1$
-		Iterator propIter = propList.iterator();
-		Map map = new HashMap();
-		while (propIter.hasNext()) {
-			String propVal = (String) propIter.next();
-			List pvList = StringUtil.getTokens(propVal, "="); //$NON-NLS-1$
-			String key = null;
-			String val = null;
-			if (pvList.size() > 0) {
-				key = (String) pvList.get(0);
-				key = key.trim();
-			}
-			if (pvList.size() > 1) {
-				val = (String) pvList.get(1);
-				val = val.trim();
-				// put back the escaped "," and "=" since we already parsed on these.
-				val = StringUtil.replaceAll(val, escape_strings[1], ","); //$NON-NLS-1$
-				val = StringUtil.replaceAll(val, escape_strings[2], "="); //$NON-NLS-1$
-			}
-			map.put(key,val);
-		}
-		return map;
-	}
-
-	public CredentialMap() {
-		super();
-	}
-
-	/**
-	 * Method to return an array of systems that have been added to this
-	 * CredentialMap.
-	 *
-	 * @return  array of the systems that have been added using addSystemCredentials() - always uppercase
-	 */
-	public String[] getSystems() {
-		Set keySet = map.keySet();
-		String[] keys = new String[keySet.size()];
-		Iterator it = keySet.iterator();
-		for (int i = 0; it.hasNext(); i++) {
-			keys[i] = (String)it.next();
-		}
-		return keys;
-	}
-
-	/**
-	 * Method to add a user name and credentials (e.g. password) for a system
-	 *
-	 * @param system system name corresponding to the user and credentials
-	 * @param credentials Map containing name/val pairs
-	 */
-	public void addSystemCredentials(String system, Map credentials) {
-		map.put(system.toUpperCase(), credentials);
-	}
-
-    /**
-     * Set the default credentials to use with this credential map.  See the 
-     * various default credential modes to understand when and how these will
-     * be returned.
-     *  
-     * @param defaultCredentials Map of credentials
-     * @since 4.3
-     */
-    public void setDefaultCredentials(Map defaultCredentials) {
-        this.defaultCredentials = defaultCredentials;
-    }
-    
-    /**
-     * Set the default credential mode to determine when default credentials should 
-     * be returned.
-     *  
-     * @param mode The mode
-     * @see #MODE_IGNORE_DEFAULTS
-     * @see #MODE_USE_DEFAULTS_GLOBALLY
-     * @see #MODE_USE_DEFAULTS_ON_EXISTING
-     * @since 4.3
-     */
-    public void setDefaultCredentialMode(short mode) {
-        this.defaultCredentialMode = mode;
-    }
-    
-	/**
-	 * Method to return the credentials map for a system
-	 *
-	 * @param systemName	system name
-	 * @return 			Map
-	 */
-	public Map getSystemCredentials(String systemName) {
-        Map systemCredentials = (Map)map.get(systemName.toUpperCase());
-        
-        // If ignoring defaults, return just as is 
-        if(this.defaultCredentialMode == MODE_IGNORE_DEFAULTS) {
-            return systemCredentials;
-        }
-        
-        // Pre-load the credential set to return with the defaults if
-        //  1. defaults exist  
-        //  2. AND using defaults globally
-        //  3.     OR (using defaults on existing AND system credentials exist) 
-        Map workingMap = null;
-        if(this.defaultCredentials != null && 
-                        (this.defaultCredentialMode == MODE_USE_DEFAULTS_GLOBALLY || 
-                                        (this.defaultCredentialMode == MODE_USE_DEFAULTS_ON_EXISTING && 
-                                         systemCredentials != null))) {
-            
-            workingMap = new HashMap();
-            workingMap.putAll(defaultCredentials);
-        }
-        
-        // Apply system credentials over the top if they exist
-        if(systemCredentials != null) {
-            if(workingMap == null) {
-                workingMap = new HashMap();
-            }
-            workingMap.putAll(systemCredentials);
-        }
-                
-		return workingMap;
-	}
-    
-    /**
-     * Get the user property for the specified system, if it exists.  The 
-     * user property is defined by the static constant {@link #USER_KEYWORD}.  
-     *  
-     * @param systemName The system to look up (case insensitive)
-     * @return The user name for this system if the system was found and the system had a user property 
-     * @since 4.3
-     */
-    public String getUser(String systemName) {
-        Map credentials = getSystemCredentials(systemName);
-        if(credentials != null) {
-            return (String) credentials.get(USER_KEYWORD);
-        }
-        
-        return null;
-    }
-
-    /**
-     * Get the password property for the specified system, if it exists.  The 
-     * password property is defined by the static constant {@link #PASSWORD_KEYWORD}.  
-     *  
-     * @param systemName The system to look up (case insensitive)
-     * @return The password for this system if the system was found and the system had a password property 
-     * @since 4.3
-     */
-    public String getPassword(String systemName) {
-        Map credentials = getSystemCredentials(systemName);
-        if(credentials != null) {
-            return (String) credentials.get(PASSWORD_KEYWORD);
-        }
-        
-        return null;
-    }
-
-	public String toString() {
-		StringBuffer b = new StringBuffer();
-		String[] systems = this.getSystems();
-		for (int i=0; i < systems.length; i++) {
-			String system = systems[i];
-			Map map = this.getSystemCredentials(system);
-			b.append("\n"); //$NON-NLS-1$
-			b.append(system);
-			b.append("\n"); //$NON-NLS-1$
-			Iterator iter = map.keySet().iterator();
-			while (iter.hasNext()) {
-				Object key = iter.next();
-				b.append("\t"); //$NON-NLS-1$
-				b.append(key);
-				b.append("="); //$NON-NLS-1$
-				b.append(map.get(key));
-				b.append("\n"); //$NON-NLS-1$
-			}
-		}
-		return b.toString();
-	}
-
-}//end CredentialMap
-
-

Modified: branches/JCA/connector-api/src/main/java/org/teiid/connector/api/ExecutionContext.java
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/api/ExecutionContext.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/api/ExecutionContext.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -24,7 +24,9 @@
 
 import java.io.Serializable;
 
+import javax.security.auth.Subject;
 
+
 /**
  * The security context provides information about the user context in which
  * this query is being run.
@@ -37,25 +39,15 @@
 public interface ExecutionContext {
 
 	/**
-	 * Get the {@link ConnectorIdentity} created by the Connector's {@link
-	 * ConnectorIdentityFactory}
-	 * 
-	 * @return the {@link ConnectorIdentity} or {@link SingleIdentity} if the
-	 * 	Connector does not implement {@link ConnectorIdentityFactory}
-	 * @since 6.0
-	 */
-	ConnectorIdentity getConnectorIdentity();
-	
-	/**
      * Get the identifier for the current connector running the command
      * @return Connector identifier; never null
      */
     String getConnectorIdentifier();
     
     /**
-     * Get the identifier for the MetaMatrix command being executed.  This can be
-     * correlated back to identifiers exposed in other parts of the MetaMatrix system.
-     * @return MetaMatrix command identifier
+     * Get the identifier for the command being executed.  This can be
+     * correlated back to identifiers exposed in other parts of the system.
+     * @return command identifier
      */
     String getRequestIdentifier();
     
@@ -67,7 +59,7 @@
     
     /**
      * Execution count defines an id; where every access to the connector from  
-     * the MetaMatrix server in a given command execution boundary is uniquely defined;
+     * the server in a given command execution boundary is uniquely defined;
      * Like for example in the case of "batched execution" of commands, each execution of 
      * command gets new identifier.  
      */
@@ -86,45 +78,29 @@
     String getVirtualDatabaseVersion();
 
     /**
-     * Get the user name for the user running this query.
-     * @return User name, never null
+     * Get the user for the user running this query.
+     * @return User, never null
      */
-    String getUser();
-
+    Subject getUser();
+    
     /**
-     * Get the trusted payload passed when the user connected.  MetaMatrix has no
-     * knowledge about what the payload contains - it is merely passed through
-     * the system.  It is most often used to pass security information such as
-     * credentials.  It is available in the connector, as is the Execution Payload,
-     * for connector developers to utilize.
-     * @return Trusted payload if one exists, otherwise null
-     */
-    Serializable getTrustedPayload();
-
-    /**
      * Get the trusted payload passed when the user statement was executed.
-     * MetaMatrix has no knowledge about what the payload contains - it is merely
+     * Teiid has no knowledge about what the payload contains - it is merely
      * passed through the system.  It is most often used to pass security
      * information such as credentials.
      * 
-     * <p>The execution payload differs from the Trusted Payload in that it
-     * is set on the Statement and so may not be constant over the Connection lifecycle
-     * and may be changed upon each statement execution.  The Execution Payload is
-     * <em>not</em> authenticated or validated by the MetaMatrix system.</p>
+     * <p>Given that the Execution Payload is not authenticated by the Teiid
+     * system, connector writers are responsible for ensuring its validity. </p>
      * 
-     * <p>Given that the Execution Payload is not authenticated by the MetaMatrix
-     * system, connector writers are responsible for ensuring its validity.  This
-     * can possibly be accomplished by comparing it against the Trusted Payload.</p>
-     * 
      * @return Trusted execution payload if one exists, otherwise null
      * @since 4.2
      */
     Serializable getExecutionPayload();
-    
+        
     /**
      * Get the identifier for the connection through which 
      * the command is being executed. This represents the original JDBC user
-     * connection to the MetaMatrix system
+     * connection to the Teiid system
      * @return Connection identifier
      */
     String getConnectionIdentifier();
@@ -150,6 +126,10 @@
      */
     void addWarning(Exception ex);
     
+    /**
+     * Flag indicates that the operation needs to be executed in a XA transaction.
+     * @return
+     */
     boolean isTransactional();
 
 	/**
@@ -166,4 +146,21 @@
 	 * @param value
 	 */
 	void put(Object key, Object value);    
+	
+	/**
+	 * Get a item that has been placed previously from cache. If no such object then a null will be returned. The item looked
+	 * up in the specified scope.
+	 * @param scope
+	 * @param key
+	 * @return
+	 */
+	Object getFromCache(CacheScope scope, Object key);
+
+	/**
+	 * Place a item in the Cache in the given scope.
+	 * @param scope
+	 * @param key
+	 * @param value
+	 */
+	void storeInCache(CacheScope scope, Object key, Object value);
 }

Deleted: branches/JCA/connector-api/src/main/java/org/teiid/connector/api/MappedUserIdentity.java
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/api/MappedUserIdentity.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/api/MappedUserIdentity.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,81 +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 org.teiid.connector.api;
-
-
-/**
- * This class represents a ConnectorIdentity keyed on a username with
- * a mapped identity
- */
-public class MappedUserIdentity implements ConnectorIdentity {
-	private String username;
-	private String mappedUser;
-	private String password;
-    
-    /**
-     * Construct with a security context
-     * @param context The context
-     */
-    public MappedUserIdentity(String username, String mappedUser, String password){
-        this.username = username;
-        this.mappedUser = mappedUser;
-        this.password = password;
-    }    
-    
-    /**
-     * Implement equals based on the case-insensitive user name.
-     * @param obj Other identity object
-     * @return True if other object is a UserIdentity with the same user name
-     */
-    public boolean equals(Object obj){
-        if (this == obj) {
-            return true;
-        }
-
-        if (obj instanceof MappedUserIdentity) {
-            MappedUserIdentity that = (MappedUserIdentity)obj;
-            return username.equals(that.username);
-        }
-        
-        return false;        
-    }
-    
-    /**
-     * Get hash code, based on user name
-     */
-    public int hashCode(){
-        return username.hashCode();
-    }    
-    
-    public String toString(){
-        return "UserIdentity " + username; //$NON-NLS-1$
-    }  
-    
-    public String getMappedUser() {
-		return mappedUser;
-	}
-    
-    public String getPassword() {
-		return password;
-	}
-}

Deleted: branches/JCA/connector-api/src/main/java/org/teiid/connector/api/SingleIdentity.java
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/api/SingleIdentity.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/api/SingleIdentity.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -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 org.teiid.connector.api;
-
-
-/**
- * This class represents a single ConnectorIdentity. All the connections are treated the same.
- */
-public class SingleIdentity implements ConnectorIdentity {
-
-    public SingleIdentity(){
-    }
-    
-    /**
-     * Return true for everything - all identities are identical.
-     */
-    public boolean equals(Object obj){
-        return obj instanceof SingleIdentity;
-    }
-    
-    public String toString(){
-        return "SingleIdentity"; //$NON-NLS-1$
-    }    
-    
-    public int hashCode(){
-        return 0; 
-    }
-}

Modified: branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/BasicConnection.java
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/BasicConnection.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/BasicConnection.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,10 +22,14 @@
 
 package org.teiid.connector.basic;
 
+import java.util.Map;
+
+import javax.resource.spi.LocalTransaction;
+import javax.transaction.xa.XAResource;
+
 import org.teiid.connector.api.Connection;
 import org.teiid.connector.api.ConnectorCapabilities;
 import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.api.ConnectorIdentity;
 import org.teiid.connector.api.Execution;
 import org.teiid.connector.api.ExecutionContext;
 import org.teiid.connector.api.ProcedureExecution;
@@ -34,6 +38,8 @@
 import org.teiid.connector.language.ICommand;
 import org.teiid.connector.language.IProcedure;
 import org.teiid.connector.language.IQueryCommand;
+import org.teiid.connector.metadata.runtime.ConnectorMetadata;
+import org.teiid.connector.metadata.runtime.DatatypeRecordImpl;
 import org.teiid.connector.metadata.runtime.RuntimeMetadata;
 
 /**
@@ -46,6 +52,7 @@
  */
 public abstract class BasicConnection implements Connection {
 
+
 	@Override
 	public Execution createExecution(ICommand command,
 			ExecutionContext executionContext, RuntimeMetadata metadata)
@@ -82,14 +89,18 @@
 	}
 		
 	@Override
-	public void closeCalled() {
-		
+	public LocalTransaction getLocalTransaction() {
+		return null;
 	}
 	
 	@Override
-	public void setConnectorIdentity(ConnectorIdentity context)
+	public XAResource getXAResource() throws ConnectorException {
+		return null;
+	}
+
+	@Override
+	public ConnectorMetadata getModelMetaData(String modelName, Map<String, DatatypeRecordImpl> dataTypes)
 			throws ConnectorException {
-		
-	}
-	
+		return null;
+	}	
 }

Modified: branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/BasicConnector.java
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/BasicConnector.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/BasicConnector.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,81 +1,20 @@
 package org.teiid.connector.basic;
 
-import org.teiid.connector.DataPlugin;
 import org.teiid.connector.api.Connector;
 import org.teiid.connector.api.ConnectorEnvironment;
 import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.api.ConnectorIdentity;
-import org.teiid.connector.api.ConnectorPropertyNames;
-import org.teiid.connector.api.CredentialMap;
-import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.api.MappedUserIdentity;
-import org.teiid.connector.api.SingleIdentity;
 
-import com.metamatrix.common.util.PropertiesUtils;
-
 public abstract class BasicConnector implements Connector {
 
-	private boolean useCredentialMap;
-	private boolean adminConnectionsAllowed = true;
-	private String connectorName;
+	protected ConnectorEnvironment config;
 	
 	@Override
-	public void start(ConnectorEnvironment environment)
-			throws ConnectorException {
-		this.connectorName = environment.getConnectorName();
-		this.adminConnectionsAllowed = PropertiesUtils.getBooleanProperty(environment.getProperties(), ConnectorPropertyNames.ADMIN_CONNECTIONS_ALLOWED, true);
-		this.useCredentialMap = PropertiesUtils.getBooleanProperty(environment.getProperties(), ConnectorPropertyNames.USE_CREDENTIALS_MAP, false);
-	}
-		
-    /* (non-Javadoc)
-	 * @see com.metamatrix.connector.api.Connector#createIdentity(com.metamatrix.connector.api.ExecutionContext)
-	 */
-	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$
-		}
-		Object payload = context.getTrustedPayload();
-		if (!(payload instanceof CredentialMap)) {
-			if (useCredentialMap) {
-				throw new ConnectorException(DataPlugin.Util.getString("UserIdentityFactory.extraction_error")); //$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(DataPlugin.Util.getString("UserIdentityFactory.missing_credentials", connectorName)); //$NON-NLS-1$
-		}
-		return new MappedUserIdentity(context.getUser(), user, password);
-	}
+	public void initialize(ConnectorEnvironment config) throws ConnectorException {
+		this.config = config;
+	}	
 	
-	public String getConnectorName() {
-		return connectorName;
+	@Override
+	public ConnectorEnvironment getConnectorEnvironment(){
+		return this.config;
 	}
-	
-	public void setConnectorName(String connectorName) {
-		this.connectorName = connectorName;
-	}
-	
-	public boolean useCredentialMap() {
-		return useCredentialMap;
-	}
-	
-	public void setUseCredentialMap(boolean useCredentialMap) {
-		this.useCredentialMap = useCredentialMap;
-	}
-	
-	public boolean areAdminConnectionsAllowed() {
-		return adminConnectionsAllowed;
-	}
-	
-	public void setAdminConnectionsAllowed(boolean adminConnectionsAllowed) {
-		this.adminConnectionsAllowed = adminConnectionsAllowed;
-	}
-	
 }

Added: branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnection.java
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnection.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnection.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,134 @@
+/*
+ * 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 org.teiid.connector.basic;
+
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionEvent;
+import javax.resource.spi.ConnectionEventListener;
+import javax.resource.spi.ConnectionRequestInfo;
+import javax.resource.spi.LocalTransaction;
+import javax.resource.spi.ManagedConnection;
+import javax.resource.spi.ManagedConnectionMetaData;
+import javax.security.auth.Subject;
+import javax.transaction.xa.XAResource;
+
+import org.teiid.connector.api.ConnectorException;
+
+public class BasicManagedConnection implements ManagedConnection {
+	protected PrintWriter log;
+	protected final Collection<ConnectionEventListener> listeners = new ArrayList<ConnectionEventListener>();
+	protected WrappedConnection conn;
+	private BasicManagedConnectionFactory mcf;
+	
+	public BasicManagedConnection(BasicManagedConnectionFactory mcf) {
+		this.mcf = mcf;
+	}
+
+	@Override
+	public void associateConnection(Object handle) throws ResourceException {
+		if (!(handle instanceof WrappedConnection)) {
+			throw new ConnectorException("Wrong connection supplied to assosiate");
+		}
+		this.conn = (WrappedConnection)handle;
+		this.conn.setManagedConnection(this);
+	}
+
+	@Override
+	public void cleanup() throws ResourceException {
+		this.conn.close();
+		this.conn = null;
+	}
+
+	@Override
+	public void destroy() throws ResourceException {
+		cleanup();
+	}
+	
+	@Override
+	public ManagedConnectionMetaData getMetaData() throws ResourceException {
+		return null;
+	}
+	
+	@Override
+	public Object getConnection(Subject arg0, ConnectionRequestInfo arg1) throws ResourceException {
+		if(!(arg1 instanceof ConnectionRequestInfoWrapper)) {
+			throw new ConnectorException("Un recognized Connection Request Info object received");
+		}
+		ConnectionRequestInfoWrapper criw = (ConnectionRequestInfoWrapper)arg1;		
+		this.conn = new WrappedConnection(criw.actualConnector.getConnection(), mcf);
+		this.conn.setManagedConnection(this);
+		return this.conn;
+	}
+
+	@Override
+	public LocalTransaction getLocalTransaction() throws ResourceException {
+		return this.conn.getLocalTransaction();
+	}
+
+	@Override
+	public XAResource getXAResource() throws ResourceException {
+		return this.conn.getXAResource();
+	}
+	
+	@Override
+	public void addConnectionEventListener(ConnectionEventListener arg0) {
+		synchronized (this.listeners) {
+			this.listeners.add(arg0);
+		}
+	}	
+
+	@Override
+	public void removeConnectionEventListener(ConnectionEventListener arg0) {
+		synchronized (this.listeners) {
+			this.listeners.remove(arg0);
+		}
+	}
+
+	@Override
+	public void setLogWriter(PrintWriter arg0) throws ResourceException {
+		this.log = arg0;
+	}
+	
+	@Override
+	public PrintWriter getLogWriter() throws ResourceException {
+		return this.log;
+	}
+
+	// called by the wrapped connection to notify the close of the connection.
+	void connectionClosed() {
+		ConnectionEvent ce = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
+		ce.setConnectionHandle(this.conn);
+		
+		ArrayList<ConnectionEventListener> copy = null;
+		synchronized (this.listeners) {
+			copy = new ArrayList<ConnectionEventListener>(this.listeners);
+		}
+		
+		for(ConnectionEventListener l: copy) {
+			l.connectionClosed(ce);
+		}
+	}
+}


Property changes on: branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnection.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnectionFactory.java
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnectionFactory.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnectionFactory.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,247 @@
+/*
+ * 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 org.teiid.connector.basic;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Properties;
+import java.util.Set;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionManager;
+import javax.resource.spi.ConnectionRequestInfo;
+import javax.resource.spi.ManagedConnection;
+import javax.resource.spi.ManagedConnectionFactory;
+import javax.resource.spi.ResourceAdapter;
+import javax.resource.spi.ResourceAdapterAssociation;
+import javax.security.auth.Subject;
+
+import org.teiid.connector.api.Connector;
+import org.teiid.connector.api.ConnectorEnvironment;
+import org.teiid.connector.api.ConnectorException;
+import org.teiid.connector.api.ConnectorLogger;
+import org.teiid.connector.api.TypeFacility;
+import org.teiid.connector.language.ILanguageFactory;
+import org.teiid.connector.language.impl.LanguageFactoryImpl;
+
+import com.metamatrix.core.MetaMatrixCoreException;
+import com.metamatrix.core.util.ReflectionHelper;
+
+public class BasicManagedConnectionFactory implements ManagedConnectionFactory, ResourceAdapterAssociation, ConnectorEnvironment {
+
+	private static final long serialVersionUID = -7302713800883776790L;
+	private static final TypeFacility TYPE_FACILITY = new TypeFacilityImpl();
+	private ConnectorLogger logger = new DefaultConnectorLogger();
+	private PrintWriter log;
+	private BasicResourceAdapter ra;
+	
+	// Properties set by ra.xml 
+	private String connectorClass;
+	private String capabilitiesClass = BasicConnectorCapabilities.class.getName();
+	private boolean immutable = false;
+	private boolean exceptionOnMaxRows = false;
+	private int maxResultRows = -1;
+	private boolean xaCapable;
+	
+	
+	private boolean resultSetCacheEnabled = false;
+	private int resultSetCacheMaxSize = 20;
+	private int resultSetCacheMaxAge =  3600000;
+	private String resultSetCacheScope = "vdb";
+	private boolean synchWorkers = true;
+	private String overrideCapabilitiesFile;
+	
+	// derived
+	private Properties overrideCapabilities;
+	
+	@Override
+	public Object createConnectionFactory() throws ResourceException {
+		return new ResourceException("Resource Adapter does not currently support running in a non-managed environment.");
+	}
+
+	@Override
+	public Object createConnectionFactory(ConnectionManager arg0) throws ResourceException {
+		try {
+			Object o = ReflectionHelper.create(this.connectorClass, null, Thread.currentThread().getContextClassLoader());
+			if(!(o instanceof Connector)) {
+				throw new ConnectorException("Invalid Connector class specified="+this.connectorClass);
+			}
+			Connector connector = (Connector)o;
+			connector.initialize(this);
+			return new WrappedConnector(connector, arg0, this);
+		} catch (MetaMatrixCoreException e) {
+			throw new ResourceException(e);
+		} 
+	}
+
+	@Override
+	public ManagedConnection createManagedConnection(Subject arg0, ConnectionRequestInfo arg1) throws ResourceException {
+		return new BasicManagedConnection(this);
+	}
+
+	@Override
+	public PrintWriter getLogWriter() throws ResourceException {
+		return this.log;
+	}
+
+	@Override
+	public ManagedConnection matchManagedConnections(Set arg0, Subject arg1, ConnectionRequestInfo arg2) throws ResourceException {
+		// rameshTODO: to manage per-user based pools the information in the request info needs to be used to filter.
+		return (ManagedConnection)arg0.iterator().next();
+	}
+
+	@Override
+	public void setLogWriter(PrintWriter arg0) throws ResourceException {
+		this.log = arg0;
+	}
+
+	@Override
+	public ResourceAdapter getResourceAdapter() {
+		return this.ra;
+	}
+
+	@Override
+	public void setResourceAdapter(ResourceAdapter arg0) throws ResourceException {
+		this.ra = (BasicResourceAdapter)arg0;
+	}
+	
+	public void setConnectorClass(String arg0) {
+		this.connectorClass = arg0;
+	}
+	
+	public void setCapabilitiesClass(String arg0) {
+		this.capabilitiesClass = arg0;
+	}
+
+	public void setImmutable(Boolean arg0) {
+		this.immutable = arg0.booleanValue();
+	}	
+	
+	public void setExceptionOnMaxRows(Boolean arg0) {
+		this.exceptionOnMaxRows = arg0.booleanValue();
+	}
+	
+	public void setMaxResultRows(Integer arg0) {
+		this.maxResultRows = arg0.intValue();
+	}
+	
+	public String getCapabilitiesClass() {
+		return capabilitiesClass;
+	}
+
+	public boolean isImmutable() {
+		return immutable;
+	}
+
+	public boolean isExceptionOnMaxRows() {
+		return exceptionOnMaxRows;
+	}
+
+	public int getMaxResultRows() {
+		return maxResultRows;
+	}
+	
+	public boolean isXaCapable() {
+		return xaCapable;
+	}
+
+	public void setXaCapable(Boolean arg0) {
+		this.xaCapable = arg0.booleanValue();
+	}	
+	
+	@Override
+	public boolean isResultSetCacheEnabled() {
+		return resultSetCacheEnabled;
+	}
+
+	public void setResultSetCacheEnabled(Boolean arg0) {
+		this.resultSetCacheEnabled = arg0.booleanValue();
+	}
+
+	@Override
+	public int getResultSetCacheMaxSize() {
+		return resultSetCacheMaxSize;
+	}
+
+	public void setResultSetCacheMaxSize(Integer arg0) {
+		this.resultSetCacheMaxSize = arg0.intValue();
+	}
+
+	@Override
+	public int getResultSetCacheMaxAge() {
+		return resultSetCacheMaxAge;
+	}
+
+	public void setResultSetCacheMaxAge(Integer arg0) {
+		this.resultSetCacheMaxAge = arg0.intValue();
+	}
+	
+	@Override
+	public String getResultSetCacheScope() {
+		return resultSetCacheScope;
+	}
+
+	public void setResultSetCacheScope(String arg0) {
+		this.resultSetCacheScope = arg0;
+	}	
+
+	@Override
+	public ILanguageFactory getLanguageFactory() {
+		return LanguageFactoryImpl.INSTANCE;
+	}
+
+	@Override
+	public ConnectorLogger getLogger() {
+		return logger;
+	}
+
+	@Override
+	public TypeFacility getTypeFacility() {
+		return TYPE_FACILITY;
+	}
+
+	@Override
+	public boolean isSynchWorkers() {
+		return synchWorkers;
+	}
+
+	public void setSynchWorkers(Boolean arg0) {
+		this.synchWorkers = arg0.booleanValue();
+	}
+
+	@Override
+	public Properties getOverrideCapabilities() throws ConnectorException {
+		if (this.overrideCapabilities == null && this.overrideCapabilitiesFile != null) {
+			try {
+				this.overrideCapabilities = new Properties();
+				this.overrideCapabilities.loadFromXML(this.getClass().getResourceAsStream(this.overrideCapabilitiesFile));
+			} catch (IOException e) {
+				throw new ConnectorException(e);
+			}
+		}
+		return this.overrideCapabilities;
+	}
+	
+	public void setOverrideCapabilitiesFile(String propsFile) {
+		this.overrideCapabilitiesFile = propsFile;
+	}
+}


Property changes on: branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnectionFactory.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/BasicResourceAdapter.java
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/BasicResourceAdapter.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/BasicResourceAdapter.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.teiid.connector.basic;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ActivationSpec;
+import javax.resource.spi.BootstrapContext;
+import javax.resource.spi.ResourceAdapter;
+import javax.resource.spi.ResourceAdapterInternalException;
+import javax.resource.spi.XATerminator;
+import javax.resource.spi.endpoint.MessageEndpointFactory;
+import javax.resource.spi.work.WorkManager;
+import javax.transaction.xa.XAResource;
+
+public class BasicResourceAdapter implements ResourceAdapter {
+	BootstrapContext ctx;
+	
+	@Override
+	public void endpointActivation(MessageEndpointFactory endpointFactory, ActivationSpec spec) throws ResourceException {
+		throw new UnsupportedOperationException("not supported");
+	}
+
+	@Override
+	public void endpointDeactivation(MessageEndpointFactory endpointFactory, ActivationSpec spec) {
+		throw new UnsupportedOperationException("not supported");
+	}
+
+	@Override
+	public XAResource[] getXAResources(ActivationSpec[] specs) throws ResourceException {
+		return new XAResource[0];
+	}
+
+	@Override
+	public void start(BootstrapContext ctx) throws ResourceAdapterInternalException {
+		this.ctx = ctx;
+	}
+
+	@Override
+	public void stop() {
+	}
+
+	public WorkManager getWorkManager() {
+		return ctx.getWorkManager();
+	}
+	
+	public XATerminator getXATerminator() {
+		return ctx.getXATerminator();
+	}
+}


Property changes on: branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/BasicResourceAdapter.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/ConnectionRequestInfoWrapper.java
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/ConnectionRequestInfoWrapper.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/ConnectionRequestInfoWrapper.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,34 @@
+/*
+ * 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 org.teiid.connector.basic;
+
+import javax.resource.spi.ConnectionRequestInfo;
+
+import org.teiid.connector.api.Connector;
+
+class ConnectionRequestInfoWrapper implements ConnectionRequestInfo {
+	Connector actualConnector;
+	
+	public ConnectionRequestInfoWrapper(Connector connector) {
+		this.actualConnector = connector;
+	}
+}


Property changes on: branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/ConnectionRequestInfoWrapper.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/DefaultConnectorLogger.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/DefaultConnectorLogger.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/DefaultConnectorLogger.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/DefaultConnectorLogger.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,111 @@
+/*
+ * 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 16, 2003
+ * Time: 11:23:00 AM
+ */
+package org.teiid.connector.basic;
+
+import org.teiid.connector.api.ConnectorLogger;
+
+/**
+ * DefaultConnectorLogger.
+ */
+public class DefaultConnectorLogger implements ConnectorLogger {
+	public static final String CTX_CONNECTOR = "CONNECTOR"; //$NON-NLS-1$
+	@Override
+    public void logError(String message) {
+        //LogManager.logError(CTX_CONNECTOR, message);
+    }
+    @Override
+    public void logError(String message, Throwable error) {
+       // LogManager.logError(CTX_CONNECTOR, error, message);
+    }
+    @Override
+    public void logWarning(String message) {
+       // LogManager.logWarning(CTX_CONNECTOR, message);
+    }
+    @Override
+    public void logInfo(String message) {
+        //LogManager.logInfo(CTX_CONNECTOR, message);
+    }
+    @Override
+    public void logDetail(String message) {
+        //LogManager.logDetail(CTX_CONNECTOR, message);
+    }
+
+    @Override
+    public void logTrace(String message) {
+       // LogManager.logTrace(CTX_CONNECTOR, message);
+    }
+
+	@Override
+	public boolean isDetailEnabled() {
+		//return LogManager.isMessageToBeRecorded(CTX_CONNECTOR, MessageLevel.DETAIL);
+		return true;
+	}
+
+	@Override
+	public boolean isErrorEnabled() {
+		//return LogManager.isMessageToBeRecorded(CTX_CONNECTOR, MessageLevel.ERROR);
+		return true;
+	}
+
+	@Override
+	public boolean isInfoEnabled() {
+		//return LogManager.isMessageToBeRecorded(CTX_CONNECTOR, MessageLevel.INFO);
+		return true;
+	}
+
+	@Override
+	public boolean isTraceEnabled() {
+		//return LogManager.isMessageToBeRecorded(CTX_CONNECTOR, MessageLevel.TRACE);
+		return true;
+	}
+
+	@Override
+	public boolean isWarningEnabled() {
+		//return LogManager.isMessageToBeRecorded(CTX_CONNECTOR, MessageLevel.WARNING);
+		return true;
+	}
+
+	@Override
+	public void logDetail(String message, Throwable error) {
+		//LogManager.log(MessageLevel.DETAIL, CTX_CONNECTOR, error, message);
+	}
+
+	@Override
+	public void logInfo(String message, Throwable error) {
+		//LogManager.log(MessageLevel.INFO, CTX_CONNECTOR, error, message);
+	}
+
+	@Override
+	public void logTrace(String message, Throwable error) {
+		//LogManager.log(MessageLevel.TRACE, CTX_CONNECTOR, error, message);
+	}
+
+	@Override
+	public void logWarning(String message, Throwable error) {
+		//LogManager.log(MessageLevel.WARNING, CTX_CONNECTOR, error, message);
+	}
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/TypeFacilityImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/TypeFacilityImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/TypeFacilityImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/TypeFacilityImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,52 @@
+/*
+ * 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 org.teiid.connector.basic;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.TimeZone;
+
+import org.teiid.connector.api.TypeFacility;
+
+import com.metamatrix.common.types.DataTypeManager;
+import com.metamatrix.common.util.TimestampWithTimezone;
+
+/**
+ */
+public class TypeFacilityImpl extends TypeFacility {
+
+    public TypeFacilityImpl() {
+    }
+
+	@Override
+	public Object convertToRuntimeType(Object value) {
+		return DataTypeManager.convertToRuntimeType(value);
+	}
+	
+	@Override
+	public Object convertDate(Date date, TimeZone initial, Calendar target,
+			Class targetType) {
+		return TimestampWithTimezone.create(date, initial, target, targetType);
+	}
+
+}

Added: branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/WrappedConnection.java
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/WrappedConnection.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/WrappedConnection.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,108 @@
+/*
+ * 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 org.teiid.connector.basic;
+
+import java.lang.reflect.Proxy;
+import java.util.Map;
+
+import javax.resource.spi.LocalTransaction;
+import javax.transaction.xa.XAResource;
+
+import org.teiid.connector.api.Connection;
+import org.teiid.connector.api.ConnectorCapabilities;
+import org.teiid.connector.api.ConnectorEnvironment;
+import org.teiid.connector.api.ConnectorException;
+import org.teiid.connector.api.Execution;
+import org.teiid.connector.api.ExecutionContext;
+import org.teiid.connector.basic.WrappedConnector.CapabilitesOverloader;
+import org.teiid.connector.language.ICommand;
+import org.teiid.connector.metadata.runtime.ConnectorMetadata;
+import org.teiid.connector.metadata.runtime.DatatypeRecordImpl;
+import org.teiid.connector.metadata.runtime.RuntimeMetadata;
+
+public class WrappedConnection implements Connection {
+
+	private Connection conn;
+	private ConnectorEnvironment env;
+	private ConnectorCapabilities caps;
+	private BasicManagedConnection mc;
+	boolean closed = false;
+	
+	public WrappedConnection(Connection conn, ConnectorEnvironment env) {
+		this.conn = conn;
+		this.env = env;
+	}
+	
+	@Override
+	public void close() {
+		if (!this.closed && this.mc != null) {
+			this.closed = true;
+			this.conn.close();
+			this.mc.connectionClosed();
+			this.mc = null;
+		}
+	}
+
+	@Override
+	public Execution createExecution(ICommand command, ExecutionContext executionContext, RuntimeMetadata metadata)
+			throws ConnectorException {
+		return conn.createExecution(command, executionContext, metadata);
+	}
+
+	@Override
+	public ConnectorCapabilities getCapabilities() throws ConnectorException {
+		if (this.caps == null) {
+			ConnectorCapabilities caps = conn.getCapabilities();
+			if (caps != null && this.env.getOverrideCapabilities() != null) {
+				caps = (ConnectorCapabilities) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {ConnectorCapabilities.class}, new CapabilitesOverloader(caps, this.env.getOverrideCapabilities()));
+			}
+			this.caps = caps;
+		}
+		return this.caps;
+	}
+
+	@Override
+	public LocalTransaction getLocalTransaction() throws ConnectorException {
+		return conn.getLocalTransaction();
+	}
+
+	@Override
+	public boolean isAlive() {
+		return conn.isAlive();
+	}
+
+	@Override
+	public XAResource getXAResource() throws ConnectorException {
+		return conn.getXAResource();
+	}
+
+	@Override
+	public ConnectorMetadata getModelMetaData(String modelName, Map<String, DatatypeRecordImpl> dataTypes)
+			throws ConnectorException {
+		return conn.getModelMetaData(modelName, dataTypes);
+	}
+
+	// Called by managed connection for the connection management
+	void setManagedConnection(BasicManagedConnection mc) {
+		this.mc = mc;
+	}
+}


Property changes on: branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/WrappedConnection.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/WrappedConnector.java
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/WrappedConnector.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/WrappedConnector.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,141 @@
+/*
+ * 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 org.teiid.connector.basic;
+
+import java.io.Serializable;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.Properties;
+
+import javax.naming.NamingException;
+import javax.naming.Reference;
+import javax.resource.Referenceable;
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionManager;
+
+import org.teiid.connector.api.Connection;
+import org.teiid.connector.api.Connector;
+import org.teiid.connector.api.ConnectorCapabilities;
+import org.teiid.connector.api.ConnectorEnvironment;
+import org.teiid.connector.api.ConnectorException;
+
+import com.metamatrix.core.MetaMatrixCoreException;
+import com.metamatrix.core.util.ReflectionHelper;
+import com.metamatrix.core.util.StringUtil;
+
+public class WrappedConnector implements Connector, Referenceable, Serializable  {
+
+	private static final long serialVersionUID = 5499157394014613035L;
+	private Connector delegate;
+	private ConnectionManager cm;	
+	private BasicManagedConnectionFactory mcf;
+	private Reference reference;
+	ConnectorCapabilities caps;
+	
+	public WrappedConnector(Connector delegate, ConnectionManager cm, BasicManagedConnectionFactory mcf) {
+		this.delegate = delegate;
+		this.cm = cm;
+		this.mcf = mcf;
+	}
+	
+	@Override
+	public void initialize(ConnectorEnvironment config) throws ConnectorException {
+		this.delegate.initialize(config);
+	}
+	
+	@Override
+	public ConnectorCapabilities getCapabilities() throws ConnectorException {
+		if (this.caps != null) {
+			return this.caps;
+		}
+		
+		// see if enhanced capabilities are available from the connector.
+		this.caps = delegate.getCapabilities();
+				
+		// if not use the default capabilities specified in the configuration.
+		if (this.caps == null) {
+			try {
+				Object o = ReflectionHelper.create(this.mcf.getCapabilitiesClass(), null, Thread.currentThread().getContextClassLoader());
+				if(!(o instanceof ConnectorCapabilities)) {
+					throw new ConnectorException("Invalid Connector Capabilities class specified="+this.mcf.getCapabilitiesClass());
+				}
+				this.caps = (ConnectorCapabilities)o;
+			} catch (MetaMatrixCoreException e) {
+				throw new ConnectorException(e);
+			} 
+		}
+		// capabilities overload
+		ConnectorEnvironment env = getConnectorEnvironment();
+		if (this.caps != null && env.getOverrideCapabilities() != null) {
+			this.caps = (ConnectorCapabilities) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {ConnectorCapabilities.class}, new CapabilitesOverloader(this.caps, env.getOverrideCapabilities()));
+		}
+		return caps;
+	}
+
+	@Override
+	public Connection getConnection() throws ConnectorException {
+		try {
+			return (Connection)cm.allocateConnection(mcf, new ConnectionRequestInfoWrapper(this.delegate));
+		} catch (ResourceException e) {
+			throw new ConnectorException(e);
+		}
+	}
+
+	@Override
+	public ConnectorEnvironment getConnectorEnvironment() {
+		return this.delegate.getConnectorEnvironment();
+	}
+
+	@Override
+	public void setReference(Reference arg0) {
+		this.reference = arg0;
+	}
+
+	@Override
+	public Reference getReference() throws NamingException {
+		return this.reference;
+	}
+
+	
+	/**
+	 * Overloads the connector capabilities with one defined in the connector binding properties
+	 */
+    static final class CapabilitesOverloader implements InvocationHandler {
+    	ConnectorCapabilities caps; 
+    	Properties properties;
+    	
+    	CapabilitesOverloader(ConnectorCapabilities caps, Properties properties){
+    		this.caps = caps;
+    		this.properties = properties;
+    	}
+    	
+		@Override
+		public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+			String value = this.properties.getProperty(method.getName());
+			if (value == null || value.trim().length() == 0 || (args != null && args.length != 0)) {
+				return method.invoke(this.caps, args);
+			}
+			return StringUtil.valueOf(value, method.getReturnType());
+		}
+	}	
+}


Property changes on: branches/JCA/connector-api/src/main/java/org/teiid/connector/basic/WrappedConnector.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/AggregateImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/AggregateImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/AggregateImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/AggregateImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,106 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import org.teiid.connector.language.IAggregate;
+import org.teiid.connector.language.IExpression;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+public class AggregateImpl extends BaseLanguageObject implements IAggregate {
+    
+    private IExpression expression = null;
+    private String aggName;
+    private boolean isDistinct;
+    private Class type;
+    
+    public AggregateImpl(String aggName, boolean isDistinct, IExpression exp, Class type) {
+        this.expression = exp;
+        this.aggName = aggName;
+        this.isDistinct = isDistinct;
+        this.type = type;
+    }
+
+    /**
+     * @see org.teiid.connector.language.IAggregate#getName()
+     */
+    public String getName() {
+        return this.aggName;
+    }
+
+    /**
+     * @see org.teiid.connector.language.IAggregate#isDistinct()
+     */
+    public boolean isDistinct() {
+        return this.isDistinct;
+    }
+
+    /**
+     * @see org.teiid.connector.language.IAggregate#getExpression()
+     */
+    public IExpression getExpression() {
+        return this.expression;
+    }
+    
+    /**
+     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
+     */
+    public void acceptVisitor(LanguageObjectVisitor visitor) {
+        visitor.visit(this);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IAggregate#setName(java.lang.String)
+     */
+    public void setName(String name) {
+        this.aggName = name;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IAggregate#setDistinct(boolean)
+     */
+    public void setDistinct(boolean isDistinct) {
+        this.isDistinct = isDistinct;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IAggregate#setExpression(com.metamatrix.data.language.IExpression)
+     */
+    public void setExpression(IExpression expression) {
+        this.expression = expression;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IExpression#getType()
+     */
+    public Class getType() {
+        return this.type;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IExpression#setType(java.lang.Class)
+     */
+    public void setType(Class type) {
+        this.type = type;
+    }
+
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/BaseLanguageObject.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/BaseLanguageObject.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/BaseLanguageObject.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/BaseLanguageObject.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,42 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import org.teiid.connector.language.ILanguageObject;
+import org.teiid.connector.visitor.util.SQLStringVisitor;
+
+/**
+ */
+public abstract class BaseLanguageObject implements ILanguageObject {
+
+    /**
+     * 
+     */
+    public BaseLanguageObject() {
+    }
+    
+    public String toString() {
+        return SQLStringVisitor.getSQLString(this);
+    }
+
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/BatchedUpdatesImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/BatchedUpdatesImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/BatchedUpdatesImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/BatchedUpdatesImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,59 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import java.util.List;
+
+import org.teiid.connector.language.IBatchedUpdates;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+
+
+/** 
+ * @since 4.2
+ */
+public class BatchedUpdatesImpl extends BaseLanguageObject implements
+                                                          IBatchedUpdates {
+
+    private List updateCommands;
+    public BatchedUpdatesImpl(List updateCommands) {
+        this.updateCommands = updateCommands;
+    }
+    
+    /** 
+     * @see org.teiid.connector.language.IBatchedUpdates#getUpdateCommands()
+     * @since 4.2
+     */
+    public List getUpdateCommands() {
+        return updateCommands;
+    }
+
+    /** 
+     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(org.teiid.connector.visitor.framework.LanguageObjectVisitor)
+     * @since 4.2
+     */
+    public void acceptVisitor(LanguageObjectVisitor visitor) {
+        visitor.visit(this);
+    }
+
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/CompareCriteriaImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/CompareCriteriaImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/CompareCriteriaImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/CompareCriteriaImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,90 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import org.teiid.connector.language.ICompareCriteria;
+import org.teiid.connector.language.IExpression;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+public class CompareCriteriaImpl extends BaseLanguageObject implements ICompareCriteria {
+
+    private IExpression leftExpression = null;
+    private IExpression rightExpression = null;
+    private Operator operator;
+    
+    public CompareCriteriaImpl(IExpression left, IExpression right, Operator operator) {
+        leftExpression = left;
+        rightExpression = right;
+        this.operator = operator;
+    }
+    /**
+     * @see org.teiid.connector.language.ICompareCriteria#getLeftExpression()
+     */
+    public IExpression getLeftExpression() {
+        return leftExpression;
+    }
+
+    /**
+     * @see org.teiid.connector.language.ICompareCriteria#getRightExpression()
+     */
+    public IExpression getRightExpression() {
+        return rightExpression;
+    }
+
+    /**
+     * @see org.teiid.connector.language.ICompareCriteria#getOperator()
+     */
+    public Operator getOperator() {
+        return this.operator;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ICompareCriteria#setLeftExpression(com.metamatrix.data.language.IExpression)
+     */
+    public void setLeftExpression(IExpression expression) {
+        this.leftExpression = expression;
+    }
+    
+    /* 
+     * @see com.metamatrix.data.language.ICompareCriteria#setRightExpression(com.metamatrix.data.language.IExpression)
+     */
+    public void setRightExpression(IExpression expression) {
+        this.rightExpression = expression;
+    }
+    
+    /* 
+     * @see com.metamatrix.data.language.ICompareCriteria#setOperator(int)
+     */
+    public void setOperator(Operator operator) {
+        this.operator = operator;
+    }
+    
+    /**
+     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
+     */
+    public void acceptVisitor(LanguageObjectVisitor visitor) {
+        visitor.visit(this);
+    }
+    
+
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/CompoundCriteriaImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/CompoundCriteriaImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/CompoundCriteriaImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/CompoundCriteriaImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,76 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import java.util.List;
+
+import org.teiid.connector.language.ICompoundCriteria;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+
+public class CompoundCriteriaImpl extends BaseLanguageObject implements ICompoundCriteria {
+    
+    private List criteria = null;
+    private Operator operator = Operator.AND;
+    
+    public CompoundCriteriaImpl(List nestedCriteria, Operator operator) {
+        criteria = nestedCriteria;
+        this.operator = operator; 
+    }
+
+    /**
+     * @see org.teiid.connector.language.ICompoundCriteria#getOperator()
+     */
+    public Operator getOperator() {
+        return this.operator;
+    }
+
+    /**
+     * @see org.teiid.connector.language.ICompoundCriteria#getCriteria()
+     */
+    public List getCriteria() {
+        return criteria;
+    }
+
+    /**
+     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
+     */
+    public void acceptVisitor(LanguageObjectVisitor visitor) {
+        visitor.visit(this);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ICompoundCriteria#setOperator(int)
+     */
+    public void setOperator(Operator operator) {
+        this.operator = operator;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ICompoundCriteria#setCriteria(java.util.List)
+     */
+    public void setCriteria(List criteria) {
+        this.criteria = criteria;
+    }
+
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/DeleteImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/DeleteImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/DeleteImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/DeleteImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,74 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import org.teiid.connector.language.ICriteria;
+import org.teiid.connector.language.IDelete;
+import org.teiid.connector.language.IGroup;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+public class DeleteImpl extends BaseLanguageObject implements IDelete {
+
+    private IGroup group = null;
+    private ICriteria criteria = null;
+    
+    public DeleteImpl(IGroup group, ICriteria criteria) {
+        this.group = group;
+        this.criteria = criteria;
+    }
+    /**
+     * @see org.teiid.connector.language.IDelete#getGroup()
+     */
+    public IGroup getGroup() {
+        return group;
+    }
+
+    /**
+     * @see org.teiid.connector.language.IDelete#getCriteria()
+     */
+    public ICriteria getCriteria() {
+        return criteria;
+    }
+
+    /**
+     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
+     */
+    public void acceptVisitor(LanguageObjectVisitor visitor) {
+        visitor.visit(this);
+    }
+    
+    /* 
+     * @see com.metamatrix.data.language.IDelete#setGroup(com.metamatrix.data.language.IGroup)
+     */
+    public void setGroup(IGroup group) {
+        this.group = group;
+    }
+    
+    /* 
+     * @see com.metamatrix.data.language.IDelete#setCriteria(com.metamatrix.data.language.ICriteria)
+     */
+    public void setCriteria(ICriteria criteria) {
+        this.criteria = criteria;
+    }
+
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/ElementImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/ElementImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/ElementImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/ElementImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,150 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import org.teiid.connector.language.IElement;
+import org.teiid.connector.language.IGroup;
+import org.teiid.connector.metadata.runtime.Element;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+public class ElementImpl extends BaseLanguageObject implements IElement {
+
+    private IGroup group;
+    private String name;
+    private Element metadataObject;
+    private Class type;
+    
+    public ElementImpl(IGroup group, String name, Element metadataObject, Class type) {
+        this.group = group;
+        this.name = name;
+        this.metadataObject = metadataObject;
+        this.type = type;
+    }
+    
+    /**
+     * @see org.teiid.connector.language.IElement#getName()
+     */
+    public String getName() {
+        return this.name;
+    }
+
+    /**
+     * @see org.teiid.connector.language.IElement#getGroup()
+     */
+    public IGroup getGroup() {
+        return group;
+    }
+
+    @Override
+    public Element getMetadataObject() {
+    	return this.metadataObject;
+    }
+    
+    public void setMetadataObject(Element metadataObject) {
+		this.metadataObject = metadataObject;
+	}
+    
+    /**
+     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
+     */
+    public void acceptVisitor(LanguageObjectVisitor visitor) {
+        visitor.visit(this);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IElement#setGroup(com.metamatrix.data.language.IGroup)
+     */
+    public void setGroup(IGroup group) {
+        this.group = group;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IExpression#getType()
+     */
+    public Class getType() {
+        return this.type;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IElement#setName(java.lang.String)
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IExpression#setType(java.lang.Class)
+     */
+    public void setType(Class type) {
+        this.type = type;
+    }
+
+    /**
+     * Compare the symbol based ONLY on name.  Symbols are not compared based on
+     * their underlying physical metadata IDs but rather on their representation
+     * in the context of a particular query.  Case is not important when comparing
+     * symbol names.
+     * @param obj Other object
+     * @return True if other obj is a Symbol (or subclass) and name is equal
+     */
+    public boolean equals(Object obj) {
+        if(obj == this) {
+            return true;
+        }
+
+        if(obj != null && obj instanceof IElement) {
+            IElement other = (IElement) obj;
+            
+            // Compare groups
+            if(other.getGroup() == null) {
+                if(this.getGroup() != null) {
+                    return false;
+                }
+            } else {
+                if(this.getGroup() == null) {
+                    return false;
+                }
+                if(! other.getGroup().equals(this.getGroup())) {
+                    return false;
+                }
+            }
+            
+            // Compare elements
+            String thisShortName = this.getName();
+            int dotIndex = thisShortName.lastIndexOf('.');
+            if(dotIndex >= 0) {
+                thisShortName = thisShortName.substring(dotIndex+1);
+            }
+            
+            String otherShortName = other.getName();
+            dotIndex = otherShortName.lastIndexOf('.');
+            if(dotIndex >= 0) {
+                otherShortName = otherShortName.substring(dotIndex+1);
+            }
+            
+            return thisShortName.equalsIgnoreCase(otherShortName);
+        }
+        return false;
+    }
+
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/ExistsCriteriaImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/ExistsCriteriaImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/ExistsCriteriaImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/ExistsCriteriaImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,64 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import org.teiid.connector.language.IExistsCriteria;
+import org.teiid.connector.language.IQuery;
+import org.teiid.connector.language.IQueryCommand;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+/**
+ */
+public class ExistsCriteriaImpl extends BaseLanguageObject implements IExistsCriteria {
+
+    private IQueryCommand query;
+    
+    /**
+     * 
+     */
+    public ExistsCriteriaImpl(IQuery query) {
+        this.query = query;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ISubqueryContainer#getQuery()
+     */
+    public IQueryCommand getQuery() {
+        return query;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
+     */
+    public void acceptVisitor(LanguageObjectVisitor visitor) {
+        visitor.visit(this);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ISubqueryContainer#setQuery(com.metamatrix.data.language.IQuery)
+     */
+    public void setQuery(IQueryCommand query) {
+        this.query = query;
+    }
+
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/FromImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/FromImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/FromImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/FromImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,60 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import java.util.List;
+
+import org.teiid.connector.language.IFrom;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+
+public class FromImpl extends BaseLanguageObject implements IFrom {
+
+    private List items = null;
+    
+    public FromImpl(List items) {
+        this.items = items;
+    }
+    
+    /**
+     * @see org.teiid.connector.language.IFrom#getItems()
+     */
+    public List getItems() {
+        return items;
+    }
+
+    /**
+     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
+     */
+    public void acceptVisitor(LanguageObjectVisitor visitor) {
+        visitor.visit(this);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IFrom#setItems(java.util.List)
+     */
+    public void setItems(List items) {
+        this.items = items;
+    }
+
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/FunctionImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/FunctionImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/FunctionImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/FunctionImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,91 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.teiid.connector.language.IExpression;
+import org.teiid.connector.language.IFunction;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+
+public class FunctionImpl extends BaseLanguageObject implements IFunction {
+
+    private String name;
+    private List<IExpression> parameters;
+    private Class type;
+    
+    public FunctionImpl(String name, List<? extends IExpression> params, Class type) {
+        this.name = name;
+        if (params == null) {
+        	this.parameters = new ArrayList<IExpression>(0);
+        } else {
+        	this.parameters = new ArrayList<IExpression>(params);
+        }
+        this.type = type;
+    }
+    
+    /**
+     * @see org.teiid.connector.language.IFunction#getName()
+     */
+    public String getName() {
+        return this.name;
+    }
+
+    /**
+     * @see org.teiid.connector.language.IFunction#getParameters()
+     */
+    public List<IExpression> getParameters() {
+        return parameters;
+    }
+
+    /**
+     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
+     */
+    public void acceptVisitor(LanguageObjectVisitor visitor) {
+        visitor.visit(this);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IFunction#setName(java.lang.String)
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IExpression#getType()
+     */
+    public Class getType() {
+        return this.type;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IExpression#setType(java.lang.Class)
+     */
+    public void setType(Class type) {
+        this.type = type;
+    }
+
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/GroupByImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/GroupByImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/GroupByImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/GroupByImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,60 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import java.util.List;
+
+import org.teiid.connector.language.IGroupBy;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+
+public class GroupByImpl extends BaseLanguageObject implements IGroupBy {
+
+    private List elements = null;
+    
+    public GroupByImpl(List elements) {
+        this.elements = elements;
+    }
+    
+    /**
+     * @see org.teiid.connector.language.IGroupBy#getElements()
+     */
+    public List getElements() {
+        return elements;
+    }
+
+    /**
+     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
+     */
+    public void acceptVisitor(LanguageObjectVisitor visitor) {
+        visitor.visit(this);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IGroupBy#setElements(java.util.List)
+     */
+    public void setElements(List elements) {
+        this.elements = elements;
+    }
+
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/GroupImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/GroupImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/GroupImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/GroupImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,113 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import org.teiid.connector.language.IGroup;
+import org.teiid.connector.metadata.runtime.Group;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+import com.metamatrix.core.util.HashCodeUtil;
+
+public class GroupImpl extends BaseLanguageObject implements IGroup {
+
+    private String context;
+    private String definition;    
+    private Group metadataObject;
+    
+    public GroupImpl(String context, String definition, Group group) {
+        this.context = context;
+        this.definition = definition;
+        this.metadataObject = group;
+    }
+
+    /**
+     * @see org.teiid.connector.language.IGroup#getContext()
+     */
+    public String getContext() {
+        return context;
+    }
+
+    /**
+     * @see org.teiid.connector.language.IGroup#getDefinition()
+     */
+    public String getDefinition() {
+        return this.definition;
+    }
+
+    @Override
+    public Group getMetadataObject() {
+    	return this.metadataObject;
+    }
+    
+    public void setMetadataObject(Group metadataObject) {
+		this.metadataObject = metadataObject;
+	}
+
+    /**
+     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
+     */
+    public void acceptVisitor(LanguageObjectVisitor visitor) {
+        visitor.visit(this);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IGroup#setDefinition(java.lang.String)
+     */
+    public void setDefinition(String definition) {
+        this.definition = definition;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IGroup#setContext(java.lang.String)
+     */
+    public void setContext(String context) {
+        this.context = context;
+    }
+    
+    public int hashCode() {
+        return HashCodeUtil.hashCode(HashCodeUtil.hashCode(0, this.getDefinition()), this.getContext());
+    }
+    
+    public boolean equals(Object obj) {
+        if(this == obj) {
+            return true;
+        }
+
+        if(obj == null || ! (obj instanceof IGroup)) {
+            return false;
+        }
+        IGroup other = (IGroup) obj;
+
+        // Two group symbols will be equal only if both use aliases or both
+        // don't use aliases.  In either case, comparing context names is
+        // enough.
+        if( (this.getDefinition() == null && other.getDefinition() == null) ||
+            (this.getDefinition() != null && other.getDefinition() != null) ) {
+
+            return this.getContext().equalsIgnoreCase(other.getContext());
+
+        }
+        return false;
+    }
+
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/InCriteriaImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/InCriteriaImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/InCriteriaImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/InCriteriaImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,89 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import java.util.List;
+
+import org.teiid.connector.language.IExpression;
+import org.teiid.connector.language.IInCriteria;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+
+public class InCriteriaImpl extends BaseLanguageObject implements IInCriteria {
+
+    private IExpression leftExpression = null;
+    private List rightExpressions = null;
+    private boolean negated = false;
+    
+    public InCriteriaImpl(IExpression left, List right, boolean negated) {
+        leftExpression = left;
+        rightExpressions = right;
+        this.negated = negated;
+    }
+    /**
+     * @see org.teiid.connector.language.IInCriteria#getLeftExpression()
+     */
+    public IExpression getLeftExpression() {
+        return leftExpression;
+    }
+
+    /**
+     * @see org.teiid.connector.language.IInCriteria#getRightExpressions()
+     */
+    public List getRightExpressions() {
+        return rightExpressions;
+    }
+
+    /**
+     * @see org.teiid.connector.language.IInCriteria#isNegated()
+     */
+    public boolean isNegated() {
+        return this.negated;
+    }
+
+    /**
+     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
+     */
+    public void acceptVisitor(LanguageObjectVisitor visitor) {
+        visitor.visit(this);
+    }
+    /* 
+     * @see com.metamatrix.data.language.IInCriteria#setRightExpressions(java.util.List)
+     */
+    public void setRightExpressions(List expressions) {
+        this.rightExpressions = expressions;
+    }
+    /* 
+     * @see com.metamatrix.data.language.IBaseInCriteria#setLeftExpression(com.metamatrix.data.language.IExpression)
+     */
+    public void setLeftExpression(IExpression expression) {
+        this.leftExpression = expression;
+    }
+    /* 
+     * @see com.metamatrix.data.language.IBaseInCriteria#setNegated(boolean)
+     */
+    public void setNegated(boolean negated) {
+        this.negated = negated;
+    }
+
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/InlineViewImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/InlineViewImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/InlineViewImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/InlineViewImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,72 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import org.teiid.connector.language.IInlineView;
+import org.teiid.connector.language.IQueryCommand;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+/**
+ * Inline views are treated like aliased groups
+ */
+public class InlineViewImpl extends GroupImpl implements IInlineView {
+
+    private String name;
+    private IQueryCommand query;
+    private String output;
+
+    public InlineViewImpl(IQueryCommand query, String name) {        
+        super(name, name, null);
+        this.query = query;
+        this.name = name;
+    }
+
+    public String getName() {
+        return this.name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public IQueryCommand getQuery() {
+        return this.query;
+    }
+
+    public void setQuery(IQueryCommand query) {
+        this.query = query;
+    }
+
+    public void acceptVisitor(LanguageObjectVisitor visitor) {
+        visitor.visit(this);
+    }
+
+	public String getOutput() {
+		return output;
+	}
+
+	public void setOutput(String output) {
+		this.output = output;
+	}
+
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/InsertImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/InsertImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/InsertImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/InsertImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,89 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import java.util.List;
+
+import org.teiid.connector.language.IGroup;
+import org.teiid.connector.language.IInsert;
+import org.teiid.connector.language.IInsertValueSource;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+
+public class InsertImpl extends BaseLanguageObject implements IInsert {
+    
+    private IGroup group;
+    private List elements;
+    private IInsertValueSource valueSource;
+  
+    public InsertImpl(IGroup group, List elements, IInsertValueSource valueSource) {
+        this.group = group;
+        this.elements = elements;
+        this.valueSource = valueSource;
+    }
+    /**
+     * @see org.teiid.connector.language.IInsert#getGroup()
+     */
+    public IGroup getGroup() {
+        return group;
+    }
+
+    /**
+     * @see org.teiid.connector.language.IInsert#getElements()
+     */
+    public List getElements() {
+        return elements;
+    }
+
+    /**
+     * @see org.teiid.connector.language.IInsert#getValueSource()
+     */
+    public IInsertValueSource getValueSource() {
+        return valueSource;
+    }
+
+    /**
+     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
+     */
+    public void acceptVisitor(LanguageObjectVisitor visitor) {
+        visitor.visit(this);
+    }
+    /* 
+     * @see com.metamatrix.data.language.IInsert#setGroup(com.metamatrix.data.language.IGroup)
+     */
+    public void setGroup(IGroup group) {
+        this.group = group;
+    }
+    /* 
+     * @see com.metamatrix.data.language.IInsert#setElements(java.util.List)
+     */
+    public void setElements(List elements) {
+        this.elements = elements;
+    }
+    
+    @Override
+    public void setValueSource(IInsertValueSource values) {
+    	this.valueSource = values;
+    }
+
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/InsertValueExpressionsImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/InsertValueExpressionsImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/InsertValueExpressionsImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/InsertValueExpressionsImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,27 @@
+package org.teiid.connector.language.impl;
+
+import java.util.List;
+
+import org.teiid.connector.language.IExpression;
+import org.teiid.connector.language.IInsertExpressionValueSource;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+public class InsertValueExpressionsImpl extends BaseLanguageObject implements IInsertExpressionValueSource {
+
+	private List<IExpression> values;
+	
+	public InsertValueExpressionsImpl(List<IExpression> values) {
+		this.values = values;
+	}
+
+	@Override
+	public List<IExpression> getValues() {
+		return values;
+	}
+
+	@Override
+	public void acceptVisitor(LanguageObjectVisitor visitor) {
+		visitor.visit(this);
+	}
+	
+}


Property changes on: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/InsertValueExpressionsImpl.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/IsNullCriteriaImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/IsNullCriteriaImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/IsNullCriteriaImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/IsNullCriteriaImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,74 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import org.teiid.connector.language.IExpression;
+import org.teiid.connector.language.IIsNullCriteria;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+public class IsNullCriteriaImpl extends BaseLanguageObject implements IIsNullCriteria {
+    
+    private IExpression expression = null;
+    private boolean negated = false;
+    
+    public IsNullCriteriaImpl(IExpression expr, boolean isNegated) {
+        expression = expr;
+        this.negated = isNegated;
+    }
+
+    /**
+     * @see org.teiid.connector.language.IIsNullCriteria#getExpression()
+     */
+    public IExpression getExpression() {
+        return expression;
+    }
+
+    /**
+     * @see org.teiid.connector.language.IIsNullCriteria#isNegated()
+     */
+    public boolean isNegated() {
+        return this.negated;
+    }
+
+    /**
+     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
+     */
+    public void acceptVisitor(LanguageObjectVisitor visitor) {
+        visitor.visit(this);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IIsNullCriteria#setExpression(com.metamatrix.data.language.IExpression)
+     */
+    public void setExpression(IExpression expression) {
+        this.expression = expression;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IIsNullCriteria#setNegated(boolean)
+     */
+    public void setNegated(boolean negated) {
+        this.negated = negated;
+    }
+
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/JoinImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/JoinImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/JoinImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/JoinImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,104 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import java.util.List;
+
+import org.teiid.connector.language.IFromItem;
+import org.teiid.connector.language.IJoin;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+
+public class JoinImpl extends BaseLanguageObject implements IJoin {
+
+    private IFromItem leftItem = null;
+    private IFromItem rightItem = null;
+    private JoinType joinType;
+    private List criteria = null;
+    
+    public JoinImpl(IFromItem left, IFromItem right, JoinType joinType, List criteria) {
+        this.leftItem = left;
+        this.rightItem = right;
+        this.joinType = joinType;
+        this.criteria = criteria;
+    }
+    /**
+     * @see org.teiid.connector.language.IJoin#getLeftItem()
+     */
+    public IFromItem getLeftItem() {
+        return leftItem;
+    }
+
+    /**
+     * @see org.teiid.connector.language.IJoin#getRightItem()
+     */
+    public IFromItem getRightItem() {
+        return rightItem;
+    }
+
+    /**
+     * @see org.teiid.connector.language.IJoin#getJoinType()
+     */
+    public JoinType getJoinType() {
+        return this.joinType;
+    }
+
+    /**
+     * @see org.teiid.connector.language.IJoin#getCriteria()
+     */
+    public List getCriteria() {
+        return criteria;
+    }
+
+    /**
+     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
+     */
+    public void acceptVisitor(LanguageObjectVisitor visitor) {
+        visitor.visit(this);
+    }
+    /* 
+     * @see com.metamatrix.data.language.IJoin#setLeftItem(com.metamatrix.data.language.IFromItem)
+     */
+    public void setLeftItem(IFromItem item) {
+        this.leftItem = item;
+    }
+    /* 
+     * @see com.metamatrix.data.language.IJoin#setRightItem(com.metamatrix.data.language.IFromItem)
+     */
+    public void setRightItem(IFromItem item) {
+        this.rightItem = item;
+    }
+    /* 
+     * @see com.metamatrix.data.language.IJoin#setJoinType(int)
+     */
+    public void setJoinType(JoinType type) {
+        this.joinType = type;
+    }
+    /* 
+     * @see com.metamatrix.data.language.IJoin#setCriteria(java.util.List)
+     */
+    public void setCriteria(List criteria) {
+        this.criteria = criteria;
+    }
+
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/LanguageFactoryImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/LanguageFactoryImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/LanguageFactoryImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/LanguageFactoryImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,346 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.teiid.connector.language.IAggregate;
+import org.teiid.connector.language.ICompareCriteria;
+import org.teiid.connector.language.ICompoundCriteria;
+import org.teiid.connector.language.ICriteria;
+import org.teiid.connector.language.IDelete;
+import org.teiid.connector.language.IElement;
+import org.teiid.connector.language.IExistsCriteria;
+import org.teiid.connector.language.IExpression;
+import org.teiid.connector.language.IFrom;
+import org.teiid.connector.language.IFromItem;
+import org.teiid.connector.language.IFunction;
+import org.teiid.connector.language.IGroup;
+import org.teiid.connector.language.IGroupBy;
+import org.teiid.connector.language.IInCriteria;
+import org.teiid.connector.language.IInlineView;
+import org.teiid.connector.language.IInsert;
+import org.teiid.connector.language.IInsertExpressionValueSource;
+import org.teiid.connector.language.IInsertValueSource;
+import org.teiid.connector.language.IIsNullCriteria;
+import org.teiid.connector.language.IJoin;
+import org.teiid.connector.language.ILanguageFactory;
+import org.teiid.connector.language.ILikeCriteria;
+import org.teiid.connector.language.ILimit;
+import org.teiid.connector.language.ILiteral;
+import org.teiid.connector.language.INotCriteria;
+import org.teiid.connector.language.IOrderBy;
+import org.teiid.connector.language.IOrderByItem;
+import org.teiid.connector.language.IParameter;
+import org.teiid.connector.language.IProcedure;
+import org.teiid.connector.language.IQuery;
+import org.teiid.connector.language.IQueryCommand;
+import org.teiid.connector.language.IScalarSubquery;
+import org.teiid.connector.language.ISearchedCaseExpression;
+import org.teiid.connector.language.ISelect;
+import org.teiid.connector.language.ISelectSymbol;
+import org.teiid.connector.language.ISetClause;
+import org.teiid.connector.language.ISetClauseList;
+import org.teiid.connector.language.ISetQuery;
+import org.teiid.connector.language.ISubqueryCompareCriteria;
+import org.teiid.connector.language.ISubqueryInCriteria;
+import org.teiid.connector.language.IUpdate;
+import org.teiid.connector.metadata.runtime.Element;
+import org.teiid.connector.metadata.runtime.Group;
+import org.teiid.connector.metadata.runtime.Parameter;
+import org.teiid.connector.metadata.runtime.Procedure;
+
+
+/**
+ */
+public class LanguageFactoryImpl implements ILanguageFactory {
+
+    /**
+     * Public instance, holds no state so can be shared by everyone.
+     */
+    public static final LanguageFactoryImpl INSTANCE = new LanguageFactoryImpl();
+
+
+
+    /* 
+     * @see com.metamatrix.data.language.ILanguageFactory#createAggregate(java.lang.String, boolean, com.metamatrix.data.language.IExpression, java.lang.Class)
+     */
+    public IAggregate createAggregate(String name, boolean isDistinct, IExpression expression, Class type) {
+        return new AggregateImpl(name, isDistinct, expression, type);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILanguageFactory#createCompareCriteria(int, com.metamatrix.data.language.IExpression, com.metamatrix.data.language.IExpression)
+     */
+    public ICompareCriteria createCompareCriteria(
+        ICompareCriteria.Operator operator,
+        IExpression leftExpression,
+        IExpression rightExpression) {
+        return new CompareCriteriaImpl(leftExpression, rightExpression, operator);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILanguageFactory#createCompoundCriteria(int, java.util.List)
+     */
+    public ICompoundCriteria createCompoundCriteria(ICompoundCriteria.Operator operator, List innerCriteria) {
+        return new CompoundCriteriaImpl(innerCriteria, operator);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILanguageFactory#createDelete(com.metamatrix.data.language.IGroup, com.metamatrix.data.language.ICriteria)
+     */
+    public IDelete createDelete(IGroup group, ICriteria criteria) {
+        return new DeleteImpl(group, criteria);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILanguageFactory#createElement(java.lang.String, com.metamatrix.data.language.IGroup, com.metamatrix.data.metadata.runtime.MetadataID)
+     */
+    public IElement createElement(String name, IGroup group, Element metadataReference, Class type) {
+        return new ElementImpl(group, name, metadataReference, type);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILanguageFactory#createExistsCriteria(com.metamatrix.data.language.IQuery)
+     */
+    public IExistsCriteria createExistsCriteria(IQuery query) {
+        return new ExistsCriteriaImpl(query);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILanguageFactory#createFrom(java.util.List)
+     */
+    public IFrom createFrom(List items) {
+        return new FromImpl(items);
+    }
+    
+    @Override
+    public IFunction createFunction(String functionName, IExpression[] args,
+    		Class<?> type) {
+    	return new FunctionImpl(functionName, Arrays.asList(args), type);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILanguageFactory#createFunction(java.lang.String, com.metamatrix.data.language.IExpression[], java.lang.Class)
+     */
+    @Override
+    public IFunction createFunction(String functionName, List<? extends IExpression> args, Class<?> type) {
+        return new FunctionImpl(functionName, args, type);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILanguageFactory#createGroup(java.lang.String, java.lang.String, com.metamatrix.data.metadata.runtime.MetadataID)
+     */
+    public IGroup createGroup(String context, String definition, Group metadataReference) {
+        return new GroupImpl(context, definition, metadataReference);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILanguageFactory#createGroupBy(java.util.List)
+     */
+    public IGroupBy createGroupBy(List items) {
+        return new GroupByImpl(items);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILanguageFactory#createInCriteria(com.metamatrix.data.language.IExpression, java.util.List, boolean)
+     */
+    public IInCriteria createInCriteria(IExpression leftExpression, List rightExpressions, boolean isNegated) {
+        return new InCriteriaImpl(leftExpression, rightExpressions, isNegated);
+    }
+    
+    @Override
+    public IInsert createInsert(IGroup group, List<IElement> columns,
+    		IInsertValueSource valueSource) {
+        return new InsertImpl(group, columns, valueSource);
+    }
+    
+    @Override
+    public IInsertExpressionValueSource createInsertExpressionValueSource(
+    		List<IExpression> values) {
+    	return new InsertValueExpressionsImpl(values);
+    }
+    
+    /* 
+     * @see com.metamatrix.data.language.ILanguageFactory#createIsNullCriteria(com.metamatrix.data.language.IExpression, boolean)
+     */
+    public IIsNullCriteria createIsNullCriteria(IExpression expression, boolean isNegated) {
+        return new IsNullCriteriaImpl(expression, isNegated);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILanguageFactory#createJoin(int, com.metamatrix.data.language.IFromItem, com.metamatrix.data.language.IFromItem, java.util.List)
+     */
+    public IJoin createJoin(IJoin.JoinType joinType, IFromItem leftItem, IFromItem rightItem, List criteria) {
+        return new JoinImpl(leftItem, rightItem, joinType, criteria);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILanguageFactory#createLikeCriteria(com.metamatrix.data.language.IExpression, com.metamatrix.data.language.IExpression, java.lang.Character, boolean)
+     */
+    public ILikeCriteria createLikeCriteria(
+        IExpression leftExpression,
+        IExpression rightExpression,
+        Character escapeCharacter,
+        boolean isNegated) {
+        return new LikeCriteriaImpl(leftExpression, rightExpression, escapeCharacter, isNegated);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILanguageFactory#createLiteral(java.lang.Object, java.lang.Class)
+     */
+    public ILiteral createLiteral(Object value, Class type) {
+        return new LiteralImpl(value, type);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILanguageFactory#createNotCriteria(com.metamatrix.data.language.ICriteria)
+     */
+    public INotCriteria createNotCriteria(ICriteria criteria) {
+        return new NotCriteriaImpl(criteria);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILanguageFactory#createOrderBy(java.util.List)
+     */
+    public IOrderBy createOrderBy(List items) {
+        return new OrderByImpl(items);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILanguageFactory#createOrderByItem(java.lang.String, com.metamatrix.data.language.IElement, boolean)
+     */
+    public IOrderByItem createOrderByItem(String name, IElement element, boolean direction) {
+        return new OrderByItemImpl(name, direction, element);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILanguageFactory#createParameter(int, int, java.lang.Object, java.lang.Class)
+     */
+    public IParameter createParameter(int index, IParameter.Direction direction, Object value, Class type, Parameter metadataReference) {
+        return new ParameterImpl(index, direction, value, type, metadataReference);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILanguageFactory#createProcedure(java.lang.String, java.util.List, com.metamatrix.data.metadata.runtime.MetadataID)
+     */
+    public IProcedure createProcedure(String name, List parameters, Procedure metadataReference) {
+        return new ProcedureImpl(name, parameters, metadataReference);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILanguageFactory#createQuery(com.metamatrix.data.language.ISelect, com.metamatrix.data.language.IFrom, com.metamatrix.data.language.ICriteria, com.metamatrix.data.language.IGroupBy, com.metamatrix.data.language.ICriteria, com.metamatrix.data.language.IOrderBy)
+     */
+    public IQuery createQuery(
+        ISelect select,
+        IFrom from,
+        ICriteria where,
+        IGroupBy groupBy,
+        ICriteria having,
+        IOrderBy orderBy) {
+        return new QueryImpl(select, from, where, groupBy, having, orderBy);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILanguageFactory#createScalarSubquery(com.metamatrix.data.language.IQuery)
+     */
+    public IScalarSubquery createScalarSubquery(IQuery query) {
+        return new ScalarSubqueryImpl(query);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILanguageFactory#createSearchedCaseExpression(java.util.List, java.util.List, com.metamatrix.data.language.IExpression, java.lang.Class)
+     */
+    public ISearchedCaseExpression createSearchedCaseExpression(
+        List whenExpressions,
+        List thenExpressions,
+        IExpression elseExpression,
+        Class type) {
+        return new SearchedCaseExpressionImpl(whenExpressions, thenExpressions, elseExpression, type);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILanguageFactory#createSelect(boolean, java.util.List)
+     */
+    public ISelect createSelect(boolean isDistinct, List selectSymbols) {
+        return new SelectImpl(selectSymbols, isDistinct);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILanguageFactory#createSelectSymbol(java.lang.String, com.metamatrix.data.language.IExpression)
+     */
+    public ISelectSymbol createSelectSymbol(String name, IExpression expression) {
+        return new SelectSymbolImpl(name, expression);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILanguageFactory#createSubqueryCompareCriteria(com.metamatrix.data.language.IExpression, int, int, com.metamatrix.data.language.IQuery)
+     */
+    public ISubqueryCompareCriteria createSubqueryCompareCriteria(
+        IExpression leftExpression,
+        ICompareCriteria.Operator operator,
+        ISubqueryCompareCriteria.Quantifier quantifier,
+        IQuery subquery) {
+        return new SubqueryCompareCriteriaImpl(leftExpression, operator, quantifier, subquery);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILanguageFactory#createSubqueryInCriteria(com.metamatrix.data.language.IExpression, com.metamatrix.data.language.IQuery, boolean)
+     */
+    public ISubqueryInCriteria createSubqueryInCriteria(IExpression expression, IQuery subquery, boolean isNegated) {
+        return new SubqueryInCriteriaImpl(expression, isNegated, subquery);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILanguageFactory#createUpdate(com.metamatrix.data.language.IGroup, java.util.List, com.metamatrix.data.language.ICriteria)
+     */
+    public IUpdate createUpdate(IGroup group, ISetClauseList updates, ICriteria criteria) {
+        return new UpdateImpl(group, updates, criteria);
+    }
+
+    public IInlineView createInlineView(IQueryCommand query, String name) {
+        return new InlineViewImpl(query, name);
+    }
+
+    public ISetQuery createSetOp(ISetQuery.Operation operation, boolean all, IQueryCommand leftQuery, IQueryCommand rightQuery, IOrderBy orderBy, ILimit limit) {
+        SetQueryImpl queryImpl = new SetQueryImpl();
+        queryImpl.setOperation(operation);
+        queryImpl.setAll(all);
+        queryImpl.setLeftQuery(leftQuery);
+        queryImpl.setRightQuery(rightQuery);
+        queryImpl.setOrderBy(orderBy);
+        queryImpl.setLimit(limit);
+        return queryImpl;
+    }
+
+	@Override
+	public ISetClause createSetClause(IElement symbol, IExpression value) {
+		return new SetClauseImpl(symbol, value);
+	}
+
+	@Override
+	public ISetClauseList createSetClauseList(List<ISetClause> clauses) {
+		return new SetClauseListImpl(clauses);
+	}
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/LikeCriteriaImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/LikeCriteriaImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/LikeCriteriaImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/LikeCriteriaImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,107 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import org.teiid.connector.language.IExpression;
+import org.teiid.connector.language.ILikeCriteria;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+public class LikeCriteriaImpl extends BaseLanguageObject implements ILikeCriteria {
+        
+    private IExpression leftExpression = null;
+    private IExpression rightExpression = null;
+    private Character escapeCharacter = null;
+    private boolean isNegated = false;
+    
+    public LikeCriteriaImpl(IExpression left, IExpression right, Character escapeCharacter, boolean negated) {
+        leftExpression = left;
+        rightExpression = right;
+        this.escapeCharacter = escapeCharacter;
+        this.isNegated = negated;
+        
+    }
+
+    /**
+     * @see org.teiid.connector.language.ILikeCriteria#getLeftExpression()
+     */
+    public IExpression getLeftExpression() {
+        return leftExpression;
+    }
+
+    /**
+     * @see org.teiid.connector.language.ILikeCriteria#getRightExpression()
+     */
+    public IExpression getRightExpression() {
+        return rightExpression;
+    }
+
+    /**
+     * @see org.teiid.connector.language.ILikeCriteria#getEscapeCharacter()
+     */
+    public Character getEscapeCharacter() {
+        return this.escapeCharacter;
+    }
+
+    /**
+     * @see org.teiid.connector.language.ILikeCriteria#isNegated()
+     */
+    public boolean isNegated() {
+        return this.isNegated;
+    }
+
+    /**
+     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
+     */
+    public void acceptVisitor(LanguageObjectVisitor visitor) {
+        visitor.visit(this);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILikeCriteria#setLeftExpression(com.metamatrix.data.language.IExpression)
+     */
+    public void setLeftExpression(IExpression expression) {
+        this.leftExpression = expression;        
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILikeCriteria#setRightExpression(com.metamatrix.data.language.IExpression)
+     */
+    public void setRightExpression(IExpression expression) {
+        this.rightExpression = expression;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILikeCriteria#setEscapeCharacter(java.lang.Character)
+     */
+    public void setEscapeCharacter(Character character) {
+        this.escapeCharacter = character;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILikeCriteria#setNegated(boolean)
+     */
+    public void setNegated(boolean negated) {
+        this.isNegated = negated;
+    }
+
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/LimitImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/LimitImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/LimitImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/LimitImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,65 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import org.teiid.connector.language.ILimit;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+
+/** 
+ * @since 4.3
+ */
+public class LimitImpl extends BaseLanguageObject implements ILimit {
+
+    private int rowOffset;
+    private int rowLimit;
+    
+    public LimitImpl(int offset, int rowLimit) {
+        this.rowOffset = offset;
+        this.rowLimit = rowLimit;
+    }
+    /** 
+     * @see org.teiid.connector.language.ILimit#getRowLimit()
+     * @since 4.3
+     */
+    public int getRowLimit() {
+        return rowLimit;
+    }
+
+    /** 
+     * @see org.teiid.connector.language.ILimit#getRowOffset()
+     * @since 4.3
+     */
+    public int getRowOffset() {
+        return rowOffset;
+    }
+
+    /** 
+     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(org.teiid.connector.visitor.framework.LanguageObjectVisitor)
+     * @since 4.3
+     */
+    public void acceptVisitor(LanguageObjectVisitor visitor) {
+        visitor.visit(this);
+    }
+
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/LiteralImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/LiteralImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/LiteralImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/LiteralImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,97 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import org.teiid.connector.language.ILiteral;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+public class LiteralImpl extends BaseLanguageObject implements ILiteral {
+    
+    private Object value;
+    private Class<?> type;
+    private boolean bindValue;
+    private boolean multiValued;
+    
+    public LiteralImpl(Object value, Class<?> type) {
+        this.value = value;
+        this.type = type;
+    }
+    
+    /**
+     * @see org.teiid.connector.language.ILiteral#getValue()
+     */
+    public Object getValue() {
+        return this.value;
+    }
+
+    /**
+     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
+     */
+    public void acceptVisitor(LanguageObjectVisitor visitor) {
+        visitor.visit(this);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILiteral#getType()
+     */
+    public Class<?> getType() {
+        return this.type;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILiteral#setValue(java.lang.Object)
+     */
+    public void setValue(Object value) {
+        this.value = value;
+    }
+
+    /** 
+     * @see org.teiid.connector.language.ILiteral#isBindValue()
+     */
+    public boolean isBindValue() {
+        return bindValue;
+    }
+
+    /** 
+     * @see org.teiid.connector.language.ILiteral#setBindValue(boolean)
+     */
+    public void setBindValue(boolean bindValue) {
+        this.bindValue = bindValue;
+    }
+
+	@Override
+	public boolean isMultiValued() {
+		return multiValued;
+	}
+
+	@Override
+	public void setMultiValued(boolean multiValued) {
+		this.multiValued = multiValued;
+	}
+
+	@Override
+	public void setType(Class<?> type) {
+		this.type = type;
+	}
+
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/NotCriteriaImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/NotCriteriaImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/NotCriteriaImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/NotCriteriaImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,56 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import org.teiid.connector.language.ICriteria;
+import org.teiid.connector.language.INotCriteria;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+public class NotCriteriaImpl extends BaseLanguageObject implements INotCriteria {
+
+    private ICriteria criteria = null;
+    
+    public NotCriteriaImpl(ICriteria criteria) {
+        this.criteria = criteria;
+    }
+    /**
+     * @see org.teiid.connector.language.INotCriteria#getCriteria()
+     */
+    public ICriteria getCriteria() {
+        return criteria;
+    }
+
+    /**
+     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
+     */
+    public void acceptVisitor(LanguageObjectVisitor visitor) {
+        visitor.visit(this);
+    }
+    /* 
+     * @see com.metamatrix.data.language.INotCriteria#setCriteria(com.metamatrix.data.language.ICriteria)
+     */
+    public void setCriteria(ICriteria criteria) {
+        this.criteria = criteria;
+    }
+
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/OrderByImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/OrderByImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/OrderByImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/OrderByImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,60 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import java.util.List;
+
+import org.teiid.connector.language.IOrderBy;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+
+public class OrderByImpl extends BaseLanguageObject implements IOrderBy {
+
+    private List items = null;
+    
+    public OrderByImpl(List items) {
+        this.items = items;
+    }
+    
+    /**
+     * @see org.teiid.connector.language.IOrderBy#getItems()
+     */
+    public List getItems() {
+        return items;
+    }
+
+    /**
+     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
+     */
+    public void acceptVisitor(LanguageObjectVisitor visitor) {
+        visitor.visit(this);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IOrderBy#setItems(java.util.List)
+     */
+    public void setItems(List items) {
+        this.items = items;
+    }
+
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/OrderByItemImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/OrderByItemImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/OrderByItemImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/OrderByItemImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,90 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import org.teiid.connector.language.IElement;
+import org.teiid.connector.language.IOrderByItem;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+public class OrderByItemImpl extends BaseLanguageObject implements IOrderByItem {
+    
+    private String name;
+    private boolean direction = false;
+    private IElement element;       // optional, may be null
+    
+    public OrderByItemImpl(String name, boolean direction, IElement element) {
+        this.name = name;
+        this.direction = direction;
+        this.element = element;
+    }
+
+    /**
+     * @see org.teiid.connector.language.IOrderByItem#getName()
+     */
+    public String getName() {
+        return this.name;
+    }
+
+    /**
+     * @see org.teiid.connector.language.IOrderByItem#getDirection()
+     */
+    public boolean getDirection() {
+        return direction;
+    }
+
+    /**
+     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
+     */
+    public void acceptVisitor(LanguageObjectVisitor visitor) {
+        visitor.visit(this);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IOrderByItem#setName(java.lang.String)
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IOrderByItem#setDirection(boolean)
+     */
+    public void setDirection(boolean direction) {
+        this.direction = direction;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IOrderByElementItem#getElement()
+     */
+    public IElement getElement() {
+        return this.element;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IOrderByElementItem#setElement(com.metamatrix.data.language.IElement)
+     */
+    public void setElement(IElement element) {
+        this.element = element;
+    }
+
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/ParameterImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/ParameterImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/ParameterImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/ParameterImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -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 org.teiid.connector.language.impl;
+
+import org.teiid.connector.language.IParameter;
+import org.teiid.connector.metadata.runtime.Parameter;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+public class ParameterImpl extends BaseLanguageObject implements IParameter {
+
+    private int index;
+    private Direction direction;
+    private Object value;
+    private boolean valueSpecified;
+    private Class type;
+    private Parameter metadataObject;
+    
+    public ParameterImpl(int index, Direction direction, Object value, Class type, Parameter metadataObject) {
+        setIndex(index);
+        setDirection(direction);
+        setValue(value);
+        setType(type);
+        this.metadataObject = metadataObject;
+    }
+    
+    /**
+     * @see org.teiid.connector.language.IParameter#getIndex()
+     */
+    public int getIndex() {
+        return this.index;
+    }
+
+    /**
+     * @see org.teiid.connector.language.IParameter#getDirection()
+     */
+    public Direction getDirection() {
+        return this.direction;
+    }
+
+    /**
+     * @see org.teiid.connector.language.IParameter#getType()
+     */
+    public Class getType() {
+        return this.type;
+    }
+
+    /*
+     * @see com.metamatrix.data.language.IParameter#getValue()
+     */
+    public Object getValue() {
+        return this.value;
+    }
+
+    /**
+     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
+     */
+    public void acceptVisitor(LanguageObjectVisitor visitor) {
+        visitor.visit(this);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IParameter#setIndex(int)
+     */
+    public void setIndex(int index) {
+        this.index = index;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IParameter#setDirection(int)
+     */
+    public void setDirection(Direction direction) {
+        this.direction = direction;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IParameter#setType(java.lang.Class)
+     */
+    public void setType(Class type) {
+        this.type = type;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IParameter#setValue(java.lang.Object)
+     */
+    public void setValue(Object value) {
+        this.value = value;
+        if(value != null) {
+            setValueSpecified(true);
+        }
+    }
+
+    @Override
+    public Parameter getMetadataObject() {
+    	return this.metadataObject;
+    }
+
+    public void setMetadataObject(Parameter metadataObject) {
+		this.metadataObject = metadataObject;
+	}
+    
+    /** 
+     * @see org.teiid.connector.language.IParameter#getValueSpecified()
+     * @since 4.3.2
+     */
+    public boolean getValueSpecified() {
+        return this.valueSpecified;
+    }
+    
+    /** 
+     * @see org.teiid.connector.language.IParameter#setValueSpecified(boolean)
+     * @since 4.3.2
+     */
+    public void setValueSpecified(boolean specified) {
+        this.valueSpecified = specified;
+    }
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/ProcedureImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/ProcedureImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/ProcedureImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/ProcedureImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,121 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import java.util.List;
+
+import org.teiid.connector.api.ConnectorException;
+import org.teiid.connector.language.IParameter;
+import org.teiid.connector.language.IProcedure;
+import org.teiid.connector.language.IParameter.Direction;
+import org.teiid.connector.metadata.runtime.Element;
+import org.teiid.connector.metadata.runtime.Procedure;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+
+public class ProcedureImpl extends BaseLanguageObject implements IProcedure {
+
+    private String name;
+    private List<IParameter> parameters;
+    private Procedure metadataObject;
+    
+    public ProcedureImpl(String name, List<IParameter> parameters, Procedure metadataObject) {
+        this.name = name;
+        this.parameters = parameters;
+        this.metadataObject = metadataObject;
+    }
+    
+    /**
+     * @see com.metamatrix.data.language.IExecute#getProcedureName()
+     */
+    public String getProcedureName() {
+        return this.name;
+    }
+
+    /**
+     * @see com.metamatrix.data.language.IExecute#getVariableValues()
+     */
+    public List<IParameter> getParameters() {
+        return parameters;
+    }
+
+    /**
+     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
+     */
+    public void acceptVisitor(LanguageObjectVisitor visitor) {
+        visitor.visit(this);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IExecute#setProcedureName(java.lang.String)
+     */
+    public void setProcedureName(String name) {
+        this.name = name;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IExecute#setParameters(java.util.List)
+     */
+    public void setParameters(List<IParameter> parameters) {
+        this.parameters = parameters;
+    }
+
+    @Override
+    public Procedure getMetadataObject() {
+    	return this.metadataObject;
+    }
+
+    public void setMetadataObject(Procedure metadataID) {
+        this.metadataObject = metadataID;
+    }
+    
+    public boolean equals(Object obj) {
+        if(obj == this) {
+            return true;
+        }
+        
+        if(obj == null) {
+            return false;
+        }
+        
+        IProcedure proc = (IProcedure) obj;
+        return getProcedureName().equalsIgnoreCase(proc.getProcedureName());
+    }
+    
+    public Class<?>[] getResultSetColumnTypes() throws ConnectorException {
+        for (IParameter param : parameters) {
+            if(param.getDirection() == Direction.RESULT_SET){
+                List<Element> columnMetadata = param.getMetadataObject().getChildren();
+
+                int size = columnMetadata.size();
+                Class<?>[] coulmnDTs = new Class[size];
+                for(int i =0; i<size; i++ ){
+                    coulmnDTs[i] = columnMetadata.get(i).getJavaType();
+                }
+                return coulmnDTs;
+            }
+        }
+        return new Class[0];
+    }
+
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/QueryCommandImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/QueryCommandImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/QueryCommandImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/QueryCommandImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,90 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.teiid.connector.language.ILimit;
+import org.teiid.connector.language.IOrderBy;
+import org.teiid.connector.language.ISelectSymbol;
+
+
+public abstract class QueryCommandImpl extends BaseLanguageObject implements org.teiid.connector.language.IQueryCommand {
+
+    private IOrderBy orderBy = null;
+    private ILimit limit = null;
+
+    /**
+     * @see org.teiid.connector.language.IQuery#getOrderBy()
+     */
+    public IOrderBy getOrderBy() {
+        return orderBy;
+    }
+
+    /**
+     * @see org.teiid.connector.language.IQuery#getLimit()
+     */
+    public ILimit getLimit() {
+        return limit;
+    }
+    
+    public String[] getColumnNames() {
+        List selectSymbols = getProjectedQuery().getSelect().getSelectSymbols();
+        String[] columnNames = new String[selectSymbols.size()];
+        int symbolIndex = 0;
+        for (Iterator i = selectSymbols.iterator(); i.hasNext(); symbolIndex++) {
+            columnNames[symbolIndex] = ((ISelectSymbol)i.next()).getOutputName();
+        }
+        return columnNames;
+    }
+    
+    public Class[] getColumnTypes() {
+        List selectSymbols = getProjectedQuery().getSelect().getSelectSymbols();
+        Class[] columnTypes = new Class[selectSymbols.size()];
+        int symbolIndex = 0;
+        for (Iterator i = selectSymbols.iterator(); i.hasNext(); symbolIndex++) {
+            ISelectSymbol symbol = (ISelectSymbol)i.next();
+            if (symbol.getExpression() == null) {
+                columnTypes[symbolIndex] = null;
+            } else {
+                columnTypes[symbolIndex] = symbol.getExpression().getType();
+            }
+        }
+        return columnTypes;
+    }
+    
+    /* 
+     * @see com.metamatrix.data.language.IQuery#setOrderBy(com.metamatrix.data.language.IOrderBy)
+     */
+    public void setOrderBy(IOrderBy orderBy) {
+        this.orderBy = orderBy;
+    }
+    
+    /* 
+     * @see com.metamatrix.data.language.IQuery#setOrderBy(com.metamatrix.data.language.IOrderBy)
+     */
+    public void setLimit(ILimit limit) {
+        this.limit = limit;
+    }
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/QueryImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/QueryImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/QueryImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/QueryImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,158 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.teiid.connector.language.ICriteria;
+import org.teiid.connector.language.IFrom;
+import org.teiid.connector.language.IGroupBy;
+import org.teiid.connector.language.IOrderBy;
+import org.teiid.connector.language.IQuery;
+import org.teiid.connector.language.ISelect;
+import org.teiid.connector.language.ISelectSymbol;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+
+public class QueryImpl extends QueryCommandImpl implements IQuery {
+
+    private ISelect select = null;
+    private IFrom from = null;
+    private ICriteria where = null;
+    private IGroupBy groupBy = null;
+    private ICriteria having = null;
+    
+    public QueryImpl(ISelect select, IFrom from, ICriteria where,
+                     IGroupBy groupBy, ICriteria having, IOrderBy orderBy) {
+        this.select = select;
+        this.from = from;
+        this.where = where;
+        this.groupBy = groupBy;
+        this.having = having;
+        this.setOrderBy(orderBy);
+    }
+    /**
+     * @see org.teiid.connector.language.IQuery#getSelect()
+     */
+    public ISelect getSelect() {
+        return select;
+    }
+
+    /**
+     * @see org.teiid.connector.language.IQuery#getFrom()
+     */
+    public IFrom getFrom() {
+        return from;
+    }
+
+    /**
+     * @see org.teiid.connector.language.IQuery#getWhere()
+     */
+    public ICriteria getWhere() {
+        return where;
+    }
+
+    /**
+     * @see org.teiid.connector.language.IQuery#getGroupBy()
+     */
+    public IGroupBy getGroupBy() {
+        return groupBy;
+    }
+
+    /**
+     * @see org.teiid.connector.language.IQuery#getHaving()
+     */
+    public ICriteria getHaving() {
+        return having;
+    }
+
+    public String[] getColumnNames() {
+        List selectSymbols = getSelect().getSelectSymbols();
+        String[] columnNames = new String[selectSymbols.size()];
+        int symbolIndex = 0;
+        for (Iterator i = selectSymbols.iterator(); i.hasNext(); symbolIndex++) {
+            columnNames[symbolIndex] = ((ISelectSymbol)i.next()).getOutputName();
+        }
+        return columnNames;
+    }
+    
+    public Class[] getColumnTypes() {
+        List selectSymbols = getSelect().getSelectSymbols();
+        Class[] columnTypes = new Class[selectSymbols.size()];
+        int symbolIndex = 0;
+        for (Iterator i = selectSymbols.iterator(); i.hasNext(); symbolIndex++) {
+            ISelectSymbol symbol = (ISelectSymbol)i.next();
+            if (symbol.getExpression() == null) {
+                columnTypes[symbolIndex] = null;
+            } else {
+                columnTypes[symbolIndex] = symbol.getExpression().getType();
+            }
+        }
+        return columnTypes;
+    }
+    
+    /**
+     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
+     */
+    public void acceptVisitor(LanguageObjectVisitor visitor) {
+        visitor.visit(this);
+    }
+    /* 
+     * @see com.metamatrix.data.language.IQuery#setSelect(com.metamatrix.data.language.ISelect)
+     */
+    public void setSelect(ISelect select) {
+        this.select = select;
+    }
+    /* 
+     * @see com.metamatrix.data.language.IQuery#setFrom(com.metamatrix.data.language.IFrom)
+     */
+    public void setFrom(IFrom from) {
+        this.from = from;
+    }
+    /* 
+     * @see com.metamatrix.data.language.IQuery#setWhere(com.metamatrix.data.language.ICriteria)
+     */
+    public void setWhere(ICriteria criteria) {
+        this.where = criteria;
+    }
+    /* 
+     * @see com.metamatrix.data.language.IQuery#setGroupBy(com.metamatrix.data.language.IGroupBy)
+     */
+    public void setGroupBy(IGroupBy groupBy) {
+        this.groupBy = groupBy;
+    }
+    /* 
+     * @see com.metamatrix.data.language.IQuery#setHaving(com.metamatrix.data.language.ICriteria)
+     */
+    public void setHaving(ICriteria criteria) {
+        this.having = criteria;
+    }
+    
+    /** 
+     * @see org.teiid.connector.language.impl.QueryCommandImpl#getProjectedQuery()
+     */
+    public IQuery getProjectedQuery() {
+        return this;
+    }
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/ScalarSubqueryImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/ScalarSubqueryImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/ScalarSubqueryImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/ScalarSubqueryImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,79 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import org.teiid.connector.language.IQueryCommand;
+import org.teiid.connector.language.IScalarSubquery;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+/**
+ */
+public class ScalarSubqueryImpl extends BaseLanguageObject implements IScalarSubquery {
+
+    private IQueryCommand query;
+    private Class type;
+
+    /**
+     * 
+     */
+    public ScalarSubqueryImpl(IQueryCommand query) {
+        setQuery(query);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IExpression#getType()
+     */
+    public Class getType() {
+        return this.type;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ISubqueryContainer#getQuery()
+     */
+    public IQueryCommand getQuery() {
+        return this.query;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
+     */
+    public void acceptVisitor(LanguageObjectVisitor visitor) {
+        visitor.visit(this);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IExpression#setType(java.lang.Class)
+     */
+    public void setType(Class type) {
+        this.type = type;        
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ISubqueryContainer#setQuery(com.metamatrix.data.language.IQuery)
+     */
+    public void setQuery(IQueryCommand query) {
+        this.query = query;
+        this.type = query.getColumnTypes()[0];
+    }
+
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SearchedCaseExpressionImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SearchedCaseExpressionImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SearchedCaseExpressionImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SearchedCaseExpressionImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,111 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import java.util.List;
+
+import org.teiid.connector.language.ICriteria;
+import org.teiid.connector.language.IExpression;
+import org.teiid.connector.language.ISearchedCaseExpression;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+
+public class SearchedCaseExpressionImpl extends BaseLanguageObject implements ISearchedCaseExpression {
+
+    private List whenExpressions;
+    private List thenExpressions;
+    private IExpression elseExpression;
+    private Class type;
+    
+    public SearchedCaseExpressionImpl(List whens, List thens, IExpression elseExpression, Class type) {
+        this.whenExpressions = whens;
+        this.thenExpressions = thens;
+        this.elseExpression = elseExpression;
+        this.type = type;
+    }
+    /**
+     * @see org.teiid.connector.language.ISearchedCaseExpression#getElseExpression()
+     */
+    public IExpression getElseExpression() {
+        return elseExpression;
+    }
+
+    /**
+     * @see org.teiid.connector.language.ISearchedCaseExpression#getThenExpression(int)
+     */
+    public IExpression getThenExpression(int index) {
+        return (IExpression)thenExpressions.get(index);
+    }
+
+    /**
+     * @see org.teiid.connector.language.ISearchedCaseExpression#getWhenCount()
+     */
+    public int getWhenCount() {
+        return whenExpressions.size();
+    }
+
+    /**
+     * @see org.teiid.connector.language.ISearchedCaseExpression#getWhenCriteria(int)
+     */
+    public ICriteria getWhenCriteria(int index) {
+        return (ICriteria)whenExpressions.get(index);
+    }
+
+    /**
+     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
+     */
+    public void acceptVisitor(LanguageObjectVisitor visitor) {
+        visitor.visit(this);
+    }
+    /* 
+     * @see com.metamatrix.data.language.ISearchedCaseExpression#setWhenCriteria(int, com.metamatrix.data.language.ICriteria)
+     */
+    public void setWhenCriteria(int index, ICriteria criteria) {
+        this.whenExpressions.set(index, criteria);
+    }
+    /* 
+     * @see com.metamatrix.data.language.ISearchedCaseExpression#setThenExpression(int, com.metamatrix.data.language.IExpression)
+     */
+    public void setThenExpression(int index, IExpression expression) {
+        this.thenExpressions.set(index, expression);
+    }
+    /* 
+     * @see com.metamatrix.data.language.ISearchedCaseExpression#setElseExpression(com.metamatrix.data.language.IExpression)
+     */
+    public void setElseExpression(IExpression expression) {
+        this.elseExpression = expression;
+    }
+    /* 
+     * @see com.metamatrix.data.language.IExpression#getType()
+     */
+    public Class getType() {
+        return this.type;
+    }
+    /* 
+     * @see com.metamatrix.data.language.IExpression#setType(java.lang.Class)
+     */
+    public void setType(Class type) {
+        this.type = type;
+    }
+
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SelectImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SelectImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SelectImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SelectImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,76 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import java.util.List;
+
+import org.teiid.connector.language.ISelect;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+
+public class SelectImpl extends BaseLanguageObject implements ISelect {
+    
+    private List selectSymbols = null;
+    private boolean isDistinct = false;
+    
+    public SelectImpl(List symbols, boolean distinct) {
+        selectSymbols = symbols;
+        this.isDistinct = distinct;
+    }
+
+    /**
+     * @see org.teiid.connector.language.ISelect#getSelectSymbols()
+     */
+    public List getSelectSymbols() {
+        return selectSymbols;
+    }
+
+    /**
+     * @see org.teiid.connector.language.ISelect#isDistinct()
+     */
+    public boolean isDistinct() {
+        return this.isDistinct;
+    }
+
+    /**
+     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
+     */
+    public void acceptVisitor(LanguageObjectVisitor visitor) {
+        visitor.visit(this);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ISelect#setSelectSymbols(java.util.List)
+     */
+    public void setSelectSymbols(List symbols) {
+        this.selectSymbols = symbols;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ISelect#setDistinct(boolean)
+     */
+    public void setDistinct(boolean distinct) {
+        this.isDistinct = distinct;
+    }
+
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SelectSymbolImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SelectSymbolImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SelectSymbolImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SelectSymbolImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,85 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import org.teiid.connector.language.IExpression;
+import org.teiid.connector.language.ISelectSymbol;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+public class SelectSymbolImpl extends BaseLanguageObject implements ISelectSymbol {
+
+    private boolean hasAlias;
+    private String name;
+    private IExpression expression = null;
+    
+    public SelectSymbolImpl(String name, IExpression expression) {
+        this.name = name;
+        this.expression = expression;
+    }
+    /**
+     * @see org.teiid.connector.language.ISelectSymbol#hasAlias()
+     */
+    public boolean hasAlias() {
+        return hasAlias;
+    }
+
+    public void setAlias(boolean alias){
+        this.hasAlias = alias;    
+    }
+    
+    /**
+     * @see org.teiid.connector.language.ISelectSymbol#getOutputName()
+     */
+    public String getOutputName() {
+        return name;
+    }
+
+    /**
+     * @see org.teiid.connector.language.ISelectSymbol#getExpression()
+     */
+    public IExpression getExpression() {
+        return expression;
+    }
+
+    /**
+     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
+     */
+    public void acceptVisitor(LanguageObjectVisitor visitor) {
+        visitor.visit(this);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ISelectSymbol#setOutputName(java.lang.String)
+     */
+    public void setOutputName(String name) {
+        this.name = name;
+    }
+    
+    /* 
+     * @see com.metamatrix.data.language.ISelectSymbol#setExpression(com.metamatrix.data.language.IExpression)
+     */
+    public void setExpression(IExpression expression) {
+        this.expression = expression;
+    }
+
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SetClauseImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SetClauseImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SetClauseImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SetClauseImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,65 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import org.teiid.connector.language.IElement;
+import org.teiid.connector.language.IExpression;
+import org.teiid.connector.language.ISetClause;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+public class SetClauseImpl extends BaseLanguageObject implements ISetClause {
+
+	private IElement symbol;
+	private IExpression value;
+	
+	public SetClauseImpl(IElement symbol, IExpression value) {
+		this.symbol = symbol;
+		this.value = value;
+	}
+
+	@Override
+	public IElement getSymbol() {
+		return symbol;
+	}
+
+	@Override
+	public IExpression getValue() {
+		return value;
+	}
+
+	@Override
+	public void setSymbol(IElement symbol) {
+		this.symbol = symbol;
+	}
+
+	@Override
+	public void setValue(IExpression value) {
+		this.value = value;
+	}
+
+	@Override
+	public void acceptVisitor(LanguageObjectVisitor visitor) {
+		visitor.visit(this);
+	}
+
+}


Property changes on: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SetClauseImpl.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SetClauseListImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SetClauseListImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SetClauseListImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SetClauseListImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -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 org.teiid.connector.language.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.teiid.connector.language.ISetClause;
+import org.teiid.connector.language.ISetClauseList;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+
+public class SetClauseListImpl extends BaseLanguageObject implements ISetClauseList {
+
+	private List<ISetClause> clauses;
+	
+	public SetClauseListImpl(List<ISetClause> clauses) {
+		if (clauses == null) {
+			clauses = new ArrayList<ISetClause>();
+		}
+		this.clauses = clauses;
+	}
+
+	@Override
+	public List<ISetClause> getClauses() {
+		return clauses;
+	}
+
+	@Override
+	public void acceptVisitor(LanguageObjectVisitor visitor) {
+		visitor.visit(this);
+	}
+
+}


Property changes on: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SetClauseListImpl.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SetQueryImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SetQueryImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SetQueryImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SetQueryImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,109 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import org.teiid.connector.language.IQuery;
+import org.teiid.connector.language.IQueryCommand;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+public class SetQueryImpl extends QueryCommandImpl implements org.teiid.connector.language.ISetQuery {
+
+    private boolean all;
+    private IQueryCommand leftQuery;
+    private IQueryCommand rightQuery;
+    private Operation operation;
+    
+    /** 
+     * @see org.teiid.connector.language.impl.QueryCommandImpl#getProjectedQuery()
+     */
+    public IQuery getProjectedQuery() {
+        if (leftQuery instanceof IQuery) {
+            return (IQuery)leftQuery;
+        }
+        return leftQuery.getProjectedQuery();
+    }
+
+    /** 
+     * @see org.teiid.connector.language.ISetQuery#getLeftQuery()
+     */
+    public IQueryCommand getLeftQuery() {
+        return leftQuery;
+    }
+
+    /** 
+     * @see org.teiid.connector.language.ISetQuery#getOperation()
+     */
+    public Operation getOperation() {
+        return operation;
+    }
+
+    /** 
+     * @see org.teiid.connector.language.ISetQuery#getRightQuery()
+     */
+    public IQueryCommand getRightQuery() {
+        return rightQuery;
+    }
+
+    /** 
+     * @see org.teiid.connector.language.ISetQuery#isAll()
+     */
+    public boolean isAll() {
+        return all;
+    }
+
+    /** 
+     * @see org.teiid.connector.language.ISetQuery#setAll(boolean)
+     */
+    public void setAll(boolean all) {
+        this.all = all;
+    }
+
+    /** 
+     * @see org.teiid.connector.language.ISetQuery#setLeftQuery(org.teiid.connector.language.IQueryCommand)
+     */
+    public void setLeftQuery(IQueryCommand leftQuery) {
+        this.leftQuery = leftQuery;
+    }
+
+    /** 
+     * @see org.teiid.connector.language.ISetQuery#setOperation(org.teiid.connector.language.ISetQuery.Operation)
+     */
+    public void setOperation(Operation operation) {
+        this.operation = operation;
+    }
+
+    /** 
+     * @see org.teiid.connector.language.ISetQuery#setRightQuery(org.teiid.connector.language.IQueryCommand)
+     */
+    public void setRightQuery(IQueryCommand rightQuery) {
+        this.rightQuery = rightQuery;
+    }
+
+    /**
+     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
+     */
+    public void acceptVisitor(LanguageObjectVisitor visitor) {
+        visitor.visit(this);
+    }
+
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SubqueryCompareCriteriaImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SubqueryCompareCriteriaImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SubqueryCompareCriteriaImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SubqueryCompareCriteriaImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,111 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import org.teiid.connector.language.*;
+import org.teiid.connector.language.ICompareCriteria.Operator;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+/**
+ */
+public class SubqueryCompareCriteriaImpl extends BaseLanguageObject implements ISubqueryCompareCriteria {
+
+    private IExpression leftExpr;
+    private Operator operator;
+    private Quantifier quantifier;
+    private IQueryCommand query;
+    
+    /**
+     * 
+     */
+    public SubqueryCompareCriteriaImpl(IExpression leftExpr, Operator operator, Quantifier quantifier, IQueryCommand query) {
+        this.leftExpr = leftExpr;
+        this.operator = operator;
+        this.quantifier = quantifier;
+        this.query = query;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ISubqueryCompareCriteria#getLeftExpression()
+     */
+    public IExpression getLeftExpression() {
+        return this.leftExpr;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ISubqueryCompareCriteria#getOperator()
+     */
+    public Operator getOperator() {
+        return this.operator;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ISubqueryCompareCriteria#getQuantifier()
+     */
+    public Quantifier getQuantifier() {
+        return this.quantifier;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ISubqueryContainer#getQuery()
+     */
+    public IQueryCommand getQuery() {
+        return this.query;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
+     */
+    public void acceptVisitor(LanguageObjectVisitor visitor) {
+        visitor.visit(this);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ISubqueryCompareCriteria#setLeftExpression(com.metamatrix.data.language.IExpression)
+     */
+    public void setLeftExpression(IExpression expression) {
+        this.leftExpr = expression;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ISubqueryCompareCriteria#setOperator(int)
+     */
+    public void setOperator(Operator operator) {
+        this.operator = operator;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ISubqueryCompareCriteria#setQuantifier(int)
+     */
+    public void setQuantifier(Quantifier quantifier) {
+        this.quantifier = quantifier;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ISubqueryContainer#setQuery(com.metamatrix.data.language.IQuery)
+     */
+    public void setQuery(IQueryCommand query) {
+        this.query = query;
+    }
+
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SubqueryInCriteriaImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SubqueryInCriteriaImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SubqueryInCriteriaImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/SubqueryInCriteriaImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,94 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import org.teiid.connector.language.*;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+/**
+ */
+public class SubqueryInCriteriaImpl extends BaseLanguageObject implements ISubqueryInCriteria {
+
+    private IExpression leftExpr;
+    private boolean isNegated = false;
+    private IQueryCommand rightQuery;
+
+    /**
+     * 
+     */
+    public SubqueryInCriteriaImpl(IExpression leftExpr, boolean isNegated, IQueryCommand rightQuery) {
+        this.leftExpr = leftExpr;
+        this.isNegated = isNegated;
+        this.rightQuery = rightQuery;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IBaseInCriteria#getLeftExpression()
+     */
+    public IExpression getLeftExpression() {
+        return this.leftExpr;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IBaseInCriteria#isNegated()
+     */
+    public boolean isNegated() {
+        return this.isNegated;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ISubqueryContainer#getQuery()
+     */
+    public IQueryCommand getQuery() {
+        return this.rightQuery;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
+     */
+    public void acceptVisitor(LanguageObjectVisitor visitor) {
+        visitor.visit(this);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IBaseInCriteria#setLeftExpression(com.metamatrix.data.language.IExpression)
+     */
+    public void setLeftExpression(IExpression expression) {
+        this.leftExpr = expression;        
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IBaseInCriteria#setNegated(boolean)
+     */
+    public void setNegated(boolean negated) {
+        this.isNegated = negated;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.ISubqueryContainer#setQuery(com.metamatrix.data.language.IQuery)
+     */
+    public void setQuery(IQueryCommand query) {
+        this.rightQuery = query;
+    }
+
+}

Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/UpdateImpl.java (from rev 1491, branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/UpdateImpl.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/UpdateImpl.java	                        (rev 0)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/language/impl/UpdateImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,89 @@
+/*
+ * 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 org.teiid.connector.language.impl;
+
+import org.teiid.connector.language.ICriteria;
+import org.teiid.connector.language.IGroup;
+import org.teiid.connector.language.ISetClauseList;
+import org.teiid.connector.language.IUpdate;
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+public class UpdateImpl extends BaseLanguageObject implements IUpdate {
+    
+    private IGroup group;
+    private ISetClauseList changes;
+    private ICriteria criteria;
+    
+    public UpdateImpl(IGroup group, ISetClauseList changes, ICriteria criteria) {
+        this.group = group;
+        this.changes = changes;
+        this.criteria = criteria;
+    }
+
+    /**
+     * @see org.teiid.connector.language.IUpdate#getGroup()
+     */
+    public IGroup getGroup() {
+        return group;
+    }
+
+    /**
+     * @see org.teiid.connector.language.IUpdate#getChanges()
+     */
+    public ISetClauseList getChanges() {
+        return changes;
+    }
+
+    /**
+     * @see org.teiid.connector.language.IUpdate#getCriteria()
+     */
+    public ICriteria getCriteria() {
+        return criteria;
+    }
+
+    /**
+     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
+     */
+    public void acceptVisitor(LanguageObjectVisitor visitor) {
+        visitor.visit(this);
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IUpdate#setGroup(com.metamatrix.data.language.IGroup)
+     */
+    public void setGroup(IGroup group) {
+        this.group = group;
+    }
+
+    public void setChanges(ISetClauseList changes) {
+        this.changes = changes;
+    }
+
+    /* 
+     * @see com.metamatrix.data.language.IUpdate#setCriteria(com.metamatrix.data.language.ICriteria)
+     */
+    public void setCriteria(ICriteria criteria) {
+        this.criteria = criteria;
+    }
+
+}

Modified: branches/JCA/connector-api/src/main/java/org/teiid/connector/metadata/runtime/MetadataFactory.java
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/metadata/runtime/MetadataFactory.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/metadata/runtime/MetadataFactory.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -28,7 +28,6 @@
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
-import java.util.Properties;
 import java.util.Set;
 
 import org.teiid.connector.DataPlugin;
@@ -44,7 +43,6 @@
 	
 	private transient UUIDFactory factory = new UUIDFactory();
 	private transient Map<String, DatatypeRecordImpl> dataTypes;
-	private transient Properties importProperties;
 	
 	private ModelRecordImpl model;
 	private Collection<TableRecordImpl> tables = new ArrayList<TableRecordImpl>();
@@ -54,9 +52,8 @@
 	
 	private Set<String> uniqueNames = new HashSet<String>();
 	
-	public MetadataFactory(String modelName, Map<String, DatatypeRecordImpl> dataTypes, Properties importProperties) {
+	public MetadataFactory(String modelName, Map<String, DatatypeRecordImpl> dataTypes) {
 		this.dataTypes = dataTypes;
-		this.importProperties = importProperties;
 		model = new ModelRecordImpl();
 		model.setFullName(modelName);
 		model.setModelType(ModelType.PHYSICAL);
@@ -65,10 +62,6 @@
 		setUUID(model);	
 	}
 	
-	public Properties getImportProperties() {
-		return importProperties;
-	}
-	
 	@Override
 	public ModelRecordImpl getModel() {
 		return model;
@@ -345,5 +338,4 @@
 			}
 		}
 	}
-		
 }

Deleted: branches/JCA/connector-api/src/main/java/org/teiid/connector/xa/api/TransactionContext.java
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/xa/api/TransactionContext.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/xa/api/TransactionContext.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,53 +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 org.teiid.connector.xa.api;
-
-import javax.transaction.Transaction;
-
-/**
- * Tracks the context of the transaction.
- */
-public interface TransactionContext {
-    
-	public enum Scope {
-		BLOCK,
-		GLOBAL,
-		LOCAL,
-		NONE,
-		REQUEST
-	}
-	
-    public boolean isInTransaction();
-    
-    /** 
-     * @return Returns the transaction.
-     */
-    public Transaction getTransaction();
-
-    /** 
-     * @return Returns the txnID.
-     */
-    public String getTxnID();
-    
-    public Scope getTransactionType();
-}

Deleted: branches/JCA/connector-api/src/main/java/org/teiid/connector/xa/api/XAConnection.java
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/xa/api/XAConnection.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/xa/api/XAConnection.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,40 +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 org.teiid.connector.xa.api;
-
-import javax.transaction.xa.XAResource;
-
-import org.teiid.connector.api.Connection;
-import org.teiid.connector.api.ConnectorException;
-
-
-public interface XAConnection extends Connection{
-    /**
-     * Get XAResource for this connection
-     * @return the XAResource, never null
-     */
-    XAResource getXAResource() throws ConnectorException;
-    
-}

Deleted: branches/JCA/connector-api/src/main/java/org/teiid/connector/xa/api/XAConnector.java
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/xa/api/XAConnector.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connector-api/src/main/java/org/teiid/connector/xa/api/XAConnector.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -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.
- */
-
-/*
- */
-package org.teiid.connector.xa.api;
-
-import org.teiid.connector.api.*;
-
-
-public interface XAConnector extends Connector{
-    
-    /**
-     * Obtain a connection with the connector. The connection must have XAResource in
-     * order to participate in distributed transaction. The connection typically is associated
-     * with a particular context.   
-     * @param context The context of the current user that will be using this connection, 
-     * may be null if this connection is for an administrative operation. 
-     * @param transactionContext The context of the transaction under which the connection will be used. May be null.
-     * @return A Connection, created by the Connector
-     * @throws ConnectorException If an error occurred obtaining a connection
-     */
-    XAConnection getXAConnection( ExecutionContext executionContext, TransactionContext transactionContext) throws ConnectorException;
-
-}

Deleted: branches/JCA/connector-api/src/test/java/org/teiid/connector/TestCredentialMap.java
===================================================================
--- branches/JCA/connector-api/src/test/java/org/teiid/connector/TestCredentialMap.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connector-api/src/test/java/org/teiid/connector/TestCredentialMap.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,350 +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 org.teiid.connector;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.teiid.connector.api.CredentialMap;
-
-
-import junit.framework.TestCase;
-
-/**
- * Note-- due to time constraints, tests make hard-coded assumptions that 
- * keywords for system, user name, and password, are "system", 
- * "user", and "password".  The actual keywords are found in
- * com.metamatrix.platform.security.CredentialsMap:  SYSTEM_KEYWORD,
- * USER_KEYWORD, and PASSWORD_KEYWORD.
- */
-public class TestCredentialMap extends TestCase {
-
-	/**
-	 * Constructor for TestCredentialMap.
-	 * @param arg0
-	 */
-	public TestCredentialMap(String arg0) {
-		super(arg0);
-	}
-	
-	public void testParseNullCredentialString() {
-		String command = null;
-	try {
-            CredentialMap.parseCredentials(command);
-			fail("Did not throw exception on null credential string"); //$NON-NLS-1$
-		} catch (Exception ex) {
-		}
-	}
-	
-	public void testParseEmptyCredentialString() {
-		String command = ""; //$NON-NLS-1$
-	try {
-            CredentialMap.parseCredentials(command);
-			fail("Did not throw exception on empyt credential string"); //$NON-NLS-1$
-		} catch (Exception ex) {
-		}
-	}
-
-	
-	public void testParseMissingSystem() {
-		String command = "(user=myusername)"; //$NON-NLS-1$
-		try {
-            CredentialMap.parseCredentials(command);
-			fail("Did not throw exception on missing system keyword"); //$NON-NLS-1$
-		} catch (Exception ex) {
-		}
-	}
-	
-
-	public void testParseNoOpeningParen() {
-		String command = "system=mysystem,username=me,mypassword=you)"; //$NON-NLS-1$
-		try {
-            CredentialMap.parseCredentials(command);
-			fail("Did not throw exception on missing open paren"); //$NON-NLS-1$
-		} catch (Exception ex) {
-		}
-	}
-	
-	public void testParseNoClosingParen() {
-		String command = "(system=mysystem,username=me,mypassword=you"; //$NON-NLS-1$
-		try {
-            CredentialMap.parseCredentials(command);
-			fail("Did not throw exception on missing closing paren"); //$NON-NLS-1$
-		} catch (Exception ex) {
-		}
-	}
-
-	public void testCaseSensitivity() throws Exception {
-		String command = "(system=mysystem,username=me,mypassword=you)"; //$NON-NLS-1$
-        CredentialMap cm = CredentialMap.parseCredentials(command);
-        Map map = cm.getSystemCredentials("MySystem"); //$NON-NLS-1$
-        if (map == null) {
-        	fail("Error looking up MySystem credentials using different cases."); //$NON-NLS-1$
-        }
-	}
-
-	public void testCorrectMixedEntries() throws Exception {
-		String command = "(system=system1,user=username1, password=password1 /  " + //$NON-NLS-1$
-				         " system=system2,user=username2, password=password2 /  " + //$NON-NLS-1$
-				         " system=system3,user=username3, password=password3 /  " + //$NON-NLS-1$
-				         " system=system4,user=username4, password=password4)"; //$NON-NLS-1$
-
-		CredentialMap cm = CredentialMap.parseCredentials(command);
-		assertNotNull("Null CredentialsMap returned on correct entry", cm); //$NON-NLS-1$
-
-		int mapSize = cm.getSystems().length;
-		assertEquals("Incorrect number of entries in credential map", 4, //$NON-NLS-1$
-				mapSize);
-				
-		// test 1st set of credentials
-		String system = "system1"; //$NON-NLS-1$
-		String userVal = "username1"; //$NON-NLS-1$
-		String passwordVal = "password1"; //$NON-NLS-1$
-		
-		Map map = cm.getSystemCredentials(system);
-		assertNotNull("Null Map returned on correct entry: system1", map); //$NON-NLS-1$
-
-		String user = (String) map.get("user"); //$NON-NLS-1$
-		assertTrue("Incorrect username returned for " + system, userVal.equals(user)); //$NON-NLS-1$
-
-		String password = (String) map.get("password"); //$NON-NLS-1$
-		assertTrue("Incorrect password returned for " + system, passwordVal.equals(password)); //$NON-NLS-1$
-
-		// test 2nd set of credentials
-		system = "system2"; //$NON-NLS-1$
-		userVal = "username2"; //$NON-NLS-1$
-		passwordVal = "password2"; //$NON-NLS-1$
-		
-		map = cm.getSystemCredentials(system);
-		assertNotNull("Null Map returned on correct entry: " + system, map); //$NON-NLS-1$
-
-		user = (String) map.get("user"); //$NON-NLS-1$
-		assertTrue("Incorrect username returned for " + system, userVal.equals(user)); //$NON-NLS-1$
-
-		password = (String) map.get("password"); //$NON-NLS-1$
-		assertTrue("Incorrect password returned for " + system, passwordVal.equals(password)); //$NON-NLS-1$
-
-		// test 3rd set of credentials
-		system = "system3"; //$NON-NLS-1$
-		userVal = "username3"; //$NON-NLS-1$
-		passwordVal = "password3"; //$NON-NLS-1$
-		
-		map = cm.getSystemCredentials(system);
-		assertNotNull("Null Map returned on correct entry: " + system, map); //$NON-NLS-1$
-
-		user = (String) map.get("user"); //$NON-NLS-1$
-		assertTrue("Incorrect username returned for " + system, userVal.equals(user)); //$NON-NLS-1$
-
-		password = (String) map.get("password"); //$NON-NLS-1$
-		assertTrue("Incorrect password returned for " + system, passwordVal.equals(password)); //$NON-NLS-1$
-
-		// test 4th set of credentials
-		system = "system4"; //$NON-NLS-1$
-		userVal = "username4"; //$NON-NLS-1$
-		passwordVal = "password4"; //$NON-NLS-1$
-		
-		map = cm.getSystemCredentials(system);
-		assertNotNull("Null Map returned on correct entry: " + system, map); //$NON-NLS-1$
-
-		user = (String) map.get("user"); //$NON-NLS-1$
-		assertTrue("Incorrect username returned for " + system, userVal.equals(user)); //$NON-NLS-1$
-
-		password = (String) map.get("password"); //$NON-NLS-1$
-		assertTrue("Incorrect password returned for " + system, passwordVal.equals(password)); //$NON-NLS-1$
-
-	}
-
-	public void testEscapeCharacters() throws Exception {
-		String command = "(system=test\\/system1,user=username1, password=\\=password1 /  " + //$NON-NLS-1$
-				         " system=system2,user=username2, password=\\=\\,)\\/;password2 /  " + //$NON-NLS-1$
-				         " system=system3,user=username3, password=\"\'\\password3 /  " + //$NON-NLS-1$
-				         " system=system4,user=username4, password=\\password4)"; //$NON-NLS-1$
-
-		CredentialMap cm = CredentialMap.parseCredentials(command);
-		assertNotNull("Null CredentialsMap returned on correct entry", cm); //$NON-NLS-1$
-
-		int mapSize = cm.getSystems().length;
-		assertEquals("Incorrect number of entries in credential map", 4, //$NON-NLS-1$
-				mapSize);
-				
-		// test 1st set of credentials
-		String system = "test/system1"; //$NON-NLS-1$
-		String userVal = "username1"; //$NON-NLS-1$
-		String passwordVal = "=password1"; //$NON-NLS-1$
-
-		Map map = cm.getSystemCredentials(system);
-		assertNotNull("Null Map returned on correct entry: system1", map); //$NON-NLS-1$
-
-		String user = (String) map.get("user"); //$NON-NLS-1$
-		assertTrue("Incorrect username returned for " + system, userVal.equals(user)); //$NON-NLS-1$
-        assertTrue("Incorrect username returned for " + system, userVal.equals(cm.getUser(system))); //$NON-NLS-1$
-        
-
-		String password = (String) map.get("password"); //$NON-NLS-1$
-		assertTrue("Incorrect password returned for " + system, passwordVal.equals(password)); //$NON-NLS-1$
-        assertTrue("Incorrect password returned for " + system, passwordVal.equals(cm.getPassword(system))); //$NON-NLS-1$
-
-		// test 2nd set of credentials
-		system = "system2"; //$NON-NLS-1$
-		userVal = "username2"; //$NON-NLS-1$
-		passwordVal = "=,)/;password2"; //$NON-NLS-1$
-		
-		map = cm.getSystemCredentials(system);
-		assertNotNull("Null Map returned on correct entry: " + system, map); //$NON-NLS-1$
-
-		user = (String) map.get("user"); //$NON-NLS-1$
-		assertTrue("Incorrect username returned for " + system, userVal.equals(user)); //$NON-NLS-1$
-        assertTrue("Incorrect username returned for " + system, userVal.equals(cm.getUser(system))); //$NON-NLS-1$
-
-		password = (String) map.get("password"); //$NON-NLS-1$
-		assertTrue("Incorrect password returned for " + system, passwordVal.equals(password)); //$NON-NLS-1$
-        assertTrue("Incorrect password returned for " + system, passwordVal.equals(cm.getPassword(system))); //$NON-NLS-1$
-
-		// test 3rd set of credentials
-		system = "system3"; //$NON-NLS-1$
-		userVal = "username3"; //$NON-NLS-1$
-		passwordVal = "\"\'\\password3"; //$NON-NLS-1$
-		
-		map = cm.getSystemCredentials(system);
-		assertNotNull("Null Map returned on correct entry: " + system, map); //$NON-NLS-1$
-
-		user = (String) map.get("user"); //$NON-NLS-1$
-		assertTrue("Incorrect username returned for " + system, userVal.equals(user)); //$NON-NLS-1$
-        assertTrue("Incorrect username returned for " + system, userVal.equals(cm.getUser(system))); //$NON-NLS-1$
-
-		password = (String) map.get("password"); //$NON-NLS-1$
-		assertTrue("Incorrect password returned for " + system, passwordVal.equals(password)); //$NON-NLS-1$
-        assertTrue("Incorrect password returned for " + system, passwordVal.equals(cm.getPassword(system))); //$NON-NLS-1$
-
-		// test 4th set of credentials
-		system = "system4"; //$NON-NLS-1$
-		userVal = "username4"; //$NON-NLS-1$
-		passwordVal = "\\password4"; //$NON-NLS-1$
-		
-		map = cm.getSystemCredentials(system);
-		assertNotNull("Null Map returned on correct entry: " + system, map); //$NON-NLS-1$
-
-		user = (String) map.get("user"); //$NON-NLS-1$
-		assertTrue("Incorrect username returned for " + system, userVal.equals(user)); //$NON-NLS-1$
-
-		password = (String) map.get("password"); //$NON-NLS-1$
-		assertTrue("Incorrect password returned for " + system, passwordVal.equals(password)); //$NON-NLS-1$
-
-	}
-    
-    private Map getDefaultCredentials() {
-        Map defaults = new HashMap();
-        defaults.put("user", "defaultUser"); //$NON-NLS-1$ //$NON-NLS-2$
-        defaults.put("password", "defaultPassword"); //$NON-NLS-1$ //$NON-NLS-2$
-        return defaults;
-    }
-    
-    private Map getSystemCredentials() {
-        Map map = new HashMap();
-        map.put("user", "user1"); //$NON-NLS-1$ //$NON-NLS-2$
-        map.put("password", "password1"); //$NON-NLS-1$ //$NON-NLS-2$
-        map.put("bonus1", "ziggy"); //$NON-NLS-1$ //$NON-NLS-2$
-        return map;
-    }
-    
-    private Map getPartialSystemCredentials() {
-        Map map = new HashMap();
-        map.put("bonus2", "ziggy"); //$NON-NLS-1$ //$NON-NLS-2$
-        return map;
-    }
-    
-    public CredentialMap setupDefaultsTest(short mode, boolean setDefaults) {
-        CredentialMap cm = new CredentialMap();
-        if(setDefaults) {
-            cm.setDefaultCredentials(getDefaultCredentials());
-        }
-        cm.addSystemCredentials("sys1", getSystemCredentials()); //$NON-NLS-1$
-        cm.addSystemCredentials("sys2", getPartialSystemCredentials()); //$NON-NLS-1$
-        cm.setDefaultCredentialMode(mode);
-        return cm;
-    }
-    
-    public void assertCredentialsMatch(Map expected, CredentialMap creds, String system) {
-        Map sysCreds = creds.getSystemCredentials(system);
-        assertEquals(expected, sysCreds);
-    }
-    
-    public void testIgnoreDefaults() {
-        CredentialMap cm = setupDefaultsTest(CredentialMap.MODE_IGNORE_DEFAULTS, true);
-                
-        assertCredentialsMatch(null, cm, "x"); //$NON-NLS-1$
-        assertCredentialsMatch(getSystemCredentials(), cm, "sys1"); //$NON-NLS-1$
-        assertCredentialsMatch(getPartialSystemCredentials(), cm, "sys2"); //$NON-NLS-1$
-    }
-
-    public void testGlobalDefaultsUnknownSystem() {
-        CredentialMap cm = setupDefaultsTest(CredentialMap.MODE_USE_DEFAULTS_GLOBALLY, true);
-        
-        assertCredentialsMatch(getDefaultCredentials(), cm, "x"); //$NON-NLS-1$
-        assertCredentialsMatch(getSystemCredentials(), cm, "sys1"); //$NON-NLS-1$
-        
-        // Get mixture of system and defaults
-        Map mixed = new HashMap();
-        mixed.putAll(getDefaultCredentials());
-        mixed.putAll(getPartialSystemCredentials());
-        assertCredentialsMatch(mixed, cm, "sys2"); //$NON-NLS-1$        
-    }
-
-    public void testExistingDefaultsUnknownSystem() {
-        CredentialMap cm = setupDefaultsTest(CredentialMap.MODE_USE_DEFAULTS_ON_EXISTING, true);
-        
-        assertCredentialsMatch(null, cm, "x"); //$NON-NLS-1$
-        assertCredentialsMatch(getSystemCredentials(), cm, "sys1"); //$NON-NLS-1$
-
-        // Get mixture of system and defaults
-        Map mixed = new HashMap();
-        mixed.putAll(getDefaultCredentials());
-        mixed.putAll(getPartialSystemCredentials());
-        assertCredentialsMatch(mixed, cm, "sys2"); //$NON-NLS-1$        
-    }
-
-    public void testIgnoreWithNoDefaults() {
-        CredentialMap cm = setupDefaultsTest(CredentialMap.MODE_IGNORE_DEFAULTS, false);
-                
-        assertCredentialsMatch(null, cm, "x"); //$NON-NLS-1$
-        assertCredentialsMatch(getSystemCredentials(), cm, "sys1"); //$NON-NLS-1$
-        assertCredentialsMatch(getPartialSystemCredentials(), cm, "sys2"); //$NON-NLS-1$
-    }
-
-    public void testGlobalDefaultsUnknownSystemNoDefaults() {
-        CredentialMap cm = setupDefaultsTest(CredentialMap.MODE_USE_DEFAULTS_GLOBALLY, false);
-        
-        assertCredentialsMatch(null, cm, "x"); //$NON-NLS-1$
-        assertCredentialsMatch(getSystemCredentials(), cm, "sys1"); //$NON-NLS-1$
-        assertCredentialsMatch(getPartialSystemCredentials(), cm, "sys2"); //$NON-NLS-1$
-    }
-
-    public void testExistingDefaultsUnknownSystemNoDefaults() {
-        CredentialMap cm = setupDefaultsTest(CredentialMap.MODE_USE_DEFAULTS_ON_EXISTING, false);
-        
-        assertCredentialsMatch(null, cm, "x"); //$NON-NLS-1$
-        assertCredentialsMatch(getSystemCredentials(), cm, "sys1"); //$NON-NLS-1$
-        assertCredentialsMatch(getPartialSystemCredentials(), cm, "sys2"); //$NON-NLS-1$
-    }
-
-}

Added: branches/JCA/connector-api/src/test/java/org/teiid/connector/TestWrappedConnector.java
===================================================================
--- branches/JCA/connector-api/src/test/java/org/teiid/connector/TestWrappedConnector.java	                        (rev 0)
+++ branches/JCA/connector-api/src/test/java/org/teiid/connector/TestWrappedConnector.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,71 @@
+/*
+ * 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 org.teiid.connector;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Properties;
+
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.teiid.connector.api.Connector;
+import org.teiid.connector.api.ConnectorCapabilities;
+import org.teiid.connector.api.ConnectorEnvironment;
+import org.teiid.connector.basic.BasicConnectorCapabilities;
+import org.teiid.connector.basic.WrappedConnector;
+
+
+public class TestWrappedConnector {
+
+    @Test public void testConnectorCapabilitiesOverride() throws Exception {
+
+    	Connector c = Mockito.mock(Connector.class);
+    	Mockito.stub(c.getCapabilities()).toReturn(new BasicConnectorCapabilities());
+    	ConnectorEnvironment env = Mockito.mock(ConnectorEnvironment.class);
+    	Mockito.stub(c.getConnectorEnvironment()).toReturn(env);
+    	
+    	WrappedConnector connector = new WrappedConnector(c, null, null);
+    	
+    	ConnectorCapabilities caps = connector.getCapabilities();
+    	assertFalse(caps.supportsExistsCriteria());
+    	assertFalse(caps.supportsExcept());
+
+    	
+    	c = Mockito.mock(Connector.class);
+    	Mockito.stub(c.getCapabilities()).toReturn(new BasicConnectorCapabilities());
+    	
+    	connector = new WrappedConnector(c, null, null);
+    	
+    	Properties props = new Properties();
+    	props.setProperty("supportsExistsCriteria", "true"); //$NON-NLS-1$ //$NON-NLS-2$
+    	props.setProperty("supportsExcept", "true"); //$NON-NLS-1$ //$NON-NLS-2$
+    	
+    	env = Mockito.mock(ConnectorEnvironment.class);
+    	Mockito.stub(env.getOverrideCapabilities()).toReturn(props);
+    	Mockito.stub(c.getConnectorEnvironment()).toReturn(env);    	
+    	
+    	caps = connector.getCapabilities();
+    	assertTrue(caps.supportsExistsCriteria());
+    	assertTrue(caps.supportsExcept());
+    }
+}


Property changes on: branches/JCA/connector-api/src/test/java/org/teiid/connector/TestWrappedConnector.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: branches/JCA/connector-metadata/pom.xml
===================================================================
--- branches/JCA/connector-metadata/pom.xml	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connector-metadata/pom.xml	2009-11-02 19:41:28 UTC (rev 1544)
@@ -10,8 +10,7 @@
   <groupId>org.jboss.teiid</groupId>
   <artifactId>teiid-connector-metadata</artifactId>
   <name>Metadata Connector</name>
-  <description>Connetor implementation utilizing runtime
-    metadata.</description>
+  <description>Connector implementation utilizing runtime metadata.</description>
   <dependencies>
     <dependency>
       <groupId>org.jboss.teiid</groupId>
@@ -42,5 +41,10 @@
       <artifactId>teiid-engine</artifactId>
       <type>test-jar</type>
     </dependency>
+    <dependency>
+      <groupId>javax.resource</groupId>
+      <artifactId>connector-api</artifactId>
+      <scope>provided</scope>
+    </dependency>    
   </dependencies>
 </project>
\ No newline at end of file

Modified: branches/JCA/connector-metadata/src/main/java/com/metamatrix/connector/metadata/IndexConnector.java
===================================================================
--- branches/JCA/connector-metadata/src/main/java/com/metamatrix/connector/metadata/IndexConnector.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connector-metadata/src/main/java/com/metamatrix/connector/metadata/IndexConnector.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -24,33 +24,20 @@
 
 import org.teiid.connector.api.ConnectorException;
 import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.api.ConnectorAnnotations.ConnectionPooling;
-import org.teiid.dqp.internal.datamgr.impl.ConnectorEnvironmentImpl;
+import org.teiid.dqp.internal.datamgr.impl.ExecutionContextImpl;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.connector.metadata.adapter.ObjectConnector;
 import com.metamatrix.connector.metadata.internal.IObjectSource;
-import com.metamatrix.dqp.service.DQPServiceNames;
-import com.metamatrix.dqp.service.MetadataService;
 
-/**
- * Connector whose source is metadata index files stored in vdbs aviailable to
- * the user logged in.
- */
- at ConnectionPooling(enabled=false)
 public class IndexConnector extends ObjectConnector {
     
-    /** 
-     * @see com.metamatrix.connector.metadata.adapter.ObjectConnector#getObjectSource(org.teiid.connector.api.ConnectorEnvironment, org.teiid.connector.api.ExecutionContext)
-     */
-    protected IObjectSource getMetadataObjectSource(final ExecutionContext context) throws ConnectorException {
-        ConnectorEnvironmentImpl internalEnvironment = (ConnectorEnvironmentImpl) this.getEnvironment();
+	@Override
+	protected IObjectSource getMetadataObjectSource(final ExecutionContext context) throws ConnectorException {
         
-        // lookup indesService
-        MetadataService metadataService = (MetadataService) internalEnvironment.findResource(DQPServiceNames.METADATA_SERVICE);
-        
+    	ExecutionContextImpl contextimpl = (ExecutionContextImpl)context;
         try {
-			return metadataService.getMetadataObjectSource(context.getVirtualDatabaseName(), context.getVirtualDatabaseVersion());
+			return contextimpl.getMetadataService().getMetadataObjectSource(context.getVirtualDatabaseName(), context.getVirtualDatabaseVersion());
 		} catch (MetaMatrixComponentException e) {
 			throw new ConnectorException(e, MetadataConnectorPlugin.Util.getString("IndexConnector.indexSelector_not_available")); //$NON-NLS-1$			
 		}

Modified: branches/JCA/connector-metadata/src/main/java/com/metamatrix/connector/metadata/adapter/ObjectConnection.java
===================================================================
--- branches/JCA/connector-metadata/src/main/java/com/metamatrix/connector/metadata/adapter/ObjectConnection.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connector-metadata/src/main/java/com/metamatrix/connector/metadata/adapter/ObjectConnection.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,7 +22,6 @@
 
 package com.metamatrix.connector.metadata.adapter;
 
-import org.teiid.connector.api.ConnectorEnvironment;
 import org.teiid.connector.api.ConnectorException;
 import org.teiid.connector.api.ExecutionContext;
 import org.teiid.connector.api.ProcedureExecution;
@@ -41,30 +40,26 @@
  */
 public class ObjectConnection extends BasicConnection {
 
-    private ExecutionContext executionContext;
     private ObjectConnector connector;
 
-    public ObjectConnection(final ConnectorEnvironment environment, final ExecutionContext context, ObjectConnector connector){
-        this.executionContext = context;
+    public ObjectConnection(ObjectConnector connector){
         this.connector = connector;
     }
 
     @Override
-    public ResultSetExecution createResultSetExecution(IQueryCommand command,
-    		ExecutionContext executionContext, RuntimeMetadata metadata)
+    public ResultSetExecution createResultSetExecution(IQueryCommand command, ExecutionContext executionContext, RuntimeMetadata metadata)
     		throws ConnectorException {
-    	return new ObjectSynchExecution((IQuery)command, metadata, this);
+    	return new ObjectSynchExecution((IQuery)command, metadata, getMetadataObjectSource(executionContext));
     }
     
     @Override
-    public ProcedureExecution createProcedureExecution(IProcedure command,
-    		ExecutionContext executionContext, RuntimeMetadata metadata)
+    public ProcedureExecution createProcedureExecution(IProcedure command, ExecutionContext executionContext, RuntimeMetadata metadata)
     		throws ConnectorException {
-    	return new MetadataProcedureExecution(command, metadata, getMetadataObjectSource());
+    	return new MetadataProcedureExecution(command, metadata, getMetadataObjectSource(executionContext));
     }
     
-    protected IObjectSource getMetadataObjectSource() throws ConnectorException {
-        return connector.getMetadataObjectSource(executionContext);
+    protected IObjectSource getMetadataObjectSource(ExecutionContext context) throws ConnectorException {
+        return connector.getMetadataObjectSource(context);
     }
     
     @Override

Modified: branches/JCA/connector-metadata/src/main/java/com/metamatrix/connector/metadata/adapter/ObjectConnector.java
===================================================================
--- branches/JCA/connector-metadata/src/main/java/com/metamatrix/connector/metadata/adapter/ObjectConnector.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connector-metadata/src/main/java/com/metamatrix/connector/metadata/adapter/ObjectConnector.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -35,32 +35,16 @@
  * Adapter to expose the object processing logic via the standard connector API.
  */
 public abstract class ObjectConnector extends BasicConnector {
-    private ConnectorEnvironment environment;
     
     public ConnectorCapabilities getCapabilities() {
     	return ObjectConnectorCapabilities.getInstance();
     }
     
     @Override
-    public void start(final ConnectorEnvironment environment) throws ConnectorException {
-        this.environment = environment;
+    public Connection getConnection() throws ConnectorException {
+        return new ObjectConnection(this);
     }
-
-    @Override
-    public void stop() {
-
-    }
-
-    /* 
-     * @see com.metamatrix.data.Connector#getConnection(com.metamatrix.data.SecurityContext)
-     */
-    public Connection getConnection(final ExecutionContext context) throws ConnectorException {
-        return new ObjectConnection(environment, context, this);
-    }
     
-    protected ConnectorEnvironment getEnvironment() {
-        return this.environment;
-    }
 
     /**
      * When a Metadata query is being executed, this method will be called to obtain the object source.

Modified: branches/JCA/connector-metadata/src/main/java/com/metamatrix/connector/metadata/adapter/ObjectSynchExecution.java
===================================================================
--- branches/JCA/connector-metadata/src/main/java/com/metamatrix/connector/metadata/adapter/ObjectSynchExecution.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connector-metadata/src/main/java/com/metamatrix/connector/metadata/adapter/ObjectSynchExecution.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -35,6 +35,7 @@
 import org.teiid.connector.metadata.runtime.RuntimeMetadata;
 
 import com.metamatrix.connector.metadata.MetadataConnectorPlugin;
+import com.metamatrix.connector.metadata.internal.IObjectSource;
 import com.metamatrix.connector.metadata.internal.ObjectQuery;
 
 /**
@@ -47,19 +48,19 @@
 
     private IObjectQuery query;
     private Iterator queryResults;
-    private ObjectConnection connection;
+    private IObjectSource source;
     private IQuery command;
     private volatile boolean cancel;
 
-    public ObjectSynchExecution(IQuery command, RuntimeMetadata metadata, ObjectConnection connection) {
+    public ObjectSynchExecution(IQuery command, RuntimeMetadata metadata, final IObjectSource objectSource) {
         this.metadata = metadata;
-        this.connection = connection;
+        this.source = objectSource;
         this.command = command;
     }
 
     @Override
     public void execute() throws ConnectorException {
-        this.processor = new ObjectQueryProcessor(connection.getMetadataObjectSource());
+        this.processor = new ObjectQueryProcessor(this.source);
         
         this.query = new ObjectQuery(metadata, command);
 		queryResults = processor.process(this.query);

Modified: branches/JCA/connector-metadata/src/test/java/com/metamatrix/connector/metadata/TestIndexConnector.java
===================================================================
--- branches/JCA/connector-metadata/src/test/java/com/metamatrix/connector/metadata/TestIndexConnector.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connector-metadata/src/test/java/com/metamatrix/connector/metadata/TestIndexConnector.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -23,39 +23,33 @@
 package com.metamatrix.connector.metadata;
 
 import java.io.IOException;
+import java.net.URL;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Map;
-import java.util.Properties;
 
+import junit.framework.TestCase;
+
+import org.mockito.Mockito;
 import org.teiid.connector.api.Connection;
-import org.teiid.connector.api.ConnectorEnvironment;
 import org.teiid.connector.api.ConnectorException;
 import org.teiid.connector.api.DataNotAvailableException;
 import org.teiid.connector.api.ExecutionContext;
 import org.teiid.connector.api.ResultSetExecution;
 import org.teiid.connector.language.IQuery;
 import org.teiid.connector.metadata.runtime.RuntimeMetadata;
-import org.teiid.dqp.internal.datamgr.impl.ConnectorEnvironmentImpl;
 import org.teiid.dqp.internal.datamgr.impl.ExecutionContextImpl;
 
-import junit.framework.TestCase;
-
 import com.metamatrix.cdk.CommandBuilder;
-import com.metamatrix.cdk.api.EnvironmentUtility;
-import com.metamatrix.common.application.ApplicationEnvironment;
-import com.metamatrix.common.application.ApplicationService;
 import com.metamatrix.connector.metadata.adapter.ObjectConnector;
 import com.metamatrix.connector.metadata.internal.IObjectSource;
-import com.metamatrix.connector.metadata.internal.TestConnectorHost;
 import com.metamatrix.connector.metadata.internal.TestObjectQueryProcessor;
-import com.metamatrix.core.MetaMatrixRuntimeException;
-import com.metamatrix.dqp.service.DQPServiceNames;
 import com.metamatrix.metadata.runtime.FakeMetadataService;
 import com.metamatrix.metadata.runtime.FakeQueryMetadata;
 import com.metamatrix.query.metadata.QueryMetadataInterface;
 
 public class TestIndexConnector extends TestCase {
+	public static final URL TEST_FILE = TestIndexConnector.class.getResource("/PartsSupplier.vdb"); //$NON-NLS-1$
     private FakeMetadataService fakeApplicationService = null;
     
     public TestIndexConnector(String name) {
@@ -64,21 +58,44 @@
 
     public void test() throws Exception {
         IndexConnector connector = new IndexConnector();
-        connector.start(helpGetConnectorEnvironment());
-        Connection connection = connector.getConnection(helpGetSecurityContext());
+        Connection connection = connector.getConnection();
         QueryMetadataInterface metadata = FakeQueryMetadata.getQueryMetadata();
         CommandBuilder commandBuilder = new CommandBuilder(metadata);
         IQuery command = (IQuery) commandBuilder.getCommand("select FullName from tables"); //$NON-NLS-1$
 
         RuntimeMetadata runtimeMetadata = TestObjectQueryProcessor.getRuntimeMetadata();
-        ExecutionContext envContext = EnvironmentUtility.createExecutionContext("100", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-        ResultSetExecution execution = (ResultSetExecution)connection.createExecution(command, envContext, runtimeMetadata);            
+        ResultSetExecution execution = (ResultSetExecution)connection.createExecution(command, helpGetContext(), runtimeMetadata);            
         execution.execute();
         int i = getSize(execution);
         assertEquals(5, i);
         execution.close();
     }
     
+    public void testWithIndexConnector() throws ConnectorException, IOException {
+        IndexConnector connector = new IndexConnector();
+        Connection connection = connector.getConnection();
+        QueryMetadataInterface metadata = FakeQueryMetadata.getQueryMetadata();
+        CommandBuilder commandBuilder = new CommandBuilder(metadata);
+        IQuery command = (IQuery) commandBuilder.getCommand("select FullName from tables"); //$NON-NLS-1$
+
+        RuntimeMetadata runtimeMetadata = TestObjectQueryProcessor.getRuntimeMetadata();
+        ResultSetExecution execution = (ResultSetExecution)connection.createExecution(command, helpGetContext(), runtimeMetadata);            
+        execution.execute();
+        String row = execution.next().toString();
+        assertEquals("[PartsSupplier.PARTSSUPPLIER.PARTS]", row); //$NON-NLS-1$
+        execution.close();    	
+    }    
+
+    ExecutionContextImpl helpGetContext() throws IOException {
+    	ExecutionContextImpl context = Mockito.mock(ExecutionContextImpl.class);
+    	Mockito.stub(context.getRequestIdentifier()).toReturn("100");
+    	Mockito.stub(context.getPartIdentifier()).toReturn("1");
+    	Mockito.stub(context.getMetadataService()).toReturn(new FakeMetadataService(TEST_FILE));
+    	Mockito.stub(context.getVirtualDatabaseName()).toReturn("testname");
+    	Mockito.stub(context.getVirtualDatabaseVersion()).toReturn("1");
+    	return context;
+    }
+    
     public void testBatches() throws Exception {
         ObjectConnector connector = new ObjectConnector() {
 
@@ -92,15 +109,13 @@
 
         };
 
-        connector.start(helpGetConnectorEnvironment());
-        Connection connection = connector.getConnection(helpGetSecurityContext());
+        Connection connection = connector.getConnection();
         QueryMetadataInterface metadata = FakeQueryMetadata.getQueryMetadata();
         CommandBuilder commandBuilder = new CommandBuilder(metadata);
         IQuery command = (IQuery) commandBuilder.getCommand("select toString from junk"); //$NON-NLS-1$
 
         RuntimeMetadata runtimeMetadata = TestObjectQueryProcessor.getRuntimeMetadata();
-        ExecutionContext envContext = EnvironmentUtility.createExecutionContext("100", "1"); //$NON-NLS-1$ //$NON-NLS-2$            
-        ResultSetExecution execution = (ResultSetExecution)connection.createExecution(command, envContext, runtimeMetadata);            
+        ResultSetExecution execution = (ResultSetExecution)connection.createExecution(command, helpGetContext(), runtimeMetadata);            
         execution.execute();
         int i = getSize(execution);
         assertEquals(30, i);
@@ -118,53 +133,19 @@
     
     public void testPropertyFileLoading() throws Exception {
         IndexConnector connector = new IndexConnector();
-        connector.start(helpGetConnectorEnvironment());
-        Connection connection = connector.getConnection(helpGetSecurityContext());
+        Connection connection = connector.getConnection();
         QueryMetadataInterface metadata = FakeQueryMetadata.getQueryMetadata();
         CommandBuilder commandBuilder = new CommandBuilder(metadata);
         IQuery command = (IQuery) commandBuilder.getCommand("select key from fake1Properties"); //$NON-NLS-1$
 
         RuntimeMetadata runtimeMetadata = TestObjectQueryProcessor.getRuntimeMetadata();
-        ExecutionContext envContext = EnvironmentUtility.createExecutionContext("100", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-        ResultSetExecution execution = (ResultSetExecution)connection.createExecution(command, envContext, runtimeMetadata);            
+        ResultSetExecution execution = (ResultSetExecution)connection.createExecution(command, helpGetContext(), runtimeMetadata);            
         execution.execute();
         assertNotNull(execution.next());
         execution.close();
     }
     
-    private ConnectorEnvironment helpGetConnectorEnvironment() {
-        ApplicationEnvironment applicationEnvironment = new ApplicationEnvironment() {
-            public Properties getApplicationProperties() {
-                return null;
-            }
-
-            public void bindService(String type, ApplicationService service) {
-
-            }
-
-            public void unbindService(String type) {
-
-            }
-
-            public ApplicationService findService(String type) {
-                if (type.equals(DQPServiceNames.METADATA_SERVICE)) {
-                    clearApplicationService();
-                    try {
-						fakeApplicationService = new FakeMetadataService(TestConnectorHost.TEST_FILE);
-					} catch (IOException e) {
-						throw new MetaMatrixRuntimeException(e);
-					}
-                    return fakeApplicationService;
-                }
-                return null;
-            }
-        };
-        return new ConnectorEnvironmentImpl(new Properties(), null, applicationEnvironment);
-    }
-    
-    private ExecutionContext helpGetSecurityContext() {
-        return new ExecutionContextImpl("testname", "1", null, null, null, null, null, null, null, null); //$NON-NLS-1$ //$NON-NLS-2$
-    }
+   
     /* 
      * @see junit.framework.TestCase#tearDown()
      */

Modified: branches/JCA/connector-metadata/src/test/java/com/metamatrix/connector/metadata/adapter/TestObjectConnector.java
===================================================================
--- branches/JCA/connector-metadata/src/test/java/com/metamatrix/connector/metadata/adapter/TestObjectConnector.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connector-metadata/src/test/java/com/metamatrix/connector/metadata/adapter/TestObjectConnector.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -25,21 +25,18 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
-import java.util.Properties;
 
+import junit.framework.TestCase;
+
+import org.mockito.Mockito;
 import org.teiid.connector.api.Connection;
-import org.teiid.connector.api.ConnectorEnvironment;
 import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.api.ExecutionContext;
 import org.teiid.connector.api.ResultSetExecution;
 import org.teiid.connector.language.IQuery;
 import org.teiid.connector.metadata.runtime.RuntimeMetadata;
-import org.teiid.dqp.internal.datamgr.impl.ConnectorEnvironmentImpl;
+import org.teiid.dqp.internal.datamgr.impl.ExecutionContextImpl;
 
-import junit.framework.TestCase;
-
 import com.metamatrix.cdk.CommandBuilder;
-import com.metamatrix.cdk.api.EnvironmentUtility;
 import com.metamatrix.core.MetaMatrixRuntimeException;
 import com.metamatrix.query.metadata.QueryMetadataInterface;
 import com.metamatrix.query.unittest.QueryMetadataInterfaceBuilder;
@@ -129,7 +126,16 @@
         assertEquals("doctor", rows[3].get(0)); //$NON-NLS-1$
         assertEquals("jim", rows[3].get(1)); //$NON-NLS-1$
     }
-
+    
+    ExecutionContextImpl helpGetContext() {
+    	ExecutionContextImpl context = Mockito.mock(ExecutionContextImpl.class);
+    	Mockito.stub(context.getRequestIdentifier()).toReturn("100");
+    	Mockito.stub(context.getPartIdentifier()).toReturn("1");
+    	Mockito.stub(context.getVirtualDatabaseName()).toReturn("testname");
+    	Mockito.stub(context.getVirtualDatabaseVersion()).toReturn("1");
+    	return context;
+    }
+    
     public void testQueryCancel_Defect18362() {
         FakeObjectWithNonScalarMethod fakeObject1 = new FakeObjectWithNonScalarMethod("bob", new String[] {"boss", "supervisor"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
         FakeObjectWithNonScalarMethod fakeObject2 = new FakeObjectWithNonScalarMethod("jim", new String[] {"worker", "doctor"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -137,19 +143,15 @@
         defineMetadata("objects", "objects(getTitles)", FakeObjectWithNonScalarMethod.class, "getTitles"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
         List objects = Arrays.asList(new FakeObjectWithNonScalarMethod[] {fakeObject1, fakeObject2});
         connector = new FakeObjectConnector(objects);
-        Properties properties = new Properties();
-        ConnectorEnvironment environment = new ConnectorEnvironmentImpl(properties, null, null);
 
         try {
-            connector.start(environment);
-            Connection connection = connector.getConnection(null);
+            Connection connection = connector.getConnection();
             QueryMetadataInterface metadata = metadataBuilder.getQueryMetadata();
             CommandBuilder commandBuilder = new CommandBuilder(metadata);
             final IQuery command = (IQuery) commandBuilder.getCommand("select getTitles from objects"); //$NON-NLS-1$
 
             RuntimeMetadata runtimeMetadata = metadataBuilder.getRuntimeMetadata();
-            ExecutionContext execContext = EnvironmentUtility.createExecutionContext("100", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-            ResultSetExecution execution = (ResultSetExecution) connection.createExecution(command, execContext, runtimeMetadata);
+            ResultSetExecution execution = (ResultSetExecution) connection.createExecution(command, helpGetContext(), runtimeMetadata);
             ExecutionThread executeThread = new ExecutionThread(execution);
             executeThread.start();
             execution.cancel();
@@ -171,19 +173,15 @@
         defineMetadata(tableName, tableNameInSource, type, tableDefiningMethodName);
         List objects = Arrays.asList(objectArray);
         connector = new FakeObjectConnector(objects);
-        Properties properties = new Properties();
-        ConnectorEnvironment environment = new ConnectorEnvironmentImpl(properties, null, null);
 
         try {
-            connector.start(environment);
-            Connection connection = connector.getConnection(null);
+            Connection connection = connector.getConnection();
             QueryMetadataInterface metadata = metadataBuilder.getQueryMetadata();
             CommandBuilder commandBuilder = new CommandBuilder(metadata);
             IQuery command = (IQuery) commandBuilder.getCommand(query);
 
             RuntimeMetadata runtimeMetadata = metadataBuilder.getRuntimeMetadata();
-            ExecutionContext execContext = EnvironmentUtility.createExecutionContext("100", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-            ResultSetExecution execution = (ResultSetExecution) connection.createExecution(command, execContext, runtimeMetadata);
+            ResultSetExecution execution = (ResultSetExecution) connection.createExecution(command, helpGetContext(), runtimeMetadata);
             execution.execute();
             List<List> results = new ArrayList<List>();
             List row = null;

Deleted: branches/JCA/connector-metadata/src/test/java/com/metamatrix/connector/metadata/internal/TestConnectorHost.java
===================================================================
--- branches/JCA/connector-metadata/src/test/java/com/metamatrix/connector/metadata/internal/TestConnectorHost.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connector-metadata/src/test/java/com/metamatrix/connector/metadata/internal/TestConnectorHost.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,112 +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.metadata.internal;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.List;
-import java.util.Properties;
-
-import org.teiid.connector.api.ConnectorException;
-
-import junit.framework.TestCase;
-
-import com.metamatrix.cdk.IConnectorHost;
-import com.metamatrix.cdk.api.ConnectorHost;
-import com.metamatrix.cdk.api.TranslationUtility;
-import com.metamatrix.connector.metadata.IndexConnector;
-import com.metamatrix.dqp.service.DQPServiceNames;
-import com.metamatrix.metadata.runtime.FakeMetadataService;
-import com.metamatrix.metadata.runtime.FakeQueryMetadata;
-
-public class TestConnectorHost extends TestCase {
-    private FakeMetadataService fakeApplicationService;
-    public static final URL TEST_FILE = TestConnectorHost.class.getResource("/PartsSupplier.vdb"); //$NON-NLS-1$
-
-    public TestConnectorHost(String name) {
-        super(name);
-    }
-
-    public void testWithIndexConnector() throws ConnectorException, IOException {
-        IConnectorHost host = getConnectorHost(null);
-        host.setSecurityContext("testName", "testVersion", null, null, null); //$NON-NLS-1$ //$NON-NLS-2$
-        List results = host.executeCommand("select FullName from tables"); //$NON-NLS-1$
-
-        List row = (List) results.get(0);
-        assertEquals("PartsSupplier.PARTSSUPPLIER.PARTS", row.get(0).toString()); //$NON-NLS-1$
-    }
-
-    private IConnectorHost getConnectorHost(Properties properties) throws IOException {
-        clearApplicationService();
-        fakeApplicationService =  new FakeMetadataService(TEST_FILE);
-        ConnectorHost host = new ConnectorHost(new IndexConnector(), properties, new TranslationUtility(FakeQueryMetadata.getQueryMetadata()));
-        host.addResourceToConnectorEnvironment(DQPServiceNames.METADATA_SERVICE, fakeApplicationService);
-        return host;
-    }
-
-    public void testWithIndexConnectorAndVdb() throws ConnectorException, IOException {
-        ConnectorHost host = new ConnectorHost(new IndexConnector(), null, new TranslationUtility(TEST_FILE), false);
-        host.setSecurityContext("testName", "testVersion", null, null, null); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testSetProperties() throws ConnectorException, IOException {
-        Properties properties = new Properties();
-        properties.put("prop1", "value1"); //$NON-NLS-1$ //$NON-NLS-2$
-        IConnectorHost host = getConnectorHost(properties);
-
-        assertEquals("value1", (String)host.getConnectorEnvironmentProperties().get("prop1")); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testCannotChangePropertiesPassedIn() throws ConnectorException, IOException {
-        Properties properties = new Properties();
-        IConnectorHost host = getConnectorHost(properties);
-
-        //Cannot directly manipulate properties after they are set.
-        properties.put("prop2", "value2"); //$NON-NLS-1$ //$NON-NLS-2$
-        assertNull(host.getConnectorEnvironmentProperties().get("prop2") ); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testCannotChangeProperties() throws ConnectorException, IOException {
-        Properties properties = new Properties();
-        IConnectorHost host = getConnectorHost(properties);
-
-        //Cannot manipulate properties returned by connector host.
-        host.getConnectorEnvironmentProperties().put("prop3", "value3"); //$NON-NLS-1$ //$NON-NLS-2$
-        assertNull(host.getConnectorEnvironmentProperties().get("prop3") ); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    /*
-     * @see junit.framework.TestCase#tearDown()
-     */
-    protected void tearDown() throws Exception {
-        super.tearDown();
-        clearApplicationService();
-    }
-
-    private void clearApplicationService() {
-        if (fakeApplicationService != null) {
-            fakeApplicationService.clear();
-            fakeApplicationService = null;
-        }
-    }
-}

Modified: branches/JCA/connector-sdk/src/main/java/com/metamatrix/cdk/CommandBuilder.java
===================================================================
--- branches/JCA/connector-sdk/src/main/java/com/metamatrix/cdk/CommandBuilder.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connector-sdk/src/main/java/com/metamatrix/cdk/CommandBuilder.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -28,8 +28,8 @@
 
 import org.teiid.connector.language.ICommand;
 import org.teiid.connector.language.ILanguageFactory;
-import org.teiid.dqp.internal.datamgr.language.LanguageBridgeFactory;
-import org.teiid.dqp.internal.datamgr.language.LanguageFactoryImpl;
+import org.teiid.connector.language.impl.LanguageBridgeFactory;
+import org.teiid.connector.language.impl.LanguageFactoryImpl;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.query.QueryParserException;

Modified: branches/JCA/connector-sdk/src/main/java/com/metamatrix/cdk/api/ConnectorHost.java
===================================================================
--- branches/JCA/connector-sdk/src/main/java/com/metamatrix/cdk/api/ConnectorHost.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connector-sdk/src/main/java/com/metamatrix/cdk/api/ConnectorHost.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -37,11 +37,11 @@
 import org.teiid.connector.api.ExecutionContext;
 import org.teiid.connector.api.ResultSetExecution;
 import org.teiid.connector.api.UpdateExecution;
+import org.teiid.connector.basic.ConnectorEnvironmentImpl;
 import org.teiid.connector.language.ICommand;
+import org.teiid.connector.language.impl.BatchedUpdatesImpl;
 import org.teiid.connector.metadata.runtime.RuntimeMetadata;
-import org.teiid.dqp.internal.datamgr.impl.ConnectorEnvironmentImpl;
 import org.teiid.dqp.internal.datamgr.impl.ExecutionContextImpl;
-import org.teiid.dqp.internal.datamgr.language.BatchedUpdatesImpl;
 import org.teiid.metadata.index.VDBMetadataFactory;
 
 import com.metamatrix.cdk.IConnectorHost;

Modified: branches/JCA/connector-sdk/src/main/java/com/metamatrix/cdk/api/EnvironmentUtility.java
===================================================================
--- branches/JCA/connector-sdk/src/main/java/com/metamatrix/cdk/api/EnvironmentUtility.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connector-sdk/src/main/java/com/metamatrix/cdk/api/EnvironmentUtility.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -29,7 +29,7 @@
 import org.teiid.connector.api.ConnectorLogger;
 import org.teiid.connector.api.ConnectorPropertyNames;
 import org.teiid.connector.api.ExecutionContext;
-import org.teiid.dqp.internal.datamgr.impl.ConnectorEnvironmentImpl;
+import org.teiid.connector.basic.ConnectorEnvironmentImpl;
 import org.teiid.dqp.internal.datamgr.impl.ExecutionContextImpl;
 
 

Modified: branches/JCA/connectors/connector-jdbc/pom.xml
===================================================================
--- branches/JCA/connectors/connector-jdbc/pom.xml	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/pom.xml	2009-11-02 19:41:28 UTC (rev 1544)
@@ -11,8 +11,9 @@
   <artifactId>connector-jdbc</artifactId>
   <groupId>org.jboss.teiid.connectors</groupId>
   <name>JDBC Connector</name>
-  <description>This project contains connectors for a JDBC source. Currently this is an aggregator for all the JDBC connectors relational databases.</description>
+  <packaging>rar</packaging>
   
+  <description>This project contains connectors for a JDBC source. Currently this is an aggregator for all the JDBC connectors relational databases.</description>
     <dependencies>
         <dependency>
             <groupId>org.jboss.teiid</groupId>
@@ -24,101 +25,29 @@
             <artifactId>teiid-common-core</artifactId>
             <scope>provided</scope>
         </dependency>
+        <dependency>
+          <groupId>javax.resource</groupId>
+          <artifactId>connector-api</artifactId>
+          <scope>provided</scope>
+        </dependency>       
     </dependencies>
       
-    <!-- This build portion is identical for all the connectors that are deployed; so when making changes make sure
-    it applies to all the connectors. This below block computes the classpath, writes to classpath.properties; it replaces
-    classpath in the xml file, then bundles current project and its dependencies and xml file in a zip for deployment-->
     <build>
-        <plugins>
-            <!-- build class path -->
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-dependency-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>build-classpath</id>
-                        <phase>generate-sources</phase>
-                        <goals>
-                            <goal>build-classpath</goal>
-                        </goals>
-                        <configuration>
-                            <fileSeparator>:</fileSeparator>
-                            <pathSeparator>;</pathSeparator>
-                            <prefix>extensionjar</prefix>
-                            <excludeTransitive>false</excludeTransitive>
-                            <includeScope>runtime</includeScope>
-                            <excludeTypes>pom</excludeTypes>
-                            <outputFile>target/classpath.properties</outputFile>
-                            <regenerateFile>true</regenerateFile>
-                            <outputFilterFile>true</outputFilterFile>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-      
-            <!-- bundles all its dependencies in a single zip file  -->
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-dependency-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>copy-dependencies</id>
-                        <phase>generate-sources</phase>
-                        <goals>
-                            <goal>copy-dependencies</goal>
-                        </goals>
-                        <configuration>
-                            <excludeTransitive>false</excludeTransitive>
-                            <includeScope>runtime</includeScope>
-                            <excludeTypes>pom</excludeTypes>
-                            <includeArtifactIds>${project.artifactId}</includeArtifactIds>
-                            <outputDirectory>target/dependency</outputDirectory>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>              
-            <plugin>
-                <artifactId>maven-assembly-plugin</artifactId>
-                <version>2.2-beta-2</version>
-                <configuration>
-                    <descriptors>
-                        <descriptor>src/assembly/bundle.xml</descriptor>
-                    </descriptors>
-                    <outputDirectory>target/distribution</outputDirectory>
-                    <workDirectory>target/assembly/work</workDirectory>
-                </configuration>
-                <executions>
-                    <execution>
-                        <id>make-assembly</id>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>single</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-        <!-- replaces the classpath tokens in the xml file -->
-        <filters>
-            <filter>target/classpath.properties</filter>
-        </filters>
-        <resources>
-            <resource>
-                <directory>src/main/resources</directory>
-                <filtering>true</filtering>
-                <includes>
-                    <include>**/*.xml</include>
-                </includes>
-            </resource>
-            <resource>
-                <directory>src/main/resources</directory>
-                <filtering>false</filtering>
-                <excludes>
-                    <exclude>**/*.xml</exclude>
-                </excludes>
-            </resource>            
-        </resources>
+      <plugins>
+        <plugin>
+          <artifactId>maven-jar-plugin</artifactId>
+          <executions>
+            <execution>
+              <id>build_jar</id>
+              <phase>process-classes</phase>
+              <goals>
+                <goal>jar</goal>
+              </goals>
+            </execution>
+          </executions>
+        </plugin>
+      </plugins>
     </build>
+
     
 </project>
\ No newline at end of file

Modified: branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCBaseExecution.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCBaseExecution.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCBaseExecution.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -29,12 +29,9 @@
 import java.sql.SQLWarning;
 import java.sql.Statement;
 import java.util.List;
-import java.util.Properties;
 
 import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.api.ConnectorIdentity;
 import org.teiid.connector.api.ConnectorLogger;
-import org.teiid.connector.api.ConnectorPropertyNames;
 import org.teiid.connector.api.ExecutionContext;
 import org.teiid.connector.basic.BasicExecution;
 import org.teiid.connector.jdbc.translator.TranslatedCommand;
@@ -42,8 +39,6 @@
 import org.teiid.connector.language.ICommand;
 import org.teiid.connector.language.ILiteral;
 
-import com.metamatrix.common.util.PropertiesUtils;
-
 /**
  */
 public abstract class JDBCBaseExecution extends BasicExecution  {
@@ -55,9 +50,9 @@
     // Passed to constructor
     protected Connection connection;
     protected Translator sqlTranslator;
-    protected ConnectorIdentity id;
     protected ConnectorLogger logger;
     protected ExecutionContext context;
+    protected JDBCManagedConnectionFactory env;
 
     // Derived from properties
     protected boolean trimString;
@@ -71,21 +66,19 @@
     // Constructors
     // ===========================================================================================================================
 
-    protected JDBCBaseExecution(Connection connection,
-                                Translator sqlTranslator,
-                                ConnectorLogger logger,
-                                Properties props,
-                                ExecutionContext context) {
+    protected JDBCBaseExecution(Connection connection, ExecutionContext context, JDBCManagedConnectionFactory env) throws ConnectorException {
         this.connection = connection;
-        this.sqlTranslator = sqlTranslator;
-        this.logger = logger;
+        this.sqlTranslator = env.getExtensionTranslationClass();
+        this.logger = env.getLogger();
         this.context = context;
+        this.env = env;
 
-        trimString = PropertiesUtils.getBooleanProperty(props, JDBCPropertyNames.TRIM_STRINGS, false);
-        fetchSize = PropertiesUtils.getIntProperty(props, JDBCPropertyNames.FETCH_SIZE, context.getBatchSize());
-        maxResultRows = PropertiesUtils.getIntProperty(props, ConnectorPropertyNames.MAX_RESULT_ROWS, -1);
+        trimString = env.isTrimStrings();
+        fetchSize = (env.getFetchSize() != -1)?env.getFetchSize():context.getBatchSize();
+        maxResultRows = env.getMaxResultRows();
+      
         //if the connector work needs to throw an excpetion, set the size plus 1
-        if (maxResultRows > 0 && PropertiesUtils.getBooleanProperty(props, ConnectorPropertyNames.EXCEPTION_ON_MAX_ROWS, false)) {
+        if (maxResultRows > 0 && env.isExceptionOnMaxRows()) {
         	maxResultRows++;
         }
         if (maxResultRows > 0) {

Modified: branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCConnector.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCConnector.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCConnector.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,343 +22,79 @@
 
 package org.teiid.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.naming.InitialContext;
 import javax.naming.NamingException;
 import javax.sql.DataSource;
-import javax.sql.XADataSource;
 
 import org.teiid.connector.api.Connection;
 import org.teiid.connector.api.ConnectorCapabilities;
 import org.teiid.connector.api.ConnectorEnvironment;
 import org.teiid.connector.api.ConnectorException;
 import org.teiid.connector.api.ConnectorLogger;
-import org.teiid.connector.api.ConnectorPropertyNames;
-import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.api.MappedUserIdentity;
-import org.teiid.connector.api.MetadataProvider;
-import org.teiid.connector.api.SingleIdentity;
-import org.teiid.connector.api.ConnectorAnnotations.ConnectionPooling;
 import org.teiid.connector.basic.BasicConnector;
-import org.teiid.connector.jdbc.translator.Translator;
-import org.teiid.connector.metadata.runtime.MetadataFactory;
-import org.teiid.connector.xa.api.TransactionContext;
-import org.teiid.connector.xa.api.XAConnection;
-import org.teiid.connector.xa.api.XAConnector;
 
-import com.metamatrix.common.util.PropertiesUtils;
-import com.metamatrix.core.MetaMatrixCoreException;
-import com.metamatrix.core.util.ReflectionHelper;
+import com.metamatrix.core.util.StringUtil;
 
 /**
  * JDBC implementation of Connector interface.
  */
- at ConnectionPooling
-public class JDBCConnector extends BasicConnector implements XAConnector, MetadataProvider {
+public class JDBCConnector extends BasicConnector {
 	
-	private static final String JNDI = "JNDI:"; //$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 JDBCManagedConnectionFactory config;
     private ConnectorCapabilities capabilities;
-    private Translator sqlTranslator;
-    private DataSource ds;
-    private XADataSource xaDs;
-    private int transIsoLevel = NO_ISOLATION_LEVEL_SET;
+    
+    
+	@Override
+	public void initialize(ConnectorEnvironment env) throws ConnectorException {
+		super.initialize(env);
+				
+		this.config = (JDBCManagedConnectionFactory)env;
+		
+		ConnectorLogger logger = config.getLogger();
+		
+		logger.logInfo(JDBCPlugin.Util.getString("JDBCConnector.JDBCConnector_initialized._1")); //$NON-NLS-1$
+		
         
-    @Override
-    public void start(ConnectorEnvironment environment)
-    		throws ConnectorException {
-    	super.start(environment);
-    	logger = environment.getLogger();
-        this.environment = environment;
+        // Get the JNDI name for the underlying JDBC source
+        String dataSourceName = this.config.getSourceJNDIName();
         
-        logger.logInfo(JDBCPlugin.Util.getString("JDBCConnector.JDBCConnector_initialized._1")); //$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$
+        if (!StringUtil.isValid(dataSourceName)) {
+            throw new ConnectorException(JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.Missing_JDBC_jndi_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();
-        }
+        capabilities = config.getExtensionTranslationClass().getConnectorCapabilities();
         
-        try {
-            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);
-        }
-        PropertiesUtils.setBeanProperties(sqlTranslator, environment.getProperties(), null);
-        sqlTranslator.initialize(environment);
-        
-        capabilities = sqlTranslator.getConnectorCapabilities();
-        PropertiesUtils.setBeanProperties(capabilities, environment.getProperties(), null);
-        
-        createDataSources(dataSourceClassName, connectionProps);
-        
         logger.logInfo(JDBCPlugin.Util.getString("JDBCConnector.JDBCConnector_started._4")); //$NON-NLS-1$
     }
     
-	@Override
-    public void stop() {     
-		/*
-		 * attempt to deregister drivers that may have been implicitly registered
-		 * with the driver manager
-		 */
-		boolean usingCustomClassLoader = PropertiesUtils.getBooleanProperty(this.environment.getProperties(), ConnectorPropertyNames.USING_CUSTOM_CLASSLOADER, false);
-
-		if (!usingCustomClassLoader) {
-			return;
-		}
-		
-		Enumeration drivers = DriverManager.getDrivers();
-
-        while(drivers.hasMoreElements()){
-        	Driver tempdriver = (Driver)drivers.nextElement();
-            if(tempdriver.getClass().getClassLoader() != Thread.currentThread().getContextClassLoader()) {
-            	continue;
-            }
-            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 {
+    public Connection getConnection() throws ConnectorException {
 		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 MappedUserIdentity) {
-				MappedUserIdentity id = (MappedUserIdentity)context.getConnectorIdentity();
-				conn = dataSource.getConnection(id.getMappedUser(), id.getPassword());
-			}
-			setDefaultTransactionIsolationLevel(conn);
+		try {
+			// TODO: credential mapping facility is now gone. so, no more re-authenticating user.
+			return new JDBCSourceConnection(dataSource.getConnection(), this.config);
 		} catch (SQLException e) {
 			throw new ConnectorException(e);
 		}
-		return createJDBCSourceConnection(conn, this.environment, this.sqlTranslator);
     }
 
-	public Connection createJDBCSourceConnection(java.sql.Connection conn, ConnectorEnvironment env, Translator trans)
-			throws ConnectorException {
-		return new JDBCSourceConnection(conn, env, trans);
-	}
 	
-	@Override
-	public XAConnection getXAConnection(
-			ExecutionContext context,
-			TransactionContext transactionContext) throws ConnectorException {
-		XADataSource xaDataSource = getXADataSource();
-		if (xaDataSource == null) {
-			throw new UnsupportedOperationException(JDBCPlugin.Util.getString("JDBCConnector.non_xa_connection_source")); //$NON-NLS-1$
-		}
-		javax.sql.XAConnection conn = null;
-		try {
-			if (context == null || context.getConnectorIdentity() instanceof SingleIdentity) {
-				conn = xaDataSource.getXAConnection();
-			} else if (context.getConnectorIdentity() instanceof MappedUserIdentity) {
-				MappedUserIdentity id = (MappedUserIdentity)context.getConnectorIdentity();
-				conn = xaDataSource.getXAConnection(id.getMappedUser(), id.getPassword());
-			} else {
-				throw new ConnectorException(JDBCPlugin.Util.getString("JDBCConnector.unsupported_identity_type")); //$NON-NLS-1$
-			}
-			java.sql.Connection c = conn.getConnection();
-			setDefaultTransactionIsolationLevel(c);
-			return createJDBCSourceXAConnection(conn, c, this.environment, this.sqlTranslator);
-		} catch (SQLException e) {
-			throw new ConnectorException(e);
-		}
-	}
-
-	public XAConnection createJDBCSourceXAConnection(
-			javax.sql.XAConnection conn, java.sql.Connection c, ConnectorEnvironment env, Translator trans)
-			throws ConnectorException, SQLException {
-		return new JDBCSourceXAConnection(c, conn, env, trans);
-	}
-
     @Override
 	public ConnectorCapabilities getCapabilities() {
 		return capabilities;
 	}
 	
-    protected void createDataSources(String dataSourceClassName, final Properties connectionProps) throws ConnectorException {
-        // create data source
-        if (dataSourceClassName.startsWith(JNDI)) {
-        	try {
-				InitialContext ic = new InitialContext();
-				this.ds = (DataSource) ic.lookup(dataSourceClassName.substring(JNDI.length()));
-			} catch (NamingException e) {
-				throw new ConnectorException(e,JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.Unable_to_find_jndi_ds", dataSourceClassName.substring(JNDI.length()))); //$NON-NLS-1$
-			}
-        } else {
-	    	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 (temp instanceof Driver) {
-	    		final Driver driver = (Driver)temp;
-	    		// check URL if there is one
-	            if (url == null || url.trim().length() == 0) {
-	                throw new ConnectorException(JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.Missing_JDBC_database_name_3")); //$NON-NLS-1$
-	            }
-	            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")) { //$NON-NLS-1$
-	    					Properties p = new Properties();
-	    					String user = null;
-	    					String password = null;
-	    					if (args != null && args.length == 2) {
-	    						user = (String)args[0];
-	    						password = (String)args[1];
-	    					} else {
-	    						user = connectionProps.getProperty(JDBCPropertyNames.USERNAME);
-	    						password = connectionProps.getProperty(JDBCPropertyNames.PASSWORD);
-	    					}
-	    					if (user != null) {
-	    						p.put("user", user); //$NON-NLS-1$
-	    					}
-	    					if (password != null) {
-	    						p.put("password", password); //$NON-NLS-1$
-	    					}
-	    					return driver.connect(url, p);
-	    				} 
-	    				throw new UnsupportedOperationException("Driver DataSource proxy only provides Connections"); //$NON-NLS-1$
-	    			}
-	    		});
-	    	} else {
-	    		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(JDBCPlugin.Util.getString("JDBCConnector.invalid_source", dataSourceClassName)); //$NON-NLS-1$
-	    		}
-	    	} 
-        }
-    	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$
-        }
-    }
-    
-    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());
-		}
-	}
-	
-	@Override
-	public void getConnectorMetadata(MetadataFactory metadataFactory)
-			throws ConnectorException {
-		java.sql.Connection conn = null;
-		javax.sql.XAConnection xaConn = null;
+    protected DataSource getDataSource() throws ConnectorException {
+    	String dsName = this.config.getSourceJNDIName(); 
 		try {
-			if (ds != null) {
-				conn = ds.getConnection();
-			} else {
-				xaConn = xaDs.getXAConnection();
-				conn = xaConn.getConnection();
-			}
-			JDBCMetdataProcessor metadataProcessor = new JDBCMetdataProcessor(this.logger);
-			PropertiesUtils.setBeanProperties(metadataProcessor, metadataFactory.getImportProperties(), "importer"); //$NON-NLS-1$
-			PropertiesUtils.setBeanProperties(metadataProcessor, this.environment.getProperties(), "importer"); //$NON-NLS-1$
-			metadataProcessor.getConnectorMetadata(conn, metadataFactory);
-		} catch (SQLException e) {
-			throw new ConnectorException(e);
-		} finally {
-			try {
-				if (conn != null) {
-					conn.close();
-				}
-				if (xaConn != null) {
-					xaConn.close();
-				}
-			} catch (SQLException e) {
-				
-			}
+			InitialContext ic = new InitialContext();
+			return (DataSource) ic.lookup(dsName);
+		} catch (NamingException e) {
+			throw new ConnectorException(e,JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.Unable_to_find_jndi_ds", dsName)); //$NON-NLS-1$
 		}
-	}
-        
+    }
 }

Added: branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCManagedConnectionFactory.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCManagedConnectionFactory.java	                        (rev 0)
+++ branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCManagedConnectionFactory.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,210 @@
+/*
+ * 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 org.teiid.connector.jdbc;
+
+import java.util.StringTokenizer;
+
+import org.teiid.connector.api.ConnectorException;
+import org.teiid.connector.basic.BasicManagedConnectionFactory;
+import org.teiid.connector.jdbc.translator.Translator;
+
+import com.metamatrix.core.MetaMatrixCoreException;
+import com.metamatrix.core.util.ReflectionHelper;
+import com.metamatrix.core.util.StringUtil;
+
+public class JDBCManagedConnectionFactory extends BasicManagedConnectionFactory {
+	
+	// JDBC connector properties
+	private boolean useBindVariables = false;
+	private String databaseTimeZone;
+	private String extensionTranslationClassName;
+	private String sourceJNDIName;
+	private boolean trimStrings=false;
+	private boolean useCommentsInSourceQuery = false;
+	private int fetchSize = -1;
+	
+	
+	
+	// import specific properties
+	private String catalog;
+	private String schemaPattern;
+	private String tableNamePattern;
+	private String procedureNamePattern;
+	private String[] tableTypes;
+	private boolean useFullSchemaName = true;
+	private boolean importKeys = true;
+	private boolean importIndexes = true;
+	private boolean importProcedures = true;
+	
+	// derived
+	private Translator sqlTranslator;
+	
+	public boolean isUseBindVariables() {
+		return useBindVariables;
+	}
+
+	public String getDatabaseTimeZone() {
+		return databaseTimeZone;
+	}
+
+	public String getExtensionTranslationClassName() {
+		return extensionTranslationClassName;
+	}
+	
+	public Translator getExtensionTranslationClass() throws ConnectorException {
+		if (this.sqlTranslator == null) {
+	        try {
+	        	String className = getExtensionTranslationClassName();
+	        	if (StringUtil.isValid(className)) {
+	        		className = Translator.class.getName();
+	        	}
+	            this.sqlTranslator = (Translator)ReflectionHelper.create(className, null, Thread.currentThread().getContextClassLoader());
+	            sqlTranslator.initialize(this);
+	        } catch (MetaMatrixCoreException e) {
+	            throw new ConnectorException(e);
+			}
+		}
+		return this.sqlTranslator;
+	}	
+
+	public String getSourceJNDIName() {
+		return sourceJNDIName;
+	}
+
+	public boolean isTrimStrings() {
+		return trimStrings;
+	}
+
+	public boolean isUseCommentsInSourceQuery() {
+		return useCommentsInSourceQuery;
+	}
+	
+	public void setUseBindVariables(Boolean arg0) {
+		this.useBindVariables = arg0.booleanValue();
+	}
+	
+	public void setDatabaseTimeZone(String arg0) {
+		this.databaseTimeZone = arg0;
+	}
+	
+	public void setExtensionTranslationClassName(String arg0) {
+		this.extensionTranslationClassName = arg0;
+	}
+	
+	public void setSourceJNDIName(String arg0) {
+		this.sourceJNDIName = arg0;
+	}
+	
+	public void setTrimStrings(Boolean arg0) {
+		this.trimStrings = arg0.booleanValue();
+	}
+
+	public void setUseCommentsInSourceQuery(Boolean arg0) {
+		this.useCommentsInSourceQuery = arg0.booleanValue();
+	}
+	
+	public void setFetchSize(Integer arg0) {
+		this.fetchSize = arg0.intValue();
+	}
+	
+	public int getFetchSize() {
+		return this.fetchSize;
+	}	
+	
+	// Importer specific properties
+	public void setImportCatalog(String arg0) {
+		this.catalog = arg0;
+	}
+	public String getImportCatalog() {
+		return this.catalog;
+	}	
+
+	public void setImportSchemaPattern(String arg0) {
+		this.schemaPattern = arg0;
+	}
+	
+	public String getImportSchemaPattern() {
+		return this.schemaPattern;
+	}	
+
+	public void setImportTableNamePattern(String arg0) {
+		this.tableNamePattern = arg0;
+	}
+	
+	public String getImportTableNamePattern() {
+		return this.tableNamePattern;
+	}	
+
+	public void setImportTableTypes(String arg0) {
+		StringTokenizer st = new StringTokenizer(arg0, ","); //$NON-NLS-1$
+		this.tableTypes = new String[st.countTokens()];
+		
+		int i = 0;
+		while(st.hasMoreTokens()) {
+			this.tableTypes[i++] = st.nextToken();
+		}
+	}
+
+	public String[] getImportTableTypes() {
+		return this.tableTypes;
+	}
+	
+	public void setImportUseFullSchemaName(Boolean arg0) {
+		this.useFullSchemaName = arg0.booleanValue();
+	}
+
+	public boolean getImportUseFullSchemaName() {
+		return this.useFullSchemaName;
+	}
+	
+	public void setImportProcedureNamePattern(String arg0) {
+		this.procedureNamePattern = arg0;
+	}
+	
+	public String getImportProcedureNamePattern() {
+		return this.procedureNamePattern;
+	}
+	
+	public void setImportIndexes(Boolean arg0) {
+		this.importIndexes = arg0.booleanValue();
+	}
+	
+	public boolean getImportIndexes() {
+		return this.importIndexes;
+	}
+	
+	public void setImportKeys(Boolean arg0) {
+		this.importKeys = arg0.booleanValue();
+	}
+	
+	public boolean getImportKeys() {
+		return this.importKeys;
+	}
+	
+	public void setImportProcedures(Boolean arg0) {
+		this.importProcedures = arg0.booleanValue();
+	}	
+	
+	public boolean getImportProcedures() {
+		return this.importProcedures;
+	}	
+}


Property changes on: branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCManagedConnectionFactory.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCMetdataProcessor.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCMetdataProcessor.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCMetdataProcessor.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -64,22 +64,14 @@
 		}
 	}
 	
-	private String catalog;
-	private String schemaPattern;
-	private String tableNamePattern;
-	private String procedureNamePattern;
-	private String[] tableTypes;
-	
-	private boolean useFullSchemaName = true;
-	private boolean importKeys = true;
-	private boolean importIndexes = true;
 	private boolean importApproximateIndexes = true;
-	private boolean importProcedures = true;
 	
 	private ConnectorLogger logger;
+	JDBCManagedConnectionFactory config;
 	
-	public JDBCMetdataProcessor(ConnectorLogger logger) {
-		this.logger = logger;
+	public JDBCMetdataProcessor(JDBCManagedConnectionFactory config) {
+		this.logger = config.getLogger();
+		this.config = config;
 	}
 
 	public void getConnectorMetadata(Connection conn, MetadataFactory metadataFactory)
@@ -88,17 +80,17 @@
 		
 		Map<String, TableInfo> tableMap = getTables(metadataFactory, metadata);
 		
-		if (importKeys) {
+		if (config.getImportKeys()) {
 			getPrimaryKeys(metadataFactory, metadata, tableMap);
 			
 			getForeignKeys(metadataFactory, metadata, tableMap);
 		}
 		
-		if (importIndexes) {
+		if (config.getImportIndexes()) {
 			getIndexes(metadataFactory, metadata, tableMap);
 		}
 		
-		if (importProcedures) {
+		if (config.getImportProcedures()) {
 			getProcedures(metadataFactory, metadata);
 		}
 	}
@@ -106,15 +98,15 @@
 	private void getProcedures(MetadataFactory metadataFactory,
 			DatabaseMetaData metadata) throws SQLException, ConnectorException {
 		logger.logDetail("JDBCMetadataProcessor - Importing procedures"); //$NON-NLS-1$
-		ResultSet procedures = metadata.getProcedures(catalog, schemaPattern, procedureNamePattern);
+		ResultSet procedures = metadata.getProcedures(config.getImportCatalog(), config.getImportSchemaPattern(), config.getImportProcedureNamePattern());
 		while (procedures.next()) {
 			String procedureCatalog = procedures.getString(1);
 			String procedureSchema = procedures.getString(2);
 			String procedureName = procedures.getString(3);
 			String fullProcedureName = getTableName(procedureCatalog, procedureSchema, procedureName);
-			ProcedureRecordImpl procedure = metadataFactory.addProcedure(useFullSchemaName?fullProcedureName:procedureName);
+			ProcedureRecordImpl procedure = metadataFactory.addProcedure(config.getImportUseFullSchemaName()?fullProcedureName:procedureName);
 			procedure.setNameInSource(fullProcedureName);
-			ResultSet columns = metadata.getProcedureColumns(catalog, procedureSchema, procedureName, null);
+			ResultSet columns = metadata.getProcedureColumns(config.getImportCatalog(), procedureSchema, procedureName, null);
 			while (columns.next()) {
 				String columnName = columns.getString(4);
 				short columnType = columns.getShort(5);
@@ -161,14 +153,14 @@
 	private Map<String, TableInfo> getTables(MetadataFactory metadataFactory,
 			DatabaseMetaData metadata) throws SQLException, ConnectorException {
 		logger.logDetail("JDBCMetadataProcessor - Importing tables"); //$NON-NLS-1$
-		ResultSet tables = metadata.getTables(catalog, schemaPattern, tableNamePattern, tableTypes);
+		ResultSet tables = metadata.getTables(config.getImportCatalog(), config.getImportSchemaPattern(), config.getImportTableNamePattern(), config.getImportTableTypes());
 		Map<String, TableInfo> tableMap = new HashMap<String, TableInfo>();
 		while (tables.next()) {
 			String tableCatalog = tables.getString(1);
 			String tableSchema = tables.getString(2);
 			String tableName = tables.getString(3);
 			String fullName = getTableName(tableCatalog, tableSchema, tableName);
-			TableRecordImpl table = metadataFactory.addTable(useFullSchemaName?fullName:tableName);
+			TableRecordImpl table = metadataFactory.addTable(config.getImportUseFullSchemaName()?fullName:tableName);
 			table.setNameInSource(fullName);
 			table.setSupportsUpdate(true);
 			String remarks = tables.getString(5);
@@ -176,6 +168,7 @@
 				metadataFactory.addAnnotation(remarks, table);
 			}
 			tableMap.put(fullName, new TableInfo(tableCatalog, tableSchema, tableName, table));
+			tableMap.put(tableName, new TableInfo(tableCatalog, tableSchema, tableName, table));
 		}
 		tables.close();
 		
@@ -187,7 +180,7 @@
 			DatabaseMetaData metadata, Map<String, TableInfo> tableMap)
 			throws SQLException, ConnectorException {
 		logger.logDetail("JDBCMetadataProcessor - Importing columns"); //$NON-NLS-1$
-		ResultSet columns = metadata.getColumns(catalog, schemaPattern, tableNamePattern, null);
+		ResultSet columns = metadata.getColumns(config.getImportCatalog(), config.getImportSchemaPattern(), config.getImportTableNamePattern(), null);
 		int rsColumns = columns.getMetaData().getColumnCount();
 		while (columns.next()) {
 			String tableCatalog = columns.getString(1);
@@ -196,7 +189,10 @@
 			String fullTableName = getTableName(tableCatalog, tableSchema, tableName);
 			TableInfo tableInfo = tableMap.get(fullTableName);
 			if (tableInfo == null) {
-				continue;
+				tableInfo = tableMap.get(tableName);
+				if (tableInfo == null) {
+					continue;
+				}
 			}
 			String columnName = columns.getString(4);
 			int type = columns.getInt(5);
@@ -343,40 +339,6 @@
 		return fullName;
 	}
 		
-	public void setCatalog(String catalog) {
-		this.catalog = catalog;
-	}
 
-	public void setSchemaPattern(String schemaPattern) {
-		this.schemaPattern = schemaPattern;
-	}
 
-	public void setTableNamePattern(String tableNamePattern) {
-		this.tableNamePattern = tableNamePattern;
-	}
-
-	public void setTableTypes(String[] tableTypes) {
-		this.tableTypes = tableTypes;
-	}
-
-	public void setUseFullSchemaName(boolean useFullSchemaName) {
-		this.useFullSchemaName = useFullSchemaName;
-	}
-
-	public void setProcedureNamePattern(String procedureNamePattern) {
-		this.procedureNamePattern = procedureNamePattern;
-	}
-	
-	public void setImportIndexes(boolean importIndexes) {
-		this.importIndexes = importIndexes;
-	}
-	
-	public void setImportKeys(boolean importKeys) {
-		this.importKeys = importKeys;
-	}
-	
-	public void setImportProcedures(boolean importProcedures) {
-		this.importProcedures = importProcedures;
-	}
-
 }

Modified: branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCProcedureExecution.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCProcedureExecution.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCProcedureExecution.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -29,22 +29,17 @@
 import java.sql.Types;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Properties;
 
-import org.teiid.connector.api.ConnectorEnvironment;
 import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.api.ConnectorLogger;
 import org.teiid.connector.api.DataNotAvailableException;
 import org.teiid.connector.api.ExecutionContext;
 import org.teiid.connector.api.ProcedureExecution;
 import org.teiid.connector.api.TypeFacility;
 import org.teiid.connector.jdbc.translator.TranslatedCommand;
-import org.teiid.connector.jdbc.translator.Translator;
 import org.teiid.connector.language.ICommand;
 import org.teiid.connector.language.IParameter;
 import org.teiid.connector.language.IProcedure;
 import org.teiid.connector.language.IParameter.Direction;
-import org.teiid.connector.metadata.runtime.RuntimeMetadata;
 
 /**
  */
@@ -59,14 +54,8 @@
      * @param props
      * @param id
      */
-    public JDBCProcedureExecution(ICommand command,
-        Connection connection,
-        Translator sqlTranslator,
-        ConnectorLogger logger,
-        Properties props,
-        RuntimeMetadata metadata, ExecutionContext context,
-        ConnectorEnvironment env) {
-        super(command, connection, sqlTranslator, logger, props, context, env);
+	public JDBCProcedureExecution(ICommand command, Connection connection, ExecutionContext context, JDBCManagedConnectionFactory env) throws ConnectorException {
+        super(command, connection, context, env);
     }
 
     @Override

Modified: branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCQueryExecution.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCQueryExecution.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCQueryExecution.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -33,16 +33,12 @@
 import java.sql.Types;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Properties;
 
-import org.teiid.connector.api.ConnectorEnvironment;
 import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.api.ConnectorLogger;
 import org.teiid.connector.api.DataNotAvailableException;
 import org.teiid.connector.api.ExecutionContext;
 import org.teiid.connector.api.ResultSetExecution;
 import org.teiid.connector.jdbc.translator.TranslatedCommand;
-import org.teiid.connector.jdbc.translator.Translator;
 import org.teiid.connector.language.ICommand;
 import org.teiid.connector.language.IQueryCommand;
 
@@ -57,7 +53,6 @@
     // ===========================================================================================================================
 
     protected ResultSet results;
-    protected ConnectorEnvironment env;
     protected ICommand command;
     protected Class<?>[] columnDataTypes;
 	private boolean[] trimColumn;
@@ -66,15 +61,9 @@
     // Constructors
     // ===========================================================================================================================
 
-    public JDBCQueryExecution(ICommand command, Connection connection,
-                              Translator sqlTranslator,
-                              ConnectorLogger logger,
-                              Properties props,
-                              ExecutionContext context,
-                              ConnectorEnvironment env) {
-        super(connection, sqlTranslator, logger, props, context);
+    public JDBCQueryExecution(ICommand command, Connection connection, ExecutionContext context, JDBCManagedConnectionFactory env) throws ConnectorException {
+        super(connection, context, env);
         this.command = command;
-        this.env = env;
     }
     
     @Override
@@ -162,7 +151,7 @@
     /**
      * @see org.teiid.connector.jdbc.JDBCBaseExecution#close()
      */
-    public void close() throws ConnectorException {
+    public synchronized void close() throws ConnectorException {
         // first we would need to close the result set here then we can close
         // the statement, using the base class.
         if (results != null) {

Modified: branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCSourceConnection.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCSourceConnection.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCSourceConnection.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -24,13 +24,10 @@
  */
 package org.teiid.connector.jdbc;
 
-import java.sql.Connection;
 import java.sql.SQLException;
-import java.sql.Statement;
+import java.util.Map;
 
-import org.teiid.connector.api.ConnectorEnvironment;
 import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.api.ConnectorLogger;
 import org.teiid.connector.api.ExecutionContext;
 import org.teiid.connector.api.ProcedureExecution;
 import org.teiid.connector.api.ResultSetExecution;
@@ -40,6 +37,9 @@
 import org.teiid.connector.language.ICommand;
 import org.teiid.connector.language.IProcedure;
 import org.teiid.connector.language.IQueryCommand;
+import org.teiid.connector.metadata.runtime.ConnectorMetadata;
+import org.teiid.connector.metadata.runtime.DatatypeRecordImpl;
+import org.teiid.connector.metadata.runtime.MetadataFactory;
 import org.teiid.connector.metadata.runtime.RuntimeMetadata;
 
 
@@ -48,37 +48,34 @@
  */
 public class JDBCSourceConnection extends BasicConnection {
     protected java.sql.Connection physicalConnection;
-    protected ConnectorEnvironment environment;
-    private ConnectorLogger logger;
+    protected JDBCManagedConnectionFactory environment;
     private Translator sqlTranslator;
 
-    public JDBCSourceConnection(java.sql.Connection connection, ConnectorEnvironment environment, Translator sqlTranslator) throws ConnectorException {
+    public JDBCSourceConnection(java.sql.Connection connection, JDBCManagedConnectionFactory environment) throws ConnectorException {
         this.physicalConnection = connection;
         this.environment = environment;
-        this.logger = environment.getLogger();
-        this.sqlTranslator = sqlTranslator;
+        this.sqlTranslator = environment.getExtensionTranslationClass();
         this.sqlTranslator.afterConnectionCreation(connection);
     }
     
     @Override
-    public ResultSetExecution createResultSetExecution(IQueryCommand command,
-    		ExecutionContext executionContext, RuntimeMetadata metadata)
+    public ResultSetExecution createResultSetExecution(IQueryCommand command, ExecutionContext executionContext, RuntimeMetadata metadata)
     		throws ConnectorException {
-    	return new JDBCQueryExecution(command, this.physicalConnection, sqlTranslator, logger, this.environment.getProperties(), executionContext, this.environment);
+    	return new JDBCQueryExecution(command, this.physicalConnection, executionContext, this.environment);
     }
     
     @Override
     public ProcedureExecution createProcedureExecution(IProcedure command,
     		ExecutionContext executionContext, RuntimeMetadata metadata)
     		throws ConnectorException {
-    	return new JDBCProcedureExecution(command, this.physicalConnection, sqlTranslator, logger, this.environment.getProperties(), metadata, executionContext, this.environment);
+    	return new JDBCProcedureExecution(command, this.physicalConnection, executionContext, this.environment);
     }
 
     @Override
     public UpdateExecution createUpdateExecution(ICommand command,
     		ExecutionContext executionContext, RuntimeMetadata metadata)
     		throws ConnectorException {
-    	return new JDBCUpdateExecution(command, this.physicalConnection, sqlTranslator, logger, this.environment.getProperties(), executionContext);    
+    	return new JDBCUpdateExecution(command, this.physicalConnection, executionContext, this.environment);    
     }
     
     @Override
@@ -90,38 +87,21 @@
 		try {
             this.physicalConnection.close();
         } catch(SQLException e) {
-        	logger.logDetail("Exception during close: " + e.getMessage()); //$NON-NLS-1$
+        	environment.getLogger().logDetail("Exception during close: " + e.getMessage()); //$NON-NLS-1$
         }
 	}
 
-    @Override
-    public boolean isAlive() {
-    	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 true;
-    }
-    
+	
+	@Override
+	public ConnectorMetadata getModelMetaData(String modelName, Map<String, DatatypeRecordImpl> dataTypes)
+			throws ConnectorException {
+		try {
+			MetadataFactory metadataFactory = new MetadataFactory(modelName, dataTypes);
+			JDBCMetdataProcessor metadataProcessor = new JDBCMetdataProcessor(this.environment);
+			metadataProcessor.getConnectorMetadata(this.physicalConnection, metadataFactory);
+			return metadataFactory;
+		} catch (SQLException e) {
+			throw new ConnectorException(e);
+		}
+	}	
 }

Deleted: branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCSourceXAConnection.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCSourceXAConnection.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCSourceXAConnection.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,104 +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 org.teiid.connector.jdbc;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-
-import javax.sql.ConnectionEvent;
-import javax.sql.ConnectionEventListener;
-import javax.transaction.xa.XAResource;
-
-import org.teiid.connector.api.ConnectorEnvironment;
-import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.jdbc.translator.Translator;
-import org.teiid.connector.xa.api.XAConnection;
-
-
-public class JDBCSourceXAConnection extends JDBCSourceConnection implements XAConnection {
-    private javax.sql.XAConnection xaConn;
-    private XAResource resource;
-    private boolean errorOccurred;
-    
-    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
-        	public void connectionClosed(ConnectionEvent event) {
-        		
-        	}
-        	@Override
-        	public void connectionErrorOccurred(ConnectionEvent event) {
-        		errorOccurred = true;
-        	}
-        });
-        this.resource = xaConn.getXAResource();
-    }
-    
-    /**
-     * @see org.teiid.connector.xa.api.XAConnection#getXAResource()
-     */
-    public XAResource getXAResource() throws ConnectorException {
-        return resource;
-    }
-    
-    @Override
-    public void close() {
-        super.close();
-        
-        try {
-			this.xaConn.close();
-		} catch (SQLException e) {
-			this.environment.getLogger().logDetail("Exception while closing: " + e.getMessage()); //$NON-NLS-1$
-		}
-    }
-    
-    /**
-     * XAConnection Connections should be cycled to ensure proper cleanup after the transaction.
-     */
-    @Override
-    public void closeCalled() {
-    	closeSourceConnection();
-    	try {
-			this.physicalConnection = this.xaConn.getConnection();
-		} catch (SQLException e) {
-			this.environment.getLogger().logDetail("Exception while cycling connection: " + e.getMessage()); //$NON-NLS-1$
-		}
-    }
-    
-    @Override
-    public boolean isAlive() {
-    	if (errorOccurred) {
-    		return false;
-    	}
-    	return super.isAlive();
-    }
-    
-    public javax.sql.XAConnection getXAConnection() {
-    	return this.xaConn;
-    }
-    
-}

Modified: branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCUpdateExecution.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCUpdateExecution.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCUpdateExecution.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -27,15 +27,12 @@
 import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Properties;
 
 import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.api.ConnectorLogger;
 import org.teiid.connector.api.DataNotAvailableException;
 import org.teiid.connector.api.ExecutionContext;
 import org.teiid.connector.api.UpdateExecution;
 import org.teiid.connector.jdbc.translator.TranslatedCommand;
-import org.teiid.connector.jdbc.translator.Translator;
 import org.teiid.connector.language.IBatchedUpdates;
 import org.teiid.connector.language.ICommand;
 import org.teiid.connector.language.ILiteral;
@@ -43,8 +40,7 @@
 
 /**
  */
-public class JDBCUpdateExecution extends JDBCBaseExecution implements
-                                                          UpdateExecution {
+public class JDBCUpdateExecution extends JDBCBaseExecution implements UpdateExecution {
 
 	private ICommand command;
 	private int[] result;
@@ -56,12 +52,8 @@
      * @param props
      * @param id
      */
-    public JDBCUpdateExecution(ICommand command, Connection connection,
-                               Translator sqlTranslator,
-                               ConnectorLogger logger,
-                               Properties props,
-                               ExecutionContext context) {
-        super(connection, sqlTranslator, logger, props, context);
+	public JDBCUpdateExecution(ICommand command, Connection connection, ExecutionContext context, JDBCManagedConnectionFactory env) throws ConnectorException {
+        super(connection, context, env);
         this.command = command;
     }
 
@@ -248,6 +240,7 @@
         	throw new JDBCExecutionException(err, tCommand);
         } finally {
         	try {
+        		connection.commit(); // in JbossAs setAutocommit = true does not trigger the commit.
         		connection.setAutoCommit(true);
         	} catch (SQLException err) {
             	throw new JDBCExecutionException(err, tCommand);

Modified: branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/db2/DB2SQLTranslator.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/db2/DB2SQLTranslator.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/db2/DB2SQLTranslator.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -26,11 +26,11 @@
 import java.util.List;
 
 import org.teiid.connector.api.ConnectorCapabilities;
-import org.teiid.connector.api.ConnectorEnvironment;
 import org.teiid.connector.api.ConnectorException;
 import org.teiid.connector.api.ExecutionContext;
 import org.teiid.connector.api.SourceSystemFunctions;
 import org.teiid.connector.api.TypeFacility;
+import org.teiid.connector.jdbc.JDBCManagedConnectionFactory;
 import org.teiid.connector.jdbc.translator.AliasModifier;
 import org.teiid.connector.jdbc.translator.ConvertModifier;
 import org.teiid.connector.jdbc.translator.FunctionModifier;
@@ -67,7 +67,7 @@
 	}
 
 	@Override
-	public void initialize(ConnectorEnvironment env) throws ConnectorException {
+	public void initialize(JDBCManagedConnectionFactory env) throws ConnectorException {
 		super.initialize(env);
         registerFunctionModifier(SourceSystemFunctions.CHAR, new AliasModifier("chr")); //$NON-NLS-1$ 
         registerFunctionModifier(SourceSystemFunctions.DAYOFMONTH, new AliasModifier("day")); //$NON-NLS-1$ 
@@ -145,13 +145,9 @@
 		}
 		return super.translate(obj, context);
 	}
+
 	
 	@Override
-	public String getDefaultConnectionTestQuery() {
-		return "Select 'x' from sysibm.systables where 1 = 2"; //$NON-NLS-1$
-	}
-	
-	@Override
 	public Class<? extends ConnectorCapabilities> getDefaultCapabilities() {
 		return DB2Capabilities.class;
 	}

Modified: branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/derby/DerbySQLTranslator.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/derby/DerbySQLTranslator.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/derby/DerbySQLTranslator.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -23,9 +23,9 @@
 package org.teiid.connector.jdbc.derby;
 
 import org.teiid.connector.api.ConnectorCapabilities;
-import org.teiid.connector.api.ConnectorEnvironment;
 import org.teiid.connector.api.ConnectorException;
 import org.teiid.connector.api.SourceSystemFunctions;
+import org.teiid.connector.jdbc.JDBCManagedConnectionFactory;
 import org.teiid.connector.jdbc.db2.DB2SQLTranslator;
 import org.teiid.connector.jdbc.oracle.LeftOrRightFunctionModifier;
 import org.teiid.connector.jdbc.translator.EscapeSyntaxModifier;
@@ -40,7 +40,7 @@
 	private String version = DerbyCapabilities.TEN_1;
 	
 	@Override
-	public void initialize(ConnectorEnvironment env) throws ConnectorException {
+	public void initialize(JDBCManagedConnectionFactory env) throws ConnectorException {
 		super.initialize(env);
 		//additional derby functions
         registerFunctionModifier(SourceSystemFunctions.TIMESTAMPADD, new EscapeSyntaxModifier()); 
@@ -57,11 +57,6 @@
     }
     
     @Override
-    public String getDefaultConnectionTestQuery() {
-    	return "Select 0 from sys.systables where 1 = 2"; //$NON-NLS-1$
-    }
-    
-    @Override
     public Class<? extends ConnectorCapabilities> getDefaultCapabilities() {
     	return DerbyCapabilities.class;
     }

Modified: branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/informix/InformixSQLTranslator.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/informix/InformixSQLTranslator.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/informix/InformixSQLTranslator.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -25,9 +25,9 @@
 package org.teiid.connector.jdbc.informix;
 
 import org.teiid.connector.api.ConnectorCapabilities;
-import org.teiid.connector.api.ConnectorEnvironment;
 import org.teiid.connector.api.ConnectorException;
 import org.teiid.connector.api.SourceSystemFunctions;
+import org.teiid.connector.jdbc.JDBCManagedConnectionFactory;
 import org.teiid.connector.jdbc.translator.ConvertModifier;
 import org.teiid.connector.jdbc.translator.Translator;
 
@@ -37,17 +37,12 @@
 public class InformixSQLTranslator extends Translator {
 
 	@Override
-	public void initialize(ConnectorEnvironment env) throws ConnectorException {
+	public void initialize(JDBCManagedConnectionFactory env) throws ConnectorException {
 		super.initialize(env);
     	registerFunctionModifier(SourceSystemFunctions.CONVERT, new ConvertModifier());
     }
 	
 	@Override
-	public String getDefaultConnectionTestQuery() {
-		return "select 'x' from informix.sysusers where 1=0"; //$NON-NLS-1$
-	}
-	
-	@Override
 	public Class<? extends ConnectorCapabilities> getDefaultCapabilities() {
 		return InformixCapabilities.class;
 	}

Modified: branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQLTranslator.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQLTranslator.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQLTranslator.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -32,9 +32,9 @@
 import java.util.List;
 
 import org.teiid.connector.api.ConnectorCapabilities;
-import org.teiid.connector.api.ConnectorEnvironment;
 import org.teiid.connector.api.ConnectorException;
 import org.teiid.connector.api.SourceSystemFunctions;
+import org.teiid.connector.jdbc.JDBCManagedConnectionFactory;
 import org.teiid.connector.jdbc.translator.ConvertModifier;
 import org.teiid.connector.jdbc.translator.FunctionModifier;
 import org.teiid.connector.jdbc.translator.LocateFunctionModifier;
@@ -47,7 +47,7 @@
 public class MySQLTranslator extends Translator {
 	
 	@Override
-    public void initialize(ConnectorEnvironment env) throws ConnectorException {
+    public void initialize(JDBCManagedConnectionFactory env) throws ConnectorException {
         super.initialize(env);
         registerFunctionModifier(SourceSystemFunctions.BITAND, new BitFunctionModifier("&", getLanguageFactory())); //$NON-NLS-1$
         registerFunctionModifier(SourceSystemFunctions.BITNOT, new BitFunctionModifier("~", getLanguageFactory())); //$NON-NLS-1$

Modified: branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleSQLTranslator.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleSQLTranslator.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleSQLTranslator.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -36,10 +36,10 @@
 import java.util.List;
 
 import org.teiid.connector.api.ConnectorCapabilities;
-import org.teiid.connector.api.ConnectorEnvironment;
 import org.teiid.connector.api.ConnectorException;
 import org.teiid.connector.api.ExecutionContext;
 import org.teiid.connector.api.SourceSystemFunctions;
+import org.teiid.connector.jdbc.JDBCManagedConnectionFactory;
 import org.teiid.connector.jdbc.JDBCPlugin;
 import org.teiid.connector.jdbc.translator.AliasModifier;
 import org.teiid.connector.jdbc.translator.ConvertModifier;
@@ -78,7 +78,7 @@
     public final static String ROWNUM = "ROWNUM"; //$NON-NLS-1$
     public final static String SEQUENCE = ":SEQUENCE="; //$NON-NLS-1$
 	
-    public void initialize(ConnectorEnvironment env) throws ConnectorException {
+    public void initialize(JDBCManagedConnectionFactory env) throws ConnectorException {
         super.initialize(env);
         registerFunctionModifier(SourceSystemFunctions.CHAR, new AliasModifier("chr")); //$NON-NLS-1$ 
         registerFunctionModifier(SourceSystemFunctions.LCASE, new AliasModifier("lower")); //$NON-NLS-1$ 
@@ -347,13 +347,8 @@
     public boolean hasTimeType() {
     	return false;
     }
-    
+       
     @Override
-    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

Modified: branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/PostgreSQLTranslator.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/PostgreSQLTranslator.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/PostgreSQLTranslator.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -29,11 +29,11 @@
 import java.util.List;
 
 import org.teiid.connector.api.ConnectorCapabilities;
-import org.teiid.connector.api.ConnectorEnvironment;
 import org.teiid.connector.api.ConnectorException;
 import org.teiid.connector.api.ExecutionContext;
 import org.teiid.connector.api.SourceSystemFunctions;
 import org.teiid.connector.api.TypeFacility;
+import org.teiid.connector.jdbc.JDBCManagedConnectionFactory;
 import org.teiid.connector.jdbc.oracle.LeftOrRightFunctionModifier;
 import org.teiid.connector.jdbc.oracle.MonthOrDayNameFunctionModifier;
 import org.teiid.connector.jdbc.translator.AliasModifier;
@@ -60,7 +60,7 @@
 	
 	private String version = PostgreSQLCapabilities.EIGHT_0;
 
-    public void initialize(ConnectorEnvironment env) throws ConnectorException {
+    public void initialize(JDBCManagedConnectionFactory env) throws ConnectorException {
         //TODO: all of the functions (except for convert) can be handled through just the escape syntax
         super.initialize(env);
         registerFunctionModifier(SourceSystemFunctions.LOG, new AliasModifier("ln")); //$NON-NLS-1$ 

Modified: branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/SybaseSQLTranslator.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/SybaseSQLTranslator.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/SybaseSQLTranslator.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -29,10 +29,10 @@
 import java.util.List;
 
 import org.teiid.connector.api.ConnectorCapabilities;
-import org.teiid.connector.api.ConnectorEnvironment;
 import org.teiid.connector.api.ConnectorException;
 import org.teiid.connector.api.ExecutionContext;
 import org.teiid.connector.api.SourceSystemFunctions;
+import org.teiid.connector.jdbc.JDBCManagedConnectionFactory;
 import org.teiid.connector.jdbc.translator.AliasModifier;
 import org.teiid.connector.jdbc.translator.ConvertModifier;
 import org.teiid.connector.jdbc.translator.EscapeSyntaxModifier;
@@ -53,7 +53,7 @@
     /* 
      * @see com.metamatrix.connector.jdbc.extension.SQLTranslator#initialize(com.metamatrix.data.api.ConnectorEnvironment, com.metamatrix.data.metadata.runtime.RuntimeMetadata)
      */
-    public void initialize(ConnectorEnvironment env) throws ConnectorException {
+    public void initialize(JDBCManagedConnectionFactory env) throws ConnectorException {
         super.initialize(env);
         registerFunctionModifier(SourceSystemFunctions.MOD, new ModFunctionModifier("%", getLanguageFactory())); //$NON-NLS-1$ 
         registerFunctionModifier(SourceSystemFunctions.CONCAT, new AliasModifier("+")); //$NON-NLS-1$ 

Modified: branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/Translator.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/Translator.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/Translator.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -46,6 +46,7 @@
 import org.teiid.connector.api.ExecutionContext;
 import org.teiid.connector.api.TypeFacility;
 import org.teiid.connector.jdbc.JDBCCapabilities;
+import org.teiid.connector.jdbc.JDBCManagedConnectionFactory;
 import org.teiid.connector.jdbc.JDBCPlugin;
 import org.teiid.connector.jdbc.JDBCPropertyNames;
 import org.teiid.connector.language.ICommand;
@@ -125,7 +126,7 @@
     };
 
 	private Map<String, FunctionModifier> functionModifiers = new HashMap<String, FunctionModifier>();
-    private ConnectorEnvironment environment;
+    private JDBCManagedConnectionFactory environment;
     
     private boolean useComments;
     private boolean usePreparedStatements;
@@ -133,8 +134,6 @@
     private TypeFacility typeFacility;
 
     private volatile boolean initialConnection;
-    private String connectionTestQuery;
-    private int isValidTimeout = -1;
     
     /**
      * Initialize the SQLTranslator.
@@ -142,11 +141,11 @@
      * @param metadata
      * @throws ConnectorException
      */
-    public void initialize(ConnectorEnvironment env) throws ConnectorException {
+    public void initialize(JDBCManagedConnectionFactory env) throws ConnectorException {
         this.environment = env;
         this.typeFacility = env.getTypeFacility();
 
-        String timeZone = env.getProperties().getProperty(JDBCPropertyNames.DATABASE_TIME_ZONE);
+        String timeZone = this.environment.getDatabaseTimeZone();
         if(timeZone != null && timeZone.trim().length() > 0) {
         	TimeZone tz = TimeZone.getTimeZone(timeZone);
             if(!DEFAULT_TIME_ZONE.hasSameRules(tz)) {
@@ -154,10 +153,8 @@
             }
         }   
         
-        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);    		
+        this.useComments = this.environment.isUseCommentsInSourceQuery();
+        this.usePreparedStatements = this.environment.isUseBindVariables();
     }
     
     /**
@@ -415,14 +412,6 @@
     	return 9;
     }
     
-    public String getConnectionTestQuery() {
-		return connectionTestQuery;
-	}
-    
-    public String getDefaultConnectionTestQuery() {
-    	return "select 1"; //$NON-NLS-1$
-    }
-    
     public TypeFacility getTypeFacility() {
     	return typeFacility;
     }
@@ -746,14 +735,7 @@
         }
     }
     
-    /**
-     * Returns a positive number if query testing should use the JDBC 4.0 isValid check.
-     * Can be set via the {@link JDBCPropertyNames#IS_VALID_TIMEOUT} property
-     * @return
-     */
-    public int getIsValidTimeout() {
-		return isValidTimeout;
-	}
+
     
     /**
      * Create the {@link SQLConversionVisitor} that will perform translation.  Typical custom
@@ -781,12 +763,11 @@
      */
     public ConnectorCapabilities getConnectorCapabilities() throws ConnectorException {
 		// create Capabilities
-		String className = this.environment.getProperties().getProperty(JDBCPropertyNames.EXT_CAPABILITY_CLASS);
+		String className = this.environment.getCapabilitiesClass();
 		try {
 			ConnectorCapabilities result = null;
 			if (className != null && className.length() > 0) {
-				result = (ConnectorCapabilities) ReflectionHelper.create(
-						className, null, Thread.currentThread().getContextClassLoader());
+				result = (ConnectorCapabilities) ReflectionHelper.create(className, null, Thread.currentThread().getContextClassLoader());
 			} else {
 				result = getDefaultCapabilities().newInstance();
 			}

Added: branches/JCA/connectors/connector-jdbc/src/main/rar/META-INF/ra.xml
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/main/rar/META-INF/ra.xml	                        (rev 0)
+++ branches/JCA/connectors/connector-jdbc/src/main/rar/META-INF/ra.xml	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,224 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<connector xmlns="http://java.sun.com/xml/ns/j2ee"
+           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+           xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+           http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd"
+           version="1.5">
+
+   <vendor-name>Red Hat Middleware LLC</vendor-name>
+   <eis-type>Teiid JDBC Connector</eis-type>
+   <resourceadapter-version>1.0</resourceadapter-version>
+   <license>
+      <description>
+ JBoss, Home of Professional Open Source.
+ Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ as indicated by the @author tags. See the copyright.txt file in the
+ distribution for a full listing of individual contributors.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+      </description>
+      <license-required>true</license-required>
+   </license>
+   <resourceadapter>
+      <resourceadapter-class>org.teiid.connector.basic.BasicResourceAdapter</resourceadapter-class>
+
+      <outbound-resourceadapter>
+         <connection-definition>
+            <managedconnectionfactory-class>org.teiid.connector.jdbc.JDBCManagedConnectionFactory</managedconnectionfactory-class>
+
+            <config-property>
+               <description>Connector Class</description>
+               <config-property-name>ConnectorClass</config-property-name>
+               <config-property-type>java.lang.String</config-property-type>
+               <config-property-value>org.teiid.connector.jdbc.JDBCConnector</config-property-value>
+            </config-property>
+
+            <config-property>
+               <description>Connector Capabilities</description>
+               <description>The class to use to provide the Connector Capabilities</description>
+               <config-property-name>CapabilitiesClass</config-property-name>
+               <config-property-type>java.lang.String</config-property-type>
+               <config-property-value>org.teiid.connector.basic.BasicConnectorCapabilities</config-property-value>
+            </config-property>
+            
+            <config-property>
+               <description>Is Immutable</description>
+               <description>Is Immutable, True if the source never changes.</description>
+               <config-property-name>Immutable</config-property-name>
+               <config-property-type>java.lang.Boolean</config-property-type>
+               <config-property-value>false</config-property-value>
+            </config-property>
+            
+            <config-property>
+               <description>Is XA Capable</description>
+               <description>True, if this connector supports XA Transactions</description>
+               <config-property-name>XaCapable</config-property-name>
+               <config-property-type>java.lang.Boolean</config-property-type>
+               <config-property-value>false</config-property-value>
+            </config-property>            
+
+            <config-property>             
+               <description>Exception on Exceeding Max Rows</description>
+               <description>Indicates if an Exception should be thrown if the specified value for Maximum Result Rows is exceeded; else no exception and no more than the maximum will be returned</description>
+               <config-property-name>ExceptionOnMaxRows</config-property-name>
+               <config-property-type>java.lang.Boolean</config-property-type>
+               <config-property-value>true</config-property-value>
+            </config-property>
+
+            <config-property>
+               <description>Maximum Result Rows</description>
+               <description>Maximum Result Rows allowed</description>
+               <config-property-name>MaxResultRows</config-property-name>
+               <config-property-type>java.lang.Integer</config-property-type>
+               <config-property-value>10000</config-property-value>
+            </config-property>
+
+            <!--  JDBC Specific properties -->
+
+            <config-property>
+               <description>Use prepared statements and bind variables</description>
+               <config-property-name>UseBindVariables</config-property-name>
+               <config-property-type>java.lang.Boolean</config-property-type>
+               <config-property-value>false</config-property-value>
+            </config-property>
+
+            <config-property>
+               <description>fetch size used from the connector to its underlying source.</description>
+               <config-property-name>FetchSize</config-property-name>
+               <config-property-type>java.lang.Integer</config-property-type>
+               <config-property-value>2000</config-property-value>
+            </config-property>
+            
+            <config-property>
+               <description>Database time zone</description>
+               <description>Time zone of the database, if different than Integration Server</description>
+               <config-property-name>DatabaseTimeZone</config-property-name>
+               <config-property-type>java.lang.String</config-property-type>
+            </config-property>
+            
+            <config-property>
+               <description>Extension SQL Translation Class Name</description>
+               <config-property-name>ExtensionTranslationClassName</config-property-name>
+               <config-property-type>java.lang.String</config-property-type>
+               <config-property-value>org.teiid.connector.jdbc.translator.Translator</config-property-value>
+            </config-property>
+
+            <config-property>
+               <description>Source Connection JNDI Name</description>
+               <description>JNDI Name of the physical resource.</description>
+               <config-property-name>SourceJNDIName</config-property-name>
+               <config-property-type>java.lang.String</config-property-type>
+            </config-property>
+
+            <config-property>
+               <description>Trim string flag</description>
+               <description>Right Trim fixed character types returned as Strings</description>
+               <config-property-name>TrimStrings</config-property-name>
+               <config-property-type>java.lang.Boolean</config-property-type>
+               <config-property-value>false</config-property-value>
+            </config-property>
+                              
+            <config-property>
+               <description>Use informational comments in Source Queries</description>
+               <description>This will embed /*comment*/ style comment with session/request id in source SQL query for informational purposes</description>
+               <config-property-name>UseCommentsInSourceQuery</config-property-name>
+               <config-property-type>java.lang.Boolean</config-property-type>
+               <config-property-value>false</config-property-value>
+            </config-property>
+
+            <config-property>
+               <description>Catalog Name to import</description>
+               <config-property-name>ImportCatalog</config-property-name>
+               <config-property-type>java.lang.String</config-property-type>
+               <config-property-value></config-property-value>
+            </config-property>
+
+            <config-property>
+               <description>Schema Name to import</description>
+               <config-property-name>ImportSchemaPattern</config-property-name>
+               <config-property-type>java.lang.String</config-property-type>
+               <config-property-value></config-property-value>
+            </config-property>
+
+            <config-property>
+               <description>Table Name pattern to import</description>
+               <config-property-name>ImportTableNamePattern</config-property-name>
+               <config-property-type>java.lang.String</config-property-type>
+               <config-property-value></config-property-value>
+            </config-property>
+
+            <config-property>
+               <description>Table types to import</description>
+               <description>Provide comma separated list for more than one type</description>
+               <config-property-name>ImportTableTypes</config-property-name>
+               <config-property-type>java.lang.String</config-property-type>
+               <config-property-value></config-property-value>
+            </config-property>
+                                                
+            <config-property>
+               <description>Use full names during import</description>
+               <description>Directs the importer to drop the source schema name from the Teiid object name, so that the Teiid fully qualified name will be in the form of model_name.table_name - Note: that this may lead to objects with duplicate names</description>
+               <config-property-name>ImportUseFullSchemaName</config-property-name>
+               <config-property-type>java.lang.Boolean</config-property-type>
+               <config-property-value>true</config-property-value>
+            </config-property>
+
+            <config-property>
+               <description>Procedure name pattern to import</description>
+               <config-property-name>ImportProcedureNamePattern</config-property-name>
+               <config-property-type>java.lang.String</config-property-type>
+               <config-property-value></config-property-value>
+            </config-property>
+
+            <config-property>
+               <description>Import Procedures</description>
+               <config-property-name>ImportProcedures</config-property-name>
+               <config-property-type>java.lang.Boolean</config-property-type>
+               <config-property-value>true</config-property-value>
+            </config-property>
+            
+            <config-property>
+               <description>Import Indexes/Unique Key/Cardinality information</description>
+               <config-property-name>ImportIndexes</config-property-name>
+               <config-property-type>java.lang.Boolean</config-property-type>
+               <config-property-value>true</config-property-value>
+            </config-property>
+            
+            <config-property>
+               <description>Import Primary and Foreign keys</description>
+               <config-property-name>ImportKeys</config-property-name>
+               <config-property-type>java.lang.Boolean</config-property-type>
+               <config-property-value>true</config-property-value>
+            </config-property>      
+                                                                                                      
+            <connectionfactory-interface>org.teiid.connector.api.Connector</connectionfactory-interface>
+            <connectionfactory-impl-class>org.teiid.connector.basic.ConnectorWrapper</connectionfactory-impl-class>
+            <connection-interface>org.teiid.connector.api.Connection</connection-interface>
+            <connection-impl-class>org.teiid.connector.basic.WrappedConnection</connection-impl-class>
+
+         </connection-definition>
+         
+         <transaction-support>NoTransaction</transaction-support>
+        
+        <authentication-mechanism>
+            <authentication-mechanism-type>BasicPassword</authentication-mechanism-type>
+            <credential-interface>javax.resource.spi.security.PasswordCredential</credential-interface>
+        </authentication-mechanism>
+        <reauthentication-support>false</reauthentication-support>
+      </outbound-resourceadapter>
+   </resourceadapter>
+</connector>


Property changes on: branches/JCA/connectors/connector-jdbc/src/main/rar/META-INF/ra.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: branches/JCA/connectors/connector-jdbc/src/main/resources/org/teiid/connector/jdbc/i18n.properties
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/main/resources/org/teiid/connector/jdbc/i18n.properties	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/main/resources/org/teiid/connector/jdbc/i18n.properties	2009-11-02 19:41:28 UTC (rev 1544)
@@ -20,7 +20,7 @@
 # 02110-1301 USA.
 #
 
-JDBCSourceConnectionFactory.Missing_JDBC_driver_class_name_1=Missing JDBC driver class name
+JDBCSourceConnectionFactory.Missing_JDBC_jndi_1=Missing JDBC Source JNDI Name
 JDBCSourceConnectionFactory.Missing_JDBC_protocol_name_2=Missing JDBC protocol name
 JDBCSourceConnectionFactory.Missing_JDBC_database_name_3=Missing JDBC database name
 JDBCSourceConnectionFactory.Unable_to_load_the_JDBC_driver_class_6=Unable to load the JDBC driver class "{0}".

Copied: branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/FakeMetadataFactory.java (from rev 1491, branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/MetadataFactory.java)
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/FakeMetadataFactory.java	                        (rev 0)
+++ branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/FakeMetadataFactory.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,66 @@
+/*
+ * 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 org.teiid.connector.jdbc;
+
+import static org.junit.Assert.assertEquals;
+import junit.framework.Assert;
+
+import org.mockito.Mockito;
+import org.teiid.connector.api.ConnectorException;
+import org.teiid.connector.api.ExecutionContext;
+import org.teiid.connector.jdbc.translator.TranslatedCommand;
+import org.teiid.connector.jdbc.translator.Translator;
+import org.teiid.connector.language.ICommand;
+
+import com.metamatrix.cdk.api.TranslationUtility;
+import com.metamatrix.cdk.unittest.FakeTranslationFactory;
+
+public class FakeMetadataFactory {
+	
+    public static final String PARTS_VDB = "/PartsSupplier.vdb"; //$NON-NLS-1$
+    public static final String BQT_VDB = "/bqt.vdb"; //$NON-NLS-1$
+
+    public static ICommand helpTranslate(String vdbFileName, String sql) {
+    	TranslationUtility util = null;
+    	if (PARTS_VDB.equals(vdbFileName)) {
+    		util = new TranslationUtility(FakeMetadataFactory.class.getResource(vdbFileName));
+    	} else if (BQT_VDB.equals(vdbFileName)){
+    		util = FakeTranslationFactory.getInstance().getBQTTranslationUtility();
+    	} else {
+    		Assert.fail("unknown vdb"); //$NON-NLS-1$
+    	}
+        return util.parseCommand(sql);        
+    }
+
+	public static void helpTestVisitor(String vdb, String input, String expectedOutput, Translator translator) throws ConnectorException {
+	    // Convert from sql to objects
+	    ICommand obj = helpTranslate(vdb, input);
+	    
+	    TranslatedCommand tc = new TranslatedCommand(Mockito.mock(ExecutionContext.class), translator); //$NON-NLS-1$
+	    tc.translateCommand(obj);
+	    
+	    // Check stuff
+	    assertEquals("Did not get correct sql", expectedOutput, tc.getSql());             //$NON-NLS-1$
+	}
+
+}


Property changes on: branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/FakeMetadataFactory.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Deleted: branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/MetadataFactory.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/MetadataFactory.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/MetadataFactory.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -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 org.teiid.connector.jdbc;
-
-import static org.junit.Assert.*;
-
-import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.jdbc.translator.TranslatedCommand;
-import org.teiid.connector.jdbc.translator.Translator;
-import org.teiid.connector.language.ICommand;
-
-import junit.framework.Assert;
-
-import com.metamatrix.cdk.api.EnvironmentUtility;
-import com.metamatrix.cdk.api.TranslationUtility;
-import com.metamatrix.cdk.unittest.FakeTranslationFactory;
-
-public class MetadataFactory {
-	
-    public static final String PARTS_VDB = "/PartsSupplier.vdb"; //$NON-NLS-1$
-    public static final String BQT_VDB = "/bqt.vdb"; //$NON-NLS-1$
-
-    public static ICommand helpTranslate(String vdbFileName, String sql) {
-    	TranslationUtility util = null;
-    	if (PARTS_VDB.equals(vdbFileName)) {
-    		util = new TranslationUtility(MetadataFactory.class.getResource(vdbFileName));
-    	} else if (BQT_VDB.equals(vdbFileName)){
-    		util = FakeTranslationFactory.getInstance().getBQTTranslationUtility();
-    	} else {
-    		Assert.fail("unknown vdb"); //$NON-NLS-1$
-    	}
-        return util.parseCommand(sql);        
-    }
-
-	public static void helpTestVisitor(String vdb, String input, String expectedOutput, Translator translator) throws ConnectorException {
-	    // Convert from sql to objects
-	    ICommand obj = helpTranslate(vdb, input);
-	    
-	    TranslatedCommand tc = new TranslatedCommand(EnvironmentUtility.createSecurityContext("user"), translator); //$NON-NLS-1$
-	    tc.translateCommand(obj);
-	    
-	    // Check stuff
-	    assertEquals("Did not get correct sql", expectedOutput, tc.getSql());             //$NON-NLS-1$
-	}
-
-}

Modified: branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCProcedureExecution.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCProcedureExecution.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCProcedureExecution.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,13 +22,12 @@
 
 package org.teiid.connector.jdbc;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
 
 import java.sql.CallableStatement;
 import java.sql.Connection;
 import java.sql.Types;
 import java.util.Arrays;
-import java.util.Properties;
 
 import org.junit.Test;
 import org.mockito.Mockito;
@@ -36,40 +35,42 @@
 import org.teiid.connector.api.ExecutionContext;
 import org.teiid.connector.jdbc.translator.Translator;
 import org.teiid.connector.language.ICommand;
-import org.teiid.dqp.internal.datamgr.metadata.RuntimeMetadataImpl;
 
-import com.metamatrix.cdk.api.EnvironmentUtility;
-import com.metamatrix.query.unittest.FakeMetadataFactory;
-
 public class TestJDBCProcedureExecution {
 	
 	@Test public void testProcedureExecution() throws Exception {
-		ICommand command = MetadataFactory.helpTranslate(MetadataFactory.BQT_VDB, "exec pm2.spTest8a()"); //$NON-NLS-1$
+		ICommand command = FakeMetadataFactory.helpTranslate(FakeMetadataFactory.BQT_VDB, "exec pm2.spTest8a()"); //$NON-NLS-1$
 		Connection connection = Mockito.mock(Connection.class);
 		CallableStatement cs = Mockito.mock(CallableStatement.class);
 		Mockito.stub(cs.getUpdateCount()).toReturn(-1);
 		Mockito.stub(cs.getInt(1)).toReturn(5);
 		Mockito.stub(connection.prepareCall("{  call spTest8a(?)}")).toReturn(cs); //$NON-NLS-1$
 		Translator sqlTranslator = new Translator();
-		ExecutionContext context = EnvironmentUtility.createSecurityContext("user"); //$NON-NLS-1$
-		RuntimeMetadataImpl runtimeMetadata = new RuntimeMetadataImpl(FakeMetadataFactory.exampleBQTCached());
-		JDBCProcedureExecution procedureExecution = new JDBCProcedureExecution(command, connection, sqlTranslator, Mockito.mock(ConnectorLogger.class), new Properties(), runtimeMetadata, context, EnvironmentUtility.createEnvironment(new Properties()) );
+		
+		JDBCManagedConnectionFactory config = Mockito.mock(JDBCManagedConnectionFactory.class);
+		Mockito.stub(config.getExtensionTranslationClass()).toReturn(sqlTranslator);
+		Mockito.stub(config.getLogger()).toReturn(Mockito.mock(ConnectorLogger.class));
+		
+		JDBCProcedureExecution procedureExecution = new JDBCProcedureExecution(command, connection, Mockito.mock(ExecutionContext.class),  config);
 		procedureExecution.execute();
 		assertEquals(Arrays.asList(5), procedureExecution.getOutputParameterValues());
 		Mockito.verify(cs, Mockito.times(1)).registerOutParameter(1, Types.INTEGER);
 	}
 	
 	@Test public void testProcedureExecution1() throws Exception {
-		ICommand command = MetadataFactory.helpTranslate(MetadataFactory.BQT_VDB, "exec pm2.spTest8(1)"); //$NON-NLS-1$
+		ICommand command = FakeMetadataFactory.helpTranslate(FakeMetadataFactory.BQT_VDB, "exec pm2.spTest8(1)"); //$NON-NLS-1$
 		Connection connection = Mockito.mock(Connection.class);
 		CallableStatement cs = Mockito.mock(CallableStatement.class);
 		Mockito.stub(cs.getUpdateCount()).toReturn(-1);
 		Mockito.stub(cs.getInt(2)).toReturn(5);
 		Mockito.stub(connection.prepareCall("{  call spTest8(?,?)}")).toReturn(cs); //$NON-NLS-1$
 		Translator sqlTranslator = new Translator();
-		ExecutionContext context = EnvironmentUtility.createSecurityContext("user"); //$NON-NLS-1$
-		RuntimeMetadataImpl runtimeMetadata = new RuntimeMetadataImpl(FakeMetadataFactory.exampleBQTCached());
-		JDBCProcedureExecution procedureExecution = new JDBCProcedureExecution(command, connection, sqlTranslator, Mockito.mock(ConnectorLogger.class), new Properties(), runtimeMetadata, context, EnvironmentUtility.createEnvironment(new Properties()) );
+
+		JDBCManagedConnectionFactory config = Mockito.mock(JDBCManagedConnectionFactory.class);
+		Mockito.stub(config.getExtensionTranslationClass()).toReturn(sqlTranslator);
+		Mockito.stub(config.getLogger()).toReturn(Mockito.mock(ConnectorLogger.class));
+		
+		JDBCProcedureExecution procedureExecution = new JDBCProcedureExecution(command, connection, Mockito.mock(ExecutionContext.class), config );
 		procedureExecution.execute();
 		assertEquals(Arrays.asList(5), procedureExecution.getOutputParameterValues());
 		Mockito.verify(cs, Mockito.times(1)).registerOutParameter(2, Types.INTEGER);

Deleted: branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCSourceConnection.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCSourceConnection.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCSourceConnection.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,118 +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 org.teiid.connector.jdbc;
-
-import java.sql.Connection;
-import java.util.Properties;
-
-import org.teiid.connector.api.ConnectorEnvironment;
-import org.teiid.connector.basic.BasicConnectorCapabilities;
-import org.teiid.connector.jdbc.JDBCPropertyNames;
-import org.teiid.connector.jdbc.JDBCSourceConnection;
-import org.teiid.connector.jdbc.translator.Translator;
-
-import junit.framework.TestCase;
-
-import com.metamatrix.cdk.api.EnvironmentUtility;
-import com.metamatrix.core.util.SimpleMock;
-
-
-/** 
- * Test case for JDBCSourceConnection
- * @since 4.3
- */
-public class TestJDBCSourceConnection extends TestCase {
-    
-    private FakeConnection fakeConnection;
-    private Connection connection;
-    private ConnectorEnvironment environment;
-    
-    
-    public TestJDBCSourceConnection(String name) {
-        super(name);
-    }
-    
-    public void setUp() throws Exception {
-        fakeConnection = new FakeConnection();
-        connection = SimpleMock.createSimpleMock(fakeConnection, Connection.class);
-
-        final Properties properties = new Properties();
-        properties.setProperty(JDBCPropertyNames.EXT_CAPABILITY_CLASS, BasicConnectorCapabilities.class.getName());  
-        
-        environment = EnvironmentUtility.createEnvironment(properties, false); 
-    }
-    
-
-    /**
-     * Tests JDBCSourceConnection.isConnectionAlive() with a ConnectionQueryStrategy
-     * @since 4.3
-     */
-    public void testIsAlive() throws Exception {
-        JDBCSourceConnection sourceConnection = new JDBCSourceConnection(connection, environment, new Translator() {
-        	@Override
-        	public String getConnectionTestQuery() {
-        		return "select 1";
-        	}
-        }); 
-        
-        //closed connections should not be 'alive'        
-        fakeConnection.closed = true;
-        assertFalse(sourceConnection.isAlive());        
-        
-        //open connections should be 'alive'
-        fakeConnection.closed = false;
-        assertTrue(sourceConnection.isAlive());
-        
-        //failed connections should not be 'alive'
-        fakeConnection.fail = true;
-        assertFalse(sourceConnection.isAlive());
-        
-    }
-    
-    /**
-     * Tests JDBCSourceConnection.isConnectionAlive() with a null ConnectionStrategy
-     * @since 4.3
-     */
-    public void testIsAliveNullStrategy() throws Exception {
-        JDBCSourceConnection sourceConnection = new JDBCSourceConnection(connection, environment, new Translator() {
-        	@Override
-        	public String getConnectionTestQuery() {
-        		return null;
-        	}
-        }); 
-        
-        //closed connections should not be 'alive'        
-        fakeConnection.closed = true;
-        assertFalse(sourceConnection.isAlive());        
-        
-        //open connections should be 'alive'
-        fakeConnection.closed = false;
-        assertTrue(sourceConnection.isAlive());
-        
-        //without a strategy, failed connections are detected as 'alive'
-        fakeConnection.fail = true;
-        assertTrue(sourceConnection.isAlive());
-        
-    }
-    
-}

Modified: branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCUpdateExecution.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCUpdateExecution.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCUpdateExecution.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -25,7 +25,6 @@
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.util.Arrays;
-import java.util.Properties;
 
 import org.junit.Test;
 import org.mockito.Mockito;
@@ -37,12 +36,10 @@
 import org.teiid.connector.language.IInsertExpressionValueSource;
 import org.teiid.connector.language.ILiteral;
 
-import com.metamatrix.cdk.api.EnvironmentUtility;
-
 public class TestJDBCUpdateExecution {
 
 	@Test public void testBulkUpdate() throws Exception {
-		ICommand command = MetadataFactory.helpTranslate(MetadataFactory.BQT_VDB, "insert into bqt1.smalla (intkey, intnum) values (1, 2)"); //$NON-NLS-1$
+		ICommand command = FakeMetadataFactory.helpTranslate(FakeMetadataFactory.BQT_VDB, "insert into bqt1.smalla (intkey, intnum) values (1, 2)"); //$NON-NLS-1$
 		ILiteral value = ((ILiteral)((IInsertExpressionValueSource)((IInsert)command).getValueSource()).getValues().get(0));
 		ILiteral value1 = ((ILiteral)((IInsertExpressionValueSource)((IInsert)command).getValueSource()).getValues().get(1));
 		value.setMultiValued(true);
@@ -55,9 +52,12 @@
 		PreparedStatement p = Mockito.mock(PreparedStatement.class);
 		Mockito.stub(p.executeBatch()).toReturn(new int [] {1, 1});
 		Mockito.stub(connection.prepareStatement("INSERT INTO SmallA (IntKey, IntNum) VALUES (?, ?)")).toReturn(p); //$NON-NLS-1$
-		Translator sqlTranslator = new Translator();
-		ExecutionContext context = EnvironmentUtility.createSecurityContext("user"); //$NON-NLS-1$
-		JDBCUpdateExecution updateExecution = new JDBCUpdateExecution(command, connection, sqlTranslator, Mockito.mock(ConnectorLogger.class), new Properties(), context);
+		
+		JDBCManagedConnectionFactory config = Mockito.mock(JDBCManagedConnectionFactory.class);
+		Mockito.stub(config.getExtensionTranslationClass()).toReturn(new Translator());
+		Mockito.stub(config.getLogger()).toReturn(Mockito.mock(ConnectorLogger.class));
+		
+		JDBCUpdateExecution updateExecution = new JDBCUpdateExecution(command, connection, Mockito.mock(ExecutionContext.class), config);
 		updateExecution.execute();
 		Mockito.verify(p, Mockito.times(2)).addBatch();
 	}

Modified: branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/access/TestAccessSQLTranslator.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/access/TestAccessSQLTranslator.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/access/TestAccessSQLTranslator.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,16 +22,16 @@
 
 package org.teiid.connector.jdbc.access;
 
-import java.util.Properties;
+import junit.framework.TestCase;
 
+import org.mockito.Mockito;
 import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.jdbc.access.AccessSQLTranslator;
+import org.teiid.connector.api.ExecutionContext;
+import org.teiid.connector.jdbc.JDBCManagedConnectionFactory;
 import org.teiid.connector.jdbc.translator.TranslatedCommand;
 import org.teiid.connector.jdbc.translator.Translator;
 import org.teiid.connector.language.ICommand;
 
-import junit.framework.TestCase;
-
 import com.metamatrix.cdk.api.EnvironmentUtility;
 import com.metamatrix.cdk.unittest.FakeTranslationFactory;
 
@@ -46,7 +46,7 @@
     static {
         try {
             TRANSLATOR = new AccessSQLTranslator();        
-            TRANSLATOR.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
+            TRANSLATOR.initialize( Mockito.mock(JDBCManagedConnectionFactory.class));
         } catch(ConnectorException e) {
             e.printStackTrace();    
         }
@@ -56,7 +56,7 @@
         // Convert from sql to objects
         ICommand obj = FakeTranslationFactory.getInstance().getBQTTranslationUtility().parseCommand(input);
         
-        TranslatedCommand tc = new TranslatedCommand(EnvironmentUtility.createSecurityContext("user"), TRANSLATOR);
+        TranslatedCommand tc = new TranslatedCommand(Mockito.mock(ExecutionContext.class), TRANSLATOR);
         tc.translateCommand(obj);
         
         

Modified: branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/db2/TestDB2ConvertModifier.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/db2/TestDB2ConvertModifier.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/db2/TestDB2ConvertModifier.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -26,25 +26,24 @@
 import java.math.BigInteger;
 import java.sql.Timestamp;
 import java.util.Arrays;
-import java.util.Properties;
 
 import junit.framework.TestCase;
 
 import org.teiid.connector.api.TypeFacility;
+import org.teiid.connector.jdbc.JDBCManagedConnectionFactory;
 import org.teiid.connector.jdbc.translator.SQLConversionVisitor;
 import org.teiid.connector.language.IExpression;
 import org.teiid.connector.language.IFunction;
 import org.teiid.connector.language.ILanguageFactory;
+import org.teiid.connector.language.impl.LanguageFactoryImpl;
 
-import com.metamatrix.cdk.CommandBuilder;
-import com.metamatrix.cdk.api.EnvironmentUtility;
 import com.metamatrix.query.unittest.TimestampUtil;
 
 /**
  */
 public class TestDB2ConvertModifier extends TestCase {
 
-    private static final ILanguageFactory LANG_FACTORY = CommandBuilder.getLanuageFactory();
+    private static final ILanguageFactory LANG_FACTORY = new LanguageFactoryImpl();
 
     /**
      * Constructor for TestSybaseConvertModifier.
@@ -56,7 +55,7 @@
 
     public String helpGetString(IExpression expr) throws Exception {
         DB2SQLTranslator trans = new DB2SQLTranslator();
-        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
+        trans.initialize(new JDBCManagedConnectionFactory());
         SQLConversionVisitor sqlVisitor = trans.getSQLConversionVisitor(); 
         sqlVisitor.append(expr);  
         

Modified: branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/db2/TestDB2SqlTranslator.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/db2/TestDB2SqlTranslator.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/db2/TestDB2SqlTranslator.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -24,17 +24,16 @@
 
 import static org.junit.Assert.assertEquals;
 
-import java.util.Properties;
-
 import org.junit.BeforeClass;
 import org.junit.Test;
+import org.mockito.Mockito;
 import org.teiid.connector.api.ConnectorException;
 import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.jdbc.MetadataFactory;
+import org.teiid.connector.jdbc.FakeMetadataFactory;
+import org.teiid.connector.jdbc.JDBCManagedConnectionFactory;
 import org.teiid.connector.jdbc.translator.TranslatedCommand;
 import org.teiid.connector.language.ICommand;
 
-import com.metamatrix.cdk.api.EnvironmentUtility;
 import com.metamatrix.cdk.api.TranslationUtility;
 import com.metamatrix.cdk.unittest.FakeTranslationFactory;
 import com.metamatrix.core.util.UnitTestUtil;
@@ -48,7 +47,7 @@
     @BeforeClass
     public static void setUp() throws ConnectorException {
         TRANSLATOR = new DB2SQLTranslator();        
-        TRANSLATOR.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
+        TRANSLATOR.initialize(new JDBCManagedConnectionFactory());
     }
     
     public String getTestVDB() {
@@ -59,9 +58,7 @@
         // Convert from sql to objects
         ICommand obj = util.parseCommand(input);
         
-        ExecutionContext context = EnvironmentUtility.createSecurityContext("user"); //$NON-NLS-1$
-                
-        TranslatedCommand tc = new TranslatedCommand(context, TRANSLATOR);
+        TranslatedCommand tc = new TranslatedCommand(Mockito.mock(ExecutionContext.class), TRANSLATOR);
         tc.translateCommand(obj);
         
         assertEquals("Did not get correct sql", expectedOutput, tc.getSql());             //$NON-NLS-1$
@@ -130,7 +127,7 @@
         String input = "SELECT locate(INTNUM, 'chimp', 1) FROM BQT1.SMALLA"; //$NON-NLS-1$
         String output = "SELECT LOCATE(char(SmallA.IntNum), 'chimp', 1) FROM SmallA";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -147,7 +144,7 @@
         String input = "SELECT locate(STRINGNUM, 'chimp') FROM BQT1.SMALLA"; //$NON-NLS-1$
         String output = "SELECT LOCATE(SmallA.StringNum, 'chimp') FROM SmallA";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -164,7 +161,7 @@
         String input = "SELECT locate(INTNUM, '234567890', 1) FROM BQT1.SMALLA WHERE INTKEY = 26"; //$NON-NLS-1$
         String output = "SELECT LOCATE(char(SmallA.IntNum), '234567890', 1) FROM SmallA WHERE SmallA.IntKey = 26";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -181,7 +178,7 @@
         String input = "SELECT locate('c', 'chimp', 1) FROM BQT1.SMALLA"; //$NON-NLS-1$
         String output = "SELECT 1 FROM SmallA";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -198,7 +195,7 @@
         String input = "SELECT locate(STRINGNUM, 'chimp', -5) FROM BQT1.SMALLA"; //$NON-NLS-1$
         String output = "SELECT LOCATE(SmallA.StringNum, 'chimp', 1) FROM SmallA";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -215,7 +212,7 @@
         String input = "SELECT locate(STRINGNUM, 'chimp', INTNUM) FROM BQT1.SMALLA"; //$NON-NLS-1$
         String output = "SELECT LOCATE(SmallA.StringNum, 'chimp', CASE WHEN SmallA.IntNum < 1 THEN 1 ELSE SmallA.IntNum END) FROM SmallA";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -232,7 +229,7 @@
         String input = "SELECT locate(STRINGNUM, 'chimp', LOCATE(STRINGNUM, 'chimp') + 1) FROM BQT1.SMALLA"; //$NON-NLS-1$
         String output = "SELECT LOCATE(SmallA.StringNum, 'chimp', CASE WHEN (LOCATE(SmallA.StringNum, 'chimp') + 1) < 1 THEN 1 ELSE (LOCATE(SmallA.StringNum, 'chimp') + 1) END) FROM SmallA";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }

Modified: branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/derby/TestDerbySQLTranslator.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/derby/TestDerbySQLTranslator.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/derby/TestDerbySQLTranslator.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -24,17 +24,15 @@
 
 import static org.junit.Assert.assertEquals;
 
-import java.util.Properties;
-
 import org.junit.BeforeClass;
 import org.junit.Test;
+import org.mockito.Mockito;
 import org.teiid.connector.api.ConnectorException;
 import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.jdbc.MetadataFactory;
+import org.teiid.connector.jdbc.JDBCManagedConnectionFactory;
 import org.teiid.connector.jdbc.translator.TranslatedCommand;
 import org.teiid.connector.language.ICommand;
 
-import com.metamatrix.cdk.api.EnvironmentUtility;
 import com.metamatrix.cdk.api.TranslationUtility;
 import com.metamatrix.cdk.unittest.FakeTranslationFactory;
 import com.metamatrix.core.util.UnitTestUtil;
@@ -48,7 +46,7 @@
     @BeforeClass
     public static void setUp() throws ConnectorException {
         TRANSLATOR = new DerbySQLTranslator();        
-        TRANSLATOR.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
+        TRANSLATOR.initialize(new JDBCManagedConnectionFactory());
     }
     
     public String getTestVDB() {
@@ -59,9 +57,8 @@
         // Convert from sql to objects
         ICommand obj = util.parseCommand(input);
         
-        ExecutionContext context = EnvironmentUtility.createSecurityContext("user"); //$NON-NLS-1$
                 
-        TranslatedCommand tc = new TranslatedCommand(context, TRANSLATOR);
+        TranslatedCommand tc = new TranslatedCommand(Mockito.mock(ExecutionContext.class), TRANSLATOR);
         tc.translateCommand(obj);
         
         assertEquals("Did not get correct sql", expectedOutput, tc.getSql());             //$NON-NLS-1$

Modified: branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/extension/impl/TestEscapeSyntaxModifier.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/extension/impl/TestEscapeSyntaxModifier.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/extension/impl/TestEscapeSyntaxModifier.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -26,20 +26,23 @@
 import java.util.Arrays;
 import java.util.List;
 
+import junit.framework.TestCase;
+
 import org.teiid.connector.jdbc.translator.EscapeSyntaxModifier;
 import org.teiid.connector.language.IFunction;
+import org.teiid.connector.language.ILanguageFactory;
 import org.teiid.connector.language.ILiteral;
+import org.teiid.connector.language.impl.LanguageFactoryImpl;
 import org.teiid.connector.visitor.util.SQLReservedWords;
 
-import junit.framework.TestCase;
-
-import com.metamatrix.cdk.CommandBuilder;
 import com.metamatrix.query.unittest.TimestampUtil;
 
 /**
  */
 public class TestEscapeSyntaxModifier extends TestCase {
 
+	private static final ILanguageFactory LANG_FACTORY = new LanguageFactoryImpl();
+	
     /**
      * Constructor for TestDropFunctionModifier.
      * @param name
@@ -49,18 +52,18 @@
     }
 
     public void testEscape() {
-        ILiteral arg1 = CommandBuilder.getLanuageFactory().createLiteral("arg1", String.class); //$NON-NLS-1$
-        ILiteral arg2 = CommandBuilder.getLanuageFactory().createLiteral("arg2", String.class);//$NON-NLS-1$
-        IFunction func = CommandBuilder.getLanuageFactory().createFunction("concat", Arrays.asList( arg1, arg2), Integer.class); //$NON-NLS-1$
+        ILiteral arg1 = LANG_FACTORY.createLiteral("arg1", String.class); //$NON-NLS-1$
+        ILiteral arg2 = LANG_FACTORY.createLiteral("arg2", String.class);//$NON-NLS-1$
+        IFunction func = LANG_FACTORY.createFunction("concat", Arrays.asList( arg1, arg2), Integer.class); //$NON-NLS-1$
                 
         helpTest(func, "{fn concat('arg1', 'arg2')}");
     }
     
     public void testTimestampAdd() {
-        ILiteral arg1 = CommandBuilder.getLanuageFactory().createLiteral(SQLReservedWords.SQL_TSI_HOUR, String.class); //$NON-NLS-1$
-        ILiteral arg2 = CommandBuilder.getLanuageFactory().createLiteral(Integer.valueOf(1), Integer.class);//$NON-NLS-1$
-        ILiteral arg3 = CommandBuilder.getLanuageFactory().createLiteral(TimestampUtil.createTimestamp(0, 0, 0, 0, 0, 0, 0), Timestamp.class);//$NON-NLS-1$
-        IFunction func = CommandBuilder.getLanuageFactory().createFunction("timestampadd", Arrays.asList( arg1, arg2, arg3), Timestamp.class); //$NON-NLS-1$
+        ILiteral arg1 = LANG_FACTORY.createLiteral(SQLReservedWords.SQL_TSI_HOUR, String.class); //$NON-NLS-1$
+        ILiteral arg2 = LANG_FACTORY.createLiteral(Integer.valueOf(1), Integer.class);//$NON-NLS-1$
+        ILiteral arg3 = LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(0, 0, 0, 0, 0, 0, 0), Timestamp.class);//$NON-NLS-1$
+        IFunction func = LANG_FACTORY.createFunction("timestampadd", Arrays.asList( arg1, arg2, arg3), Timestamp.class); //$NON-NLS-1$
                 
         helpTest(func, "{fn timestampadd(SQL_TSI_HOUR, 1, {ts'1899-12-31 00:00:00.0'})}");
     }

Modified: branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/mysql/TestMySQLTranslator.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/mysql/TestMySQLTranslator.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/mysql/TestMySQLTranslator.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,14 +22,11 @@
 
 package org.teiid.connector.jdbc.mysql;
 
-import java.util.Properties;
-
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.jdbc.MetadataFactory;
-
-import com.metamatrix.cdk.api.EnvironmentUtility;
+import org.teiid.connector.jdbc.FakeMetadataFactory;
+import org.teiid.connector.jdbc.JDBCManagedConnectionFactory;
 
 /**
  */
@@ -39,22 +36,22 @@
     
     @BeforeClass public static void oneTimeSetup() throws ConnectorException {
         TRANSLATOR = new MySQLTranslator();        
-        TRANSLATOR.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
+        TRANSLATOR.initialize(new JDBCManagedConnectionFactory());
     }
 
     private String getTestVDB() {
-        return MetadataFactory.PARTS_VDB;
+        return FakeMetadataFactory.PARTS_VDB;
     }
     
     private String getTestBQTVDB() {
-        return MetadataFactory.BQT_VDB; 
+        return FakeMetadataFactory.BQT_VDB; 
     }
     
     @Test public void testConversion1() throws Exception {
         String input = "SELECT char(convert(PART_WEIGHT, integer) + 100) FROM PARTS"; //$NON-NLS-1$
         String output = "SELECT char((cast(PARTS.PART_WEIGHT AS signed) + 100)) FROM PARTS";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(getTestVDB(),
+        FakeMetadataFactory.helpTestVisitor(getTestVDB(),
             input, 
             output, TRANSLATOR);
     }
@@ -63,7 +60,7 @@
         String input = "SELECT convert(PART_WEIGHT, long) FROM PARTS"; //$NON-NLS-1$
         String output = "SELECT cast(PARTS.PART_WEIGHT AS signed) FROM PARTS";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(getTestVDB(),
+        FakeMetadataFactory.helpTestVisitor(getTestVDB(),
             input, 
             output, TRANSLATOR);
     }
@@ -72,7 +69,7 @@
         String input = "SELECT convert(convert(PART_WEIGHT, long), string) FROM PARTS"; //$NON-NLS-1$
         String output = "SELECT cast(cast(PARTS.PART_WEIGHT AS signed) AS char) FROM PARTS";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(getTestVDB(),
+        FakeMetadataFactory.helpTestVisitor(getTestVDB(),
             input, 
             output, TRANSLATOR);
     }
@@ -81,7 +78,7 @@
         String input = "SELECT convert(convert(PART_WEIGHT, date), string) FROM PARTS"; //$NON-NLS-1$
         String output = "SELECT date_format(DATE(PARTS.PART_WEIGHT), '%Y-%m-%d') FROM PARTS";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(getTestVDB(),
+        FakeMetadataFactory.helpTestVisitor(getTestVDB(),
             input, 
             output, TRANSLATOR);
     }
@@ -89,7 +86,7 @@
         String input = "SELECT convert(convert(PART_WEIGHT, time), string) FROM PARTS"; //$NON-NLS-1$
         String output = "SELECT date_format(TIME(PARTS.PART_WEIGHT), '%H:%i:%S') FROM PARTS";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(getTestVDB(),
+        FakeMetadataFactory.helpTestVisitor(getTestVDB(),
             input, 
             output, TRANSLATOR);
     }
@@ -97,7 +94,7 @@
         String input = "SELECT convert(convert(PART_WEIGHT, timestamp), string) FROM PARTS"; //$NON-NLS-1$
         String output = "SELECT date_format(TIMESTAMP(PARTS.PART_WEIGHT), '%Y-%m-%d %H:%i:%S.%f') FROM PARTS";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(getTestVDB(),
+        FakeMetadataFactory.helpTestVisitor(getTestVDB(),
             input, 
             output, TRANSLATOR);
     }
@@ -105,7 +102,7 @@
         String input = "SELECT ifnull(PART_WEIGHT, 'otherString') FROM PARTS"; //$NON-NLS-1$
         String output = "SELECT ifnull(PARTS.PART_WEIGHT, 'otherString') FROM PARTS";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(getTestVDB(),
+        FakeMetadataFactory.helpTestVisitor(getTestVDB(),
             input, 
             output, TRANSLATOR);
     }
@@ -113,7 +110,7 @@
         String input = "SELECT convert(convert(PART_WEIGHT, integer), string) FROM PARTS"; //$NON-NLS-1$
         String output = "SELECT cast(cast(PARTS.PART_WEIGHT AS signed) AS char) FROM PARTS";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(getTestVDB(),
+        FakeMetadataFactory.helpTestVisitor(getTestVDB(),
             input, 
             output, TRANSLATOR);
     }
@@ -121,7 +118,7 @@
         String input = "SELECT insert(PART_WEIGHT, 1, 5, 'chimp') FROM PARTS"; //$NON-NLS-1$
         String output = "SELECT insert(PARTS.PART_WEIGHT, 1, 5, 'chimp') FROM PARTS";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(getTestVDB(),
+        FakeMetadataFactory.helpTestVisitor(getTestVDB(),
             input, 
             output, TRANSLATOR);
     }
@@ -138,7 +135,7 @@
         String input = "SELECT locate(INTNUM, 'chimp', 1) FROM BQT1.SMALLA"; //$NON-NLS-1$
         String output = "SELECT LOCATE(cast(SmallA.IntNum AS char), 'chimp', 1) FROM SmallA";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -155,7 +152,7 @@
         String input = "SELECT locate(STRINGNUM, 'chimp') FROM BQT1.SMALLA"; //$NON-NLS-1$
         String output = "SELECT LOCATE(SmallA.StringNum, 'chimp') FROM SmallA";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -172,7 +169,7 @@
         String input = "SELECT locate(INTNUM, '234567890', 1) FROM BQT1.SMALLA WHERE INTKEY = 26"; //$NON-NLS-1$
         String output = "SELECT LOCATE(cast(SmallA.IntNum AS char), '234567890', 1) FROM SmallA WHERE SmallA.IntKey = 26";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -189,7 +186,7 @@
         String input = "SELECT locate('c', 'chimp', 1) FROM BQT1.SMALLA"; //$NON-NLS-1$
         String output = "SELECT 1 FROM SmallA";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -206,7 +203,7 @@
         String input = "SELECT locate(STRINGNUM, 'chimp', -5) FROM BQT1.SMALLA"; //$NON-NLS-1$
         String output = "SELECT LOCATE(SmallA.StringNum, 'chimp', 1) FROM SmallA";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -223,7 +220,7 @@
         String input = "SELECT locate(STRINGNUM, 'chimp', INTNUM) FROM BQT1.SMALLA"; //$NON-NLS-1$
         String output = "SELECT LOCATE(SmallA.StringNum, 'chimp', CASE WHEN SmallA.IntNum < 1 THEN 1 ELSE SmallA.IntNum END) FROM SmallA";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -240,7 +237,7 @@
         String input = "SELECT locate(STRINGNUM, 'chimp', LOCATE(STRINGNUM, 'chimp') + 1) FROM BQT1.SMALLA"; //$NON-NLS-1$
         String output = "SELECT LOCATE(SmallA.StringNum, 'chimp', CASE WHEN (LOCATE(SmallA.StringNum, 'chimp') + 1) < 1 THEN 1 ELSE (LOCATE(SmallA.StringNum, 'chimp') + 1) END) FROM SmallA";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -249,7 +246,7 @@
         String input = "SELECT substring(PART_WEIGHT, 1) FROM PARTS"; //$NON-NLS-1$
         String output = "SELECT substring(PARTS.PART_WEIGHT, 1) FROM PARTS";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(getTestVDB(),
+        FakeMetadataFactory.helpTestVisitor(getTestVDB(),
             input, 
             output, TRANSLATOR);
     }
@@ -257,7 +254,7 @@
         String input = "SELECT substring(PART_WEIGHT, 1, 5) FROM PARTS"; //$NON-NLS-1$
         String output = "SELECT substring(PARTS.PART_WEIGHT, 1, 5) FROM PARTS";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(getTestVDB(),
+        FakeMetadataFactory.helpTestVisitor(getTestVDB(),
             input, 
             output, TRANSLATOR);
     }
@@ -265,7 +262,7 @@
         String input = "SELECT PART_ID FROM PARTS UNION SELECT PART_ID FROM PARTS ORDER BY PART_ID"; //$NON-NLS-1$
         String output = "(SELECT PARTS.PART_ID FROM PARTS) UNION (SELECT PARTS.PART_ID FROM PARTS) ORDER BY PART_ID";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(getTestVDB(),
+        FakeMetadataFactory.helpTestVisitor(getTestVDB(),
             input, 
             output, TRANSLATOR);
     }
@@ -274,7 +271,7 @@
         String input = "select intkey from bqt1.smalla limit 100"; //$NON-NLS-1$
         String output = "SELECT SmallA.IntKey FROM SmallA LIMIT 100"; //$NON-NLS-1$
                
-        MetadataFactory.helpTestVisitor(getTestBQTVDB(),
+        FakeMetadataFactory.helpTestVisitor(getTestBQTVDB(),
             input, 
             output, TRANSLATOR);        
     }
@@ -283,7 +280,7 @@
         String input = "select intkey from bqt1.smalla limit 50, 100"; //$NON-NLS-1$
         String output = "SELECT SmallA.IntKey FROM SmallA LIMIT 50, 100"; //$NON-NLS-1$
                
-        MetadataFactory.helpTestVisitor(getTestBQTVDB(),
+        FakeMetadataFactory.helpTestVisitor(getTestBQTVDB(),
             input, 
             output, TRANSLATOR);        
     }
@@ -292,7 +289,7 @@
         String input = "select bitand(intkey, intnum) from bqt1.smalla"; //$NON-NLS-1$
         String output = "SELECT cast((SmallA.IntKey & SmallA.IntNum) AS signed) FROM SmallA"; //$NON-NLS-1$
                
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
             input, 
             output, TRANSLATOR);        
     }
@@ -301,7 +298,7 @@
         String input = "select smalla.intkey from bqt1.smalla inner join bqt1.smallb on smalla.stringkey=smallb.stringkey cross join bqt1.mediuma"; //$NON-NLS-1$
         String output = "SELECT SmallA.IntKey FROM (SmallA INNER JOIN SmallB ON SmallA.StringKey = SmallB.StringKey) CROSS JOIN MediumA"; //$NON-NLS-1$
           
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
             input, 
             output, TRANSLATOR);        
     }
@@ -310,7 +307,7 @@
         String input = "select smalla.intkey from bqt1.smalla where smalla.timestampvalue = '2009-08-06 12:23:34.999'"; //$NON-NLS-1$
         String output = "SELECT SmallA.IntKey FROM SmallA WHERE SmallA.TimestampValue = {ts '2009-08-06 12:23:34.0'}"; //$NON-NLS-1$
           
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
             input, 
             output, TRANSLATOR);        
     }

Modified: branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestDayWeekQuarterFunctionModifier.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestDayWeekQuarterFunctionModifier.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestDayWeekQuarterFunctionModifier.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -24,25 +24,24 @@
 
 import java.sql.Timestamp;
 import java.util.Arrays;
-import java.util.Properties;
 
 import junit.framework.TestCase;
 
 import org.teiid.connector.api.SourceSystemFunctions;
+import org.teiid.connector.jdbc.JDBCManagedConnectionFactory;
 import org.teiid.connector.jdbc.translator.SQLConversionVisitor;
 import org.teiid.connector.language.IFunction;
 import org.teiid.connector.language.ILanguageFactory;
 import org.teiid.connector.language.ILiteral;
+import org.teiid.connector.language.impl.LanguageFactoryImpl;
 
-import com.metamatrix.cdk.CommandBuilder;
-import com.metamatrix.cdk.api.EnvironmentUtility;
 import com.metamatrix.query.unittest.TimestampUtil;
 
 /**
  */
 public class TestDayWeekQuarterFunctionModifier extends TestCase {
 
-    private static final ILanguageFactory LANG_FACTORY = CommandBuilder.getLanuageFactory();
+    private static final ILanguageFactory LANG_FACTORY = new LanguageFactoryImpl();
 
     /**
      * Constructor for TestHourFunctionModifier.
@@ -58,7 +57,7 @@
             String.class);
         
         OracleSQLTranslator trans = new OracleSQLTranslator();
-        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
+        trans.initialize(new JDBCManagedConnectionFactory());
         
         SQLConversionVisitor sqlVisitor = trans.getSQLConversionVisitor(); 
         sqlVisitor.append(func);  

Modified: branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestLeftOrRightFunctionModifier.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestLeftOrRightFunctionModifier.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestLeftOrRightFunctionModifier.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -23,23 +23,21 @@
 package org.teiid.connector.jdbc.oracle;
 
 import java.util.Arrays;
-import java.util.Properties;
 
 import junit.framework.TestCase;
 
+import org.teiid.connector.jdbc.JDBCManagedConnectionFactory;
 import org.teiid.connector.jdbc.translator.SQLConversionVisitor;
 import org.teiid.connector.language.IFunction;
 import org.teiid.connector.language.ILanguageFactory;
 import org.teiid.connector.language.ILiteral;
+import org.teiid.connector.language.impl.LanguageFactoryImpl;
 
-import com.metamatrix.cdk.CommandBuilder;
-import com.metamatrix.cdk.api.EnvironmentUtility;
-
 /**
  */
 public class TestLeftOrRightFunctionModifier extends TestCase {
 
-    private static final ILanguageFactory LANG_FACTORY = CommandBuilder.getLanuageFactory();
+    private static final ILanguageFactory LANG_FACTORY = new LanguageFactoryImpl();
 
     /**
      * Constructor for TestHourFunctionModifier.
@@ -55,7 +53,7 @@
             String.class);
         
         OracleSQLTranslator trans = new OracleSQLTranslator();
-        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
+        trans.initialize(new JDBCManagedConnectionFactory());
         
         SQLConversionVisitor sqlVisitor = trans.getSQLConversionVisitor(); 
         sqlVisitor.append(func);  

Modified: branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestLog10FunctionModifier.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestLog10FunctionModifier.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestLog10FunctionModifier.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -25,20 +25,20 @@
 import java.util.Arrays;
 import java.util.List;
 
-import org.teiid.connector.jdbc.oracle.Log10FunctionModifier;
+import junit.framework.TestCase;
+
 import org.teiid.connector.language.IExpression;
 import org.teiid.connector.language.IFunction;
+import org.teiid.connector.language.ILanguageFactory;
 import org.teiid.connector.language.ILiteral;
+import org.teiid.connector.language.impl.LanguageFactoryImpl;
 import org.teiid.connector.visitor.util.SQLStringVisitor;
 
-import junit.framework.TestCase;
-
-import com.metamatrix.cdk.CommandBuilder;
-
 /**
  */
 public class TestLog10FunctionModifier extends TestCase {
-
+	private static final ILanguageFactory LANG_FACTORY = new LanguageFactoryImpl();
+	
     /**
      * Constructor for TestLog10FunctionModifier.
      * @param name
@@ -48,10 +48,10 @@
     }
 
     public void testModifier() {
-        ILiteral arg = CommandBuilder.getLanuageFactory().createLiteral(new Double(5.2), Double.class);
-        IFunction func = CommandBuilder.getLanuageFactory().createFunction("log10", Arrays.asList(arg), Double.class); //$NON-NLS-1$
+        ILiteral arg = LANG_FACTORY.createLiteral(new Double(5.2), Double.class);
+        IFunction func = LANG_FACTORY.createFunction("log10", Arrays.asList(arg), Double.class); //$NON-NLS-1$
         
-        Log10FunctionModifier modifier = new Log10FunctionModifier(CommandBuilder.getLanuageFactory());
+        Log10FunctionModifier modifier = new Log10FunctionModifier(LANG_FACTORY);
         modifier.translate(func);
         
         assertEquals("log", func.getName()); //$NON-NLS-1$

Modified: branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestMonthOrDayNameFunctionModifier.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestMonthOrDayNameFunctionModifier.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestMonthOrDayNameFunctionModifier.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -24,24 +24,23 @@
 
 import java.sql.Timestamp;
 import java.util.Arrays;
-import java.util.Properties;
 
 import junit.framework.TestCase;
 
+import org.teiid.connector.jdbc.JDBCManagedConnectionFactory;
 import org.teiid.connector.jdbc.translator.SQLConversionVisitor;
 import org.teiid.connector.language.IFunction;
 import org.teiid.connector.language.ILanguageFactory;
 import org.teiid.connector.language.ILiteral;
+import org.teiid.connector.language.impl.LanguageFactoryImpl;
 
-import com.metamatrix.cdk.CommandBuilder;
-import com.metamatrix.cdk.api.EnvironmentUtility;
 import com.metamatrix.query.unittest.TimestampUtil;
 
 /**
  */
 public class TestMonthOrDayNameFunctionModifier extends TestCase {
 
-    private static final ILanguageFactory LANG_FACTORY = CommandBuilder.getLanuageFactory();
+    private static final ILanguageFactory LANG_FACTORY = new LanguageFactoryImpl();
 
     /**
      * Constructor for TestHourFunctionModifier.
@@ -57,7 +56,7 @@
             String.class);
         
         OracleSQLTranslator trans = new OracleSQLTranslator();
-        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
+        trans.initialize(new JDBCManagedConnectionFactory());
         
         SQLConversionVisitor sqlVisitor = trans.getSQLConversionVisitor(); 
         sqlVisitor.append(func);  

Modified: branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestOracleConvertModifier.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestOracleConvertModifier.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestOracleConvertModifier.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,41 +22,41 @@
 
 package org.teiid.connector.jdbc.oracle;
 
+import static org.junit.Assert.assertEquals;
+
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.sql.Timestamp;
 import java.util.Arrays;
-import java.util.Properties;
 
-import static org.junit.Assert.*;
-
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.teiid.connector.api.TypeFacility;
+import org.teiid.connector.jdbc.JDBCManagedConnectionFactory;
 import org.teiid.connector.jdbc.translator.SQLConversionVisitor;
 import org.teiid.connector.jdbc.translator.Translator;
 import org.teiid.connector.language.IExpression;
 import org.teiid.connector.language.IFunction;
 import org.teiid.connector.language.ILanguageFactory;
+import org.teiid.connector.language.impl.LanguageFactoryImpl;
 
-import com.metamatrix.cdk.CommandBuilder;
-import com.metamatrix.cdk.api.EnvironmentUtility;
 import com.metamatrix.query.unittest.TimestampUtil;
 
 /**
  */
 public class TestOracleConvertModifier {
 
-    private static final ILanguageFactory LANG_FACTORY = CommandBuilder.getLanuageFactory();
+    private static final ILanguageFactory LANG_FACTORY = new LanguageFactoryImpl();
+    
     private static Translator TRANSLATOR = new OracleSQLTranslator(); 
     
     @BeforeClass public static void oneTimeSetup() throws Exception {
-        TRANSLATOR.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
+        TRANSLATOR.initialize(new JDBCManagedConnectionFactory());
     }
     
     public String helpGetString(IExpression expr) throws Exception {
         OracleSQLTranslator trans = new OracleSQLTranslator();
-        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
+        trans.initialize(new JDBCManagedConnectionFactory());
         
         SQLConversionVisitor sqlVisitor = TRANSLATOR.getSQLConversionVisitor(); 
         sqlVisitor.append(expr);  

Modified: branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestOracleSQLConversionVisitor.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestOracleSQLConversionVisitor.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestOracleSQLConversionVisitor.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,22 +22,21 @@
 
 package org.teiid.connector.jdbc.oracle;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
 
 import java.util.Properties;
 
 import org.junit.Test;
 import org.teiid.connector.api.ConnectorException;
 import org.teiid.connector.api.ExecutionContext;
+import org.teiid.connector.jdbc.JDBCManagedConnectionFactory;
 import org.teiid.connector.jdbc.JDBCPropertyNames;
-import org.teiid.connector.jdbc.oracle.OracleSQLTranslator;
 import org.teiid.connector.jdbc.translator.TranslatedCommand;
 import org.teiid.connector.language.ICommand;
 import org.teiid.dqp.internal.datamgr.impl.ExecutionContextImpl;
 import org.teiid.dqp.internal.datamgr.impl.FakeExecutionContextImpl;
 
 import com.metamatrix.cdk.CommandBuilder;
-import com.metamatrix.cdk.api.EnvironmentUtility;
 import com.metamatrix.cdk.api.TranslationUtility;
 import com.metamatrix.common.types.DataTypeManager;
 import com.metamatrix.core.util.UnitTestUtil;
@@ -88,7 +87,7 @@
         if (dbmsTimeZone != null) {
         	p.setProperty(JDBCPropertyNames.DATABASE_TIME_ZONE, dbmsTimeZone);
         }
-        translator.initialize(EnvironmentUtility.createEnvironment(p, false));
+        translator.initialize(new JDBCManagedConnectionFactory());
         // Convert back to SQL
         TranslatedCommand tc = new TranslatedCommand(context, translator);
         tc.translateCommand(obj);
@@ -233,7 +232,7 @@
         String output = "SELECT /*+ ALL_ROWS */ PARTS.PART_NAME, ROWNUM FROM PARTS"; //$NON-NLS-1$
                
         String hint = "/*+ ALL_ROWS */"; //$NON-NLS-1$
-        ExecutionContext context = new ExecutionContextImpl(null, null, null, null, hint, null, "", null, null, null); //$NON-NLS-1$
+        ExecutionContext context = new ExecutionContextImpl(null, null, hint, null, "", null, null, null); //$NON-NLS-1$
         
         helpTestVisitor(getTestVDB(),
             input, 

Modified: branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestOracleTranslator.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestOracleTranslator.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestOracleTranslator.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -24,13 +24,15 @@
 
 import java.io.File;
 import java.net.URL;
-import java.util.Properties;
 
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
+import org.mockito.Mockito;
 import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.jdbc.MetadataFactory;
+import org.teiid.connector.api.ExecutionContext;
+import org.teiid.connector.jdbc.FakeMetadataFactory;
+import org.teiid.connector.jdbc.JDBCManagedConnectionFactory;
 import org.teiid.connector.jdbc.translator.TranslatedCommand;
 import org.teiid.connector.jdbc.translator.Translator;
 import org.teiid.connector.language.ICommand;
@@ -49,7 +51,7 @@
 
     @BeforeClass public static void oneTimeSetup() throws Exception {
         TRANSLATOR = new OracleSQLTranslator();        
-        TRANSLATOR.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
+        TRANSLATOR.initialize(new JDBCManagedConnectionFactory());
         // Define a UDFSource to hold the reference to our function definitions
         File udfFile = new File("src/main/resources/OracleSpatialFunctions.xmi"); //$NON-NLS-1$;
         URL[] urls = new URL[0];            
@@ -82,7 +84,7 @@
         // Convert from sql to objects
         ICommand obj = FakeTranslationFactory.getInstance().getAutoIncrementTranslationUtility().parseCommand(input);
         
-        TranslatedCommand tc = new TranslatedCommand(EnvironmentUtility.createSecurityContext("user"), TRANSLATOR); //$NON-NLS-1$
+        TranslatedCommand tc = new TranslatedCommand(Mockito.mock(ExecutionContext.class), TRANSLATOR); //$NON-NLS-1$
         tc.translateCommand(obj);
         
         // Check stuff
@@ -101,7 +103,7 @@
         String input = "select smalla.intkey from bqt1.smalla inner join bqt1.smallb on smalla.stringkey=smallb.stringkey cross join bqt1.mediuma"; //$NON-NLS-1$
         String output = "SELECT SmallA.IntKey FROM SmallA INNER JOIN SmallB ON SmallA.StringKey = SmallB.StringKey CROSS JOIN MediumA"; //$NON-NLS-1$
           
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
             input, 
             output, TRANSLATOR);        
     }
@@ -110,7 +112,7 @@
         String input = "select smalla.intkey from bqt1.smalla cross join (bqt1.smallb cross join bqt1.mediuma)"; //$NON-NLS-1$
         String output = "SELECT SmallA.IntKey FROM SmallA CROSS JOIN (SmallB CROSS JOIN MediumA)"; //$NON-NLS-1$
       
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
             input, 
             output, TRANSLATOR);        
     }
@@ -119,7 +121,7 @@
         String input = "SELECT char(convert(STRINGNUM, integer) + 100) FROM BQT1.SMALLA"; //$NON-NLS-1$
         String output = "SELECT chr((trunc(to_number(SmallA.StringNum)) + 100)) FROM SmallA";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
             input, output, 
             TRANSLATOR);
     }
@@ -128,7 +130,7 @@
         String input = "SELECT convert(STRINGNUM, long) FROM BQT1.SMALLA"; //$NON-NLS-1$
         String output = "SELECT trunc(to_number(SmallA.StringNum)) FROM SmallA";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -137,7 +139,7 @@
         String input = "SELECT convert(convert(STRINGNUM, long), string) FROM BQT1.SMALLA"; //$NON-NLS-1$
         String output = "SELECT to_char(trunc(to_number(SmallA.StringNum))) FROM SmallA";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -146,7 +148,7 @@
         String input = "SELECT convert(convert(TIMESTAMPVALUE, date), string) FROM BQT1.SMALLA"; //$NON-NLS-1$
         String output = "SELECT to_char(trunc(cast(SmallA.TimestampValue AS date)), 'YYYY-MM-DD') FROM SmallA";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -154,7 +156,7 @@
         String input = "SELECT convert(convert(TIMEVALUE, timestamp), string) FROM BQT1.SMALLA"; //$NON-NLS-1$
         String output = "SELECT to_char(cast(SmallA.TimeValue AS timestamp), 'YYYY-MM-DD HH24:MI:SS.FF') FROM SmallA";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -162,7 +164,7 @@
         String input = "SELECT nvl(INTNUM, 'otherString') FROM BQT1.SMALLA"; //$NON-NLS-1$
         String output = "SELECT nvl(to_char(SmallA.IntNum), 'otherString') FROM SmallA";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -170,7 +172,7 @@
         String input = "SELECT convert(convert(STRINGNUM, integer), string) FROM BQT1.SMALLA"; //$NON-NLS-1$
         String output = "SELECT to_char(trunc(to_number(SmallA.StringNum))) FROM SmallA";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -187,7 +189,7 @@
         String input = "SELECT locate(INTNUM, 'chimp', 1) FROM BQT1.SMALLA"; //$NON-NLS-1$
         String output = "SELECT INSTR('chimp', to_char(SmallA.IntNum), 1) FROM SmallA";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -204,7 +206,7 @@
         String input = "SELECT locate(STRINGNUM, 'chimp') FROM BQT1.SMALLA"; //$NON-NLS-1$
         String output = "SELECT INSTR('chimp', SmallA.StringNum) FROM SmallA";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -221,7 +223,7 @@
         String input = "SELECT locate(INTNUM, '234567890', 1) FROM BQT1.SMALLA WHERE INTKEY = 26"; //$NON-NLS-1$
         String output = "SELECT INSTR('234567890', to_char(SmallA.IntNum), 1) FROM SmallA WHERE SmallA.IntKey = 26";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -238,7 +240,7 @@
         String input = "SELECT locate('c', 'chimp', 1) FROM BQT1.SMALLA"; //$NON-NLS-1$
         String output = "SELECT 1 FROM SmallA";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -255,7 +257,7 @@
         String input = "SELECT locate(STRINGNUM, 'chimp', -5) FROM BQT1.SMALLA"; //$NON-NLS-1$
         String output = "SELECT INSTR('chimp', SmallA.StringNum, 1) FROM SmallA";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -272,7 +274,7 @@
         String input = "SELECT locate(STRINGNUM, 'chimp', INTNUM) FROM BQT1.SMALLA"; //$NON-NLS-1$
         String output = "SELECT INSTR('chimp', SmallA.StringNum, CASE WHEN SmallA.IntNum < 1 THEN 1 ELSE SmallA.IntNum END) FROM SmallA";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -289,7 +291,7 @@
         String input = "SELECT locate(STRINGNUM, 'chimp', LOCATE(STRINGNUM, 'chimp') + 1) FROM BQT1.SMALLA"; //$NON-NLS-1$
         String output = "SELECT INSTR('chimp', SmallA.StringNum, CASE WHEN (INSTR('chimp', SmallA.StringNum) + 1) < 1 THEN 1 ELSE (INSTR('chimp', SmallA.StringNum) + 1) END) FROM SmallA";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -298,7 +300,7 @@
         String input = "SELECT substring(StringNum, 1) FROM BQT1.SMALLA"; //$NON-NLS-1$
         String output = "SELECT substr(SmallA.StringNum, 1) FROM SmallA";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -306,7 +308,7 @@
         String input = "SELECT substring(StringNum, 1, 1) FROM BQT1.SMALLA"; //$NON-NLS-1$
         String output = "SELECT substr(SmallA.StringNum, 1, 1) FROM SmallA";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -314,7 +316,7 @@
         String input = "SELECT IntKey FROM BQT1.SMALLA UNION SELECT IntKey FROM BQT1.SMALLB ORDER BY IntKey"; //$NON-NLS-1$
         String output = "SELECT SmallA.IntKey FROM SmallA UNION SELECT SmallB.IntKey FROM SmallB ORDER BY IntKey NULLS FIRST";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -322,7 +324,7 @@
         String input = "select intkey from bqt1.smalla limit 10, 0"; //$NON-NLS-1$
         String output = "SELECT * FROM (SELECT VIEW_FOR_LIMIT.*, ROWNUM ROWNUM_ FROM (SELECT SmallA.IntKey FROM SmallA) VIEW_FOR_LIMIT WHERE ROWNUM <= 10) WHERE ROWNUM_ > 10"; //$NON-NLS-1$
                
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -330,7 +332,7 @@
         String input = "select intkey from bqt1.smalla limit 0, 10"; //$NON-NLS-1$
         String output = "SELECT * FROM (SELECT SmallA.IntKey FROM SmallA) WHERE ROWNUM <= 10"; //$NON-NLS-1$
                
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -338,7 +340,7 @@
         String input = "select intkey from bqt1.smalla limit 1, 10"; //$NON-NLS-1$
         String output = "SELECT * FROM (SELECT VIEW_FOR_LIMIT.*, ROWNUM ROWNUM_ FROM (SELECT SmallA.IntKey FROM SmallA) VIEW_FOR_LIMIT WHERE ROWNUM <= 11) WHERE ROWNUM_ > 1"; //$NON-NLS-1$
                
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -346,7 +348,7 @@
         String input = "select intkey from bqt1.mediuma limit 100"; //$NON-NLS-1$
         String output = "SELECT * FROM (SELECT MediumA.IntKey FROM MediumA) WHERE ROWNUM <= 100"; //$NON-NLS-1$
                
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -354,7 +356,7 @@
         String input = "select intkey from bqt1.mediuma limit 50, 100"; //$NON-NLS-1$
         String output = "SELECT * FROM (SELECT VIEW_FOR_LIMIT.*, ROWNUM ROWNUM_ FROM (SELECT MediumA.IntKey FROM MediumA) VIEW_FOR_LIMIT WHERE ROWNUM <= 150) WHERE ROWNUM_ > 50"; //$NON-NLS-1$
                
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -362,7 +364,7 @@
     @Test public void testConcat2_useLiteral() throws Exception {        
         String input = "select concat2(stringnum,'_xx') from bqt1.Smalla"; //$NON-NLS-1$
         String output = "SELECT concat(nvl(SmallA.StringNum, ''), '_xx') FROM SmallA"; //$NON-NLS-1$
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -370,7 +372,7 @@
     @Test public void testConcat2() throws Exception {        
         String input = "select concat2(stringnum, stringkey) from bqt1.Smalla"; //$NON-NLS-1$
         String output = "SELECT CASE WHEN (SmallA.StringNum IS NULL) AND (SmallA.StringKey IS NULL) THEN NULL ELSE concat(nvl(SmallA.StringNum, ''), nvl(SmallA.StringKey, '')) END FROM SmallA"; //$NON-NLS-1$
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -386,7 +388,7 @@
         String input = "SELECT a.INTKEY FROM BQT1.SMALLA A, BQT1.SMALLB B WHERE sdo_relate(A.OBJECTVALUE, b.OBJECTVALUE, 'mask=ANYINTERACT') = true"; //$NON-NLS-1$
         String output = "SELECT /*+ ORDERED */ A.IntKey FROM SmallA A, SmallB B WHERE sdo_relate(A.ObjectValue, B.ObjectValue, 'mask=ANYINTERACT') = 'true'";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -402,7 +404,7 @@
         String input = "SELECT INTKEY FROM BQT1.SMALLA WHERE sdo_within_distance(OBJECTVALUE, 'SDO_GEOMETRY(2001, 8307, MDSYS.SDO_POINT_TYPE(90.0, -45.0, NULL), NULL, NULL)', 'DISTANCE=25.0 UNIT=NAUT_MILE') = true"; //$NON-NLS-1$
         String output = "SELECT SmallA.IntKey FROM SmallA WHERE sdo_within_distance(SmallA.ObjectValue, SDO_GEOMETRY(2001, 8307, MDSYS.SDO_POINT_TYPE(90.0, -45.0, NULL), NULL, NULL), 'DISTANCE=25.0 UNIT=NAUT_MILE') = 'true'";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -418,7 +420,7 @@
         String input = "SELECT INTKEY FROM BQT1.SMALLA WHERE sdo_within_distance('SDO_GEOMETRY(2001, 8307, MDSYS.SDO_POINT_TYPE(90.0, -45.0, NULL), NULL, NULL)', OBJECTVALUE, 'DISTANCE=25.0 UNIT=NAUT_MILE') = true"; //$NON-NLS-1$
         String output = "SELECT SmallA.IntKey FROM SmallA WHERE sdo_within_distance(SDO_GEOMETRY(2001, 8307, MDSYS.SDO_POINT_TYPE(90.0, -45.0, NULL), NULL, NULL), SmallA.ObjectValue, 'DISTANCE=25.0 UNIT=NAUT_MILE') = 'true'";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -439,7 +441,7 @@
         // as the signature was the best match for this query.
         String output = "SELECT SmallA.IntKey FROM SmallA WHERE sdo_within_distance(SmallA.StringKey, SDO_GEOMETRY(2001, 8307, MDSYS.SDO_POINT_TYPE(90.0, -45.0, NULL), NULL, NULL), 'DISTANCE=25.0 UNIT=NAUT_MILE') = ?";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -460,7 +462,7 @@
         // as the signature was the best match for this query.
         String output = "SELECT SmallA.IntKey FROM SmallA WHERE sdo_within_distance(SDO_GEOMETRY(2001, 8307, MDSYS.SDO_POINT_TYPE(90.0, -45.0, NULL), NULL, NULL), SDO_GEOMETRY(2001, 8307, MDSYS.SDO_POINT_TYPE(90.0, -45.0, NULL), NULL, NULL), 'DISTANCE=25.0 UNIT=NAUT_MILE') = ?";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -476,7 +478,7 @@
         String input = "SELECT a.INTKEY FROM BQT1.SMALLA A, BQT1.SMALLB B WHERE sdo_within_distance(a.OBJECTVALUE, b.OBJECTVALUE, 'DISTANCE=25.0 UNIT=NAUT_MILE') = true"; //$NON-NLS-1$
         String output = "SELECT A.IntKey FROM SmallA A, SmallB B WHERE sdo_within_distance(A.ObjectValue, B.ObjectValue, 'DISTANCE=25.0 UNIT=NAUT_MILE') = 'true'";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -485,7 +487,7 @@
         String input = "SELECT log(CONVERT(stringkey, INTEGER)) FROM bqt1.smalla"; //$NON-NLS-1$
         String output = "SELECT ln(trunc(to_number(SmallA.StringKey))) FROM SmallA"; //$NON-NLS-1$
     
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -494,7 +496,7 @@
         String input = "SELECT log10(CONVERT(stringkey, INTEGER)) FROM bqt1.smalla"; //$NON-NLS-1$
         String output = "SELECT log(10, trunc(to_number(SmallA.StringKey))) FROM SmallA"; //$NON-NLS-1$
     
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -503,7 +505,7 @@
         String input = "SELECT char(CONVERT(stringkey, INTEGER)), lcase(stringkey), ucase(stringkey), ifnull(stringkey, 'x') FROM bqt1.smalla"; //$NON-NLS-1$
         String output = "SELECT chr(trunc(to_number(SmallA.StringKey))), lower(SmallA.StringKey), upper(SmallA.StringKey), nvl(SmallA.StringKey, 'x') FROM SmallA"; //$NON-NLS-1$
         
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }    

Modified: branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestSubstringFunctionModifier.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestSubstringFunctionModifier.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestSubstringFunctionModifier.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -23,24 +23,22 @@
 package org.teiid.connector.jdbc.oracle;
 
 import java.util.Arrays;
-import java.util.Properties;
 
 import junit.framework.TestCase;
 
 import org.teiid.connector.api.TypeFacility;
+import org.teiid.connector.jdbc.JDBCManagedConnectionFactory;
 import org.teiid.connector.jdbc.translator.SQLConversionVisitor;
 import org.teiid.connector.language.IExpression;
 import org.teiid.connector.language.IFunction;
 import org.teiid.connector.language.ILanguageFactory;
+import org.teiid.connector.language.impl.LanguageFactoryImpl;
 
-import com.metamatrix.cdk.CommandBuilder;
-import com.metamatrix.cdk.api.EnvironmentUtility;
-
 /**
  */
 public class TestSubstringFunctionModifier extends TestCase {
 
-    private static final ILanguageFactory LANG_FACTORY = CommandBuilder.getLanuageFactory();
+    private static final ILanguageFactory LANG_FACTORY = new LanguageFactoryImpl();
 
 
     /**
@@ -56,7 +54,7 @@
             Arrays.asList(args), TypeFacility.RUNTIME_TYPES.STRING);
         
         OracleSQLTranslator trans = new OracleSQLTranslator();
-        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
+        trans.initialize(new JDBCManagedConnectionFactory());
 
         SQLConversionVisitor sqlVisitor = trans.getSQLConversionVisitor(); 
         sqlVisitor.append(func);  

Modified: branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/postgresql/TestPostgreSQLTranslator.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/postgresql/TestPostgreSQLTranslator.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/postgresql/TestPostgreSQLTranslator.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,14 +22,11 @@
 
 package org.teiid.connector.jdbc.postgresql;
 
-import java.util.Properties;
-
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.jdbc.MetadataFactory;
-
-import com.metamatrix.cdk.api.EnvironmentUtility;
+import org.teiid.connector.jdbc.FakeMetadataFactory;
+import org.teiid.connector.jdbc.JDBCManagedConnectionFactory;
 
 public class TestPostgreSQLTranslator {
 
@@ -37,19 +34,19 @@
 
     @BeforeClass public static void setupOnce() throws Exception {
         TRANSLATOR = new PostgreSQLTranslator();        
-        TRANSLATOR.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
+        TRANSLATOR.initialize(new JDBCManagedConnectionFactory());
     }
     
     public String getTestVDB() {
-        return MetadataFactory.PARTS_VDB;
+        return FakeMetadataFactory.PARTS_VDB;
     }
     
     private String getTestBQTVDB() {
-        return MetadataFactory.BQT_VDB;
+        return FakeMetadataFactory.BQT_VDB;
     }
         
     public void helpTestVisitor(String vdb, String input, String expectedOutput) throws ConnectorException {
-        MetadataFactory.helpTestVisitor(vdb, input, expectedOutput, TRANSLATOR);
+        FakeMetadataFactory.helpTestVisitor(vdb, input, expectedOutput, TRANSLATOR);
     }
 
     @Test public void testConversion1() throws Exception {
@@ -414,7 +411,7 @@
         String input = "SELECT locate(INTNUM, 'chimp', 1) FROM BQT1.SMALLA"; //$NON-NLS-1$
         String output = "SELECT position(cast(SmallA.IntNum AS varchar(4000)) in substr('chimp', 1)) FROM SmallA";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -431,7 +428,7 @@
         String input = "SELECT locate(STRINGNUM, 'chimp') FROM BQT1.SMALLA"; //$NON-NLS-1$
         String output = "SELECT position(SmallA.StringNum in 'chimp') FROM SmallA";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -448,7 +445,7 @@
         String input = "SELECT locate(INTNUM, '234567890', 1) FROM BQT1.SMALLA WHERE INTKEY = 26"; //$NON-NLS-1$
         String output = "SELECT position(cast(SmallA.IntNum AS varchar(4000)) in substr('234567890', 1)) FROM SmallA WHERE SmallA.IntKey = 26";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -465,7 +462,7 @@
         String input = "SELECT locate('c', 'chimp', 1) FROM BQT1.SMALLA"; //$NON-NLS-1$
         String output = "SELECT 1 FROM SmallA";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -482,7 +479,7 @@
         String input = "SELECT locate(STRINGNUM, 'chimp', -5) FROM BQT1.SMALLA"; //$NON-NLS-1$
         String output = "SELECT position(SmallA.StringNum in substr('chimp', 1)) FROM SmallA";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -499,7 +496,7 @@
         String input = "SELECT locate(STRINGNUM, 'chimp', INTNUM) FROM BQT1.SMALLA"; //$NON-NLS-1$
         String output = "SELECT position(SmallA.StringNum in substr('chimp', CASE WHEN SmallA.IntNum < 1 THEN 1 ELSE SmallA.IntNum END)) FROM SmallA";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }
@@ -516,7 +513,7 @@
         String input = "SELECT locate(STRINGNUM, 'chimp', LOCATE(STRINGNUM, 'chimp') + 1) FROM BQT1.SMALLA"; //$NON-NLS-1$
         String output = "SELECT position(SmallA.StringNum in substr('chimp', CASE WHEN (position(SmallA.StringNum in 'chimp') + 1) < 1 THEN 1 ELSE (position(SmallA.StringNum in 'chimp') + 1) END)) FROM SmallA";  //$NON-NLS-1$
 
-        MetadataFactory.helpTestVisitor(MetadataFactory.BQT_VDB,
+        FakeMetadataFactory.helpTestVisitor(FakeMetadataFactory.BQT_VDB,
                 input, output, 
                 TRANSLATOR);
     }

Modified: branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/sqlserver/TestSqlServerConversionVisitor.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/sqlserver/TestSqlServerConversionVisitor.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/sqlserver/TestSqlServerConversionVisitor.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,18 +22,17 @@
 
 package org.teiid.connector.jdbc.sqlserver;
 
-import java.util.Properties;
-
 import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Test;
+import org.mockito.Mockito;
 import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.jdbc.MetadataFactory;
+import org.teiid.connector.api.ExecutionContext;
+import org.teiid.connector.jdbc.FakeMetadataFactory;
+import org.teiid.connector.jdbc.JDBCManagedConnectionFactory;
 import org.teiid.connector.jdbc.translator.TranslatedCommand;
 import org.teiid.connector.language.ICommand;
 
-import com.metamatrix.cdk.api.EnvironmentUtility;
-
 /**
  */
 public class TestSqlServerConversionVisitor {
@@ -42,15 +41,15 @@
     
     @BeforeClass
     public static void setup() throws ConnectorException {
-        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
+        trans.initialize(new JDBCManagedConnectionFactory());
     }
 
     public String getTestVDB() {
-        return MetadataFactory.PARTS_VDB;
+        return FakeMetadataFactory.PARTS_VDB;
     }
 
     public String getBQTVDB() {
-        return MetadataFactory.BQT_VDB;
+        return FakeMetadataFactory.BQT_VDB;
     }
     
     public void helpTestVisitor(String vdb, String input, String expectedOutput) throws ConnectorException {
@@ -58,8 +57,8 @@
     }
     
     public void helpTestVisitor(String vdb, String input, String[] expectedOutputs) throws ConnectorException {
-        ICommand obj = MetadataFactory.helpTranslate(vdb, input);
-        TranslatedCommand tc = new TranslatedCommand(EnvironmentUtility.createSecurityContext("user"), trans); //$NON-NLS-1$
+        ICommand obj = FakeMetadataFactory.helpTranslate(vdb, input);
+        TranslatedCommand tc = new TranslatedCommand(Mockito.mock(ExecutionContext.class), trans); //$NON-NLS-1$
         tc.translateCommand(obj);
         Assert.assertEquals("Did not get correct sql", expectedOutputs[0], tc.getSql());             //$NON-NLS-1$
     }

Modified: branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/sybase/TestSybaseConvertModifier.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/sybase/TestSybaseConvertModifier.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/sybase/TestSybaseConvertModifier.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,24 +22,23 @@
 
 package org.teiid.connector.jdbc.sybase;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
 
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.sql.Timestamp;
-import java.util.Properties;
 
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.teiid.connector.api.ConnectorException;
+import org.teiid.connector.jdbc.JDBCManagedConnectionFactory;
 import org.teiid.connector.jdbc.translator.SQLConversionVisitor;
 import org.teiid.connector.language.IExpression;
 import org.teiid.connector.language.IFunction;
 import org.teiid.connector.language.ILanguageFactory;
 import org.teiid.connector.language.ILiteral;
+import org.teiid.connector.language.impl.LanguageFactoryImpl;
 
-import com.metamatrix.cdk.CommandBuilder;
-import com.metamatrix.cdk.api.EnvironmentUtility;
 import com.metamatrix.common.types.DataTypeManager;
 import com.metamatrix.query.unittest.TimestampUtil;
 
@@ -47,12 +46,12 @@
  */
 public class TestSybaseConvertModifier {
 
-    private static final ILanguageFactory LANG_FACTORY = CommandBuilder.getLanuageFactory();
+    private static final ILanguageFactory LANG_FACTORY = new LanguageFactoryImpl();
     private static SybaseSQLTranslator trans = new SybaseSQLTranslator();
     
     @BeforeClass
     public static void setup() throws ConnectorException {
-        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
+        trans.initialize(new JDBCManagedConnectionFactory());
     }
     
     public String helpGetString(IExpression expr) throws Exception {

Modified: branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/sybase/TestSybaseSQLConversionVisitor.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/sybase/TestSybaseSQLConversionVisitor.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/sybase/TestSybaseSQLConversionVisitor.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -24,17 +24,16 @@
 
 import static org.junit.Assert.assertEquals;
 
-import java.util.Properties;
-
 import org.junit.BeforeClass;
 import org.junit.Test;
+import org.mockito.Mockito;
 import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.jdbc.MetadataFactory;
+import org.teiid.connector.api.ExecutionContext;
+import org.teiid.connector.jdbc.FakeMetadataFactory;
+import org.teiid.connector.jdbc.JDBCManagedConnectionFactory;
 import org.teiid.connector.jdbc.translator.TranslatedCommand;
 import org.teiid.connector.language.ICommand;
 
-import com.metamatrix.cdk.api.EnvironmentUtility;
-
 /**
  */
 public class TestSybaseSQLConversionVisitor {
@@ -43,22 +42,22 @@
     
     @BeforeClass
     public static void setup() throws ConnectorException {
-        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
+        trans.initialize(new JDBCManagedConnectionFactory());
     }
 
     public String getTestVDB() {
-        return MetadataFactory.PARTS_VDB;
+        return FakeMetadataFactory.PARTS_VDB;
     }
 
     public String getBQTVDB() {
-        return MetadataFactory.BQT_VDB;
+        return FakeMetadataFactory.BQT_VDB;
     }
     
     public void helpTestVisitor(String vdb, String input, String expectedOutput) {
         // Convert from sql to objects
-        ICommand obj = MetadataFactory.helpTranslate(vdb, input);
+        ICommand obj = FakeMetadataFactory.helpTranslate(vdb, input);
         
-        TranslatedCommand tc = new TranslatedCommand(EnvironmentUtility.createSecurityContext("user"), trans); //$NON-NLS-1$
+        TranslatedCommand tc = new TranslatedCommand(Mockito.mock(ExecutionContext.class), trans); //$NON-NLS-1$
 		try {
 			tc.translateCommand(obj);
 		} catch (ConnectorException e) {

Modified: branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/translator/TestExtractFunctionModifier.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/translator/TestExtractFunctionModifier.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/translator/TestExtractFunctionModifier.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -24,28 +24,27 @@
 
 import java.sql.Timestamp;
 import java.util.Arrays;
-import java.util.Properties;
 
 import junit.framework.TestCase;
 
 import org.teiid.connector.api.SourceSystemFunctions;
 import org.teiid.connector.api.TypeFacility;
+import org.teiid.connector.jdbc.JDBCManagedConnectionFactory;
 import org.teiid.connector.language.IElement;
 import org.teiid.connector.language.IExpression;
 import org.teiid.connector.language.IFunction;
 import org.teiid.connector.language.IGroup;
 import org.teiid.connector.language.ILanguageFactory;
 import org.teiid.connector.language.ILiteral;
+import org.teiid.connector.language.impl.LanguageFactoryImpl;
 
-import com.metamatrix.cdk.CommandBuilder;
-import com.metamatrix.cdk.api.EnvironmentUtility;
 import com.metamatrix.query.unittest.TimestampUtil;
 
 /**
  */
 public class TestExtractFunctionModifier extends TestCase {
 
-    private static final ILanguageFactory LANG_FACTORY = CommandBuilder.getLanuageFactory();
+    private static final ILanguageFactory LANG_FACTORY = new LanguageFactoryImpl();
 
     /**
      * Constructor for TestMonthFunctionModifier.
@@ -63,7 +62,7 @@
         ExtractFunctionModifier mod = new ExtractFunctionModifier ();
         Translator trans = new Translator();
         trans.registerFunctionModifier(target, mod);
-        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
+        trans.initialize(new JDBCManagedConnectionFactory());
         
         SQLConversionVisitor sqlVisitor = trans.getSQLConversionVisitor(); 
 

Modified: branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/translator/TestLocateFunctionModifier.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/translator/TestLocateFunctionModifier.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/translator/TestLocateFunctionModifier.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,29 +22,26 @@
 
 package org.teiid.connector.jdbc.translator;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
 
 import java.util.Arrays;
-import java.util.Properties;
 
 import org.junit.Test;
-import org.teiid.connector.api.ConnectorEnvironment;
 import org.teiid.connector.api.ConnectorException;
 import org.teiid.connector.api.SourceSystemFunctions;
+import org.teiid.connector.jdbc.JDBCManagedConnectionFactory;
 import org.teiid.connector.language.IExpression;
 import org.teiid.connector.language.IFunction;
 import org.teiid.connector.language.ILanguageFactory;
+import org.teiid.connector.language.impl.LanguageFactoryImpl;
 
-import com.metamatrix.cdk.CommandBuilder;
-import com.metamatrix.cdk.api.EnvironmentUtility;
-
 /**
  * Test <code>LOCATEFunctionModifier</code> by invoking its methods with varying 
  * parameters to validate it performs as designed and expected. 
  */
 public class TestLocateFunctionModifier {
 
-    private static final ILanguageFactory LANG_FACTORY = CommandBuilder.getLanuageFactory();
+    private static final ILanguageFactory LANG_FACTORY = new LanguageFactoryImpl();
 
     /**
      * Create an expression containing a LOCATE function using <code>args</code> 
@@ -101,14 +98,14 @@
 
     	Translator trans = new Translator() {
 			@Override
-			public void initialize(ConnectorEnvironment env)
+			public void initialize(JDBCManagedConnectionFactory env)
 					throws ConnectorException {
 				super.initialize(env);
 				registerFunctionModifier(SourceSystemFunctions.LOCATE, new LocateFunctionModifier(getLanguageFactory(), locateFunctionName, parameterOrder));
 			}
     	};
     	
-        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
+        trans.initialize(new JDBCManagedConnectionFactory());
 
         SQLConversionVisitor sqlVisitor = trans.getSQLConversionVisitor(); 
         sqlVisitor.append(func);  

Modified: branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/translator/TestModFunctionModifier.java
===================================================================
--- branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/translator/TestModFunctionModifier.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/translator/TestModFunctionModifier.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -25,19 +25,18 @@
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.util.Arrays;
-import java.util.Properties;
 
 import junit.framework.TestCase;
 
-import org.teiid.connector.api.ConnectorEnvironment;
 import org.teiid.connector.api.ConnectorException;
 import org.teiid.connector.api.SourceSystemFunctions;
+import org.teiid.connector.jdbc.JDBCManagedConnectionFactory;
 import org.teiid.connector.language.IExpression;
 import org.teiid.connector.language.IFunction;
 import org.teiid.connector.language.ILanguageFactory;
+import org.teiid.connector.language.impl.LanguageFactoryImpl;
 
 import com.metamatrix.cdk.CommandBuilder;
-import com.metamatrix.cdk.api.EnvironmentUtility;
 
 /**
  * Test <code>ModFunctionModifier</code> by invoking its methods with varying 
@@ -45,7 +44,7 @@
  */
 public class TestModFunctionModifier extends TestCase {
 
-    private static final ILanguageFactory LANG_FACTORY = CommandBuilder.getLanuageFactory();
+    private static final ILanguageFactory LANG_FACTORY = new LanguageFactoryImpl();
 
     /**
      * Constructor for TestModFunctionModifier.
@@ -94,14 +93,14 @@
 
     	Translator trans = new Translator() {
 			@Override
-			public void initialize(ConnectorEnvironment env)
+			public void initialize(JDBCManagedConnectionFactory env)
 					throws ConnectorException {
 				super.initialize(env);
 				registerFunctionModifier(SourceSystemFunctions.MOD, new ModFunctionModifier(modFunctionName, getLanguageFactory()));
 			}
     	};
     	
-        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
+        trans.initialize(new JDBCManagedConnectionFactory());
 
         SQLConversionVisitor sqlVisitor = trans.getSQLConversionVisitor(); 
         sqlVisitor.append(func);  

Modified: branches/JCA/connectors/pom.xml
===================================================================
--- branches/JCA/connectors/pom.xml	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/connectors/pom.xml	2009-11-02 19:41:28 UTC (rev 1544)
@@ -104,6 +104,7 @@
   
   <modules>
     <module>connector-jdbc</module>
+    <!-- 
     <module>connector-loopback</module>
     <module>connector-text</module>
     <module>connector-xml</module>
@@ -112,5 +113,6 @@
     <module>salesforce-api</module>
     <module>connector-ldap</module>
     <module>connector-xml-common</module>
+     -->
   </modules>
 </project>
\ No newline at end of file

Modified: branches/JCA/engine/pom.xml
===================================================================
--- branches/JCA/engine/pom.xml	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/pom.xml	2009-11-02 19:41:28 UTC (rev 1544)
@@ -64,20 +64,12 @@
     </dependency>
     
     <dependency>
-      <groupId>javax.transaction</groupId>
-      <artifactId>jta</artifactId>
-    </dependency>
-    
-    <dependency>
       <groupId>javax.resource</groupId>
       <artifactId>connector-api</artifactId>
-    </dependency>
-    
-    <dependency>
-    	<groupId>com.google.code.guice</groupId>
-		<artifactId>guice</artifactId>
+      <scope>provided</scope>
     </dependency>    
-    
   </dependencies>
   
+
+      
 </project>
\ No newline at end of file

Deleted: branches/JCA/engine/src/main/java/com/metamatrix/common/application/AbstractClassLoaderManager.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/common/application/AbstractClassLoaderManager.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/com/metamatrix/common/application/AbstractClassLoaderManager.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,118 +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.common.application;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import com.metamatrix.common.classloader.PostDelegatingClassLoader;
-import com.metamatrix.common.classloader.URLFilteringClassLoader;
-import com.metamatrix.common.log.LogManager;
-import com.metamatrix.common.protocol.MetaMatrixURLStreamHandlerFactory;
-import com.metamatrix.dqp.util.LogConstants;
-
-public abstract class AbstractClassLoaderManager implements ClassLoaderManager {
-	
-	private ClassLoader parentClassLoader;
-    private URLFilteringClassLoader commonExtensionClassloader;
-    private Map<String, PostDelegatingClassLoader> postdelegationClassLoaderCache = new HashMap<String, PostDelegatingClassLoader>();
-    private boolean usePostDelegationCache;
-    private MetaMatrixURLStreamHandlerFactory factory;
-    private Object lock = new Object();
-    
-    public AbstractClassLoaderManager(ClassLoader parentClassLoader, boolean usePostDelegationCache, boolean useStreamHandler) {
-    	this.usePostDelegationCache = usePostDelegationCache;
-    	this.parentClassLoader = parentClassLoader;
-    	if (useStreamHandler) {
-    		factory = new MetaMatrixURLStreamHandlerFactory();
-    	}
-    }
-    
-	public ClassLoader getCommonClassLoader(String urls) {
-		synchronized (lock) {
-			if (this.commonExtensionClassloader == null) {
-	            // since we are using the extensions, get the common extension path 
-				this.commonExtensionClassloader = new URLFilteringClassLoader(parseURLs(getCommonExtensionClassPath()), parentClassLoader, factory);
-			}
-			if (urls != null && urls.trim().length() > 0) {
-	            for (URL url : parseURLs(urls)) {
-	            	this.commonExtensionClassloader.addURL(url);
-				}
-			}
-			return this.commonExtensionClassloader;
-		}
-	}
-	
-	public ClassLoader getPostDelegationClassLoader(String urls) {
-		synchronized (lock) {
-			PostDelegatingClassLoader cl = this.postdelegationClassLoaderCache.get(urls);
-	    	if (cl == null) {
-	    		if (urls != null && urls.trim().length() > 0) {
-		            cl = new PostDelegatingClassLoader(parseURLs(urls), getCommonClassLoader(null), factory);
-		            if (usePostDelegationCache) {
-		            	this.postdelegationClassLoaderCache.put(urls, cl);
-		            }
-	    		}
-	    		if (cl == null) {
-	    			return getCommonClassLoader(null);
-	    		}
-	    	}
-	    	return cl;
-		}
-	}
-
-	public void clearCache() {
-		synchronized (lock) {
-			this.commonExtensionClassloader = null;
-			this.postdelegationClassLoaderCache.clear();
-		}
-	}
-		
-	public URL[] parseURLs(String delimitedUrls) {
-		StringTokenizer toke = new StringTokenizer(delimitedUrls, ";"); //$NON-NLS-1$
-        List<URL> urls = new ArrayList<URL>(toke.countTokens());
-        while (toke.hasMoreElements()) {
-            String urlString = toke.nextToken();
-	        try {
-				URL url = parseURL(urlString);
-				if (url != null) {
-					urls.add(url);
-				}
-			} catch (MalformedURLException e) {
-				LogManager.logError(LogConstants.CTX_EXTENSION_SOURCE, "Invalid extension classpath entry " + urlString); //$NON-NLS-1$
-			}
-        }
-                
-        return urls.toArray(new URL[urls.size()]);	
-	}
-	
-	public abstract URL parseURL(String url) throws MalformedURLException;
-	
-	public abstract String getCommonExtensionClassPath();
-		
-}

Deleted: branches/JCA/engine/src/main/java/com/metamatrix/common/application/ClassLoaderManager.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/common/application/ClassLoaderManager.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/com/metamatrix/common/application/ClassLoaderManager.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,41 +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.common.application;
-
-public interface ClassLoaderManager {
-	
-	/**
-	 * Return the common class loader with the given urls appended
-	 * @param urls
-	 * @return
-	 */
-	ClassLoader getCommonClassLoader(String urls);
-	
-	/**
-	 * Return a distinct post delgation class loader - which may be cached.
-	 * @param urls
-	 * @return
-	 */
-	ClassLoader getPostDelegationClassLoader(String urls);
-
-}

Modified: branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferManagerImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferManagerImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferManagerImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -132,7 +132,7 @@
             TimerTask statTask = new TimerTask() {
                 public void run() {
                     BufferStats stats = getStats();
-                    stats.log();
+                   // stats.log();
                 }
             };
             getTimer().schedule(statTask, 0, this.config.getLogStatInterval());

Modified: branches/JCA/engine/src/main/java/com/metamatrix/dqp/message/AtomicRequestMessage.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/dqp/message/AtomicRequestMessage.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/com/metamatrix/dqp/message/AtomicRequestMessage.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -28,11 +28,10 @@
 import java.util.Date;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import org.teiid.connector.xa.api.TransactionContext;
 import org.teiid.dqp.internal.process.DQPWorkContext;
 
 import com.metamatrix.common.buffer.impl.BufferConfig;
-import com.metamatrix.dqp.internal.datamgr.ConnectorID;
+import com.metamatrix.dqp.service.TransactionContext;
 import com.metamatrix.query.sql.lang.Command;
 
 /**
@@ -54,19 +53,13 @@
 	 * The connectorBindingID that identifies the connector needed for this
 	 * query.
 	 */
-	private String connectorBindingID;
+	private String connectorName;
 
 	/**
 	 * Name of model where the connector is bound to
 	 */
 	private String modelName;
 
-	/**
-	 * For cancel and update operations, the id of the data connector which
-	 * originally handled the request.
-	 */
-	private ConnectorID connectorID;
-
 	// Transaction context for the current request
 	private TransactionContext txnContext;
 
@@ -107,22 +100,14 @@
         return this.atomicRequestId;
     }
           
-    public String getConnectorBindingID() {
-        return connectorBindingID;
+    public String getConnectorName() {
+        return connectorName;
     }
 
-    public ConnectorID getConnectorID() {
-        return connectorID;
+    public void setConnectorName(String string) {
+        connectorName = string;
     }
-    
-    public void setConnectorID(ConnectorID connectorID) {
-        this.connectorID = connectorID;
-    }    
 
-    public void setConnectorBindingID(String string) {
-        connectorBindingID = string;
-    }
-
     public String getModelName() {
         return this.modelName;
     }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/dqp/service/ConfigurationService.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/dqp/service/ConfigurationService.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/com/metamatrix/dqp/service/ConfigurationService.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -29,12 +29,7 @@
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.common.application.ApplicationService;
-import com.metamatrix.common.application.ClassLoaderManager;
-import com.metamatrix.common.config.api.ComponentType;
-import com.metamatrix.common.config.api.ConfigurationModelContainer;
 import com.metamatrix.common.config.api.ConnectorBinding;
-import com.metamatrix.common.config.api.ConnectorBindingType;
-import com.metamatrix.common.config.api.ExtensionModule;
 import com.metamatrix.common.vdb.api.VDBArchive;
 import com.metamatrix.platform.security.api.service.SessionListener;
 
@@ -45,7 +40,7 @@
  * for other services and also DQP configuration. 
  * @since 4.3
  */
-public interface ConfigurationService extends ApplicationService, ClassLoaderManager {
+public interface ConfigurationService extends ApplicationService {
     public static final String NEXT_VDB_VERSION = "NEXT_VDB_VERSION";         //$NON-NLS-1$
     public static final String USER_DEFINED_FUNCTION_MODEL = "FunctionDefinitions.xmi"; //$NON-NLS-1$
     /**
@@ -61,36 +56,8 @@
      */
     public Properties getSystemProperties();
     
+          
     /**
-     * Set System property (Contents of ServerConfig.xml file)
-     * @param key
-     * @param value
-     * @throws MetaMatrixComponentException
-     */
-    public void setSystemProperty(String key, String value) throws MetaMatrixComponentException;
-
-    /**
-     * Set several System properties (Contents of ServerConfig.xml file). 
-     * Any properties not specified will remain unchanged.
-     * 
-     * @param properties The properties to set.
-     * @throws MetaMatrixComponentException
-     */
-    public void updateSystemProperties(Properties properties) throws MetaMatrixComponentException;
-
-    
-    
-    /**
-     * Get the system Configuration object loaded from the configuration object, this is currently
-     * only needed to support the exportConfiguration admin call. 
-     * @return
-     * @throws MetaMatrixComponentException
-     * @since 4.3
-     */
-    public ConfigurationModelContainer getSystemConfiguration() throws MetaMatrixComponentException;
-    
-        
-    /**
      * Get the user defined functions file name  
      * @return URL - URL to the User defined file; null if one not defined
      */
@@ -177,14 +144,7 @@
      */
     public ConnectorBinding getConnectorBinding(String connectorBindingName) 
         throws MetaMatrixComponentException;
-
-    /**
-     * Get the default properties for the Connector type 
-     * @param type
-     * @return properties
-     */
-    public Properties getDefaultProperties(ConnectorBindingType type);
-    
+   
     /** 
      * Update the Connector Binding, the assumption here that we kept the name same 
      * @param binding - Connector Binding to be modified
@@ -200,85 +160,8 @@
      * @since 4.3
      */
     public List<ConnectorBinding> getConnectorBindings() throws MetaMatrixComponentException;
-        
-    
-    /**
-     * Get Component type for the given id  
-     * @param id
-     * @return
-     * @throws MetaMatrixComponentException
-     */
-    public ConnectorBindingType getConnectorType(String connectorType) 
-        throws MetaMatrixComponentException;
-    
-    /**
-     * Add the Given component type to the persistent store 
-     * @param type
-     * @throws MetaMatrixComponentException
-     */
-    public void saveConnectorType(ConnectorBindingType type) 
-        throws MetaMatrixComponentException;
-    
-    /**
-     * Delete the Given component type to the persistent store 
-     * @param connectorType - Name of the connector Type
-     * @throws MetaMatrixComponentException
-     */
-    public void deleteConnectorType(String connectorType) 
-        throws MetaMatrixComponentException;    
 
     /**
-     * Get list of all the connector types available in the System. 
-     * @return list of {@link com.metamatrix.common.config.api.ComponentType}
-     * @throws MetaMatrixComponentException
-     */
-    public List<ComponentType> getConnectorTypes() 
-        throws MetaMatrixComponentException;
-        
-    /**
-     * Retun the context class path to be used by all the extension modules
-     * to use. if one not specified a default must be supplied. Usally this
-     * is directory where all the extension jars are stored or a URL
-     * @return String URL - url to extension path; null if extensions are not used 
-     * @since 4.3
-     */
-    public URL[] getExtensionPath();
-
-    /**
-     * Get the list of extension modules available in the store
-     * @return list of Extension Modules {@link com.metamatrix.common.config.api.ExtensionModule} 
-     * @throws MetaMatrixComponentException
-     * @since 4.3
-     */
-    public List<ExtensionModule> getExtensionModules() throws MetaMatrixComponentException;
-
-    /**
-     * Get the extension module by the given identifier 
-     * @param extModuleName - Module name
-     * @return ExtensionModule; null if not found
-     * @throws MetaMatrixComponentException
-     * @since 4.3
-     */
-    public ExtensionModule getExtensionModule(String extModuleName) 
-        throws MetaMatrixComponentException;
-    
-    /**
-     * Save the given extension module 
-     * @throws MetaMatrixComponentException
-     * @since 4.3
-     */
-    public void saveExtensionModule(ExtensionModule extModule) throws MetaMatrixComponentException;
-    
-    /**
-     * Delete the extension module from the configuration with name supplied 
-     * @param extModuleName - extension module name
-     * @throws MetaMatrixComponentException
-     * @since 4.3
-     */
-    public void deleteExtensionModule(String extModuleName) 
-        throws MetaMatrixComponentException;
-    
-    /**
      * Client Connection Listener object for the service; This will get notifications
      * about the connections currently available to DQP. 
      * @throws MetaMatrixComponentException
@@ -305,31 +188,8 @@
     
     public void unregister(ConnectorBindingLifeCycleListener listener);
         
-    /**
-     * Gets the reference URL to the Configuration File for the DQP.
-     * @return URL to configuration file; null otherwise
-     * @since 4.4
-     */
-    public URL getConfigFile();
     
-    
     /**
-     * Use the extension classpath defined in the connector bindins and load jars in
-     * different class loader or in the same class loader as calling code
-     * @return true - to load different class loader, false otherwise
-     */
-    public boolean useExtensionClasspath();
-    
-    
-    /**
-     * Get path(s) for VDB(s) that are availble from the configuration to the DQP
-     * engine. 
-     * @return URLs to the resources.
-     */
-    public URL[] getVDBLocations();
-    
-    
-    /**
      * Use disk for buffering for result set management during the processing 
      * @return true if yes to use buffering; false otherwise
      */
@@ -382,8 +242,6 @@
      */
     void loadUDF() throws MetaMatrixComponentException;
     
-    void clearClassLoaderCache() throws MetaMatrixComponentException;
-    
     boolean isFullyConfiguredVDB(VDBArchive vdb) throws MetaMatrixComponentException;
     
     String getClusterName();

Modified: branches/JCA/engine/src/main/java/com/metamatrix/dqp/service/DataService.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/dqp/service/DataService.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/com/metamatrix/dqp/service/DataService.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -23,24 +23,16 @@
 package com.metamatrix.dqp.service;
 
 import java.util.Collection;
-import java.util.List;
-import java.util.Properties;
 
-import org.teiid.adminapi.ConnectionPool;
 import org.teiid.connector.metadata.runtime.ConnectorMetadata;
-import org.teiid.dqp.internal.process.DQPWorkContext;
 
-import com.metamatrix.api.exception.ComponentNotFoundException;
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.common.application.ApplicationService;
-import com.metamatrix.common.application.exception.ApplicationLifecycleException;
 import com.metamatrix.common.comm.api.ResultsReceiver;
-import com.metamatrix.common.config.api.ConnectorBinding;
-import com.metamatrix.dqp.internal.datamgr.ConnectorID;
+import com.metamatrix.common.queue.WorkerPoolStats;
 import com.metamatrix.dqp.message.AtomicRequestID;
 import com.metamatrix.dqp.message.AtomicRequestMessage;
 import com.metamatrix.dqp.message.AtomicResultsMessage;
-import com.metamatrix.dqp.message.RequestMessage;
 import com.metamatrix.query.optimizer.capabilities.SourceCapabilities;
 
 /**
@@ -51,26 +43,18 @@
 public interface DataService extends ApplicationService {
 
     /**
-     * Select a connector to use for the given connector binding.
-     * @param connectorBindingName Connector binding identifier
-     * @return ConnectorID identifying a connector instance
-     */
-    ConnectorID selectConnector(String connectorBindingName) 
-        throws MetaMatrixComponentException;
-    
-    /**
      * Execute the given request on a <code>Connector</code>.
      * @param request
      * @return
      */
-    void executeRequest(AtomicRequestMessage request, ConnectorID connector, ResultsReceiver<AtomicResultsMessage> resultListener) 
+    void executeRequest(AtomicRequestMessage request, String deployedConnectorName, ResultsReceiver<AtomicResultsMessage> resultListener) 
         throws MetaMatrixComponentException;
     
-	void cancelRequest(AtomicRequestID request, ConnectorID connectorId) throws MetaMatrixComponentException;
+	void cancelRequest(AtomicRequestID request, String deployedConnectorName) throws MetaMatrixComponentException;
 
-	void closeRequest(AtomicRequestID request, ConnectorID connectorId) throws MetaMatrixComponentException;
+	void closeRequest(AtomicRequestID request, String deployedConnectorName) throws MetaMatrixComponentException;
 	
-	void requestBatch(AtomicRequestID request, ConnectorID connectorId) throws MetaMatrixComponentException;
+	void requestBatch(AtomicRequestID request, String deployedConnectorName) throws MetaMatrixComponentException;
 
     /**
      * Find the capabilities of this source.
@@ -78,7 +62,7 @@
      * @param connector Connector to retrieve capabilities from
      * @return All capability information as key-value pairs
      */
-    SourceCapabilities getCapabilities(RequestMessage request, DQPWorkContext dqpWorkContext, ConnectorID connector) 
+    SourceCapabilities getCapabilities(String connectorName) 
         throws MetaMatrixComponentException;
     
     /**
@@ -86,70 +70,12 @@
      * @param vdbName
      * @param vdbVersion
      * @param modelName
-     * @param importProperties
      * @return
      * @throws MetaMatrixComponentException 
      */
-    ConnectorMetadata getConnectorMetadata(String vdbName, String vdbVersion, String modelName, Properties importProperties) throws MetaMatrixComponentException;
-               
+    ConnectorMetadata getConnectorMetadata(String vdbName, String vdbVersion, String modelName) throws MetaMatrixComponentException;
+                   
     /**
-     * Start the Connector Binding by the name given, if it is already added and not srarted. 
-     * @param connectorBindingName
-     * @throws ApplicationLifecycleException
-     * @throws ComponentNotFoundException
-     * @since 4.3
-     */
-    void startConnectorBinding(String connectorBindingName)
-        throws ApplicationLifecycleException, MetaMatrixComponentException;
-
-    /**
-     * Stop the Connector Binding by the given name 
-     * @param connectorBindingName
-     * @throws ApplicationLifecycleException
-     * @throws ComponentNotFoundException
-     * @since 4.3
-     */
-    void stopConnectorBinding(String connectorBindingName) 
-        throws ApplicationLifecycleException, MetaMatrixComponentException;
-    
-    /**
-     * Get the list of connector bindings deployed in the system. 
-     * @return list {@link com.metamatrix.common.config.api.ConnectorBinding}
-     * @throws ComponentNotFoundException
-     * @since 4.3
-     */
-    List getConnectorBindings() throws MetaMatrixComponentException;
-    
-
-    /**
-     * Get the connector binding specifed the name 
-     * @return ConnectorBinding
-     * @throws ComponentNotFoundException
-     * @since 4.3
-     */
-    ConnectorBinding getConnectorBinding(String connectorBindingName) 
-        throws MetaMatrixComponentException;
-    
-    /**
-     * Get the State of the connector binding name 
-     * @return {@link ConnectorStatus}
-     * @throws MetaMatrixComponentException
-     * @since 4.3
-     */
-    ConnectorStatus getConnectorBindingState(String connectorBindingName) 
-        throws MetaMatrixComponentException;
-    
-    /**
-     * Get connector bindings queue statistics 
-     * @param connectorBindingName - Name of the connector binding
-     * @return a list of {@link com.metamatrix.common.queue.WorkerPoolStats}
-     * @throws MetaMatrixComponentException
-     * @since 4.3
-     */
-    Collection getConnectorBindingStatistics(String connectorBindingName)
-        throws MetaMatrixComponentException;
-    
-    /**
      * Clear any caches for the connector binding. Incase of the JDBC Connector
      * clear the result set cache. 
      * @param connectorBindingName
@@ -159,13 +85,5 @@
     void clearConnectorBindingCache(String connectorBindingName) 
         throws MetaMatrixComponentException;
     
-    /**
-     * Get connection pool statistics for connector binding 
-     * @param connectorBindingName - Name of the connector binding
-     * @return a list of {@link com.metamatrix.admin.objects.ConnectionPoolStatsImpl}
-     * @throws MetaMatrixComponentException
-     * @since 6.1
-     */
-    Collection<? extends ConnectionPool> getConnectionPoolStatistics(String connectorBindingName)
-        throws MetaMatrixComponentException;
+    public Collection<WorkerPoolStats> getConnectorStatistics(String deployedConnectorName) throws MetaMatrixComponentException;    
 }

Added: branches/JCA/engine/src/main/java/com/metamatrix/dqp/service/TransactionContext.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/dqp/service/TransactionContext.java	                        (rev 0)
+++ branches/JCA/engine/src/main/java/com/metamatrix/dqp/service/TransactionContext.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,104 @@
+/*
+ * 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.dqp.service;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.resource.spi.work.ExecutionContext;
+
+public class TransactionContext extends ExecutionContext implements Serializable{
+
+	private static final long serialVersionUID = -8689401273499649058L;
+
+	public enum Scope {
+		BLOCK,
+		GLOBAL,
+		LOCAL,
+		NONE,
+		REQUEST
+	}
+	
+    private String threadId;
+    private Scope transactionType = Scope.NONE;
+    private long creationTime;
+    private boolean rollback = false;
+    private Set<String> suspendedBy = Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>());
+    boolean inTransaction = false;
+    
+    public boolean isInTransaction() {
+        return (getXid() != null && inTransaction);
+    }
+
+    public long getCreationTime() {
+		return creationTime;
+	}
+    
+    public void setCreationTime(long time) {
+		this.creationTime = time;
+	}    
+    
+    public void setTransactionType(Scope transactionType) {
+        this.transactionType = transactionType;
+    }
+
+    public Scope getTransactionType() {
+        return transactionType;
+    }
+
+    public void setThreadId(String threadId) {
+        this.threadId = threadId;
+    }
+
+    public String getThreadId() {
+        return threadId;
+    }
+
+    public String toString() {
+        StringBuffer sb = new StringBuffer();
+        this.buildString(sb);
+        return sb.toString();
+    }
+
+    private void buildString(StringBuffer sb) {
+        sb.append("xid: ").append(getXid()); //$NON-NLS-1$
+    }
+    
+    public void setRollbackOnly() {
+    	this.rollback = true;
+    }
+    
+    public boolean shouldRollback() {
+    	return this.rollback;
+    }
+    
+    public Set<String> getSuspendedBy() {
+        return this.suspendedBy;
+    }
+
+	public void inTransaction(boolean flag) {
+		this.inTransaction = flag;
+	}    
+}
\ No newline at end of file


Property changes on: branches/JCA/engine/src/main/java/com/metamatrix/dqp/service/TransactionContext.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: branches/JCA/engine/src/main/java/com/metamatrix/dqp/service/TransactionService.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/dqp/service/TransactionService.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/com/metamatrix/dqp/service/TransactionService.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -26,95 +26,54 @@
 
 import java.util.Collection;
 
-import javax.transaction.InvalidTransactionException;
-import javax.transaction.SystemException;
-import javax.transaction.TransactionManager;
-import javax.transaction.xa.XAResource;
 import javax.transaction.xa.Xid;
 
 import org.teiid.adminapi.AdminException;
 import org.teiid.adminapi.Transaction;
-import org.teiid.connector.xa.api.TransactionContext;
-import org.teiid.dqp.internal.transaction.TransactionProvider.XAConnectionSource;
 
 import com.metamatrix.common.application.ApplicationService;
 import com.metamatrix.common.xa.MMXid;
 import com.metamatrix.common.xa.XATransactionException;
-import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
 
 /**
  */
 public interface TransactionService extends ApplicationService {
-	public static final String TRANSACTIONS_ENABLED = "xa.enabled"; //$NON-NLS-1$
-    public static final String MAX_TIMEOUT = "xa.max_timeout"; //$NON-NLS-1$
-    public static final String TXN_STORE_DIR = "xa.txnstore_dir"; //$NON-NLS-1$
-    public static final String TXN_STATUS_PORT = "xa.txnstatus_port"; //$NON-NLS-1$
-    public static final String TXN_ENABLE_RECOVERY = "xa.enable_recovery"; //$NON-NLS-1$
     
-    public static final String PROCESSNAME = DQPEmbeddedProperties.PROCESSNAME;
-    
-    public static final String DEFAULT_TXN_MGR_LOG_DIR = "txnlog"; //$NON-NLS-1$
-    public static final String DEFAULT_TXN_TIMEOUT = "120"; //$NON-NLS-1$ //2 mins
-    public static final String DEFAULT_TXN_STATUS_PORT = "0"; //$NON-NLS-1$
-    
-    TransactionManager getTransactionManager();
-
     // processor level methods
-    TransactionContext start(TransactionContext context) throws XATransactionException, SystemException;
+    TransactionContext start(TransactionContext context) throws XATransactionException;
 
-    TransactionContext commit(TransactionContext context) throws XATransactionException, SystemException;
+    TransactionContext commit(TransactionContext context) throws XATransactionException;
 
-    TransactionContext rollback(TransactionContext context) throws XATransactionException, SystemException;
+    TransactionContext rollback(TransactionContext context) throws XATransactionException;
 
     TransactionContext getOrCreateTransactionContext(String threadId);
 
     // local transaction methods
-    TransactionContext begin(String threadId) throws XATransactionException, SystemException;
+    TransactionContext begin(String threadId) throws XATransactionException;
 
-    void commit(String threadId) throws XATransactionException, SystemException;
+    void commit(String threadId) throws XATransactionException;
 
-    void rollback(String threadId) throws XATransactionException, SystemException;
+    void rollback(String threadId) throws XATransactionException;
 
-    void cancelTransactions(String threadId, boolean requestOnly) throws InvalidTransactionException, SystemException;
+    void cancelTransactions(String threadId, boolean requestOnly) throws XATransactionException;
 
     // global transaction methods
-    int prepare(final String threadId,
-            MMXid xid) throws XATransactionException;
+    int prepare(final String threadId, MMXid xid) throws XATransactionException;
 
-	void commit(final String threadId,
-	                   MMXid xid,
-	                   boolean onePhase) throws XATransactionException;
+	void commit(final String threadId, MMXid xid, boolean onePhase) throws XATransactionException;
 	
-	void rollback(final String threadId,
-	                     MMXid xid) throws XATransactionException;
+	void rollback(final String threadId, MMXid xid) throws XATransactionException;
 	
 	Xid[] recover(int flag) throws XATransactionException;
 	
-	void forget(final String threadId,
-	            MMXid xid) throws XATransactionException;
+	void forget(final String threadId, MMXid xid) throws XATransactionException;
 	
-	void start(final String threadId,
-	           MMXid xid,
-	           int flags,
-	           int timeout) throws XATransactionException;
+	void start(final String threadId, MMXid xid, int flags, int timeout) throws XATransactionException;
 	
-	void end(final String threadId,
-	         MMXid xid,
-	         int flags) throws XATransactionException;
+	void end(final String threadId, MMXid xid, int flags) throws XATransactionException;
         
 	// management methods
     Collection<Transaction> getTransactions();
     
     void terminateTransaction(Xid transactionId) throws AdminException;
-    
-    void terminateTransaction(String transactionId, String sessionId) throws AdminException;
-    
-    // Teiid managed XA
-    TransactionContext enlist(TransactionContext context,
-                              XAResource resource) throws XATransactionException;
-    
-    void registerRecoverySource(String name, XAConnectionSource resource);
-    
-    void removeRecoverySource(String name);  
-
 }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/dqp/util/LogConstants.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/dqp/util/LogConstants.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/com/metamatrix/dqp/util/LogConstants.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,10 +22,12 @@
 
 package com.metamatrix.dqp.util;
 
+import org.teiid.connector.basic.DefaultConnectorLogger;
+
 public interface LogConstants {
 	// add the new contexts to the Log4JUtil.java class, for configuration purpose
 	public static final String CTX_DQP = "DQP"; //$NON-NLS-1$
-    public static final String CTX_CONNECTOR = "CONNECTOR"; //$NON-NLS-1$
+    public static final String CTX_CONNECTOR = DefaultConnectorLogger.CTX_CONNECTOR;
     public static final String CTX_BUFFER_MGR = "BUFFER_MGR"; //$NON-NLS-1$
     public static final String CTX_STORAGE_MGR = "STORAGE_MGR"; //$NON-NLS-1$
     public static final String CTX_TXN_LOG = "TXN_LOG"; //$NON-NLS-1$

Modified: branches/JCA/engine/src/main/java/com/metamatrix/platform/security/api/MetaMatrixSessionInfo.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/platform/security/api/MetaMatrixSessionInfo.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/com/metamatrix/platform/security/api/MetaMatrixSessionInfo.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -40,7 +40,6 @@
     private Properties productInfo;
     private String clientIp;
     private String clientHostname;
-    private Serializable trustedToken;
 
     /**
      * Master constructor, allows a MetaMatrixSessionInfo to be created with
@@ -145,12 +144,4 @@
 	public String getClientHostname() {
 		return clientHostname;
 	}
-
-	public void setTrustedToken(Serializable trustedToken) {
-		this.trustedToken = trustedToken;
-	}
-
-	public Serializable getTrustedToken() {
-		return trustedToken;
-	}
 }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/platform/security/api/service/AuthenticationToken.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/platform/security/api/service/AuthenticationToken.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/com/metamatrix/platform/security/api/service/AuthenticationToken.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -34,13 +34,6 @@
  * <p></p>
  */
 public interface AuthenticationToken extends Serializable {
-
-    /**
-     * Get the payload token that has been successfully authentcated by a
-     * membership domain.
-     * @return The successfully authenticated token unmodified.
-     */
-    Serializable getPayload();
     
     /**
      * Get the <b>exact</b> username of the authenticated user as it

Modified: branches/JCA/engine/src/main/java/com/metamatrix/platform/security/api/service/MembershipServiceInterface.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/platform/security/api/service/MembershipServiceInterface.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/com/metamatrix/platform/security/api/service/MembershipServiceInterface.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,7 +22,6 @@
 
 package com.metamatrix.platform.security.api.service;
 
-import java.io.Serializable;
 import java.util.List;
 import java.util.Set;
 
@@ -84,7 +83,7 @@
      * @throws MetaMatrixSecurityException if there is an error within this
      * service or during communicating with the underlying service provider
      */
-    AuthenticationToken authenticateUser(String username, Credentials credential, Serializable trustePayload, String applicationName)
+    AuthenticationToken authenticateUser(String username, Credentials credential, String applicationName)
     throws MembershipServiceException;
 
     /**

Modified: branches/JCA/engine/src/main/java/com/metamatrix/platform/security/api/service/SessionServiceInterface.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/platform/security/api/service/SessionServiceInterface.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/com/metamatrix/platform/security/api/service/SessionServiceInterface.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -68,7 +68,6 @@
      */
     public MetaMatrixSessionInfo createSession(String userName,
                                                Credentials credentials,
-                                               Serializable trustedToken,
                                                String applicationName,
                                                Properties properties)
             throws MetaMatrixAuthenticationException, SessionServiceException;

Modified: branches/JCA/engine/src/main/java/com/metamatrix/platform/security/api/service/SuccessfulAuthenticationToken.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/platform/security/api/service/SuccessfulAuthenticationToken.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/com/metamatrix/platform/security/api/service/SuccessfulAuthenticationToken.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -26,8 +26,6 @@
  */
 package com.metamatrix.platform.security.api.service;
 
-import java.io.Serializable;
-
 import com.metamatrix.platform.security.api.SecurityMessagesKeys;
 import com.metamatrix.platform.security.api.SecurityPlugin;
 
@@ -48,7 +46,6 @@
  * <p>This wrapper class will not be exposed outside of the Membership framework.</p>
  */
 public final class SuccessfulAuthenticationToken implements AuthenticationToken {
-    private Serializable payload;
     private String username;
     private String domainName;
 
@@ -67,24 +64,14 @@
      * exactly as it is known by the authenticating membership domain. May <b>not</b>
      * be <code>null</code>.
      */
-    public SuccessfulAuthenticationToken(final Serializable payload, final String username) {
+    public SuccessfulAuthenticationToken(final String username) {
         if (username == null || username.trim().length() == 0) {
             throw new IllegalArgumentException(SecurityPlugin.Util.getString(SecurityMessagesKeys.SEC_API_0061));
         }
-        this.payload = payload;
         this.username = username;
     }
 
     /**
-     * Get the payload token that has been successfully authenticated by a
-     * membership domain.
-     * @return The successfully authenticated token unmodified.
-     */
-    public Serializable getPayload() {
-        return payload;
-    }
-
-    /**
      * Get the <b>exact</b> username of the authenticated user as it
      * is known to the authenticating membership domain.
      * <p><b>Will be <code>null</code> if the user was <b>not</b>

Modified: branches/JCA/engine/src/main/java/com/metamatrix/server/serverapi/RequestInfo.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/server/serverapi/RequestInfo.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/com/metamatrix/server/serverapi/RequestInfo.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -25,6 +25,8 @@
 import java.io.Serializable;
 import java.util.Date;
 
+import javax.transaction.xa.Xid;
+
 import com.metamatrix.dqp.message.RequestID;
 import com.metamatrix.platform.security.api.SessionToken;
 
@@ -35,6 +37,8 @@
 
 public class RequestInfo implements Serializable {
 
+	private static final long serialVersionUID = -2779106368517784259L;
+	
 	private RequestID requestID;
     private String command;
     private SessionToken token;
@@ -43,7 +47,7 @@
     private boolean isSubscription;
     private int nodeID = Integer.MIN_VALUE;
     private String connectorBindingUUID;
-    private String transactionId;
+    private Xid xid;
     private int executionID;
     
     public RequestInfo(RequestID requestId, String originalCommand, Date submittedTime, Date processingTime) {
@@ -152,13 +156,13 @@
     }
 
 
-	public String getTransactionId() {
-		return transactionId;
+	public Xid getXid() {
+		return this.xid;
 	}
 
 
-	public void setTransactionId(String transactionId) {
-		this.transactionId = transactionId;
+	public void setXid(Xid id) {
+		this.xid = id;
 	}
 	
     @Override

Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/AsynchConnectorWorkItem.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/AsynchConnectorWorkItem.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/AsynchConnectorWorkItem.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,7 +22,10 @@
 
 package org.teiid.dqp.internal.datamgr.impl;
 
+import org.teiid.connector.api.ConnectorException;
+
 import com.metamatrix.common.comm.api.ResultsReceiver;
+import com.metamatrix.core.MetaMatrixRuntimeException;
 import com.metamatrix.dqp.message.AtomicRequestMessage;
 import com.metamatrix.dqp.message.AtomicResultsMessage;
 
@@ -34,13 +37,21 @@
     
     @Override
     protected boolean dataNotAvailable(long delay) {
-    	this.manager.scheduleTask(this, delay);
+    	try {
+			this.manager.scheduleTask(this, delay);
+		} catch (ConnectorException e) {
+			throw new MetaMatrixRuntimeException(e.getCause());
+		}
     	return false;
     }
     
 	@Override
     protected void resumeProcessing() {
-    	this.manager.reenqueueRequest(this);
+    	try {
+			this.manager.reenqueueRequest(this);
+		} catch (ConnectorException e) {
+			throw new MetaMatrixRuntimeException(e.getCause());
+		}
     }
 
 }
\ No newline at end of file

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorEnvironmentImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorEnvironmentImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorEnvironmentImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,224 +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 10, 2003
- * Time: 3:58:41 PM
- */
-package org.teiid.dqp.internal.datamgr.impl;
-
-import java.util.Properties;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.TimeUnit;
-
-import org.teiid.connector.api.CacheScope;
-import org.teiid.connector.api.ConnectorEnvironment;
-import org.teiid.connector.api.ConnectorLogger;
-import org.teiid.connector.api.ConnectorPropertyNames;
-import org.teiid.connector.api.TypeFacility;
-import org.teiid.connector.language.ILanguageFactory;
-import org.teiid.dqp.internal.cache.DQPContextCache;
-import org.teiid.dqp.internal.datamgr.language.LanguageFactoryImpl;
-import org.teiid.dqp.internal.process.DQPWorkContext;
-
-import com.metamatrix.cache.Cache;
-import com.metamatrix.common.application.ApplicationEnvironment;
-import com.metamatrix.common.queue.WorkerPool;
-import com.metamatrix.dqp.DQPPlugin;
-import com.metamatrix.dqp.service.BufferService;
-import com.metamatrix.dqp.service.DQPServiceNames;
-
-/**
- * Default Connector Environment. 
- */
-public class ConnectorEnvironmentImpl implements ConnectorEnvironment {
-    
-    private final class ContextClassLoaderPreservingRunnable implements
-			Runnable {
-		private final Runnable arg0;
-		private final ClassLoader cl = Thread.currentThread().getContextClassLoader();
-
-		private ContextClassLoaderPreservingRunnable(Runnable arg0) {
-			this.arg0 = arg0;
-		}
-
-		@Override
-		public void run() {
-			ClassLoader current = Thread.currentThread().getContextClassLoader();
-			Thread.currentThread().setContextClassLoader(cl);
-			try {
-				arg0.run();
-			} finally {
-				Thread.currentThread().setContextClassLoader(current);
-			}
-		}
-	}
-
-	private static final TypeFacility TYPE_FACILITY = new TypeFacilityImpl();
-    
-    private ConnectorLogger logger;
-    private Properties properties;
-    private ApplicationEnvironment env;
-    private WorkerPool workerPool;
-    
-    
-    public ConnectorEnvironmentImpl(Properties connectorProperties, ConnectorLogger logger, ApplicationEnvironment env) {
-    	this(connectorProperties, logger, env, null);
-    }
-    /**
-     * ctor  
-     * @param connectorProperties - Properties required for this Connector
-     * @param logger - Logger to be used by the Connector
-     * @param env - Connector Environment.
-     */
-    public ConnectorEnvironmentImpl(Properties connectorProperties, ConnectorLogger logger, ApplicationEnvironment env, WorkerPool workerPool) {
-        this.properties = connectorProperties;
-        this.logger = logger;
-        this.env = env;
-        this.workerPool = workerPool;
-    }
-    
-    /**  
-     * @see org.teiid.connector.api.ConnectorEnvironment#getProperties()
-     */
-    public Properties getProperties() {
-        return this.properties;
-    }
-
-    /**  
-     * @see org.teiid.connector.api.ConnectorEnvironment#getConnectorName() 
-     */
-    public String getConnectorName() {
-        return this.properties.getProperty(ConnectorPropertyNames.CONNECTOR_BINDING_NAME);
-    }
-
-    /**
-     * Aquire the logger that the connector using this environment will
-     * use to log messages.
-     * @return The {@link com.metamatrix.data.ConnectorLogger} for this Connector.
-     */
-    public ConnectorLogger getLogger() {
-        return this.logger;
-    }
-   
-    /**
-     * Implement the InternalConnectorEnvironment to allow access for internal connectors
-     * to standard Connector Manager resources.  For now this is just access to other
-     * connector manager services.
-     * @param resourceName Resource name - for now only valid names are DQP service names
-     * @return The service as requested 
-     * @see com.metamatrix.dqp.datamgr.InternalConnectorEnvironment#findResource(java.lang.String)
-     */
-    public Object findResource(String resourceName) {
-        return env.findService(resourceName);
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorEnvironment#getLanguageFactory()
-     */
-    public ILanguageFactory getLanguageFactory() {
-        return LanguageFactoryImpl.INSTANCE;
-    }
-
-    /**  
-     * @see org.teiid.connector.api.ConnectorEnvironment#getTypeFacility()
-     */
-    public TypeFacility getTypeFacility() {
-        return TYPE_FACILITY;
-    }
-
-	@Override
-	public void execute(Runnable command) {
-		if (this.workerPool != null) {
-			this.workerPool.execute(new ContextClassLoaderPreservingRunnable(command));
-		} else {
-			command.run();
-		}
-	}               
-	
-	@Override
-	public ScheduledFuture<?> scheduleAtFixedRate(Runnable command,
-			long initialDelay, long period, TimeUnit unit) {
-		if (this.workerPool != null) {
-			return this.workerPool.scheduleAtFixedRate(new ContextClassLoaderPreservingRunnable(command), initialDelay, period, unit);
-		}
-		return null;
-	}
-	
-	@Override
-	public Object getFromCache(CacheScope scope, Object key) {
-		DQPWorkContext context = DQPWorkContext.getWorkContext();
-		checkScopeValidity(scope, context);
-
-		Cache cache = getScopedCache(scope, context);
-		if (cache != null) {
-			return cache.get(key);
-		}
-		return null;
-	}
-	
-	@Override
-	public void storeInCache(CacheScope scope, Object key, Object value) {
-		DQPWorkContext context = DQPWorkContext.getWorkContext();
-		checkScopeValidity(scope, context);
-		Cache cache = getScopedCache(scope, context);
-		if (cache != null) {
-			cache.put(key, value);
-		}
-	}
-	
-	private Cache getScopedCache(CacheScope scope, DQPWorkContext context) {
-		BufferService service = (BufferService) findResource(DQPServiceNames.BUFFER_SERVICE);
-		if (service != null) {
-			DQPContextCache contextCache = service.getContextCache();
-			switch (scope) {
-			case SERVICE:
-				return contextCache.getServiceScopedCache(properties.getProperty(ConnectorPropertyNames.CONNECTOR_ID));
-			case SESSION:
-				return contextCache.getSessionScopedCache(context.getSessionToken().getSessionIDValue());
-			case VDB:
-				return contextCache.getVDBScopedCache(context.getVdbName(), context.getVdbVersion());
-			case GLOBAL:
-				return contextCache.getGlobalScopedCache();
-			}
-		}
-		return null;
-	}
-	
-	
-	private void checkScopeValidity(CacheScope scope, DQPWorkContext context) {
-		if (scope == CacheScope.REQUEST) {
-			throw new IllegalStateException(DQPPlugin.Util.getString("ConnectorEnvironmentImpl.request_scope_error")); //$NON-NLS-1$
-		}
-		
-		if (scope == CacheScope.SESSION) {
-			if (context == null || context.getSessionToken() == null) {
-				throw new IllegalStateException(DQPPlugin.Util.getString("ConnectorEnvironmentImpl.session_scope_error")); //$NON-NLS-1$
-			}
-		}
-		else if (scope == CacheScope.VDB) {
-			if (context == null || context.getVdbName() == null || context.getVdbVersion() == null) {
-				throw new IllegalStateException(DQPPlugin.Util.getString("ConnectorEnvironmentImpl.vdb_scope_error")); //$NON-NLS-1$
-			}
-		}
-	}
-}

Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -26,65 +26,50 @@
  */
 package org.teiid.dqp.internal.datamgr.impl;
 
-import java.io.Serializable;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Properties;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.TimeUnit;
 
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.resource.spi.work.Work;
+import javax.resource.spi.work.WorkException;
+import javax.resource.spi.work.WorkManager;
+
 import org.teiid.connector.api.Connection;
 import org.teiid.connector.api.Connector;
 import org.teiid.connector.api.ConnectorCapabilities;
 import org.teiid.connector.api.ConnectorEnvironment;
 import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.api.ConnectorPropertyNames;
 import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.api.ConnectorAnnotations.ConnectionPooling;
-import org.teiid.connector.api.ConnectorAnnotations.SynchronousWorkers;
 import org.teiid.connector.metadata.runtime.ConnectorMetadata;
-import org.teiid.connector.metadata.runtime.MetadataFactory;
-import org.teiid.connector.xa.api.XAConnector;
 import org.teiid.dqp.internal.cache.DQPContextCache;
 import org.teiid.dqp.internal.cache.ResultSetCache;
 import org.teiid.dqp.internal.datamgr.CapabilitiesConverter;
-import org.teiid.dqp.internal.pooling.connector.PooledConnector;
-import org.teiid.dqp.internal.process.DQPWorkContext;
 
-import com.metamatrix.admin.objects.MMConnectionPool;
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.common.application.ApplicationEnvironment;
 import com.metamatrix.common.application.ApplicationService;
-import com.metamatrix.common.application.ClassLoaderManager;
+import com.metamatrix.common.application.exception.ApplicationInitializationException;
 import com.metamatrix.common.application.exception.ApplicationLifecycleException;
 import com.metamatrix.common.comm.api.ResultsReceiver;
 import com.metamatrix.common.log.LogManager;
-import com.metamatrix.common.queue.WorkerPool;
-import com.metamatrix.common.queue.WorkerPoolFactory;
+import com.metamatrix.common.queue.StatsCapturingWorkManager;
 import com.metamatrix.common.queue.WorkerPoolStats;
-import com.metamatrix.common.util.PropertiesUtils;
-import com.metamatrix.core.MetaMatrixCoreException;
 import com.metamatrix.core.log.MessageLevel;
 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.ResourceFinder;
-import com.metamatrix.dqp.internal.datamgr.ConnectorID;
 import com.metamatrix.dqp.message.AtomicRequestID;
 import com.metamatrix.dqp.message.AtomicRequestMessage;
 import com.metamatrix.dqp.message.AtomicResultsMessage;
-import com.metamatrix.dqp.message.RequestID;
 import com.metamatrix.dqp.service.BufferService;
 import com.metamatrix.dqp.service.CommandLogMessage;
 import com.metamatrix.dqp.service.ConnectorStatus;
 import com.metamatrix.dqp.service.DQPServiceNames;
 import com.metamatrix.dqp.service.MetadataService;
-import com.metamatrix.dqp.service.TransactionService;
 import com.metamatrix.dqp.util.LogConstants;
 import com.metamatrix.query.optimizer.capabilities.BasicSourceCapabilities;
 import com.metamatrix.query.optimizer.capabilities.SourceCapabilities;
@@ -96,107 +81,75 @@
  * and its associated workers' state.
  */
 public class ConnectorManager implements ApplicationService {
-
 	public static final int DEFAULT_MAX_THREADS = 20;
-    private static final String DEFAULT_MAX_RESULTSET_CACHE_SIZE = "20"; //$NON-NLS-1$
-    private static final String DEFAULT_MAX_RESULTSET_CACHE_AGE = "3600000"; //$NON-NLS-1$
-
-    //state constructed in start
-    private ConnectorWrapper connector;
-    private ConnectorID connectorID;
-    private WorkerPool connectorWorkerPool;
-    private ResultSetCache rsCache;
-    private ConnectorWorkItemFactory workItemFactory;
 	private String connectorName;
-    private int maxResultRows;
-    private boolean exceptionOnMaxRows = true;
-    private boolean synchWorkers;
-    private boolean isXa;
-    private boolean isImmutable;
+	    
+    private StatsCapturingWorkManager workManager;
+    protected ResultSetCache rsCache;
+    protected ConnectorWorkItemFactory workItemFactory;
     
     private volatile ConnectorStatus state = ConnectorStatus.NOT_INITIALIZED;
 
     //services acquired in start
     private MetadataService metadataService;
-    private TransactionService transactionService;
     private BufferService bufferService;
     
-    private ClassLoaderManager clManager;
-
     // known requests
     private ConcurrentHashMap<AtomicRequestID, ConnectorWorkItem> requestStates = new ConcurrentHashMap<AtomicRequestID, ConnectorWorkItem>();
 
-    private Properties props;
-	private ClassLoader classloader;
     
-    public void initialize(Properties props) {
-    	this.props = props;
-    	this.isImmutable = PropertiesUtils.getBooleanProperty(props, ConnectorPropertyNames.IS_IMMUTABLE, false);
+    public ConnectorManager(String name, WorkManager workManager) {
+    	if (name == null) {
+    		throw new IllegalArgumentException("Connector name can not be null");
+    	}
+    	this.connectorName = name;
+    	this.workManager = new StatsCapturingWorkManager(this.connectorName, workManager, DEFAULT_MAX_THREADS);
     }
     
-    public boolean isImmutable() {
-        return isImmutable;
-    }
-
-    public ClassLoader getClassloader() {
-		return classloader;
+	@Override
+	public void initialize(Properties props) throws ApplicationInitializationException {
+		// TODO: this method needs to go away;
 	}
-    
-    public ConnectorMetadata getMetadata(String modelName, Properties importProperties) throws ConnectorException {
-    	MetadataFactory factory;
-		try {
-			factory = new MetadataFactory(modelName, this.metadataService.getBuiltinDatatypes(), importProperties);
-		} catch (MetaMatrixComponentException e) {
-			throw new ConnectorException(e);
-		}
-		Thread currentThread = Thread.currentThread();
-		ClassLoader threadContextLoader = currentThread.getContextClassLoader();
-		try {
-			currentThread.setContextClassLoader(classloader);
-			this.connector.getConnectorMetadata(factory);
-		} finally {
-			currentThread.setContextClassLoader(threadContextLoader);
-		}
-		return factory;
+	
+    public String getName() {
+        return this.connectorName;
+    }	
+	
+    public ConnectorMetadata getMetadata(String modelName) throws ConnectorException {
+    	Connection conn = null;
+    	try {
+    		checkStatus();
+	    	conn = getConnector().getConnection();
+	    	return conn.getModelMetaData(modelName, this.metadataService.getBuiltinDatatypes());
+    	} catch(MetaMatrixComponentException e) {
+    		throw new ConnectorException(e);
+    	} finally {
+    		if (conn != null) {
+    			conn.close();
+    		}
+    	}
 	}
     
-    public SourceCapabilities getCapabilities(RequestID requestID, Serializable executionPayload, DQPWorkContext message) throws ConnectorException {
+    public SourceCapabilities getCapabilities() throws ConnectorException {
         Connection conn = null;
-        // Defect 17536 - Set the thread-context classloader to the non-delegating classloader when calling
-        // methods on the connector.
-        Thread currentThread = Thread.currentThread();
-        ClassLoader threadContextLoader = currentThread.getContextClassLoader();
         try {
+        	checkStatus();
+        	Connector connector = getConnector();
         	ConnectorCapabilities caps = connector.getCapabilities();
-            currentThread.setContextClassLoader(classloader);
             boolean global = true;
             if (caps == null) {
-            	ExecutionContextImpl context = new ExecutionContextImpl(
-                        message.getVdbName(),
-                        message.getVdbVersion(),
-                        message.getUserName(),
-                        message.getTrustedPayload(),
-                        executionPayload,
-                        "capabilities-request", //$NON-NLS-1$
-                        connectorID.getID(), 
-                        requestID.toString(), 
-                        "capabilities-request", "0"); //$NON-NLS-1$ //$NON-NLS-2$ 
-            	
-            	context.setContextCache(getContextCache());
-
-            	conn = connector.getConnection(context, null);
+            	conn = connector.getConnection();
             	caps = conn.getCapabilities();
             	global = false;
             }
-            caps = (ConnectorCapabilities) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {ConnectorCapabilities.class}, new CapabilitesOverloader(caps, this.props));
-            BasicSourceCapabilities resultCaps = CapabilitiesConverter.convertCapabilities(caps, getName(), isXa);
+            
+            BasicSourceCapabilities resultCaps = CapabilitiesConverter.convertCapabilities(caps, getName(), connector.getConnectorEnvironment().isXaCapable());
             resultCaps.setScope(global?Scope.SCOPE_GLOBAL:Scope.SCOPE_PER_USER);
             return resultCaps;
         } finally {
         	if ( conn != null ) {
                 conn.close();
             }
-            currentThread.setContextClassLoader(threadContextLoader);
         }
     }
     
@@ -206,8 +159,9 @@
         }
     }
      
-    public void executeRequest(ResultsReceiver<AtomicResultsMessage> receiver, AtomicRequestMessage message) {
+    public void executeRequest(ResultsReceiver<AtomicResultsMessage> receiver, AtomicRequestMessage message) throws ConnectorException {
         // Set the connector ID to be used; if not already set. 
+    	checkStatus();
     	AtomicRequestID atomicRequestId = message.getAtomicRequestID();
     	LogManager.logDetail(LogConstants.CTX_CONNECTOR, new Object[] {atomicRequestId, "Create State"}); //$NON-NLS-1$
 
@@ -215,15 +169,20 @@
     	
         Assertion.isNull(requestStates.put(atomicRequestId, item), "State already existed"); //$NON-NLS-1$
         message.markProcessingStart();
-        enqueueRequest(item);
+		enqueueRequest(item);
     }
     
-    private void enqueueRequest(ConnectorWorkItem state) {
-        this.connectorWorkerPool.execute(state);
+    private void enqueueRequest(ConnectorWorkItem work) throws ConnectorException {
+        try {
+        	// TODO: install work listener; what can we use this for?
+			this.workManager.scheduleWork(work, 0, work.requestMsg.getTransactionContext(), null);
+		} catch (WorkException e) {
+			throw new ConnectorException(e);
+		}
     }
     
-    void reenqueueRequest(AsynchConnectorWorkItem state) {
-    	enqueueRequest(state);
+    void reenqueueRequest(AsynchConnectorWorkItem work)  throws ConnectorException {
+    	enqueueRequest(work);
     }
     
     ConnectorWorkItem getState(AtomicRequestID requestId) {
@@ -243,13 +202,7 @@
     	if (workItem == null) {
     		return; //already closed
     	}
-        ClassLoader contextloader = Thread.currentThread().getContextClassLoader();
-        try {
-        	Thread.currentThread().setContextClassLoader(classloader);
-    	    workItem.requestCancel();
-        } finally {
-        	Thread.currentThread().setContextClassLoader(contextloader);
-        }
+	    workItem.requestCancel();
     }
     
     public void closeRequest(AtomicRequestID requestId) {
@@ -266,13 +219,21 @@
      * @param delay The delay to wait (in ms) before executing the task
      * @since 4.3.3
      */
-    public void scheduleTask(final AsynchConnectorWorkItem state, long delay) {
-        this.connectorWorkerPool.schedule(new Runnable() {
-        	@Override
-        	public void run() {
-        		state.requestMore();
-        	}
-        }, delay, TimeUnit.MILLISECONDS);        
+    public void scheduleTask(final AsynchConnectorWorkItem state, long delay) throws ConnectorException {
+    	try {
+			this.workManager.scheduleWork(new Work() {
+				@Override
+				public void run() {
+					state.requestMore();
+				}
+				@Override
+				public void release() {
+					
+				}
+			}, delay, null, null);
+		} catch (WorkException e) {
+			throw new ConnectorException(e);
+		}        
     }
     
     /**
@@ -288,21 +249,6 @@
         return requestStates.size();
     }
     
-    public ConnectorStatus getStatus() {
-    	ConnectorWrapper connectorWrapper = this.connector;
-    	ConnectorStatus result = this.state;
-    	if (result != ConnectorStatus.OPEN) {
-    		return result;
-    	}
-        ClassLoader contextloader = Thread.currentThread().getContextClassLoader();
-        try {
-        	Thread.currentThread().setContextClassLoader(classloader);
-            return connectorWrapper.getStatus();
-        } finally {
-        	Thread.currentThread().setContextClassLoader(contextloader);
-        }
-    }
-    
     /**
      * initialize this <code>ConnectorManager</code>.
      */
@@ -311,174 +257,36 @@
     		return;
     	}
     	this.state = ConnectorStatus.INIT_FAILED;
-        connectorName = props.getProperty(ConnectorPropertyNames.CONNECTOR_BINDING_NAME, "Unknown_Binding_Name"); //$NON-NLS-1$
-        String connIDStr = props.getProperty(ConnectorPropertyNames.CONNECTOR_ID);
-        connectorID = new ConnectorID(connIDStr);
         
-        //connector Name - logical name<Unique Id>
-        connectorName = connectorName + '<' + connIDStr + '>';
-
         LogManager.logInfo(LogConstants.CTX_CONNECTOR, DQPPlugin.Util.getString("ConnectorManagerImpl.Initializing_connector", connectorName)); //$NON-NLS-1$
 
-        this.setTransactionService((TransactionService) env.findService(DQPServiceNames.TRANSACTION_SERVICE));
-
-        // Set the class name for the connector class
-        String connectorClassString = props.getProperty(ConnectorPropertyNames.CONNECTOR_CLASS);
-        if ( connectorClassString == null || connectorClassString.trim().length() == 0 ) {             
-            throw new ApplicationLifecycleException(DQPPlugin.Util.getString("Missing_required_property", new Object[]{ConnectorPropertyNames.CONNECTOR_CLASS, connectorName})); //$NON-NLS-1$
-        }
-
-        int maxThreads = PropertiesUtils.getIntProperty(props, ConnectorPropertyNames.MAX_CONNECTIONS, DEFAULT_MAX_THREADS);
-
-        connectorWorkerPool = WorkerPoolFactory.newWorkerPool(connectorName, maxThreads);
-
-        // Create the Connector env
-        Properties clonedProps = new Properties(this.props);
-        
-        ConnectorEnvironment connectorEnv = new ConnectorEnvironmentImpl(clonedProps, new DefaultConnectorLogger(connectorID), env, connectorWorkerPool);
-
-        // Get the metadata service
-        this.metadataService = (MetadataService) env.findService(DQPServiceNames.METADATA_SERVICE);
-        if ( this.metadataService == null ) {
-            throw new ApplicationLifecycleException(DQPPlugin.Util.getString("Failed_to_find_service", new Object[]{DQPServiceNames.METADATA_SERVICE, connectorName})); //$NON-NLS-1$
-        }
-
-        this.maxResultRows = PropertiesUtils.getIntProperty(props, ConnectorPropertyNames.MAX_RESULT_ROWS, 0);
-        this.exceptionOnMaxRows = PropertiesUtils.getBooleanProperty(props, ConnectorPropertyNames.EXCEPTION_ON_MAX_ROWS, false);
-    	this.synchWorkers = PropertiesUtils.getBooleanProperty(props, ConnectorPropertyNames.SYNCH_WORKERS, true);
-
+        setMetadataService((MetadataService) env.findService(DQPServiceNames.METADATA_SERVICE));
      	this.bufferService = (BufferService) env.findService(DQPServiceNames.BUFFER_SERVICE);
-        // Initialize and start the connector
-        initStartConnector(connectorEnv);
+     	
+     	ConnectorEnvironment connectorEnv = null;
+		
+     	try {
+			connectorEnv = getConnector().getConnectorEnvironment();
+		} catch (ConnectorException e) {
+			throw new ApplicationLifecycleException(e.getCause(), e.getMessage());
+		}
+    	
+    	if (!connectorEnv.isSynchWorkers() && connectorEnv.isXaCapable()) {
+    		throw new ApplicationLifecycleException(DQPPlugin.Util.getString("ConnectorManager.xa_capbility_not_supported", this.connectorName)); //$NON-NLS-1$
+    	}
+
         //check result set cache
-        if(PropertiesUtils.getBooleanProperty(props, ConnectorPropertyNames.USE_RESULTSET_CACHE, false)) {
+        if(connectorEnv.isResultSetCacheEnabled()) {
             Properties rsCacheProps = new Properties();
-        	rsCacheProps.setProperty(ResultSetCache.RS_CACHE_MAX_SIZE, props.getProperty(ConnectorPropertyNames.MAX_RESULTSET_CACHE_SIZE, DEFAULT_MAX_RESULTSET_CACHE_SIZE)); 
-        	rsCacheProps.setProperty(ResultSetCache.RS_CACHE_MAX_AGE, props.getProperty(ConnectorPropertyNames.MAX_RESULTSET_CACHE_AGE, DEFAULT_MAX_RESULTSET_CACHE_AGE)); 
-        	rsCacheProps.setProperty(ResultSetCache.RS_CACHE_SCOPE, props.getProperty(ConnectorPropertyNames.RESULTSET_CACHE_SCOPE, ResultSetCache.RS_CACHE_SCOPE_VDB)); 
+        	rsCacheProps.setProperty(ResultSetCache.RS_CACHE_MAX_SIZE, String.valueOf(connectorEnv.getResultSetCacheMaxSize())); 
+        	rsCacheProps.setProperty(ResultSetCache.RS_CACHE_MAX_AGE, String.valueOf(connectorEnv.getResultSetCacheMaxAge())); 
+        	rsCacheProps.setProperty(ResultSetCache.RS_CACHE_SCOPE, connectorEnv.getResultSetCacheScope()); 
     		this.rsCache = createResultSetCache(rsCacheProps);
         }
-		this.workItemFactory = new ConnectorWorkItemFactory(this, this.rsCache, synchWorkers);
+		this.workItemFactory = new ConnectorWorkItemFactory(this, this.rsCache, connectorEnv.isSynchWorkers());
     	this.state = ConnectorStatus.OPEN;
     }
-    
-	private String buildClasspath(Properties connectorProperties) {
-		StringBuilder sb = new StringBuilder();
-		appendlasspath(connectorProperties.getProperty(ConnectorPropertyNames.CONNECTOR_CLASSPATH), sb); // this is user defined, could be very specific to the binding
-        appendlasspath(connectorProperties.getProperty(ConnectorPropertyNames.CONNECTOR_TYPE_CLASSPATH), sb); // this is system defined; type classpath
-        return sb.toString();
-	}
-	
-	private void appendlasspath(String path, StringBuilder builder) {
-        if (path != null && path.length() > 0) {
-        	builder.append(path);
-        	if (!path.endsWith(";")) { //$NON-NLS-1$
-        		builder.append(";"); //$NON-NLS-1$
-        	}
-        }
-	} 
-	
-    /**
-     * Initialize and start the connector.
-     * @param env
-     * @throws ApplicationLifecycleException
-     */
-    private void initStartConnector(ConnectorEnvironment env) throws ApplicationLifecycleException {
-    	
-        String connectorClassName = env.getProperties().getProperty(ConnectorPropertyNames.CONNECTOR_CLASS);
-        
-        String classPath = buildClasspath(env.getProperties());
-
-        Thread currentThread = Thread.currentThread();
-        ClassLoader threadContextLoader = currentThread.getContextClassLoader();
-        
-        if (classPath == null || classPath.trim().length() == 0) {
-        	classloader = threadContextLoader;
-        } else {
-        	env.getProperties().setProperty(ConnectorPropertyNames.USING_CUSTOM_CLASSLOADER, Boolean.TRUE.toString());
-            
-            boolean postDelegation = PropertiesUtils.getBooleanProperty(env.getProperties(), ConnectorPropertyNames.USE_POST_DELEGATION, false);
-            
-            LogManager.logInfo(LogConstants.CTX_CONNECTOR, DQPPlugin.Util.getString("ConnectorManager.useClassloader", connectorName, postDelegation, classPath)); //$NON-NLS-1$
-            
-            if (postDelegation) {
-            	this.classloader = this.clManager.getPostDelegationClassLoader(classPath);
-            } else {
-            	this.classloader = this.clManager.getCommonClassLoader(classPath);
-            }
-        }
-        
-        try {
-        	currentThread.setContextClassLoader(classloader);
-        	Connector c;
-			try {
-				Object o = ReflectionHelper.create(connectorClassName, null, classloader);
-				if (o instanceof Connector) {
-					c = (Connector)o;
-					this.isXa = PropertiesUtils.getBooleanProperty(env.getProperties(), ConnectorPropertyNames.IS_XA, false);
-				} else {
-					try {
-						Class legacyConnector = classloader.loadClass("com.metamatrix.data.api.Connector"); //$NON-NLS-1$
-						if (!legacyConnector.isAssignableFrom(o.getClass())) {
-							throw new ApplicationLifecycleException(DQPPlugin.Util.getString("failed_legacy", connectorClassName)); //$NON-NLS-1$
-						}
-						c = (Connector)ReflectionHelper.create("com.metamatrix.dqp.internal.datamgr.ConnectorWrapper", new Object[] {o}, new Class[] {legacyConnector}, classloader); //$NON-NLS-1$
-						this.isXa = classloader.loadClass("com.metamatrix.data.xa.api.XAConnector").isAssignableFrom(o.getClass()); //$NON-NLS-1$
-					} catch (ClassNotFoundException e) {
-						throw new ApplicationLifecycleException(e, DQPPlugin.Util.getString("failed_legacy", connectorClassName)); //$NON-NLS-1$
-					} 
-				}
-			} catch (MetaMatrixCoreException e) {
-	            throw new ApplicationLifecycleException(e, DQPPlugin.Util.getString("failed_find_Connector_class", connectorClassName)); //$NON-NLS-1$
-			}
-            if (this.synchWorkers) {
-                SynchronousWorkers synchWorkerAnnotation = c.getClass().getAnnotation(SynchronousWorkers.class);
-            	if (synchWorkerAnnotation != null) {
-            		this.synchWorkers = synchWorkerAnnotation.enabled();
-            	}
-            	if (!this.synchWorkers) {
-            		LogManager.logDetail(LogConstants.CTX_CONNECTOR, "Changing asynch connector", getName(), "to non-XA.  Consider changing you're connector binding to be non-XA."); //$NON-NLS-1$ //$NON-NLS-2$
-            		this.isXa = false;
-            	}
-            }
-        	this.connector = wrapConnector(c, env);
-            this.connector.start(env);
-        } catch (ConnectorException e) {
-            throw new ApplicationLifecycleException(e, DQPPlugin.Util.getString("failed_start_Connector", new Object[] {this.getConnectorID(), e.getMessage()})); //$NON-NLS-1$
-        } finally {
-        	currentThread.setContextClassLoader(threadContextLoader);
-        }
-    }
-    
-    private ConnectorWrapper wrapConnector(Connector c, ConnectorEnvironment connectorEnv) throws ApplicationLifecycleException {
-    	//the pooling annotation overrides the connector binding
-        ConnectionPooling connectionPooling = c.getClass().getAnnotation(ConnectionPooling.class);
-    	boolean connectionPoolPropertyEnabled = PropertiesUtils.getBooleanProperty(connectorEnv.getProperties(), ConnectorPropertyNames.CONNECTION_POOL_ENABLED, true);
-    	boolean propertySet = connectorEnv.getProperties().contains(ConnectorPropertyNames.CONNECTION_POOL_ENABLED);
-    	boolean poolingEnabled = false;
-        if (propertySet) {
-        	poolingEnabled = connectionPoolPropertyEnabled && (connectionPooling == null || connectionPooling.enabled());
-        } else {
-        	poolingEnabled = connectionPooling != null && connectionPooling.enabled();
-        }
-		if (this.isXa) {
-            if(poolingEnabled && !(c instanceof XAConnector)){
-            	throw new ApplicationLifecycleException(DQPPlugin.Util.getString("non_xa_connector", connectorName)); //$NON-NLS-1$
-            }
-            if (this.getTransactionService() == null) {                    
-                throw new ApplicationLifecycleException(DQPPlugin.Util.getString("no_txn_manager", connectorName)); //$NON-NLS-1$
-            }
-		}
-        if (poolingEnabled) {
-           	LogManager.logDetail(LogConstants.CTX_CONNECTOR, "Automatic connection pooling was enabled for connector " + getName()); //$NON-NLS-1$
-        	if (!this.synchWorkers) {
-            	LogManager.logWarning(LogConstants.CTX_CONNECTOR, DQPPlugin.Util.getString("ConnectorManager.asynch_worker_warning", ConnectorPropertyNames.SYNCH_WORKERS)); //$NON-NLS-1$	                
-        	}
-        	return new PooledConnector(this.connectorName, c, isXa?this.getTransactionService():null);
-        }         
-        return new ConnectorWrapper(c);
-    }
-    
+       
     protected ResultSetCache createResultSetCache(Properties rsCacheProps) {
 		return new ResultSetCache(rsCacheProps, ResourceFinder.getCacheFactory());
 	}
@@ -493,39 +301,17 @@
         	}
             this.state= ConnectorStatus.CLOSED;
 		}
-        if (this.connectorWorkerPool != null) {
-        	this.connectorWorkerPool.shutdownNow();
-        }
+       	this.workManager.shutdownNow();
         
         //ensure that all requests receive a response
         for (ConnectorWorkItem workItem : this.requestStates.values()) {
         	try {
-        		workItem.resultsReceiver.exceptionOccurred(new ConnectorException(DQPPlugin.Util.getString("Connector_Shutting_down", new Object[] {workItem.id, connectorID}))); //$NON-NLS-1$
+        		workItem.resultsReceiver.exceptionOccurred(new ConnectorException(DQPPlugin.Util.getString("Connector_Shutting_down", new Object[] {workItem.id, this.connectorName}))); //$NON-NLS-1$
         	} catch (Exception e) {
         		//ignore
         	}
 		}
         
-        if ( this.connector != null ) {
-
-            if(this.isXa){
-                if (this.getTransactionService() != null) {
-                    TransactionService ts = this.getTransactionService();
-                    ts.removeRecoverySource(connectorName);
-                }
-            }
-            
-            Thread currentThread = Thread.currentThread();
-            ClassLoader threadContextLoader = currentThread.getContextClassLoader();
-            try {
-                currentThread.setContextClassLoader(classloader);
-                this.connector.stop();
-            } finally {
-                currentThread.setContextClassLoader(threadContextLoader);
-            }
-            
-        }
-        
         if (this.rsCache != null) {
         	this.rsCache.shutDown();
         	this.rsCache = null;
@@ -538,10 +324,7 @@
      * If there are no queues, an empty Collection is returned.
      */
     public Collection<WorkerPoolStats> getQueueStatistics() {
-        if ( this.connectorWorkerPool == null ) {
-            return Collections.emptyList();
-        }
-        return Arrays.asList(connectorWorkerPool.getStats());
+        return Arrays.asList(workManager.getStats());
     }
 
     /**
@@ -550,12 +333,10 @@
      * If there is no queue with the given name, an empty Collection is returned.
      */
     public Collection<WorkerPoolStats> getQueueStatistics(String name) {
-        if ( connectorID == null ||
-             !name.equalsIgnoreCase(connectorID.getID()) ||
-             connectorWorkerPool == null ) {
+        if (!name.equalsIgnoreCase(this.connectorName)) {
             return Collections.emptyList();
         }
-        return Arrays.asList(connectorWorkerPool.getStats());
+        return Arrays.asList(workManager.getStats());
     }
 
     /**
@@ -574,7 +355,7 @@
         String userName = qr.getWorkContext().getUserName();
         String transactionID = null;
         if ( qr.isTransactional() ) {
-            transactionID = qr.getTransactionContext().getTxnID();
+            transactionID = qr.getTransactionContext().getXid().toString();
         }
         
         String modelName = qr.getModelName();
@@ -606,18 +387,15 @@
      * manager.
      * @return the <code>Connector</code>.
      */
-    ConnectorWrapper getConnector() {
-        return this.connector;
+    Connector getConnector() throws ConnectorException {
+		try {
+			InitialContext ic  = new InitialContext();
+			return (Connector)ic.lookup(this.connectorName);    			
+		} catch (NamingException e) {
+			throw new ConnectorException(e, DQPPlugin.Util.getString("ConnectorManager.failed_to_lookup_connector", this.connectorName)); //$NON-NLS-1$
+		}
     }
     
-    void setConnector(ConnectorWrapper connector) {
-    	this.connector = connector;
-    }
-
-	int getMaxResultRows() {
-		return maxResultRows;
-	}
-
 	void setMetadataService(MetadataService metadataService) {
 		this.metadataService = metadataService;
 	}
@@ -625,88 +403,21 @@
 	MetadataService getMetadataService() {
 		return metadataService;
 	}
-
-	boolean isExceptionOnMaxRows() {
-		return exceptionOnMaxRows;
-	}
-
-	void setTransactionService(TransactionService transactionService) {
-		this.transactionService = transactionService;
-	}
-
-	TransactionService getTransactionService() {
-		return transactionService;
-	}
 	
-    /**
-     * The identifier that code will use to identify this object.
-     * @return The <code>ConnectorID</code>.
-     */
-    public ConnectorID getConnectorID() {
-        return connectorID;
-    }
-    
     DQPContextCache getContextCache() {
      	if (bufferService != null) {
     		return bufferService.getContextCache();
     	}
-
     	return null;
     }
     
-    /**
-     * Get the human-readable name that this connector is known by.
-     * <p>Will be <code>null</code> if connector is not started.</p>
-     * @return The connector's name.
-     */
-    public String getName() {
-        return this.connectorName;
+    public ConnectorStatus getStatus() {
+    	return this.state;
     }
-
-	void setConnectorWorkerPool(WorkerPool connectorWorkerPool) {
-		this.connectorWorkerPool = connectorWorkerPool;
-	}
-	
-	public boolean isXa() {
-		return isXa;
-	}
-	
-	public void setClassLoaderManager(ClassLoaderManager clManager) {
-		this.clManager = clManager;
-	}
-	
-	public void setWorkItemFactory(ConnectorWorkItemFactory workItemFactory) {
-		this.workItemFactory = workItemFactory;
-	}
-	
-	/**
-	 * Overloads the connector capabilities with one defined in the connector binding properties
-	 */
-    static final class CapabilitesOverloader implements InvocationHandler {
-    	ConnectorCapabilities caps; 
-    	Properties properties;
-    	
-    	CapabilitesOverloader(ConnectorCapabilities caps, Properties properties){
-    		this.caps = caps;
-    		this.properties = properties;
+    
+    private void checkStatus() throws ConnectorException {
+    	if (this.state != ConnectorStatus.OPEN) {
+    		throw new ConnectorException(DQPPlugin.Util.getString("ConnectorManager.not_in_valid_state", this.connectorName));
     	}
-    	
-		@Override
-		public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
-			String value = this.properties.getProperty(method.getName());
-			if (value == null || value.trim().length() == 0 || (args != null && args.length != 0)) {
-				return method.invoke(this.caps, args);
-			}
-			return StringUtil.valueOf(value, method.getReturnType());
-		}
-	}
-
-	public Collection<MMConnectionPool> getConnectionPoolStats() {
-	     if (connector instanceof  PooledConnector) {
-    	 	PooledConnector pc = (PooledConnector) connector;
-    	 	
-    	 	return pc.getConnectionPoolStats();
-	     }
-	     return Collections.emptyList();
-	}
+    }
 }

Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWorkItem.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWorkItem.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWorkItem.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -26,10 +26,9 @@
 import java.util.Arrays;
 import java.util.List;
 
-import javax.transaction.InvalidTransactionException;
-import javax.transaction.SystemException;
-
 import org.teiid.connector.api.Connection;
+import org.teiid.connector.api.Connector;
+import org.teiid.connector.api.ConnectorEnvironment;
 import org.teiid.connector.api.ConnectorException;
 import org.teiid.connector.api.DataNotAvailableException;
 import org.teiid.connector.api.Execution;
@@ -78,6 +77,7 @@
     
     /* Created on new request */
     protected Connection connection;
+    protected ConnectorEnvironment connectorEnv;
     protected ExecutionContextImpl securityContext;
     protected volatile ResultSetExecution execution;
     protected ProcedureBatchHandler procedureBatchHandler;
@@ -110,46 +110,40 @@
         this.resultsReceiver = resultsReceiver;
         AtomicRequestID requestID = this.requestMsg.getAtomicRequestID();
         this.securityContext = new ExecutionContextImpl(requestMsg.getWorkContext().getVdbName(),
-                requestMsg.getWorkContext().getVdbVersion(),
-                requestMsg.getWorkContext().getUserName(),
-                requestMsg.getWorkContext().getTrustedPayload(),
+                requestMsg.getWorkContext().getVdbVersion(),                
                 requestMsg.getExecutionPayload(),                                                                       
                 requestMsg.getWorkContext().getConnectionID(),                                                                      
-                requestMsg.getConnectorID().getID(),
+                requestMsg.getConnectorName(),
                 requestMsg.getRequestID().toString(),
                 Integer.toString(requestID.getNodeID()),
                 Integer.toString(requestID.getExecutionId())
                 );
+        this.securityContext.setUser(requestMsg.getWorkContext().getUser());
         this.securityContext.setBatchSize(this.requestMsg.getFetchSize());
         this.securityContext.setContextCache(manager.getContextCache());
+        this.securityContext.setMetadataService(manager.getMetadataService());
     }
 
-    protected void createConnection(ConnectorWrapper connector, QueryMetadataInterface queryMetadata) throws ConnectorException, MetaMatrixComponentException {
+    protected void createConnection(Connector connector, QueryMetadataInterface queryMetadata) throws ConnectorException, MetaMatrixComponentException {
         LogManager.logTrace(LogConstants.CTX_CONNECTOR, new Object[] {id, "creating connection for atomic-request"});  //$NON-NLS-1$
-         
+        
+        ConnectorEnvironment env = connector.getConnectorEnvironment();
+        
         if (requestMsg.isTransactional()){
-        	if (manager.isXa()) {
+        	if (env.isXaCapable()) {
 	    		this.securityContext.setTransactional(true);
 	    		this.isTransactional = true;
-	    		try {
-					manager.getTransactionService().getTransactionManager().resume(requestMsg.getTransactionContext().getTransaction());
-				} catch (InvalidTransactionException e) {
-					throw new ConnectorException(e);
-				} catch (SystemException e) {
-					throw new ConnectorException(e);
-				}
-        	} else if (!manager.isImmutable() && requestMsg.getCommand().updatingModelCount(queryMetadata) > 0) {
+        	} else if (!env.isImmutable() && requestMsg.getCommand().updatingModelCount(queryMetadata) > 0) {
     	        throw new ConnectorException(DQPPlugin.Util.getString("ConnectorWorker.transactionNotSupported")); //$NON-NLS-1$
     	    }
     	}
         
-    	connection = connector.getConnection(this.securityContext, this.isTransactional?requestMsg.getTransactionContext():null);
+    	this.connection = connector.getConnection();
+    	this.connectorEnv = env;
     }
     
     protected void process() {
     	DQPWorkContext.setWorkContext(this.requestMsg.getWorkContext());
-        ClassLoader contextloader = Thread.currentThread().getContextClassLoader();
-    	Thread.currentThread().setContextClassLoader(this.manager.getClassloader());
     	boolean success = true;
     	try {
     		checkForCloseEvent();
@@ -179,13 +173,9 @@
     		this.requestState = RequestState.CLOSE;
         	handleError(t);
         } finally {
-        	try {
-	        	if (this.requestState == RequestState.CLOSE) {
-	    			processClose(success);
-	        	} 
-        	} finally {
-            	Thread.currentThread().setContextClassLoader(contextloader);
-        	}
+        	if (this.requestState == RequestState.CLOSE) {
+    			processClose(success);
+        	} 
         }
     }
 
@@ -276,13 +266,6 @@
     }
 
 	private void sendClose() {
-		if (this.isTransactional) {
-			try {
-				manager.getTransactionService().getTransactionManager().suspend();
-			} catch (SystemException e) {
-				LogManager.logWarning(LogConstants.CTX_CONNECTOR, e, e.getMessage());
-			}
-		}
 		AtomicResultsMessage response = new AtomicResultsMessage(this.requestMsg);
 		response.setRequestClosed(true);
 		this.resultsReceiver.receiveResults(response);
@@ -379,8 +362,14 @@
         int batchSize = 0;
         List<List> rows = new ArrayList<List>(batchSize/4);
         boolean sendResults = true;
-    	try {
+        
+        try {
 	        while (batchSize < this.requestMsg.getFetchSize()) {
+	        	
+	        	if (shouldAbortProcessing()) {
+	        		throw new ConnectorException("Container requested to abort the operation!");
+	        	}
+	        	
         		List row = this.execution.next();
             	if (row == null) {
             		this.lastBatch = true;
@@ -396,13 +385,13 @@
             	correctTypes(row);
             	rows.add(row);
 	            // Check for max result rows exceeded
-	            if(manager.getMaxResultRows() != 0 && this.rowCount >= manager.getMaxResultRows()){
-	                if (this.rowCount == manager.getMaxResultRows() && !manager.isExceptionOnMaxRows()) {
-		                LogManager.logDetail(LogConstants.CTX_CONNECTOR, new Object[] {this.id, "Exceeded max, returning", manager.getMaxResultRows()}); //$NON-NLS-1$
+	            if(this.connectorEnv.getMaxResultRows() != 0 && this.rowCount >= this.connectorEnv.getMaxResultRows()){
+	                if (this.rowCount == this.connectorEnv.getMaxResultRows() && !this.connectorEnv.isExceptionOnMaxRows()) {
+		                LogManager.logDetail(LogConstants.CTX_CONNECTOR, new Object[] {this.id, "Exceeded max, returning", this.connectorEnv.getMaxResultRows()}); //$NON-NLS-1$
 		        		this.lastBatch = true;
 		        		break;
-	            	} else if (this.rowCount > manager.getMaxResultRows() && manager.isExceptionOnMaxRows()) {
-	                    String msg = DQPPlugin.Util.getString("ConnectorWorker.MaxResultRowsExceed", manager.getMaxResultRows()); //$NON-NLS-1$
+	            	} else if (this.rowCount > this.connectorEnv.getMaxResultRows() && this.connectorEnv.isExceptionOnMaxRows()) {
+	                    String msg = DQPPlugin.Util.getString("ConnectorWorker.MaxResultRowsExceed", this.connectorEnv.getMaxResultRows()); //$NON-NLS-1$
 	                    throw new ConnectorException(msg);
 	                }
 	            }
@@ -435,7 +424,7 @@
 		if ( !lastBatch && currentRowCount == 0 ) {
 		    // Defect 13366 - Should send all batches, even if they're zero size.
 		    // Log warning if received a zero-size non-last batch from the connector.
-		    LogManager.logWarning(LogConstants.CTX_CONNECTOR, DQPPlugin.Util.getString("ConnectorWorker.zero_size_non_last_batch", requestMsg.getConnectorID())); //$NON-NLS-1$
+		    LogManager.logWarning(LogConstants.CTX_CONNECTOR, DQPPlugin.Util.getString("ConnectorWorker.zero_size_non_last_batch", requestMsg.getConnectorName())); //$NON-NLS-1$
 		}
 
 		AtomicResultsMessage response = createResultsMessage(this.requestMsg, rows.toArray(new List[currentRowCount]), requestMsg.getCommand().getProjectedSymbols());

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWrapper.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWrapper.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWrapper.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,154 +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 org.teiid.dqp.internal.datamgr.impl;
-
-import java.util.concurrent.TimeUnit;
-
-import org.teiid.connector.api.Connection;
-import org.teiid.connector.api.Connector;
-import org.teiid.connector.api.ConnectorCapabilities;
-import org.teiid.connector.api.ConnectorEnvironment;
-import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.api.ConnectorIdentity;
-import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.api.MetadataProvider;
-import org.teiid.connector.metadata.runtime.MetadataFactory;
-import org.teiid.connector.xa.api.TransactionContext;
-import org.teiid.connector.xa.api.XAConnection;
-import org.teiid.connector.xa.api.XAConnector;
-import org.teiid.dqp.internal.pooling.connector.ConnectionPool;
-
-import com.metamatrix.common.util.PropertiesUtils;
-import com.metamatrix.dqp.service.ConnectorStatus;
-
-/**
- * ConnectorWrapper adds default behavior to the wrapped connector.
- */
-public class ConnectorWrapper implements MetadataProvider {
-	
-	private Connector actualConnector;
-	private volatile ConnectorStatus status = ConnectorStatus.UNABLE_TO_CHECK;
-	
-	public ConnectorWrapper(Connector actualConnector){
-		this.actualConnector = actualConnector;
-	}
-
-	public void start(ConnectorEnvironment environment) throws ConnectorException {
-		actualConnector.start(environment);
-		int interval = PropertiesUtils.getIntProperty(environment.getProperties(), ConnectionPool.SOURCE_CONNECTION_TEST_INTERVAL, ConnectionPool.DEFAULT_SOURCE_CONNECTION_TEST_INTERVAL);
-		if (interval > 0 && isConnectionTestable()) {
-			environment.scheduleAtFixedRate(new Runnable() {
-				@Override
-				public void run() {
-					updateStatus();
-				}
-			}, 0, interval, TimeUnit.SECONDS);
-		}
-	}
-	
-	protected boolean isConnectionTestable() {
-		return supportsSingleIdentity();
-	}
-
-	public void stop() {
-		actualConnector.stop();
-	}
-	
-	public final Connection getConnection(ExecutionContext context, TransactionContext transactionContext)
-	throws ConnectorException {
-		if (context instanceof ExecutionContextImpl && context.getConnectorIdentity() == null) {
-    		((ExecutionContextImpl)context).setConnectorIdentity(createIdentity(context));
-    	}
-		if (transactionContext == null) {
-			return getConnectionDirect(context);
-		}
-		return getXAConnectionDirect(context, transactionContext);
-	}
-	
-	protected Connection getConnectionDirect(ExecutionContext context)
-			throws ConnectorException {
-		return actualConnector.getConnection(context);
-	}
-	
-	protected XAConnection getXAConnectionDirect(ExecutionContext executionContext,
-			TransactionContext transactionContext) throws ConnectorException {
-		if (actualConnector instanceof XAConnector) {
-    		return ((XAConnector)actualConnector).getXAConnection(executionContext, transactionContext);
-    	}
-    	return null;
-	}
-
-	public ConnectorCapabilities getCapabilities() {
-	    return actualConnector.getCapabilities();
-	}
-	
-	public final ConnectorStatus getStatus() {
-		return status;
-	}
-	
-	protected void updateStatus() {
-		this.status = testConnection();
-	}
-
-	protected ConnectorStatus testConnection() {
-		if (supportsSingleIdentity()) {
-			Connection conn = null;
-			try {
-				conn = this.getConnectionDirect(null);
-				return conn.isAlive()?ConnectorStatus.OPEN:ConnectorStatus.DATA_SOURCE_UNAVAILABLE;
-			} catch (ConnectorException e) {
-				return ConnectorStatus.DATA_SOURCE_UNAVAILABLE;
-			} finally {
-				if (conn != null) {
-					conn.close();
-				}
-			}
-		}
-		return ConnectorStatus.UNABLE_TO_CHECK;
-	}
-	
-	public Connector getActualConnector() {
-		return actualConnector;
-	}
-	
-	public ConnectorIdentity createIdentity(ExecutionContext context)
-			throws ConnectorException {
-		return actualConnector.createIdentity(context);
-	}
-	
-	public boolean supportsSingleIdentity() {
-		try {
-			return createIdentity(null) != null;
-		} catch (ConnectorException e) {
-			return false;
-		}
-	}
-	
-	@Override
-	public void getConnectorMetadata(MetadataFactory metadataFactory)
-			throws ConnectorException {
-		if (this.actualConnector instanceof MetadataProvider) {
-			((MetadataProvider)this.actualConnector).getConnectorMetadata(metadataFactory);
-		}
-	}
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/DefaultConnectorLogger.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/DefaultConnectorLogger.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/DefaultConnectorLogger.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,111 +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 16, 2003
- * Time: 11:23:00 AM
- */
-package org.teiid.dqp.internal.datamgr.impl;
-
-import org.teiid.connector.api.ConnectorLogger;
-
-import com.metamatrix.common.log.LogManager;
-import com.metamatrix.core.log.MessageLevel;
-import com.metamatrix.dqp.internal.datamgr.ConnectorID;
-import com.metamatrix.dqp.util.LogConstants;
-
-/**
- * DefaultConnectorLogger.
- */
-public class DefaultConnectorLogger implements ConnectorLogger {
-    public DefaultConnectorLogger(ConnectorID loggingID) {
-    }
-
-    public void logError(String message) {
-        LogManager.logError(LogConstants.CTX_CONNECTOR, message);
-    }
-
-    public void logError(String message, Throwable error) {
-        LogManager.logError(LogConstants.CTX_CONNECTOR, error, message);
-    }
-
-    public void logWarning(String message) {
-        LogManager.logWarning(LogConstants.CTX_CONNECTOR, message);
-    }
-
-    public void logInfo(String message) {
-        LogManager.logInfo(LogConstants.CTX_CONNECTOR, message);
-    }
-
-    public void logDetail(String message) {
-        LogManager.logDetail(LogConstants.CTX_CONNECTOR, message);
-    }
-
-    public void logTrace(String message) {
-        LogManager.logTrace(LogConstants.CTX_CONNECTOR, message);
-    }
-
-	@Override
-	public boolean isDetailEnabled() {
-		return LogManager.isMessageToBeRecorded(LogConstants.CTX_CONNECTOR, MessageLevel.DETAIL);
-	}
-
-	@Override
-	public boolean isErrorEnabled() {
-		return LogManager.isMessageToBeRecorded(LogConstants.CTX_CONNECTOR, MessageLevel.ERROR);
-	}
-
-	@Override
-	public boolean isInfoEnabled() {
-		return LogManager.isMessageToBeRecorded(LogConstants.CTX_CONNECTOR, MessageLevel.INFO);
-	}
-
-	@Override
-	public boolean isTraceEnabled() {
-		return LogManager.isMessageToBeRecorded(LogConstants.CTX_CONNECTOR, MessageLevel.TRACE);
-	}
-
-	@Override
-	public boolean isWarningEnabled() {
-		return LogManager.isMessageToBeRecorded(LogConstants.CTX_CONNECTOR, MessageLevel.WARNING);
-	}
-
-	@Override
-	public void logDetail(String message, Throwable error) {
-		LogManager.log(MessageLevel.DETAIL, LogConstants.CTX_CONNECTOR, error, message);
-	}
-
-	@Override
-	public void logInfo(String message, Throwable error) {
-		LogManager.log(MessageLevel.INFO, LogConstants.CTX_CONNECTOR, error, message);
-	}
-
-	@Override
-	public void logTrace(String message, Throwable error) {
-		LogManager.log(MessageLevel.TRACE, LogConstants.CTX_CONNECTOR, error, message);		
-	}
-
-	@Override
-	public void logWarning(String message, Throwable error) {
-		LogManager.log(MessageLevel.WARNING, LogConstants.CTX_CONNECTOR, error, message);	
-	}
-}

Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ExecutionContextImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ExecutionContextImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ExecutionContextImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -23,17 +23,23 @@
 package org.teiid.dqp.internal.datamgr.impl;
 
 import java.io.Serializable;
+import java.security.Principal;
 import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.List;
 
-import org.teiid.connector.api.ConnectorIdentity;
+import javax.security.auth.Subject;
+
+import org.teiid.connector.api.CacheScope;
 import org.teiid.connector.api.ExecutionContext;
 import org.teiid.dqp.internal.cache.DQPContextCache;
+import org.teiid.dqp.internal.process.DQPWorkContext;
 
 import com.metamatrix.cache.Cache;
 import com.metamatrix.common.buffer.impl.BufferConfig;
 import com.metamatrix.core.util.HashCodeUtil;
+import com.metamatrix.dqp.DQPPlugin;
+import com.metamatrix.dqp.service.MetadataService;
 
 /**
  */
@@ -44,15 +50,13 @@
     //  Access Node ID
     private String partID;
     // currentConnector ID
-    private String connectorID;    
+    private String connectorName;    
     // current VDB 
     private String vdbName;
     // Current VDB's version
     private String vdbVersion;
     // User Name
-    private String userName;
-    // Payload setup on the Connection Object
-    private Serializable trustedPayload;
+    private Subject user;
     // Payload setup on the Statement object
     private Serializable executionPayload;
     // ID of the parent JDBC Connection which is executing the statement
@@ -63,24 +67,19 @@
     private boolean keepAlive = false;
     
     private boolean isTransactional;
-    
-    private ConnectorIdentity connectorIdentity;
-    
     private DQPContextCache contextCache;
+    private MetadataService metadataService;
     
     private int batchSize = BufferConfig.DEFAULT_CONNECTOR_BATCH_SIZE;
 	private List<Exception> warnings = new LinkedList<Exception>();
     
-    public ExecutionContextImpl(String vdbName, String vdbVersion, String userName,
-                                Serializable trustedPayload, Serializable executionPayload, 
-                                String originalConnectionID, String connectorId, String requestId, String partId, String execCount) {
+    public ExecutionContextImpl(String vdbName, String vdbVersion,  Serializable executionPayload, 
+                                String originalConnectionID, String connectorName, String requestId, String partId, String execCount) {
         
         this.vdbName = vdbName;
         this.vdbVersion = vdbVersion;
-        this.userName = userName;
-        this.trustedPayload = trustedPayload;
         this.executionPayload = executionPayload;
-        this.connectorID = connectorId;
+        this.connectorName = connectorName;
         this.requestID = requestId;
         this.partID = partId;        
         this.requestConnectionID = originalConnectionID;
@@ -88,43 +87,50 @@
     }
     
     public String getConnectorIdentifier() {
-        return this.connectorID;
+        return this.connectorName;
     }
     
+    @Override
     public String getRequestIdentifier() {
         return this.requestID;
     }
 
+    @Override
     public String getPartIdentifier() {
         return this.partID;
     }
+    
+    @Override
     public String getExecutionCountIdentifier() {
         return this.executeCount;
     }
+    @Override
     public String getVirtualDatabaseName() {
         return this.vdbName;
     }
-
+    @Override
     public String getVirtualDatabaseVersion() {
         return this.vdbVersion;
     }
-
-    public String getUser() {
-        return this.userName;
+    @Override
+    public Subject getUser() {
+        return this.user;
     }
-
-    public Serializable getTrustedPayload() {
-        return this.trustedPayload;
+    
+    public void setUser(Subject user) {
+        this.user = user;
     }
 
+    @Override
     public Serializable getExecutionPayload() {
         return executionPayload;
     }
     
+    @Override
 	public String getConnectionIdentifier() {
 		return requestConnectionID;
 	}
-
+    @Override
     public void keepExecutionAlive(boolean alive) {
         this.keepAlive = alive;
     }    
@@ -163,9 +169,16 @@
     }
 
     public String toString() {
-        return "ExecutionContext<vdb=" + this.vdbName + ", version=" + this.vdbVersion + ", user=" + this.userName + ">"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+    	String userName = null;
+    	if (this.user != null) {
+	    	for(Principal p:this.user.getPrincipals()) {
+	    		userName = p.getName();
+	    	}
+    	}
+        return "ExecutionContext<vdb=" + this.vdbName + ", version=" + this.vdbVersion + ", user=" + userName + ">"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
     }
-
+	
+    @Override
 	public boolean isTransactional() {
 		return isTransactional;
 	}
@@ -173,17 +186,8 @@
 	void setTransactional(boolean isTransactional) {
 		this.isTransactional = isTransactional;
 	}
-
+		
 	@Override
-	public ConnectorIdentity getConnectorIdentity() {
-		return this.connectorIdentity;
-	}
-	
-	public void setConnectorIdentity(ConnectorIdentity connectorIdentity) {
-		this.connectorIdentity = connectorIdentity;
-	}
-	
-	@Override
 	public int getBatchSize() {
 		return batchSize;
 	}
@@ -213,6 +217,14 @@
 		this.contextCache = cache;
 	}
 	
+	public void setMetadataService(MetadataService service) {
+		this.metadataService = service;
+	}	
+	
+	public MetadataService getMetadataService() {
+		return this.metadataService;
+	}
+	
 	@Override
 	public Object get(Object key) {
 		if (this.contextCache != null) {
@@ -229,4 +241,58 @@
 			cache.put(key, value);
 		}
 	}	
+	
+	
+	@Override
+	public Object getFromCache(CacheScope scope, Object key) {
+		DQPWorkContext context = DQPWorkContext.getWorkContext();
+		checkScopeValidity(scope, context);
+
+		Cache cache = getScopedCache(scope, context);
+		if (cache != null) {
+			return cache.get(key);
+		}
+		return null;
+	}
+	
+	@Override
+	public void storeInCache(CacheScope scope, Object key, Object value) {
+		DQPWorkContext context = DQPWorkContext.getWorkContext();
+		checkScopeValidity(scope, context);
+		Cache cache = getScopedCache(scope, context);
+		if (cache != null) {
+			cache.put(key, value);
+		}
+	}
+	
+	private Cache getScopedCache(CacheScope scope, DQPWorkContext context) {
+		switch (scope) {
+			case SERVICE:
+				return contextCache.getServiceScopedCache(getConnectorIdentifier());
+			case SESSION:
+				return contextCache.getSessionScopedCache(context.getSessionToken().getSessionIDValue());
+			case VDB:
+				return contextCache.getVDBScopedCache(context.getVdbName(), context.getVdbVersion());
+			case GLOBAL:
+				return contextCache.getGlobalScopedCache();
+		}
+		return null;
+	}
+	
+	private void checkScopeValidity(CacheScope scope, DQPWorkContext context) {
+		if (scope == CacheScope.REQUEST) {
+			throw new IllegalStateException(DQPPlugin.Util.getString("ConnectorEnvironmentImpl.request_scope_error")); //$NON-NLS-1$
+		}
+		
+		if (scope == CacheScope.SESSION) {
+			if (context == null || context.getSessionToken() == null) {
+				throw new IllegalStateException(DQPPlugin.Util.getString("ConnectorEnvironmentImpl.session_scope_error")); //$NON-NLS-1$
+			}
+		}
+		else if (scope == CacheScope.VDB) {
+			if (context == null || context.getVdbName() == null || context.getVdbVersion() == null) {
+				throw new IllegalStateException(DQPPlugin.Util.getString("ConnectorEnvironmentImpl.vdb_scope_error")); //$NON-NLS-1$
+			}
+		}
+	}	
 }

Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/SynchConnectorWorkItem.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/SynchConnectorWorkItem.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/SynchConnectorWorkItem.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -26,6 +26,8 @@
 import java.util.Map;
 import java.util.concurrent.Semaphore;
 
+import javax.transaction.xa.Xid;
+
 import com.metamatrix.common.comm.api.ResultsReceiver;
 import com.metamatrix.common.log.LogManager;
 import com.metamatrix.dqp.message.AtomicRequestMessage;
@@ -39,7 +41,7 @@
 		int pendingCount;
 	}
 
-	private static Map<String, TransactionLock> TRANSACTION_LOCKS = new HashMap<String, TransactionLock>();
+	private static Map<Xid, TransactionLock> TRANSACTION_LOCKS = new HashMap<Xid, TransactionLock>();
 
 	private TransactionLock lock;
 
@@ -89,7 +91,7 @@
 		if (!this.isTransactional) {
 			return;
 		}
-		String key = requestMsg.getTransactionContext().getTxnID();
+		Xid key = requestMsg.getTransactionContext().getXid();
 
 		TransactionLock existing = null;
 		synchronized (TRANSACTION_LOCKS) {
@@ -111,7 +113,7 @@
 		synchronized (TRANSACTION_LOCKS) {
 			lock.pendingCount--;
 			if (lock.pendingCount == 0) {
-				String key = requestMsg.getTransactionContext().getTxnID();
+				Xid key = requestMsg.getTransactionContext().getXid();
 				TRANSACTION_LOCKS.remove(key);
 			}
 		}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/TypeFacilityImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/TypeFacilityImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/TypeFacilityImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,52 +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 org.teiid.dqp.internal.datamgr.impl;
-
-import java.util.Calendar;
-import java.util.Date;
-import java.util.TimeZone;
-
-import org.teiid.connector.api.TypeFacility;
-
-import com.metamatrix.common.types.DataTypeManager;
-import com.metamatrix.common.util.TimestampWithTimezone;
-
-/**
- */
-public class TypeFacilityImpl extends TypeFacility {
-
-    public TypeFacilityImpl() {
-    }
-
-	@Override
-	public Object convertToRuntimeType(Object value) {
-		return DataTypeManager.convertToRuntimeType(value);
-	}
-	
-	@Override
-	public Object convertDate(Date date, TimeZone initial, Calendar target,
-			Class targetType) {
-		return TimestampWithTimezone.create(date, initial, target, targetType);
-	}
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/AggregateImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/AggregateImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/AggregateImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,106 +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 org.teiid.dqp.internal.datamgr.language;
-
-import org.teiid.connector.language.IAggregate;
-import org.teiid.connector.language.IExpression;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-public class AggregateImpl extends BaseLanguageObject implements IAggregate {
-    
-    private IExpression expression = null;
-    private String aggName;
-    private boolean isDistinct;
-    private Class type;
-    
-    public AggregateImpl(String aggName, boolean isDistinct, IExpression exp, Class type) {
-        this.expression = exp;
-        this.aggName = aggName;
-        this.isDistinct = isDistinct;
-        this.type = type;
-    }
-
-    /**
-     * @see org.teiid.connector.language.IAggregate#getName()
-     */
-    public String getName() {
-        return this.aggName;
-    }
-
-    /**
-     * @see org.teiid.connector.language.IAggregate#isDistinct()
-     */
-    public boolean isDistinct() {
-        return this.isDistinct;
-    }
-
-    /**
-     * @see org.teiid.connector.language.IAggregate#getExpression()
-     */
-    public IExpression getExpression() {
-        return this.expression;
-    }
-    
-    /**
-     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
-     */
-    public void acceptVisitor(LanguageObjectVisitor visitor) {
-        visitor.visit(this);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IAggregate#setName(java.lang.String)
-     */
-    public void setName(String name) {
-        this.aggName = name;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IAggregate#setDistinct(boolean)
-     */
-    public void setDistinct(boolean isDistinct) {
-        this.isDistinct = isDistinct;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IAggregate#setExpression(com.metamatrix.data.language.IExpression)
-     */
-    public void setExpression(IExpression expression) {
-        this.expression = expression;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IExpression#getType()
-     */
-    public Class getType() {
-        return this.type;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IExpression#setType(java.lang.Class)
-     */
-    public void setType(Class type) {
-        this.type = type;
-    }
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/BaseLanguageObject.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/BaseLanguageObject.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/BaseLanguageObject.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,42 +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 org.teiid.dqp.internal.datamgr.language;
-
-import org.teiid.connector.language.ILanguageObject;
-import org.teiid.connector.visitor.util.SQLStringVisitor;
-
-/**
- */
-public abstract class BaseLanguageObject implements ILanguageObject {
-
-    /**
-     * 
-     */
-    public BaseLanguageObject() {
-    }
-    
-    public String toString() {
-        return SQLStringVisitor.getSQLString(this);
-    }
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/BatchedUpdatesImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/BatchedUpdatesImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/BatchedUpdatesImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,59 +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 org.teiid.dqp.internal.datamgr.language;
-
-import java.util.List;
-
-import org.teiid.connector.language.IBatchedUpdates;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-
-
-/** 
- * @since 4.2
- */
-public class BatchedUpdatesImpl extends BaseLanguageObject implements
-                                                          IBatchedUpdates {
-
-    private List updateCommands;
-    public BatchedUpdatesImpl(List updateCommands) {
-        this.updateCommands = updateCommands;
-    }
-    
-    /** 
-     * @see org.teiid.connector.language.IBatchedUpdates#getUpdateCommands()
-     * @since 4.2
-     */
-    public List getUpdateCommands() {
-        return updateCommands;
-    }
-
-    /** 
-     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(org.teiid.connector.visitor.framework.LanguageObjectVisitor)
-     * @since 4.2
-     */
-    public void acceptVisitor(LanguageObjectVisitor visitor) {
-        visitor.visit(this);
-    }
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/CompareCriteriaImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/CompareCriteriaImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/CompareCriteriaImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,90 +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 org.teiid.dqp.internal.datamgr.language;
-
-import org.teiid.connector.language.ICompareCriteria;
-import org.teiid.connector.language.IExpression;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-public class CompareCriteriaImpl extends BaseLanguageObject implements ICompareCriteria {
-
-    private IExpression leftExpression = null;
-    private IExpression rightExpression = null;
-    private Operator operator;
-    
-    public CompareCriteriaImpl(IExpression left, IExpression right, Operator operator) {
-        leftExpression = left;
-        rightExpression = right;
-        this.operator = operator;
-    }
-    /**
-     * @see org.teiid.connector.language.ICompareCriteria#getLeftExpression()
-     */
-    public IExpression getLeftExpression() {
-        return leftExpression;
-    }
-
-    /**
-     * @see org.teiid.connector.language.ICompareCriteria#getRightExpression()
-     */
-    public IExpression getRightExpression() {
-        return rightExpression;
-    }
-
-    /**
-     * @see org.teiid.connector.language.ICompareCriteria#getOperator()
-     */
-    public Operator getOperator() {
-        return this.operator;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ICompareCriteria#setLeftExpression(com.metamatrix.data.language.IExpression)
-     */
-    public void setLeftExpression(IExpression expression) {
-        this.leftExpression = expression;
-    }
-    
-    /* 
-     * @see com.metamatrix.data.language.ICompareCriteria#setRightExpression(com.metamatrix.data.language.IExpression)
-     */
-    public void setRightExpression(IExpression expression) {
-        this.rightExpression = expression;
-    }
-    
-    /* 
-     * @see com.metamatrix.data.language.ICompareCriteria#setOperator(int)
-     */
-    public void setOperator(Operator operator) {
-        this.operator = operator;
-    }
-    
-    /**
-     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
-     */
-    public void acceptVisitor(LanguageObjectVisitor visitor) {
-        visitor.visit(this);
-    }
-    
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/CompoundCriteriaImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/CompoundCriteriaImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/CompoundCriteriaImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -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 org.teiid.dqp.internal.datamgr.language;
-
-import java.util.List;
-
-import org.teiid.connector.language.ICompoundCriteria;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-
-public class CompoundCriteriaImpl extends BaseLanguageObject implements ICompoundCriteria {
-    
-    private List criteria = null;
-    private Operator operator = Operator.AND;
-    
-    public CompoundCriteriaImpl(List nestedCriteria, Operator operator) {
-        criteria = nestedCriteria;
-        this.operator = operator; 
-    }
-
-    /**
-     * @see org.teiid.connector.language.ICompoundCriteria#getOperator()
-     */
-    public Operator getOperator() {
-        return this.operator;
-    }
-
-    /**
-     * @see org.teiid.connector.language.ICompoundCriteria#getCriteria()
-     */
-    public List getCriteria() {
-        return criteria;
-    }
-
-    /**
-     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
-     */
-    public void acceptVisitor(LanguageObjectVisitor visitor) {
-        visitor.visit(this);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ICompoundCriteria#setOperator(int)
-     */
-    public void setOperator(Operator operator) {
-        this.operator = operator;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ICompoundCriteria#setCriteria(java.util.List)
-     */
-    public void setCriteria(List criteria) {
-        this.criteria = criteria;
-    }
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/DeleteImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/DeleteImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/DeleteImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,74 +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 org.teiid.dqp.internal.datamgr.language;
-
-import org.teiid.connector.language.ICriteria;
-import org.teiid.connector.language.IDelete;
-import org.teiid.connector.language.IGroup;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-public class DeleteImpl extends BaseLanguageObject implements IDelete {
-
-    private IGroup group = null;
-    private ICriteria criteria = null;
-    
-    public DeleteImpl(IGroup group, ICriteria criteria) {
-        this.group = group;
-        this.criteria = criteria;
-    }
-    /**
-     * @see org.teiid.connector.language.IDelete#getGroup()
-     */
-    public IGroup getGroup() {
-        return group;
-    }
-
-    /**
-     * @see org.teiid.connector.language.IDelete#getCriteria()
-     */
-    public ICriteria getCriteria() {
-        return criteria;
-    }
-
-    /**
-     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
-     */
-    public void acceptVisitor(LanguageObjectVisitor visitor) {
-        visitor.visit(this);
-    }
-    
-    /* 
-     * @see com.metamatrix.data.language.IDelete#setGroup(com.metamatrix.data.language.IGroup)
-     */
-    public void setGroup(IGroup group) {
-        this.group = group;
-    }
-    
-    /* 
-     * @see com.metamatrix.data.language.IDelete#setCriteria(com.metamatrix.data.language.ICriteria)
-     */
-    public void setCriteria(ICriteria criteria) {
-        this.criteria = criteria;
-    }
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/ElementImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/ElementImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/ElementImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,150 +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 org.teiid.dqp.internal.datamgr.language;
-
-import org.teiid.connector.language.IElement;
-import org.teiid.connector.language.IGroup;
-import org.teiid.connector.metadata.runtime.Element;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-public class ElementImpl extends BaseLanguageObject implements IElement {
-
-    private IGroup group;
-    private String name;
-    private Element metadataObject;
-    private Class type;
-    
-    public ElementImpl(IGroup group, String name, Element metadataObject, Class type) {
-        this.group = group;
-        this.name = name;
-        this.metadataObject = metadataObject;
-        this.type = type;
-    }
-    
-    /**
-     * @see org.teiid.connector.language.IElement#getName()
-     */
-    public String getName() {
-        return this.name;
-    }
-
-    /**
-     * @see org.teiid.connector.language.IElement#getGroup()
-     */
-    public IGroup getGroup() {
-        return group;
-    }
-
-    @Override
-    public Element getMetadataObject() {
-    	return this.metadataObject;
-    }
-    
-    public void setMetadataObject(Element metadataObject) {
-		this.metadataObject = metadataObject;
-	}
-    
-    /**
-     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
-     */
-    public void acceptVisitor(LanguageObjectVisitor visitor) {
-        visitor.visit(this);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IElement#setGroup(com.metamatrix.data.language.IGroup)
-     */
-    public void setGroup(IGroup group) {
-        this.group = group;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IExpression#getType()
-     */
-    public Class getType() {
-        return this.type;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IElement#setName(java.lang.String)
-     */
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IExpression#setType(java.lang.Class)
-     */
-    public void setType(Class type) {
-        this.type = type;
-    }
-
-    /**
-     * Compare the symbol based ONLY on name.  Symbols are not compared based on
-     * their underlying physical metadata IDs but rather on their representation
-     * in the context of a particular query.  Case is not important when comparing
-     * symbol names.
-     * @param obj Other object
-     * @return True if other obj is a Symbol (or subclass) and name is equal
-     */
-    public boolean equals(Object obj) {
-        if(obj == this) {
-            return true;
-        }
-
-        if(obj != null && obj instanceof IElement) {
-            IElement other = (IElement) obj;
-            
-            // Compare groups
-            if(other.getGroup() == null) {
-                if(this.getGroup() != null) {
-                    return false;
-                }
-            } else {
-                if(this.getGroup() == null) {
-                    return false;
-                }
-                if(! other.getGroup().equals(this.getGroup())) {
-                    return false;
-                }
-            }
-            
-            // Compare elements
-            String thisShortName = this.getName();
-            int dotIndex = thisShortName.lastIndexOf('.');
-            if(dotIndex >= 0) {
-                thisShortName = thisShortName.substring(dotIndex+1);
-            }
-            
-            String otherShortName = other.getName();
-            dotIndex = otherShortName.lastIndexOf('.');
-            if(dotIndex >= 0) {
-                otherShortName = otherShortName.substring(dotIndex+1);
-            }
-            
-            return thisShortName.equalsIgnoreCase(otherShortName);
-        }
-        return false;
-    }
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/ExistsCriteriaImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/ExistsCriteriaImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/ExistsCriteriaImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,64 +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 org.teiid.dqp.internal.datamgr.language;
-
-import org.teiid.connector.language.IExistsCriteria;
-import org.teiid.connector.language.IQuery;
-import org.teiid.connector.language.IQueryCommand;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-/**
- */
-public class ExistsCriteriaImpl extends BaseLanguageObject implements IExistsCriteria {
-
-    private IQueryCommand query;
-    
-    /**
-     * 
-     */
-    public ExistsCriteriaImpl(IQuery query) {
-        this.query = query;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ISubqueryContainer#getQuery()
-     */
-    public IQueryCommand getQuery() {
-        return query;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
-     */
-    public void acceptVisitor(LanguageObjectVisitor visitor) {
-        visitor.visit(this);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ISubqueryContainer#setQuery(com.metamatrix.data.language.IQuery)
-     */
-    public void setQuery(IQueryCommand query) {
-        this.query = query;
-    }
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/FromImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/FromImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/FromImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,60 +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 org.teiid.dqp.internal.datamgr.language;
-
-import java.util.List;
-
-import org.teiid.connector.language.IFrom;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-
-public class FromImpl extends BaseLanguageObject implements IFrom {
-
-    private List items = null;
-    
-    public FromImpl(List items) {
-        this.items = items;
-    }
-    
-    /**
-     * @see org.teiid.connector.language.IFrom#getItems()
-     */
-    public List getItems() {
-        return items;
-    }
-
-    /**
-     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
-     */
-    public void acceptVisitor(LanguageObjectVisitor visitor) {
-        visitor.visit(this);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IFrom#setItems(java.util.List)
-     */
-    public void setItems(List items) {
-        this.items = items;
-    }
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/FunctionImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/FunctionImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/FunctionImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,91 +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 org.teiid.dqp.internal.datamgr.language;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.teiid.connector.language.IExpression;
-import org.teiid.connector.language.IFunction;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-
-public class FunctionImpl extends BaseLanguageObject implements IFunction {
-
-    private String name;
-    private List<IExpression> parameters;
-    private Class type;
-    
-    public FunctionImpl(String name, List<? extends IExpression> params, Class type) {
-        this.name = name;
-        if (params == null) {
-        	this.parameters = new ArrayList<IExpression>(0);
-        } else {
-        	this.parameters = new ArrayList<IExpression>(params);
-        }
-        this.type = type;
-    }
-    
-    /**
-     * @see org.teiid.connector.language.IFunction#getName()
-     */
-    public String getName() {
-        return this.name;
-    }
-
-    /**
-     * @see org.teiid.connector.language.IFunction#getParameters()
-     */
-    public List<IExpression> getParameters() {
-        return parameters;
-    }
-
-    /**
-     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
-     */
-    public void acceptVisitor(LanguageObjectVisitor visitor) {
-        visitor.visit(this);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IFunction#setName(java.lang.String)
-     */
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IExpression#getType()
-     */
-    public Class getType() {
-        return this.type;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IExpression#setType(java.lang.Class)
-     */
-    public void setType(Class type) {
-        this.type = type;
-    }
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/GroupByImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/GroupByImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/GroupByImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,60 +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 org.teiid.dqp.internal.datamgr.language;
-
-import java.util.List;
-
-import org.teiid.connector.language.IGroupBy;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-
-public class GroupByImpl extends BaseLanguageObject implements IGroupBy {
-
-    private List elements = null;
-    
-    public GroupByImpl(List elements) {
-        this.elements = elements;
-    }
-    
-    /**
-     * @see org.teiid.connector.language.IGroupBy#getElements()
-     */
-    public List getElements() {
-        return elements;
-    }
-
-    /**
-     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
-     */
-    public void acceptVisitor(LanguageObjectVisitor visitor) {
-        visitor.visit(this);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IGroupBy#setElements(java.util.List)
-     */
-    public void setElements(List elements) {
-        this.elements = elements;
-    }
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/GroupImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/GroupImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/GroupImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,113 +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 org.teiid.dqp.internal.datamgr.language;
-
-import org.teiid.connector.language.IGroup;
-import org.teiid.connector.metadata.runtime.Group;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-import com.metamatrix.core.util.HashCodeUtil;
-
-public class GroupImpl extends BaseLanguageObject implements IGroup {
-
-    private String context;
-    private String definition;    
-    private Group metadataObject;
-    
-    public GroupImpl(String context, String definition, Group group) {
-        this.context = context;
-        this.definition = definition;
-        this.metadataObject = group;
-    }
-
-    /**
-     * @see org.teiid.connector.language.IGroup#getContext()
-     */
-    public String getContext() {
-        return context;
-    }
-
-    /**
-     * @see org.teiid.connector.language.IGroup#getDefinition()
-     */
-    public String getDefinition() {
-        return this.definition;
-    }
-
-    @Override
-    public Group getMetadataObject() {
-    	return this.metadataObject;
-    }
-    
-    public void setMetadataObject(Group metadataObject) {
-		this.metadataObject = metadataObject;
-	}
-
-    /**
-     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
-     */
-    public void acceptVisitor(LanguageObjectVisitor visitor) {
-        visitor.visit(this);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IGroup#setDefinition(java.lang.String)
-     */
-    public void setDefinition(String definition) {
-        this.definition = definition;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IGroup#setContext(java.lang.String)
-     */
-    public void setContext(String context) {
-        this.context = context;
-    }
-    
-    public int hashCode() {
-        return HashCodeUtil.hashCode(HashCodeUtil.hashCode(0, this.getDefinition()), this.getContext());
-    }
-    
-    public boolean equals(Object obj) {
-        if(this == obj) {
-            return true;
-        }
-
-        if(obj == null || ! (obj instanceof IGroup)) {
-            return false;
-        }
-        IGroup other = (IGroup) obj;
-
-        // Two group symbols will be equal only if both use aliases or both
-        // don't use aliases.  In either case, comparing context names is
-        // enough.
-        if( (this.getDefinition() == null && other.getDefinition() == null) ||
-            (this.getDefinition() != null && other.getDefinition() != null) ) {
-
-            return this.getContext().equalsIgnoreCase(other.getContext());
-
-        }
-        return false;
-    }
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/InCriteriaImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/InCriteriaImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/InCriteriaImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,89 +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 org.teiid.dqp.internal.datamgr.language;
-
-import java.util.List;
-
-import org.teiid.connector.language.IExpression;
-import org.teiid.connector.language.IInCriteria;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-
-public class InCriteriaImpl extends BaseLanguageObject implements IInCriteria {
-
-    private IExpression leftExpression = null;
-    private List rightExpressions = null;
-    private boolean negated = false;
-    
-    public InCriteriaImpl(IExpression left, List right, boolean negated) {
-        leftExpression = left;
-        rightExpressions = right;
-        this.negated = negated;
-    }
-    /**
-     * @see org.teiid.connector.language.IInCriteria#getLeftExpression()
-     */
-    public IExpression getLeftExpression() {
-        return leftExpression;
-    }
-
-    /**
-     * @see org.teiid.connector.language.IInCriteria#getRightExpressions()
-     */
-    public List getRightExpressions() {
-        return rightExpressions;
-    }
-
-    /**
-     * @see org.teiid.connector.language.IInCriteria#isNegated()
-     */
-    public boolean isNegated() {
-        return this.negated;
-    }
-
-    /**
-     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
-     */
-    public void acceptVisitor(LanguageObjectVisitor visitor) {
-        visitor.visit(this);
-    }
-    /* 
-     * @see com.metamatrix.data.language.IInCriteria#setRightExpressions(java.util.List)
-     */
-    public void setRightExpressions(List expressions) {
-        this.rightExpressions = expressions;
-    }
-    /* 
-     * @see com.metamatrix.data.language.IBaseInCriteria#setLeftExpression(com.metamatrix.data.language.IExpression)
-     */
-    public void setLeftExpression(IExpression expression) {
-        this.leftExpression = expression;
-    }
-    /* 
-     * @see com.metamatrix.data.language.IBaseInCriteria#setNegated(boolean)
-     */
-    public void setNegated(boolean negated) {
-        this.negated = negated;
-    }
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/InlineViewImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/InlineViewImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/InlineViewImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,72 +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 org.teiid.dqp.internal.datamgr.language;
-
-import org.teiid.connector.language.IInlineView;
-import org.teiid.connector.language.IQueryCommand;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-/**
- * Inline views are treated like aliased groups
- */
-public class InlineViewImpl extends GroupImpl implements IInlineView {
-
-    private String name;
-    private IQueryCommand query;
-    private String output;
-
-    public InlineViewImpl(IQueryCommand query, String name) {        
-        super(name, name, null);
-        this.query = query;
-        this.name = name;
-    }
-
-    public String getName() {
-        return this.name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public IQueryCommand getQuery() {
-        return this.query;
-    }
-
-    public void setQuery(IQueryCommand query) {
-        this.query = query;
-    }
-
-    public void acceptVisitor(LanguageObjectVisitor visitor) {
-        visitor.visit(this);
-    }
-
-	public String getOutput() {
-		return output;
-	}
-
-	public void setOutput(String output) {
-		this.output = output;
-	}
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/InsertImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/InsertImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/InsertImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,89 +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 org.teiid.dqp.internal.datamgr.language;
-
-import java.util.List;
-
-import org.teiid.connector.language.IGroup;
-import org.teiid.connector.language.IInsert;
-import org.teiid.connector.language.IInsertValueSource;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-
-public class InsertImpl extends BaseLanguageObject implements IInsert {
-    
-    private IGroup group;
-    private List elements;
-    private IInsertValueSource valueSource;
-  
-    public InsertImpl(IGroup group, List elements, IInsertValueSource valueSource) {
-        this.group = group;
-        this.elements = elements;
-        this.valueSource = valueSource;
-    }
-    /**
-     * @see org.teiid.connector.language.IInsert#getGroup()
-     */
-    public IGroup getGroup() {
-        return group;
-    }
-
-    /**
-     * @see org.teiid.connector.language.IInsert#getElements()
-     */
-    public List getElements() {
-        return elements;
-    }
-
-    /**
-     * @see org.teiid.connector.language.IInsert#getValueSource()
-     */
-    public IInsertValueSource getValueSource() {
-        return valueSource;
-    }
-
-    /**
-     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
-     */
-    public void acceptVisitor(LanguageObjectVisitor visitor) {
-        visitor.visit(this);
-    }
-    /* 
-     * @see com.metamatrix.data.language.IInsert#setGroup(com.metamatrix.data.language.IGroup)
-     */
-    public void setGroup(IGroup group) {
-        this.group = group;
-    }
-    /* 
-     * @see com.metamatrix.data.language.IInsert#setElements(java.util.List)
-     */
-    public void setElements(List elements) {
-        this.elements = elements;
-    }
-    
-    @Override
-    public void setValueSource(IInsertValueSource values) {
-    	this.valueSource = values;
-    }
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/InsertValueExpressionsImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/InsertValueExpressionsImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/InsertValueExpressionsImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,27 +0,0 @@
-package org.teiid.dqp.internal.datamgr.language;
-
-import java.util.List;
-
-import org.teiid.connector.language.IExpression;
-import org.teiid.connector.language.IInsertExpressionValueSource;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-public class InsertValueExpressionsImpl extends BaseLanguageObject implements IInsertExpressionValueSource {
-
-	private List<IExpression> values;
-	
-	public InsertValueExpressionsImpl(List<IExpression> values) {
-		this.values = values;
-	}
-
-	@Override
-	public List<IExpression> getValues() {
-		return values;
-	}
-
-	@Override
-	public void acceptVisitor(LanguageObjectVisitor visitor) {
-		visitor.visit(this);
-	}
-	
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/IsNullCriteriaImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/IsNullCriteriaImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/IsNullCriteriaImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,74 +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 org.teiid.dqp.internal.datamgr.language;
-
-import org.teiid.connector.language.IExpression;
-import org.teiid.connector.language.IIsNullCriteria;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-public class IsNullCriteriaImpl extends BaseLanguageObject implements IIsNullCriteria {
-    
-    private IExpression expression = null;
-    private boolean negated = false;
-    
-    public IsNullCriteriaImpl(IExpression expr, boolean isNegated) {
-        expression = expr;
-        this.negated = isNegated;
-    }
-
-    /**
-     * @see org.teiid.connector.language.IIsNullCriteria#getExpression()
-     */
-    public IExpression getExpression() {
-        return expression;
-    }
-
-    /**
-     * @see org.teiid.connector.language.IIsNullCriteria#isNegated()
-     */
-    public boolean isNegated() {
-        return this.negated;
-    }
-
-    /**
-     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
-     */
-    public void acceptVisitor(LanguageObjectVisitor visitor) {
-        visitor.visit(this);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IIsNullCriteria#setExpression(com.metamatrix.data.language.IExpression)
-     */
-    public void setExpression(IExpression expression) {
-        this.expression = expression;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IIsNullCriteria#setNegated(boolean)
-     */
-    public void setNegated(boolean negated) {
-        this.negated = negated;
-    }
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/JoinImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/JoinImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/JoinImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,104 +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 org.teiid.dqp.internal.datamgr.language;
-
-import java.util.List;
-
-import org.teiid.connector.language.IFromItem;
-import org.teiid.connector.language.IJoin;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-
-public class JoinImpl extends BaseLanguageObject implements IJoin {
-
-    private IFromItem leftItem = null;
-    private IFromItem rightItem = null;
-    private JoinType joinType;
-    private List criteria = null;
-    
-    public JoinImpl(IFromItem left, IFromItem right, JoinType joinType, List criteria) {
-        this.leftItem = left;
-        this.rightItem = right;
-        this.joinType = joinType;
-        this.criteria = criteria;
-    }
-    /**
-     * @see org.teiid.connector.language.IJoin#getLeftItem()
-     */
-    public IFromItem getLeftItem() {
-        return leftItem;
-    }
-
-    /**
-     * @see org.teiid.connector.language.IJoin#getRightItem()
-     */
-    public IFromItem getRightItem() {
-        return rightItem;
-    }
-
-    /**
-     * @see org.teiid.connector.language.IJoin#getJoinType()
-     */
-    public JoinType getJoinType() {
-        return this.joinType;
-    }
-
-    /**
-     * @see org.teiid.connector.language.IJoin#getCriteria()
-     */
-    public List getCriteria() {
-        return criteria;
-    }
-
-    /**
-     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
-     */
-    public void acceptVisitor(LanguageObjectVisitor visitor) {
-        visitor.visit(this);
-    }
-    /* 
-     * @see com.metamatrix.data.language.IJoin#setLeftItem(com.metamatrix.data.language.IFromItem)
-     */
-    public void setLeftItem(IFromItem item) {
-        this.leftItem = item;
-    }
-    /* 
-     * @see com.metamatrix.data.language.IJoin#setRightItem(com.metamatrix.data.language.IFromItem)
-     */
-    public void setRightItem(IFromItem item) {
-        this.rightItem = item;
-    }
-    /* 
-     * @see com.metamatrix.data.language.IJoin#setJoinType(int)
-     */
-    public void setJoinType(JoinType type) {
-        this.joinType = type;
-    }
-    /* 
-     * @see com.metamatrix.data.language.IJoin#setCriteria(java.util.List)
-     */
-    public void setCriteria(List criteria) {
-        this.criteria = criteria;
-    }
-
-}

Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/LanguageBridgeFactory.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/LanguageBridgeFactory.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/LanguageBridgeFactory.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -68,6 +68,42 @@
 import org.teiid.connector.language.ICompareCriteria.Operator;
 import org.teiid.connector.language.IParameter.Direction;
 import org.teiid.connector.language.ISubqueryCompareCriteria.Quantifier;
+import org.teiid.connector.language.impl.AggregateImpl;
+import org.teiid.connector.language.impl.BatchedUpdatesImpl;
+import org.teiid.connector.language.impl.CompareCriteriaImpl;
+import org.teiid.connector.language.impl.CompoundCriteriaImpl;
+import org.teiid.connector.language.impl.DeleteImpl;
+import org.teiid.connector.language.impl.ElementImpl;
+import org.teiid.connector.language.impl.ExistsCriteriaImpl;
+import org.teiid.connector.language.impl.FromImpl;
+import org.teiid.connector.language.impl.FunctionImpl;
+import org.teiid.connector.language.impl.GroupByImpl;
+import org.teiid.connector.language.impl.GroupImpl;
+import org.teiid.connector.language.impl.InCriteriaImpl;
+import org.teiid.connector.language.impl.InlineViewImpl;
+import org.teiid.connector.language.impl.InsertImpl;
+import org.teiid.connector.language.impl.InsertValueExpressionsImpl;
+import org.teiid.connector.language.impl.IsNullCriteriaImpl;
+import org.teiid.connector.language.impl.JoinImpl;
+import org.teiid.connector.language.impl.LikeCriteriaImpl;
+import org.teiid.connector.language.impl.LimitImpl;
+import org.teiid.connector.language.impl.LiteralImpl;
+import org.teiid.connector.language.impl.NotCriteriaImpl;
+import org.teiid.connector.language.impl.OrderByImpl;
+import org.teiid.connector.language.impl.OrderByItemImpl;
+import org.teiid.connector.language.impl.ParameterImpl;
+import org.teiid.connector.language.impl.ProcedureImpl;
+import org.teiid.connector.language.impl.QueryImpl;
+import org.teiid.connector.language.impl.ScalarSubqueryImpl;
+import org.teiid.connector.language.impl.SearchedCaseExpressionImpl;
+import org.teiid.connector.language.impl.SelectImpl;
+import org.teiid.connector.language.impl.SelectSymbolImpl;
+import org.teiid.connector.language.impl.SetClauseImpl;
+import org.teiid.connector.language.impl.SetClauseListImpl;
+import org.teiid.connector.language.impl.SetQueryImpl;
+import org.teiid.connector.language.impl.SubqueryCompareCriteriaImpl;
+import org.teiid.connector.language.impl.SubqueryInCriteriaImpl;
+import org.teiid.connector.language.impl.UpdateImpl;
 import org.teiid.connector.metadata.runtime.Parameter;
 import org.teiid.connector.metadata.runtime.Procedure;
 import org.teiid.dqp.internal.datamgr.metadata.RuntimeMetadataImpl;

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/LanguageFactoryImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/LanguageFactoryImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/LanguageFactoryImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,346 +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 org.teiid.dqp.internal.datamgr.language;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.teiid.connector.language.IAggregate;
-import org.teiid.connector.language.ICompareCriteria;
-import org.teiid.connector.language.ICompoundCriteria;
-import org.teiid.connector.language.ICriteria;
-import org.teiid.connector.language.IDelete;
-import org.teiid.connector.language.IElement;
-import org.teiid.connector.language.IExistsCriteria;
-import org.teiid.connector.language.IExpression;
-import org.teiid.connector.language.IFrom;
-import org.teiid.connector.language.IFromItem;
-import org.teiid.connector.language.IFunction;
-import org.teiid.connector.language.IGroup;
-import org.teiid.connector.language.IGroupBy;
-import org.teiid.connector.language.IInCriteria;
-import org.teiid.connector.language.IInlineView;
-import org.teiid.connector.language.IInsert;
-import org.teiid.connector.language.IInsertExpressionValueSource;
-import org.teiid.connector.language.IInsertValueSource;
-import org.teiid.connector.language.IIsNullCriteria;
-import org.teiid.connector.language.IJoin;
-import org.teiid.connector.language.ILanguageFactory;
-import org.teiid.connector.language.ILikeCriteria;
-import org.teiid.connector.language.ILimit;
-import org.teiid.connector.language.ILiteral;
-import org.teiid.connector.language.INotCriteria;
-import org.teiid.connector.language.IOrderBy;
-import org.teiid.connector.language.IOrderByItem;
-import org.teiid.connector.language.IParameter;
-import org.teiid.connector.language.IProcedure;
-import org.teiid.connector.language.IQuery;
-import org.teiid.connector.language.IQueryCommand;
-import org.teiid.connector.language.IScalarSubquery;
-import org.teiid.connector.language.ISearchedCaseExpression;
-import org.teiid.connector.language.ISelect;
-import org.teiid.connector.language.ISelectSymbol;
-import org.teiid.connector.language.ISetClause;
-import org.teiid.connector.language.ISetClauseList;
-import org.teiid.connector.language.ISetQuery;
-import org.teiid.connector.language.ISubqueryCompareCriteria;
-import org.teiid.connector.language.ISubqueryInCriteria;
-import org.teiid.connector.language.IUpdate;
-import org.teiid.connector.metadata.runtime.Element;
-import org.teiid.connector.metadata.runtime.Group;
-import org.teiid.connector.metadata.runtime.Parameter;
-import org.teiid.connector.metadata.runtime.Procedure;
-
-
-/**
- */
-public class LanguageFactoryImpl implements ILanguageFactory {
-
-    /**
-     * Public instance, holds no state so can be shared by everyone.
-     */
-    public static final LanguageFactoryImpl INSTANCE = new LanguageFactoryImpl();
-
-
-
-    /* 
-     * @see com.metamatrix.data.language.ILanguageFactory#createAggregate(java.lang.String, boolean, com.metamatrix.data.language.IExpression, java.lang.Class)
-     */
-    public IAggregate createAggregate(String name, boolean isDistinct, IExpression expression, Class type) {
-        return new AggregateImpl(name, isDistinct, expression, type);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILanguageFactory#createCompareCriteria(int, com.metamatrix.data.language.IExpression, com.metamatrix.data.language.IExpression)
-     */
-    public ICompareCriteria createCompareCriteria(
-        ICompareCriteria.Operator operator,
-        IExpression leftExpression,
-        IExpression rightExpression) {
-        return new CompareCriteriaImpl(leftExpression, rightExpression, operator);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILanguageFactory#createCompoundCriteria(int, java.util.List)
-     */
-    public ICompoundCriteria createCompoundCriteria(ICompoundCriteria.Operator operator, List innerCriteria) {
-        return new CompoundCriteriaImpl(innerCriteria, operator);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILanguageFactory#createDelete(com.metamatrix.data.language.IGroup, com.metamatrix.data.language.ICriteria)
-     */
-    public IDelete createDelete(IGroup group, ICriteria criteria) {
-        return new DeleteImpl(group, criteria);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILanguageFactory#createElement(java.lang.String, com.metamatrix.data.language.IGroup, com.metamatrix.data.metadata.runtime.MetadataID)
-     */
-    public IElement createElement(String name, IGroup group, Element metadataReference, Class type) {
-        return new ElementImpl(group, name, metadataReference, type);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILanguageFactory#createExistsCriteria(com.metamatrix.data.language.IQuery)
-     */
-    public IExistsCriteria createExistsCriteria(IQuery query) {
-        return new ExistsCriteriaImpl(query);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILanguageFactory#createFrom(java.util.List)
-     */
-    public IFrom createFrom(List items) {
-        return new FromImpl(items);
-    }
-    
-    @Override
-    public IFunction createFunction(String functionName, IExpression[] args,
-    		Class<?> type) {
-    	return new FunctionImpl(functionName, Arrays.asList(args), type);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILanguageFactory#createFunction(java.lang.String, com.metamatrix.data.language.IExpression[], java.lang.Class)
-     */
-    @Override
-    public IFunction createFunction(String functionName, List<? extends IExpression> args, Class<?> type) {
-        return new FunctionImpl(functionName, args, type);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILanguageFactory#createGroup(java.lang.String, java.lang.String, com.metamatrix.data.metadata.runtime.MetadataID)
-     */
-    public IGroup createGroup(String context, String definition, Group metadataReference) {
-        return new GroupImpl(context, definition, metadataReference);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILanguageFactory#createGroupBy(java.util.List)
-     */
-    public IGroupBy createGroupBy(List items) {
-        return new GroupByImpl(items);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILanguageFactory#createInCriteria(com.metamatrix.data.language.IExpression, java.util.List, boolean)
-     */
-    public IInCriteria createInCriteria(IExpression leftExpression, List rightExpressions, boolean isNegated) {
-        return new InCriteriaImpl(leftExpression, rightExpressions, isNegated);
-    }
-    
-    @Override
-    public IInsert createInsert(IGroup group, List<IElement> columns,
-    		IInsertValueSource valueSource) {
-        return new InsertImpl(group, columns, valueSource);
-    }
-    
-    @Override
-    public IInsertExpressionValueSource createInsertExpressionValueSource(
-    		List<IExpression> values) {
-    	return new InsertValueExpressionsImpl(values);
-    }
-    
-    /* 
-     * @see com.metamatrix.data.language.ILanguageFactory#createIsNullCriteria(com.metamatrix.data.language.IExpression, boolean)
-     */
-    public IIsNullCriteria createIsNullCriteria(IExpression expression, boolean isNegated) {
-        return new IsNullCriteriaImpl(expression, isNegated);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILanguageFactory#createJoin(int, com.metamatrix.data.language.IFromItem, com.metamatrix.data.language.IFromItem, java.util.List)
-     */
-    public IJoin createJoin(IJoin.JoinType joinType, IFromItem leftItem, IFromItem rightItem, List criteria) {
-        return new JoinImpl(leftItem, rightItem, joinType, criteria);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILanguageFactory#createLikeCriteria(com.metamatrix.data.language.IExpression, com.metamatrix.data.language.IExpression, java.lang.Character, boolean)
-     */
-    public ILikeCriteria createLikeCriteria(
-        IExpression leftExpression,
-        IExpression rightExpression,
-        Character escapeCharacter,
-        boolean isNegated) {
-        return new LikeCriteriaImpl(leftExpression, rightExpression, escapeCharacter, isNegated);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILanguageFactory#createLiteral(java.lang.Object, java.lang.Class)
-     */
-    public ILiteral createLiteral(Object value, Class type) {
-        return new LiteralImpl(value, type);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILanguageFactory#createNotCriteria(com.metamatrix.data.language.ICriteria)
-     */
-    public INotCriteria createNotCriteria(ICriteria criteria) {
-        return new NotCriteriaImpl(criteria);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILanguageFactory#createOrderBy(java.util.List)
-     */
-    public IOrderBy createOrderBy(List items) {
-        return new OrderByImpl(items);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILanguageFactory#createOrderByItem(java.lang.String, com.metamatrix.data.language.IElement, boolean)
-     */
-    public IOrderByItem createOrderByItem(String name, IElement element, boolean direction) {
-        return new OrderByItemImpl(name, direction, element);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILanguageFactory#createParameter(int, int, java.lang.Object, java.lang.Class)
-     */
-    public IParameter createParameter(int index, IParameter.Direction direction, Object value, Class type, Parameter metadataReference) {
-        return new ParameterImpl(index, direction, value, type, metadataReference);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILanguageFactory#createProcedure(java.lang.String, java.util.List, com.metamatrix.data.metadata.runtime.MetadataID)
-     */
-    public IProcedure createProcedure(String name, List parameters, Procedure metadataReference) {
-        return new ProcedureImpl(name, parameters, metadataReference);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILanguageFactory#createQuery(com.metamatrix.data.language.ISelect, com.metamatrix.data.language.IFrom, com.metamatrix.data.language.ICriteria, com.metamatrix.data.language.IGroupBy, com.metamatrix.data.language.ICriteria, com.metamatrix.data.language.IOrderBy)
-     */
-    public IQuery createQuery(
-        ISelect select,
-        IFrom from,
-        ICriteria where,
-        IGroupBy groupBy,
-        ICriteria having,
-        IOrderBy orderBy) {
-        return new QueryImpl(select, from, where, groupBy, having, orderBy);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILanguageFactory#createScalarSubquery(com.metamatrix.data.language.IQuery)
-     */
-    public IScalarSubquery createScalarSubquery(IQuery query) {
-        return new ScalarSubqueryImpl(query);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILanguageFactory#createSearchedCaseExpression(java.util.List, java.util.List, com.metamatrix.data.language.IExpression, java.lang.Class)
-     */
-    public ISearchedCaseExpression createSearchedCaseExpression(
-        List whenExpressions,
-        List thenExpressions,
-        IExpression elseExpression,
-        Class type) {
-        return new SearchedCaseExpressionImpl(whenExpressions, thenExpressions, elseExpression, type);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILanguageFactory#createSelect(boolean, java.util.List)
-     */
-    public ISelect createSelect(boolean isDistinct, List selectSymbols) {
-        return new SelectImpl(selectSymbols, isDistinct);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILanguageFactory#createSelectSymbol(java.lang.String, com.metamatrix.data.language.IExpression)
-     */
-    public ISelectSymbol createSelectSymbol(String name, IExpression expression) {
-        return new SelectSymbolImpl(name, expression);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILanguageFactory#createSubqueryCompareCriteria(com.metamatrix.data.language.IExpression, int, int, com.metamatrix.data.language.IQuery)
-     */
-    public ISubqueryCompareCriteria createSubqueryCompareCriteria(
-        IExpression leftExpression,
-        ICompareCriteria.Operator operator,
-        ISubqueryCompareCriteria.Quantifier quantifier,
-        IQuery subquery) {
-        return new SubqueryCompareCriteriaImpl(leftExpression, operator, quantifier, subquery);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILanguageFactory#createSubqueryInCriteria(com.metamatrix.data.language.IExpression, com.metamatrix.data.language.IQuery, boolean)
-     */
-    public ISubqueryInCriteria createSubqueryInCriteria(IExpression expression, IQuery subquery, boolean isNegated) {
-        return new SubqueryInCriteriaImpl(expression, isNegated, subquery);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILanguageFactory#createUpdate(com.metamatrix.data.language.IGroup, java.util.List, com.metamatrix.data.language.ICriteria)
-     */
-    public IUpdate createUpdate(IGroup group, ISetClauseList updates, ICriteria criteria) {
-        return new UpdateImpl(group, updates, criteria);
-    }
-
-    public IInlineView createInlineView(IQueryCommand query, String name) {
-        return new InlineViewImpl(query, name);
-    }
-
-    public ISetQuery createSetOp(ISetQuery.Operation operation, boolean all, IQueryCommand leftQuery, IQueryCommand rightQuery, IOrderBy orderBy, ILimit limit) {
-        SetQueryImpl queryImpl = new SetQueryImpl();
-        queryImpl.setOperation(operation);
-        queryImpl.setAll(all);
-        queryImpl.setLeftQuery(leftQuery);
-        queryImpl.setRightQuery(rightQuery);
-        queryImpl.setOrderBy(orderBy);
-        queryImpl.setLimit(limit);
-        return queryImpl;
-    }
-
-	@Override
-	public ISetClause createSetClause(IElement symbol, IExpression value) {
-		return new SetClauseImpl(symbol, value);
-	}
-
-	@Override
-	public ISetClauseList createSetClauseList(List<ISetClause> clauses) {
-		return new SetClauseListImpl(clauses);
-	}
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/LikeCriteriaImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/LikeCriteriaImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/LikeCriteriaImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -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 org.teiid.dqp.internal.datamgr.language;
-
-import org.teiid.connector.language.IExpression;
-import org.teiid.connector.language.ILikeCriteria;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-public class LikeCriteriaImpl extends BaseLanguageObject implements ILikeCriteria {
-        
-    private IExpression leftExpression = null;
-    private IExpression rightExpression = null;
-    private Character escapeCharacter = null;
-    private boolean isNegated = false;
-    
-    public LikeCriteriaImpl(IExpression left, IExpression right, Character escapeCharacter, boolean negated) {
-        leftExpression = left;
-        rightExpression = right;
-        this.escapeCharacter = escapeCharacter;
-        this.isNegated = negated;
-        
-    }
-
-    /**
-     * @see org.teiid.connector.language.ILikeCriteria#getLeftExpression()
-     */
-    public IExpression getLeftExpression() {
-        return leftExpression;
-    }
-
-    /**
-     * @see org.teiid.connector.language.ILikeCriteria#getRightExpression()
-     */
-    public IExpression getRightExpression() {
-        return rightExpression;
-    }
-
-    /**
-     * @see org.teiid.connector.language.ILikeCriteria#getEscapeCharacter()
-     */
-    public Character getEscapeCharacter() {
-        return this.escapeCharacter;
-    }
-
-    /**
-     * @see org.teiid.connector.language.ILikeCriteria#isNegated()
-     */
-    public boolean isNegated() {
-        return this.isNegated;
-    }
-
-    /**
-     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
-     */
-    public void acceptVisitor(LanguageObjectVisitor visitor) {
-        visitor.visit(this);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILikeCriteria#setLeftExpression(com.metamatrix.data.language.IExpression)
-     */
-    public void setLeftExpression(IExpression expression) {
-        this.leftExpression = expression;        
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILikeCriteria#setRightExpression(com.metamatrix.data.language.IExpression)
-     */
-    public void setRightExpression(IExpression expression) {
-        this.rightExpression = expression;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILikeCriteria#setEscapeCharacter(java.lang.Character)
-     */
-    public void setEscapeCharacter(Character character) {
-        this.escapeCharacter = character;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILikeCriteria#setNegated(boolean)
-     */
-    public void setNegated(boolean negated) {
-        this.isNegated = negated;
-    }
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/LimitImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/LimitImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/LimitImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,65 +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 org.teiid.dqp.internal.datamgr.language;
-
-import org.teiid.connector.language.ILimit;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-
-/** 
- * @since 4.3
- */
-public class LimitImpl extends BaseLanguageObject implements ILimit {
-
-    private int rowOffset;
-    private int rowLimit;
-    
-    public LimitImpl(int offset, int rowLimit) {
-        this.rowOffset = offset;
-        this.rowLimit = rowLimit;
-    }
-    /** 
-     * @see org.teiid.connector.language.ILimit#getRowLimit()
-     * @since 4.3
-     */
-    public int getRowLimit() {
-        return rowLimit;
-    }
-
-    /** 
-     * @see org.teiid.connector.language.ILimit#getRowOffset()
-     * @since 4.3
-     */
-    public int getRowOffset() {
-        return rowOffset;
-    }
-
-    /** 
-     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(org.teiid.connector.visitor.framework.LanguageObjectVisitor)
-     * @since 4.3
-     */
-    public void acceptVisitor(LanguageObjectVisitor visitor) {
-        visitor.visit(this);
-    }
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/LiteralImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/LiteralImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/LiteralImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -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.
- */
-
-package org.teiid.dqp.internal.datamgr.language;
-
-import org.teiid.connector.language.ILiteral;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-public class LiteralImpl extends BaseLanguageObject implements ILiteral {
-    
-    private Object value;
-    private Class<?> type;
-    private boolean bindValue;
-    private boolean multiValued;
-    
-    public LiteralImpl(Object value, Class<?> type) {
-        this.value = value;
-        this.type = type;
-    }
-    
-    /**
-     * @see org.teiid.connector.language.ILiteral#getValue()
-     */
-    public Object getValue() {
-        return this.value;
-    }
-
-    /**
-     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
-     */
-    public void acceptVisitor(LanguageObjectVisitor visitor) {
-        visitor.visit(this);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILiteral#getType()
-     */
-    public Class<?> getType() {
-        return this.type;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILiteral#setValue(java.lang.Object)
-     */
-    public void setValue(Object value) {
-        this.value = value;
-    }
-
-    /** 
-     * @see org.teiid.connector.language.ILiteral#isBindValue()
-     */
-    public boolean isBindValue() {
-        return bindValue;
-    }
-
-    /** 
-     * @see org.teiid.connector.language.ILiteral#setBindValue(boolean)
-     */
-    public void setBindValue(boolean bindValue) {
-        this.bindValue = bindValue;
-    }
-
-	@Override
-	public boolean isMultiValued() {
-		return multiValued;
-	}
-
-	@Override
-	public void setMultiValued(boolean multiValued) {
-		this.multiValued = multiValued;
-	}
-
-	@Override
-	public void setType(Class<?> type) {
-		this.type = type;
-	}
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/NotCriteriaImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/NotCriteriaImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/NotCriteriaImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,56 +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 org.teiid.dqp.internal.datamgr.language;
-
-import org.teiid.connector.language.ICriteria;
-import org.teiid.connector.language.INotCriteria;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-public class NotCriteriaImpl extends BaseLanguageObject implements INotCriteria {
-
-    private ICriteria criteria = null;
-    
-    public NotCriteriaImpl(ICriteria criteria) {
-        this.criteria = criteria;
-    }
-    /**
-     * @see org.teiid.connector.language.INotCriteria#getCriteria()
-     */
-    public ICriteria getCriteria() {
-        return criteria;
-    }
-
-    /**
-     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
-     */
-    public void acceptVisitor(LanguageObjectVisitor visitor) {
-        visitor.visit(this);
-    }
-    /* 
-     * @see com.metamatrix.data.language.INotCriteria#setCriteria(com.metamatrix.data.language.ICriteria)
-     */
-    public void setCriteria(ICriteria criteria) {
-        this.criteria = criteria;
-    }
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/OrderByImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/OrderByImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/OrderByImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,60 +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 org.teiid.dqp.internal.datamgr.language;
-
-import java.util.List;
-
-import org.teiid.connector.language.IOrderBy;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-
-public class OrderByImpl extends BaseLanguageObject implements IOrderBy {
-
-    private List items = null;
-    
-    public OrderByImpl(List items) {
-        this.items = items;
-    }
-    
-    /**
-     * @see org.teiid.connector.language.IOrderBy#getItems()
-     */
-    public List getItems() {
-        return items;
-    }
-
-    /**
-     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
-     */
-    public void acceptVisitor(LanguageObjectVisitor visitor) {
-        visitor.visit(this);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IOrderBy#setItems(java.util.List)
-     */
-    public void setItems(List items) {
-        this.items = items;
-    }
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/OrderByItemImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/OrderByItemImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/OrderByItemImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,90 +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 org.teiid.dqp.internal.datamgr.language;
-
-import org.teiid.connector.language.IElement;
-import org.teiid.connector.language.IOrderByItem;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-public class OrderByItemImpl extends BaseLanguageObject implements IOrderByItem {
-    
-    private String name;
-    private boolean direction = false;
-    private IElement element;       // optional, may be null
-    
-    public OrderByItemImpl(String name, boolean direction, IElement element) {
-        this.name = name;
-        this.direction = direction;
-        this.element = element;
-    }
-
-    /**
-     * @see org.teiid.connector.language.IOrderByItem#getName()
-     */
-    public String getName() {
-        return this.name;
-    }
-
-    /**
-     * @see org.teiid.connector.language.IOrderByItem#getDirection()
-     */
-    public boolean getDirection() {
-        return direction;
-    }
-
-    /**
-     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
-     */
-    public void acceptVisitor(LanguageObjectVisitor visitor) {
-        visitor.visit(this);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IOrderByItem#setName(java.lang.String)
-     */
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IOrderByItem#setDirection(boolean)
-     */
-    public void setDirection(boolean direction) {
-        this.direction = direction;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IOrderByElementItem#getElement()
-     */
-    public IElement getElement() {
-        return this.element;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IOrderByElementItem#setElement(com.metamatrix.data.language.IElement)
-     */
-    public void setElement(IElement element) {
-        this.element = element;
-    }
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/ParameterImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/ParameterImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/ParameterImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -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 org.teiid.dqp.internal.datamgr.language;
-
-import org.teiid.connector.language.IParameter;
-import org.teiid.connector.metadata.runtime.Parameter;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-public class ParameterImpl extends BaseLanguageObject implements IParameter {
-
-    private int index;
-    private Direction direction;
-    private Object value;
-    private boolean valueSpecified;
-    private Class type;
-    private Parameter metadataObject;
-    
-    public ParameterImpl(int index, Direction direction, Object value, Class type, Parameter metadataObject) {
-        setIndex(index);
-        setDirection(direction);
-        setValue(value);
-        setType(type);
-        this.metadataObject = metadataObject;
-    }
-    
-    /**
-     * @see org.teiid.connector.language.IParameter#getIndex()
-     */
-    public int getIndex() {
-        return this.index;
-    }
-
-    /**
-     * @see org.teiid.connector.language.IParameter#getDirection()
-     */
-    public Direction getDirection() {
-        return this.direction;
-    }
-
-    /**
-     * @see org.teiid.connector.language.IParameter#getType()
-     */
-    public Class getType() {
-        return this.type;
-    }
-
-    /*
-     * @see com.metamatrix.data.language.IParameter#getValue()
-     */
-    public Object getValue() {
-        return this.value;
-    }
-
-    /**
-     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
-     */
-    public void acceptVisitor(LanguageObjectVisitor visitor) {
-        visitor.visit(this);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IParameter#setIndex(int)
-     */
-    public void setIndex(int index) {
-        this.index = index;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IParameter#setDirection(int)
-     */
-    public void setDirection(Direction direction) {
-        this.direction = direction;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IParameter#setType(java.lang.Class)
-     */
-    public void setType(Class type) {
-        this.type = type;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IParameter#setValue(java.lang.Object)
-     */
-    public void setValue(Object value) {
-        this.value = value;
-        if(value != null) {
-            setValueSpecified(true);
-        }
-    }
-
-    @Override
-    public Parameter getMetadataObject() {
-    	return this.metadataObject;
-    }
-
-    public void setMetadataObject(Parameter metadataObject) {
-		this.metadataObject = metadataObject;
-	}
-    
-    /** 
-     * @see org.teiid.connector.language.IParameter#getValueSpecified()
-     * @since 4.3.2
-     */
-    public boolean getValueSpecified() {
-        return this.valueSpecified;
-    }
-    
-    /** 
-     * @see org.teiid.connector.language.IParameter#setValueSpecified(boolean)
-     * @since 4.3.2
-     */
-    public void setValueSpecified(boolean specified) {
-        this.valueSpecified = specified;
-    }
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/ProcedureImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/ProcedureImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/ProcedureImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,121 +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 org.teiid.dqp.internal.datamgr.language;
-
-import java.util.List;
-
-import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.language.IParameter;
-import org.teiid.connector.language.IProcedure;
-import org.teiid.connector.language.IParameter.Direction;
-import org.teiid.connector.metadata.runtime.Element;
-import org.teiid.connector.metadata.runtime.Procedure;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-
-public class ProcedureImpl extends BaseLanguageObject implements IProcedure {
-
-    private String name;
-    private List<IParameter> parameters;
-    private Procedure metadataObject;
-    
-    public ProcedureImpl(String name, List<IParameter> parameters, Procedure metadataObject) {
-        this.name = name;
-        this.parameters = parameters;
-        this.metadataObject = metadataObject;
-    }
-    
-    /**
-     * @see com.metamatrix.data.language.IExecute#getProcedureName()
-     */
-    public String getProcedureName() {
-        return this.name;
-    }
-
-    /**
-     * @see com.metamatrix.data.language.IExecute#getVariableValues()
-     */
-    public List<IParameter> getParameters() {
-        return parameters;
-    }
-
-    /**
-     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
-     */
-    public void acceptVisitor(LanguageObjectVisitor visitor) {
-        visitor.visit(this);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IExecute#setProcedureName(java.lang.String)
-     */
-    public void setProcedureName(String name) {
-        this.name = name;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IExecute#setParameters(java.util.List)
-     */
-    public void setParameters(List<IParameter> parameters) {
-        this.parameters = parameters;
-    }
-
-    @Override
-    public Procedure getMetadataObject() {
-    	return this.metadataObject;
-    }
-
-    public void setMetadataObject(Procedure metadataID) {
-        this.metadataObject = metadataID;
-    }
-    
-    public boolean equals(Object obj) {
-        if(obj == this) {
-            return true;
-        }
-        
-        if(obj == null) {
-            return false;
-        }
-        
-        IProcedure proc = (IProcedure) obj;
-        return getProcedureName().equalsIgnoreCase(proc.getProcedureName());
-    }
-    
-    public Class<?>[] getResultSetColumnTypes() throws ConnectorException {
-        for (IParameter param : parameters) {
-            if(param.getDirection() == Direction.RESULT_SET){
-                List<Element> columnMetadata = param.getMetadataObject().getChildren();
-
-                int size = columnMetadata.size();
-                Class<?>[] coulmnDTs = new Class[size];
-                for(int i =0; i<size; i++ ){
-                    coulmnDTs[i] = columnMetadata.get(i).getJavaType();
-                }
-                return coulmnDTs;
-            }
-        }
-        return new Class[0];
-    }
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/QueryCommandImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/QueryCommandImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/QueryCommandImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,90 +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 org.teiid.dqp.internal.datamgr.language;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.teiid.connector.language.ILimit;
-import org.teiid.connector.language.IOrderBy;
-import org.teiid.connector.language.ISelectSymbol;
-
-
-public abstract class QueryCommandImpl extends BaseLanguageObject implements org.teiid.connector.language.IQueryCommand {
-
-    private IOrderBy orderBy = null;
-    private ILimit limit = null;
-
-    /**
-     * @see org.teiid.connector.language.IQuery#getOrderBy()
-     */
-    public IOrderBy getOrderBy() {
-        return orderBy;
-    }
-
-    /**
-     * @see org.teiid.connector.language.IQuery#getLimit()
-     */
-    public ILimit getLimit() {
-        return limit;
-    }
-    
-    public String[] getColumnNames() {
-        List selectSymbols = getProjectedQuery().getSelect().getSelectSymbols();
-        String[] columnNames = new String[selectSymbols.size()];
-        int symbolIndex = 0;
-        for (Iterator i = selectSymbols.iterator(); i.hasNext(); symbolIndex++) {
-            columnNames[symbolIndex] = ((ISelectSymbol)i.next()).getOutputName();
-        }
-        return columnNames;
-    }
-    
-    public Class[] getColumnTypes() {
-        List selectSymbols = getProjectedQuery().getSelect().getSelectSymbols();
-        Class[] columnTypes = new Class[selectSymbols.size()];
-        int symbolIndex = 0;
-        for (Iterator i = selectSymbols.iterator(); i.hasNext(); symbolIndex++) {
-            ISelectSymbol symbol = (ISelectSymbol)i.next();
-            if (symbol.getExpression() == null) {
-                columnTypes[symbolIndex] = null;
-            } else {
-                columnTypes[symbolIndex] = symbol.getExpression().getType();
-            }
-        }
-        return columnTypes;
-    }
-    
-    /* 
-     * @see com.metamatrix.data.language.IQuery#setOrderBy(com.metamatrix.data.language.IOrderBy)
-     */
-    public void setOrderBy(IOrderBy orderBy) {
-        this.orderBy = orderBy;
-    }
-    
-    /* 
-     * @see com.metamatrix.data.language.IQuery#setOrderBy(com.metamatrix.data.language.IOrderBy)
-     */
-    public void setLimit(ILimit limit) {
-        this.limit = limit;
-    }
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/QueryImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/QueryImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/QueryImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,158 +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 org.teiid.dqp.internal.datamgr.language;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.teiid.connector.language.ICriteria;
-import org.teiid.connector.language.IFrom;
-import org.teiid.connector.language.IGroupBy;
-import org.teiid.connector.language.IOrderBy;
-import org.teiid.connector.language.IQuery;
-import org.teiid.connector.language.ISelect;
-import org.teiid.connector.language.ISelectSymbol;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-
-public class QueryImpl extends QueryCommandImpl implements IQuery {
-
-    private ISelect select = null;
-    private IFrom from = null;
-    private ICriteria where = null;
-    private IGroupBy groupBy = null;
-    private ICriteria having = null;
-    
-    public QueryImpl(ISelect select, IFrom from, ICriteria where,
-                     IGroupBy groupBy, ICriteria having, IOrderBy orderBy) {
-        this.select = select;
-        this.from = from;
-        this.where = where;
-        this.groupBy = groupBy;
-        this.having = having;
-        this.setOrderBy(orderBy);
-    }
-    /**
-     * @see org.teiid.connector.language.IQuery#getSelect()
-     */
-    public ISelect getSelect() {
-        return select;
-    }
-
-    /**
-     * @see org.teiid.connector.language.IQuery#getFrom()
-     */
-    public IFrom getFrom() {
-        return from;
-    }
-
-    /**
-     * @see org.teiid.connector.language.IQuery#getWhere()
-     */
-    public ICriteria getWhere() {
-        return where;
-    }
-
-    /**
-     * @see org.teiid.connector.language.IQuery#getGroupBy()
-     */
-    public IGroupBy getGroupBy() {
-        return groupBy;
-    }
-
-    /**
-     * @see org.teiid.connector.language.IQuery#getHaving()
-     */
-    public ICriteria getHaving() {
-        return having;
-    }
-
-    public String[] getColumnNames() {
-        List selectSymbols = getSelect().getSelectSymbols();
-        String[] columnNames = new String[selectSymbols.size()];
-        int symbolIndex = 0;
-        for (Iterator i = selectSymbols.iterator(); i.hasNext(); symbolIndex++) {
-            columnNames[symbolIndex] = ((ISelectSymbol)i.next()).getOutputName();
-        }
-        return columnNames;
-    }
-    
-    public Class[] getColumnTypes() {
-        List selectSymbols = getSelect().getSelectSymbols();
-        Class[] columnTypes = new Class[selectSymbols.size()];
-        int symbolIndex = 0;
-        for (Iterator i = selectSymbols.iterator(); i.hasNext(); symbolIndex++) {
-            ISelectSymbol symbol = (ISelectSymbol)i.next();
-            if (symbol.getExpression() == null) {
-                columnTypes[symbolIndex] = null;
-            } else {
-                columnTypes[symbolIndex] = symbol.getExpression().getType();
-            }
-        }
-        return columnTypes;
-    }
-    
-    /**
-     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
-     */
-    public void acceptVisitor(LanguageObjectVisitor visitor) {
-        visitor.visit(this);
-    }
-    /* 
-     * @see com.metamatrix.data.language.IQuery#setSelect(com.metamatrix.data.language.ISelect)
-     */
-    public void setSelect(ISelect select) {
-        this.select = select;
-    }
-    /* 
-     * @see com.metamatrix.data.language.IQuery#setFrom(com.metamatrix.data.language.IFrom)
-     */
-    public void setFrom(IFrom from) {
-        this.from = from;
-    }
-    /* 
-     * @see com.metamatrix.data.language.IQuery#setWhere(com.metamatrix.data.language.ICriteria)
-     */
-    public void setWhere(ICriteria criteria) {
-        this.where = criteria;
-    }
-    /* 
-     * @see com.metamatrix.data.language.IQuery#setGroupBy(com.metamatrix.data.language.IGroupBy)
-     */
-    public void setGroupBy(IGroupBy groupBy) {
-        this.groupBy = groupBy;
-    }
-    /* 
-     * @see com.metamatrix.data.language.IQuery#setHaving(com.metamatrix.data.language.ICriteria)
-     */
-    public void setHaving(ICriteria criteria) {
-        this.having = criteria;
-    }
-    
-    /** 
-     * @see org.teiid.dqp.internal.datamgr.language.QueryCommandImpl#getProjectedQuery()
-     */
-    public IQuery getProjectedQuery() {
-        return this;
-    }
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/ScalarSubqueryImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/ScalarSubqueryImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/ScalarSubqueryImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,79 +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 org.teiid.dqp.internal.datamgr.language;
-
-import org.teiid.connector.language.IQueryCommand;
-import org.teiid.connector.language.IScalarSubquery;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-/**
- */
-public class ScalarSubqueryImpl extends BaseLanguageObject implements IScalarSubquery {
-
-    private IQueryCommand query;
-    private Class type;
-
-    /**
-     * 
-     */
-    public ScalarSubqueryImpl(IQueryCommand query) {
-        setQuery(query);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IExpression#getType()
-     */
-    public Class getType() {
-        return this.type;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ISubqueryContainer#getQuery()
-     */
-    public IQueryCommand getQuery() {
-        return this.query;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
-     */
-    public void acceptVisitor(LanguageObjectVisitor visitor) {
-        visitor.visit(this);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IExpression#setType(java.lang.Class)
-     */
-    public void setType(Class type) {
-        this.type = type;        
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ISubqueryContainer#setQuery(com.metamatrix.data.language.IQuery)
-     */
-    public void setQuery(IQueryCommand query) {
-        this.query = query;
-        this.type = query.getColumnTypes()[0];
-    }
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SearchedCaseExpressionImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SearchedCaseExpressionImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SearchedCaseExpressionImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,111 +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 org.teiid.dqp.internal.datamgr.language;
-
-import java.util.List;
-
-import org.teiid.connector.language.ICriteria;
-import org.teiid.connector.language.IExpression;
-import org.teiid.connector.language.ISearchedCaseExpression;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-
-public class SearchedCaseExpressionImpl extends BaseLanguageObject implements ISearchedCaseExpression {
-
-    private List whenExpressions;
-    private List thenExpressions;
-    private IExpression elseExpression;
-    private Class type;
-    
-    public SearchedCaseExpressionImpl(List whens, List thens, IExpression elseExpression, Class type) {
-        this.whenExpressions = whens;
-        this.thenExpressions = thens;
-        this.elseExpression = elseExpression;
-        this.type = type;
-    }
-    /**
-     * @see org.teiid.connector.language.ISearchedCaseExpression#getElseExpression()
-     */
-    public IExpression getElseExpression() {
-        return elseExpression;
-    }
-
-    /**
-     * @see org.teiid.connector.language.ISearchedCaseExpression#getThenExpression(int)
-     */
-    public IExpression getThenExpression(int index) {
-        return (IExpression)thenExpressions.get(index);
-    }
-
-    /**
-     * @see org.teiid.connector.language.ISearchedCaseExpression#getWhenCount()
-     */
-    public int getWhenCount() {
-        return whenExpressions.size();
-    }
-
-    /**
-     * @see org.teiid.connector.language.ISearchedCaseExpression#getWhenCriteria(int)
-     */
-    public ICriteria getWhenCriteria(int index) {
-        return (ICriteria)whenExpressions.get(index);
-    }
-
-    /**
-     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
-     */
-    public void acceptVisitor(LanguageObjectVisitor visitor) {
-        visitor.visit(this);
-    }
-    /* 
-     * @see com.metamatrix.data.language.ISearchedCaseExpression#setWhenCriteria(int, com.metamatrix.data.language.ICriteria)
-     */
-    public void setWhenCriteria(int index, ICriteria criteria) {
-        this.whenExpressions.set(index, criteria);
-    }
-    /* 
-     * @see com.metamatrix.data.language.ISearchedCaseExpression#setThenExpression(int, com.metamatrix.data.language.IExpression)
-     */
-    public void setThenExpression(int index, IExpression expression) {
-        this.thenExpressions.set(index, expression);
-    }
-    /* 
-     * @see com.metamatrix.data.language.ISearchedCaseExpression#setElseExpression(com.metamatrix.data.language.IExpression)
-     */
-    public void setElseExpression(IExpression expression) {
-        this.elseExpression = expression;
-    }
-    /* 
-     * @see com.metamatrix.data.language.IExpression#getType()
-     */
-    public Class getType() {
-        return this.type;
-    }
-    /* 
-     * @see com.metamatrix.data.language.IExpression#setType(java.lang.Class)
-     */
-    public void setType(Class type) {
-        this.type = type;
-    }
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SelectImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SelectImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SelectImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -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 org.teiid.dqp.internal.datamgr.language;
-
-import java.util.List;
-
-import org.teiid.connector.language.ISelect;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-
-public class SelectImpl extends BaseLanguageObject implements ISelect {
-    
-    private List selectSymbols = null;
-    private boolean isDistinct = false;
-    
-    public SelectImpl(List symbols, boolean distinct) {
-        selectSymbols = symbols;
-        this.isDistinct = distinct;
-    }
-
-    /**
-     * @see org.teiid.connector.language.ISelect#getSelectSymbols()
-     */
-    public List getSelectSymbols() {
-        return selectSymbols;
-    }
-
-    /**
-     * @see org.teiid.connector.language.ISelect#isDistinct()
-     */
-    public boolean isDistinct() {
-        return this.isDistinct;
-    }
-
-    /**
-     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
-     */
-    public void acceptVisitor(LanguageObjectVisitor visitor) {
-        visitor.visit(this);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ISelect#setSelectSymbols(java.util.List)
-     */
-    public void setSelectSymbols(List symbols) {
-        this.selectSymbols = symbols;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ISelect#setDistinct(boolean)
-     */
-    public void setDistinct(boolean distinct) {
-        this.isDistinct = distinct;
-    }
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SelectSymbolImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SelectSymbolImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SelectSymbolImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,85 +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 org.teiid.dqp.internal.datamgr.language;
-
-import org.teiid.connector.language.IExpression;
-import org.teiid.connector.language.ISelectSymbol;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-public class SelectSymbolImpl extends BaseLanguageObject implements ISelectSymbol {
-
-    private boolean hasAlias;
-    private String name;
-    private IExpression expression = null;
-    
-    public SelectSymbolImpl(String name, IExpression expression) {
-        this.name = name;
-        this.expression = expression;
-    }
-    /**
-     * @see org.teiid.connector.language.ISelectSymbol#hasAlias()
-     */
-    public boolean hasAlias() {
-        return hasAlias;
-    }
-
-    public void setAlias(boolean alias){
-        this.hasAlias = alias;    
-    }
-    
-    /**
-     * @see org.teiid.connector.language.ISelectSymbol#getOutputName()
-     */
-    public String getOutputName() {
-        return name;
-    }
-
-    /**
-     * @see org.teiid.connector.language.ISelectSymbol#getExpression()
-     */
-    public IExpression getExpression() {
-        return expression;
-    }
-
-    /**
-     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
-     */
-    public void acceptVisitor(LanguageObjectVisitor visitor) {
-        visitor.visit(this);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ISelectSymbol#setOutputName(java.lang.String)
-     */
-    public void setOutputName(String name) {
-        this.name = name;
-    }
-    
-    /* 
-     * @see com.metamatrix.data.language.ISelectSymbol#setExpression(com.metamatrix.data.language.IExpression)
-     */
-    public void setExpression(IExpression expression) {
-        this.expression = expression;
-    }
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SetClauseImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SetClauseImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SetClauseImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,65 +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 org.teiid.dqp.internal.datamgr.language;
-
-import org.teiid.connector.language.IElement;
-import org.teiid.connector.language.IExpression;
-import org.teiid.connector.language.ISetClause;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-public class SetClauseImpl extends BaseLanguageObject implements ISetClause {
-
-	private IElement symbol;
-	private IExpression value;
-	
-	public SetClauseImpl(IElement symbol, IExpression value) {
-		this.symbol = symbol;
-		this.value = value;
-	}
-
-	@Override
-	public IElement getSymbol() {
-		return symbol;
-	}
-
-	@Override
-	public IExpression getValue() {
-		return value;
-	}
-
-	@Override
-	public void setSymbol(IElement symbol) {
-		this.symbol = symbol;
-	}
-
-	@Override
-	public void setValue(IExpression value) {
-		this.value = value;
-	}
-
-	@Override
-	public void acceptVisitor(LanguageObjectVisitor visitor) {
-		visitor.visit(this);
-	}
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SetClauseListImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SetClauseListImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SetClauseListImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,54 +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 org.teiid.dqp.internal.datamgr.language;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.teiid.connector.language.ISetClause;
-import org.teiid.connector.language.ISetClauseList;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-
-public class SetClauseListImpl extends BaseLanguageObject implements ISetClauseList {
-
-	private List<ISetClause> clauses;
-	
-	public SetClauseListImpl(List<ISetClause> clauses) {
-		if (clauses == null) {
-			clauses = new ArrayList<ISetClause>();
-		}
-		this.clauses = clauses;
-	}
-
-	@Override
-	public List<ISetClause> getClauses() {
-		return clauses;
-	}
-
-	@Override
-	public void acceptVisitor(LanguageObjectVisitor visitor) {
-		visitor.visit(this);
-	}
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SetQueryImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SetQueryImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SetQueryImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,109 +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 org.teiid.dqp.internal.datamgr.language;
-
-import org.teiid.connector.language.IQuery;
-import org.teiid.connector.language.IQueryCommand;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-public class SetQueryImpl extends QueryCommandImpl implements org.teiid.connector.language.ISetQuery {
-
-    private boolean all;
-    private IQueryCommand leftQuery;
-    private IQueryCommand rightQuery;
-    private Operation operation;
-    
-    /** 
-     * @see org.teiid.dqp.internal.datamgr.language.QueryCommandImpl#getProjectedQuery()
-     */
-    public IQuery getProjectedQuery() {
-        if (leftQuery instanceof IQuery) {
-            return (IQuery)leftQuery;
-        }
-        return leftQuery.getProjectedQuery();
-    }
-
-    /** 
-     * @see org.teiid.connector.language.ISetQuery#getLeftQuery()
-     */
-    public IQueryCommand getLeftQuery() {
-        return leftQuery;
-    }
-
-    /** 
-     * @see org.teiid.connector.language.ISetQuery#getOperation()
-     */
-    public Operation getOperation() {
-        return operation;
-    }
-
-    /** 
-     * @see org.teiid.connector.language.ISetQuery#getRightQuery()
-     */
-    public IQueryCommand getRightQuery() {
-        return rightQuery;
-    }
-
-    /** 
-     * @see org.teiid.connector.language.ISetQuery#isAll()
-     */
-    public boolean isAll() {
-        return all;
-    }
-
-    /** 
-     * @see org.teiid.connector.language.ISetQuery#setAll(boolean)
-     */
-    public void setAll(boolean all) {
-        this.all = all;
-    }
-
-    /** 
-     * @see org.teiid.connector.language.ISetQuery#setLeftQuery(org.teiid.connector.language.IQueryCommand)
-     */
-    public void setLeftQuery(IQueryCommand leftQuery) {
-        this.leftQuery = leftQuery;
-    }
-
-    /** 
-     * @see org.teiid.connector.language.ISetQuery#setOperation(org.teiid.connector.language.ISetQuery.Operation)
-     */
-    public void setOperation(Operation operation) {
-        this.operation = operation;
-    }
-
-    /** 
-     * @see org.teiid.connector.language.ISetQuery#setRightQuery(org.teiid.connector.language.IQueryCommand)
-     */
-    public void setRightQuery(IQueryCommand rightQuery) {
-        this.rightQuery = rightQuery;
-    }
-
-    /**
-     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
-     */
-    public void acceptVisitor(LanguageObjectVisitor visitor) {
-        visitor.visit(this);
-    }
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SubqueryCompareCriteriaImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SubqueryCompareCriteriaImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SubqueryCompareCriteriaImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,111 +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 org.teiid.dqp.internal.datamgr.language;
-
-import org.teiid.connector.language.*;
-import org.teiid.connector.language.ICompareCriteria.Operator;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-/**
- */
-public class SubqueryCompareCriteriaImpl extends BaseLanguageObject implements ISubqueryCompareCriteria {
-
-    private IExpression leftExpr;
-    private Operator operator;
-    private Quantifier quantifier;
-    private IQueryCommand query;
-    
-    /**
-     * 
-     */
-    public SubqueryCompareCriteriaImpl(IExpression leftExpr, Operator operator, Quantifier quantifier, IQueryCommand query) {
-        this.leftExpr = leftExpr;
-        this.operator = operator;
-        this.quantifier = quantifier;
-        this.query = query;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ISubqueryCompareCriteria#getLeftExpression()
-     */
-    public IExpression getLeftExpression() {
-        return this.leftExpr;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ISubqueryCompareCriteria#getOperator()
-     */
-    public Operator getOperator() {
-        return this.operator;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ISubqueryCompareCriteria#getQuantifier()
-     */
-    public Quantifier getQuantifier() {
-        return this.quantifier;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ISubqueryContainer#getQuery()
-     */
-    public IQueryCommand getQuery() {
-        return this.query;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
-     */
-    public void acceptVisitor(LanguageObjectVisitor visitor) {
-        visitor.visit(this);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ISubqueryCompareCriteria#setLeftExpression(com.metamatrix.data.language.IExpression)
-     */
-    public void setLeftExpression(IExpression expression) {
-        this.leftExpr = expression;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ISubqueryCompareCriteria#setOperator(int)
-     */
-    public void setOperator(Operator operator) {
-        this.operator = operator;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ISubqueryCompareCriteria#setQuantifier(int)
-     */
-    public void setQuantifier(Quantifier quantifier) {
-        this.quantifier = quantifier;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ISubqueryContainer#setQuery(com.metamatrix.data.language.IQuery)
-     */
-    public void setQuery(IQueryCommand query) {
-        this.query = query;
-    }
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SubqueryInCriteriaImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SubqueryInCriteriaImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/SubqueryInCriteriaImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,94 +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 org.teiid.dqp.internal.datamgr.language;
-
-import org.teiid.connector.language.*;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-/**
- */
-public class SubqueryInCriteriaImpl extends BaseLanguageObject implements ISubqueryInCriteria {
-
-    private IExpression leftExpr;
-    private boolean isNegated = false;
-    private IQueryCommand rightQuery;
-
-    /**
-     * 
-     */
-    public SubqueryInCriteriaImpl(IExpression leftExpr, boolean isNegated, IQueryCommand rightQuery) {
-        this.leftExpr = leftExpr;
-        this.isNegated = isNegated;
-        this.rightQuery = rightQuery;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IBaseInCriteria#getLeftExpression()
-     */
-    public IExpression getLeftExpression() {
-        return this.leftExpr;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IBaseInCriteria#isNegated()
-     */
-    public boolean isNegated() {
-        return this.isNegated;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ISubqueryContainer#getQuery()
-     */
-    public IQueryCommand getQuery() {
-        return this.rightQuery;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
-     */
-    public void acceptVisitor(LanguageObjectVisitor visitor) {
-        visitor.visit(this);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IBaseInCriteria#setLeftExpression(com.metamatrix.data.language.IExpression)
-     */
-    public void setLeftExpression(IExpression expression) {
-        this.leftExpr = expression;        
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IBaseInCriteria#setNegated(boolean)
-     */
-    public void setNegated(boolean negated) {
-        this.isNegated = negated;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.ISubqueryContainer#setQuery(com.metamatrix.data.language.IQuery)
-     */
-    public void setQuery(IQueryCommand query) {
-        this.rightQuery = query;
-    }
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/UpdateImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/UpdateImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/UpdateImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,89 +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 org.teiid.dqp.internal.datamgr.language;
-
-import org.teiid.connector.language.ICriteria;
-import org.teiid.connector.language.IGroup;
-import org.teiid.connector.language.ISetClauseList;
-import org.teiid.connector.language.IUpdate;
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-public class UpdateImpl extends BaseLanguageObject implements IUpdate {
-    
-    private IGroup group;
-    private ISetClauseList changes;
-    private ICriteria criteria;
-    
-    public UpdateImpl(IGroup group, ISetClauseList changes, ICriteria criteria) {
-        this.group = group;
-        this.changes = changes;
-        this.criteria = criteria;
-    }
-
-    /**
-     * @see org.teiid.connector.language.IUpdate#getGroup()
-     */
-    public IGroup getGroup() {
-        return group;
-    }
-
-    /**
-     * @see org.teiid.connector.language.IUpdate#getChanges()
-     */
-    public ISetClauseList getChanges() {
-        return changes;
-    }
-
-    /**
-     * @see org.teiid.connector.language.IUpdate#getCriteria()
-     */
-    public ICriteria getCriteria() {
-        return criteria;
-    }
-
-    /**
-     * @see org.teiid.connector.language.ILanguageObject#acceptVisitor(com.metamatrix.data.visitor.LanguageObjectVisitor)
-     */
-    public void acceptVisitor(LanguageObjectVisitor visitor) {
-        visitor.visit(this);
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IUpdate#setGroup(com.metamatrix.data.language.IGroup)
-     */
-    public void setGroup(IGroup group) {
-        this.group = group;
-    }
-
-    public void setChanges(ISetClauseList changes) {
-        this.changes = changes;
-    }
-
-    /* 
-     * @see com.metamatrix.data.language.IUpdate#setCriteria(com.metamatrix.data.language.ICriteria)
-     */
-    public void setCriteria(ICriteria criteria) {
-        this.criteria = criteria;
-    }
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/pooling/connector/ConnectionPool.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/pooling/connector/ConnectionPool.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/pooling/connector/ConnectionPool.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,506 +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 org.teiid.dqp.internal.pooling.connector;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.IdentityHashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.Semaphore;
-import java.util.concurrent.TimeUnit;
-
-import org.teiid.connector.DataPlugin;
-import org.teiid.connector.api.Connection;
-import org.teiid.connector.api.ConnectorEnvironment;
-import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.api.ConnectorIdentity;
-import org.teiid.connector.api.ConnectorPropertyNames;
-import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.api.SingleIdentity;
-import org.teiid.connector.xa.api.TransactionContext;
-import org.teiid.connector.xa.api.XAConnector;
-import org.teiid.dqp.internal.datamgr.impl.ConnectorWrapper;
-
-import com.metamatrix.common.log.LogManager;
-import com.metamatrix.common.util.PropertiesUtils;
-import com.metamatrix.core.log.MessageLevel;
-import com.metamatrix.core.util.ArgCheck;
-import com.metamatrix.dqp.util.LogConstants;
-
-public class ConnectionPool {
-	
-    /**
-     * This property is used to specify the length of time between JDBC Source test connections
-     * How often (in seconds) to test that the data source is available by establishing a new connection.  Default to 600 seconds.
-     */
-    public static final String SOURCE_CONNECTION_TEST_INTERVAL = "SourceConnectionTestInterval"; //$NON-NLS-1$
-
-    public static final String MAX_CONNECTIONS = ConnectorPropertyNames.MAX_CONNECTIONS;
-
-    /**
-     * Maximum connection for each ConnectorIdentity. Default to 0, which means there is no limit.
-     */
-    public static final String MAX_CONNECTIONS_FOR_EACH_ID = "com.metamatrix.data.pool.max_connections_for_each_id"; //$NON-NLS-1$
-
-    /**
-     * Idle time of the connection before it should be closed in seconds. Default to 60 seconds.
-     */
-    public static final String LIVE_AND_UNUSED_TIME = "com.metamatrix.data.pool.live_and_unused_time"; //$NON-NLS-1$
-
-    /**
-     * Time to wait if the connection is not available in milliseconds.  Default to 2 seconds.
-     */
-    public static final String WAIT_FOR_SOURCE_TIME = "com.metamatrix.data.pool.wait_for_source_time"; //$NON-NLS-1$
-
-    /**
-     * Interval for running the cleaning thread in seconds. Default to 60 seconds.
-     */
-    public static final String CLEANING_INTERVAL = "com.metamatrix.data.pool.cleaning_interval"; //$NON-NLS-1$
-
-    /**
-     * Whether to enable pool shrinking.  Default to true.
-     */
-    public static final String ENABLE_SHRINKING = "com.metamatrix.data.pool.enable_shrinking"; //$NON-NLS-1$
-    
-    private static final String CTX_CONNECTOR = LogConstants.CTX_CONNECTOR;
-
-    static final int DEFAULT_MAX_CONNECTION = 20;
-    static final int DEFAULT_MAX_CONNECTIONS_FOR_EACH_ID = 20;
-    static final int DEFAULT_LIVE_AND_UNUSED_TIME = 60;
-    static final int DEFAULT_WAIT_FOR_SOURCE_TIME = 120000;
-    static final int DEFAULT_CLEANING_INTERVAL = 60;
-    static final boolean DEFAULT_ENABLE_SHRINKING = true; 
-    public static final int DEFAULT_SOURCE_CONNECTION_TEST_INTERVAL = 600;  //10 minutes 
-
-    private static class ConnectionsForId {
-        LinkedList<ConnectionWrapper> used = new LinkedList<ConnectionWrapper>();
-        LinkedList<ConnectionWrapper> unused = new LinkedList<ConnectionWrapper>();
-        Semaphore idSemaphore;
-    }
-    
-    private int maxConnections = DEFAULT_MAX_CONNECTION;
-    private int maxConnectionsForEachID = DEFAULT_MAX_CONNECTIONS_FOR_EACH_ID;
-    private int liveAndUnusedTime = DEFAULT_LIVE_AND_UNUSED_TIME;
-    private int waitForSourceTime = DEFAULT_WAIT_FOR_SOURCE_TIME;
-    private int cleaningInterval = DEFAULT_CLEANING_INTERVAL;
-    private boolean enableShrinking = DEFAULT_ENABLE_SHRINKING;
-    
-    
-    /**How often (in ms) to test that the data source is available by establishing a new connection.*/
-    private int testConnectInterval;
-    private ConnectorWrapper connectionFactory;
-
-    private Map<ConnectorIdentity, ConnectionsForId> idConnections = new HashMap<ConnectorIdentity, ConnectionsForId>();
-    private Map<ConnectionWrapper, ConnectorIdentity> reverseIdConnections = new IdentityHashMap<ConnectionWrapper, ConnectorIdentity>();
-
-    private Object lock = new Object();
-    
-    private Semaphore poolSemaphore;
-
-    /**
-     * Total number of connections that are currently in the system (in use or waiting)
-     */
-    private volatile int totalConnectionCount;
-    /**
-     * Total number of connections that have been destroyed since the inception of this pool
-     */
-    private volatile int totalDestroyedConnections;
-    
-    private volatile boolean shuttingDownPool;
-
-    /**
-     * Construct the connection pool with a connection factory
-     *
-     * @param connectionFactory The factory for creating connections and ConnectorIdentity objects.
-     */
-    public ConnectionPool(ConnectorWrapper connectionFactory) {
-        this.connectionFactory = connectionFactory;
-    }
-
-    /**
-     * Initialize the connection pool. Default value will be used if the property
-     * is not set.
-     *
-     * @param poolProperties Properties of the pool as defined in this class. May be empty, but may not be null.
-     * @throws ConnectionPoolException if the connection pool fails to initialize.
-     */
-    public void initialize(ConnectorEnvironment env) throws ConnectionPoolException {
-    	ArgCheck.isNotNull(env);
-    	Properties poolProperties = env.getProperties();
-
-        maxConnections = PropertiesUtils.getIntProperty(poolProperties, MAX_CONNECTIONS, DEFAULT_MAX_CONNECTION);
-        if (maxConnections < 1) {
-            throw new ConnectionPoolException(DataPlugin.Util.getString("ConnectionPool.The_conn_value", maxConnections)); //$NON-NLS-1$
-        }
-        
-        poolSemaphore = new Semaphore(maxConnections, true);
-
-        maxConnectionsForEachID = PropertiesUtils.getIntProperty(poolProperties, MAX_CONNECTIONS_FOR_EACH_ID, DEFAULT_MAX_CONNECTIONS_FOR_EACH_ID);
-        if (maxConnectionsForEachID < 1) {
-            throw new ConnectionPoolException(DataPlugin.Util.getString("ConnectionPool.The_conn_value", maxConnectionsForEachID)); //$NON-NLS-1$
-        }                
-
-        liveAndUnusedTime = PropertiesUtils.getIntProperty(poolProperties, LIVE_AND_UNUSED_TIME, DEFAULT_LIVE_AND_UNUSED_TIME) * 1000;
-        waitForSourceTime = PropertiesUtils.getIntProperty(poolProperties, WAIT_FOR_SOURCE_TIME, DEFAULT_WAIT_FOR_SOURCE_TIME);
-        cleaningInterval = PropertiesUtils.getIntProperty(poolProperties, CLEANING_INTERVAL, DEFAULT_CLEANING_INTERVAL) * 1000;
-        enableShrinking = PropertiesUtils.getBooleanProperty(poolProperties, ENABLE_SHRINKING, DEFAULT_ENABLE_SHRINKING);
-        testConnectInterval = PropertiesUtils.getIntProperty(poolProperties, SOURCE_CONNECTION_TEST_INTERVAL, DEFAULT_SOURCE_CONNECTION_TEST_INTERVAL) * 1000;
-        
-        if (enableShrinking && !this.shuttingDownPool) {
-        	env.scheduleAtFixedRate(new Runnable() {
-        		public void run() {
-            		cleanUp(false);
-        		};
-        	}, cleaningInterval, cleaningInterval, TimeUnit.MILLISECONDS);
-        }
-
-        LogManager.logInfo(CTX_CONNECTOR, DataPlugin.Util.getString("ConnectionPool.Connection_pool_created_1")); //$NON-NLS-1$
-    }
-    
-    private long timeRemaining(long startTime) {
-        return startTime + this.waitForSourceTime - System.currentTimeMillis();
-    }
-    
-    public ConnectionWrapper obtain(ExecutionContext executionContext) throws ConnectionPoolException {
-    	return this.obtain(executionContext, null, false);
-    }
-
-    /**
-     * Return a connection from the connection pool.
-     *
-     * @return Connection from the pool.
-     * @throws ConnectionPoolException if there is any error occurred.
-     */
-    public ConnectionWrapper obtain(ExecutionContext executionContext, TransactionContext transactionContext, boolean xa) throws ConnectionPoolException {
-    	if ( shuttingDownPool ) {
-            throw new ConnectionPoolException(DataPlugin.Util.getString("ConnectionPool.No_connection_pool_available._8")); //$NON-NLS-1$
-        }
-
-        long startTime = System.currentTimeMillis();
-
-        ConnectorIdentity id = null;
-        if (executionContext != null) {
-        	id = executionContext.getConnectorIdentity();
-        }
-        if (id == null) {
-        	id = new SingleIdentity();
-        }
-                
-        LogManager.logTrace(CTX_CONNECTOR, new Object[] {"Obtaining connection for id", id}); //$NON-NLS-1$ 
-
-        ConnectionsForId connLists = null;
-
-        synchronized (this.lock) {
-            connLists = this.idConnections.get(id);
-            if ( connLists == null ) {
-                connLists = new ConnectionsForId();
-                if (this.maxConnectionsForEachID < this.maxConnections) {
-                    connLists.idSemaphore = new Semaphore(this.maxConnectionsForEachID, true);
-                }
-                this.idConnections.put(id, connLists);
-            }
-        }
-
-        boolean poolLockHeld = false;
-        boolean idLockHeld = false;
-        boolean success = false;
-
-        try {
-            if (!poolLockHeld && !this.poolSemaphore.tryAcquire(this.timeRemaining(startTime), TimeUnit.MILLISECONDS)) {
-                throw new ConnectionPoolException(DataPlugin.Util.getString("ConnectionPool.ExceededWait", id, new Integer(this.waitForSourceTime))); //$NON-NLS-1$
-            }
-            poolLockHeld = true;
-            
-            if (connLists.idSemaphore != null && !idLockHeld && !connLists.idSemaphore.tryAcquire(this.timeRemaining(startTime), TimeUnit.MILLISECONDS)) {
-                throw new ConnectionPoolException(DataPlugin.Util.getString("ConnectionPool.ExceededConnections", id, new Integer(this.maxConnectionsForEachID) )); //$NON-NLS-1$
-            }
-            idLockHeld = true;
-            
-            //try to reuse my existing at least once
-            do {
-                synchronized (connLists) {
-                    if (connLists.unused.isEmpty()) {
-                    	break;
-                    }
-                        
-                    ConnectionWrapper conn = connLists.unused.removeFirst();
-                    if ( conn.isAlive() ) { 
-                        try {
-							conn.setConnectorIdentity(id);
-	                        LogManager.logDetail(CTX_CONNECTOR,  new Object[] {"Existing connection leased for", id}); //$NON-NLS-1$
-	                        connLists.used.addLast(conn);
-	                        success = true;
-	                        return conn;
-						} catch (ConnectorException e) {
-							LogManager.logDetail(CTX_CONNECTOR,  new Object[] {"Existing connection failed to have identity updated", id}); //$NON-NLS-1$
-						}
-                    }
-                    closeSourceConnection(conn, id);
-                }
-            } while (timeRemaining(startTime) > 0);
-
-            //at this point we've made a best effort to ensure we've used existing connections.
-            //allow a new connection to be created outside of locking.
-            ConnectionWrapper connection = createConnection(executionContext, transactionContext, xa);
-            
-            int idSize = 0;
-            
-            synchronized (connLists) {
-                connLists.used.addLast(connection);
-                idSize = connLists.used.size() + connLists.unused.size();
-            }
-            
-            updateStateWithNewConnection(id, connection, idSize);
-            success = true;
-            return connection;
-        } catch (InterruptedException err) {
-            throw new ConnectionPoolException(err);
-        } finally {
-            if (!success) {
-                if (idLockHeld && connLists.idSemaphore != null) {
-                    connLists.idSemaphore.release();
-                }
-                if (poolLockHeld) {
-                    poolSemaphore.release();
-                }
-            }
-        }
-    }
-
-    private void updateStateWithNewConnection(ConnectorIdentity id,
-                                              ConnectionWrapper connection,
-                                              int idSize) {
-        Collection<ConnectionsForId> ids = null;
-        
-        synchronized (this.lock) {
-            this.reverseIdConnections.put(connection, id);
-            this.totalConnectionCount++;
-             
-            if (this.totalConnectionCount > this.maxConnections) {
-                ids = new ArrayList<ConnectionsForId>(this.idConnections.values());
-            }
-            
-            // Log warnings if we hit the max connection count or the max count per pool - if both
-            // are hit, we will only log the max connection count for the pool as that is more likely
-            // to make sense to users, esp. users using a standard SingleIdentity pool
-            if(this.totalConnectionCount == this.maxConnections) {
-               LogManager.logWarning(CTX_CONNECTOR, DataPlugin.Util.getString("ConnectionPool.Max_conn_reached")); //$NON-NLS-1$
-            } else if(idSize == this.maxConnectionsForEachID) {
-               LogManager.logWarning(CTX_CONNECTOR, DataPlugin.Util.getString("ConnectionPool.Max_conn_per_id_reached")); //$NON-NLS-1$
-            }
-        }
-  
-        //release any unused connection
-        //TODO: this search is biased and slow
-        if (ids != null) { 
-            for (Iterator<ConnectionsForId> i = ids.iterator(); i.hasNext() && this.totalConnectionCount > this.maxConnections;) {
-                ConnectionsForId connsForId = i.next();
-                synchronized (connsForId) {
-                    if (connsForId.unused.isEmpty()) {
-                        continue;
-                    }
-                    ConnectionWrapper conn = connsForId.unused.removeFirst();
-                    closeSourceConnection(conn, id);
-                    break;
-                }
-            }
-        }
-    }
-
-    private ConnectionWrapper createConnection(ExecutionContext id, TransactionContext transactionContext, boolean xa) throws ConnectionPoolException {
-    	ConnectionWrapper sourceConnection = null;
-        try {
-        	Connection connection = null;
-        	if (xa) {
-        		connection = ((XAConnector)this.connectionFactory.getActualConnector()).getXAConnection(id, transactionContext);
-        	} else {
-        		connection = this.connectionFactory.getActualConnector().getConnection(id);
-        	}
-        	sourceConnection = new ConnectionWrapper(connection, this, testConnectInterval);
-
-        	LogManager.logTrace(CTX_CONNECTOR, new Object[] {"Connection pool created a connection for", id}); //$NON-NLS-1$
-        } catch (ConnectorException e) {
-            throw new ConnectionPoolException(e);
-        }
-        return sourceConnection;
-    }
-
-    void release(ConnectionWrapper connection, boolean forceClose) {
-        ConnectionsForId connLists = null;
-        ConnectorIdentity id = null;
-        synchronized (this.lock) {
-            id = this.reverseIdConnections.get(connection);
-            connLists = this.idConnections.get(id);
-        }
-            
-        if (connLists == null) {
-        	return;
-        }
-        
-        synchronized (connLists) {
-            //release it only if there is one.
-            //If the same connection is to be released twice, just ignore
-            if ( connLists.used.remove(connection)) {
-                LogManager.logTrace(CTX_CONNECTOR, new Object[] {"ConnectionPool(release) connection released:", id}); //$NON-NLS-1$
-                if ( forceClose || shuttingDownPool ) {
-                    closeSourceConnection(connection, id);
-                } else {
-                    /*TODO: this is problematic - scenario:
-                     *thread 1 lease
-                     *thread 1 release
-                     *thread 2 lease same connection
-                     *thread 1 redundant release
-    				 *thread 3 leases same connection at the same time as 2
-                     */
-                	connLists.unused.addLast(connection);
-                }
-                if (connLists.idSemaphore != null) {
-                    connLists.idSemaphore.release();
-                }
-                poolSemaphore.release();
-            }
-        }
-    }
-    
-    /**
-     * Shut down the pool.
-     */
-    public void shutDown() {
-        //log that we're shutting down the pool
-        if (LogManager.isMessageToBeRecorded(CTX_CONNECTOR, MessageLevel.TRACE)) {
-            LogManager.logTrace(CTX_CONNECTOR, DataPlugin.Util.getString("ConnectionPool.Shut_down")); //$NON-NLS-1$
-        }
-        
-        shuttingDownPool = true;
-        
-        this.cleanUp(true);
-    }
-
-    protected void cleanUp(boolean forceClose) {        
-        Map<ConnectorIdentity, ConnectionsForId> values = null;
-        synchronized (this.lock) {
-            values = new HashMap<ConnectorIdentity, ConnectionsForId>(this.idConnections);
-        }
-        
-        for (Map.Entry<ConnectorIdentity, ConnectionsForId> entry : values.entrySet()) {
-            ConnectionsForId connLists = entry.getValue();
-
-            synchronized (connLists) {
-                for ( Iterator<ConnectionWrapper> unusedIter = connLists.unused.iterator(); unusedIter.hasNext(); ) {
-                    ConnectionWrapper unusedConnection = unusedIter.next();
-                    if (forceClose || (enableShrinking && System.currentTimeMillis() - unusedConnection.getTimeReturnedToPool() >= this.liveAndUnusedTime)
-                            || !unusedConnection.isAlive() ) {
-                        unusedIter.remove();
-                        
-                        closeSourceConnection(unusedConnection, entry.getKey());
-                    }
-                }
-            }
-        }
-    }
-    
-    /**
-     * @param connection
-     * @return true if we succeeded in closing the connection
-     * @throws Exception
-     * @since 4.3
-     */
-    private void closeSourceConnection(ConnectionWrapper connection, ConnectorIdentity id) {
-    	synchronized (this.lock) {
-            this.totalConnectionCount--;
-            this.totalDestroyedConnections++;
-            this.reverseIdConnections.remove(connection);
-        }
-    	try {
-            connection.getConnection().close();
-        
-            //log that we removed a connection
-            if (LogManager.isMessageToBeRecorded(CTX_CONNECTOR, MessageLevel.TRACE)) {
-                LogManager.logDetail(CTX_CONNECTOR, DataPlugin.Util.getString("ConnectionPool.Removed_conn", id)); //$NON-NLS-1$
-            }
-            
-        } catch (Exception e) {
-            LogManager.logWarning(CTX_CONNECTOR, DataPlugin.Util.getString("ConnectionPool.Failed_close_a_connection__2", id)); //$NON-NLS-1$
-        }
-    }
-        
-    //for testing purpose
-    final List<ConnectionWrapper> getUsedConnections(Connection connection) {
-    	ConnectorIdentity id = null;
-    	ConnectionsForId connLists = null;
-    	synchronized (this.lock) {
-            id = this.reverseIdConnections.get(connection);
-            connLists = this.idConnections.get(id);
-		}
-        if ( connLists != null ) {
-        	synchronized (connLists) {
-            	return new ArrayList<ConnectionWrapper>(connLists.used);
-			}
-        }
-        return Collections.emptyList();
-    }
-
-    //for testing purpose
-    final List<ConnectionWrapper> getUnusedConnections(Connection connection) {
-    	ConnectorIdentity id = null;
-    	ConnectionsForId connLists = null;
-    	synchronized (this.lock) {
-            id = this.reverseIdConnections.get(connection);
-            connLists = this.idConnections.get(id);
-		}
-        if ( connLists != null ) {
-        	synchronized (connLists) {
-            	return new ArrayList<ConnectionWrapper>(connLists.unused);
-			}
-        }
-        return Collections.emptyList();
-    }
-
-    
-    int getTotalConnectionCount() {
-        return this.totalConnectionCount;
-    }
-    
-    int getTotalCreatedConnectionCount() {
-    	return this.totalDestroyedConnections + this.totalConnectionCount;
-    }
-    
-    int getTotalDestroyedConnectionCount() {
-    	return this.totalDestroyedConnections;
-    }
-    
-    int getNumberOfConnectionsInUse() {
-    	return maxConnections - this.poolSemaphore.availablePermits();
-    }
-    
-    int getNumberOfConnectinsWaiting() {
-    	return this.totalConnectionCount - getNumberOfConnectionsInUse();
-    }
-
-}
\ No newline at end of file

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/pooling/connector/ConnectionPoolException.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/pooling/connector/ConnectionPoolException.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/pooling/connector/ConnectionPoolException.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,70 +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 org.teiid.dqp.internal.pooling.connector;
-
-import org.teiid.connector.api.ConnectorException;
-
-/**
- * This class is for exceptions occurring within the connection pool.
- */
-public class ConnectionPoolException extends ConnectorException{
-
-
-    /**
-     * No-arg constructor required by Externalizable semantics.
-     */
-    public ConnectionPoolException() {
-        super();
-    }
-    
-    /**
-     * Construct an instance with the message specified.
-     *
-     * @param message A message describing the exception
-     */
-    public ConnectionPoolException( String message ) {
-        super( message );
-    }
-
-    /**
-     * Construct an instance with a linked exception specified.
-     *
-     * @param e An exception to chain to this exception
-     */
-    public ConnectionPoolException( Throwable e ) {
-        super( e );
-    }
-
-    /**
-     * Construct an instance from a message and an exception to chain to this one.
-     *
-     * @param message A message describing the exception
-     * @param e An exception to nest within this one
-     */
-    public ConnectionPoolException( Throwable e, String message ) {
-        super( e, message );
-    }
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/pooling/connector/ConnectionWrapper.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/pooling/connector/ConnectionWrapper.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/pooling/connector/ConnectionWrapper.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,144 +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 org.teiid.dqp.internal.pooling.connector;
-
-import javax.transaction.xa.XAResource;
-
-import org.teiid.connector.api.Connection;
-import org.teiid.connector.api.ConnectorCapabilities;
-import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.api.ConnectorIdentity;
-import org.teiid.connector.api.Execution;
-import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.language.ICommand;
-import org.teiid.connector.metadata.runtime.RuntimeMetadata;
-import org.teiid.connector.xa.api.XAConnection;
-
-
-public class ConnectionWrapper implements XAConnection {
-
-	private Connection connection;
-    private long timeReturnedToPool = System.currentTimeMillis();
-    private long lastTest = System.currentTimeMillis();
-    private boolean isDead;
-    private long testInterval;
-    private ConnectionPool connectionPool;
-    private int leaseCount;
-    private boolean isInTxn;
-    
-    public ConnectionWrapper(Connection connection,
-			ConnectionPool connectionPool, long testInterval) {
-		this.connection = connection;
-		this.connectionPool = connectionPool;
-		this.testInterval = testInterval;
-	}
-    
-    public Connection getConnection() {
-		return connection;
-	}
-
-	public long getTimeReturnedToPool() {
-		return timeReturnedToPool;
-	}
-    
-	@Override
-	public boolean isAlive() {
-		if (isDead) {
-			return false;
-		}
-		long now = System.currentTimeMillis();
-		if (now - lastTest > testInterval) {
-			boolean result = connection.isAlive();
-			lastTest = now; 
-			this.isDead = !result;
-		}
-		return !isDead;
-	}
-	
-	@Override
-	public Execution createExecution(ICommand command,
-			ExecutionContext executionContext, RuntimeMetadata metadata)
-			throws ConnectorException {
-		return connection.createExecution(command, executionContext, metadata);
-	}
-
-	@Override
-	public ConnectorCapabilities getCapabilities() {
-		return connection.getCapabilities();
-	}
-
-	@Override
-	public void close() {
-		synchronized (this) {
-			if (this.leaseCount > 0) {
-				this.leaseCount--;
-			}
-			if (isInTxn() || this.isLeased()) {
-				return;
-			}
-		}
-		this.closeCalled();
-		this.timeReturnedToPool = System.currentTimeMillis();
-		this.connectionPool.release(this, false);
-	}
-
-	@Override
-	public XAResource getXAResource() throws ConnectorException {
-		if (this.connection instanceof XAConnection) {
-			return ((XAConnection)this.connection).getXAResource();
-		}
-		return null;
-	}
-	
-    public synchronized boolean isLeased() {
-        return this.leaseCount > 0;
-    }    
-    
-    public synchronized void lease() throws ConnectorException {
-        this.leaseCount++;
-    }
-    
-    public synchronized boolean isInTxn() {
-		return isInTxn;
-	}
-    
-    public synchronized void setInTxn(boolean isInTxn) {
-		this.isInTxn = isInTxn;
-	}
-
-	@Override
-	public void closeCalled() {
-		this.connection.closeCalled();
-	}
-	
-	public void setTestInterval(long testInterval) {
-		this.testInterval = testInterval;
-	}
-	
-	@Override
-	public void setConnectorIdentity(ConnectorIdentity context)
-			throws ConnectorException {
-		this.connection.setConnectorIdentity(context);
-	}
-
-}

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/pooling/connector/PooledConnector.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/pooling/connector/PooledConnector.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/pooling/connector/PooledConnector.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,264 +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 org.teiid.dqp.internal.pooling.connector;
-
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.transaction.RollbackException;
-import javax.transaction.Synchronization;
-import javax.transaction.SystemException;
-import javax.transaction.xa.XAResource;
-
-import org.teiid.connector.api.Connection;
-import org.teiid.connector.api.Connector;
-import org.teiid.connector.api.ConnectorEnvironment;
-import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.xa.api.TransactionContext;
-import org.teiid.connector.xa.api.XAConnection;
-import org.teiid.connector.xa.api.XAConnector;
-import org.teiid.dqp.internal.datamgr.impl.ConnectorWrapper;
-import org.teiid.dqp.internal.transaction.TransactionProvider;
-
-import com.metamatrix.admin.objects.MMConnectionPool;
-import com.metamatrix.common.log.LogManager;
-import com.metamatrix.common.xa.XATransactionException;
-import com.metamatrix.dqp.DQPPlugin;
-import com.metamatrix.dqp.service.ConnectorStatus;
-import com.metamatrix.dqp.service.TransactionService;
-import com.metamatrix.dqp.util.LogConstants;
-
-
-/**
- * Implements Pooling around a Connector or XAConnector.
- * 
- * XA Considerations:
- * 1. Two pools are maintained, one for connections participating in XA, and one for not.
- *    Most JDBC sources need to segregate, so this is the default.  TODO: make this configurable.
- * 2. XAConnections are bound to their transaction.  TODO: make this configurable.
- * 
- */
-public class PooledConnector extends ConnectorWrapper {
-	
-	private final class RemovalCallback implements Synchronization {
-
-		private final TransactionContext transactionContext;
-		private final ConnectionWrapper conn;
-
-		/**
-		 * @param transactionContext
-		 */
-		private RemovalCallback(TransactionContext transactionContext,
-				ConnectionWrapper conn) {
-			this.transactionContext = transactionContext;
-			this.conn = conn;
-		}
-
-		public void afterCompletion(int arg0) {
-			synchronized (idToConnections) {
-				idToConnections.remove(this.transactionContext.getTxnID());
-				conn.setInTxn(false);
-				if (!conn.isLeased()) {
-					conn.close();
-				}
-			}
-			if (environment.getLogger().isTraceEnabled()) {
-				environment.getLogger().logTrace("released connection for transaction " + transactionContext.getTxnID()); //$NON-NLS-1$
-			}
-		}
-
-		public void beforeCompletion() {
-		}
-	}
-
-	private ConnectionPool pool;
-	private ConnectionPool xaPool;
-	
-	private Map<String, ConnectionWrapper> idToConnections = Collections.synchronizedMap(new HashMap<String, ConnectionWrapper>());
-	private ConnectorEnvironment environment;
-	private TransactionService transactionService;
-	private String name;
-	
-	public PooledConnector(String name, Connector actualConnector, TransactionService transactionService) {
-		super(actualConnector);
-		pool = new ConnectionPool(this);
-		this.transactionService = transactionService;
-		if (actualConnector instanceof XAConnector) {
-			xaPool = new ConnectionPool(this);
-		}
-		this.name = name;
-	}
-
-	@Override
-	public void start(ConnectorEnvironment environment)
-			throws ConnectorException {
-		this.environment = environment;
-		pool.initialize(environment);
-		if (xaPool != null) {
-			xaPool.initialize(environment);
-		}
-		super.start(environment);
-		if (this.transactionService != null) {
-            if (this.supportsSingleIdentity()) {
-            	// add this connector as the recovery source
-                transactionService.registerRecoverySource(this.name, new TransactionProvider.XAConnectionSource() {
-                	XAConnection conn = null;
-                	
-                	@Override
-                	public XAResource getXAResource() throws SQLException {
-                		if (conn == null) {
-                			try {
-								conn = getXAConnectionDirect(null, null);
-							} catch (ConnectorException e) {
-								throw new SQLException(e);
-							}
-                		}
-                		try {
-							return conn.getXAResource();
-						} catch (ConnectorException e) {
-							throw new SQLException(e);
-						}
-                	}
-                	
-                	@Override
-                	public void close() {
-                		if (conn != null) {
-                			conn.close();
-                		}
-                	}
-                });
-            } else {
-            	LogManager.logWarning(LogConstants.CTX_CONNECTOR, DQPPlugin.Util.getString("ConnectorManager.cannot_add_to_recovery", this.name)); //$NON-NLS-1$	                
-            }
-        }
-	}
-	
-	@Override
-	public void stop() {
-		pool.shutDown();
-		if (xaPool != null) {
-			xaPool.shutDown();
-		}
-		super.stop();
-	}
-
-	@Override
-	public Connection getConnectionDirect(ExecutionContext context)
-			throws ConnectorException {
-		return pool.obtain(context);
-	}
-
-	@Override
-	public XAConnection getXAConnectionDirect(ExecutionContext executionContext,
-			TransactionContext transactionContext) throws ConnectorException {
-        ConnectionWrapper conn = null;
-        
-        if(transactionContext != null){
-        	synchronized (idToConnections) {
-                conn  = idToConnections.get(transactionContext.getTxnID());
-                if (conn != null){
-                	if (environment.getLogger().isTraceEnabled()) {
-                		environment.getLogger().logTrace("Transaction " + transactionContext.getTxnID() + " already has connection, using the same connection"); //$NON-NLS-1$ //$NON-NLS-2$
-                	}
-                    conn.lease();
-                    return conn;
-                }
-			}
-        }
-    
-        conn = xaPool.obtain(executionContext, transactionContext, true);
-        conn.lease();
-        if (transactionContext != null) {
-        	if (environment.getLogger().isTraceEnabled()) {
-        		environment.getLogger().logTrace("Obtained new connection for transaction " + transactionContext.getTxnID()); //$NON-NLS-1$
-        	}
-    		XAResource xaRes = conn.getXAResource();
-    		try {
-				transactionService.enlist(transactionContext, xaRes);
-			} catch (XATransactionException e) {
-				conn.close();
-                throw new ConnectorException(e);
-			}
-            
-            try { //add a synchronization to remove the map entry
-                transactionContext.getTransaction().registerSynchronization(new RemovalCallback(transactionContext, conn));
-            } catch (RollbackException err) {
-                conn.close();
-                throw new ConnectorException(err);
-            } catch (SystemException err) {
-                conn.close();
-                throw new ConnectorException(err);
-            }
-	        conn.setInTxn(true);
-	        synchronized (idToConnections) {
-	            idToConnections.put(transactionContext.getTxnID(), conn);
-			}
-        }
-        return conn;
-	}
-
-	public List<MMConnectionPool> getConnectionPoolStats() {
-		List<MMConnectionPool> pools = new ArrayList<MMConnectionPool>(2);
-
-		MMConnectionPool stats = getStats(pool);
-		pools.add(stats);
-		
-		if (xaPool != null) {
-			stats = getStats(xaPool);
-			stats.setXa(true);
-			pools.add(stats);
-		}
-		
-		return pools;
-	}
-
-	@Override
-	protected boolean isConnectionTestable() {
-		return true;
-	}
-	
-	@Override
-	protected ConnectorStatus testConnection() {
-		if (this.pool.getNumberOfConnectionsInUse() > 0) {
-			return ConnectorStatus.OPEN;
-		}
-		//TODO: call is alive on an unused connection
-		return super.testConnection();
-	}
-	
-	private MMConnectionPool getStats(ConnectionPool connpool) {
-		MMConnectionPool stats = new MMConnectionPool();
-		stats.setConnectionsWaiting(connpool.getNumberOfConnectinsWaiting());
-		stats.setConnectionsCreated(connpool.getTotalCreatedConnectionCount());
-		stats.setConnectionsDestroyed(connpool.getTotalDestroyedConnectionCount());
-		stats.setConnectionsInUse(connpool.getNumberOfConnectionsInUse());
-		stats.setTotalConnections(connpool.getTotalConnectionCount());
-		return stats;
-	}
-
-}

Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/AbstractWorkItem.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/AbstractWorkItem.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/AbstractWorkItem.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,6 +22,8 @@
 
 package org.teiid.dqp.internal.process;
 
+import javax.resource.spi.work.Work;
+
 import com.metamatrix.common.log.LogManager;
 import com.metamatrix.dqp.util.LogConstants;
 
@@ -30,13 +32,14 @@
  * Represents a task that performs work that may take more than one processing pass to complete.
  * During processing the WorkItem may receive events asynchronously through the moreWork method.
  */
-public abstract class AbstractWorkItem implements Runnable {
+public abstract class AbstractWorkItem implements Work {
 	
     enum ThreadState {
     	MORE_WORK, WORKING, IDLE, DONE
     }
     
     private ThreadState threadState = ThreadState.MORE_WORK;
+    private volatile boolean release = false;
     
     public void run() {
     	try {
@@ -122,4 +125,13 @@
     protected abstract boolean isDoneProcessing();
     
     public abstract String toString();
+    
+	@Override
+	public void release() {
+		this.release = true;
+	}
+	
+	public boolean shouldAbortProcessing() {
+		return this.release;
+	}
 }

Added: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/AsyncRequestWorkItem.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/AsyncRequestWorkItem.java	                        (rev 0)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/AsyncRequestWorkItem.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,25 @@
+package org.teiid.dqp.internal.process;
+
+import com.metamatrix.common.comm.api.ResultsReceiver;
+import com.metamatrix.dqp.message.RequestID;
+import com.metamatrix.dqp.message.RequestMessage;
+import com.metamatrix.dqp.message.ResultsMessage;
+
+public class AsyncRequestWorkItem extends RequestWorkItem {
+
+	public AsyncRequestWorkItem(DQPCore dqpCore, RequestMessage requestMsg,
+			Request request, ResultsReceiver<ResultsMessage> receiver,
+			RequestID requestID, DQPWorkContext workContext) {
+		super(dqpCore, requestMsg, request, receiver, requestID, workContext);
+	}
+	
+	
+	@Override
+	protected void resumeProcessing() {
+		dqpCore.addWork(this, getTransactionContext());
+	}
+	
+	@Override
+	protected void pauseProcessing() {
+	}
+}


Property changes on: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/AsyncRequestWorkItem.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/CachedRequestWorkItem.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/CachedRequestWorkItem.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/CachedRequestWorkItem.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -24,8 +24,6 @@
 
 import java.util.List;
 
-import javax.transaction.SystemException;
-
 import org.teiid.dqp.internal.cache.CacheResults;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
@@ -56,7 +54,7 @@
 	}
 	
 	@Override
-	protected void processMore() throws SystemException, BlockedException,
+	protected void processMore() throws BlockedException,
 			MetaMatrixCoreException {
 		//do nothing
 	}

Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -32,19 +32,20 @@
 import java.util.Map;
 import java.util.Properties;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.TimeUnit;
 
-import javax.transaction.InvalidTransactionException;
-import javax.transaction.SystemException;
+import javax.resource.spi.work.Work;
+import javax.resource.spi.work.WorkException;
+import javax.resource.spi.work.WorkManager;
 import javax.transaction.xa.Xid;
 
-import org.teiid.connector.xa.api.TransactionContext;
 import org.teiid.dqp.internal.cache.CacheID;
 import org.teiid.dqp.internal.cache.DQPContextCache;
 import org.teiid.dqp.internal.cache.ResultSetCache;
 import org.teiid.dqp.internal.cache.ResultSetCacheUtil;
 
+import com.google.inject.Inject;
 import com.google.inject.Singleton;
+import com.google.inject.name.Named;
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.MetaMatrixProcessingException;
 import com.metamatrix.api.exception.query.QueryMetadataException;
@@ -58,8 +59,7 @@
 import com.metamatrix.common.buffer.BufferManager;
 import com.metamatrix.common.lob.LobChunk;
 import com.metamatrix.common.log.LogManager;
-import com.metamatrix.common.queue.WorkerPool;
-import com.metamatrix.common.queue.WorkerPoolFactory;
+import com.metamatrix.common.queue.StatsCapturingWorkManager;
 import com.metamatrix.common.util.PropertiesUtils;
 import com.metamatrix.common.xa.MMXid;
 import com.metamatrix.common.xa.XATransactionException;
@@ -72,7 +72,6 @@
 import com.metamatrix.dqp.client.MetadataResult;
 import com.metamatrix.dqp.client.ResultsFuture;
 import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
-import com.metamatrix.dqp.internal.datamgr.ConnectorID;
 import com.metamatrix.dqp.message.AtomicRequestID;
 import com.metamatrix.dqp.message.AtomicRequestMessage;
 import com.metamatrix.dqp.message.RequestID;
@@ -84,6 +83,7 @@
 import com.metamatrix.dqp.service.DQPServiceNames;
 import com.metamatrix.dqp.service.DataService;
 import com.metamatrix.dqp.service.MetadataService;
+import com.metamatrix.dqp.service.TransactionContext;
 import com.metamatrix.dqp.service.TransactionService;
 import com.metamatrix.dqp.service.VDBService;
 import com.metamatrix.dqp.util.LogConstants;
@@ -119,16 +119,20 @@
 		}
 	}
 	
+    @Inject @Named("TeiidWorkManager") 
+    private WorkManager workManager;
+    private StatsCapturingWorkManager processWorkerPool;
+    
     //Constants
     private static final int DEFAULT_MAX_CODE_TABLE_RECORDS = 10000;
     private static final int DEFAULT_MAX_CODE_TABLES = 200;
     private static final int DEFAULT_MAX_CODE_RECORDS = 200000;
     private static final int DEFAULT_FETCH_SIZE = 2000;
     private static final int DEFAULT_PROCESSOR_TIMESLICE = 2000;
-    private static final String PROCESS_PLAN_QUEUE_NAME = "QueryProcessorQueue"; //$NON-NLS-1$
-    private static final int DEFAULT_MAX_PROCESS_WORKERS = 15;
     private static final String DEFAULT_MAX_RESULTSET_CACHE_SIZE = "50"; //$NON-NLS-1$
     private static final String DEFAULT_MAX_RESULTSET_CACHE_AGE = "3600000"; //$NON-NLS-1$
+    private static final String PROCESS_PLAN_QUEUE_NAME = "QueryProcessorQueue"; //$NON-NLS-1$
+    private static final int DEFAULT_MAX_PROCESS_WORKERS = 15;
 
     // System properties for Code Table
     private int maxCodeTableRecords = DEFAULT_MAX_CODE_TABLE_RECORDS;
@@ -147,7 +151,6 @@
     private ResultSetCache rsCache;
     
     // Query worker pool for processing plans
-    private WorkerPool processWorkerPool;
     private int processorTimeslice = DEFAULT_PROCESSOR_TIMESLICE;
     private boolean processorDebugAllowed;
     
@@ -159,6 +162,7 @@
 	private DQPContextCache contextCache;
     private ServiceLoader loader = new ServiceLoader();
 
+        
     /**
      * perform a full shutdown and wait for 10 seconds for all threads to finish
      * @throws ApplicationLifecycleException 
@@ -166,11 +170,6 @@
 	@Override
     public void stop() throws ApplicationLifecycleException {
 		LogManager.logDetail(LogConstants.CTX_DQP, "Stopping the DQP"); //$NON-NLS-1$
-    	processWorkerPool.shutdownNow();
-    	try {
-			processWorkerPool.awaitTermination(10, TimeUnit.SECONDS);
-		} catch (InterruptedException e) {
-		}
     	contextCache.shutdown();
     	super.stop();
     }
@@ -208,13 +207,13 @@
             	RequestInfo req = new RequestInfo(holder.requestID, holder.requestMsg.getCommandString(), holder.requestMsg.getSubmittedTimestamp(), holder.requestMsg.getProcessingTimestamp());
             	req.setSessionToken(holder.dqpWorkContext.getSessionToken());
             	if (holder.getTransactionContext() != null && holder.getTransactionContext().isInTransaction()) {
-            		req.setTransactionId(holder.getTransactionContext().getTxnID());
+            		req.setXid(holder.getTransactionContext().getXid());
             	}
 
                 for (DataTierTupleSource conInfo : holder.getConnectorRequests()) {
-                    ConnectorID connectorID = conInfo.getConnectorId();
+                    String connectorName = conInfo.getConnectorName();
 
-                    if (connectorID == null) {
+                    if (connectorName == null) {
                     	continue;
                     }
                     // If the request has not yet completed processing, then
@@ -222,7 +221,7 @@
                 	AtomicRequestMessage arm = conInfo.getAtomicRequestMessage();
                 	RequestInfo info = new RequestInfo(arm.getRequestID(), arm.getCommand().toString(), arm.getSubmittedTimestamp(), arm.getProcessingTimestamp());
                 	info.setSessionToken(holder.dqpWorkContext.getSessionToken());
-                	info.setConnectorBindingUUID(arm.getConnectorBindingID());
+                	info.setConnectorBindingUUID(arm.getConnectorName());
         			info.setNodeID(arm.getAtomicRequestID().getNodeID());
         			info.setExecutionID(arm.getAtomicRequestID().getExecutionId());
         			results.add(info);
@@ -262,13 +261,18 @@
         	workItem = new CachedRequestWorkItem(this, requestMsg, request, resultsFuture.getResultsReceiver(), requestID, workContext, command);
         }
         else {            
-            workItem = new RequestWorkItem(this, requestMsg, request, resultsFuture.getResultsReceiver(), requestID, workContext);
+//        	if (request.transactionContext != null && request.transactionContext.isInTransaction()) {
+        		workItem = new RequestWorkItem(this, requestMsg, request, resultsFuture.getResultsReceiver(), requestID, workContext);
+//        	}
+//        	else {
+//        		workItem = new AsyncRequestWorkItem(this, requestMsg, request, resultsFuture.getResultsReceiver(), requestID, workContext);
+//        	}
         }
         
-    	logMMCommand(workItem, true, false, 0); //TODO: there is no transaction at this point 
+    	logMMCommand(workItem, true, false, 0); 
         addRequest(requestID, workItem);
         
-        this.addWork(workItem);      
+        this.addWork(workItem, workItem.getTransactionContext());      
         return resultsFuture;
     }
 	
@@ -318,10 +322,20 @@
         return rsCache.hasResults(cID);        
     }
            
-    void addWork(Runnable r) {
-    	this.processWorkerPool.execute(r);
+    void addWork(Work work, TransactionContext context) {
+    	try {
+			this.processWorkerPool.scheduleWork(work, 20000, context, null);
+		} catch (WorkException e) {
+			//TODO: how can be turn this into result?
+			e.printStackTrace();
+		}
     }
     
+    void setWorkManager(WorkManager mgr) {
+    	this.workManager = mgr;
+    	this.processWorkerPool = new StatsCapturingWorkManager(PROCESS_PLAN_QUEUE_NAME, this.workManager, DEFAULT_MAX_PROCESS_WORKERS);
+    }
+    
 	public ResultsFuture<?> closeLobChunkStream(int lobRequestId,
 			long requestId, String streamId)
 			throws MetaMatrixProcessingException {
@@ -374,35 +388,18 @@
 	RequestWorkItem safeGetWorkItem(Object processorID) {
     	return this.requests.get(processorID);
 	}
-
+	
     /**
      * Returns a list of QueueStats objects that represent the queues in
      * this service.
      * If there are no queues, an empty Collection is returned.
      */
     public Collection getQueueStatistics() {
-        if ( this.processWorkerPool == null ) {
-            return Collections.EMPTY_LIST;
-        }
-
         return Arrays.asList(processWorkerPool.getStats());
     }
 
+           
     /**
-     * Returns a QueueStats object that represent the queue in
-     * this service.
-     * If there is no queue with the given name, an empty Collection is returned.
-     */
-    public Collection getQueueStatistics(String name) {
-        if ( !name.equalsIgnoreCase(PROCESS_PLAN_QUEUE_NAME)) {
-            return Collections.EMPTY_LIST;
-        }
-        return getQueueStatistics();
-    }
-    
-
-            
-    /**
      * Cancel and close all requests associated with the clientConnection/session. Also runs a final cleanup any caches within
      * the session's scope.
      * @param clientConnection
@@ -438,11 +435,9 @@
         if (transactionService != null) {
             try {
                 transactionService.cancelTransactions(sessionId, false);
-            } catch (InvalidTransactionException err) {
+            } catch (XATransactionException err) {
                 LogManager.logWarning(LogConstants.CTX_DQP, "rollback failed for requestID=" + sessionId); //$NON-NLS-1$
-            } catch (SystemException err) {
-                throw new MetaMatrixComponentException(err);
-            }
+            } 
         }
         contextCache.removeSessionScopedCache(sessionId);
     }
@@ -522,8 +517,8 @@
     	}
     	String txnID = null;
 		TransactionContext tc = workItem.getTransactionContext();
-		if (tc != null) {
-			txnID = tc.getTxnID();
+		if (tc != null && tc.getXid() != null) {
+			txnID = tc.getXid().toString();
 		}
     	String appName = workContext.getAppName();
         // Log to request log
@@ -663,10 +658,9 @@
 
         transactionService = (TransactionService )env.findService(DQPServiceNames.TRANSACTION_SERVICE);
         metadataService = (MetadataService) env.findService(DQPServiceNames.METADATA_SERVICE);
-
-        // Create the worker pools to tie the queues together
-        processWorkerPool = WorkerPoolFactory.newWorkerPool(PROCESS_PLAN_QUEUE_NAME, PropertiesUtils.getIntProperty(props, DQPEmbeddedProperties.PROCESS_POOL_MAX_THREADS, DEFAULT_MAX_PROCESS_WORKERS)); 
- 
+        
+        this.processWorkerPool = new StatsCapturingWorkManager(PROCESS_PLAN_QUEUE_NAME, this.workManager, PropertiesUtils.getIntProperty(props, DQPEmbeddedProperties.PROCESS_POOL_MAX_THREADS, DEFAULT_MAX_PROCESS_WORKERS));
+        
         tempTableStoresHolder = new TempTableStoresHolder(bufferManager);
         
         dataTierMgr = new DataTierManagerImpl(this,
@@ -693,65 +687,56 @@
 		this.cancelRequest(workContext.getRequestID(requestID));
 	}
 	
+	// local txn
 	public void begin() throws XATransactionException {
     	String threadId = DQPWorkContext.getWorkContext().getConnectionID();
-        try {
-			this.getTransactionService().begin(threadId);
-		} catch (SystemException e) {
-			throw new XATransactionException(e);
-		}
+    	this.getTransactionService().begin(threadId);
 	}
 	
+	// local txn
 	public void commit() throws XATransactionException {
 		String threadId = DQPWorkContext.getWorkContext().getConnectionID();
-        try {
-			this.getTransactionService().commit(threadId);
-		} catch (SystemException e) {
-			throw new XATransactionException(e);
-		}
+		this.getTransactionService().commit(threadId);
 	}
 	
+	// local txn
 	public void rollback() throws XATransactionException {
-		try {
-			this.getTransactionService().rollback(
-					DQPWorkContext.getWorkContext().getConnectionID());
-		} catch (SystemException e) {
-			throw new XATransactionException(e);
-		}
+		String threadId = DQPWorkContext.getWorkContext().getConnectionID();
+		this.getTransactionService().rollback(threadId);
 	}
 
-	public void commit(MMXid xid, boolean onePhase)
-			throws XATransactionException {
+	// global txn
+	public void commit(MMXid xid, boolean onePhase) throws XATransactionException {
 		String threadId = DQPWorkContext.getWorkContext().getConnectionID();
 		this.getTransactionService().commit(threadId, xid, onePhase);
 	}
-
+	// global txn
 	public void end(MMXid xid, int flags) throws XATransactionException {
 		String threadId = DQPWorkContext.getWorkContext().getConnectionID();
 		this.getTransactionService().end(threadId, xid, flags);
 	}
-
+	// global txn
 	public void forget(MMXid xid) throws XATransactionException {
 		String threadId = DQPWorkContext.getWorkContext().getConnectionID();
 		this.getTransactionService().forget(threadId, xid);
 	}
-	
+	// global txn
 	public int prepare(MMXid xid) throws XATransactionException {
 		return this.getTransactionService().prepare(
 				DQPWorkContext.getWorkContext().getConnectionID(),
 				xid);
 	}
-	
+	// global txn
 	public Xid[] recover(int flag) throws XATransactionException {
 		return this.getTransactionService().recover(flag);
 	}
-
+	// global txn
 	public void rollback(MMXid xid) throws XATransactionException {
 		this.getTransactionService().rollback(
 				DQPWorkContext.getWorkContext().getConnectionID(),
 				xid);
 	}
-
+	// global txn
 	public void start(MMXid xid, int flags, int timeout)
 			throws XATransactionException {
 		String threadId = DQPWorkContext.getWorkContext().getConnectionID();

Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -24,6 +24,8 @@
 
 import java.io.Serializable;
 
+import javax.security.auth.Subject;
+
 import com.metamatrix.dqp.message.RequestID;
 import com.metamatrix.platform.security.api.MetaMatrixSessionID;
 import com.metamatrix.platform.security.api.SessionToken;
@@ -46,7 +48,6 @@
 		CONTEXTS.set(context);
 	}
 	
-    private Serializable trustedPayload;
     private String vdbName;
     private String vdbVersion;
     private String appName;
@@ -60,19 +61,20 @@
     /**
      * @return
      */
-    public Serializable getTrustedPayload() {
-        return trustedPayload;
-    }
-
-    /**
-     * @return
-     */
     public String getUserName() {
 		if (this.sessionToken == null) {
 			return null;
 		}
         return this.sessionToken.getUsername();
     }
+    
+    public Subject getUser() {
+		if (this.sessionToken == null) {
+			return null;
+		}
+        return this.sessionToken.getSubject();
+    }
+    
 
     /**
      * @return
@@ -89,13 +91,6 @@
     }
 
     /**
-     * @param serializable
-     */
-    public void setTrustedPayload(Serializable trustedPayload) {
-        this.trustedPayload = trustedPayload;
-    }
-
-    /**
      * @param string
      */
     public void setVdbName(String vdbName) {
@@ -162,7 +157,6 @@
 	public void reset() {
 		setSessionToken(null);
 		setAppName(null);
-		setTrustedPayload(null);
 		setVdbName(null);
 		setVdbVersion(null);
 	}

Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -38,7 +38,6 @@
 import com.metamatrix.core.util.Assertion;
 import com.metamatrix.dqp.DQPPlugin;
 import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
-import com.metamatrix.dqp.internal.datamgr.ConnectorID;
 import com.metamatrix.dqp.message.AtomicRequestID;
 import com.metamatrix.dqp.message.AtomicRequestMessage;
 import com.metamatrix.dqp.message.AtomicResultsMessage;
@@ -81,7 +80,7 @@
 			String modelName, String connectorBindingId, int nodeID) throws MetaMatrixComponentException, MetaMatrixProcessingException {
 		RequestWorkItem workItem = requestMgr.getRequestWorkItem((RequestID)processorId);
 		AtomicRequestMessage aqr = createRequest(processorId, command, modelName, connectorBindingId, nodeID);
-        DataTierTupleSource tupleSource = new DataTierTupleSource(aqr.getCommand().getProjectedSymbols(), aqr, this, aqr.getConnectorID(), workItem);
+        DataTierTupleSource tupleSource = new DataTierTupleSource(aqr.getCommand().getProjectedSymbols(), aqr, this, aqr.getConnectorName(), workItem);
         tupleSource.open();
         return tupleSource;
 	}
@@ -112,11 +111,8 @@
 	        connectorBindingId = (String)bindings.get(0); 
 	        Assertion.isNotNull(connectorBindingId, "could not obtain connector id"); //$NON-NLS-1$
         }
-        aqr.setConnectorBindingID(connectorBindingId);
-        // Select any connector instance for this connector binding
-        ConnectorID connectorID = this.dataService.selectConnector(connectorBindingId);
-        // if we had this as null before
-        aqr.setConnectorID(connectorID);
+        aqr.setConnectorName(connectorBindingId);
+
 		return aqr;
 	}
 	
@@ -129,25 +125,25 @@
         return connectorBindingID;
 	}
 	
-	void executeRequest(AtomicRequestMessage aqr, ConnectorID connectorId,
+	void executeRequest(AtomicRequestMessage aqr, String connectorName,
 			ResultsReceiver<AtomicResultsMessage> receiver)
 			throws MetaMatrixComponentException {
-		this.dataService.executeRequest(aqr, connectorId, receiver);
+		this.dataService.executeRequest(aqr, connectorName, receiver);
 	}
 
-	public void closeRequest(AtomicRequestID request, ConnectorID connectorId)
+	public void closeRequest(AtomicRequestID request, String connectorName)
 			throws MetaMatrixComponentException {
-		this.dataService.closeRequest(request, connectorId);
+		this.dataService.closeRequest(request, connectorName);
 	}
 	
-	public void cancelRequest(AtomicRequestID request, ConnectorID connectorId)
+	public void cancelRequest(AtomicRequestID request, String connectorName)
 		throws MetaMatrixComponentException {
-		this.dataService.cancelRequest(request, connectorId);
+		this.dataService.cancelRequest(request, connectorName);
 	}
 
-	void requestBatch(AtomicRequestID request, ConnectorID connectorId)
+	void requestBatch(AtomicRequestID request, String connectorName)
 			throws MetaMatrixComponentException {
-		this.dataService.requestBatch(request, connectorId);
+		this.dataService.requestBatch(request, connectorName);
 	}
 
     /** 

Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -31,7 +31,6 @@
 import com.metamatrix.common.comm.api.ResultsReceiver;
 import com.metamatrix.core.util.Assertion;
 import com.metamatrix.dqp.exception.SourceWarning;
-import com.metamatrix.dqp.internal.datamgr.ConnectorID;
 import com.metamatrix.dqp.message.AtomicRequestMessage;
 import com.metamatrix.dqp.message.AtomicResultsMessage;
 
@@ -45,7 +44,7 @@
     private final List schema;
     private final AtomicRequestMessage aqr;
     private final DataTierManagerImpl dataMgr;
-    private final ConnectorID connectorId;
+    private final String connectorName;
     private final RequestWorkItem workItem;
     
     // Data state
@@ -64,11 +63,11 @@
     /**
      * Constructor for DataTierTupleSource.
      */
-    public DataTierTupleSource(List schema, AtomicRequestMessage aqr, DataTierManagerImpl dataMgr, ConnectorID connectorID, RequestWorkItem workItem) {
+    public DataTierTupleSource(List schema, AtomicRequestMessage aqr, DataTierManagerImpl dataMgr, String connectorName, RequestWorkItem workItem) {
         this.schema = schema;       
         this.aqr = aqr;
         this.dataMgr = dataMgr;
-        this.connectorId = connectorID;
+        this.connectorName = connectorName;
         this.workItem = workItem;
     }
 
@@ -104,7 +103,7 @@
         synchronized (this) {
         	this.waitingForData = true;
 	        try {
-	        	this.dataMgr.executeRequest(aqr, this.connectorId, this);
+	        	this.dataMgr.executeRequest(aqr, this.connectorName, this);
 	        } catch (MetaMatrixComponentException e) {
 	        	exceptionOccurred(e);
 	        }
@@ -139,7 +138,7 @@
         } 
         // Request the next batch immediately
         if (!this.isLast && !waitingForData) {
-            this.dataMgr.requestBatch(this.aqr.getAtomicRequestID(), connectorId);
+            this.dataMgr.requestBatch(this.aqr.getAtomicRequestID(), this.connectorName);
             
             // update waitingForData
             this.waitingForData = true;
@@ -150,11 +149,11 @@
     }
     
     public void fullyCloseSource() throws MetaMatrixComponentException {
-    	this.dataMgr.closeRequest(aqr.getAtomicRequestID(), connectorId);
+    	this.dataMgr.closeRequest(aqr.getAtomicRequestID(), this.connectorName);
     }
     
     public void cancelRequest() throws MetaMatrixComponentException {
-    	this.dataMgr.cancelRequest(aqr.getAtomicRequestID(), connectorId);
+    	this.dataMgr.cancelRequest(aqr.getAtomicRequestID(), this.connectorName);
     }
 
     /**
@@ -162,7 +161,7 @@
      */
     public void closeSource() throws MetaMatrixComponentException {
     	if (this.supportsImplicitClose) {
-    		this.dataMgr.closeRequest(aqr.getAtomicRequestID(), connectorId);
+    		this.dataMgr.closeRequest(aqr.getAtomicRequestID(), this.connectorName);
     	}
     }
 
@@ -171,7 +170,7 @@
 			if(workItem.requestMsg.supportsPartialResults()) {
 				nextBatch = new List[0];
 				nextBatchIsLast = true;
-		        String connectorBindingName = dataMgr.getConnectorName(aqr.getConnectorBindingID());
+		        String connectorBindingName = dataMgr.getConnectorName(aqr.getConnectorName());
 		        SourceWarning sourceFailure = new SourceWarning(this.aqr.getModelName(), connectorBindingName, e, true);
 		        workItem.addSourceFailureDetails(sourceFailure);
 			} else {
@@ -201,7 +200,7 @@
 	        waitingForData = false;
 		}
 		if (response.getWarnings() != null) {
-	        String connectorBindingName = dataMgr.getConnectorName(aqr.getConnectorBindingID());
+	        String connectorBindingName = dataMgr.getConnectorName(aqr.getConnectorName());
 			for (Exception warning : response.getWarnings()) {
 				SourceWarning sourceFailure = new SourceWarning(this.aqr.getModelName(), connectorBindingName, warning, true);
 		        workItem.addSourceFailureDetails(sourceFailure);
@@ -217,8 +216,8 @@
 		return aqr;
 	}
 
-	public ConnectorID getConnectorId() {
-		return connectorId;
+	public String getConnectorName() {
+		return this.connectorName;
 	}
 	
 	public boolean isTransactional() {

Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/LobWorkItem.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/LobWorkItem.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/LobWorkItem.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -24,6 +24,8 @@
 
 import java.io.IOException;
 
+import javax.resource.spi.work.Work;
+
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.common.buffer.BlockedOnMemoryException;
 import com.metamatrix.common.buffer.TupleSourceNotFoundException;
@@ -36,7 +38,7 @@
 import com.metamatrix.dqp.message.RequestID;
 import com.metamatrix.dqp.util.LogConstants;
 
-public class LobWorkItem implements Runnable {
+public class LobWorkItem implements Work {
 	
 	private RequestWorkItem parent;
     private RequestID requestID; 
@@ -76,7 +78,7 @@
             shouldClose = chunk.isLast();
     	} catch (BlockedOnMemoryException e) {
 			LogManager.logDetail(LogConstants.CTX_DQP, new Object[] {"Reenqueueing LOB chunk request due to lack of available memory ###########", requestID}); //$NON-NLS-1$ //$NON-NLS-2$
-			this.dqpCore.addWork(this);
+			this.dqpCore.addWork(this, null);
 			return;
     	} catch (TupleSourceNotFoundException e) {
             LogManager.logWarning(LogConstants.CTX_DQP, e, DQPPlugin.Util.getString("BufferManagerLobChunkStream.no_tuple_source", streamId)); //$NON-NLS-1$
@@ -127,4 +129,9 @@
     	Assertion.isNull(this.resultsReceiver, "Cannot request results with a pending request"); //$NON-NLS-1$
     	this.resultsReceiver = resultsReceiver;
     }
+
+	@Override
+	public void release() {
+		
+	}
 }

Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/Request.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/Request.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -31,9 +31,6 @@
 import java.util.Properties;
 import java.util.Set;
 
-import javax.transaction.SystemException;
-
-import org.teiid.connector.xa.api.TransactionContext;
 import org.teiid.dqp.internal.process.capabilities.ConnectorCapabilitiesFinder;
 import org.teiid.dqp.internal.process.capabilities.SharedCachedFinder;
 import org.teiid.dqp.internal.process.multisource.MultiSourceCapabilitiesFinder;
@@ -64,6 +61,7 @@
 import com.metamatrix.dqp.service.DQPServiceNames;
 import com.metamatrix.dqp.service.DataService;
 import com.metamatrix.dqp.service.MetadataService;
+import com.metamatrix.dqp.service.TransactionContext;
 import com.metamatrix.dqp.service.TransactionService;
 import com.metamatrix.dqp.service.VDBService;
 import com.metamatrix.dqp.util.LogConstants;
@@ -402,13 +400,12 @@
                     tc = transactionService.start(tc);
                 } catch (XATransactionException err) {
                     throw new MetaMatrixComponentException(err);
-                } catch (SystemException err) {
-                    throw new MetaMatrixComponentException(err);
                 }
             }
         } 
         
         this.transactionContext = tc;
+        this.transactionContext.inTransaction(true);
         this.processor = new QueryProcessor(processPlan, context, bufferManager, new TempTableDataManager(processorDataManager, tempTableStore));
     }
 

Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -32,10 +32,6 @@
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
-import javax.transaction.InvalidTransactionException;
-import javax.transaction.SystemException;
-
-import org.teiid.connector.xa.api.TransactionContext;
 import org.teiid.dqp.internal.cache.CacheID;
 import org.teiid.dqp.internal.cache.CacheResults;
 import org.teiid.dqp.internal.cache.ResultSetCache;
@@ -67,6 +63,7 @@
 import com.metamatrix.dqp.message.RequestMessage;
 import com.metamatrix.dqp.message.ResultsMessage;
 import com.metamatrix.dqp.service.CommandLogMessage;
+import com.metamatrix.dqp.service.TransactionContext;
 import com.metamatrix.dqp.service.TransactionService;
 import com.metamatrix.dqp.util.LogConstants;
 import com.metamatrix.query.analysis.AnalysisRecord;
@@ -182,11 +179,41 @@
 	protected boolean isDoneProcessing() {
 		return isClosed;
 	}
-
+	
+//	@Override
+//	protected void resumeProcessing() {
+//		dqpCore.addWork(this, getTransactionContext());
+//	}	
+	
 	@Override
+	public void run() {
+		while (!this.isDoneProcessing()) { //process until closed
+			super.run();
+		}
+	}
+	
+	@Override
 	protected void resumeProcessing() {
-		dqpCore.addWork(this);
+		this.notify();
 	}
+	
+	@Override
+	protected void pauseProcessing() {
+		try {
+			this.wait();
+		} catch (InterruptedException e) {
+			interrupted(e);
+		}
+	}
+	
+	private void interrupted(InterruptedException e) {
+		try {
+			LogManager.logDetail(LogConstants.CTX_DQP, e, this.requestID+" Interrupted, proceeding to close"); //$NON-NLS-1$
+			this.dqpCore.cancelRequest(this.requestID);
+		} catch (MetaMatrixComponentException e1) {
+			LogManager.logWarning(LogConstants.CTX_DQP, e, DQPPlugin.Util.getString("Cancel_failed", this.requestID)); //$NON-NLS-1$			
+		}
+	}
              
 	@Override
 	protected void process() {
@@ -255,7 +282,7 @@
         }
     }
 
-	protected void processMore() throws SystemException, BlockedException, MetaMatrixCoreException {
+	protected void processMore() throws BlockedException, MetaMatrixCoreException {
 		if (!doneProducingBatches) {
 			sendResultsIfNeeded(null);
 		    doneProducingBatches = processor.process(this.processorTimeslice);
@@ -345,8 +372,6 @@
         		this.transactionService.rollback(transactionContext);
             } catch (XATransactionException e1) {
                 LogManager.logWarning(LogConstants.CTX_DQP, e1, DQPPlugin.Util.getString("ProcessWorker.failed_rollback")); //$NON-NLS-1$           
-            } catch (SystemException err) {
-                LogManager.logWarning(LogConstants.CTX_DQP, err, DQPPlugin.Util.getString("ProcessWorker.failed_rollback")); //$NON-NLS-1$
             }
 		}
 		
@@ -562,7 +587,7 @@
             }
 		}
     	workItem.setResultsReceiver(chunckReceiver);
-        dqpCore.addWork(workItem);
+        dqpCore.addWork(workItem, getTransactionContext());
     }
     
     public void removeLobStream(int streamRequestId) {
@@ -590,9 +615,8 @@
 	            if (transactionService != null) {
 	                try {
 	                    transactionService.cancelTransactions(requestID.getConnectionID(), true);
-	                } catch (InvalidTransactionException err) {
+	                } catch (XATransactionException err) {
 	                    LogManager.logWarning(LogConstants.CTX_DQP, "rollback failed for requestID=" + requestID.getConnectionID()); //$NON-NLS-1$
-	                } catch (SystemException err) {
 	                    throw new MetaMatrixComponentException(err);
 	                }
 	            }
@@ -665,7 +689,7 @@
     private void logCommandError() {
         String transactionID = null;
         if (this.transactionContext != null && this.transactionContext.isInTransaction()) {
-            transactionID = this.transactionContext.getTxnID();
+            transactionID = this.transactionContext.getXid().toString();
         }
         CommandLogMessage message = new CommandLogMessage(System.currentTimeMillis(), requestID.toString(), transactionID == null ? null : transactionID, requestID.getConnectionID(), dqpWorkContext.getUserName(), dqpWorkContext.getVdbName(), dqpWorkContext.getVdbVersion(), -1, false, true);
         LogManager.log(MessageLevel.INFO, LogConstants.CTX_COMMANDLOGGING, message);
@@ -692,11 +716,7 @@
 	TransactionContext getTransactionContext() {
 		return transactionContext;
 	}
-	
-	void setTransactionContext(TransactionContext transactionContext) {
-		this.transactionContext = transactionContext;
-	}
-	
+		
 	Collection<DataTierTupleSource> getConnectorRequests() {
 		return new LinkedList<DataTierTupleSource>(this.connectorInfo.values());
 	}

Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/capabilities/ConnectorCapabilitiesFinder.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/capabilities/ConnectorCapabilitiesFinder.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/capabilities/ConnectorCapabilitiesFinder.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -27,7 +27,6 @@
 import org.teiid.dqp.internal.process.DQPWorkContext;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.dqp.internal.datamgr.ConnectorID;
 import com.metamatrix.dqp.message.RequestMessage;
 import com.metamatrix.dqp.service.DataService;
 import com.metamatrix.dqp.service.VDBService;
@@ -61,8 +60,7 @@
         for(int i=0; i<bindings.size(); i++) {
             try {
                 String connBinding = (String) bindings.get(i); 
-                ConnectorID connector = dataService.selectConnector(connBinding);
-                return dataService.getCapabilities(requestMessage, workContext, connector);
+                return dataService.getCapabilities(connBinding);
             }catch(MetaMatrixComponentException e) {
                 if(i == bindings.size()-1) {
                     throw e;

Added: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/transaction/ContainerTransactionProvider.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/transaction/ContainerTransactionProvider.java	                        (rev 0)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/transaction/ContainerTransactionProvider.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,38 @@
+/*
+ * 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 org.teiid.dqp.internal.transaction;
+
+import javax.resource.spi.XATerminator;
+
+public class ContainerTransactionProvider implements TransactionProvider {
+	XATerminator terminator;
+		
+	public ContainerTransactionProvider(XATerminator terminator) {
+		this.terminator = terminator;
+	}
+
+	@Override
+	public XATerminator getXATerminator() {
+		return terminator;
+	}
+}


Property changes on: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/transaction/ContainerTransactionProvider.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Deleted: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/transaction/TransactionContextImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/transaction/TransactionContextImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/transaction/TransactionContextImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,166 +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 org.teiid.dqp.internal.transaction;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.util.Collections;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.transaction.Transaction;
-import javax.transaction.xa.XAResource;
-
-import org.teiid.connector.xa.api.TransactionContext;
-
-import com.metamatrix.common.xa.MMXid;
-import com.metamatrix.core.MetaMatrixRuntimeException;
-import com.metamatrix.dqp.DQPPlugin;
-
-class TransactionContextImpl implements
-                              TransactionContext, Externalizable {
-
-    private String threadId;
-    private MMXid xid;
-    private String txnID;
-    private Transaction transaction;
-    private Scope transactionType = Scope.NONE;
-    private Set<String> suspendedBy = Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>());
-    private int transactionTimeout = -1;
-    private Set<XAResource> xaResources = Collections.newSetFromMap(new ConcurrentHashMap<XAResource, Boolean>());
-    private long creationTime;
-    
-    public TransactionContextImpl() {}
-    
-    public boolean isInTransaction() {
-        return getTransaction() != null;
-    }
-
-    /**
-     * @param transaction
-     *            The transaction to set.
-     */
-    void setTransaction(Transaction transaction, String id) {
-        this.transaction = transaction;
-        this.txnID = id;
-        this.creationTime = System.currentTimeMillis();
-    }
-    
-    long getCreationTime() {
-		return creationTime;
-	}
-    
-    /**
-     * @return Returns the transaction.
-     */
-    public Transaction getTransaction() {
-        return transaction;
-    }
-
-    /**
-     * @return Returns the txnID.
-     */
-    public String getTxnID() {
-        return this.txnID;
-    }
-
-    void setTransactionType(Scope transactionType) {
-        this.transactionType = transactionType;
-    }
-
-    public Scope getTransactionType() {
-        return transactionType;
-    }
-
-    /**
-     * @see java.lang.Object#toString()
-     */
-    public String toString() {
-        StringBuffer sb = new StringBuffer();
-        this.buildString(sb);
-        return sb.toString();
-    }
-
-    private void buildString(StringBuffer sb) {
-        sb.append("TxnContext: ").append(this.txnID); //$NON-NLS-1$
-    }
-
-    void setThreadId(String threadId) {
-        this.threadId = threadId;
-    }
-
-    String getThreadId() {
-        return threadId;
-    }
-
-    public MMXid getXid() {
-        return this.xid;
-    }
-
-    void setXid(MMXid xid) {
-        this.xid = xid;
-    }
-
-    Set<String> getSuspendedBy() {
-        return this.suspendedBy;
-    }
-
-    /** 
-     * @see org.teiid.connector.xa.api.TransactionContext#getTransactionTimeout()
-     */
-    int getTransactionTimeout() {
-        return this.transactionTimeout;
-    }
-    
-    void setTransactionTimeout(int transactionTimeout) {
-        this.transactionTimeout = transactionTimeout;
-    }
-    
-    void addXAResource(XAResource resource) {
-    	this.xaResources.add(resource);
-    }
-    
-    Set<XAResource> getXAResources() {
-    	return xaResources;
-    }
-
-    /** 
-     * @see java.io.Externalizable#readExternal(java.io.ObjectInput)
-     */
-    public void readExternal(ObjectInput in) throws IOException,
-                                            ClassNotFoundException {
-        
-    }
-
-    /** 
-     * @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
-     */
-    public void writeExternal(ObjectOutput out) throws IOException {
-        if (this.transaction != null) {
-            throw new MetaMatrixRuntimeException(DQPPlugin.Util.getString("TransactionContextImpl.remote_not_supported")); //$NON-NLS-1$
-        }
-    }
-
-}
\ No newline at end of file

Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/transaction/TransactionProvider.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/transaction/TransactionProvider.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/transaction/TransactionProvider.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,43 +22,11 @@
 
 package org.teiid.dqp.internal.transaction;
 
-import java.sql.SQLException;
-import java.util.Properties;
-
 import javax.resource.spi.XATerminator;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-import javax.transaction.xa.XAException;
-import javax.transaction.xa.XAResource;
 
-import com.metamatrix.common.xa.MMXid;
-import com.metamatrix.common.xa.XATransactionException;
 
-
 public interface TransactionProvider {
 	
-	public interface XAConnectionSource {
-		
-		XAResource getXAResource() throws SQLException;
-		
-		void close();
-		
-	}
-    
-    void init(Properties props) throws XATransactionException;
-
     XATerminator getXATerminator();
 
-    TransactionManager getTransactionManager();
-
-    Transaction importTransaction(MMXid xid, int timeout) throws XAException, SystemException;
-    
-    String getTransactionID(Transaction tx);
-    
-    void shutdown();
-    
-    void registerRecoverySource(String name, XAConnectionSource resource);
-    
-    void removeRecoverySource(String name);    
 }
\ No newline at end of file

Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/transaction/TransactionServerImpl.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/transaction/TransactionServerImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/transaction/TransactionServerImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -32,27 +32,15 @@
 import java.util.Properties;
 import java.util.Set;
 
-import javax.transaction.HeuristicMixedException;
-import javax.transaction.HeuristicRollbackException;
+import javax.resource.NotSupportedException;
 import javax.transaction.InvalidTransactionException;
-import javax.transaction.NotSupportedException;
-import javax.transaction.RollbackException;
-import javax.transaction.Status;
-import javax.transaction.Synchronization;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
 import javax.transaction.xa.XAException;
 import javax.transaction.xa.XAResource;
 import javax.transaction.xa.Xid;
 
-import org.teiid.adminapi.AdminComponentException;
 import org.teiid.adminapi.AdminException;
 import org.teiid.adminapi.AdminProcessingException;
-import org.teiid.connector.xa.api.TransactionContext;
-import org.teiid.dqp.internal.transaction.TransactionProvider.XAConnectionSource;
 
-import com.metamatrix.admin.objects.MMAdminObject;
 import com.metamatrix.admin.objects.TransactionImpl;
 import com.metamatrix.common.application.ApplicationEnvironment;
 import com.metamatrix.common.application.exception.ApplicationInitializationException;
@@ -61,6 +49,7 @@
 import com.metamatrix.common.xa.XATransactionException;
 import com.metamatrix.core.util.Assertion;
 import com.metamatrix.dqp.DQPPlugin;
+import com.metamatrix.dqp.service.TransactionContext;
 import com.metamatrix.dqp.service.TransactionService;
 
 public class TransactionServerImpl implements TransactionService {
@@ -68,15 +57,15 @@
     private static class TransactionMapping {
 
         // (connection -> transaction for global and local)
-        private Map<String, TransactionContextImpl> threadToTransactionContext = new HashMap<String, TransactionContextImpl>();
+        private Map<String, TransactionContext> threadToTransactionContext = new HashMap<String, TransactionContext>();
         // (MMXid -> global transactions keyed)
-        private Map<MMXid, TransactionContextImpl> xidToTransactionContext = new HashMap<MMXid, TransactionContextImpl>();
+        private Map<Xid, TransactionContext> xidToTransactionContext = new HashMap<Xid, TransactionContext>();
         
-        public synchronized TransactionContextImpl getOrCreateTransactionContext(String threadId) {
-            TransactionContextImpl tc = threadToTransactionContext.get(threadId);
+        public synchronized TransactionContext getOrCreateTransactionContext(String threadId) {
+            TransactionContext tc = threadToTransactionContext.get(threadId);
 
             if (tc == null) {
-                tc = new TransactionContextImpl();
+                tc = new TransactionContext();
                 tc.setThreadId(threadId);
                 threadToTransactionContext.put(threadId, tc);
             }
@@ -84,19 +73,19 @@
             return tc;
         }
         
-        public synchronized TransactionContextImpl getTransactionContext(String threadId) {
+        public synchronized TransactionContext getTransactionContext(String threadId) {
             return threadToTransactionContext.get(threadId);
         }
 
-        public synchronized TransactionContextImpl getTransactionContext(MMXid xid) {
+        public synchronized TransactionContext getTransactionContext(MMXid xid) {
             return xidToTransactionContext.get(xid);
         }
 
-        public synchronized TransactionContextImpl removeTransactionContext(String threadId) {
+        public synchronized TransactionContext removeTransactionContext(String threadId) {
             return threadToTransactionContext.remove(threadId);
         }
 
-        public synchronized void removeTransactionContext(TransactionContextImpl tc) {
+        public synchronized void removeTransactionContext(TransactionContext tc) {
             if (tc.getXid() != null) {
                 this.xidToTransactionContext.remove(tc.getXid());
             }
@@ -109,7 +98,7 @@
             this.xidToTransactionContext.remove(xid);
         }
 
-        public synchronized void addTransactionContext(TransactionContextImpl tc) {
+        public synchronized void addTransactionContext(TransactionContext tc) {
             if (tc.getXid() != null) {
                 this.xidToTransactionContext.put(tc.getXid(), tc);
             }
@@ -123,6 +112,7 @@
     
     private TransactionProvider provider;
     private String processName = "embedded"; //$NON-NLS-1$
+    private XidFactory xidFactory;
 
     public TransactionServerImpl() {
     }
@@ -135,148 +125,82 @@
         this.provider = theProvider;
     }
 
-    @SuppressWarnings("finally")
-	public int prepare(final String threadId,
-                       MMXid xid) throws XATransactionException {
-        TransactionContextImpl impl = checkXAState(threadId, xid, true, false);
+    /**
+     * Global Transaction 
+     */
+	public int prepare(final String threadId, MMXid xid) throws XATransactionException {
+        TransactionContext impl = checkXAState(threadId, xid, true, false);
         if (!impl.getSuspendedBy().isEmpty()) {
             throw new XATransactionException(XAException.XAER_PROTO, DQPPlugin.Util.getString("TransactionServer.suspended_exist", xid)); //$NON-NLS-1$
-        }
-        try {
-        	getTransactionManager().resume(impl.getTransaction());
-        	try {
-        		endAssociations(impl);
-        	} finally {
-        		return this.provider.getXATerminator().prepare(xid);
-        	}
-        } catch (XAException err) {
-            throw new XATransactionException(err);
-        } catch (SystemException err) {
-        	throw new XATransactionException(err);
-		} catch (InvalidTransactionException err) {
-			throw new XATransactionException(err);
-		} catch (IllegalStateException err) {
-			throw new XATransactionException(err);
-		} finally {
-			try {
-				getTransactionManager().suspend();
-			} catch (SystemException err) {
-				throw new XATransactionException(err);
-			}
-		}
+        }		
+        
+    	// In the container this pass though
+    	return XAResource.XA_RDONLY;
     }
     
-    private void endAssociations(TransactionContextImpl impl) throws XATransactionException, SystemException {
-        Transaction tx = getTransactionManager().getTransaction();
-        Assertion.isNotNull(tx);
-        for (XAResource resource : impl.getXAResources()) {
-        	if (!tx.delistResource(resource, XAResource.TMSUCCESS)) {
-                throw new XATransactionException(DQPPlugin.Util.getString("TransactionServer.failed_to_delist")); //$NON-NLS-1$
-            }
-        }
-        impl.getXAResources().clear();
+    /**
+     * Global Transaction 
+     */    
+    public void commit(final String threadId, MMXid xid, boolean onePhase) throws XATransactionException {
+    	// no-op; Connector sources will be directly managed by container's TM
+    	TransactionContext tc = checkXAState(threadId, xid, true, false);     
+    	this.transactions.removeTransactionContext(tc);
     }
-
-    public void commit(final String threadId,
-                       MMXid xid,
-                       boolean onePhase) throws XATransactionException {
-
-        TransactionContextImpl tc = checkXAState(threadId, xid, true, false);        
-        try {
-            if (onePhase && prepare(threadId, xid) == XAResource.XA_RDONLY) {
-                return;
-            }
-            // TODO: for one phase, MM needs to check if there are multiple resources involved
-            // or single, in its txn, if it has single it can use onePhase.
-            // Also, Arjuna has bug JBTM-457, where on single phase commit, they do not call the synchronization
-            // when they fix the bug, we can re-write next couple lines differently to make use of the
-            // optimization of onePhase.
-            this.provider.getXATerminator().commit(xid, false);
-        } catch (XAException err) {
-            throw new XATransactionException(err);
-        } finally {
-            this.transactions.removeTransactionContext(tc);
-        }
+    
+    /**
+     * Global Transaction 
+     */
+    public void rollback(final String threadId, MMXid xid) throws XATransactionException {
+    	// no-op; Connector sources will be directly managed by container's TM
+    	TransactionContext tc = checkXAState(threadId, xid, true, false);     
+    	this.transactions.removeTransactionContext(tc);
     }
 
-    public void rollback(final String threadId,
-                         MMXid xid) throws XATransactionException {
-        TransactionContextImpl tc = checkXAState(threadId, xid, true, false);
-        try {
-            this.provider.getXATerminator().rollback(xid);
-        } catch (XAException err) {
-            throw new XATransactionException(err);
-        } finally {
-            this.transactions.removeTransactionContext(tc);
-        }
-    }
-
+    /**
+     * Global Transaction 
+     */    
     public Xid[] recover(int flag) throws XATransactionException {
-        try {
-            return this.provider.getXATerminator().recover(flag);
-        } catch (XAException err) {
-            throw new XATransactionException(err);
-        }
+    	// no-op; Connector sources will be directly managed by container's TM
+    	return new Xid[0];
     }
 
-    public void forget(final String threadId,
-                       MMXid xid) throws XATransactionException {
-        try {
-            this.provider.getXATerminator().forget(xid);
-        } catch (XAException err) {
-            throw new XATransactionException(err);
-        } finally {
-            this.transactions.removeTransactionContext(xid);
-        }
+    /**
+     * Global Transaction 
+     */    
+    public void forget(final String threadId, MMXid xid) throws XATransactionException {
+    	// no-op; Connector sources will be directly managed by container's TM
     }
 
+    /**
+     * Global Transaction 
+     */
     public void start(final String threadId,
                       final MMXid xid,
                       int flags,
                       int timeout) throws XATransactionException {
         
-        TransactionContextImpl tc = null;
+        TransactionContext tc = null;
 
         switch (flags) {
             case XAResource.TMNOFLAGS: {
-                checkXAState(threadId, xid, false, false);
-                tc = transactions.getOrCreateTransactionContext(threadId);
-                if (tc.getTransactionType() != TransactionContext.Scope.NONE) {
-                    throw new XATransactionException(XAException.XAER_PROTO, DQPPlugin.Util.getString("TransactionServer.existing_transaction")); //$NON-NLS-1$
-                }
-                Transaction tx;
                 try {
-                    tx = this.provider.importTransaction(xid, timeout);
-                } catch (XAException err) {
-                    throw new XATransactionException(err);
-                } catch (SystemException err) {
-                	throw new XATransactionException(err);
-                }
-                
-                try {
-                    tx.registerSynchronization(new Synchronization() {
-
-                        public void afterCompletion(int arg0) {
-                            transactions.removeTransactionContext(xid);
-                        }
-
-                        public void beforeCompletion() {
-                        }});
-                } catch (RollbackException err) {
-                    throw new XATransactionException(err, XAException.XA_RBROLLBACK);
-                } catch (SystemException err) {
-                    throw new XATransactionException(err, XAException.XAER_RMERR);
-                }
-                tc.setTransaction(tx, provider.getTransactionID(tx));
-                tc.setTransactionTimeout(timeout);
-                tc.setXid(xid);
-                tc.setTransactionType(TransactionContext.Scope.GLOBAL);
+					checkXAState(threadId, xid, false, false);
+					tc = transactions.getOrCreateTransactionContext(threadId);
+					if (tc.getTransactionType() != TransactionContext.Scope.NONE) {
+					    throw new XATransactionException(XAException.XAER_PROTO, DQPPlugin.Util.getString("TransactionServer.existing_transaction")); //$NON-NLS-1$
+					}
+					tc.setTransactionTimeout(timeout);
+					tc.setXid(xid);
+					tc.setTransactionType(TransactionContext.Scope.GLOBAL);
+				} catch (NotSupportedException e) {
+					throw new XATransactionException(XAException.XAER_INVAL, e.getMessage()); //$NON-NLS-1$
+				}
                 break;
             }
             case XAResource.TMJOIN:
             case XAResource.TMRESUME: {
                 tc = checkXAState(threadId, xid, true, false);
-                TransactionContextImpl threadContext = transactions.getOrCreateTransactionContext(threadId);
+                TransactionContext threadContext = transactions.getOrCreateTransactionContext(threadId);
                 if (threadContext.getTransactionType() != TransactionContext.Scope.NONE) {
                     throw new XATransactionException(XAException.XAER_PROTO, DQPPlugin.Util.getString("TransactionServer.existing_transaction")); //$NON-NLS-1$
                 }
@@ -294,10 +218,11 @@
         transactions.addTransactionContext(tc);
     }
 
-    public void end(final String threadId,
-                    MMXid xid,
-                    int flags) throws XATransactionException {
-        TransactionContextImpl tc = checkXAState(threadId, xid, true, true);
+    /**
+     * Global Transaction 
+     */    
+    public void end(final String threadId, MMXid xid, int flags) throws XATransactionException {
+        TransactionContext tc = checkXAState(threadId, xid, true, true);
         try {
             switch (flags) {
                 case XAResource.TMSUSPEND: {
@@ -309,11 +234,6 @@
                     break;
                 }
                 case XAResource.TMFAIL: {
-                    try {
-                        tc.getTransaction().setRollbackOnly();
-                    } catch (SystemException err) {
-                        throw new XATransactionException(err, XAException.XAER_RMERR);
-                    }
                     break;
                 }
                 default:
@@ -325,10 +245,8 @@
         }
     }
 
-    private TransactionContextImpl checkXAState(final String threadId,
-                                                    final MMXid xid,
-                                                    boolean transactionExpected, boolean threadBound) throws XATransactionException {
-        TransactionContextImpl tc = transactions.getTransactionContext(xid);
+    private TransactionContext checkXAState(final String threadId, final MMXid xid, boolean transactionExpected, boolean threadBound) throws XATransactionException {
+        TransactionContext tc = transactions.getTransactionContext(xid);
         
         if (transactionExpected && tc == null) {
             throw new XATransactionException(XAException.XAER_NOTA, DQPPlugin.Util.getString("TransactionServer.no_global_transaction", xid)); //$NON-NLS-1$
@@ -356,23 +274,18 @@
         return tc;
     }
 
-    private TransactionContextImpl checkLocalTransactionState(String threadId,
-                                               boolean transactionExpected) throws NotSupportedException,
-                                                                           SystemException,
-                                                                           InvalidTransactionException {
+    private TransactionContext checkLocalTransactionState(String threadId, boolean transactionExpected) 
+    	throws InvalidTransactionException {
 
-        final TransactionContextImpl tc = transactions.getOrCreateTransactionContext(threadId);
+        final TransactionContext tc = transactions.getOrCreateTransactionContext(threadId);
 
-        final TransactionManager tm = getTransactionManager();
-
         if (tc.getTransactionType() != TransactionContext.Scope.NONE) {
             if (tc.getTransactionType() != TransactionContext.Scope.LOCAL) {
-                throw new NotSupportedException(DQPPlugin.Util.getString("TransactionServer.existing_transaction")); //$NON-NLS-1$
+                throw new InvalidTransactionException(DQPPlugin.Util.getString("TransactionServer.existing_transaction")); //$NON-NLS-1$
             }
             if (!transactionExpected) {
-                throw new NotSupportedException(DQPPlugin.Util.getString("TransactionServer.existing_transaction")); //$NON-NLS-1$
+                throw new InvalidTransactionException(DQPPlugin.Util.getString("TransactionServer.existing_transaction")); //$NON-NLS-1$
             }
-            tm.resume(tc.getTransaction());
         } else if (transactionExpected) {
             throw new InvalidTransactionException(DQPPlugin.Util.getString("TransactionServer.no_transaction", threadId)); //$NON-NLS-1$
         }
@@ -380,191 +293,130 @@
         return tc;
     }
 
-    public TransactionContext begin(String threadId) throws XATransactionException, SystemException {
+    /**
+     * Local Transaction 
+     */
+    public TransactionContext begin(String threadId) throws XATransactionException {
         try {
-            TransactionContextImpl tc = checkLocalTransactionState(threadId, false);
-            final TransactionManager tm = getTransactionManager();
-            tm.begin();
-            Transaction tx = tm.suspend();
-            tc.setTransaction(tx, provider.getTransactionID(tx));
+            TransactionContext tc = checkLocalTransactionState(threadId, false);
+            tc.setXid(this.xidFactory.createXid());
+            tc.setCreationTime(System.currentTimeMillis());
             tc.setTransactionType(TransactionContext.Scope.LOCAL);
             return tc;
         } catch (InvalidTransactionException err) {
             throw new XATransactionException(err);
-        } catch (NotSupportedException err) {
-            throw new XATransactionException(err);
-        } 
+        }
     }
 
-    public void commit(String threadId) throws XATransactionException, SystemException {
-        TransactionContextImpl tc;
+    /**
+     * Local Transaction 
+     */    
+    public void commit(String threadId) throws XATransactionException {
+        TransactionContext tc;
         try {
             tc = checkLocalTransactionState(threadId, true);
         } catch (InvalidTransactionException err) {
             throw new XATransactionException(err);
-        } catch (NotSupportedException err) {
-            throw new XATransactionException(err);
         } 
-        final TransactionManager tm = getTransactionManager();
+
+        if (tc.shouldRollback()) {
+        	rollback(threadId);
+        }
         try {
-        	try {
-        		endAssociations(tc);
-        	} finally {
-        		tm.commit();
+        	if (tc.isInTransaction()) {
+		        // TODO: implement the one phase logic
+		        this.provider.getXATerminator().commit(tc.getXid(), false);
         	}
-        } catch (IllegalStateException err) {
-            throw new XATransactionException(err);
-        } catch (RollbackException err) {
-            throw new XATransactionException(err);
-        } catch (HeuristicMixedException err) {
-            throw new XATransactionException(err);
-        } catch (HeuristicRollbackException err) {
-            throw new XATransactionException(err);
+        } catch (XAException e) {
+            throw new XATransactionException(e);
         } finally {
             transactions.removeTransactionContext(tc);
         }
-        
     }
 
-    public void rollback(String threadId) throws XATransactionException, SystemException {
-        TransactionContextImpl tc;
+    /**
+     * Local Transaction 
+     */    
+    public void rollback(String threadId) throws XATransactionException {
+        TransactionContext tc;
         try {
             tc = checkLocalTransactionState(threadId, true);
         } catch (InvalidTransactionException err) {
             throw new XATransactionException(err);
-        } catch (NotSupportedException err) {
-            throw new XATransactionException(err);
         } 
-        final TransactionManager tm = getTransactionManager();
         
         try {
-            tm.rollback();
-        } catch (IllegalStateException err) {
-            throw new XATransactionException(err);
+        	if (tc.isInTransaction()) {
+        		this.provider.getXATerminator().rollback(tc.getXid());
+        	}
+        } catch (XAException e) {
+            throw new XATransactionException(e);
         } finally {
             transactions.removeTransactionContext(tc);
         }
     }
 
-    public TransactionManager getTransactionManager() {
-        return provider.getTransactionManager();
-    }
 
     public TransactionContext getOrCreateTransactionContext(String threadId) {
         return transactions.getOrCreateTransactionContext(threadId);
     }
 
-    // request level transaction
-    public TransactionContext start(TransactionContext context) throws XATransactionException, SystemException {
-        TransactionManager tm = getTransactionManager();
-
-        TransactionContextImpl tc = (TransactionContextImpl)context;
-
-        try {
-            if (tc.getTransactionType() != TransactionContext.Scope.NONE) {
-                throw new XATransactionException(DQPPlugin.Util.getString("TransactionServer.existing_transaction")); //$NON-NLS-1$
-            }
-            tm.begin();
-            Transaction tx = tm.suspend();
-            
-            tc.setTransaction(tx, provider.getTransactionID(tx));
-            tc.setTransactionType(TransactionContext.Scope.REQUEST);
-            return tc;
-        } catch (NotSupportedException e) {
-            throw new XATransactionException(e);
+    /**
+     * Request level transaction
+     */
+    public TransactionContext start(TransactionContext context) throws XATransactionException{
+        if (context.getTransactionType() != TransactionContext.Scope.NONE) {
+            throw new XATransactionException(DQPPlugin.Util.getString("TransactionServer.existing_transaction")); //$NON-NLS-1$
         }
+        context.setXid(this.xidFactory.createXid());
+        context.setCreationTime(System.currentTimeMillis());
+        context.setTransactionType(TransactionContext.Scope.REQUEST);
+        return context;
     }
 
-    public TransactionContext commit(TransactionContext context) throws XATransactionException, SystemException {
+    /**
+     * Request level transaction
+     */    
+    public TransactionContext commit(TransactionContext context) throws XATransactionException {
         Assertion.assertTrue(context.getTransactionType() == TransactionContext.Scope.REQUEST);
-        TransactionContextImpl tc = (TransactionContextImpl)context;
         
         //commit may be called multiple times by the processworker, if this is a subsequent call, then the current
         //context will not be active
-        TransactionContextImpl currentContext = transactions.getTransactionContext(tc.getThreadId());
+        TransactionContext currentContext = transactions.getTransactionContext(context.getThreadId());
         if (currentContext == null || currentContext.getTransactionType() == TransactionContext.Scope.NONE) {
             return currentContext;
         }
-        TransactionManager tm = getTransactionManager();
-        
         try {
-            tm.resume(context.getTransaction());
-            try {
-            	endAssociations(tc);
-            } finally {
-            	tm.commit();
-            }
-        } catch (InvalidTransactionException e) {
+	        // TODO: implement the one phase logic
+	        this.provider.getXATerminator().commit(context.getXid(), false);
+        } catch (XAException e) {
             throw new XATransactionException(e);
-        } catch (RollbackException e) {
-            throw new XATransactionException(e);
-        } catch (HeuristicMixedException e) {
-            throw new XATransactionException(e);
-        } catch (HeuristicRollbackException e) {
-            throw new XATransactionException(e);
         } finally {
-            transactions.removeTransactionContext(tc);
+            transactions.removeTransactionContext(context);
         }
         return context;
     }
 
-    public TransactionContext rollback(TransactionContext context) throws XATransactionException, SystemException {
+    /**
+     * Request level transaction
+     */    
+    public TransactionContext rollback(TransactionContext context) throws XATransactionException {
         Assertion.assertTrue(context.getTransactionType() == TransactionContext.Scope.REQUEST);
-        TransactionManager tm = getTransactionManager();
         try {
-            tm.resume(context.getTransaction());
-        	tm.rollback();
-        } catch (InvalidTransactionException e) {
+	        this.provider.getXATerminator().rollback(context.getXid());
+        } catch (XAException e) {
             throw new XATransactionException(e);
         } finally {
-            transactions.removeTransactionContext((TransactionContextImpl)context);
-        }        
-        return context;
-    }
-
-    public TransactionContext enlist(TransactionContext context,
-                                     XAResource resource) throws XATransactionException {
-        TransactionManager tm = getTransactionManager();
-        TransactionContextImpl tc = (TransactionContextImpl)context;
-        
-        try {
-            if (tc.getTransactionTimeout() > 0 && tc.getTransactionTimeout() != resource.getTransactionTimeout()) {
-                resource.setTransactionTimeout(tc.getTransactionTimeout());
-            }
-            Transaction tx = tm.getTransaction();
-            if (tx == null) {
-                tm.resume(context.getTransaction());
-            } else if (!tx.equals(context.getTransaction())) {
-                throw new XATransactionException(context.getTransaction() + " != " + tx); //$NON-NLS-1$
-            }
-
-            if (!context.getTransaction().enlistResource(resource)) {
-				context.getTransaction().delistResource(resource, XAResource.TMFAIL);
-                throw new XATransactionException(DQPPlugin.Util.getString("TransactionServer.failed_to_enlist")); //$NON-NLS-1$
-            }
-            tc.addXAResource(resource);
-        } catch (SystemException err) {
-            throw new XATransactionException(err);
-        } catch (InvalidTransactionException err) {
-            throw new XATransactionException(err);
-        } catch (RollbackException err) {
-            throw new XATransactionException(err);
-        } catch (IllegalStateException err) {
-            throw new XATransactionException(err);
-        } catch (XAException err) {
-            throw new XATransactionException(err);
+            transactions.removeTransactionContext(context);
         }
-
-        return context;
+        return context;      
     }
 
-    /** 
-     * @throws IllegalStateException 
-     * @throws InvalidTransactionException 
-     * @see com.metamatrix.dqp.transaction.TransactionServer#cancelTransactions(java.lang.String)
+    /**
+     * Request level transaction
      */
-    public void cancelTransactions(String threadId, boolean requestOnly) throws InvalidTransactionException, SystemException {
-        TransactionContextImpl tc = transactions.getTransactionContext(threadId);
+    public void cancelTransactions(String threadId, boolean requestOnly) throws XATransactionException {
+        TransactionContext tc = transactions.getTransactionContext(threadId);
         
         if (tc == null || tc.getTransactionType() == TransactionContext.Scope.NONE) {
             return;
@@ -577,116 +429,62 @@
         cancelTransaction(tc);
     }
 
-	private void cancelTransaction(TransactionContextImpl tc)
-			throws InvalidTransactionException, SystemException {
-		TransactionManager tm = getTransactionManager();
-        
-        try {
-            tm.resume(tc.getTransaction());
-            tm.setRollbackOnly();
-        } finally {
-            tm.suspend();
-            //transactions.removeTransactionContext(tc);
-        }
+	private void cancelTransaction(TransactionContext context) throws XATransactionException {
+		context.setRollbackOnly();
+		rollback(context);
 	}    
     
-    public synchronized void registerRecoverySource(String name, XAConnectionSource resource) {
-        this.provider.registerRecoverySource(name, resource);
-    }
-
-    public synchronized void removeRecoverySource(String name) {
-        this.provider.removeRecoverySource(name);
-    }
-
 	@Override
 	public Collection<org.teiid.adminapi.Transaction> getTransactions() {
-		Set<TransactionContextImpl> txnSet = Collections.newSetFromMap(new IdentityHashMap<TransactionContextImpl, Boolean>());
+		Set<TransactionContext> txnSet = Collections.newSetFromMap(new IdentityHashMap<TransactionContext, Boolean>());
 		synchronized (this.transactions) {
 			txnSet.addAll(this.transactions.threadToTransactionContext.values());
 			txnSet.addAll(this.transactions.xidToTransactionContext.values());
 		}
 		Collection<org.teiid.adminapi.Transaction> result = new ArrayList<org.teiid.adminapi.Transaction>(txnSet.size());
-		for (TransactionContextImpl transactionContextImpl : txnSet) {
-			if (transactionContextImpl.getTxnID() == null) {
+		for (TransactionContext TransactionContext : txnSet) {
+			if (TransactionContext.getXid() == null) {
 				continue;
 			}
-			TransactionImpl txnImpl = new TransactionImpl(processName, transactionContextImpl.getTxnID());
-			txnImpl.setAssociatedSession(transactionContextImpl.getThreadId());
-			txnImpl.setCreated(new Date(transactionContextImpl.getCreationTime()));
-			txnImpl.setScope(transactionContextImpl.getTransactionType().toString());
-			try {
-				txnImpl.setStatus(getStatusString(transactionContextImpl.getTransaction().getStatus()));
-			} catch (SystemException e) {
-				txnImpl.setStatus(getStatusString(Status.STATUS_UNKNOWN));
-			}
-			txnImpl.setXid(transactionContextImpl.getXid());
+			TransactionImpl txnImpl = new TransactionImpl(processName, TransactionContext.getXid().toString());
+			txnImpl.setAssociatedSession(TransactionContext.getThreadId());
+			txnImpl.setCreated(new Date(TransactionContext.getCreationTime()));
+			txnImpl.setScope(TransactionContext.getTransactionType().toString());
+			txnImpl.setXid((MMXid)TransactionContext.getXid());
 			result.add(txnImpl);
 		}
 		return result;
 	}
 	
-	public static String getStatusString(int status) {
-		switch (status) {
-		case Status.STATUS_ACTIVE:
-			return "ACTIVE"; //$NON-NLS-1$
-		case Status.STATUS_COMMITTED:
-			return "COMMITTED"; //$NON-NLS-1$
-		case Status.STATUS_COMMITTING:
-			return "COMMITTING"; //$NON-NLS-1$
-		case Status.STATUS_MARKED_ROLLBACK:
-			return "MARKED_ROLLBACK"; //$NON-NLS-1$
-		case Status.STATUS_NO_TRANSACTION:
-			return "NO_TRANSACTION"; //$NON-NLS-1$
-		case Status.STATUS_PREPARED:
-			return "PREPARED"; //$NON-NLS-1$
-		case Status.STATUS_PREPARING:
-			return "PREPARING"; //$NON-NLS-1$
-		case Status.STATUS_ROLLEDBACK:
-			return "ROLLEDBACK"; //$NON-NLS-1$
-		case Status.STATUS_ROLLING_BACK:
-			return "ROLLING_BACK";			 //$NON-NLS-1$
-		}
-		return "UNKNOWN"; //$NON-NLS-1$
-	}
-	
 	@Override
-	public void terminateTransaction(Xid transactionId) throws AdminException {
-		if (transactionId == null) {
+	public void terminateTransaction(Xid xid) throws AdminException {
+		if (xid == null) {
 			return;
 		}
-		TransactionContextImpl context = this.transactions.getTransactionContext(new MMXid(transactionId));
-		if (context != null) {
-			try {
-				cancelTransaction(context);
-			} catch (InvalidTransactionException e) {
-				throw new AdminProcessingException(e);
-			} catch (SystemException e) {
-				throw new AdminComponentException(e);
+		TransactionContext context = this.transactions.getTransactionContext(new MMXid(xid));
+		context.setRollbackOnly();
+		
+		try {
+			if (context.getTransactionType() == TransactionContext.Scope.REQUEST ) {
+				rollback(context);
 			}
+			
+			if (context.getTransactionType() == TransactionContext.Scope.LOCAL ) {
+				rollback(context.getThreadId());
+			}
+			
+			if (context.getTransactionType() == TransactionContext.Scope.GLOBAL ) {
+				throw new AdminProcessingException("Can not terminate global transactions!");
+			}			
+		} catch (XATransactionException e) {
+			throw new AdminProcessingException(e.getMessage());
 		}
 	}
 	
-	@Override
-	public void terminateTransaction(String transactionId, String sessionId) throws AdminException {
-		if (transactionId == null) {
-			return;
-		}
-		String[] id = MMAdminObject.buildIdentifierArray(transactionId);
-		if (!this.processName.equalsIgnoreCase(id[0]) || id.length != 2) {
-			return;
-		}
-		TransactionContextImpl context = this.transactions.getTransactionContext(sessionId);
-		if (context != null && id[1].equalsIgnoreCase(context.getTxnID())) {
-			try {
-				cancelTransaction(context);
-			} catch (InvalidTransactionException e) {
-				throw new AdminProcessingException(e);
-			} catch (SystemException e) {
-				throw new AdminComponentException(e);
-			}
-		}
+	protected void setXidFactory(XidFactory f) {
+		this.xidFactory = f;
 	}
-
+	
 	@Override
 	public void initialize(Properties props)
 			throws ApplicationInitializationException {
@@ -700,7 +498,6 @@
 
 	@Override
 	public synchronized void stop() throws ApplicationLifecycleException {
-		this.provider.shutdown();
 	}    
     
 }

Added: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/transaction/XidFactory.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/transaction/XidFactory.java	                        (rev 0)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/transaction/XidFactory.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,43 @@
+/*
+ * 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 org.teiid.dqp.internal.transaction;
+
+import java.util.Random;
+
+import javax.transaction.xa.Xid;
+
+import com.google.inject.Singleton;
+import com.metamatrix.common.xa.MMXid;
+
+ at Singleton
+public class XidFactory {
+	Random r = new Random(System.currentTimeMillis());
+	public Xid createXid() {
+		
+		byte[] global = new byte[10];
+		byte[] branch = new byte[10];
+		r.nextBytes(global);
+		r.nextBytes(branch);
+		
+		return new MMXid(78923, global, branch);
+	}
+}


Property changes on: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/transaction/XidFactory.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: branches/JCA/engine/src/main/resources/com/metamatrix/dqp/i18n.properties
===================================================================
--- branches/JCA/engine/src/main/resources/com/metamatrix/dqp/i18n.properties	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/main/resources/com/metamatrix/dqp/i18n.properties	2009-11-02 19:41:28 UTC (rev 1544)
@@ -33,11 +33,13 @@
 
 AtomicRequestID.Unable_to_create_ID_for_null_AtomicRequestMessage=Unable to create an ID for a null AtomicRequestMessage.
 AtomicRequestID.Unable_to_create_ID_for_AtomicRequestMessage_with_null_RequestID=Unable to create an ID for an AtomicRequestMessage with null RequestID.
+
+ConnectorManager.failed_to_lookup_connector=Failed to look up Connector instance {0}
+ConnectorManager.xa_capbility_not_supported=XA support by the Connector {0} is not possible when "SyncWorkers" is set to false 
 
 ConnectorManagerImpl.Initializing_connector=Initializing connector {0}
 ConnectorManagerImpl.Couldn__t_parse_property=Could not parse property: {0}
 Error_closing_client_connection=Error closing client connection in ConnectorManager
-failed_find_Connector_class=Could not find Connector class {0}
 failed_legacy=The specified connector class {0} is not an instance of a Teiid connector.  This may be due to an inappropriate classpath entry.  An attempt was also made to treat the class as a legacy MetaMatrix connector, however this was not successful either.
 failed_instantiate_Connector_class=Could not instantiate Connector class {0}
 failed_start_Connector=Could not start Connector {0}. {1}
@@ -63,6 +65,7 @@
 no_txn_manager=No Transaction Manger found in the configuration, Failed to start connector \"{0}\"
 Connector_State_not_active=Connector request state is not active for request {0} in Connector {1}
 Missing_required_property=Connector is missing required property {0} or wrong value supplied {1} 
+Cancel_failed=Request {0} failed to cancel.
 
 ConnectorWorker.Can__t_communicate_error_to_client=Can not not communicate error to client
 ConnectorWorker.Command_null=Command is null.

Modified: branches/JCA/engine/src/test/java/com/metamatrix/dqp/message/TestAtomicRequestMessage.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/dqp/message/TestAtomicRequestMessage.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/com/metamatrix/dqp/message/TestAtomicRequestMessage.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -24,13 +24,12 @@
 
 import java.util.Date;
 
+import junit.framework.TestCase;
+
 import org.teiid.dqp.internal.datamgr.language.TestQueryImpl;
 import org.teiid.dqp.internal.process.DQPWorkContext;
 
-import junit.framework.TestCase;
-
 import com.metamatrix.core.util.UnitTestUtil;
-import com.metamatrix.dqp.internal.datamgr.ConnectorID;
 import com.metamatrix.platform.security.api.MetaMatrixSessionID;
 import com.metamatrix.platform.security.api.SessionToken;
 
@@ -56,8 +55,7 @@
         message.setRequestID(new RequestID(5000L));
         
         //AtomicRequestMessage-specific stuff
-        message.setConnectorBindingID("connectorBindingID"); //$NON-NLS-1$
-        message.setConnectorID(new ConnectorID("10000")); //$NON-NLS-1$
+        message.setConnectorName("connectorBindingID"); //$NON-NLS-1$
         return message;
     }
 
@@ -71,8 +69,7 @@
         assertEquals(new RequestID(5000L), copy.getRequestID());
         assertEquals("2", copy.getWorkContext().getConnectionID()); //$NON-NLS-1$
         //AtomicRequestMessage-specific stuff
-        assertEquals("connectorBindingID", copy.getConnectorBindingID()); //$NON-NLS-1$
-        assertEquals(new ConnectorID("10000"), copy.getConnectorID()); //$NON-NLS-1$
+        assertEquals("connectorBindingID", copy.getConnectorName()); //$NON-NLS-1$
         assertEquals(1000, copy.getAtomicRequestID().getNodeID());
     }
 }

Modified: branches/JCA/engine/src/test/java/com/metamatrix/dqp/service/AutoGenDataService.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/dqp/service/AutoGenDataService.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/com/metamatrix/dqp/service/AutoGenDataService.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -28,22 +28,17 @@
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Properties;
 
 import org.teiid.connector.metadata.runtime.ConnectorMetadata;
 import org.teiid.dqp.internal.datamgr.impl.ConnectorWorkItem;
-import org.teiid.dqp.internal.process.DQPWorkContext;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.common.application.exception.ApplicationLifecycleException;
 import com.metamatrix.common.comm.api.ResultsReceiver;
-import com.metamatrix.common.config.api.ConnectorBinding;
+import com.metamatrix.common.queue.WorkerPoolStats;
 import com.metamatrix.common.types.DataTypeManager;
-import com.metamatrix.dqp.internal.datamgr.ConnectorID;
 import com.metamatrix.dqp.message.AtomicRequestID;
 import com.metamatrix.dqp.message.AtomicRequestMessage;
 import com.metamatrix.dqp.message.AtomicResultsMessage;
-import com.metamatrix.dqp.message.RequestMessage;
 import com.metamatrix.query.optimizer.capabilities.BasicSourceCapabilities;
 import com.metamatrix.query.optimizer.capabilities.SourceCapabilities;
 import com.metamatrix.query.sql.symbol.SingleElementSymbol;
@@ -77,15 +72,9 @@
         return this.rows;
     }
 
-    /* 
-     * @see com.metamatrix.dqp.service.DataService#selectConnector(java.lang.String)
-     */
-    public ConnectorID selectConnector(String connectorBindingID) {
-        return null;
-    }
-    
+    @Override
 	public void executeRequest(AtomicRequestMessage request,
-			ConnectorID connector,
+			String connector,
 			ResultsReceiver<AtomicResultsMessage> resultListener)
 			throws MetaMatrixComponentException {
         List projectedSymbols = (request.getCommand()).getProjectedSymbols();               
@@ -164,94 +153,41 @@
         }
     }
 
-	public SourceCapabilities getCapabilities(RequestMessage request,
-			DQPWorkContext dqpWorkContext, ConnectorID connector)
+    @Override
+	public SourceCapabilities getCapabilities(String connector)
 			throws MetaMatrixComponentException {
         return caps;
     }
-        
-    /** 
-     * @see com.metamatrix.dqp.service.DataService#startConnectorBinding(java.lang.String)
-     * @since 4.3
-     */
-    public void startConnectorBinding(String connectorBindingName) throws ApplicationLifecycleException,
-                                                                  MetaMatrixComponentException {
-    }
 
-    /** 
-     * @see com.metamatrix.dqp.service.DataService#stopConnectorBinding(java.lang.String)
-     * @since 4.3
-     */
-    public void stopConnectorBinding(String connectorBindingName) throws ApplicationLifecycleException,
-                                                                 MetaMatrixComponentException {
-    }
 
-    /** 
-     * @see com.metamatrix.dqp.service.DataService#getConnectorBindings()
-     * @since 4.3
-     */
-    public List getConnectorBindings() throws MetaMatrixComponentException {
-        return null;
-    }
-
-    /** 
-     * @see com.metamatrix.dqp.service.DataService#getConnectorBindingState(java.lang.String)
-     * @since 4.3
-     */
-    public ConnectorStatus getConnectorBindingState(String connectorBindingName) throws MetaMatrixComponentException {
-        return null;
-    }
-
-    /** 
-     * @see com.metamatrix.dqp.service.DataService#getConnectorBinding(java.lang.String)
-     * @since 4.3
-     */
-    public ConnectorBinding getConnectorBinding(String connectorBindingName) throws MetaMatrixComponentException {
-        return null;
-    }
-
-    /** 
-     * @see com.metamatrix.dqp.service.DataService#getConnectorBindingStatistics(java.lang.String)
-     * @since 4.3
-     */
-    public Collection getConnectorBindingStatistics(String connectorBindingName) throws MetaMatrixComponentException {
-        return null;
-    }
-    
-    /** 
-     * @see com.metamatrix.dqp.service.DataService#getConnectionPoolStatistics(java.lang.String)
-     * @since 6.1
-     */
-    public Collection getConnectionPoolStatistics(String connectorBindingName) throws MetaMatrixComponentException {
-    	return null;
-    } 
-
-    /** 
-     * @see com.metamatrix.dqp.service.DataService#clearConnectorBindingCache(java.lang.String)
-     * @since 4.3
-     */
+    @Override
     public void clearConnectorBindingCache(String connectorBindingName) throws MetaMatrixComponentException {
     }
-
-	public void cancelRequest(AtomicRequestID request, ConnectorID connectorId)
+    @Override
+	public void cancelRequest(AtomicRequestID request, String connectorId)
 			throws MetaMatrixComponentException {
 		
 	}
-
-	public void closeRequest(AtomicRequestID request, ConnectorID connectorId)
+    @Override
+	public void closeRequest(AtomicRequestID request, String connectorId)
 			throws MetaMatrixComponentException {
 		
 	}
-
-	public void requestBatch(AtomicRequestID request, ConnectorID connectorId)
+    @Override
+	public void requestBatch(AtomicRequestID request, String connectorId)
 			throws MetaMatrixComponentException {
 		
 	}
 	
     @Override
-    public ConnectorMetadata getConnectorMetadata(String vdbName,
-    		String vdbVersion, String modelName, Properties importProperties) {
+    public ConnectorMetadata getConnectorMetadata(String vdbName, String vdbVersion, String modelName) {
     	throw new UnsupportedOperationException();
     }
 
+	@Override
+	public Collection<WorkerPoolStats> getConnectorStatistics(
+			String deployedConnectorName) throws MetaMatrixComponentException {
+		return null;
+	}
+
 }

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/FakeConnector.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/FakeConnector.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/FakeConnector.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -25,7 +25,7 @@
 import java.util.Arrays;
 import java.util.List;
 
-import javax.transaction.xa.XAResource;
+import junit.framework.Assert;
 
 import org.teiid.connector.api.Connection;
 import org.teiid.connector.api.ConnectorCapabilities;
@@ -43,14 +43,9 @@
 import org.teiid.connector.language.ICommand;
 import org.teiid.connector.language.IQueryCommand;
 import org.teiid.connector.metadata.runtime.RuntimeMetadata;
-import org.teiid.connector.xa.api.TransactionContext;
-import org.teiid.connector.xa.api.XAConnection;
-import org.teiid.connector.xa.api.XAConnector;
 
-import junit.framework.Assert;
 
-
-public class FakeConnector extends BasicConnector implements XAConnector {
+public class FakeConnector extends BasicConnector {
 	private static final int RESULT_SIZE = 5;
 	
 	private boolean executeBlocks;
@@ -63,6 +58,8 @@
     private int connectionCount;
     private int executionCount;
     
+    private ConnectorEnvironment env;
+    
     public int getConnectionCount() {
 		return connectionCount;
 	}
@@ -71,24 +68,20 @@
 		return executionCount;
 	}
     
-    @Override
-    public Connection getConnection(org.teiid.connector.api.ExecutionContext context) throws ConnectorException {
-        return new FakeConnection();
+    public ConnectorEnvironment getConnectorEnvironment() {
+    	return this.env;
     }
-    @Override
-    public void start(ConnectorEnvironment environment)
-    		throws ConnectorException {
-    	
+    
+    public void setConnectorEnvironment(ConnectorEnvironment env) {
+    	this.env = env;
     }
+    
     @Override
-    public void stop() {}
-    @Override
-	public XAConnection getXAConnection(ExecutionContext executionContext,
-			TransactionContext transactionContext) throws ConnectorException {
-		return new FakeConnection();
-	}
+    public Connection getConnection() throws ConnectorException {
+        return new FakeConnection();
+    }
 	
-    private class FakeConnection extends BasicConnection implements XAConnection {
+    private class FakeConnection extends BasicConnection {
     	
     	public FakeConnection() {
 			connectionCount++;
@@ -106,10 +99,6 @@
             Assert.assertFalse("The connection should not be released more than once", released); //$NON-NLS-1$
             released = true;
         }
-		@Override
-		public XAResource getXAResource() throws ConnectorException {
-			return null;
-		}
     }   
     
     private final class FakeBlockingExecution extends BasicExecution implements ResultSetExecution, UpdateExecution {

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/FakeExecutionContextImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/FakeExecutionContextImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/FakeExecutionContextImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -39,8 +39,6 @@
 	public FakeExecutionContextImpl(int unique) {
 		super("VDB" + unique, //$NON-NLS-1$
 				"Version" + unique, //$NON-NLS-1$
-				"User" + unique, //$NON-NLS-1$ 
-				"Payload" + unique, //$NON-NLS-1$
 				"ExecutionPayload" + unique, //$NON-NLS-1$            
 				"ConnectionID" + unique, //$NON-NLS-1$
 				"ConnectorID" + unique, //$NON-NLS-1$
@@ -50,8 +48,7 @@
 	}
 
 	public FakeExecutionContextImpl(ExecutionContext c) {
-		super(c.getVirtualDatabaseName(), c.getVirtualDatabaseVersion(), c
-				.getUser(), c.getTrustedPayload(), c.getExecutionPayload(), c
+		super(c.getVirtualDatabaseName(), c.getVirtualDatabaseVersion(), c.getExecutionPayload(), c
 				.getConnectionIdentifier(), c.getConnectorIdentifier(), c
 				.getRequestIdentifier(), c.getPartIdentifier(), c
 				.getExecutionCountIdentifier());

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/FakeTransactionService.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/FakeTransactionService.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/FakeTransactionService.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -24,6 +24,7 @@
 
 import org.teiid.dqp.internal.transaction.TransactionProvider;
 import org.teiid.dqp.internal.transaction.TransactionServerImpl;
+import org.teiid.dqp.internal.transaction.XidFactory;
 
 import com.metamatrix.core.util.SimpleMock;
 
@@ -31,6 +32,7 @@
 
 	public FakeTransactionService() {
 		this.setTransactionProvider(SimpleMock.createSimpleMock(TransactionProvider.class));
+		this.setXidFactory(new XidFactory());
 	}
 	
 }

Added: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/FakeWorkManager.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/FakeWorkManager.java	                        (rev 0)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/FakeWorkManager.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,51 @@
+package org.teiid.dqp.internal.datamgr.impl;
+
+import java.util.concurrent.SynchronousQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+import javax.resource.spi.work.ExecutionContext;
+import javax.resource.spi.work.Work;
+import javax.resource.spi.work.WorkException;
+import javax.resource.spi.work.WorkListener;
+import javax.resource.spi.work.WorkManager;
+
+public class FakeWorkManager implements WorkManager {
+	ThreadPoolExecutor pool = new ThreadPoolExecutor(1, 200, 2000, TimeUnit.MILLISECONDS, new SynchronousQueue<Runnable>());
+	
+	@Override
+	public void doWork(Work arg0) throws WorkException {
+		pool.execute(arg0);
+	}
+
+	@Override
+	public void doWork(Work arg0, long arg1, ExecutionContext arg2,
+			WorkListener arg3) throws WorkException {
+		pool.execute(arg0);
+	}
+
+	@Override
+	public void scheduleWork(Work arg0) throws WorkException {
+		pool.execute(arg0);
+	}
+
+	@Override
+	public void scheduleWork(Work arg0, long arg1, ExecutionContext arg2,
+			WorkListener arg3) throws WorkException {
+		pool.execute(arg0);
+	}
+
+	@Override
+	public long startWork(Work arg0) throws WorkException {
+		pool.execute(arg0);
+		return 0;
+	}
+
+	@Override
+	public long startWork(Work arg0, long arg1, ExecutionContext arg2,
+			WorkListener arg3) throws WorkException {
+		pool.execute(arg0);
+		return 0;
+	}
+
+}


Property changes on: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/FakeWorkManager.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorManagerImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorManagerImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorManagerImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -26,75 +26,56 @@
  */
 package org.teiid.dqp.internal.datamgr.impl;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 
-import java.net.URL;
-import java.net.URLClassLoader;
 import java.util.Properties;
 import java.util.concurrent.TimeUnit;
 
 import org.junit.Test;
 import org.mockito.Mockito;
-import org.teiid.connector.api.Connection;
 import org.teiid.connector.api.Connector;
-import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.api.ConnectorIdentity;
-import org.teiid.connector.api.ConnectorPropertyNames;
-import org.teiid.connector.api.ExecutionContext;
+import org.teiid.connector.api.ConnectorEnvironment;
 import org.teiid.dqp.internal.cache.ResultSetCache;
 import org.teiid.dqp.internal.datamgr.impl.TestConnectorWorkItem.QueueResultsReceiver;
-import org.teiid.dqp.internal.pooling.connector.ConnectionPool;
-import org.teiid.dqp.internal.pooling.connector.FakeSourceConnectionFactory;
-import org.teiid.dqp.internal.process.DQPWorkContext;
 
 import com.metamatrix.cache.FakeCache;
 import com.metamatrix.common.application.ApplicationEnvironment;
-import com.metamatrix.common.application.exception.ApplicationLifecycleException;
 import com.metamatrix.dqp.message.AtomicRequestMessage;
 import com.metamatrix.dqp.message.AtomicResultsMessage;
-import com.metamatrix.dqp.service.ConnectorStatus;
-import com.metamatrix.dqp.service.DQPServiceNames;
 import com.metamatrix.dqp.service.FakeMetadataService;
-import com.metamatrix.query.optimizer.capabilities.SourceCapabilities;
-import com.metamatrix.query.optimizer.capabilities.SourceCapabilities.Capability;
 
 /**
  * JUnit test for TestConnectorManagerImpl
  */
 public final class TestConnectorManagerImpl {
-    private Properties helpGetAppProps() {
-        Properties appProperties = new Properties();
-
-        appProperties.setProperty(ConnectorPropertyNames.CONNECTOR_BINDING_NAME, "AFakeConnectorBinding"); //$NON-NLS-1$
-        appProperties.setProperty(ConnectorPropertyNames.MAX_RESULT_ROWS, "10"); //$NON-NLS-1$
-        appProperties.setProperty(ConnectorPropertyNames.CONNECTOR_CLASS, FakeConnector.class.getName());
-
-        return appProperties;
+   
+	private ConnectorEnvironment helpGetAppProps() {
+		ConnectorEnvironment env = Mockito.mock(ConnectorEnvironment.class);
+		Mockito.stub(env.getMaxResultRows()).toReturn(10);
+		return env;
     }
+	
+	static ConnectorManager getConnectorManager(ConnectorEnvironment env) throws Exception {
+		final FakeConnector c = new FakeConnector();
+		c.setConnectorEnvironment(env);		
+		ConnectorManager cm = new ConnectorManager("FakeConnector", new FakeWorkManager()) {
+			Connector getConnector() {
+				return c;
+			}
+		};
+		cm.setMetadataService(new FakeMetadataService());		
+		return cm;
+	}	
 
     // =========================================================================
     //                         T E S T   C A S E S
     // =========================================================================
 
-    @Test public void testStartFailsWithNullRequiredProp() throws Exception {
-        ConnectorManager cm = new ConnectorManager();
-        Properties appProperties = helpGetAppProps();
-        // Remove required property
-        appProperties.setProperty(ConnectorPropertyNames.CONNECTOR_CLASS, ""); //$NON-NLS-1$
-        
-        try {
-            startConnectorManager(cm, appProperties);
-    		cm.stop();
-            fail("Able to start ConnectorManager with null required props."); //$NON-NLS-1$
-        } catch (ApplicationLifecycleException e) {
-        	assertEquals("Connector is missing required property ConnectorClass or wrong value supplied AFakeConnectorBinding<null> ", e.getMessage()); //$NON-NLS-1$
-        } 
-    }
 
     @Test public void testReceive() throws Exception {
-    	ConnectorManager cm = new ConnectorManager();
-    	startConnectorManager(cm, helpGetAppProps());
-        
+    	ConnectorManager cm = getConnectorManager(helpGetAppProps());
+    	cm.start(Mockito.mock(ApplicationEnvironment.class));
         AtomicRequestMessage request = TestConnectorWorkItem.createNewAtomicRequestMessage(1, 1);
         QueueResultsReceiver receiver = new QueueResultsReceiver();
         cm.executeRequest(receiver, request);
@@ -102,75 +83,20 @@
         cm.stop();
     }
     
-    @Test public void testConnectorCapabilitiesOverride() throws Exception {
-    	ConnectorManager cm = new ConnectorManager();
-    	startConnectorManager(cm, helpGetAppProps());
+    
+    @Test public void testCaching() throws Exception {
+    	ConnectorManager cm = getConnectorManager(helpGetAppProps());
 
-    	AtomicRequestMessage request = TestConnectorWorkItem.createNewAtomicRequestMessage(1, 1);
-    	
-    	SourceCapabilities caps = cm.getCapabilities(request.getRequestID(), null, Mockito.mock(DQPWorkContext.class));
-    	assertFalse(caps.supportsCapability(Capability.CRITERIA_EXISTS));
-    	assertFalse(caps.supportsCapability(Capability.QUERY_EXCEPT));
+		Properties rsCacheProps = new Properties();
+    	rsCacheProps.setProperty(ResultSetCache.RS_CACHE_MAX_SIZE, "20"); 
+    	rsCacheProps.setProperty(ResultSetCache.RS_CACHE_MAX_AGE, "3600000"); 
+    	rsCacheProps.setProperty(ResultSetCache.RS_CACHE_SCOPE, "vdb"); 
 
-    	
-    	ConnectorManager cmnew = new ConnectorManager();
-    	Properties props = helpGetAppProps();
-    	props.setProperty("supportsExistsCriteria", "true"); //$NON-NLS-1$ //$NON-NLS-2$
-    	props.setProperty("supportsExcept", "true"); //$NON-NLS-1$ //$NON-NLS-2$
-    	startConnectorManager(cmnew, props);
+    	cm.rsCache = new ResultSetCache(rsCacheProps, new FakeCache.FakeCacheFactory());
+    	//cm.start(Mockito.mock(ApplicationEnvironment.class));
+    	cm.workItemFactory = new ConnectorWorkItemFactory(cm, cm.rsCache, true);
 
-    	SourceCapabilities capsnew = cmnew.getCapabilities(request.getRequestID(), null, Mockito.mock(DQPWorkContext.class));
-    	assertTrue(capsnew.supportsCapability(Capability.CRITERIA_EXISTS));
-    	assertTrue(capsnew.supportsCapability(Capability.QUERY_EXCEPT));
-    }
-
-	private void startConnectorManager(ConnectorManager cm, Properties props)
-			throws ApplicationLifecycleException {
-		cm.initialize(props);
-        ApplicationEnvironment env = new ApplicationEnvironment();
-        env.bindService(DQPServiceNames.METADATA_SERVICE, new FakeMetadataService());
-        env.bindService(DQPServiceNames.TRANSACTION_SERVICE, new FakeTransactionService());
-        cm.start(env);
-	}
-    
-    @Test public void testIsXA() throws Exception {
-    	ConnectorManager cm = new ConnectorManager();
-        Properties props = new Properties();
-        props.setProperty(ConnectorPropertyNames.CONNECTOR_CLASS, FakeConnector.class.getName());
-        props.setProperty(ConnectorPropertyNames.IS_XA, Boolean.TRUE.toString());
-        startConnectorManager(cm, props);
-        assertTrue(cm.isXa());
-        cm.stop();
-    }
-    
-    @Test public void testIsXA_Failure() throws Exception {
-        ConnectorManager cm = new ConnectorManager();
-        Properties props = new Properties();
-        props.setProperty(ConnectorPropertyNames.CONNECTOR_CLASS, FakeSourceConnectionFactory.class.getName());
-        props.setProperty(ConnectorPropertyNames.IS_XA, Boolean.TRUE.toString());
-        try {
-        	startConnectorManager(cm, props);
-        } catch (ApplicationLifecycleException e) {
-        	assertEquals("Connector \"Unknown_Binding_Name<null>\" was configured to support XA transactions, but the connector is not an XAConnector", e.getMessage()); //$NON-NLS-1$
-        }
-        cm.stop();
-    }
-    
-    @Test public void testCaching() throws Exception {
-    	ConnectorManager cm = new ConnectorManager() {
-    		@Override
-    		protected ResultSetCache createResultSetCache(Properties rsCacheProps) {
-    			assertEquals(String.valueOf(3600000), rsCacheProps.get(ResultSetCache.RS_CACHE_MAX_AGE));
-    			return new ResultSetCache(rsCacheProps, new FakeCache.FakeCacheFactory());
-    		}
-    	};
-        Properties props = new Properties();
-        props.setProperty(ConnectorPropertyNames.CONNECTOR_CLASS, FakeConnector.class.getName());
-        props.setProperty(ConnectorPropertyNames.USE_RESULTSET_CACHE, Boolean.TRUE.toString());
-        props.setProperty(ConnectionPool.SOURCE_CONNECTION_TEST_INTERVAL, String.valueOf(-1));
-        startConnectorManager(cm, props);
-        ConnectorWrapper wrapper = cm.getConnector();
-        FakeConnector fc = (FakeConnector)wrapper.getActualConnector();
+    	FakeConnector fc = (FakeConnector)cm.getConnector();
         assertEquals(0, fc.getConnectionCount());
         assertEquals(0, fc.getExecutionCount());
         AtomicRequestMessage request = TestConnectorWorkItem.createNewAtomicRequestMessage(1, 1);
@@ -200,88 +126,12 @@
     }
     
     @Test public void testDefect19049() throws Exception {
-        ConnectorManager cm = new ConnectorManager();
-        Properties props = new Properties();
-        final String connectorName = FakeConnector.class.getName();
-        props.setProperty(ConnectorPropertyNames.CONNECTOR_CLASS, connectorName);
-        URLClassLoader cl = new URLClassLoader(new URL[0]);
-        startConnectorManager(cm, props);
-        ((FakeConnector)cm.getConnector().getActualConnector()).setClassloader(cl);
+        ConnectorManager cm = getConnectorManager(helpGetAppProps());
+        cm.start(Mockito.mock(ApplicationEnvironment.class));
         AtomicRequestMessage request = TestConnectorWorkItem.createNewAtomicRequestMessage(1, 1);
         QueueResultsReceiver receiver = new QueueResultsReceiver();
         cm.executeRequest(receiver, request);
         assertNotNull(receiver.getResults().poll(1000, TimeUnit.MILLISECONDS));
         cm.stop();
     }
-
-    @Test public void testConnectorStatus() throws Exception {
-    	ConnectorManager cm = new ConnectorManager();
-    	assertEquals(ConnectorStatus.NOT_INITIALIZED, cm.getStatus());
-    	
-    	Properties props = new Properties();
-    	Connector mockConnector = Mockito.mock(Connector.class);
-    	Connection mockConnection = Mockito.mock(Connection.class);
-    	
-    	Mockito.stub(mockConnector.getConnection((ExecutionContext)Mockito.anyObject())).toReturn(mockConnection);        
-    	
-        final String connectorName = mockConnector.getClass().getName();
-        props.setProperty(ConnectorPropertyNames.CONNECTOR_CLASS, connectorName);
-        startConnectorManager(cm, props);
-        cm.setConnector(new ConnectorWrapper(mockConnector)); // to make them same connector
-
-        // no identity can be defined
-        assertEquals(ConnectorStatus.UNABLE_TO_CHECK, cm.getStatus());
-    }
-    
-    @Test public void testConnectorStatus_alive() throws Exception {
-    	ConnectorManager cm = new ConnectorManager();
-    	assertEquals(ConnectorStatus.NOT_INITIALIZED, cm.getStatus());
-    	
-    	Connector mockConnector = Mockito.mock(Connector.class);
-    	Connection mockConnection = Mockito.mock(Connection.class);
-    	ConnectorIdentity mockIdentity = Mockito.mock(ConnectorIdentity.class);
-    	
-    	Mockito.stub(mockConnector.getConnection((ExecutionContext)Mockito.anyObject())).toReturn(mockConnection);        
-        Mockito.stub(mockConnector.createIdentity(null)).toReturn(mockIdentity);
-        Mockito.stub(mockConnection.isAlive()).toReturn(true);
-    	
-        ConnectorWrapper wrapper = new ConnectorWrapper(mockConnector);
-        
-        wrapper.updateStatus();
-        assertEquals(ConnectorStatus.OPEN, wrapper.getStatus());
-    }
-    
-    @Test public void testConnectorStatus_unavailable() throws Exception {
-    	ConnectorManager cm = new ConnectorManager();
-    	assertEquals(ConnectorStatus.NOT_INITIALIZED, cm.getStatus());
-    	
-    	Connector mockConnector = Mockito.mock(Connector.class);
-    	Connection mockConnection = Mockito.mock(Connection.class);
-    	ConnectorIdentity mockIdentity = Mockito.mock(ConnectorIdentity.class);
-    	
-    	Mockito.stub(mockConnector.getConnection((ExecutionContext)Mockito.anyObject())).toReturn(mockConnection);        
-        Mockito.stub(mockConnector.createIdentity(null)).toReturn(mockIdentity);
-        Mockito.stub(mockConnection.isAlive()).toReturn(false);
-    	
-        ConnectorWrapper wrapper = new ConnectorWrapper(mockConnector);
-        
-        wrapper.updateStatus();
-        assertEquals(ConnectorStatus.DATA_SOURCE_UNAVAILABLE, wrapper.getStatus());
-    }    
-    
-    @Test public void testConnectorStatus_exception() throws Exception {
-    	ConnectorManager cm = new ConnectorManager();
-    	assertEquals(ConnectorStatus.NOT_INITIALIZED, cm.getStatus());
-    	
-    	Connector mockConnector = Mockito.mock(Connector.class);
-    	ConnectorIdentity mockIdentity = Mockito.mock(ConnectorIdentity.class);
-    	
-    	Mockito.stub(mockConnector.getConnection((ExecutionContext)Mockito.anyObject())).toThrow(new ConnectorException());        
-        Mockito.stub(mockConnector.createIdentity(null)).toReturn(mockIdentity);
-    	
-        ConnectorWrapper wrapper = new ConnectorWrapper(mockConnector);
-        
-        wrapper.updateStatus();
-        assertEquals(ConnectorStatus.DATA_SOURCE_UNAVAILABLE, wrapper.getStatus());
-    }     
 }
\ No newline at end of file

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorStateManager.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorStateManager.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorStateManager.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -31,14 +31,12 @@
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 
-import org.mockito.Mockito;
-import org.teiid.dqp.internal.datamgr.impl.ConnectorManager;
-import org.teiid.dqp.internal.datamgr.impl.ConnectorWorkItem;
-import org.teiid.dqp.internal.datamgr.impl.ConnectorWrapper;
-
 import junit.framework.TestCase;
 
-import com.metamatrix.common.queue.WorkerPool;
+import org.mockito.Mockito;
+import org.teiid.connector.api.ConnectorEnvironment;
+import org.teiid.dqp.internal.datamgr.impl.TestConnectorWorkItem.QueueResultsReceiver;
+
 import com.metamatrix.dqp.client.ResultsFuture;
 import com.metamatrix.dqp.message.AtomicRequestID;
 import com.metamatrix.dqp.message.AtomicRequestMessage;
@@ -63,19 +61,18 @@
     protected void setUp() throws Exception {
         super.setUp();
         request = TestConnectorWorkItem.createNewAtomicRequestMessage(1, 1);
-        csm = new ConnectorManager();
-        csm.setConnectorWorkerPool(Mockito.mock(WorkerPool.class));
-        csm.setConnector(new ConnectorWrapper(new FakeConnector()));
-        csm.setWorkItemFactory(new ConnectorWorkItemFactory(csm, null, true));
+        csm = TestConnectorManagerImpl.getConnectorManager(Mockito.mock(ConnectorEnvironment.class));
+        csm.workItemFactory = new ConnectorWorkItemFactory(csm, null, true);
     }
 
-    void helpAssureOneState() {
-    	csm.executeRequest(null, request);
+    void helpAssureOneState() throws Exception {
+    	QueueResultsReceiver receiver = new QueueResultsReceiver();
+    	csm.executeRequest(receiver, request);
     	ConnectorWorkItem state = csm.getState(request.getAtomicRequestID());
     	assertEquals(state, csm.getState(request.getAtomicRequestID()));
     }
 
-    public void testCreateAndAddRequestState() {
+    public void testCreateAndAddRequestState() throws Exception {
         helpAssureOneState();
         assertEquals("Expected size of 1", 1, csm.size()); //$NON-NLS-1$
     }
@@ -90,13 +87,13 @@
         }
     }
 
-    public void testRemoveRequestState() {
+    public void testRemoveRequestState() throws Exception {
         helpAssureOneState();
         csm.removeState(request.getAtomicRequestID());
         assertEquals("Expected size of 0", 0, csm.size()); //$NON-NLS-1$
     }
 
-    public void testRemoveUnknownRequestState() {
+    public void testRemoveUnknownRequestState() throws Exception {
         helpAssureOneState();
         csm.removeState(new AtomicRequestID(new RequestID("ZZZZ", 3210), 5, 5)); //$NON-NLS-1$
 

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorWorkItem.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorWorkItem.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestConnectorWorkItem.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -24,31 +24,29 @@
 
 import java.util.Arrays;
 import java.util.List;
-import java.util.Properties;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.TimeUnit;
 
-import javax.transaction.Transaction;
-
 import junit.framework.TestCase;
 
+import org.mockito.Mockito;
+import org.teiid.connector.api.Connector;
+import org.teiid.connector.api.ConnectorEnvironment;
 import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.api.ConnectorPropertyNames;
 import org.teiid.connector.api.ProcedureExecution;
 import org.teiid.connector.language.IProcedure;
-import org.teiid.connector.xa.api.TransactionContext;
 import org.teiid.dqp.internal.datamgr.language.LanguageBridgeFactory;
 import org.teiid.dqp.internal.process.DQPWorkContext;
 
 import com.metamatrix.common.comm.api.ResultsReceiver;
 import com.metamatrix.common.log.LogManager;
 import com.metamatrix.dqp.client.ResultsFuture;
-import com.metamatrix.dqp.internal.datamgr.ConnectorID;
 import com.metamatrix.dqp.message.AtomicRequestMessage;
 import com.metamatrix.dqp.message.AtomicResultsMessage;
 import com.metamatrix.dqp.message.RequestID;
 import com.metamatrix.dqp.message.RequestMessage;
 import com.metamatrix.dqp.service.FakeMetadataService;
+import com.metamatrix.dqp.service.TransactionContext;
 import com.metamatrix.dqp.util.LogConstants;
 import com.metamatrix.platform.security.api.MetaMatrixSessionID;
 import com.metamatrix.platform.security.api.SessionToken;
@@ -73,10 +71,15 @@
 		return command;
 	}
 
-	static ConnectorManager getConnectorManager() {
-		ConnectorManager cm = new ConnectorManager();
-		cm.setConnector(new ConnectorWrapper(new FakeConnector()));
-		cm.setTransactionService(new FakeTransactionService());
+	static ConnectorManager getConnectorManager(ConnectorEnvironment env) {
+		final FakeConnector c = new FakeConnector();
+		c.setConnectorEnvironment(env);
+		
+		ConnectorManager cm = new ConnectorManager("FakeConnector", new FakeWorkManager()) {
+			Connector getConnector() {
+				return c;
+			}			
+		};
 		cm.setMetadataService(new FakeMetadataService());
 		return cm;
 	}
@@ -91,7 +94,7 @@
 		request.setCommand(helpGetCommand(
 				"SELECT BQT1.SmallA.INTKEY FROM BQT1.SmallA", EXAMPLE_BQT)); //$NON-NLS-1$
 		request.setRequestID(new RequestID(requestid));
-		request.setConnectorID(new ConnectorID("testing")); //$NON-NLS-1$
+		request.setConnectorName("testing"); //$NON-NLS-1$
 		request.setFetchSize(5);
 		return request;
 	}
@@ -129,9 +132,7 @@
 		AtomicRequestMessage request = createNewAtomicRequestMessage(1, 1);
 		// only one response is expected
 		ResultsFuture<AtomicResultsMessage> resultsFuture = new ResultsFuture<AtomicResultsMessage>();
-		ConnectorWorkItem state = new SynchConnectorWorkItem(request,
-				getConnectorManager(), resultsFuture
-						.getResultsReceiver());
+		ConnectorWorkItem state = new SynchConnectorWorkItem(request,getConnectorManager(Mockito.mock(ConnectorEnvironment.class)), resultsFuture.getResultsReceiver());
 
 		state.asynchCancel(); // cancel does not cause close, but the next
 								// processing will close
@@ -169,8 +170,12 @@
 			switch (msgCount++) {
 			case 0:
 				// request more during delivery
-				((FakeConnector) manager.getConnector().getActualConnector()).setReturnsFinalBatch(true);
-				workItem.requestMore();
+				try {
+					((FakeConnector) manager.getConnector()).setReturnsFinalBatch(true);
+					workItem.requestMore();
+				} catch (ConnectorException e) {
+					exceptionOccurred(e);
+				}
 				break;
 			case 1:
 				if (results.isRequestClosed()) {
@@ -216,9 +221,8 @@
 
 	public void testMoreAsynch() throws Throwable {
 		AtomicRequestMessage request = createNewAtomicRequestMessage(1, 1);
-		final ConnectorManager manager = getConnectorManager();
-		AsynchMoreResultsReceiver receiver = new AsynchMoreResultsReceiver(
-				manager);
+		final ConnectorManager manager = getConnectorManager(Mockito.mock(ConnectorEnvironment.class));
+		AsynchMoreResultsReceiver receiver = new AsynchMoreResultsReceiver(manager);
 		ConnectorWorkItem state = new SynchConnectorWorkItem(request, manager,
 				receiver);
 		receiver.workItem = state;
@@ -232,7 +236,7 @@
 	
 	public void testSynchInterrupt() throws Exception {
 		AtomicRequestMessage request = createNewAtomicRequestMessage(1, 1);
-		final ConnectorManager manager = getConnectorManager();
+		final ConnectorManager manager = getConnectorManager(Mockito.mock(ConnectorEnvironment.class));
 		QueueResultsReceiver receiver = new QueueResultsReceiver();
 		ConnectorWorkItem state = new SynchConnectorWorkItem(request, manager, receiver);
 		Thread t = runRequest(state);
@@ -243,8 +247,8 @@
 
 	public void testImplicitClose() throws Exception {
 		AtomicRequestMessage request = createNewAtomicRequestMessage(1, 1);
-		ConnectorManager manager = getConnectorManager();
-		FakeConnector connector = (FakeConnector) manager.getConnector().getActualConnector();
+		ConnectorManager manager = getConnectorManager(Mockito.mock(ConnectorEnvironment.class));
+		FakeConnector connector = (FakeConnector) manager.getConnector();
 
 		connector.setReturnsFinalBatch(true);
 
@@ -258,8 +262,7 @@
 	public void testCloseBeforeNew() throws Exception {
 		AtomicRequestMessage request = createNewAtomicRequestMessage(1, 1);
 		ResultsFuture<AtomicResultsMessage> resultsFuture = new ResultsFuture<AtomicResultsMessage>();
-		ConnectorWorkItem state = new SynchConnectorWorkItem(request,
-				getConnectorManager(), resultsFuture.getResultsReceiver());
+		ConnectorWorkItem state = new SynchConnectorWorkItem(request,getConnectorManager(Mockito.mock(ConnectorEnvironment.class)), resultsFuture.getResultsReceiver());
 
 		state.requestClose();
 		assertFalse(resultsFuture.isDone());
@@ -273,8 +276,8 @@
 
 	public void testAsynchBasicMore() throws Exception {
 		AtomicRequestMessage request = createNewAtomicRequestMessage(1, 1);
-		ConnectorManager manager = getConnectorManager();
-		FakeConnector connector = (FakeConnector) manager.getConnector().getActualConnector();
+		ConnectorManager manager = getConnectorManager(Mockito.mock(ConnectorEnvironment.class));
+		FakeConnector connector = (FakeConnector) manager.getConnector();
 		QueueResultsReceiver resultsReceiver = new QueueResultsReceiver(); 
 		FakeQueuingAsynchConnectorWorkItem state = new FakeQueuingAsynchConnectorWorkItem(
 				request, manager, resultsReceiver);
@@ -295,8 +298,8 @@
 
 	public void testAsynchKeepAlive() throws Exception {
 		AtomicRequestMessage request = createNewAtomicRequestMessage(1, 1);
-		ConnectorManager manager = getConnectorManager();
-		FakeConnector connector = (FakeConnector) manager.getConnector().getActualConnector();
+		ConnectorManager manager = getConnectorManager(Mockito.mock(ConnectorEnvironment.class));
+		FakeConnector connector = (FakeConnector) manager.getConnector();
 		QueueResultsReceiver resultsReceiver = new QueueResultsReceiver();
 		FakeQueuingAsynchConnectorWorkItem state = new FakeQueuingAsynchConnectorWorkItem(
 				request, manager, resultsReceiver);
@@ -329,7 +332,7 @@
 		AtomicRequestMessage arm = createNewAtomicRequestMessage(1, 1);
 		arm.setCommand(command);
 		QueueResultsReceiver receiver = new QueueResultsReceiver();
-		SynchConnectorWorkItem synchConnectorWorkItem = new SynchConnectorWorkItem(arm, getConnectorManager(), receiver);
+		SynchConnectorWorkItem synchConnectorWorkItem = new SynchConnectorWorkItem(arm, getConnectorManager(Mockito.mock(ConnectorEnvironment.class)), receiver);
 		synchConnectorWorkItem.run();
 		if (receiver.exception != null) {
 			throw receiver.exception;
@@ -352,16 +355,10 @@
     	 *  3. command must NOT be a SELECT
     	 *  4. Then, set isImmutable to TRUE, we should SUCCEED
     	 */
-		ConnectorManager cm = getConnectorManager();
-        Properties props = new Properties();
+    	ConnectorEnvironment env = Mockito.mock(ConnectorEnvironment.class);
+    	Mockito.stub(env.isImmutable()).toReturn(true);
+		ConnectorManager cm = getConnectorManager(env);
 
-        // to create an XA ConnectorManager
-        props.setProperty(ConnectorPropertyNames.CONNECTOR_CLASS, FakeConnector.class.getName());
-
-        // to set IS_IMMUTABLE to true
-        props.setProperty(ConnectorPropertyNames.IS_IMMUTABLE, "true"); //$NON-NLS-1$ //$NON-NLS-2$
-		cm.initialize(props);
-        
 		// command must not be a SELECT
 		Command command = helpGetCommand("update bqt1.smalla set stringkey = 1 where stringkey = 2", EXAMPLE_BQT); //$NON-NLS-1$
 		AtomicRequestMessage requestMsg = createNewAtomicRequestMessage(1, 1);
@@ -369,26 +366,7 @@
 		
 		// To make the AtomicRequestMessage transactional, construct your own
 		requestMsg.setTransactionContext( new TransactionContext(){
-
 			@Override
-			public Transaction getTransaction() {
-				// TODO Auto-generated method stub
-				return null;
-			}
-
-			@Override
-			public Scope getTransactionType() {
-				// TODO Auto-generated method stub
-				return null;
-			}
-
-			@Override
-			public String getTxnID() {
-				// TODO Auto-generated method stub
-				return null;
-			}
-
-			@Override
 			public boolean isInTransaction() {
 				// TODO Auto-generated method stub
 				return true;
@@ -415,15 +393,9 @@
     	 *  3. command must NOT be a SELECT
     	 *  4. Then, set isImmutable to FALSE, and we should FAIL
     	 */
-		ConnectorManager cm = getConnectorManager();
-        Properties props = new Properties();
-
-        // to create an XA ConnectorManager
-        props.setProperty(ConnectorPropertyNames.CONNECTOR_CLASS, FakeConnector.class.getName());
-
-        // to set IS_IMMUTABLE to false
-        props.setProperty(ConnectorPropertyNames.IS_IMMUTABLE, "false"); //$NON-NLS-1$ //$NON-NLS-2$
-		cm.initialize(props);
+    	ConnectorEnvironment env = Mockito.mock(ConnectorEnvironment.class);
+    	Mockito.stub(env.isImmutable()).toReturn(false);
+		ConnectorManager cm = getConnectorManager(env);
         
 		// command must not be a SELECT
 		Command command = helpGetCommand("update bqt1.smalla set stringkey = 1 where stringkey = 2", EXAMPLE_BQT); //$NON-NLS-1$
@@ -432,26 +404,7 @@
 		
 		// To make the AtomicRequestMessage transactional, construct your own
 		requestMsg.setTransactionContext( new TransactionContext(){
-
 			@Override
-			public Transaction getTransaction() {
-				// TODO Auto-generated method stub
-				return null;
-			}
-
-			@Override
-			public Scope getTransactionType() {
-				// TODO Auto-generated method stub
-				return null;
-			}
-
-			@Override
-			public String getTxnID() {
-				// TODO Auto-generated method stub
-				return null;
-			}
-
-			@Override
 			public boolean isInTransaction() {
 				// TODO Auto-generated method stub
 				return true;
@@ -463,7 +416,7 @@
 		// This is the test
 		try {
 			synchConnectorWorkItem.run();
-			this.assertNull("Connection should be null when IsImmutable is false", synchConnectorWorkItem.connection);  //$NON-NLS-1$ 
+			assertNull("Connection should be null when IsImmutable is false", synchConnectorWorkItem.connection);  //$NON-NLS-1$ 
 		} catch ( Exception e ) {
 			LogManager.logWarning(LogConstants.CTX_CONNECTOR, e.getMessage());			
 		}

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestExecutionContextImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestExecutionContextImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestExecutionContextImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -37,7 +37,7 @@
     }
 
     public ExecutionContextImpl createContext(String requestID, String partID) {
-        return new ExecutionContextImpl("vdb", "1", "user", null, null,   //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+        return new ExecutionContextImpl("vdb", "1", null,   //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
                                         "Connection", "Connector", requestID, partID, "0"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
     }
     

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestTypeFacilityImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestTypeFacilityImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/impl/TestTypeFacilityImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -24,7 +24,7 @@
 
 import java.sql.Clob;
 
-import org.teiid.dqp.internal.datamgr.impl.TypeFacilityImpl;
+import org.teiid.connector.basic.TypeFacilityImpl;
 
 import junit.framework.TestCase;
 

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestAggregateImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestAggregateImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestAggregateImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -23,8 +23,8 @@
 package org.teiid.dqp.internal.datamgr.language;
 
 import org.teiid.connector.language.IAggregate;
-import org.teiid.dqp.internal.datamgr.language.AggregateImpl;
-import org.teiid.dqp.internal.datamgr.language.LiteralImpl;
+import org.teiid.connector.language.impl.AggregateImpl;
+import org.teiid.connector.language.impl.LiteralImpl;
 
 import com.metamatrix.common.types.DataTypeManager;
 import com.metamatrix.query.sql.ReservedWords;

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestBatchedUpdatesImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestBatchedUpdatesImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestBatchedUpdatesImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -28,7 +28,7 @@
 import org.teiid.connector.language.IDelete;
 import org.teiid.connector.language.IInsert;
 import org.teiid.connector.language.IUpdate;
-import org.teiid.dqp.internal.datamgr.language.BatchedUpdatesImpl;
+import org.teiid.connector.language.impl.BatchedUpdatesImpl;
 
 import junit.framework.TestCase;
 

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestCompareCriteriaImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestCompareCriteriaImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestCompareCriteriaImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -23,8 +23,8 @@
 package org.teiid.dqp.internal.datamgr.language;
 
 import org.teiid.connector.language.ICompareCriteria.Operator;
-import org.teiid.dqp.internal.datamgr.language.CompareCriteriaImpl;
-import org.teiid.dqp.internal.datamgr.language.LiteralImpl;
+import org.teiid.connector.language.impl.CompareCriteriaImpl;
+import org.teiid.connector.language.impl.LiteralImpl;
 
 import com.metamatrix.query.sql.lang.CompareCriteria;
 import com.metamatrix.query.sql.symbol.Constant;

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestCompoundCriteriaImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestCompoundCriteriaImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestCompoundCriteriaImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -26,7 +26,7 @@
 
 import org.teiid.connector.language.ICriteria;
 import org.teiid.connector.language.ICompoundCriteria.Operator;
-import org.teiid.dqp.internal.datamgr.language.CompoundCriteriaImpl;
+import org.teiid.connector.language.impl.CompoundCriteriaImpl;
 
 import com.metamatrix.query.sql.lang.CompareCriteria;
 import com.metamatrix.query.sql.lang.CompoundCriteria;

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestDeleteImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestDeleteImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestDeleteImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,7 +22,7 @@
 
 package org.teiid.dqp.internal.datamgr.language;
 
-import org.teiid.dqp.internal.datamgr.language.DeleteImpl;
+import org.teiid.connector.language.impl.DeleteImpl;
 
 import com.metamatrix.query.sql.lang.CompoundCriteria;
 import com.metamatrix.query.sql.lang.Delete;

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestElementImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestElementImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestElementImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -26,6 +26,8 @@
 
 import org.teiid.connector.language.IElement;
 import org.teiid.connector.language.IGroup;
+import org.teiid.connector.language.impl.ElementImpl;
+import org.teiid.connector.language.impl.GroupImpl;
 import org.teiid.connector.metadata.runtime.Element;
 
 import com.metamatrix.common.types.DataTypeManager;

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestExistsCriteriaImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestExistsCriteriaImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestExistsCriteriaImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,7 +22,7 @@
 
 package org.teiid.dqp.internal.datamgr.language;
 
-import org.teiid.dqp.internal.datamgr.language.ExistsCriteriaImpl;
+import org.teiid.connector.language.impl.ExistsCriteriaImpl;
 
 import com.metamatrix.query.sql.lang.ExistsCriteria;
 

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestFromImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestFromImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestFromImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -27,7 +27,7 @@
 import java.util.List;
 
 import org.teiid.connector.language.IFromItem;
-import org.teiid.dqp.internal.datamgr.language.FromImpl;
+import org.teiid.connector.language.impl.FromImpl;
 
 import com.metamatrix.query.sql.lang.From;
 import com.metamatrix.query.sql.lang.UnaryFromClause;

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestFunctionImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestFunctionImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestFunctionImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -25,7 +25,7 @@
 import java.util.List;
 
 import org.teiid.connector.language.IExpression;
-import org.teiid.dqp.internal.datamgr.language.FunctionImpl;
+import org.teiid.connector.language.impl.FunctionImpl;
 
 import com.metamatrix.query.sql.symbol.Constant;
 import com.metamatrix.query.sql.symbol.Expression;

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestGroupByImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestGroupByImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestGroupByImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -27,7 +27,7 @@
 import java.util.List;
 
 import org.teiid.connector.language.IElement;
-import org.teiid.dqp.internal.datamgr.language.GroupByImpl;
+import org.teiid.connector.language.impl.GroupByImpl;
 
 import com.metamatrix.query.sql.lang.GroupBy;
 import com.metamatrix.query.sql.symbol.ElementSymbol;

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestGroupImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestGroupImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestGroupImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,7 +22,7 @@
 
 package org.teiid.dqp.internal.datamgr.language;
 
-import org.teiid.dqp.internal.datamgr.language.GroupImpl;
+import org.teiid.connector.language.impl.GroupImpl;
 
 import junit.framework.TestCase;
 

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestInCriteriaImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestInCriteriaImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestInCriteriaImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -28,7 +28,7 @@
 
 import org.teiid.connector.language.IExpression;
 import org.teiid.connector.language.ILiteral;
-import org.teiid.dqp.internal.datamgr.language.InCriteriaImpl;
+import org.teiid.connector.language.impl.InCriteriaImpl;
 
 import com.metamatrix.query.sql.lang.SetCriteria;
 

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestInlineViewImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestInlineViewImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestInlineViewImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,7 +22,7 @@
 
 package org.teiid.dqp.internal.datamgr.language;
 
-import org.teiid.dqp.internal.datamgr.language.InlineViewImpl;
+import org.teiid.connector.language.impl.InlineViewImpl;
 
 import com.metamatrix.query.sql.lang.SubqueryFromClause;
 

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestInsertImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestInsertImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestInsertImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -28,7 +28,7 @@
 import org.teiid.connector.language.IElement;
 import org.teiid.connector.language.IExpression;
 import org.teiid.connector.language.IInsertExpressionValueSource;
-import org.teiid.dqp.internal.datamgr.language.InsertImpl;
+import org.teiid.connector.language.impl.InsertImpl;
 
 import com.metamatrix.query.sql.lang.Insert;
 import com.metamatrix.query.sql.symbol.GroupSymbol;

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestIsNullCriteriaImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestIsNullCriteriaImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestIsNullCriteriaImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,7 +22,7 @@
 
 package org.teiid.dqp.internal.datamgr.language;
 
-import org.teiid.dqp.internal.datamgr.language.IsNullCriteriaImpl;
+import org.teiid.connector.language.impl.IsNullCriteriaImpl;
 
 import com.metamatrix.query.sql.lang.IsNullCriteria;
 

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestJoinImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestJoinImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestJoinImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -26,7 +26,7 @@
 import java.util.Iterator;
 
 import org.teiid.connector.language.ICriteria;
-import org.teiid.dqp.internal.datamgr.language.JoinImpl;
+import org.teiid.connector.language.impl.JoinImpl;
 
 import com.metamatrix.query.sql.lang.CompareCriteria;
 import com.metamatrix.query.sql.lang.JoinPredicate;

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestLikeCriteriaImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestLikeCriteriaImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestLikeCriteriaImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -23,7 +23,7 @@
 package org.teiid.dqp.internal.datamgr.language;
 
 import org.teiid.connector.language.ILiteral;
-import org.teiid.dqp.internal.datamgr.language.LikeCriteriaImpl;
+import org.teiid.connector.language.impl.LikeCriteriaImpl;
 
 import com.metamatrix.query.sql.lang.MatchCriteria;
 import com.metamatrix.query.sql.symbol.Constant;

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestLiteralImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestLiteralImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestLiteralImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,7 +22,7 @@
 
 package org.teiid.dqp.internal.datamgr.language;
 
-import org.teiid.dqp.internal.datamgr.language.LiteralImpl;
+import org.teiid.connector.language.impl.LiteralImpl;
 
 import com.metamatrix.query.sql.symbol.Constant;
 

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestNotCriteriaImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestNotCriteriaImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestNotCriteriaImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,7 +22,7 @@
 
 package org.teiid.dqp.internal.datamgr.language;
 
-import org.teiid.dqp.internal.datamgr.language.NotCriteriaImpl;
+import org.teiid.connector.language.impl.NotCriteriaImpl;
 
 import com.metamatrix.query.sql.lang.CompareCriteria;
 import com.metamatrix.query.sql.lang.NotCriteria;

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestOrderByImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestOrderByImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestOrderByImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -27,7 +27,7 @@
 import java.util.List;
 
 import org.teiid.connector.language.IOrderByItem;
-import org.teiid.dqp.internal.datamgr.language.OrderByImpl;
+import org.teiid.connector.language.impl.OrderByImpl;
 
 import com.metamatrix.query.sql.lang.OrderBy;
 

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestParameterImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestParameterImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestParameterImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -25,8 +25,8 @@
 import java.sql.ResultSet;
 
 import org.teiid.connector.language.IParameter.Direction;
-import org.teiid.dqp.internal.datamgr.language.ParameterImpl;
-import org.teiid.dqp.internal.datamgr.language.ProcedureImpl;
+import org.teiid.connector.language.impl.ParameterImpl;
+import org.teiid.connector.language.impl.ProcedureImpl;
 
 
 import junit.framework.TestCase;

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestProcedureImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestProcedureImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestProcedureImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -26,7 +26,7 @@
 import java.util.Iterator;
 
 import org.teiid.connector.language.IParameter;
-import org.teiid.dqp.internal.datamgr.language.ProcedureImpl;
+import org.teiid.connector.language.impl.ProcedureImpl;
 
 import com.metamatrix.query.parser.QueryParser;
 import com.metamatrix.query.resolver.QueryResolver;

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestQueryImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestQueryImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestQueryImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,7 +22,7 @@
 
 package org.teiid.dqp.internal.datamgr.language;
 
-import org.teiid.dqp.internal.datamgr.language.QueryImpl;
+import org.teiid.connector.language.impl.QueryImpl;
 
 import com.metamatrix.core.util.EquivalenceUtil;
 import com.metamatrix.query.sql.lang.CompoundCriteria;

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestScalarSubqueryImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestScalarSubqueryImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestScalarSubqueryImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -24,7 +24,7 @@
 
 import org.teiid.connector.language.IQuery;
 import org.teiid.connector.language.ISelectSymbol;
-import org.teiid.dqp.internal.datamgr.language.ScalarSubqueryImpl;
+import org.teiid.connector.language.impl.ScalarSubqueryImpl;
 
 import junit.framework.TestCase;
 

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSearchedCaseExpressionImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSearchedCaseExpressionImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSearchedCaseExpressionImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -25,7 +25,7 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.teiid.dqp.internal.datamgr.language.SearchedCaseExpressionImpl;
+import org.teiid.connector.language.impl.SearchedCaseExpressionImpl;
 
 import com.metamatrix.query.sql.lang.CompareCriteria;
 import com.metamatrix.query.sql.symbol.Constant;

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSelectImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSelectImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSelectImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -27,7 +27,7 @@
 import java.util.List;
 
 import org.teiid.connector.language.ISelectSymbol;
-import org.teiid.dqp.internal.datamgr.language.SelectImpl;
+import org.teiid.connector.language.impl.SelectImpl;
 
 import com.metamatrix.query.sql.lang.Select;
 

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSelectSymbolImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSelectSymbolImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSelectSymbolImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -23,7 +23,7 @@
 package org.teiid.dqp.internal.datamgr.language;
 
 import org.teiid.connector.language.IExpression;
-import org.teiid.dqp.internal.datamgr.language.SelectSymbolImpl;
+import org.teiid.connector.language.impl.SelectSymbolImpl;
 
 import com.metamatrix.query.sql.symbol.*;
 

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSetQueryImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSetQueryImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSetQueryImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -31,15 +31,15 @@
 import org.teiid.connector.language.IQuery;
 import org.teiid.connector.language.ISelectSymbol;
 import org.teiid.connector.language.ISetQuery;
-import org.teiid.dqp.internal.datamgr.language.ElementImpl;
-import org.teiid.dqp.internal.datamgr.language.FromImpl;
-import org.teiid.dqp.internal.datamgr.language.GroupImpl;
-import org.teiid.dqp.internal.datamgr.language.OrderByImpl;
-import org.teiid.dqp.internal.datamgr.language.OrderByItemImpl;
-import org.teiid.dqp.internal.datamgr.language.QueryImpl;
-import org.teiid.dqp.internal.datamgr.language.SelectImpl;
-import org.teiid.dqp.internal.datamgr.language.SelectSymbolImpl;
-import org.teiid.dqp.internal.datamgr.language.SetQueryImpl;
+import org.teiid.connector.language.impl.ElementImpl;
+import org.teiid.connector.language.impl.FromImpl;
+import org.teiid.connector.language.impl.GroupImpl;
+import org.teiid.connector.language.impl.OrderByImpl;
+import org.teiid.connector.language.impl.OrderByItemImpl;
+import org.teiid.connector.language.impl.QueryImpl;
+import org.teiid.connector.language.impl.SelectImpl;
+import org.teiid.connector.language.impl.SelectSymbolImpl;
+import org.teiid.connector.language.impl.SetQueryImpl;
 
 import junit.framework.TestCase;
 

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSubqueryCompareCriteriaImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSubqueryCompareCriteriaImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSubqueryCompareCriteriaImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -24,7 +24,7 @@
 
 import org.teiid.connector.language.ICompareCriteria;
 import org.teiid.connector.language.ISubqueryCompareCriteria.Quantifier;
-import org.teiid.dqp.internal.datamgr.language.SubqueryCompareCriteriaImpl;
+import org.teiid.connector.language.impl.SubqueryCompareCriteriaImpl;
 
 import junit.framework.TestCase;
 

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSubqueryInCriteriaImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSubqueryInCriteriaImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSubqueryInCriteriaImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,7 +22,7 @@
 
 package org.teiid.dqp.internal.datamgr.language;
 
-import org.teiid.dqp.internal.datamgr.language.SubqueryInCriteriaImpl;
+import org.teiid.connector.language.impl.SubqueryInCriteriaImpl;
 
 import junit.framework.TestCase;
 

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestUpdateImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestUpdateImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestUpdateImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -24,7 +24,7 @@
 
 import java.util.List;
 
-import org.teiid.dqp.internal.datamgr.language.UpdateImpl;
+import org.teiid.connector.language.impl.UpdateImpl;
 
 import junit.framework.TestCase;
 

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TstLanguageBridgeFactory.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TstLanguageBridgeFactory.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TstLanguageBridgeFactory.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,7 +22,6 @@
 
 package org.teiid.dqp.internal.datamgr.language;
 
-import org.teiid.dqp.internal.datamgr.language.LanguageBridgeFactory;
 import org.teiid.dqp.internal.datamgr.metadata.RuntimeMetadataImpl;
 
 import com.metamatrix.query.unittest.FakeMetadataFacade;

Deleted: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/pooling/connector/FakeSourceConnectionFactory.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/pooling/connector/FakeSourceConnectionFactory.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/pooling/connector/FakeSourceConnectionFactory.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,102 +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 org.teiid.dqp.internal.pooling.connector;
-
-import org.teiid.connector.api.Connection;
-import org.teiid.connector.api.ConnectorCapabilities;
-import org.teiid.connector.api.ConnectorEnvironment;
-import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.api.Execution;
-import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.basic.BasicConnection;
-import org.teiid.connector.basic.BasicConnector;
-import org.teiid.connector.language.ICommand;
-import org.teiid.connector.metadata.runtime.RuntimeMetadata;
-
-/**
- */
-public class FakeSourceConnectionFactory extends BasicConnector {
-    static int connCnt;
-    
-    static boolean alive = true;
-    
-    class FakeSourceConnection extends BasicConnection {
-        int id;
-        
-        FakeSourceConnection(int id){
-            FakeSourceConnection.this.id = id;
-        }
-        
-        public boolean isAlive() {
-            return alive;
-        }
-        
-        public boolean equals(Object other){
-            return this.id == ((FakeSourceConnection)other).id;
-        }
-        
-        public String toString(){
-            return "Connection " + id; //$NON-NLS-1$
-        }
-
-		@Override
-		public Execution createExecution(ICommand command,
-				ExecutionContext executionContext, RuntimeMetadata metadata)
-				throws ConnectorException {
-			return null;
-		}
-
-		@Override
-		public ConnectorCapabilities getCapabilities() {
-			return null;
-		}
-
-		@Override
-		public void close() {
-			
-		}
-		
-    }
-
-	@Override
-	public Connection getConnection(ExecutionContext context)
-			throws ConnectorException {
-		return new FakeSourceConnection(connCnt++);
-	}
-
-	@Override
-	public void start(ConnectorEnvironment environment) throws ConnectorException {
-	}
-
-	@Override
-	public void stop() {
-	}
-	
-	@Override
-	public ConnectorCapabilities getCapabilities() {
-		return null;
-	}
-
-}

Deleted: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/pooling/connector/FakeUserIdentityConnectionFactory.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/pooling/connector/FakeUserIdentityConnectionFactory.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/pooling/connector/FakeUserIdentityConnectionFactory.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,47 +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 org.teiid.dqp.internal.pooling.connector;
-
-import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.api.ConnectorIdentity;
-import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.api.MappedUserIdentity;
-
-/**
- */
-public class FakeUserIdentityConnectionFactory extends FakeSourceConnectionFactory {
-
-    /* 
-     * @see com.metamatrix.data.pool.SourceConnectionFactory#createIdentity(com.metamatrix.data.SecurityContext)
-     */
-    public ConnectorIdentity createIdentity(ExecutionContext context) throws ConnectorException {
-        if (context == null) {
-        	return null;
-        }
-    	//use user name for now
-        return new MappedUserIdentity(context.getUser(), null, null);
-    }
-    
-}

Deleted: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/pooling/connector/TestConnectionPool.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/pooling/connector/TestConnectionPool.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/pooling/connector/TestConnectionPool.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,389 +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 org.teiid.dqp.internal.pooling.connector;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.teiid.connector.api.ConnectorEnvironment;
-import org.teiid.connector.api.ConnectorLogger;
-import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.api.MappedUserIdentity;
-import org.teiid.dqp.internal.datamgr.impl.ConnectorEnvironmentImpl;
-import org.teiid.dqp.internal.datamgr.impl.ConnectorWrapper;
-import org.teiid.dqp.internal.datamgr.impl.ExecutionContextImpl;
-
-import com.metamatrix.common.application.ApplicationEnvironment;
-import com.metamatrix.common.queue.WorkerPool;
-import com.metamatrix.common.queue.WorkerPoolFactory;
-
-
-public class TestConnectionPool {
-    private ConnectionPool userIDPool;
-    private ConnectionPool singleIDPool;
-    private static ArrayList<Exception> EXCEPTIONS = new ArrayList<Exception>();
-    private static WorkerPool pool = WorkerPoolFactory.newWorkerPool(TestConnectionPool.class.getSimpleName(), 1);
-    
-    @AfterClass public static void tearDownOnce() {
-    	pool.shutdownNow();
-    }
-    
-    @Before public void setUp() throws Exception{
-        FakeSourceConnectionFactory.alive = true;        
-        
-        singleIDPool = new ConnectionPool(new ConnectorWrapper(new FakeSourceConnectionFactory()));
-        userIDPool = new ConnectionPool(new ConnectorWrapper(new FakeUserIdentityConnectionFactory()));
-        
-        Properties poolProperties = new Properties();
-        poolProperties.put(ConnectionPool.MAX_CONNECTIONS, "10"); //$NON-NLS-1$ 
-        poolProperties.put(ConnectionPool.MAX_CONNECTIONS_FOR_EACH_ID, "5"); //$NON-NLS-1$ 
-        poolProperties.put(ConnectionPool.LIVE_AND_UNUSED_TIME, "1"); //$NON-NLS-1$
-        poolProperties.put(ConnectionPool.WAIT_FOR_SOURCE_TIME, "500"); //$NON-NLS-1$
-        poolProperties.put(ConnectionPool.CLEANING_INTERVAL, "1"); //$NON-NLS-1$
-        poolProperties.put(ConnectionPool.SOURCE_CONNECTION_TEST_INTERVAL, "-1"); //$NON-NLS-1$
-        ConnectorEnvironment env = createConnectorEnvironment(poolProperties);
-        singleIDPool.initialize(env);
-        userIDPool.initialize(env);
-    }
-
-	private ConnectorEnvironment createConnectorEnvironment(
-			Properties poolProperties) {
-		ConnectorEnvironment env = new ConnectorEnvironmentImpl(poolProperties, Mockito.mock(ConnectorLogger.class), new ApplicationEnvironment(), pool);
-		return env;
-	}
-    
-    public void tearDown() throws Exception{
-        singleIDPool.shutDown();
-        userIDPool.shutDown();
-    }
-        
-    public static ExecutionContext createContext(final String user, boolean userIdentity) {
-    	ExecutionContextImpl context = new ExecutionContextImpl(null, null, user, null, null, null, null, null, null, null);
-    	if (userIdentity) {
-    		context.setConnectorIdentity(new MappedUserIdentity(context.getUser(), null, null));
-    	}
-    	return context;
-    }
-    
-    //=== tests ===//
-    @Test public void testPoolUsingSingleIdentity() throws Exception {
-        ExecutionContext context = createContext("x", false);//$NON-NLS-1$
-
-        ConnectionWrapper conn1 = singleIDPool.obtain(context);
-        ConnectionWrapper conn2 = singleIDPool.obtain(context);
-        ConnectionWrapper conn3 = singleIDPool.obtain(context);
-        ConnectionWrapper conn4 = singleIDPool.obtain(context);   
-        
-        assertEquals(4, singleIDPool.getTotalCreatedConnectionCount());
-        assertEquals(4, singleIDPool.getTotalConnectionCount());
-        assertEquals(4, singleIDPool.getNumberOfConnectionsInUse());
-        assertEquals(0, singleIDPool.getNumberOfConnectinsWaiting());
-        assertEquals(0, singleIDPool.getTotalDestroyedConnectionCount());
-
-     
-
-        
-        singleIDPool.release(conn2, false);
-        singleIDPool.release(conn4, true);
-        
-        // only 1 has been closed/destroyed  #4
-        assertEquals(3, singleIDPool.getTotalConnectionCount());
-        assertEquals(1, singleIDPool.getTotalDestroyedConnectionCount());
-        assertEquals(1, singleIDPool.getNumberOfConnectinsWaiting());
-        assertEquals(4, singleIDPool.getTotalCreatedConnectionCount());
-        assertEquals(2, singleIDPool.getNumberOfConnectionsInUse());
-
-        
-        List unusedConns = singleIDPool.getUnusedConnections(conn1);
-        assertEquals(1, unusedConns.size());
-        assertTrue(unusedConns.contains(conn2));
-        List usedConns = singleIDPool.getUsedConnections(conn2);
-        assertEquals(2, usedConns.size());
-        assertTrue(usedConns.contains(conn1));
-        assertTrue(usedConns.contains(conn3));    
-        assertEquals(3, singleIDPool.getTotalConnectionCount());  
-    }
-
-    @Test public void testMaxConnectionTest() throws Exception {
-        ConnectionPool pool = new ConnectionPool(new ConnectorWrapper(new FakeSourceConnectionFactory()));
-        
-        Properties poolProperties = new Properties();
-        poolProperties.put(ConnectionPool.MAX_CONNECTIONS, "0"); //$NON-NLS-1$ 
-        poolProperties.put(ConnectionPool.MAX_CONNECTIONS_FOR_EACH_ID, "5"); //$NON-NLS-1$ 
-        poolProperties.put(ConnectionPool.LIVE_AND_UNUSED_TIME, "1"); //$NON-NLS-1$
-        poolProperties.put(ConnectionPool.WAIT_FOR_SOURCE_TIME, "500"); //$NON-NLS-1$
-        poolProperties.put(ConnectionPool.CLEANING_INTERVAL, "1"); //$NON-NLS-1$
-        poolProperties.put(ConnectionPool.SOURCE_CONNECTION_TEST_INTERVAL, "-1"); //$NON-NLS-1$
-        
-        try {
-            pool.initialize(createConnectorEnvironment(poolProperties));
-            fail("should have failed to use 0 as max connections"); //$NON-NLS-1$
-        }catch (ConnectionPoolException e) {
-            // pass
-        }
-    }
-    
-    @Test public void testMaxConnectionTest1() throws Exception {
-        ConnectionPool pool = new ConnectionPool(new ConnectorWrapper(new FakeSourceConnectionFactory()));
-        
-        Properties poolProperties = new Properties();
-        poolProperties.put(ConnectionPool.MAX_CONNECTIONS, "-1"); //$NON-NLS-1$ 
-        poolProperties.put(ConnectionPool.MAX_CONNECTIONS_FOR_EACH_ID, "5"); //$NON-NLS-1$ 
-        poolProperties.put(ConnectionPool.LIVE_AND_UNUSED_TIME, "1"); //$NON-NLS-1$
-        poolProperties.put(ConnectionPool.WAIT_FOR_SOURCE_TIME, "500"); //$NON-NLS-1$
-        poolProperties.put(ConnectionPool.CLEANING_INTERVAL, "1"); //$NON-NLS-1$
-        poolProperties.put(ConnectionPool.SOURCE_CONNECTION_TEST_INTERVAL, "-1"); //$NON-NLS-1$
-        
-        try {
-            pool.initialize(createConnectorEnvironment(poolProperties));
-            fail("should have failed to use 0 as max connections"); //$NON-NLS-1$
-        }catch (ConnectionPoolException e) {
-            // pass
-        }
-    }
-    
-    @Test public void testMaxConnectionTest2() throws Exception {
-        ConnectionPool pool = new ConnectionPool(new ConnectorWrapper(new FakeSourceConnectionFactory()));
-        
-        Properties poolProperties = new Properties();
-        poolProperties.put(ConnectionPool.MAX_CONNECTIONS, "10"); //$NON-NLS-1$ 
-        poolProperties.put(ConnectionPool.MAX_CONNECTIONS_FOR_EACH_ID, "0"); //$NON-NLS-1$ 
-        poolProperties.put(ConnectionPool.LIVE_AND_UNUSED_TIME, "1"); //$NON-NLS-1$
-        poolProperties.put(ConnectionPool.WAIT_FOR_SOURCE_TIME, "500"); //$NON-NLS-1$
-        poolProperties.put(ConnectionPool.CLEANING_INTERVAL, "1"); //$NON-NLS-1$
-        poolProperties.put(ConnectionPool.SOURCE_CONNECTION_TEST_INTERVAL, "-1"); //$NON-NLS-1$
-        
-        try {
-            pool.initialize(createConnectorEnvironment(poolProperties));
-            fail("should have failed to use 0 as max connections"); //$NON-NLS-1$
-        }catch (ConnectionPoolException e) {
-            // pass
-        }
-    }
-
-    @Test public void testMessageWhenPoolMaxedOutPerIdentity() throws Exception {
-        ExecutionContext context = createContext("x", false);//$NON-NLS-1$
-
-        // Max out the pool - 5 connections for same ID
-        for(int i=0; i<5; i++) {
-            singleIDPool.obtain(context);
-        }
-        
-        // Ask for one more - this should time out
-        try {
-            singleIDPool.obtain(context);
-            fail("No exception received when maxing out the pool"); //$NON-NLS-1$
-        } catch(ConnectionPoolException e) {
-            assertEquals("The connection pool for identity \"SingleIdentity\" is at the maximum connection count \"5\" and no connection became available in the timeout period.  Consider increasing the number of connections allowed per identity or the wait time.", e.getMessage()); //$NON-NLS-1$
-        }
-    }
-    
-    @Test public void testMessageWhenPoolTimedOut() throws Exception {
-        FakeSourceConnectionFactory.alive = true;        
-        
-        singleIDPool = new ConnectionPool(new ConnectorWrapper(new FakeSourceConnectionFactory()));
-        Properties poolProperties = new Properties();
-        poolProperties.put(ConnectionPool.MAX_CONNECTIONS, "1"); //$NON-NLS-1$
-        poolProperties.put(ConnectionPool.MAX_CONNECTIONS_FOR_EACH_ID, "1"); //$NON-NLS-1$
-        poolProperties.put(ConnectionPool.LIVE_AND_UNUSED_TIME, "1"); //$NON-NLS-1$
-        poolProperties.put(ConnectionPool.WAIT_FOR_SOURCE_TIME, "1"); //$NON-NLS-1$
-        poolProperties.put(ConnectionPool.CLEANING_INTERVAL, "1"); //$NON-NLS-1$
-        poolProperties.put(ConnectionPool.ENABLE_SHRINKING, Boolean.FALSE.toString());
-        poolProperties.put(ConnectionPool.SOURCE_CONNECTION_TEST_INTERVAL, "-1"); //$NON-NLS-1$
-        singleIDPool.initialize(createConnectorEnvironment(poolProperties));
-        
-        ExecutionContext context = createContext("x", false);//$NON-NLS-1$
-
-        singleIDPool.obtain(context);
-        
-        try {            
-            // Ask for a connection... should time out.
-            singleIDPool.obtain(context);
-            
-            fail("No exception received on pool timeout"); //$NON-NLS-1$           
-        } catch (ConnectionPoolException e) {
-            assertEquals("The connection pool for identity \"SingleIdentity\" exceeded wait time for connection, \"1\" ms, and no connection became available in the timeout period.  Consider increasing the number of connections allowed per identity or the wait time.", e.getMessage()); //$NON-NLS-1$
-        }
-    }
-
-    @Test public void testPoolUsingUserIdentity() throws Exception {
-        ExecutionContext context1 = createContext("Jack", true); //$NON-NLS-1$
-        ExecutionContext context2 = createContext("Tom", true); //$NON-NLS-1$
-        userIDPool.obtain(context1);
-        ConnectionWrapper conn2 = userIDPool.obtain(context1);
-        ConnectionWrapper conn3 = userIDPool.obtain(context2);
-        ConnectionWrapper conn4 = userIDPool.obtain(context2);      
-        
-        assertEquals(4, userIDPool.getTotalCreatedConnectionCount());
-        assertEquals(4, userIDPool.getTotalConnectionCount());
-        assertEquals(4, userIDPool.getNumberOfConnectionsInUse());
-        assertEquals(0, userIDPool.getNumberOfConnectinsWaiting());
-        assertEquals(0, userIDPool.getTotalDestroyedConnectionCount());
-        
-        
-        
-        userIDPool.release(conn2, false);
-        userIDPool.release(conn4, true);
-        
-        // only 1 has been closed/destroyed  #4
-        assertEquals(3, userIDPool.getTotalConnectionCount());
-        assertEquals(1, userIDPool.getTotalDestroyedConnectionCount());
-        assertEquals(1, userIDPool.getNumberOfConnectinsWaiting());
-        assertEquals(4, userIDPool.getTotalCreatedConnectionCount());
-        assertEquals(2, userIDPool.getNumberOfConnectionsInUse());
-        
-        
-        List unusedConns = userIDPool.getUnusedConnections(conn2);
-        assertEquals(1, unusedConns.size());
-        assertTrue(unusedConns.contains(conn2));
-        List usedConns = userIDPool.getUsedConnections(conn3);
-        assertEquals(1, usedConns.size());
-        assertTrue(usedConns.contains(conn3));    
-        assertEquals(3, userIDPool.getTotalConnectionCount());        
-    }
-    
-    @Test public void testPoolCleanUp() throws Exception {
-        ExecutionContext context = createContext("x", false);       //$NON-NLS-1$ 
-
-        ConnectionWrapper conn1 = singleIDPool.obtain(context);
-        ConnectionWrapper conn2 = singleIDPool.obtain(context);
-        ConnectionWrapper conn3 = singleIDPool.obtain(context);
-        ConnectionWrapper conn4 = singleIDPool.obtain(context);         
-        singleIDPool.release(conn2, false);
-        singleIDPool.release(conn4, true);
-        
-        try {
-            Thread.sleep(3000);
-        } catch (InterruptedException e1) {
-        }
-        
-        List unusedConns = singleIDPool.getUnusedConnections(conn1);
-        assertEquals(0, unusedConns.size());
-        List usedConns = singleIDPool.getUsedConnections(conn1);
-        assertEquals(2, usedConns.size());
-        assertTrue(usedConns.contains(conn1));
-        assertTrue(usedConns.contains(conn3));   
-        assertEquals(2, singleIDPool.getTotalConnectionCount());           
-    }
-    
-    @Test public void testMultiThreading() throws Exception {
-    	EXCEPTIONS.clear();
-        int runnerNumber = 20;
-        int connPerRunner = 20;
-
-        LoadRunner runner[] = new LoadRunner[runnerNumber];
-        for(int i=0; i< runnerNumber; i++){
-            runner[i] = new LoadRunner(userIDPool, connPerRunner);
-        }
-        
-        for(int i=0; i< runnerNumber; i++){
-            runner[i].start();
-        }
-        
-        for(int i=0; i< runnerNumber; i++){
-            try {
-                runner[i].join();
-            } catch (InterruptedException e) {
-            }
-        }
-        
-        assertEquals(EXCEPTIONS.toString(), 0, EXCEPTIONS.size());
-        
-        ExecutionContext context1 = createContext("Jack", true); //$NON-NLS-1$
-        ExecutionContext context2 = createContext("Tom", true); //$NON-NLS-1$
-
-        //List unusedConns1 = pool.getUnusedConneections(id1);
-        List usedConns1 = userIDPool.getUsedConnections(userIDPool.obtain(context1));
-
-        assertEquals(1, usedConns1.size());
-        //List unusedConns2 = pool.getUnusedConneections(id2);
-        List usedConns2 = userIDPool.getUsedConnections(userIDPool.obtain(context2));
-        assertEquals(1, usedConns2.size()); 
-    }
-    
-    static class LoadRunner extends Thread {        
-    	ConnectionPool pool;
-        private int n;
-        
-        LoadRunner(ConnectionPool pool, int connPerRunner){
-            n = connPerRunner;
-            this.pool = pool;
-        }
-        
-        public void run(){
-            ExecutionContext context1 = createContext("Jack", true); //$NON-NLS-1$
-            ExecutionContext context2 = createContext("Tom", true); //$NON-NLS-1$
-            try {
-            	ConnectionWrapper conn = null;
-                
-                for(int i=0; i<n; i++) {
-                	if(Math.random() < .5) {
-                    	conn = pool.obtain(context1);
-                    } else {
-                        conn = pool.obtain(context2);
-                    }
-                    try {
-    					Thread.sleep(5);
-    				} catch (InterruptedException e) {
-    					//ignore
-    				}
-                    pool.release(conn, false);
-                }    
-            } catch (ConnectionPoolException e) {
-                TestConnectionPool.EXCEPTIONS.add(e);
-            }
-        }
-    }
-    
-    @Test public void testMaxWithUserPool() throws Exception {
-        userIDPool = new ConnectionPool(new ConnectorWrapper(new FakeUserIdentityConnectionFactory()));   
-        Properties poolProperties = new Properties();
-        poolProperties.put(ConnectionPool.MAX_CONNECTIONS, "1"); //$NON-NLS-1$
-        poolProperties.put(ConnectionPool.MAX_CONNECTIONS_FOR_EACH_ID, "1"); //$NON-NLS-1$
-        poolProperties.put(ConnectionPool.LIVE_AND_UNUSED_TIME, "1000"); //$NON-NLS-1$
-        poolProperties.put(ConnectionPool.WAIT_FOR_SOURCE_TIME, "1"); //$NON-NLS-1$
-        poolProperties.put(ConnectionPool.CLEANING_INTERVAL, "1000"); //$NON-NLS-1$
-        poolProperties.put(ConnectionPool.ENABLE_SHRINKING, "false"); //$NON-NLS-1$
-        poolProperties.put(ConnectionPool.SOURCE_CONNECTION_TEST_INTERVAL, "-1"); //$NON-NLS-1$
-        userIDPool.initialize(createConnectorEnvironment(poolProperties));
-        
-        ConnectionWrapper conn = userIDPool.obtain(createContext("x", true)); //$NON-NLS-1$
-        userIDPool.release(conn,false);
-
-        assertEquals(1, userIDPool.getTotalConnectionCount());
-        
-        userIDPool.obtain(createContext("y", true)); //$NON-NLS-1$
-
-        assertEquals(1, userIDPool.getTotalConnectionCount());
-    }
-        
-}

Deleted: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/pooling/connector/TestConnectionWrapper.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/pooling/connector/TestConnectionWrapper.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/pooling/connector/TestConnectionWrapper.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,54 +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 org.teiid.dqp.internal.pooling.connector;
-
-import junit.framework.TestCase;
-
-import org.mockito.Mockito;
-import org.teiid.connector.basic.BasicConnection;
-import org.teiid.dqp.internal.pooling.connector.ConnectionPool;
-import org.teiid.dqp.internal.pooling.connector.ConnectionWrapper;
-
-
-public class TestConnectionWrapper extends TestCase {
-
-	public void testIdleTime() throws Exception {
-		ConnectionWrapper wrapper = new ConnectionWrapper(Mockito.mock(BasicConnection.class), Mockito.mock(ConnectionPool.class), 1);
-		long time = wrapper.getTimeReturnedToPool();
-		Thread.sleep(5);
-		wrapper.close();
-		assertTrue(wrapper.getTimeReturnedToPool() - time > 0);
-	}
-	
-	public void testIsAliveTestInterval() throws Exception {
-		BasicConnection connection = Mockito.mock(BasicConnection.class);
-		Mockito.stub(connection.isAlive()).toReturn(Boolean.TRUE);
-		ConnectionWrapper wrapper = new ConnectionWrapper(connection, Mockito.mock(ConnectionPool.class), 1);
-		wrapper.setTestInterval(-1); //trigger an actual call.
-		for (int i = 0; i < 10; i++) {
-			wrapper.isAlive();
-			wrapper.setTestInterval(60000);
-		}
-		Mockito.verify(connection, Mockito.times(1)).isAlive();
-	}
-}

Deleted: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/pooling/connector/TestPerUserPool.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/pooling/connector/TestPerUserPool.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/pooling/connector/TestPerUserPool.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,141 +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 org.teiid.dqp.internal.pooling.connector;
-
-import java.io.Serializable;
-import java.util.Properties;
-
-import junit.framework.TestCase;
-
-import org.mockito.Mockito;
-import org.teiid.connector.api.Connection;
-import org.teiid.connector.api.Connector;
-import org.teiid.connector.api.ConnectorCapabilities;
-import org.teiid.connector.api.ConnectorEnvironment;
-import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.api.ConnectorLogger;
-import org.teiid.connector.api.ConnectorPropertyNames;
-import org.teiid.connector.api.CredentialMap;
-import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.api.MappedUserIdentity;
-import org.teiid.connector.basic.BasicConnector;
-import org.teiid.dqp.internal.datamgr.impl.ConnectorEnvironmentImpl;
-import org.teiid.dqp.internal.datamgr.impl.ExecutionContextImpl;
-
-import com.metamatrix.common.application.ApplicationEnvironment;
-
-/**
- */
-public class TestPerUserPool extends TestCase {
-	
-    public TestPerUserPool(String name) {
-        super(name);
-    }
-    
-    private Connector getTestConnector(ConnectorEnvironment env) throws ConnectorException {
-    	BasicConnector con = new BasicConnector() {
-
-			@Override
-			public ConnectorCapabilities getCapabilities() {
-				return null;
-			}
-
-			@Override
-			public Connection getConnection(ExecutionContext context)
-					throws ConnectorException {
-				assertTrue(context.getConnectorIdentity() instanceof MappedUserIdentity);
-				return null;
-			}
-
-			@Override
-			public void start(ConnectorEnvironment environment)
-					throws ConnectorException {
-				
-			}
-
-			@Override
-			public void stop() {
-				
-			}
-    		
-    	};
-    	con.setUseCredentialMap(true);
-    	con.setAdminConnectionsAllowed(false);
-    	con.setConnectorName("oracle system");
-    	con.start(env);
-    	return con;
-    }
-    
-    public void testWrongCredentials() throws Exception {
-        ConnectorEnvironment env = initConnectorEnvironment();
-        Connector factory = getTestConnector(env);
-        try {
-            ExecutionContext ctx = createSecurityContext("pw1", false, factory); //$NON-NLS-1$
-			factory.getConnection(ctx);
-			fail("expected failure"); //$NON-NLS-1$
-		} catch (ConnectorException e) {
-			assertEquals("Unable to extract credentials from command payload or trusted session payload for per-user connection.", e.getMessage()); //$NON-NLS-1$
-		}
-    }
-    
-    private ConnectorEnvironment initConnectorEnvironment() throws Exception {
-        final Properties connProps = new Properties();
-        connProps.put(ConnectorPropertyNames.CONNECTOR_BINDING_NAME, "oracle system"); //$NON-NLS-1$
-        return new ConnectorEnvironmentImpl(connProps, Mockito.mock(ConnectorLogger.class), new ApplicationEnvironment());
-    }
-    
-    private ExecutionContext createSecurityContext(String credentialsStr, boolean useMap, Connector factory) throws Exception {
-        Serializable credentials = credentialsStr;
-    	if (useMap) {
-    		credentials = CredentialMap.parseCredentials(credentialsStr);
-        }
-    	
-        // session payload
-        ExecutionContextImpl impl = new ExecutionContextImpl(null, null, null, credentials, null, null, null, null, null, null);
-        impl.setConnectorIdentity(factory.createIdentity(impl));
-        return impl;
-    }
-    
-    public void testCredentialMapInSessionPayload() throws Exception {
-        ConnectorEnvironment env = initConnectorEnvironment();
-        Connector factory = getTestConnector(env);
-        ExecutionContext ctx = createSecurityContext("(system=oracle system,user=bqt2,password=mm)", true, factory); //$NON-NLS-1$
-        factory.getConnection(ctx);
-    }
-    
-    public void testCredentialMapMissingSystem() throws Exception {
-        ConnectorEnvironment env = initConnectorEnvironment();
-        Connector factory = getTestConnector(env);
-
-        // Set system to "x" instead of "oracle system" which will cause no credentials to be found
-        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("Payload missing credentials for oracle system", e.getMessage()); //$NON-NLS-1$
-        }
-    }
-
-}

Deleted: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/pooling/connector/TestPooledConnector.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/pooling/connector/TestPooledConnector.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/pooling/connector/TestPooledConnector.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,70 +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 org.teiid.dqp.internal.pooling.connector;
-
-import static org.junit.Assert.*;
-
-import java.util.List;
-import java.util.Properties;
-
-import javax.transaction.Transaction;
-
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.teiid.connector.api.Connection;
-import org.teiid.connector.api.ConnectorLogger;
-import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.xa.api.TransactionContext;
-import org.teiid.connector.xa.api.XAConnector;
-import org.teiid.dqp.internal.datamgr.impl.ConnectorEnvironmentImpl;
-
-import com.metamatrix.admin.objects.MMConnectionPool;
-import com.metamatrix.common.application.ApplicationEnvironment;
-import com.metamatrix.dqp.service.TransactionService;
-
-public class TestPooledConnector {
-	
-	@Test public void testGetXAConnection() throws Exception {
-		XAConnector connector = Mockito.mock(XAConnector.class);
-		PooledConnector pc = new PooledConnector("foo", connector, Mockito.mock(TransactionService.class)); //$NON-NLS-1$
-		pc.start(new ConnectorEnvironmentImpl(new Properties(), Mockito.mock(ConnectorLogger.class), new ApplicationEnvironment()));
-		TransactionContext tc = Mockito.mock(TransactionContext.class);
-		Mockito.stub(tc.getTransaction()).toReturn(Mockito.mock(Transaction.class));
-		Mockito.stub(tc.getTxnID()).toReturn("1"); //$NON-NLS-1$
-		Connection conn = pc.getConnection(Mockito.mock(ExecutionContext.class), tc);
-		conn.close();
-		Connection conn1 = pc.getConnection(Mockito.mock(ExecutionContext.class), tc);
-		assertSame(conn, conn1);
-		
-		List<MMConnectionPool> stats = pc.getConnectionPoolStats();
-		assertEquals(2, stats.size());
-		assertEquals(1, stats.get(1).getConnectionsCreated());
-		conn1.close(); //this is still in a txn so it should still be in use
-		
-		stats = pc.getConnectionPoolStats();
-		assertEquals(1, stats.get(1).getConnectionsInuse());
-		
-		pc.stop();
-	}
-
-}

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -33,6 +33,7 @@
 import org.junit.Before;
 import org.junit.Test;
 import org.teiid.dqp.internal.datamgr.impl.FakeTransactionService;
+import org.teiid.dqp.internal.datamgr.impl.FakeWorkManager;
 import org.teiid.dqp.internal.process.DQPCore;
 import org.teiid.dqp.internal.process.DQPWorkContext;
 import org.teiid.dqp.internal.process.DQPCore.ConnectorCapabilitiesCache;
@@ -92,6 +93,7 @@
             }
         };
         core.start(new Properties());
+        core.setWorkManager(new FakeWorkManager());
     }
     
     @After public void tearDown() throws Exception {

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCoreRequestHandling.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCoreRequestHandling.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCoreRequestHandling.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -26,18 +26,10 @@
 import java.util.HashSet;
 import java.util.Set;
 
-import org.mockito.Mockito;
-import org.teiid.connector.xa.api.TransactionContext;
-import org.teiid.dqp.internal.process.DQPCore;
-import org.teiid.dqp.internal.process.DQPWorkContext;
-import org.teiid.dqp.internal.process.DataTierTupleSource;
-import org.teiid.dqp.internal.process.RequestWorkItem;
-
 import junit.framework.TestCase;
 
 import com.metamatrix.api.exception.MetaMatrixException;
 import com.metamatrix.dqp.exception.SourceWarning;
-import com.metamatrix.dqp.internal.datamgr.ConnectorID;
 import com.metamatrix.dqp.message.AtomicRequestMessage;
 import com.metamatrix.dqp.message.RequestID;
 import com.metamatrix.dqp.message.RequestMessage;
@@ -159,7 +151,7 @@
         RequestWorkItem workItem = addRequest(rm, r0, requestID, null, null);
         AtomicRequestMessage atomicReq = new AtomicRequestMessage(workItem.requestMsg, workItem.dqpWorkContext, 1);
 
-        DataTierTupleSource info = new DataTierTupleSource(null, atomicReq, null, new ConnectorID("connID"), workItem); //$NON-NLS-1$
+        DataTierTupleSource info = new DataTierTupleSource(null, atomicReq, null, "connID", workItem); //$NON-NLS-1$
         workItem.addConnectorRequest(atomicReq.getAtomicRequestID(), info);
         
         DataTierTupleSource arInfo = workItem.getConnectorRequest(atomicReq.getAtomicRequestID());
@@ -173,7 +165,7 @@
         RequestWorkItem workItem = addRequest(rm, r0, requestID, null, null);
         AtomicRequestMessage atomicReq = new AtomicRequestMessage(workItem.requestMsg, workItem.dqpWorkContext, 1);
 
-        DataTierTupleSource info = new DataTierTupleSource(null, atomicReq, null, new ConnectorID("connID"), workItem); //$NON-NLS-1$
+        DataTierTupleSource info = new DataTierTupleSource(null, atomicReq, null,"connID", workItem); //$NON-NLS-1$
         workItem.addConnectorRequest(atomicReq.getAtomicRequestID(), info);
         
         workItem.closeAtomicRequest(atomicReq.getAtomicRequestID());

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPWorkContext.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPWorkContext.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPWorkContext.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -43,7 +43,6 @@
 
 	public static DQPWorkContext example() {
 		DQPWorkContext message = new DQPWorkContext();
-		message.setTrustedPayload("myTrustedPayload"); //$NON-NLS-1$
 		message.setVdbName("vdbName"); //$NON-NLS-1$
 		message.setVdbVersion("vdbVersion"); //$NON-NLS-1$
 		message.setAppName("querybuilder"); //$NON-NLS-1$
@@ -55,7 +54,6 @@
 		DQPWorkContext copy = UnitTestUtil.helpSerialize(example());
 
 		assertEquals("5", copy.getConnectionID()); //$NON-NLS-1$
-		assertEquals("myTrustedPayload", copy.getTrustedPayload()); //$NON-NLS-1$
 		assertEquals("userName", copy.getUserName()); //$NON-NLS-1$
 		assertEquals("vdbName", copy.getVdbName()); //$NON-NLS-1$
 		assertEquals("vdbVersion", copy.getVdbVersion()); //$NON-NLS-1$

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -33,7 +33,6 @@
 
 import org.teiid.connector.metadata.runtime.ConnectorMetadata;
 
-import com.metamatrix.api.exception.ComponentNotFoundException;
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.MetaMatrixException;
 import com.metamatrix.common.application.ApplicationEnvironment;
@@ -43,14 +42,12 @@
 import com.metamatrix.common.buffer.BufferManager;
 import com.metamatrix.common.buffer.TupleBatch;
 import com.metamatrix.common.comm.api.ResultsReceiver;
-import com.metamatrix.common.config.api.ConnectorBinding;
-import com.metamatrix.dqp.internal.datamgr.ConnectorID;
+import com.metamatrix.common.queue.WorkerPoolStats;
 import com.metamatrix.dqp.message.AtomicRequestID;
 import com.metamatrix.dqp.message.AtomicRequestMessage;
 import com.metamatrix.dqp.message.AtomicResultsMessage;
 import com.metamatrix.dqp.message.RequestID;
 import com.metamatrix.dqp.message.RequestMessage;
-import com.metamatrix.dqp.service.ConnectorStatus;
 import com.metamatrix.dqp.service.DataService;
 import com.metamatrix.dqp.service.FakeBufferService;
 import com.metamatrix.dqp.service.FakeVDBService;
@@ -134,9 +131,9 @@
         
         request = new AtomicRequestMessage(original, workContext, nodeId);
         request.setCommand(command);
-        request.setConnectorID(new ConnectorID("FakeConnectorID")); //$NON-NLS-1$
+        request.setConnectorName("FakeConnectorID"); //$NON-NLS-1$
 
-        info = new DataTierTupleSource(command.getProjectedSymbols(), request, dtm, request.getConnectorID(), workItem);
+        info = new DataTierTupleSource(command.getProjectedSymbols(), request, dtm, request.getConnectorName(), workItem);
         workItem.addConnectorRequest(request.getAtomicRequestID(), info);
     }
     
@@ -343,8 +340,8 @@
         private FakeDataService(int failOnCallNumber) {
             this.failOnCall = failOnCallNumber;
         }
-		public void executeRequest(AtomicRequestMessage request,
-				ConnectorID connector,
+        @Override
+		public void executeRequest(AtomicRequestMessage request, String connector,
 				ResultsReceiver<AtomicResultsMessage> resultListener)
 				throws MetaMatrixComponentException {
             if (closed) {
@@ -356,39 +353,31 @@
             	resultListener.receiveResults(results);
             }
         }
-        public ConnectorID selectConnector(String connectorBindingID) {
-            if (connectorBindingID.equals("mmuuid:binding")) { //$NON-NLS-1$
-                return new ConnectorID("FakeConnectorID"); //$NON-NLS-1$
-            }
-            return null;
-        }
+
         public void initialize(Properties props) throws ApplicationInitializationException {}
         public void start(ApplicationEnvironment environment) throws ApplicationLifecycleException {}
         public void stop() throws ApplicationLifecycleException {}
-        public void startConnectorBinding(String connectorBindingName) throws ApplicationLifecycleException,ComponentNotFoundException {}
-        public void stopConnectorBinding(String connectorBindingName) throws ApplicationLifecycleException,ComponentNotFoundException {}
-        public List getConnectorBindings() throws ComponentNotFoundException {return null;}
-        public ConnectorStatus getConnectorBindingState(String connectorBindingName) throws MetaMatrixComponentException {return null;}
-        public ConnectorBinding getConnectorBinding(String connectorBindingName) throws MetaMatrixComponentException {return null;}
-        public Collection getConnectorBindingStatistics(String connectorBindingName) throws MetaMatrixComponentException {return null;}
-        public Collection getConnectionPoolStatistics(String connectorBindingName) throws MetaMatrixComponentException { return null; }
         
+        @Override
         public void clearConnectorBindingCache(String connectorBindingName) throws MetaMatrixComponentException {}
         
+        @Override
 		public void cancelRequest(AtomicRequestID request,
-				ConnectorID connectorId) throws MetaMatrixComponentException {
+				String connectorId) throws MetaMatrixComponentException {
 		}
+		@Override
 		public void closeRequest(AtomicRequestID request,
-				ConnectorID connectorId) throws MetaMatrixComponentException {
+				String connectorId) throws MetaMatrixComponentException {
 			closed = true;
 		}
-		public SourceCapabilities getCapabilities(RequestMessage request,
-				DQPWorkContext dqpWorkContext, ConnectorID connector)
+		@Override
+		public SourceCapabilities getCapabilities(String connector)
 				throws MetaMatrixComponentException {
 			return null;
 		}
+		@Override
 		public void requestBatch(AtomicRequestID request,
-				ConnectorID connectorId) throws MetaMatrixComponentException {
+				String connectorId) throws MetaMatrixComponentException {
             calls++;
             if (calls == failOnCall) {
                 throw new MetaMatrixComponentException("Force fail on executeRequest for call # " + calls); //$NON-NLS-1$
@@ -396,8 +385,14 @@
 		}
 	    @Override
 	    public ConnectorMetadata getConnectorMetadata(String vdbName,
-	    		String vdbVersion, String modelName, Properties importProperties) {
+	    		String vdbVersion, String modelName) {
 	    	throw new UnsupportedOperationException();
 	    }
+		@Override
+		public Collection<WorkerPoolStats> getConnectorStatistics(
+				String deployedConnectorName)
+				throws MetaMatrixComponentException {
+			return null;
+		}
     }
 }

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/capabilities/TestConnectorCapabilitiesFinder.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/capabilities/TestConnectorCapabilitiesFinder.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/capabilities/TestConnectorCapabilitiesFinder.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -29,7 +29,6 @@
 import org.mockito.Mockito;
 import org.teiid.dqp.internal.process.DQPWorkContext;
 
-import com.metamatrix.dqp.internal.datamgr.ConnectorID;
 import com.metamatrix.dqp.message.RequestMessage;
 import com.metamatrix.dqp.service.DataService;
 import com.metamatrix.dqp.service.VDBService;
@@ -64,11 +63,10 @@
         VDBService vdbService = Mockito.mock(VDBService.class); 
         Mockito.stub(vdbService.getConnectorBindingNames(vdbName, vdbVersion, modelName)).toReturn(Arrays.asList(modelName));
         DataService dataService = Mockito.mock(DataService.class);
-        ConnectorID id = new ConnectorID("foo"); //$NON-NLS-1$
-        Mockito.stub(dataService.selectConnector(modelName)).toReturn(id);
+        
         BasicSourceCapabilities basicSourceCapabilities = new BasicSourceCapabilities();
         basicSourceCapabilities.setFunctionSupport(functionName, true);
-        Mockito.stub(dataService.getCapabilities(request, workContext, id)).toReturn(basicSourceCapabilities);
+        Mockito.stub(dataService.getCapabilities(modelName)).toReturn(basicSourceCapabilities);
         
         ConnectorCapabilitiesFinder finder = new ConnectorCapabilitiesFinder(vdbService, dataService, request, workContext);
         

Deleted: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/transaction/TestTransactionContextImpl.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/transaction/TestTransactionContextImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/transaction/TestTransactionContextImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,96 +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 org.teiid.dqp.internal.transaction;
-
-import javax.transaction.HeuristicMixedException;
-import javax.transaction.HeuristicRollbackException;
-import javax.transaction.RollbackException;
-import javax.transaction.Synchronization;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import javax.transaction.xa.XAResource;
-
-import org.teiid.dqp.internal.transaction.TransactionContextImpl;
-
-import junit.framework.TestCase;
-
-import com.metamatrix.core.MetaMatrixRuntimeException;
-import com.metamatrix.core.util.UnitTestUtil;
-
-public class TestTransactionContextImpl extends TestCase {
-    
-    public void testSerialization() throws Exception {
-        TransactionContextImpl context = new TransactionContextImpl();
-        
-        UnitTestUtil.helpSerialize(context);
-        
-        context.setTransaction(new Transaction() {
-
-            public void commit() throws RollbackException,
-                                HeuristicMixedException,
-                                HeuristicRollbackException,
-                                SecurityException,
-                                IllegalStateException,
-                                SystemException {
-            }
-
-            public boolean delistResource(XAResource arg0,
-                                          int arg1) throws IllegalStateException,
-                                                   SystemException {
-                return false;
-            }
-
-            public boolean enlistResource(XAResource arg0) throws RollbackException,
-                                                          IllegalStateException,
-                                                          SystemException {
-                return false;
-            }
-
-            public int getStatus() throws SystemException {
-                return 0;
-            }
-
-            public void registerSynchronization(Synchronization arg0) throws RollbackException,
-                                                                     IllegalStateException,
-                                                                     SystemException {
-            }
-
-            public void rollback() throws IllegalStateException,
-                                  SystemException {
-            }
-
-            public void setRollbackOnly() throws IllegalStateException,
-                                         SystemException {
-            }
-            
-        }, "foo"); //$NON-NLS-1$
-        
-        try {
-            UnitTestUtil.helpSerialize(context);
-            fail("expected exception"); //$NON-NLS-1$
-        } catch (MetaMatrixRuntimeException e) {
-            
-        }
-    }
-
-}

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/transaction/TestTransactionServer.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/transaction/TestTransactionServer.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/transaction/TestTransactionServer.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -24,6 +24,7 @@
 
 import javax.transaction.xa.XAResource;
 
+import org.mockito.Mockito;
 import org.teiid.adminapi.Transaction;
 
 import junit.framework.TestCase;
@@ -52,6 +53,7 @@
     protected void setUp() throws Exception {
         server = new TransactionServerImpl();
         server.setTransactionProvider(SimpleMock.createSimpleMock(TransactionProvider.class)); 
+        server.setXidFactory(new XidFactory());
     }
 
     /**


Property changes on: branches/JCA/jboss-integration
___________________________________________________________________
Name: svn:ignore
   + .classpath

.project

.settings

target


Added: branches/JCA/jboss-integration/pom.xml
===================================================================
--- branches/JCA/jboss-integration/pom.xml	                        (rev 0)
+++ branches/JCA/jboss-integration/pom.xml	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,29 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <artifactId>teiid</artifactId>
+    <groupId>org.jboss.teiid</groupId>
+    <version>6.3.0-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.jboss.teiid</groupId>
+  <artifactId>jboss-integration</artifactId>
+  <name>teiid-jboss-integration</name>
+  <version>6.3.0-SNAPSHOT</version>
+  <description>JBoss specific integration layer for teiid</description>
+  
+  <dependencies>
+    <dependency>
+      <groupId>org.jboss.teiid</groupId>
+      <artifactId>teiid-client</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.teiid</groupId>
+      <artifactId>teiid-common-internal</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.teiid</groupId>
+      <artifactId>teiid-engine</artifactId>
+    </dependency>
+  </dependencies>
+  
+</project>
\ No newline at end of file


Property changes on: branches/JCA/jboss-integration/pom.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java
===================================================================
--- branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java	                        (rev 0)
+++ branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,657 @@
+/*
+ * 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.dqp.embedded.admin;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.teiid.adminapi.AdminComponentException;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminObject;
+import org.teiid.adminapi.AdminProcessingException;
+import org.teiid.adminapi.Cache;
+import org.teiid.adminapi.ExtensionModule;
+import org.teiid.adminapi.Session;
+import org.teiid.dqp.internal.process.DQPWorkContext;
+import org.teiid.dqp.internal.process.Util;
+
+import com.metamatrix.admin.objects.MMConnectorBinding;
+import com.metamatrix.admin.objects.MMConnectorType;
+import com.metamatrix.admin.objects.MMExtensionModule;
+import com.metamatrix.admin.objects.MMLogConfiguration;
+import com.metamatrix.admin.objects.MMModel;
+import com.metamatrix.admin.objects.MMPropertyDefinition;
+import com.metamatrix.admin.objects.MMRequest;
+import com.metamatrix.admin.objects.MMSession;
+import com.metamatrix.admin.objects.MMVDB;
+import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.api.exception.security.SessionServiceException;
+import com.metamatrix.common.application.exception.ApplicationLifecycleException;
+import com.metamatrix.common.config.api.ComponentType;
+import com.metamatrix.common.config.api.ComponentTypeDefn;
+import com.metamatrix.common.config.api.ConnectorBinding;
+import com.metamatrix.common.log.LogConfigurationImpl;
+import com.metamatrix.common.object.PropertyDefinition;
+import com.metamatrix.common.util.crypto.CryptoException;
+import com.metamatrix.common.util.crypto.CryptoUtil;
+import com.metamatrix.common.vdb.api.VDBArchive;
+import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
+import com.metamatrix.dqp.service.AuthorizationService;
+import com.metamatrix.dqp.service.ConfigurationService;
+import com.metamatrix.dqp.service.ConnectorStatus;
+import com.metamatrix.dqp.service.DQPServiceNames;
+import com.metamatrix.dqp.service.DataService;
+import com.metamatrix.dqp.service.TransactionService;
+import com.metamatrix.dqp.service.VDBService;
+import com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl;
+import com.metamatrix.platform.security.api.MetaMatrixSessionInfo;
+import com.metamatrix.platform.security.api.SessionToken;
+import com.metamatrix.platform.security.api.service.MembershipServiceInterface;
+import com.metamatrix.platform.security.api.service.SessionServiceInterface;
+import com.metamatrix.platform.util.ProductInfoConstants;
+import com.metamatrix.server.serverapi.RequestInfo;
+
+
+/** 
+ * @since 4.3
+ */
+abstract class BaseAdmin {
+    static final String DOT = "."; //$NON-NLS-1$
+    static final String STAR = "*"; //$NON-NLS-1$
+    static final String FILE_NAME_REGEX="\\w+\\.\\w+"; //$NON-NLS-1$
+    static final String MULTIPLE_WORDS_REGEX = "\\w+([\\s|-]*\\w)*"; //$NON-NLS-1$
+    static final String SINGLE_WORD_REGEX = "\\w+"; //$NON-NLS-1$    
+    static final String MULTIPLE_WORD_WILDCARD_REGEX = "\\w*((\\.)?\\s*\\w)*(\\*)?"; //$NON-NLS-1$
+    static final String SINGLE_WORD_WILDCARD_REGEX = "\\w*(\\*)?"; //$NON-NLS-1$
+    // This should find word.word.* or word.* kind of patterns (ugly, you can rewrite) 
+    static final String WORD_AND_DOT_WILDCARD_REGEX = "\\w+((\\.\\*)|(\\.\\w+)|(\\.\\w*\\*))*|\\w*(\\*){1}"; //$NON-NLS-1$
+    
+    static final String VDB_REGEX = "\\w*(\\*)?(\\.\\d+)?"; //$NON-NLS-1$
+    static final String NUMBER_DOT_REGEX = "\\d+((\\.\\*)|(\\.\\d+)|(\\.\\d*\\*))*|\\d*(\\*){1}"; //$NON-NLS-1$
+    static final String NUMBER_REGEX = "\\d*(\\*)?"; //$NON-NLS-1$
+        
+    static final String[] cacheTypes = {Cache.CODE_TABLE_CACHE, 
+        Cache.CONNECTOR_RESULT_SET_CACHE,
+        Cache.PREPARED_PLAN_CACHE,
+        Cache.QUERY_SERVICE_RESULT_SET_CACHE
+        };    
+    
+    private EmbeddedConnectionFactoryImpl manager = null; 
+    
+    BaseAdmin(EmbeddedConnectionFactoryImpl manager){
+        this.manager = manager;       
+    }
+            
+    protected AdminException accumulateSystemException(AdminException parent, Exception e) {
+        if (parent == null) {
+            return new AdminComponentException(e); 
+        }
+        parent.addChild(new AdminComponentException(e));
+        return parent;
+    }
+    
+    protected AdminException accumulateProcessingException(AdminException parent, Exception e) {
+        if (parent == null) {
+            return new AdminProcessingException(e); 
+        }
+        parent.addChild(new AdminProcessingException(e));
+        return parent;
+    }
+    
+    protected String prettyPrintBindingNames(List bindings) {
+        StringBuffer buffer = new StringBuffer();
+        for (Iterator iter = bindings.iterator(); iter.hasNext();) {
+            ConnectorBinding binding = (ConnectorBinding) iter.next();
+            buffer.append(binding.getDeployedName());
+            if (iter.hasNext()) {
+                buffer.append(", "); //$NON-NLS-1$
+            }
+        }
+        
+        return buffer.toString();
+    }
+    
+    /** 
+     * @return Returns the manager.
+     * @since 4.3
+     */
+    public EmbeddedConnectionFactoryImpl getManager() {
+        return this.manager;
+    }
+    
+    VDBService getVDBService() {
+        return (VDBService)getManager().findService(DQPServiceNames.VDB_SERVICE);            
+    }
+    
+    DataService getDataService() {
+        return (DataService)getManager().findService(DQPServiceNames.DATA_SERVICE);
+    }
+    
+    TransactionService getTransactionService() {
+    	return (TransactionService)getManager().findService(DQPServiceNames.TRANSACTION_SERVICE);
+    }
+
+    MembershipServiceInterface getMembershipService() {
+    	return (MembershipServiceInterface)getManager().findService(DQPServiceNames.MEMBERSHIP_SERVICE);
+    }
+    
+    AuthorizationService getAuthorizationService() {
+    	return (AuthorizationService)getManager().findService(DQPServiceNames.AUTHORIZATION_SERVICE);
+    }
+    
+    ConfigurationService getConfigurationService() {
+        return (ConfigurationService)getManager().findService(DQPServiceNames.CONFIGURATION_SERVICE);
+    }
+    
+    SessionServiceInterface getSessionService() {
+        return (SessionServiceInterface)getManager().findService(DQPServiceNames.SESSION_SERVICE);
+    }
+        
+    protected Object convertToAdminObjects(Object src) {
+        return convertToAdminObjects(src,null);
+    }
+    
+    protected Object convertToAdminObjects(Object src, Object parent) {
+        if (src == null) {
+            return src;
+        }
+        
+        if (src instanceof List) {
+            List modified = new ArrayList();
+            List list = (List)src;
+            for (final Iterator i = list.iterator(); i.hasNext();) {
+                final Object e = i.next();
+                Object converted = convertToAdminObject(e, parent);
+                modified.add(converted);
+            } 
+            return modified;
+        }
+        else if (src instanceof Collection) {
+            List modified = new ArrayList();
+            for (Iterator i = ((Collection)src).iterator(); i.hasNext();) {
+                final Object e = i.next();
+                Object converted = convertToAdminObject(e, parent);
+                modified.add(converted);
+            } 
+            return modified;
+        }
+        else if (src instanceof Object[] ) {
+            List modified = new ArrayList();
+            Object[] srcArray = (Object[])src;
+            for (int i = 0; i < srcArray.length; i++) {
+                final Object converted = convertToAdminObject(srcArray[i], parent);
+                modified.add(converted);                
+            }
+            return modified;
+        }
+        return convertToAdminObject(src, parent);
+    }    
+        
+    
+    private Object convertToAdminObject(Object src, Object parent) {
+        if (src != null && src instanceof com.metamatrix.common.config.api.ConnectorBinding) {
+            com.metamatrix.common.config.api.ConnectorBinding binding = (com.metamatrix.common.config.api.ConnectorBinding)src;
+            return convertConnectorType(binding, parent);
+        }
+        else if (src != null && src instanceof com.metamatrix.common.config.api.ConnectorBindingType) {
+            com.metamatrix.common.config.api.ConnectorBindingType type = (com.metamatrix.common.config.api.ConnectorBindingType)src;
+            return convertConnectorType(type, parent);
+        }
+        else if (src != null && src instanceof com.metamatrix.common.vdb.api.VDBDefn) {
+            com.metamatrix.common.vdb.api.VDBDefn vdb = (com.metamatrix.common.vdb.api.VDBDefn)src;
+            return convertVDB(vdb, parent);
+        }
+        else if (src != null && src instanceof VDBArchive) {
+        	VDBArchive vdb = (VDBArchive)src;
+            return convertVDB(vdb.getConfigurationDef(), parent);
+        }        
+        else if (src != null && src instanceof com.metamatrix.common.vdb.api.ModelInfo) {
+            com.metamatrix.common.vdb.api.ModelInfo model = (com.metamatrix.common.vdb.api.ModelInfo)src;
+            return convertModel(model, parent);
+        }
+        else if (src != null && src instanceof com.metamatrix.common.log.LogConfiguration) {
+            com.metamatrix.common.log.LogConfiguration config = (com.metamatrix.common.log.LogConfiguration)src;
+            return covertLogConfiguration(config);
+        }
+        else if (src != null && src instanceof com.metamatrix.server.serverapi.RequestInfo) {
+        	com.metamatrix.server.serverapi.RequestInfo request = (com.metamatrix.server.serverapi.RequestInfo)src;
+            return convertRequest(request);
+        }
+        else if (src != null && src instanceof com.metamatrix.common.queue.WorkerPoolStats) {
+            com.metamatrix.common.queue.WorkerPoolStats stats = (com.metamatrix.common.queue.WorkerPoolStats)src;
+            return Util.convertStats(stats, stats.getQueueName());
+        }
+        else if (src != null && src instanceof MetaMatrixSessionInfo) {
+        	MetaMatrixSessionInfo conn = (MetaMatrixSessionInfo)src;
+            return convertConnection(conn);
+        }
+        else if (src != null && src instanceof com.metamatrix.common.config.api.ExtensionModule) {
+            com.metamatrix.common.config.api.ExtensionModule extModule = (com.metamatrix.common.config.api.ExtensionModule)src;
+            return convertExtensionModule(extModule);
+        }         
+        else {
+        	if (src == null) {
+        		return null;
+        	}
+            throw new UnsupportedOperationException(DQPEmbeddedPlugin.Util.getString("UnSupported_object_conversion"));  //$NON-NLS-1$
+        }
+    }
+
+    Object convertToNativeObjects(Object src) {
+        if (src instanceof org.teiid.adminapi.LogConfiguration) {
+            org.teiid.adminapi.LogConfiguration config = (org.teiid.adminapi.LogConfiguration)src;
+            return covertToNativeLogConfiguration(config);
+        }
+        throw new UnsupportedOperationException(DQPEmbeddedPlugin.Util.getString("UnSupported_object_conversion"));  //$NON-NLS-1$            
+    }
+     
+    
+    private ExtensionModule convertExtensionModule(com.metamatrix.common.config.api.ExtensionModule src) {
+        MMExtensionModule module = new MMExtensionModule(new String[] {src.getFullName()}) ;
+        module.setDescription(src.getDescription());
+        module.setFileContents(src.getFileContents());
+        module.setModuleType(src.getModuleType());
+        return module;
+    }
+    
+    private Session convertConnection(MetaMatrixSessionInfo src) {
+        MMSession session = new MMSession(new String[] {src.getSessionID().toString()});
+        session.setVDBName(src.getProductInfo(ProductInfoConstants.VIRTUAL_DB));
+        session.setVDBVersion(src.getProductInfo(ProductInfoConstants.VDB_VERSION)); 
+        session.setApplicationName(src.getApplicationName());
+        session.setIPAddress(src.getClientIp());
+        session.setHostName(src.getClientHostname());
+        session.setUserName(src.getUserName());
+        session.setLastPingTime(src.getLastPingTime());
+        session.setCreated(new Date(src.getTimeCreated()));
+        return session;
+    }
+    
+    /**
+     * Convert LogConfiguration to Admin Object 
+     */
+    private org.teiid.adminapi.LogConfiguration covertLogConfiguration(final com.metamatrix.common.log.LogConfiguration src) {
+    	Map<String, Integer> contextMap = new HashMap<String, Integer>();
+    	for(String context:src.getContexts()) {
+    		contextMap.put(context, src.getLogLevel(context));
+    	}
+        return new MMLogConfiguration(contextMap);
+    }
+
+    /**
+     * Convert LogConfiguration to Admin Object 
+     */
+    private com.metamatrix.common.log.LogConfiguration covertToNativeLogConfiguration(final org.teiid.adminapi.LogConfiguration src) {
+    	Map<String, Integer> contextMap = new HashMap<String, Integer>();
+    	for(String context:src.getContexts()) {
+    		contextMap.put(context, src.getLogLevel(context));
+    	}
+    	return new LogConfigurationImpl(contextMap);
+    }
+
+    /** 
+     * @param binding
+     * @return
+     * @since 4.3
+     */
+    private org.teiid.adminapi.ConnectorBinding convertConnectorType(final com.metamatrix.common.config.api.ConnectorBinding src, final Object parent) {
+        MMConnectorBinding binding = new MMConnectorBinding(new String[] {src.getDeployedName()});
+        
+        binding.setConnectorTypeName(src.getComponentTypeID().getFullName());
+        binding.setCreated(src.getCreatedDate());
+        binding.setCreatedBy(src.getCreatedBy());
+        binding.setDescription(src.getDescription());
+        binding.setEnabled(src.isEnabled());
+        binding.setLastUpdated(src.getLastChangedDate());
+        binding.setLastUpdatedBy(src.getLastChangedBy());
+        binding.setProperties(src.getProperties());
+        binding.setRegistered(true);
+        binding.setRoutingUUID(src.getRoutingUUID());
+        binding.setServiceID(0); // TODO:
+        
+        // Binding state needs to be converted into pool state; until then we use
+        // binding state  as pool state.
+//        try {
+//        	ConnectorStatus status = getDataService().getConnectorBindingState(src.getDeployedName());
+//        	switch(status) {
+//        	case OPEN:
+//        		binding.setState(org.teiid.adminapi.ConnectorBinding.STATE_OPEN);
+//        		break;
+//        	case NOT_INITIALIZED:
+//        		binding.setState(org.teiid.adminapi.ConnectorBinding.STATE_NOT_INITIALIZED);
+//        		break;
+//        	case CLOSED:
+//        		binding.setState(org.teiid.adminapi.ConnectorBinding.STATE_CLOSED);
+//        		break;
+//        	case DATA_SOURCE_UNAVAILABLE:
+//        		binding.setState(org.teiid.adminapi.ConnectorBinding.STATE_DATA_SOURCE_UNAVAILABLE);
+//        		break;
+//        	case INIT_FAILED:
+//        		binding.setState(org.teiid.adminapi.ConnectorBinding.STATE_INIT_FAILED);
+//        		break;
+//        	case UNABLE_TO_CHECK:
+//        		binding.setState(org.teiid.adminapi.ConnectorBinding.STATE_FAILED_TO_CHECK);
+//        		break;
+//        	}        	
+//        }catch(MetaMatrixComponentException e) {
+//            binding.setState(org.teiid.adminapi.ConnectorBinding.STATE_NOT_DEPLOYED);            
+//        }
+        binding.setStateChangedTime(src.getLastChangedDate());
+        return binding;       
+    }
+
+    /** 
+     * @param type
+     * @return
+     * @since 4.3
+     */
+    private org.teiid.adminapi.ConnectorType convertConnectorType(final com.metamatrix.common.config.api.ConnectorBindingType src, final Object parent) {
+        MMConnectorType type = new MMConnectorType(new String[] {src.getName()});
+        type.setCreated(src.getCreatedDate());
+        type.setCreatedBy(src.getCreatedBy());
+        type.setEnabled(true);
+        type.setLastUpdated(src.getLastChangedDate());
+        type.setRegistered(true);
+        
+        return type;       
+    }
+
+    /** 
+     * @param vdb
+     * @return
+     * @since 4.3
+     */
+    private org.teiid.adminapi.VDB convertVDB(final com.metamatrix.common.vdb.api.VDBDefn src, final Object parent) {
+        
+        MMVDB vdb = new MMVDB(new String[] {src.getName(), src.getVersion()});
+        vdb.setCreated(src.getDateCreated());
+        vdb.setCreatedBy(src.getCreatedBy());
+        vdb.setEnabled(src.isActiveStatus());
+        vdb.setLastUpdated(src.getDateCreated());
+        vdb.setLastUpdatedBy(src.getCreatedBy());
+        vdb.setMaterializedViews(src.getMatertializationModel() != null);
+        vdb.setModels((Collection)convertToAdminObjects(src.getModels(), src));
+        vdb.setProperties(null);
+        vdb.setRegistered(true);
+        vdb.setStatus(src.getStatus());
+        vdb.setUID(0); // TODO: src.getUUID());
+        vdb.setVersionedBy(src.getCreatedBy());
+        vdb.setVersionedDate(src.getDateCreated());
+        vdb.setHasWSDL(src.hasWSDLDefined());
+        
+        return vdb;        
+    }
+    
+    private org.teiid.adminapi.Model convertModel(final com.metamatrix.common.vdb.api.ModelInfo src, final Object parent) {
+        final com.metamatrix.common.vdb.api.VDBDefn vdb = (com.metamatrix.common.vdb.api.VDBDefn)parent;
+        MMModel model = new MMModel(new String[] {src.getName()});
+        model.setCreated(vdb.getDateCreated());
+        model.setCreatedBy(vdb.getCreatedBy());
+        model.setEnabled(vdb.isActiveStatus());
+        model.setLastUpdated(vdb.getDateCreated());
+        model.setLastUpdatedBy(vdb.getCreatedBy());
+        model.setModelType(src.getModelTypeName());
+        model.setModelURI(src.getModelURI());
+        model.setMaterialization(src.isMaterialization());
+        model.setPhysical(src.isPhysical());
+        model.setRegistered(true);        
+        model.setSupportsMultiSourceBindings(src.isMultiSourceBindingEnabled());
+        model.setVisible(src.isVisible());
+        if (src.isPhysical()) {
+            List bindings = src.getConnectorBindingNames();
+            if (bindings != null && !bindings.isEmpty()) {
+                List names = new ArrayList();
+                for (int i=0; i<bindings.size();i++) {
+                    names.add(convertToAdminObject(vdb.getConnectorBindingByName((String)bindings.get(i)), parent));
+                }
+                model.setConnectorBindingNames(names);
+            }
+        }
+        return model;
+    }
+
+    private org.teiid.adminapi.Request convertRequest(final RequestInfo src) {
+        
+        String connId = src.getRequestID().getConnectionID();
+        
+        MMRequest request = null;
+        if (src.getConnectorBindingUUID() != null) {
+            request = new MMRequest(new String[] {connId, String.valueOf(src.getRequestID().getExecutionID()), String.valueOf(src.getNodeID()), String.valueOf(src.getExecutionID())}); 
+        }
+        else {
+            request = new MMRequest(new String[] {connId, String.valueOf(src.getRequestID().getExecutionID())}); 
+        }
+        
+        request.setSqlCommand(src.getCommand());
+        
+        request.setCreated(src.getProcessingTimestamp());
+        
+        if (src.getConnectorBindingUUID() != null) {
+            request.setSource(true);
+            request.setNodeID(String.valueOf(src.getNodeID()));
+        }
+        return request;
+    }
+    
+    /**
+     * Get the connection connection object for the given id. 
+     * @param identifier
+     * @return
+     * @since 4.3
+     */
+    MetaMatrixSessionInfo getClientConnection(String identifier) throws AdminException {
+        Collection<MetaMatrixSessionInfo> sessions = getClientConnections();
+        for (MetaMatrixSessionInfo info:sessions) {
+            if (info.getSessionID().toString().equals(identifier)) {
+                return info;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Get all the available connections 
+     * @return
+     * @throws AdminException
+     */
+    Collection<MetaMatrixSessionInfo> getClientConnections() throws AdminException {
+        try {
+			return getSessionService().getActiveSessions();
+		} catch (SessionServiceException e) {
+			// SessionServiceException not in the client known exception (in common-internal)
+			throw new AdminComponentException(e.getMessage(), e.getCause());
+		}
+    }
+
+    boolean matches(String regEx, String value) {
+        regEx = regEx.replaceAll(AdminObject.ESCAPED_WILDCARD, ".*"); //$NON-NLS-1$ 
+        regEx = regEx.replaceAll(AdminObject.ESCAPED_DELIMITER, ""); //$NON-NLS-1$ 
+        return value.matches(regEx);
+    }
+    
+    List matchedCollection(String identifier, List adminObjects) {
+        ArrayList matched = new ArrayList();
+        for (Iterator i = adminObjects.iterator(); i.hasNext();) {
+            AdminObject aObj = (AdminObject)i.next();
+            if (matches(identifier, aObj.getName()) || matches(identifier, aObj.getIdentifier())) {
+                matched.add(aObj);
+            }
+        }        
+        return matched;
+    }
+    
+    /**
+     * Get list of available connector bindings 
+     * @param identifier
+     */
+    Collection getConnectorBindings(String identifier) throws AdminException{
+//        try {
+//            List connectorBindings = getDataService().getConnectorBindings();
+//            connectorBindings = (List)convertToAdminObjects(connectorBindings);
+//            return matchedCollection(identifier, connectorBindings);
+//        } catch (MetaMatrixComponentException e) {
+//            throw new AdminComponentException(e);
+//        }
+    	return Collections.EMPTY_LIST;
+    }
+    
+    
+    /**
+     * Get list of available connector types 
+     * @param identifier
+     */
+    Collection getConnectorTypes(String identifier) throws AdminException{
+   
+        try {
+            List connectorTypes = getConfigurationService().getConnectorTypes();
+            connectorTypes = (List)convertToAdminObjects(connectorTypes);
+            return matchedCollection(identifier, connectorTypes);
+        } catch (MetaMatrixComponentException err) {
+            throw new AdminComponentException(err);
+        } 
+    }
+
+    boolean isMaskedProperty(String  propName, ComponentType type) {
+        if (type != null) {
+            ComponentTypeDefn typeDef = type.getComponentTypeDefinition(propName);
+            if (typeDef != null && typeDef.getPropertyDefinition().isMasked()) {
+                return true;
+            }
+        }
+        return false;
+    }
+    
+    /**
+     * Encrypt a string 
+     * @param value
+     * @return
+     * @throws AdminException
+     * @since 4.3
+     */
+    String encryptString(String value) throws AdminException {
+        try {
+            return CryptoUtil.stringEncrypt(value);
+        } catch (CryptoException e) {
+            throw new AdminComponentException(e);
+        }
+    }
+    
+    
+    
+    /**
+     * Convert a ComponentType and a set of properties into a Collection of 
+     * com.metamatrix.admin.api.objects.PropertyDefinition objects
+     * @param ctype
+     * @param properties
+     * @return
+     * @since 4.3
+     */
+    protected Collection convertPropertyDefinitions(ComponentType ctype, Properties properties) {
+        ArrayList results = new ArrayList();
+        for (Iterator iter = ctype.getComponentTypeDefinitions().iterator(); iter.hasNext(); ) {
+            ComponentTypeDefn cdefn = (ComponentTypeDefn) iter.next();
+            PropertyDefinition pdefn = cdefn.getPropertyDefinition();
+                        
+            MMPropertyDefinition result = new MMPropertyDefinition(new String[] {pdefn.getName()});
+            result.setAllowedValues(pdefn.getAllowedValues());
+            result.setDefaultValue(pdefn.getDefaultValue());
+            result.setDescription(pdefn.getShortDescription());
+            result.setDisplayName(pdefn.getDisplayName());
+            result.setExpert(pdefn.isExpert());
+            result.setMasked(pdefn.isMasked());
+            result.setModifiable(pdefn.isModifiable());
+            result.setPropertyType(pdefn.getPropertyType().getDisplayName());
+            result.setPropertyTypeClassName(pdefn.getPropertyType().getClassName());
+            result.setRequired(pdefn.isRequired());
+            result.setRequiresRestart(pdefn.getRequiresRestart());
+            
+            String value = properties.getProperty(pdefn.getName());
+            result.setValue(value);
+            
+            results.add(result);
+        }
+        
+        
+        return results;
+    }
+    
+    
+    /**
+     * Convert a set of properties into a Collection of 
+     * com.metamatrix.admin.api.objects.PropertyDefinition objects
+     *  
+     * @param ctype
+     * @param properties
+     * @return
+     * @since 4.3
+     */
+    protected Collection convertPropertyDefinitions(Properties properties) {
+        ArrayList results = new ArrayList();
+        for (Iterator iter = properties.keySet().iterator(); iter.hasNext(); ) {
+            String key = (String) iter.next();
+            String value = properties.getProperty(key);
+                        
+            MMPropertyDefinition result = new MMPropertyDefinition(new String[] {key});
+            result.setDisplayName(key);
+            result.setValue(value);
+            
+            results.add(result);
+        }
+        
+        
+        return results;
+    }
+    
+    protected SessionToken validateSession() {
+        return DQPWorkContext.getWorkContext().getSessionToken();
+    }
+    
+    protected void changeVDBStatus(String name, String version, int status)
+			throws AdminException {
+		try {
+
+			if (name == null || version == null || !name.matches(SINGLE_WORD_REGEX)) {
+				throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_vdb_name")); //$NON-NLS-1$
+			}
+
+			// Now change the VDB status it self
+			this.getVDBService().changeVDBStatus(name, version, status);
+
+			// If the VDB is modified and if its status changed to DELETED, then
+			// we can remove all the connector bindings associated with this VDB
+			// the above delete will also remove them
+		} catch (ApplicationLifecycleException e) {
+			throw new AdminComponentException(e);
+		} catch (MetaMatrixComponentException e) {
+			throw new AdminComponentException(e);
+		}
+	}    
+    
+}


Property changes on: branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java
===================================================================
--- branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java	                        (rev 0)
+++ branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,1063 @@
+/*
+ * 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.dqp.embedded.admin;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+import java.util.StringTokenizer;
+
+import org.teiid.adminapi.AdminComponentException;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminOptions;
+import org.teiid.adminapi.AdminProcessingException;
+import org.teiid.adminapi.ConfigurationAdmin;
+import org.teiid.adminapi.EmbeddedLogger;
+import org.teiid.adminapi.LogConfiguration;
+import org.teiid.adminapi.VDB;
+
+import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.common.application.exception.ApplicationLifecycleException;
+import com.metamatrix.common.config.api.ComponentType;
+import com.metamatrix.common.config.api.ComponentTypeDefn;
+import com.metamatrix.common.config.api.ComponentTypeID;
+import com.metamatrix.common.config.api.ConnectorArchive;
+import com.metamatrix.common.config.api.ConnectorBinding;
+import com.metamatrix.common.config.api.ConnectorBindingType;
+import com.metamatrix.common.config.api.ExtensionModule;
+import com.metamatrix.common.config.model.BasicConnectorArchive;
+import com.metamatrix.common.config.model.BasicExtensionModule;
+import com.metamatrix.common.log.LogManager;
+import com.metamatrix.common.util.crypto.CryptoException;
+import com.metamatrix.common.util.crypto.CryptoUtil;
+import com.metamatrix.common.vdb.api.VDBArchive;
+import com.metamatrix.common.vdb.api.VDBDefn;
+import com.metamatrix.core.vdb.VDBStatus;
+import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
+import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
+import com.metamatrix.dqp.embedded.configuration.ConnectorConfigurationReader;
+import com.metamatrix.dqp.embedded.configuration.ConnectorConfigurationWriter;
+import com.metamatrix.dqp.embedded.configuration.VDBConfigurationReader;
+import com.metamatrix.dqp.service.ConfigurationService;
+import com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl;
+
+
+/** 
+ * DQP implementation of the Config Admin API
+ * @since 4.3
+ */
+public class DQPConfigAdminImpl extends BaseAdmin implements ConfigurationAdmin {
+    
+    public DQPConfigAdminImpl(EmbeddedConnectionFactoryImpl manager) {
+        super(manager);
+    }
+
+    /** 
+     * @see org.teiid.adminapi.ConfigurationAdmin#setProperty(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
+     * @since 4.3
+     */
+    public void setConnectorBindingProperty(String deployedName, String propertyName, String propertyValue)
+        throws AdminException {
+
+//        try {
+//			ConnectorBinding binding = getConfigurationService().getConnectorBinding(deployedName);
+//			if (binding == null) {
+//				throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.cb_doesnot_exist", deployedName)); //$NON-NLS-1$
+//			}
+//			
+//			ComponentTypeID id = binding.getComponentTypeID();
+//			ConnectorBindingType type = getConfigurationService().getConnectorType(id.getName());
+//			
+//			boolean needsEncryption = isMaskedProperty(propertyName, type);
+//			if (needsEncryption) {
+//			    propertyValue = encryptString(propertyValue);
+//			}
+//			
+//			Properties p = new Properties();
+//			p.setProperty(propertyName, propertyValue);
+//			
+//			//update the configuration
+//			binding = ConnectorConfigurationReader.addConnectorBindingProperties(binding, p);
+//			getConfigurationService().updateConnectorBinding(binding);
+//		} catch (MetaMatrixComponentException e) {
+//			throw new AdminComponentException(e);
+//		}
+    }
+    
+    /** 
+     * @see org.teiid.adminapi.ConfigurationAdmin#addConnectorType(java.lang.String, char[])
+     * @since 4.3
+     */
+    public void addConnectorType(String deployName, char[] cdkFile) 
+        throws AdminException {
+//        try {
+//            if (deployName == null || !deployName.matches(MULTIPLE_WORDS_REGEX)) {
+//                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_ct_name")); //$NON-NLS-1$                
+//            }
+//            if (cdkFile == null || cdkFile.length == 0) {
+//                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_ct_source")); //$NON-NLS-1$
+//            }
+//            
+//            // This is only place we check the existence in admin. Generally the Admin is not the
+//            // guy to decide, if it can take in or not, it should be the service. I did not 
+//            // want add in the configuration service beacuse, it may need to allow this behavior 
+//            // in case we are updating.  
+//            if (getConfigurationService().getConnectorType(deployName) == null) {            
+//                ConnectorBindingType type = ConnectorConfigurationReader.loadConnectorType(cdkFile);            
+//                saveConnectorType(type);
+//            }
+//            else {
+//                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Connector_type_exists", deployName)); //$NON-NLS-1$
+//            }
+//        } catch (MetaMatrixComponentException e) {
+//        	throw new AdminComponentException(e);
+//		}            
+    }
+
+    /** 
+     * @see org.teiid.adminapi.ConfigurationAdmin#deleteConnectorType(java.lang.String)
+     * @since 4.3
+     */
+    public void deleteConnectorType(String deployName) 
+        throws AdminException {
+//        try {
+//            if (deployName == null || !deployName.matches(MULTIPLE_WORDS_REGEX)) {
+//                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_ct_name")); //$NON-NLS-1$                
+//            }            
+//            getConfigurationService().deleteConnectorType(deployName);
+//        } catch (MetaMatrixComponentException e) {
+//        	throw new AdminComponentException(e);
+//		}         
+    }
+
+    /** 
+     * @see org.teiid.adminapi.ConfigurationAdmin#addConnectorBinding(java.lang.String, java.lang.String, java.util.Properties, AdminOptions)
+     * @since 4.3
+     */
+    public org.teiid.adminapi.ConnectorBinding addConnectorBinding(String deployName, String type, Properties properties, AdminOptions options) 
+        throws AdminException {
+//        // if the options object is null treat as if it is IGNORE as default
+//        if (options == null) {
+//            options = new AdminOptions(AdminOptions.OnConflict.IGNORE);
+//        }
+//
+//        if (deployName == null || !deployName.matches(MULTIPLE_WORDS_REGEX)) {
+//            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_cb_name")); //$NON-NLS-1$                
+//        }
+//        
+//        if (type == null || !type.matches(MULTIPLE_WORDS_REGEX)) {
+//            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_ct_name")); //$NON-NLS-1$                
+//        }
+//                
+//        ConnectorBinding binding = null;
+//        try {
+//            // Check if the binding exists already, if does take action based on user
+//            // preferences in the admin options
+//            if (bindingExists(deployName)) {
+//                // Based on users preference, either add or replace or ignore 
+//                if (options.containsOption(AdminOptions.OnConflict.EXCEPTION)) {
+//                    throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.addBindingEixists", deployName)); //$NON-NLS-1$
+//                }
+//                else if (options.containsOption(AdminOptions.OnConflict.IGNORE)) {
+//                    binding = getDataService().getConnectorBinding(deployName);
+//                    return (org.teiid.adminapi.ConnectorBinding) convertToAdminObjects(binding);
+//                }
+//            }
+//            
+//            // Get the connector type
+//            ConnectorBindingType ctype = getConfigurationService().getConnectorType(type);
+//            if (ctype == null) {
+//                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.connector_type_not_exists", type)); //$NON-NLS-1$
+//            }
+//            
+//            // Build the connector binding with informatin we know.
+//            binding = ConnectorConfigurationReader.loadConnectorBinding(deployName, properties, ctype);
+//            
+//            // Check that the connector binding passwords can be decrypted
+//            try {
+//            	checkDecryption(binding, ctype);
+//            } catch(CryptoException e) {
+//            	if (!options.containsOption(AdminOptions.BINDINGS_IGNORE_DECRYPT_ERROR)) {
+//            		throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.CODE_DECRYPTION_FAILED", binding.getFullName())); //$NON-NLS-1$		
+//            	}
+//            }
+//            
+//            // now that all of the input parameters validated, add the connector binding
+//            binding = addConnectorBinding(deployName, binding, ctype, false);
+//            
+//        } catch (MetaMatrixComponentException e) {
+//        	throw new AdminComponentException(e);
+//        }
+//        return (org.teiid.adminapi.ConnectorBinding) convertToAdminObjects(binding);
+    	
+    	return null;
+    }
+
+    boolean bindingExists(String name) throws MetaMatrixComponentException {
+//        ConnectorBinding binding = getDataService().getConnectorBinding(name);
+//        return (binding != null);
+    	return false;
+    }
+    
+    boolean bindingTypeExists(String name) throws MetaMatrixComponentException {
+        ConnectorBindingType type = getConfigurationService().getConnectorType(name);
+        return (type != null);
+    }
+    
+    /** 
+     * @see org.teiid.adminapi.ConfigurationAdmin#addConnectorBinding(java.lang.String, char[], AdminOptions)
+     * @since 4.3
+     */
+    public org.teiid.adminapi.ConnectorBinding addConnectorBinding(String deployName, char[] xmlFile, AdminOptions options) 
+        throws AdminException {
+        
+//        // if the options object is null treat as if it is IGNORE as default
+//        if (options == null) {
+//            options = new AdminOptions(AdminOptions.OnConflict.IGNORE);
+//        }
+//
+//        if (deployName == null || !deployName.matches(MULTIPLE_WORDS_REGEX)) {
+//            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_cb_name")); //$NON-NLS-1$                
+//        }
+//        if (xmlFile == null || xmlFile.length == 0) {
+//            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_cb_source")); //$NON-NLS-1$
+//        }
+//                
+//        ConnectorBinding binding = null;
+//        try {
+//            // Check if the binding exists already, if does take action based on user
+//            // preferences in the admin options
+//            if (bindingExists(deployName)) {
+//                // Based on users preference, either add or replace or ignore 
+//                if (options.containsOption(AdminOptions.OnConflict.EXCEPTION)) {
+//                    throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.addBindingEixists", deployName)); //$NON-NLS-1$
+//                }
+//                else if (options.containsOption(AdminOptions.OnConflict.IGNORE)) {
+//                    binding = getDataService().getConnectorBinding(deployName);
+//                    return (org.teiid.adminapi.ConnectorBinding) convertToAdminObjects(binding);
+//                }
+//            }
+//            
+//            // now we are in situation we do have the connector or overwriting it.
+//            // before we add the connector binding we need to add the connector type
+//            // as the connector binding only references to type by identifier.
+//            ConnectorBindingType type = ConnectorConfigurationReader.loadConnectorType(xmlFile);
+//            
+//            // Check if the binding type exists already, if does take action based on user
+//            // preferences in the admin options, same rules apply as binding. 
+//            boolean addType = true;
+//            if (bindingTypeExists(type.getName())) {
+//                if (options.containsOption(AdminOptions.OnConflict.EXCEPTION)) {
+//                    throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.addBinding_type_exists", deployName, type.getName())); //$NON-NLS-1$
+//                }
+//                else if (options.containsOption(AdminOptions.OnConflict.IGNORE)) {
+//                	addType = false;
+//                }                
+//            }
+//            
+//            binding = ConnectorConfigurationReader.loadConnectorBinding(deployName, xmlFile);
+//            
+//            // Check that the connector binding passwords can be decrypted
+//            try {
+//            	checkDecryption(binding, type);
+//            } catch(CryptoException e) {
+//            	if (!options.containsOption(AdminOptions.BINDINGS_IGNORE_DECRYPT_ERROR)) {
+//            		throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.CODE_DECRYPTION_FAILED", binding.getFullName())); //$NON-NLS-1$		
+//            	}
+//            }
+//
+//            // now that all of the input parameters validated, add the connector binding
+//            binding = addConnectorBinding(deployName, binding, type, addType);
+//                                
+//        } catch (MetaMatrixComponentException e) {
+//        	throw new AdminComponentException(e);
+//        }
+//        
+//        return (org.teiid.adminapi.ConnectorBinding) convertToAdminObjects(binding);
+    	return null;
+    }
+
+    /**
+     * Helper method to add the connector binding.. 
+     * @param deployName
+     * @param binding
+     * @param type
+     * @param options
+     * @throws AdminException
+     */
+    ConnectorBinding addConnectorBinding(String deployName, ConnectorBinding binding, ConnectorBindingType type, boolean addType) 
+        throws AdminException {
+        // Make sure we have both correctly configured
+        if (type != null && binding != null) {
+            if (binding.getComponentTypeID().getName().equals(type.getName())) {
+                try {
+                    
+                    // First add the connector type if one is not already in here.
+                    if (getConfigurationService().getConnectorType(type.getName()) == null || addType) {
+                        saveConnectorType(type);
+                    }
+                    // Now add the connector binding.
+                    binding = getConfigurationService().addConnectorBinding(deployName, binding, true);
+                    return binding;
+                } catch (MetaMatrixComponentException e) {
+                	throw new AdminComponentException(e);
+                } 
+            }
+            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.connector_load_failed_wrong_type", deployName));  //$NON-NLS-1$                    
+        }
+        throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.connector_load_failed_wrong_contents", deployName));  //$NON-NLS-1$        
+    }
+    
+    /** 
+     * @see org.teiid.adminapi.ConfigurationAdmin#deleteConnectorBinding(java.lang.String)
+     * @since 4.3
+     */
+    public void deleteConnectorBinding(String identifier) 
+        throws AdminException {
+//        try {
+//            if (identifier == null || !identifier.matches(MULTIPLE_WORD_WILDCARD_REGEX)) {
+//                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_cb_name")); //$NON-NLS-1$
+//            }
+//            getConfigurationService().deleteConnectorBinding(identifier);
+//        } catch (MetaMatrixComponentException e) {
+//        	throw new AdminComponentException(e);
+//        }          
+    }
+
+    /** 
+     * @see org.teiid.adminapi.ConfigurationAdmin#addVDB(java.lang.String, byte[], char[], AdminOptions)
+     * @since 4.3
+     */
+    private VDB addVDB(String deployName, byte[] vdbFile, char[] defFile, AdminOptions options) 
+        throws AdminException {
+        
+        // if the options object is null treat as if it is BINDINGS_ADD as default
+        if (options == null) {
+            options = new AdminOptions(AdminOptions.OnConflict.IGNORE);
+        }
+        
+        if (deployName == null || !deployName.matches(SINGLE_WORD_REGEX)) {
+            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_vdb_name")); //$NON-NLS-1$                
+        }
+        if (vdbFile == null || vdbFile.length == 0) {
+            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_vdb_source")); //$NON-NLS-1$
+        }        
+        
+        if (defFile == null) {
+            DQPEmbeddedPlugin.logInfo("Admin.load_combined_vdb", new Object[] {deployName}); //$NON-NLS-1$
+        }
+        
+        VDBArchive vdb = null;
+        try {
+        	// Load the VDB from the files
+        	if (defFile == null) {
+        		vdb = VDBConfigurationReader.loadVDB(deployName, vdbFile);
+        	}
+        	else {
+        		vdb = VDBConfigurationReader.loadVDB(deployName, defFile, vdbFile);    
+        	}
+
+            // Add the connector binding in the VDB to the system
+            validateConnectorBindingsInVdb(vdb, options);
+            
+            // now deploy the VDB into the system. Flag is to 
+            VDBArchive deployedVDB = getConfigurationService().addVDB(vdb, !options.containsOption(AdminOptions.OnConflict.IGNORE));
+
+            // If the connector bindings are correctly initialized and VDB is active
+            // start the bindings automatically.
+            if ( (deployedVDB.getStatus() == VDBStatus.ACTIVE) ||
+              	  (deployedVDB.getStatus() == VDBStatus.ACTIVE_DEFAULT) ) {
+                try {
+                    startVDBConnectorBindings(deployedVDB);
+                } catch (MetaMatrixComponentException e) {
+                } catch (ApplicationLifecycleException e) {
+                    // we can safely ignore these because the cause of the not starting is already recorded
+                    // and more likely VDB deployment succeeded.
+                }
+            }
+            
+            return (VDB) convertToAdminObjects(deployedVDB);
+        } catch (MetaMatrixComponentException e) {
+        	throw new AdminComponentException(e);
+        }
+    }
+
+    /** 
+     * Start the connector bindings in the given VDB
+     * @param vdb
+     */
+    private void startVDBConnectorBindings(VDBArchive vdb) throws MetaMatrixComponentException,
+        ApplicationLifecycleException {
+//        
+//    	VDBDefn def = vdb.getConfigurationDef();
+//    	Collection<ConnectorBinding> bindings = def.getConnectorBindings().values();
+// 	 	for (ConnectorBinding binding:bindings) {
+// 	 		getDataService().startConnectorBinding(binding.getDeployedName());
+// 	 	}        
+    }
+    
+    /**
+     * Validate the connector bindings in a VDB. Since the connector bindings in VDB
+     * are VDB scoped there is no meaning for the admin options provided. Just check
+     * the decrypt properties.
+     */
+    void validateConnectorBindingsInVdb(VDBArchive vdb, AdminOptions options) 
+        throws MetaMatrixComponentException, AdminProcessingException, AdminException {
+        
+    	VDBDefn def = vdb.getConfigurationDef();
+    	
+        int version = 0; 
+        VDBArchive existing = null;
+        do {
+            version++;
+            existing = getConfigurationService().getVDB(def.getName(), String.valueOf(version));            
+        } while(existing != null);
+                
+        // Look for the connector bindings in the VDB            
+        // Based on users preference, either add or replace or throw exception
+        List vdbbindings = new ArrayList(def.getConnectorBindings().values());        
+        
+        for (Iterator i = vdbbindings.iterator(); i.hasNext();) {        
+            ConnectorBinding binding = (ConnectorBinding)i.next();
+
+            String deployName = binding.getDeployedName();
+            if (deployName == null) {
+            	deployName = binding.getFullName();
+            }
+            
+            if (bindingExists(deployName)) {
+                if (options.containsOption(AdminOptions.OnConflict.EXCEPTION)) {
+                    throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.addBindingEixists", binding.getDeployedName())); //$NON-NLS-1$
+                }                    
+            }
+            
+            // when the binding is not found it falls in "add", "overwrite" or "ignore"
+            // first two cases we need to add.
+            ConnectorBindingType type = (ConnectorBindingType)def.getConnectorType(binding.getComponentTypeID().getName());
+            
+            // Check that the connector binding passwords can be decrypted
+            try {
+            	checkDecryption(binding, type);
+            } catch(CryptoException e) {
+            	if (!options.containsOption(AdminOptions.BINDINGS_IGNORE_DECRYPT_ERROR)) {
+            		throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.CODE_DECRYPTION_FAILED", binding.getFullName())); //$NON-NLS-1$		
+            	}
+            }
+        }
+    }
+
+    /**
+     * Check that the properties of the specified ConnectorBinding can be decrypted.
+     * @param 
+     * @return
+     * @since 4.3
+     */
+    private void checkDecryption(ConnectorBinding binding, ConnectorBindingType type) throws CryptoException {
+        Properties props = binding.getProperties();
+        Iterator it = props.keySet().iterator();
+        while (it.hasNext()) {
+            String name = (String)it.next();
+            if (isMaskedProperty(name, type)) {
+                decryptProperty(props.getProperty(name));
+            }
+        }
+    }
+       
+    /**
+     * Check to see if the property read is a masked/encoded property 
+     * @param propName
+     * @param type
+     * @return
+     */
+    boolean isMaskedProperty(String  propName, ComponentType type) {
+        if (type != null) {
+            ComponentTypeDefn typeDef = type.getComponentTypeDefinition(propName);
+            if (typeDef != null && typeDef.getPropertyDefinition().isMasked()) {
+                return true;
+            }
+        }
+        return false;
+    }
+    
+    /**
+     * Decrypt the given property using the Crypto libraries. 
+     * @param value
+     * @return decrypted property.
+     */
+    String decryptProperty(String value) throws CryptoException{
+        if (value != null && value.length() > 0 && CryptoUtil.isValueEncrypted(value)) {
+           return CryptoUtil.stringDecrypt(value);
+        }
+        return value;
+    }     
+    
+    /** 
+     * @see org.teiid.adminapi.ConfigurationAdmin#addVDB(java.lang.String, byte[], AdminOptions)
+     * @since 4.3
+     */
+    public VDB addVDB(String deployName, byte[] vdbFile, AdminOptions options) 
+        throws AdminException {
+        return addVDB(deployName, vdbFile, null, options);
+    }
+    
+    @Override
+    public void deleteVDB(String vdbName, String vdbVersion) throws AdminException {
+    	super.changeVDBStatus(vdbName, vdbVersion, VDB.DELETED);
+    }
+        
+    /** 
+     * @see org.teiid.adminapi.ConfigurationAdmin#addExtensionModule(java.lang.String, java.lang.String, byte[], java.lang.String)
+     * @since 4.3
+     */
+    public void addExtensionModule(String type, String sourceName, byte[] source, String description) 
+        throws AdminException {
+//        try {
+//            if (sourceName == null) {
+//                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_ext_source_name")); //$NON-NLS-1$                
+//            }            
+//            if (source == null || source.length == 0) {
+//                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_ext_source")); //$NON-NLS-1$
+//            }
+//            if (!sourceName.endsWith(".jar") && !sourceName.endsWith(".xmi")) { //$NON-NLS-1$ //$NON-NLS-2$
+//                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_ext_module")); //$NON-NLS-1$                
+//            }   
+//            ExtensionModule previousModule = null;
+//
+//            try {
+//                previousModule = getConfigurationService().getExtensionModule(sourceName);
+//            }catch(MetaMatrixComponentException e) {
+//                // this is OK, we did not find any thing
+//            }
+//            
+//            if ( previousModule == null) {
+//                // Now add it.
+//                BasicExtensionModule extModule = new BasicExtensionModule(sourceName, type, description, source);
+//                getConfigurationService().saveExtensionModule(extModule);
+//            }
+//            else {
+//                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.extension_module_exists", sourceName)); //$NON-NLS-1$
+//            }
+//        } catch (MetaMatrixComponentException e) {
+//        	throw new AdminComponentException(e);
+//        }
+    }
+
+    /** 
+     * @see org.teiid.adminapi.ConfigurationAdmin#deleteExtensionModule(java.lang.String)
+     * @since 4.3
+     */
+    public void deleteExtensionModule(String sourceName) 
+        throws AdminException {        
+//        try {
+//            if (sourceName == null) {
+//                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_ext_source_name")); //$NON-NLS-1$                
+//            }                        
+//            getConfigurationService().deleteExtensionModule(sourceName);
+//        } catch (MetaMatrixComponentException e) {
+//        	throw new AdminComponentException(e);
+//        }        
+    }
+
+    /** 
+     * @see org.teiid.adminapi.ConfigurationAdmin#assignBindingToModel(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
+     * @since 4.3
+     */
+    public void assignBindingToModel(String deployedConnectorBindingName, String vdbName, String vdbVersion, String modelName) 
+        throws AdminException {
+
+        if (deployedConnectorBindingName == null || !deployedConnectorBindingName.matches(MULTIPLE_WORD_WILDCARD_REGEX)) {
+            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_cb_name")); //$NON-NLS-1$                
+        }
+        
+        if (vdbName == null || vdbVersion == null || !vdbName.matches(SINGLE_WORD_REGEX)) {
+            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_vdb_name")); //$NON-NLS-1$
+        }
+
+        if (modelName == null || !modelName.matches(MULTIPLE_WORDS_REGEX)) {
+            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_model_name")); //$NON-NLS-1$
+        }
+        
+        // find the connector binding if found in the configuration service
+        // add to the vdb binding.
+        try {
+            ConnectorBinding binding = null;//getDataService().getConnectorBinding(deployedConnectorBindingName);
+            if (binding != null) {
+                List list = new ArrayList();
+                list.add(binding);            
+                getConfigurationService().assignConnectorBinding(vdbName, vdbVersion, modelName, (ConnectorBinding[])list.toArray(new ConnectorBinding[list.size()]));
+            }
+            else {
+                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Vdb_or_Model_notfound")); //$NON-NLS-1$
+            }
+        } catch (MetaMatrixComponentException e) {
+        	throw new AdminComponentException(e);
+        }                        
+    }
+    
+    public void assignBindingsToModel(String[] deployedConnectorBindingName, String vdbName, String vdbVersion, String modelName) throws AdminException {
+        if (deployedConnectorBindingName == null || deployedConnectorBindingName.length == 0) {
+            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_cb_name")); //$NON-NLS-1$                
+        }
+        
+        if (vdbName == null || vdbVersion == null || !vdbName.matches(SINGLE_WORD_REGEX)) {
+            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_vdb_name")); //$NON-NLS-1$
+        }
+
+        if (modelName == null || !modelName.matches(MULTIPLE_WORDS_REGEX)) {
+            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_model_name")); //$NON-NLS-1$
+        }
+        
+        // find the connector binding if found in the configuration service
+        // add to the vdb binding.
+        try {
+        	List list = new ArrayList();
+        	for (int i = 0; i < deployedConnectorBindingName.length; i++) {
+        		ConnectorBinding binding = null; //getDataService().getConnectorBinding(deployedConnectorBindingName[i]);
+                if (binding != null) {
+                    list.add(binding);
+                }
+        	}
+            
+            if (!list.isEmpty()) {
+                getConfigurationService().assignConnectorBinding(vdbName, vdbVersion, modelName, (ConnectorBinding[])list.toArray(new ConnectorBinding[list.size()]));
+            }
+            else {
+                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Vdb_or_Model_notfound")); //$NON-NLS-1$
+            }
+        } catch (MetaMatrixComponentException e) {
+        	throw new AdminComponentException(e);
+        }                        
+    	
+    }
+
+    /** 
+     * @see org.teiid.adminapi.ConfigurationAdmin#getLogConfiguration()
+     * @since 4.3
+     */
+    public LogConfiguration getLogConfiguration() 
+        throws AdminException {
+            return (LogConfiguration)convertToAdminObjects(LogManager.getLogConfigurationCopy());
+    }
+
+    /** 
+     * @see org.teiid.adminapi.ConfigurationAdmin#setLogConfiguration(org.teiid.adminapi.LogConfiguration)
+     * @since 4.3
+     */
+    public void setLogConfiguration(LogConfiguration config) 
+        throws AdminException {
+        LogManager.setLogConfiguration((com.metamatrix.common.log.LogConfiguration)convertToNativeObjects(config));
+    }
+    
+    /** 
+     * @see com.metamatrix.admin.api.embedded.EmbeddedRuntimeStateAdmin#setLogListener(java.lang.Object)
+     * @since 4.3
+     */
+    public void setLogListener(EmbeddedLogger listener) 
+        throws AdminException {
+        if(listener != null) {
+        	LogManager.setLogListener(new DQPLogListener(listener));
+        }
+        else {
+            throw new AdminProcessingException("Admin_invalid_log_listener"); //$NON-NLS-1$
+        }
+    }    
+
+    /** 
+     * @see org.teiid.adminapi.ConfigurationAdmin#exportExtensionModule(java.lang.String)
+     * @since 4.3
+     */
+    public byte[] exportExtensionModule(String sourceName) throws AdminException {
+//        try {
+//            if (sourceName == null) {
+//                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_ext_source_name")); //$NON-NLS-1$                
+//            }            
+//            
+//            ExtensionModule extModule = getConfigurationService().getExtensionModule(sourceName);            
+//            return extModule.getFileContents();
+//        } catch (MetaMatrixComponentException e) {
+//        	throw new AdminComponentException(e);
+//        }
+    	return null;
+    }
+
+    /** 
+     * @see org.teiid.adminapi.ConfigurationAdmin#exportConfiguration()
+     * @since 4.3
+     */
+    public char[] exportConfiguration() throws AdminException {
+        try {
+        	StringWriter sw = new StringWriter();
+            Properties props = getConfigurationService().getSystemProperties();
+            props.store(sw, "Export of Teiid Configuration Properties"); //$NON-NLS-1$
+            return sw.toString().toCharArray();
+        } catch (IOException e) {
+        	throw new AdminComponentException(e);
+        }
+    }
+
+    /** 
+     * @see org.teiid.adminapi.ConfigurationAdmin#exportConnectorBinding(java.lang.String)
+     * @since 4.3
+     */
+    public char[] exportConnectorBinding(String identifier) 
+        throws AdminException {
+//        try {
+//            if (identifier == null || !identifier.matches(MULTIPLE_WORD_WILDCARD_REGEX)) {
+//                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_cb_name")); //$NON-NLS-1$                
+//            }
+//            
+//            List bindingList = getDataService().getConnectorBindings();
+//            List matchedList = new ArrayList();
+//            for (Iterator i = bindingList.iterator(); i.hasNext();) {
+//                ConnectorBinding binding = (ConnectorBinding)i.next();
+//                if (matches(identifier, binding.getDeployedName())) {
+//                    matchedList.add(binding);
+//                }
+//            }
+//            
+//            if (!matchedList.isEmpty()) {
+//                ConnectorBinding[] bindings = (ConnectorBinding[])matchedList.toArray(new ConnectorBinding[matchedList.size()]);
+//                ConnectorBindingType[] types = new ConnectorBindingType[bindings.length];
+//                
+//                for (int i = 0; i < bindings.length; i++) {
+//                    types[i] = getConfigurationService().getConnectorType(bindings[i].getComponentTypeID().getName());                
+//                }
+//                return ConnectorConfigurationWriter.writeToCharArray(bindings, types);
+//            }
+//            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Connector_binding_does_not_exists", identifier)); //$NON-NLS-1$
+//        } catch (MetaMatrixComponentException e) {
+//        	throw new AdminComponentException(e);
+//        }
+    	return null;
+    }
+
+    /** 
+     * @see org.teiid.adminapi.ConfigurationAdmin#exportConnectorType(java.lang.String)
+     * @since 4.3
+     */
+    public char[] exportConnectorType(String identifier) 
+        throws AdminException {
+//        try {
+//            if (identifier == null || !identifier.matches(MULTIPLE_WORDS_REGEX)) {
+//                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_ct_name")); //$NON-NLS-1$                
+//            }
+//            
+//            List typesList = getConfigurationService().getConnectorTypes();
+//            List matchedList = new ArrayList();
+//            for (Iterator i = typesList.iterator(); i.hasNext();) {
+//                ConnectorBindingType type = (ConnectorBindingType)i.next();
+//                if (matches(identifier, type.getName())) {
+//                    matchedList.add(type);
+//                }
+//            }
+//            
+//            if (!matchedList.isEmpty()) {
+//                ConnectorBindingType[] types = (ConnectorBindingType[])matchedList.toArray(new ConnectorBindingType[matchedList.size()]);
+//                return ConnectorConfigurationWriter.writeToCharArray(types);
+//            }
+//            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Connector_type_does_not_exists", identifier)); //$NON-NLS-1$
+//        } catch (MetaMatrixComponentException e) {
+//        	throw new AdminComponentException(e);
+//        } 
+    	return null;
+    }
+
+    /**  
+     * @see org.teiid.adminapi.ConfigurationAdmin#exportVDB(java.lang.String, java.lang.String)
+     * @since 4.3
+     */
+    public byte[] exportVDB(String name, String version) 
+        throws AdminException {     
+    	
+        try {
+            if (name == null || version == null || !name.matches(SINGLE_WORD_REGEX)) {
+                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_vdb_name")); //$NON-NLS-1$                
+            }
+            
+            VDBArchive vdb = getConfigurationService().getVDB(name, version); 
+            if (vdb != null) {
+                return VDBArchive.writeToByteArray(vdb);
+            }
+            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.vdb_does_not_exists", name, version)); //$NON-NLS-1$
+        } catch (MetaMatrixComponentException e) {
+        	throw new AdminComponentException(e);
+        }
+    }
+
+    /** 
+     * @see org.teiid.adminapi.ConfigurationAdmin#addConnectorArchive(byte[], org.teiid.adminapi.AdminOptions)
+     * @since 4.3.2
+     */
+    public void addConnectorArchive(byte[] contents, AdminOptions options) throws AdminException {
+        
+        // if the options object is null treat as if it is IGNORE as default
+        if (options == null) {
+            options = new AdminOptions(AdminOptions.OnConflict.IGNORE);
+        }
+
+        if (contents == null || contents.length == 0) {
+            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_ct_source")); //$NON-NLS-1$
+        }
+        
+        try {            
+            // Load the connector Archive from the file            
+            HashSet previouslyAddedModules = new HashSet();
+            ConnectorArchive archive = ConnectorConfigurationReader.loadConnectorArchive(contents);
+            ConnectorBindingType[] connectorTypes = archive.getConnectorTypes();
+                           
+            // Loop through each type and add all of them based on the option.
+            for (int typeIndex = 0; typeIndex < connectorTypes.length; typeIndex++) {
+                
+                // first make sure we do not already have this connector type
+                String connectorName = connectorTypes[typeIndex].getName();
+                ConnectorBindingType type = getConfigurationService().getConnectorType(connectorName);
+                if (type == null) {
+                    type = connectorTypes[typeIndex];
+                    ExtensionModule[] extModules = archive.getExtensionModules(type);
+                    checkDuplicateExtensionModules(extModules, options, previouslyAddedModules);
+                    saveConnectorType(type);
+
+                } else {
+                
+                    // if not asked to overwrite/skip writing them
+                    if (options.containsOption(AdminOptions.OnConflict.EXCEPTION)) {
+                        throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Connector_type_exists", connectorName)); //$NON-NLS-1$            
+                    } else if (options.containsOption(AdminOptions.OnConflict.IGNORE)) {
+                        continue;
+                    } else if (options.containsOption(AdminOptions.OnConflict.OVERWRITE)){
+                        deleteConnectorType(connectorName);
+                        // Now that we know we need to add this to configuration; let's get on with it
+                        type = connectorTypes[typeIndex];
+                        ExtensionModule[] extModules = archive.getExtensionModules(type);
+                        checkDuplicateExtensionModules(extModules, options, previouslyAddedModules);
+                        saveConnectorType(type);
+                    }                
+                }
+                // Now that we know we need to add this to configuration; let's get on with it
+                type = connectorTypes[typeIndex];
+                ExtensionModule[] extModules = archive.getExtensionModules(type);
+                checkDuplicateExtensionModules(extModules, options, previouslyAddedModules);
+            }
+            
+            // Now add the extension modules
+            for (Iterator i = previouslyAddedModules.iterator(); i.hasNext();) {
+                ExtensionModule extModule = (ExtensionModule)i.next();
+                addExtensionModule(extModule.getModuleType(), extModule.getFullName(), extModule.getFileContents(), extModule.getDescription());
+            }        
+                        
+        } catch (MetaMatrixComponentException e) {
+            throw new AdminComponentException(e);
+        }
+    }
+
+    /**
+     * This method checks the passed in connector type's extension module is not already in the
+     * system, if it there takes the appropriate action. Otherwise keeps tracks of all modules 
+     * to add. 
+     * @param type - connector type
+     * @param extModules - Extension modules for the Connector Type
+     * @param options - Admin Options
+     * @param ignorableModules - Modules which are already added, can be ignored for adding
+     */
+    void checkDuplicateExtensionModules(ExtensionModule[] extModules, AdminOptions options, HashSet ignorableModules) 
+        throws AdminException  {
+
+        // Now check if the the extension modules are already there        
+        for (int i = 0; i < extModules.length; i++) {
+            boolean add = true;
+            
+            String moduleName = extModules[i].getFullName();
+            ExtensionModule previousModule = null;
+            
+            // see if we can ignore this, because we may have just added this during import of
+            // another connector type through this archive
+            if (ignorableModules.contains(extModules[i])) {
+                continue;
+            }
+            
+            // we have not already added this this time around, now check if this available 
+            // from configuration service
+            try {
+                previousModule = getConfigurationService().getExtensionModule(moduleName);
+            }catch(MetaMatrixComponentException e) {
+                // this is OK, we did not find any thing
+            }
+            
+            // if we found it take appropriate action.
+            if(previousModule != null && options.containsOption(AdminOptions.OnConflict.EXCEPTION)) {
+                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.extension_module_exists", previousModule.getFullName())); //$NON-NLS-1$
+            }
+            else if (previousModule != null && options.containsOption(AdminOptions.OnConflict.IGNORE)) {
+                add = false;
+            }
+            else if (previousModule != null && options.containsOption(AdminOptions.OnConflict.OVERWRITE)) {
+                // since we are overwrite, first delete and then add, there is no safe way to overwrite
+                deleteExtensionModule(previousModule.getFullName());
+            }
+                            
+            // Now keep track what extension modules to add; also to ignore in future
+            // adds
+            if (add) {                
+                ignorableModules.add(extModules[i]);
+            }
+        }                    
+    }
+    
+    /** 
+     * @see org.teiid.adminapi.ConfigurationAdmin#exportConnectorArchive(java.lang.String)
+     * @since 4.3
+     */
+    public byte[] exportConnectorArchive(String identifier) throws AdminException {
+//        try {
+//            if (identifier == null || !identifier.matches(MULTIPLE_WORD_WILDCARD_REGEX)) {
+//                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_ct_name")); //$NON-NLS-1$                
+//            }
+//            
+//            // first build the connector archive object
+//            BasicConnectorArchive archive = new BasicConnectorArchive();
+//            List connectorTypes = getConfigurationService().getConnectorTypes();
+//            
+//            for (Iterator i = connectorTypes.iterator(); i.hasNext();) {
+//                ConnectorBindingType type = (ConnectorBindingType)i.next();
+//                
+//                // If the types name matches with the pattern sent in add to archive
+//                if (type != null && matches(identifier, type.getName())) {
+//                    
+//                    // Add connector type first
+//                    archive.addConnectorType(type);
+//    
+//                    // Get the extension modules required for the type
+//                    String[] extModules = type.getExtensionModules();
+//                    for (int m = 0; m < extModules.length; m++) {
+//                        // Get the extension module from the configuration and add to the archive
+//                        ExtensionModule extModule = getConfigurationService().getExtensionModule(extModules[m]);
+//                        if (extModule != null) {
+//                            archive.addExtensionModule(type, extModule);
+//                        }
+//                        else {
+//                            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("DataService.ext_module_not_found", extModules[m])); //$NON-NLS-1$                            
+//                        }                        
+//                    }                    
+//                }
+//            }
+//                
+//            // if no types found to the identifier pattern, then throw an exception
+//            if (archive.getConnectorTypes().length == 0) {
+//                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Connector_type_does_not_exists", identifier)); //$NON-NLS-1$    
+//            }
+//                            
+//            // now convert the object into file form
+//            return ConnectorConfigurationWriter.writeToByteArray(archive);
+//           
+//        } catch (MetaMatrixComponentException e) {
+//        	throw new AdminComponentException(e);
+//        } 
+    	return null;
+    }
+    
+    private void saveConnectorType(ConnectorBindingType type) throws MetaMatrixComponentException {
+        getConfigurationService().saveConnectorType(type);
+    }
+    
+    
+    @Override
+	public void addUDF(byte[] modelFileContents, String classpath)
+			throws AdminException {
+		if (modelFileContents == null || modelFileContents.length == 0) {
+			throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_UDF_contents")); //$NON-NLS-1$               
+		}
+
+		try {
+		
+			getConfigurationService().unloadUDF();
+			
+			// delete any extension module by the same name first
+			try {
+				deleteExtensionModule(ConfigurationService.USER_DEFINED_FUNCTION_MODEL);
+			} catch (AdminException e) {
+				// if not found then it is OK to fail
+			}
+			
+			// add the function definitions as extension modules
+			addExtensionModule(ExtensionModule.FUNCTION_DEFINITION_TYPE,ConfigurationService.USER_DEFINED_FUNCTION_MODEL,modelFileContents, "User Defined Functions File"); //$NON-NLS-1$
+			
+	        String commonpath = getConfigurationService().getSystemProperties().getProperty(DQPEmbeddedProperties.COMMON_EXTENSION_CLASPATH, ""); //$NON-NLS-1$
+	        
+	        StringBuilder sb = new StringBuilder();
+	        if (classpath != null && classpath.length() > 0 ) {
+	        	StringTokenizer st = new StringTokenizer(classpath, ";"); //$NON-NLS-1$
+	        	while (st.hasMoreTokens()) {
+	        		String partpath = st.nextToken();
+	        		if (commonpath.indexOf(partpath) == -1) {
+	        			sb.append(partpath).append(";"); //$NON-NLS-1$
+	        		}
+	        	}
+	        }
+	        getConfigurationService().setSystemProperty(DQPEmbeddedProperties.COMMON_EXTENSION_CLASPATH, sb.toString()+commonpath);
+			
+			
+			// then update the properties
+			Properties p = new Properties();
+			p.setProperty(DQPEmbeddedProperties.COMMON_EXTENSION_CLASPATH, classpath);
+			getConfigurationService().updateSystemProperties(p);
+			// reload the new UDF
+			getConfigurationService().loadUDF();
+		} catch (MetaMatrixComponentException e) {
+			throw new AdminComponentException(e);
+		}
+	}
+
+	@Override
+	public void deleteUDF() throws AdminException {
+		try {
+			getConfigurationService().unloadUDF();
+			deleteExtensionModule(ConfigurationService.USER_DEFINED_FUNCTION_MODEL); 
+		} catch (MetaMatrixComponentException e) {
+			throw new AdminComponentException(e);
+		}
+	}
+	
+	@Override
+	public void extensionModuleModified(String name) throws AdminException {
+		try {
+			getConfigurationService().clearClassLoaderCache();
+			getConfigurationService().loadUDF();
+		} catch (MetaMatrixComponentException e) {
+			throw new AdminComponentException(e);
+		}		
+	}
+
+	@Override
+	public void setProcessProperty(String processIdentifier, String propertyName, String propertyValue) throws AdminException{
+		try {
+			getConfigurationService().setSystemProperty(propertyName, propertyValue);
+		} catch (MetaMatrixComponentException e) {
+			throw new AdminComponentException(e);
+		}
+	}
+}


Property changes on: branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/embedded/admin/DQPLogListener.java
===================================================================
--- branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/embedded/admin/DQPLogListener.java	                        (rev 0)
+++ branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/embedded/admin/DQPLogListener.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,76 @@
+/*
+ * 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.dqp.embedded.admin;
+
+import org.teiid.adminapi.EmbeddedLogger;
+import org.teiid.adminapi.LogConfiguration;
+
+import com.metamatrix.core.log.LogListener;
+import com.metamatrix.core.log.MessageLevel;
+
+
+public class DQPLogListener implements LogListener {
+    
+    private EmbeddedLogger logger;
+    
+    public DQPLogListener(EmbeddedLogger logger) {
+        this.logger = logger;
+    }
+
+    public void log(int level, String context, Object msg) {
+        logger.log(convertLevel(level), System.currentTimeMillis(), context, Thread.currentThread().getName(), msg.toString(), null);        
+    }
+
+    public void log(int level, String context, Throwable t, Object msg) {
+    	logger.log(convertLevel(level), System.currentTimeMillis(), context, Thread.currentThread().getName(), msg.toString(), t);
+    }    
+    
+	private int convertLevel(int level) {
+		int logLevel = LogConfiguration.INFO;
+        
+        switch(level) {
+            case MessageLevel.WARNING:
+                logLevel = LogConfiguration.WARNING;
+                break;
+            case MessageLevel.ERROR:
+                logLevel = LogConfiguration.ERROR;
+                break;
+            case MessageLevel.DETAIL:
+                logLevel = LogConfiguration.DETAIL;
+                break;
+            case MessageLevel.TRACE:
+                logLevel = LogConfiguration.TRACE;
+                break;
+            case MessageLevel.NONE:
+                logLevel = LogConfiguration.NONE;
+                break;
+                
+            default:
+                logLevel = LogConfiguration.INFO;
+        }
+		return logLevel;
+	}
+    
+    public void shutdown() {
+    }
+}


Property changes on: branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/embedded/admin/DQPLogListener.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/embedded/admin/DQPMonitoringAdminImpl.java
===================================================================
--- branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/embedded/admin/DQPMonitoringAdminImpl.java	                        (rev 0)
+++ branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/embedded/admin/DQPMonitoringAdminImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,327 @@
+/*
+ * 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.dqp.embedded.admin;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+
+import org.teiid.adminapi.AdminComponentException;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminProcessingException;
+import org.teiid.adminapi.Cache;
+import org.teiid.adminapi.ConnectionPool;
+import org.teiid.adminapi.ConnectorBinding;
+import org.teiid.adminapi.ConnectorType;
+import org.teiid.adminapi.ExtensionModule;
+import org.teiid.adminapi.MonitoringAdmin;
+import org.teiid.adminapi.ProcessObject;
+import org.teiid.adminapi.PropertyDefinition;
+import org.teiid.adminapi.QueueWorkerPool;
+import org.teiid.adminapi.Request;
+import org.teiid.adminapi.Session;
+import org.teiid.adminapi.Transaction;
+import org.teiid.adminapi.VDB;
+
+import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.common.config.api.ConnectorBindingType;
+import com.metamatrix.common.vdb.api.VDBArchive;
+import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
+import com.metamatrix.dqp.service.TransactionService;
+import com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl;
+import com.metamatrix.server.serverapi.RequestInfo;
+
+
+/** 
+ * DQP implementation of the Monitoring API
+ * @since 4.3
+ */
+public class DQPMonitoringAdminImpl extends BaseAdmin implements MonitoringAdmin {
+
+    public DQPMonitoringAdminImpl(EmbeddedConnectionFactoryImpl manager) {
+        super(manager);
+    }
+
+    /** 
+     * @see org.teiid.adminapi.MonitoringAdmin#getConnectorTypes(java.lang.String)
+     * @since 4.3
+     */
+    public Collection<ConnectorType> getConnectorTypes(String identifier) 
+        throws AdminException {
+
+        if (identifier == null || !identifier.matches(MULTIPLE_WORD_WILDCARD_REGEX)) {
+            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_identifier")); //$NON-NLS-1$                
+        }
+        
+        return super.getConnectorTypes(identifier);
+    }
+
+    /** 
+     * @see org.teiid.adminapi.MonitoringAdmin#getVDBs(java.lang.String)
+     * @since 4.3
+     */
+    public Collection<VDB> getVDBs(String identifier) 
+        throws AdminException {
+        
+        if (identifier == null || !identifier.matches(VDB_REGEX)) {
+            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_identifier")); //$NON-NLS-1$                
+        }
+        
+        // if . and * not specified, add a STAR at the end to compensate for the
+        // version number matching.
+        if (identifier.indexOf(DOT) == -1 && identifier.indexOf(STAR) == -1) {
+            identifier = identifier +DOT+STAR;
+        }
+        
+        try {
+            List<VDBArchive> vdbs = getVDBService().getAvailableVDBs();
+            List matchedVdbs = new ArrayList();
+            for (VDBArchive vdb:vdbs) {
+                if (matches(identifier, vdb.getName()+"."+vdb.getVersion())) { //$NON-NLS-1$
+                    matchedVdbs.add(vdb);
+                }
+            }                        
+            return (List)convertToAdminObjects(matchedVdbs);
+        } catch (MetaMatrixComponentException e) {
+        	throw new AdminComponentException(e);
+        }
+    }
+
+    /** 
+     * @see org.teiid.adminapi.MonitoringAdmin#getConnectorBindings(java.lang.String)
+     * @since 4.3
+     */
+    public Collection<ConnectorBinding> getConnectorBindings(String identifier) 
+        throws AdminException {
+        
+        if (identifier == null) {
+            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_identifier")); //$NON-NLS-1$                
+        }                
+        return super.getConnectorBindings(identifier);
+    }
+    
+
+    @Override
+    public Collection<ConnectorBinding> getConnectorBindingsInVDB(String vdbName, String vdbVersion)  throws AdminException{
+        try {
+            VDBArchive vdb = getConfigurationService().getVDB(vdbName, vdbVersion); 
+            if (vdb != null) {
+            	return (List)convertToAdminObjects(vdb.getConfigurationDef().getConnectorBindings().values());
+            }
+            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.vdb_does_not_exists", vdbVersion, vdbVersion)); //$NON-NLS-1$
+            
+        } catch (MetaMatrixComponentException e) {
+        	throw new AdminComponentException(e);
+        }      
+    }    
+    
+    /** 
+     * @see org.teiid.adminapi.MonitoringAdmin#getExtensionModules(java.lang.String)
+     * @since 4.3
+     */
+    public Collection<ExtensionModule> getExtensionModules(String identifier) 
+        throws AdminException {
+        
+        if (identifier == null || !identifier.matches(WORD_AND_DOT_WILDCARD_REGEX)) {
+            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_identifier")); //$NON-NLS-1$                
+        }
+                
+        try {
+            List extModules = getConfigurationService().getExtensionModules();
+            extModules = (List)convertToAdminObjects(extModules);
+            return matchedCollection(identifier, extModules);            
+        } catch (MetaMatrixComponentException e) {
+        	throw new AdminComponentException(e);
+        }
+    }
+
+    /** 
+     * @see org.teiid.adminapi.MonitoringAdmin#getQueueWorkerPools(java.lang.String)
+     * @since 4.3
+     */
+    public Collection<QueueWorkerPool> getQueueWorkerPools(String identifier) 
+        throws AdminException {
+        
+        if (identifier == null || !identifier.matches(MULTIPLE_WORD_WILDCARD_REGEX)) {
+            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_identifier")); //$NON-NLS-1$                
+        }
+        
+        List results = new ArrayList();
+        if (matches(identifier, "dqp")) { //$NON-NLS-1$
+            // First get the queue statistics for the DQP
+            Collection c = getManager().getDQP().getQueueStatistics();;
+            if (c != null && !c.isEmpty()) {
+                results.addAll(c);
+            }
+        }
+        
+        try {
+            // Now get for all the connector bindings
+            Collection bindings = super.getConnectorBindings(identifier);
+            for (Iterator i = bindings.iterator(); i.hasNext();) {
+                ConnectorBinding binding = (ConnectorBinding)i.next();
+                Collection c = getDataService().getConnectorStatistics(binding.getName());
+                if (c != null && !c.isEmpty()) {
+                    results.addAll(c);
+                }                
+            }
+        } catch (MetaMatrixComponentException e) {
+        	throw new AdminComponentException(e);
+        }
+                
+        if (!results.isEmpty()) {
+            return (List)convertToAdminObjects(results);
+        }
+        return Collections.EMPTY_LIST;
+    }
+
+    /** 
+     * @see org.teiid.adminapi.MonitoringAdmin#getCaches(java.lang.String)
+     * @since 4.3
+     */
+    public Collection<Cache> getCaches(String identifier) 
+        throws AdminException {
+        
+        if (identifier == null || !identifier.matches(SINGLE_WORD_WILDCARD_REGEX)) {
+            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_identifier")); //$NON-NLS-1$                
+        }
+        
+        List cacheList = new ArrayList();
+        for (int i =0; i < cacheTypes.length; i++) {
+            if (matches(identifier, cacheTypes[i])) {
+                cacheList.add(cacheTypes[i]);
+            }            
+        }
+        return cacheList;
+    }
+
+    /** 
+     * @see org.teiid.adminapi.MonitoringAdmin#getSessions(java.lang.String)
+     * @since 4.3
+     */
+    public Collection<Session> getSessions(String identifier) 
+        throws AdminException {
+        
+        if (identifier == null || !identifier.matches(NUMBER_REGEX)) {
+            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_identifier")); //$NON-NLS-1$                
+        }
+        return matchedCollection(identifier, (List)convertToAdminObjects(getClientConnections()));
+    }
+        
+    /** 
+     * @see org.teiid.adminapi.MonitoringAdmin#getRequests(java.lang.String)
+     * @since 4.3
+     */
+    public Collection<Request> getRequests(String identifier) 
+        throws AdminException {
+
+        if (identifier == null || !identifier.matches(NUMBER_DOT_REGEX)) {
+            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_identifier")); //$NON-NLS-1$                
+        }
+        
+        ArrayList requestList = new ArrayList();
+        // List contains both top and atomic requests, only add the top requests
+    	List<RequestInfo> requests = getManager().getDQP().getRequests();                 
+        for(RequestInfo request:requests) {
+        	if (request.getConnectorBindingUUID() == null) {
+        		requestList.add(request);
+        	}
+        }
+        return matchedCollection(identifier, (List)convertToAdminObjects(requestList));
+    }
+
+    /** 
+     * @see org.teiid.adminapi.MonitoringAdmin#getSourceRequests(java.lang.String)
+     * @since 4.3
+     */
+    public Collection<Request> getSourceRequests(String identifier) 
+        throws AdminException {
+        
+        if (identifier == null || !identifier.matches(NUMBER_DOT_REGEX)) {
+            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_identifier")); //$NON-NLS-1$                
+        }
+        
+        ArrayList atomicRequestList = new ArrayList();
+    	List<RequestInfo> requests = getManager().getDQP().getRequests();
+        for (RequestInfo request:requests) {
+        	if (request.getConnectorBindingUUID() != null) {
+        		atomicRequestList.add(request);
+        	}
+        }
+        return matchedCollection(identifier, (List)convertToAdminObjects(atomicRequestList));
+    }
+    
+    /** 
+     * @see org.teiid.adminapi.MonitoringAdmin#getPropertyDefinitions(java.lang.String, java.lang.String)
+     * @since 4.3
+     */
+    public Collection<PropertyDefinition> getConnectorTypePropertyDefinitions(String typeName) throws AdminException {
+    	
+        if (typeName == null || !typeName.matches(MULTIPLE_WORDS_REGEX)) {
+        	throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_ct_name")); //$NON-NLS-1$                
+        }
+
+        try {
+			ConnectorBindingType type = getConfigurationService().getConnectorType(typeName);
+			if (type == null) {
+				throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.ct_doesnot_exist", typeName)); //$NON-NLS-1$
+			}
+   
+			return convertPropertyDefinitions(type, new Properties());
+		} catch (MetaMatrixComponentException e) {
+			throw new AdminComponentException(e);
+		}
+    }
+
+    @Override
+    public Collection<Transaction> getTransactions()
+    		throws AdminException {
+    	TransactionService ts = getTransactionService();
+    	if (ts == null) {
+    		return Collections.emptyList();
+    	}
+    	return ts.getTransactions();
+    }
+
+	@Override
+	public Collection<? extends ConnectionPool> getConnectionPoolStats(String identifier)
+			throws AdminException {
+		
+//		try {
+//			return this.getDataService().getConnectionPoolStatistics(identifier);
+//		} catch (MetaMatrixComponentException e) {
+//			throw new AdminComponentException(e);
+//		}
+		return Collections.EMPTY_LIST;
+	}
+
+	@Override
+	public Collection<ProcessObject> getProcesses(String processIdentifier) throws AdminException {
+		ArrayList<ProcessObject> list = new ArrayList<ProcessObject>();
+		list.add(getManager().getProcess());
+		return list;
+	}
+}


Property changes on: branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/embedded/admin/DQPMonitoringAdminImpl.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/embedded/admin/DQPRuntimeStateAdminImpl.java
===================================================================
--- branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/embedded/admin/DQPRuntimeStateAdminImpl.java	                        (rev 0)
+++ branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/embedded/admin/DQPRuntimeStateAdminImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,302 @@
+/*
+ * 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.dqp.embedded.admin;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.transaction.xa.Xid;
+
+import org.teiid.adminapi.AdminComponentException;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminObject;
+import org.teiid.adminapi.AdminProcessingException;
+import org.teiid.adminapi.Cache;
+import org.teiid.adminapi.ConnectorBinding;
+import org.teiid.adminapi.Request;
+import org.teiid.adminapi.RuntimeStateAdmin;
+import org.teiid.dqp.internal.process.DQPWorkContext;
+
+import com.metamatrix.admin.objects.MMRequest;
+import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
+import com.metamatrix.dqp.message.AtomicRequestID;
+import com.metamatrix.dqp.message.RequestID;
+import com.metamatrix.dqp.service.TransactionService;
+import com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl;
+import com.metamatrix.platform.security.api.MetaMatrixSessionInfo;
+
+
+/** 
+ * @since 4.3
+ */
+public class DQPRuntimeStateAdminImpl  extends BaseAdmin implements RuntimeStateAdmin {
+
+    public DQPRuntimeStateAdminImpl(EmbeddedConnectionFactoryImpl manager) {
+        super(manager);
+    }
+
+    /** 
+     * @see com.metamatrix.admin.api.embedded.EmbeddedRuntimeStateAdmin#stop(int)
+     * @since 4.3
+     */
+    public void shutdown(int millisToWait) throws AdminException {        
+        // TODO: rreddy need to implement the time to wait.
+        // First terminate all the sessions to the DQP currently have
+        terminateSession(AdminObject.WILDCARD);
+        
+        getManager().shutdown(false);
+    }
+
+    /** 
+     * @see com.metamatrix.admin.api.embedded.EmbeddedRuntimeStateAdmin#restart()
+     * @since 4.3
+     */
+    public void restart() throws AdminException {
+        // First terminate all the sessions to the DQP currently have
+        terminateSession(AdminObject.WILDCARD);
+        
+        // Now shutdown the DQP, it will automatically start next timea new connection is 
+        // requested.
+        getManager().shutdown(true);                        
+    }
+
+    /** 
+     * @see org.teiid.adminapi.RuntimeStateAdmin#startConnectorBinding(java.lang.String)
+     * @since 4.3
+     */
+    public void startConnectorBinding(String identifier) 
+        throws AdminException {
+        
+//        if (identifier == null || !identifier.matches(MULTIPLE_WORD_WILDCARD_REGEX)) {
+//            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_identifier")); //$NON-NLS-1$                
+//        }
+//        
+//        AdminException exceptionWrapper = null;
+//        // Get all matching connector bindings
+//        Collection bindings = getConnectorBindings(identifier);
+//        if (bindings != null && !bindings.isEmpty()) {
+//            for (Iterator i = bindings.iterator(); i.hasNext();) {
+//                try {
+//                    AdminObject binding = (AdminObject)i.next();
+//                    getDataService().startConnectorBinding(binding.getName());
+//                } catch (ApplicationLifecycleException e) {
+//                    exceptionWrapper = accumulateSystemException(exceptionWrapper, e);
+//                } catch (MetaMatrixComponentException e) {
+//                    exceptionWrapper = accumulateSystemException(exceptionWrapper, e);
+//                }
+//            }
+//        }
+//        else {
+//            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Connector_binding_does_not_exists", new Object[] {identifier})); //$NON-NLS-1$            
+//        }
+//
+//        // If any errors occurred then thow the exception.
+//        if (exceptionWrapper != null) {
+//            throw exceptionWrapper;
+//        }
+    }
+
+    /** 
+     * @see org.teiid.adminapi.RuntimeStateAdmin#stopConnectorBinding(java.lang.String, boolean)
+     * @since 4.3
+     */
+    public void stopConnectorBinding(String identifier, boolean stopNow) 
+        throws AdminException {
+//        // TODO: need to implement "now" part
+//        if (identifier == null || !identifier.matches(MULTIPLE_WORD_WILDCARD_REGEX)) {
+//            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_identifier")); //$NON-NLS-1$                
+//        }
+//        
+//        AdminException exceptionWrapper = null;
+//        // Get all matching connector bindings        
+//        Collection bindings = getConnectorBindings(identifier);
+//        if (bindings != null && !bindings.isEmpty()) {
+//            for (Iterator i = bindings.iterator(); i.hasNext();) {
+//                try {
+//                    AdminObject binding = (AdminObject)i.next();
+//                    getDataService().stopConnectorBinding(binding.getName());
+//                } catch (ApplicationLifecycleException e) {
+//                    exceptionWrapper = accumulateSystemException(exceptionWrapper, e);
+//                } catch (MetaMatrixComponentException e) {
+//                    exceptionWrapper = accumulateSystemException(exceptionWrapper, e);
+//                }
+//            }
+//        }
+//        else {
+//            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Connector_binding_does_not_exists", new Object[] {identifier})); //$NON-NLS-1$            
+//        }
+//
+//        // If any errors occurred then thow the exception.
+//        if (exceptionWrapper != null) {
+//            throw exceptionWrapper;
+//        }
+    }
+
+    /** 
+     * @see org.teiid.adminapi.RuntimeStateAdmin#clearCache(java.lang.String)
+     * @since 4.3
+     */
+    public void clearCache(String identifier) 
+        throws AdminException {
+        
+        if (identifier == null || !identifier.matches(SINGLE_WORD_WILDCARD_REGEX)) {
+            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_identifier")); //$NON-NLS-1$                
+        }
+        boolean processed = false;
+        
+        for (int i = 0; i < cacheTypes.length; i++) {
+            if (matches(identifier, cacheTypes[i])) {
+                if(cacheTypes[i].equals(Cache.CODE_TABLE_CACHE)) {
+                    processed = true;
+                    getManager().getDQP().clearCodeTableCache();
+                } else if(cacheTypes[i].equals(Cache.PREPARED_PLAN_CACHE)) {
+                    processed = true;
+                    getManager().getDQP().clearPlanCache();
+                } else if(cacheTypes[i].equals( Cache.QUERY_SERVICE_RESULT_SET_CACHE)) {
+                    processed = true;
+                    getManager().getDQP().clearResultSetCache();
+                } else if (cacheTypes[i].equals(Cache.CONNECTOR_RESULT_SET_CACHE)) {
+                    processed = true;
+                    try {
+                        // Now get for all the connector bindings
+                        Collection bindings = super.getConnectorBindings("*"); //$NON-NLS-1$
+                        for (Iterator iter = bindings.iterator(); iter.hasNext();) {
+                            ConnectorBinding binding = (ConnectorBinding)iter.next();
+                            getDataService().clearConnectorBindingCache(binding.getName());
+                        }
+                    } catch (MetaMatrixComponentException e) {
+                    	throw new AdminComponentException(e);
+                    }                                        
+                } 
+            }
+        }
+        
+        if (!processed) {
+            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.invalid_request", new Object[] {identifier})); //$NON-NLS-1$
+        }        
+    }
+    
+    /** 
+     * @see org.teiid.adminapi.RuntimeStateAdmin#terminateSession(java.lang.String)
+     * @since 4.3
+     */
+    public void terminateSession(String identifier) 
+        throws AdminException {
+        
+        Collection<MetaMatrixSessionInfo> sessions = getClientConnections();
+        ArrayList<MetaMatrixSessionInfo> matchedConnections = new ArrayList<MetaMatrixSessionInfo>();
+        
+        for (MetaMatrixSessionInfo info:sessions) {
+            String id = info.getSessionID().toString();
+            if (matches(identifier, id)) {
+                matchedConnections.add(info);
+            }
+        }
+
+        // terminate the sessions.
+        for (MetaMatrixSessionInfo info: matchedConnections) {
+        	getSessionService().terminateSession(info.getSessionID(), DQPWorkContext.getWorkContext().getSessionId());
+        }
+    }
+    
+    /** 
+     * @see org.teiid.adminapi.RuntimeStateAdmin#cancelRequest(java.lang.String)
+     * @since 4.3
+     */
+    public void cancelRequest(String identifier) 
+        throws AdminException {
+
+        if (identifier == null || !identifier.matches("\\d+\\" + Request.DELIMITER + "\\d+")) { //$NON-NLS-1$ //$NON-NLS-2$
+            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_identifier")); //$NON-NLS-1$                
+        }
+                
+        String[] identifierParts = MMRequest.buildIdentifierArray(identifier);
+        String connId = identifierParts[0];
+        long requestId = Long.parseLong(identifierParts[1]);
+        
+        // get the client connection
+        RequestID id = new RequestID(connId, requestId);    
+        
+        try {
+        	getManager().getDQP().cancelRequest(id);
+		} catch (MetaMatrixComponentException e) {
+			throw new AdminComponentException(e);
+		}
+    }
+
+    /** 
+     * @see org.teiid.adminapi.RuntimeStateAdmin#cancelSourceRequest(java.lang.String)
+     * @since 4.3
+     */
+    public void cancelSourceRequest(String identifier) 
+        throws AdminException {
+        
+        if (identifier == null || !identifier.matches("\\d+\\" + Request.DELIMITER + "\\d+\\" + Request.DELIMITER + "\\d+" + Request.DELIMITER + "\\d+")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_identifier")); //$NON-NLS-1$                
+        }
+        
+        String[] identifierParts = MMRequest.buildIdentifierArray(identifier);
+
+        String connId = identifierParts[0];
+        long requestId = Long.parseLong(identifierParts[1]);
+        int nodeId = Integer.parseInt(identifierParts[2]);
+        int executionId = Integer.parseInt(identifierParts[3]);
+        AtomicRequestID id = new AtomicRequestID(new RequestID(connId, requestId), nodeId, executionId);
+
+        try {
+        	getManager().getDQP().cancelAtomicRequest(id);
+		} catch (MetaMatrixComponentException e) {
+			throw new AdminComponentException(e);
+		}
+    }
+
+    /** 
+     * @see org.teiid.adminapi.RuntimeStateAdmin#changeVDBStatus(java.lang.String, java.lang.String, int)
+     * @since 4.3
+     */
+    public void changeVDBStatus(String name, String version, int status) 
+        throws AdminException {
+    	super.changeVDBStatus(name, version, status);
+    }
+    
+        
+    @Override
+    public void terminateTransaction(String transactionId, String sessionId)
+    		throws AdminException {
+//    	TransactionService ts = getTransactionService();
+//    	if (ts != null) {
+//    		ts.terminateTransaction(transactionId, sessionId);
+//    	}
+    }
+    
+    @Override
+    public void terminateTransaction(Xid transactionId) throws AdminException {
+    	TransactionService ts = getTransactionService();
+    	if (ts != null) {
+    		ts.terminateTransaction(transactionId);
+    	}
+    }
+    
+}


Property changes on: branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/embedded/admin/DQPRuntimeStateAdminImpl.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/embedded/admin/DQPSecurityAdminImpl.java
===================================================================
--- branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/embedded/admin/DQPSecurityAdminImpl.java	                        (rev 0)
+++ branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/embedded/admin/DQPSecurityAdminImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,275 @@
+/*
+ * 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.dqp.embedded.admin;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.teiid.adminapi.AdminComponentException;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.AdminObject;
+import org.teiid.adminapi.AdminOptions;
+import org.teiid.adminapi.AdminProcessingException;
+import org.teiid.adminapi.Group;
+import org.teiid.adminapi.SecurityAdmin;
+import org.xml.sax.SAXException;
+
+import com.metamatrix.admin.api.exception.security.InvalidSessionException;
+import com.metamatrix.admin.api.exception.security.MetaMatrixSecurityException;
+import com.metamatrix.admin.objects.MMGroup;
+import com.metamatrix.admin.objects.MMRole;
+import com.metamatrix.api.exception.security.AuthorizationException;
+import com.metamatrix.api.exception.security.AuthorizationMgmtException;
+import com.metamatrix.api.exception.security.MembershipServiceException;
+import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
+import com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl;
+import com.metamatrix.platform.admin.api.EntitlementMigrationReport;
+import com.metamatrix.platform.security.api.AuthorizationPolicy;
+import com.metamatrix.platform.security.api.AuthorizationPolicyFactory;
+import com.metamatrix.platform.security.api.AuthorizationRealm;
+import com.metamatrix.platform.security.api.MetaMatrixPrincipal;
+import com.metamatrix.platform.security.api.MetaMatrixPrincipalName;
+
+
+/** 
+ * @since 4.3
+ */
+public class DQPSecurityAdminImpl  extends BaseAdmin implements SecurityAdmin {
+
+    public DQPSecurityAdminImpl(EmbeddedConnectionFactoryImpl manager) {
+        super(manager);
+    }
+    
+    /** 
+     * @see com.metamatrix.admin.api.server.ServerSecurityAdmin#addRoleToGroup(java.lang.String, java.lang.String)
+     * @since 4.3
+     */
+    public void assignRoleToGroup(String roleIdentifier, String groupIdentifier) throws AdminException {
+    	throw new AdminComponentException(DQPEmbeddedPlugin.Util.getString("ServerSecurityAdminImpl.not_implemented")); //$NON-NLS-1$
+    }
+    
+    /** 
+     * @see com.metamatrix.admin.api.server.ServerSecurityAdmin#removeRoleFromGroup(java.lang.String, java.lang.String)
+     * @since 4.3
+     */
+    public void removeRoleFromGroup(String roleIdentifier, String groupIdentifier) throws AdminException {
+    	throw new AdminComponentException(DQPEmbeddedPlugin.Util.getString("ServerSecurityAdminImpl.not_implemented")); //$NON-NLS-1$
+    }
+    
+    /** 
+     * @see com.metamatrix.admin.api.server.ServerSecurityAdmin#getGroupsForUser(java.lang.String, boolean)
+     * @since 4.3
+     */
+    public Collection<Group> getGroupsForUser(String userIdentifier) throws AdminException {
+        if (userIdentifier == null) {
+            throwProcessingException("AdminImpl.requiredparameter", new Object[] {}); //$NON-NLS-1$
+        }
+        
+        if ( userIdentifier.equals(AdminObject.WILDCARD) ) {
+            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("ServerSecurityAdminImpl.Cant_use_wildcard")); //$NON-NLS-1$
+        }
+        Collection groups = new ArrayList();
+        // Get all memberships - explicit and implicit
+        Set allMemberships = null;
+        try {
+            allMemberships = getMembershipService().getGroupsForUser(userIdentifier);
+        } catch (MetaMatrixSecurityException e) {
+            throw new AdminComponentException(e);
+        }
+        Iterator allMembershipsItr = allMemberships.iterator();
+        while ( allMembershipsItr.hasNext() ) {
+            groups.add(new MMGroup(new String[] {(String)allMembershipsItr.next()}));
+        }
+        return groups;
+    }
+
+    /** 
+     * @see com.metamatrix.admin.api.server.ServerSecurityAdmin#getGroups(java.lang.String)
+     * @since 4.3
+     */
+    public Collection<Group> getGroups(String groupIdentifier) throws AdminException {
+        if (groupIdentifier == null) {
+            throwProcessingException("AdminImpl.requiredparameter", new Object[] {}); //$NON-NLS-1$
+        }
+        
+        Collection<Group> groups = new ArrayList<Group>();
+        Collection allGroups = null;
+        // Add all groups from internal membership domain
+        try {
+            allGroups = getMembershipService().getGroupNames();
+        } catch (MetaMatrixSecurityException e) {
+        	throw new AdminComponentException(e);
+        }
+
+        Iterator groupItr = allGroups.iterator();
+        while ( groupItr.hasNext() ) {
+            String groupName = (String) groupItr.next();
+
+            if (!groupIdentifier.equals(AdminObject.WILDCARD) && !groupName.equals(groupIdentifier)) {
+                continue;
+            }
+
+            groups.add(new MMGroup(new String[] {groupName}));
+        }
+        return groups;
+    }
+
+
+    /** 
+     * @see com.metamatrix.admin.api.server.ServerSecurityAdmin#getRolesForGroup(java.lang.String)
+     * @since 4.3
+     */
+    public Collection getRolesForGroup(String groupIdentifier) throws AdminException {
+        if (groupIdentifier == null) {
+            throwProcessingException("AdminImpl.requiredparameter", new Object[] {}); //$NON-NLS-1$
+        }
+        
+        if ( groupIdentifier.equals(AdminObject.WILDCARD) ) {
+            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("ServerSecurityAdminImpl.Cant_use_wildcard")); //$NON-NLS-1$
+        }
+        Collection roleNames = null;
+        try {
+            roleNames = getAuthorizationService().getRoleNamesForPrincipal(new MetaMatrixPrincipalName(groupIdentifier, MetaMatrixPrincipal.TYPE_GROUP));
+        } catch (InvalidSessionException e) {
+        	throw new AdminComponentException(e);
+        } catch (AuthorizationMgmtException e) {
+        	throw new AdminComponentException(e);
+        } catch (AuthorizationException e) {
+        	throw new AdminComponentException(e);
+        }
+        Collection roles = new ArrayList();
+        Iterator roleNameItr = roleNames.iterator();
+        while ( roleNameItr.hasNext() ) {
+             String roleName = (String)roleNameItr.next();
+             roles.add(new MMRole(new String[] {roleName}));
+        }
+        return roles;
+    }
+       
+    /**
+     * @see com.metamatrix.admin.api.server.ServerSecurityAdmin#importDataRoles(java.lang.String, java.lang.String, char[], org.teiid.adminapi.AdminOptions)
+     */
+    public String importDataRoles(String vdbName, String vdbVersion, char[] xmlContents, AdminOptions options) 
+        throws AdminException{
+        
+        if (vdbName == null) {
+            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("ServerSecurityAdminImpl.vdbName_can_not_be_null")); //$NON-NLS-1$
+        }
+        
+        if (vdbVersion == null) {
+            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("ServerSecurityAdminImpl.vdbVersion_can_not_be_null")); //$NON-NLS-1$
+        }
+        
+        if (options == null) {
+            
+            options = new AdminOptions(AdminOptions.OnConflict.IGNORE);
+        }
+
+        try {
+        	EntitlementMigrationReport rpt = new EntitlementMigrationReport("from file", vdbName + " " + vdbVersion); //$NON-NLS-1$ //$NON-NLS-2$
+        	
+            Collection<AuthorizationPolicy> roles = AuthorizationPolicyFactory.buildPolicies(vdbName, vdbVersion, xmlContents);
+
+            AuthorizationRealm realm = new AuthorizationRealm(vdbName, vdbVersion);
+            
+            getAuthorizationService().updatePoliciesInRealm(realm, roles);
+
+            return rpt.toString();
+        } catch (AuthorizationMgmtException e) {
+        	throw new AdminProcessingException(e);
+   		} catch (SAXException e) {
+   			throw new AdminComponentException(e);
+   		} catch (IOException e) {
+   			throw new AdminComponentException(e);
+   		} catch (ParserConfigurationException e) {
+   			throw new AdminComponentException(e);
+        }
+    }
+
+    /**
+     * @see com.metamatrix.admin.api.server.ServerSecurityAdmin#exportDataRoles(java.lang.String, java.lang.String)
+     */
+    public char[] exportDataRoles(String vdbName, String vdbVersion) throws AdminException {
+        
+        if (vdbName == null) {
+            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("ServerSecurityAdminImpl.vdbName_can_not_be_null")); //$NON-NLS-1$
+        }
+        
+        if (vdbVersion == null) {
+            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("ServerSecurityAdminImpl.vdbVersion_can_not_be_null")); //$NON-NLS-1$
+        }
+	     
+        Collection roles = null;
+		try {
+			roles = getAuthorizationService().getPoliciesInRealm(new AuthorizationRealm(vdbName, vdbVersion));
+			if (roles != null && !roles.isEmpty()) {
+				return AuthorizationPolicyFactory.exportPolicies(roles);
+			}
+			return null;
+		} catch (AuthorizationMgmtException e) {
+			throw new AdminProcessingException(e);
+		} catch (AuthorizationException e) {
+			throw new AdminProcessingException(e);
+		} catch (IOException e) {
+			throw new AdminComponentException(e);
+		}
+	}
+    
+    @Override
+    public List<String> getDomainNames() throws AdminException {
+    	try {
+			return this.getMembershipService().getDomainNames();
+		} catch (MembershipServiceException e) {
+			throw new AdminComponentException(e);
+		}
+    }
+    
+    @Override
+    public Collection<Group> getGroupsForDomain(String domainName)
+    		throws AdminException {
+        if (domainName == null) {
+            throwProcessingException("AdminImpl.requiredparameter", new Object[] {}); //$NON-NLS-1$
+        }
+        try {
+        	Collection<String> groupNames = this.getMembershipService().getGroupsForDomain(domainName);
+        	List<Group> result = new ArrayList<Group>(groupNames.size());
+        	for (String groupName : groupNames) {
+        		result.add(new MMGroup(new String[] {groupName}));
+			}
+        	return result;
+        } catch (MembershipServiceException e) {
+        	throw new AdminComponentException(e);
+        }
+    }
+    
+     void throwProcessingException(String key, Object[] objects) throws AdminException {
+        throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString(key, objects));
+    }    
+ 
+}


Property changes on: branches/JCA/jboss-integration/src/main/java/com/metamatrix/dqp/embedded/admin/DQPSecurityAdminImpl.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: branches/JCA/jboss-integration/src/test/java/com/metamatrix/dqp/embedded/admin/TestBaseAdmin.java
===================================================================
--- branches/JCA/jboss-integration/src/test/java/com/metamatrix/dqp/embedded/admin/TestBaseAdmin.java	                        (rev 0)
+++ branches/JCA/jboss-integration/src/test/java/com/metamatrix/dqp/embedded/admin/TestBaseAdmin.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,101 @@
+/*
+ * 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.dqp.embedded.admin;
+
+import junit.framework.TestCase;
+
+
+/** 
+ * @since 4.3
+ */
+public class TestBaseAdmin extends TestCase {
+
+    public void testRegexStuff() {
+        assertTrue("RegEx Failed", "one".matches(BaseAdmin.MULTIPLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertTrue("RegEx Failed", "one two".matches(BaseAdmin.MULTIPLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertFalse("RegEx Failed", "one two three ".matches(BaseAdmin.MULTIPLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertTrue("RegEx Failed", "one9_two_Three".matches(BaseAdmin.MULTIPLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertFalse("RegEx Failed", "one9_two*Three".matches(BaseAdmin.MULTIPLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertFalse("RegEx Failed", "#one9_two Three".matches(BaseAdmin.MULTIPLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        
+        assertTrue("RegEx Failed", "one".matches(BaseAdmin.SINGLE_WORD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertFalse("RegEx Failed", "one ".matches(BaseAdmin.SINGLE_WORD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertFalse("RegEx Failed", "one*".matches(BaseAdmin.SINGLE_WORD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertFalse("RegEx Failed", "one two".matches(BaseAdmin.SINGLE_WORD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertTrue("RegEx Failed", "one_TWO_three".matches(BaseAdmin.SINGLE_WORD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        
+        assertTrue("RegEx Failed", "one*".matches(BaseAdmin.MULTIPLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertTrue("RegEx Failed", "one two*".matches(BaseAdmin.MULTIPLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertFalse("RegEx Failed", "one two *".matches(BaseAdmin.MULTIPLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertFalse("RegEx Failed", "*one two*".matches(BaseAdmin.MULTIPLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertTrue("RegEx Failed", "*".matches(BaseAdmin.MULTIPLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertFalse("RegEx Failed", "#two*".matches(BaseAdmin.MULTIPLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertFalse("RegEx Failed", "one.*".matches(BaseAdmin.MULTIPLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertTrue("RegEx Failed", "one.two".matches(BaseAdmin.MULTIPLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertTrue("RegEx Failed", "one.two*".matches(BaseAdmin.MULTIPLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        
+        
+        assertTrue("RegEx Failed", "*".matches(BaseAdmin.SINGLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertTrue("RegEx Failed", "one*".matches(BaseAdmin.SINGLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertTrue("RegEx Failed", "one_TWO_three*".matches(BaseAdmin.SINGLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertFalse("RegEx Failed", "*one".matches(BaseAdmin.SINGLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertFalse("RegEx Failed", "* one".matches(BaseAdmin.SINGLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertFalse("RegEx Failed", "*.*".matches(BaseAdmin.SINGLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertFalse("RegEx Failed", "one.*".matches(BaseAdmin.SINGLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+
+        
+        assertTrue("RegEx Failed", "*".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertTrue("RegEx Failed", "one.*".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertTrue("RegEx Failed", "one".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertTrue("RegEx Failed", "one.two".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertFalse("RegEx Failed", "*.one".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertFalse("RegEx Failed", "one_two *".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertTrue("RegEx Failed", "one.two*".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$       
+        assertTrue("RegEx Failed", "one.two*.three*".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$        
+        assertFalse("RegEx Failed", "one.two**".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$                       
+        assertTrue("RegEx Failed", "one.two.*".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$        
+        assertTrue("RegEx Failed", "one*".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertFalse("RegEx Failed", "one.".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertTrue("RegEx Failed", "0.10.*".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertFalse("RegEx Failed", "0.10..*".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertFalse("RegEx Failed", "0.10..".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertFalse("RegEx Failed", ".one*".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertFalse("RegEx Failed", ".one_two".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        
+        assertTrue("RegEx Failed", "One".matches(BaseAdmin.VDB_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertTrue("RegEx Failed", "One.1".matches(BaseAdmin.VDB_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertTrue("RegEx Failed", "*.1".matches(BaseAdmin.VDB_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertFalse("RegEx Failed", "One.One".matches(BaseAdmin.VDB_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertTrue("RegEx Failed", "One*".matches(BaseAdmin.VDB_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertTrue("RegEx Failed", "One*.101".matches(BaseAdmin.VDB_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertFalse("RegEx Failed", "*.*".matches(BaseAdmin.VDB_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertFalse("RegEx Failed", "100.*".matches(BaseAdmin.VDB_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertTrue("RegEx Failed", ".1".matches(BaseAdmin.VDB_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        //assertTrue("RegEx Failed", "V0.*".matches(BaseAdmin.VDB_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        
+        assertTrue("RegEx Failed", "XML-Relational File Connector".matches(BaseAdmin.MULTIPLE_WORDS_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertTrue("RegEx Failed", "XML Connector".matches(BaseAdmin.MULTIPLE_WORDS_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        assertFalse("RegEx Failed", "XML&Relational Connector".matches(BaseAdmin.MULTIPLE_WORDS_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+        //assertTrue("RegEx Failed", "".matches(BaseAdmin.MULTIPLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+}


Property changes on: branches/JCA/jboss-integration/src/test/java/com/metamatrix/dqp/embedded/admin/TestBaseAdmin.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: branches/JCA/metadata/pom.xml
===================================================================
--- branches/JCA/metadata/pom.xml	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/metadata/pom.xml	2009-11-02 19:41:28 UTC (rev 1544)
@@ -39,6 +39,11 @@
       <artifactId>teiid-client</artifactId>
     </dependency>
     
+    <dependency>
+      <groupId>javax.resource</groupId>
+      <artifactId>connector-api</artifactId>
+      <scope>provided</scope>
+    </dependency>    
   </dependencies>
   
 </project>
\ No newline at end of file

Modified: branches/JCA/metadata/src/main/java/org/teiid/metadata/QueryMetadataCache.java
===================================================================
--- branches/JCA/metadata/src/main/java/org/teiid/metadata/QueryMetadataCache.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/metadata/src/main/java/org/teiid/metadata/QueryMetadataCache.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -192,7 +192,7 @@
 		        		}
 		        	}
 		        	if (connectorMetadata == null) {
-		        		connectorMetadata = dataService.getConnectorMetadata(vdbID.getName(), vdbID.getVersion(), modelName, runtimeSelector.getModelInfo(modelName).getProperties());
+		        		connectorMetadata = dataService.getConnectorMetadata(vdbID.getName(), vdbID.getVersion(), modelName);
 		        	}
 		        	if (runtimeSelector.cacheConnectorMetadata()) {
 		        		ByteArrayOutputStream baos = new ByteArrayOutputStream();

Modified: branches/JCA/pom.xml
===================================================================
--- branches/JCA/pom.xml	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/pom.xml	2009-11-02 19:41:28 UTC (rev 1544)
@@ -79,15 +79,21 @@
 						<version>2.2-beta-2</version>
 						<configuration>
 							<descriptors>
+                                <!--  
 								<descriptor>build/assembly/src.xml</descriptor>
+                                -->
 								<descriptor>build/assembly/client-jar.xml</descriptor>
+                                <descriptor>build/assembly/jboss-container/dependencies.xml</descriptor>
+                                <descriptor>build/assembly/jboss-container/connectors.xml</descriptor>
+                                <descriptor>build/assembly/jboss-container/dist.xml</descriptor>
+                                <!--
 								<descriptor>build/assembly/runtime/dependencies.xml</descriptor>
 								<descriptor>build/assembly/runtime/dist.xml</descriptor>
 								<descriptor>build/assembly/cdk/cdk-dependencies.xml</descriptor>
 								<descriptor>build/assembly/cdk/cdk-dist.xml</descriptor>
                                 <descriptor>build/assembly/adminshell/adminshell-dependencies.xml</descriptor>
                                 <descriptor>build/assembly/adminshell/adminshell-dist.xml</descriptor>
-                                <!-- 
+                                 
 								<descriptor>documentation/assembly/docs.xml</descriptor>
                                  -->
 							</descriptors>
@@ -99,7 +105,9 @@
 			</build>
 			<modules>
                 <module>build</module>
+                <!-- 
 				<module>documentation</module>
+                 -->
 			</modules>
 		</profile>
 	</profiles>
@@ -341,6 +349,11 @@
 				<artifactId>teiid-connector-metadata</artifactId>
 				<version>${project.version}</version>
 			</dependency>
+            <dependency>
+                <groupId>org.jboss.teiid</groupId>
+                <artifactId>teiid-jboss-integration</artifactId>
+                <version>${project.version}</version>
+            </dependency>            
       
       <!-- External dependencies -->
 			<dependency>
@@ -349,26 +362,6 @@
 				<version>1.0</version>
 			</dependency>
 			<dependency>
-				<groupId>jboss.jbossts</groupId>
-				<artifactId>jbossjta-integration</artifactId>
-				<version>4.3.0.GA</version>
-			</dependency>
-			<dependency>
-				<groupId>jboss.jbossts</groupId>
-				<artifactId>jbossts-common</artifactId>
-				<version>4.3.0.GA</version>
-			</dependency>
-			<dependency>
-				<groupId>jboss.jbossts</groupId>
-				<artifactId>jbossjta</artifactId>
-				<version>4.3.0.GA</version>
-			</dependency>
-			<dependency>
-				<groupId>javax.transaction</groupId>
-				<artifactId>jta</artifactId>
-				<version>1.1</version>
-			</dependency>
-			<dependency>
 				<groupId>javax.resource</groupId>
 				<artifactId>connector-api</artifactId>
 				<version>1.5</version>
@@ -445,6 +438,12 @@
 		</dependencies>
 	</dependencyManagement>
 	<modules>
+        <!-- 
+        <module>txn-jbossts</module>
+        <module>connector-sdk</module>
+		<module>test-integration</module>
+        <module>jboss-integration</module>
+         -->
 		<module>common-core</module>
 		<module>common-internal</module>
 		<module>connector-api</module>
@@ -453,14 +452,12 @@
 		<module>engine</module>
 		<module>connectors</module>
 		<module>metadata</module>
-		<module>txn-jbossts</module>
-		<module>connector-sdk</module>
 		<module>runtime</module>
 		<module>adminshell</module>
-		<module>test-integration</module>
 		<module>connector-metadata</module>
 		<module>cache-jbosscache</module>
 		<module>hibernate-dialect</module>
+        
 	</modules>
 	<distributionManagement>
 		<repository>

Modified: branches/JCA/runtime/pom.xml
===================================================================
--- branches/JCA/runtime/pom.xml	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/pom.xml	2009-11-02 19:41:28 UTC (rev 1544)
@@ -41,10 +41,12 @@
       <artifactId>teiid-engine</artifactId>
       <type>test-jar</type>
     </dependency>
+    <!-- Will open this later on once runtime is fixed
     <dependency>
       <groupId>org.jboss.teiid</groupId>
-      <artifactId>teiid-txn-jbossts</artifactId>
+      <artifactId>teiid-jboss-integration</artifactId>
     </dependency>
+     -->    
     <dependency>
       <groupId>org.jboss.teiid</groupId>
       <artifactId>teiid-metadata</artifactId>
@@ -64,6 +66,7 @@
     <dependency>
       <groupId>log4j</groupId>
       <artifactId>log4j</artifactId>
+      <scope>provided</scope>
     </dependency>    
     <dependency>
         <groupId>commons-logging</groupId>
@@ -74,5 +77,16 @@
         <artifactId>netty</artifactId>
     </dependency>
         
+    <dependency>
+        <groupId>org.jboss.cache</groupId>
+        <artifactId>jbosscache-core</artifactId>
+        <scope>test</scope>
+    </dependency>        
+    
+    <dependency>
+      <groupId>javax.resource</groupId>
+      <artifactId>connector-api</artifactId>
+      <scope>provided</scope>
+    </dependency>    
   </dependencies>
 </project>
\ No newline at end of file

Deleted: branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java
===================================================================
--- branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/BaseAdmin.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,655 +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.dqp.embedded.admin;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import org.teiid.adminapi.AdminComponentException;
-import org.teiid.adminapi.AdminException;
-import org.teiid.adminapi.AdminObject;
-import org.teiid.adminapi.AdminProcessingException;
-import org.teiid.adminapi.Cache;
-import org.teiid.adminapi.ExtensionModule;
-import org.teiid.adminapi.Session;
-import org.teiid.dqp.internal.process.DQPWorkContext;
-import org.teiid.dqp.internal.process.Util;
-
-import com.metamatrix.admin.objects.MMConnectorBinding;
-import com.metamatrix.admin.objects.MMConnectorType;
-import com.metamatrix.admin.objects.MMExtensionModule;
-import com.metamatrix.admin.objects.MMLogConfiguration;
-import com.metamatrix.admin.objects.MMModel;
-import com.metamatrix.admin.objects.MMPropertyDefinition;
-import com.metamatrix.admin.objects.MMRequest;
-import com.metamatrix.admin.objects.MMSession;
-import com.metamatrix.admin.objects.MMVDB;
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.api.exception.security.SessionServiceException;
-import com.metamatrix.common.application.exception.ApplicationLifecycleException;
-import com.metamatrix.common.config.api.ComponentType;
-import com.metamatrix.common.config.api.ComponentTypeDefn;
-import com.metamatrix.common.config.api.ConnectorBinding;
-import com.metamatrix.common.log.LogConfigurationImpl;
-import com.metamatrix.common.object.PropertyDefinition;
-import com.metamatrix.common.util.crypto.CryptoException;
-import com.metamatrix.common.util.crypto.CryptoUtil;
-import com.metamatrix.common.vdb.api.VDBArchive;
-import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
-import com.metamatrix.dqp.service.AuthorizationService;
-import com.metamatrix.dqp.service.ConfigurationService;
-import com.metamatrix.dqp.service.ConnectorStatus;
-import com.metamatrix.dqp.service.DQPServiceNames;
-import com.metamatrix.dqp.service.DataService;
-import com.metamatrix.dqp.service.TransactionService;
-import com.metamatrix.dqp.service.VDBService;
-import com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl;
-import com.metamatrix.platform.security.api.MetaMatrixSessionInfo;
-import com.metamatrix.platform.security.api.SessionToken;
-import com.metamatrix.platform.security.api.service.MembershipServiceInterface;
-import com.metamatrix.platform.security.api.service.SessionServiceInterface;
-import com.metamatrix.platform.util.ProductInfoConstants;
-import com.metamatrix.server.serverapi.RequestInfo;
-
-
-/** 
- * @since 4.3
- */
-abstract class BaseAdmin {
-    static final String DOT = "."; //$NON-NLS-1$
-    static final String STAR = "*"; //$NON-NLS-1$
-    static final String FILE_NAME_REGEX="\\w+\\.\\w+"; //$NON-NLS-1$
-    static final String MULTIPLE_WORDS_REGEX = "\\w+([\\s|-]*\\w)*"; //$NON-NLS-1$
-    static final String SINGLE_WORD_REGEX = "\\w+"; //$NON-NLS-1$    
-    static final String MULTIPLE_WORD_WILDCARD_REGEX = "\\w*((\\.)?\\s*\\w)*(\\*)?"; //$NON-NLS-1$
-    static final String SINGLE_WORD_WILDCARD_REGEX = "\\w*(\\*)?"; //$NON-NLS-1$
-    // This should find word.word.* or word.* kind of patterns (ugly, you can rewrite) 
-    static final String WORD_AND_DOT_WILDCARD_REGEX = "\\w+((\\.\\*)|(\\.\\w+)|(\\.\\w*\\*))*|\\w*(\\*){1}"; //$NON-NLS-1$
-    
-    static final String VDB_REGEX = "\\w*(\\*)?(\\.\\d+)?"; //$NON-NLS-1$
-    static final String NUMBER_DOT_REGEX = "\\d+((\\.\\*)|(\\.\\d+)|(\\.\\d*\\*))*|\\d*(\\*){1}"; //$NON-NLS-1$
-    static final String NUMBER_REGEX = "\\d*(\\*)?"; //$NON-NLS-1$
-        
-    static final String[] cacheTypes = {Cache.CODE_TABLE_CACHE, 
-        Cache.CONNECTOR_RESULT_SET_CACHE,
-        Cache.PREPARED_PLAN_CACHE,
-        Cache.QUERY_SERVICE_RESULT_SET_CACHE
-        };    
-    
-    private EmbeddedConnectionFactoryImpl manager = null; 
-    
-    BaseAdmin(EmbeddedConnectionFactoryImpl manager){
-        this.manager = manager;       
-    }
-            
-    protected AdminException accumulateSystemException(AdminException parent, Exception e) {
-        if (parent == null) {
-            return new AdminComponentException(e); 
-        }
-        parent.addChild(new AdminComponentException(e));
-        return parent;
-    }
-    
-    protected AdminException accumulateProcessingException(AdminException parent, Exception e) {
-        if (parent == null) {
-            return new AdminProcessingException(e); 
-        }
-        parent.addChild(new AdminProcessingException(e));
-        return parent;
-    }
-    
-    protected String prettyPrintBindingNames(List bindings) {
-        StringBuffer buffer = new StringBuffer();
-        for (Iterator iter = bindings.iterator(); iter.hasNext();) {
-            ConnectorBinding binding = (ConnectorBinding) iter.next();
-            buffer.append(binding.getDeployedName());
-            if (iter.hasNext()) {
-                buffer.append(", "); //$NON-NLS-1$
-            }
-        }
-        
-        return buffer.toString();
-    }
-    
-    /** 
-     * @return Returns the manager.
-     * @since 4.3
-     */
-    public EmbeddedConnectionFactoryImpl getManager() {
-        return this.manager;
-    }
-    
-    VDBService getVDBService() {
-        return (VDBService)getManager().findService(DQPServiceNames.VDB_SERVICE);            
-    }
-    
-    DataService getDataService() {
-        return (DataService)getManager().findService(DQPServiceNames.DATA_SERVICE);
-    }
-    
-    TransactionService getTransactionService() {
-    	return (TransactionService)getManager().findService(DQPServiceNames.TRANSACTION_SERVICE);
-    }
-
-    MembershipServiceInterface getMembershipService() {
-    	return (MembershipServiceInterface)getManager().findService(DQPServiceNames.MEMBERSHIP_SERVICE);
-    }
-    
-    AuthorizationService getAuthorizationService() {
-    	return (AuthorizationService)getManager().findService(DQPServiceNames.AUTHORIZATION_SERVICE);
-    }
-    
-    ConfigurationService getConfigurationService() {
-        return (ConfigurationService)getManager().findService(DQPServiceNames.CONFIGURATION_SERVICE);
-    }
-    
-    SessionServiceInterface getSessionService() {
-        return (SessionServiceInterface)getManager().findService(DQPServiceNames.SESSION_SERVICE);
-    }
-        
-    protected Object convertToAdminObjects(Object src) {
-        return convertToAdminObjects(src,null);
-    }
-    
-    protected Object convertToAdminObjects(Object src, Object parent) {
-        if (src == null) {
-            return src;
-        }
-        
-        if (src instanceof List) {
-            List modified = new ArrayList();
-            List list = (List)src;
-            for (final Iterator i = list.iterator(); i.hasNext();) {
-                final Object e = i.next();
-                Object converted = convertToAdminObject(e, parent);
-                modified.add(converted);
-            } 
-            return modified;
-        }
-        else if (src instanceof Collection) {
-            List modified = new ArrayList();
-            for (Iterator i = ((Collection)src).iterator(); i.hasNext();) {
-                final Object e = i.next();
-                Object converted = convertToAdminObject(e, parent);
-                modified.add(converted);
-            } 
-            return modified;
-        }
-        else if (src instanceof Object[] ) {
-            List modified = new ArrayList();
-            Object[] srcArray = (Object[])src;
-            for (int i = 0; i < srcArray.length; i++) {
-                final Object converted = convertToAdminObject(srcArray[i], parent);
-                modified.add(converted);                
-            }
-            return modified;
-        }
-        return convertToAdminObject(src, parent);
-    }    
-        
-    
-    private Object convertToAdminObject(Object src, Object parent) {
-        if (src != null && src instanceof com.metamatrix.common.config.api.ConnectorBinding) {
-            com.metamatrix.common.config.api.ConnectorBinding binding = (com.metamatrix.common.config.api.ConnectorBinding)src;
-            return convertConnectorType(binding, parent);
-        }
-        else if (src != null && src instanceof com.metamatrix.common.config.api.ConnectorBindingType) {
-            com.metamatrix.common.config.api.ConnectorBindingType type = (com.metamatrix.common.config.api.ConnectorBindingType)src;
-            return convertConnectorType(type, parent);
-        }
-        else if (src != null && src instanceof com.metamatrix.common.vdb.api.VDBDefn) {
-            com.metamatrix.common.vdb.api.VDBDefn vdb = (com.metamatrix.common.vdb.api.VDBDefn)src;
-            return convertVDB(vdb, parent);
-        }
-        else if (src != null && src instanceof VDBArchive) {
-        	VDBArchive vdb = (VDBArchive)src;
-            return convertVDB(vdb.getConfigurationDef(), parent);
-        }        
-        else if (src != null && src instanceof com.metamatrix.common.vdb.api.ModelInfo) {
-            com.metamatrix.common.vdb.api.ModelInfo model = (com.metamatrix.common.vdb.api.ModelInfo)src;
-            return convertModel(model, parent);
-        }
-        else if (src != null && src instanceof com.metamatrix.common.log.LogConfiguration) {
-            com.metamatrix.common.log.LogConfiguration config = (com.metamatrix.common.log.LogConfiguration)src;
-            return covertLogConfiguration(config);
-        }
-        else if (src != null && src instanceof com.metamatrix.server.serverapi.RequestInfo) {
-        	com.metamatrix.server.serverapi.RequestInfo request = (com.metamatrix.server.serverapi.RequestInfo)src;
-            return convertRequest(request);
-        }
-        else if (src != null && src instanceof com.metamatrix.common.queue.WorkerPoolStats) {
-            com.metamatrix.common.queue.WorkerPoolStats stats = (com.metamatrix.common.queue.WorkerPoolStats)src;
-            return Util.convertStats(stats, stats.getQueueName());
-        }
-        else if (src != null && src instanceof MetaMatrixSessionInfo) {
-        	MetaMatrixSessionInfo conn = (MetaMatrixSessionInfo)src;
-            return convertConnection(conn);
-        }
-        else if (src != null && src instanceof com.metamatrix.common.config.api.ExtensionModule) {
-            com.metamatrix.common.config.api.ExtensionModule extModule = (com.metamatrix.common.config.api.ExtensionModule)src;
-            return convertExtensionModule(extModule);
-        }         
-        else {
-        	if (src == null) {
-        		return null;
-        	}
-            throw new UnsupportedOperationException(DQPEmbeddedPlugin.Util.getString("UnSupported_object_conversion"));  //$NON-NLS-1$
-        }
-    }
-
-    Object convertToNativeObjects(Object src) {
-        if (src instanceof org.teiid.adminapi.LogConfiguration) {
-            org.teiid.adminapi.LogConfiguration config = (org.teiid.adminapi.LogConfiguration)src;
-            return covertToNativeLogConfiguration(config);
-        }
-        throw new UnsupportedOperationException(DQPEmbeddedPlugin.Util.getString("UnSupported_object_conversion"));  //$NON-NLS-1$            
-    }
-     
-    
-    private ExtensionModule convertExtensionModule(com.metamatrix.common.config.api.ExtensionModule src) {
-        MMExtensionModule module = new MMExtensionModule(new String[] {src.getFullName()}) ;
-        module.setDescription(src.getDescription());
-        module.setFileContents(src.getFileContents());
-        module.setModuleType(src.getModuleType());
-        return module;
-    }
-    
-    private Session convertConnection(MetaMatrixSessionInfo src) {
-        MMSession session = new MMSession(new String[] {src.getSessionID().toString()});
-        session.setVDBName(src.getProductInfo(ProductInfoConstants.VIRTUAL_DB));
-        session.setVDBVersion(src.getProductInfo(ProductInfoConstants.VDB_VERSION)); 
-        session.setApplicationName(src.getApplicationName());
-        session.setIPAddress(src.getClientIp());
-        session.setHostName(src.getClientHostname());
-        session.setUserName(src.getUserName());
-        session.setLastPingTime(src.getLastPingTime());
-        session.setCreated(new Date(src.getTimeCreated()));
-        return session;
-    }
-    
-    /**
-     * Convert LogConfiguration to Admin Object 
-     */
-    private org.teiid.adminapi.LogConfiguration covertLogConfiguration(final com.metamatrix.common.log.LogConfiguration src) {
-    	Map<String, Integer> contextMap = new HashMap<String, Integer>();
-    	for(String context:src.getContexts()) {
-    		contextMap.put(context, src.getLogLevel(context));
-    	}
-        return new MMLogConfiguration(contextMap);
-    }
-
-    /**
-     * Convert LogConfiguration to Admin Object 
-     */
-    private com.metamatrix.common.log.LogConfiguration covertToNativeLogConfiguration(final org.teiid.adminapi.LogConfiguration src) {
-    	Map<String, Integer> contextMap = new HashMap<String, Integer>();
-    	for(String context:src.getContexts()) {
-    		contextMap.put(context, src.getLogLevel(context));
-    	}
-    	return new LogConfigurationImpl(contextMap);
-    }
-
-    /** 
-     * @param binding
-     * @return
-     * @since 4.3
-     */
-    private org.teiid.adminapi.ConnectorBinding convertConnectorType(final com.metamatrix.common.config.api.ConnectorBinding src, final Object parent) {
-        MMConnectorBinding binding = new MMConnectorBinding(new String[] {src.getDeployedName()});
-        
-        binding.setConnectorTypeName(src.getComponentTypeID().getFullName());
-        binding.setCreated(src.getCreatedDate());
-        binding.setCreatedBy(src.getCreatedBy());
-        binding.setDescription(src.getDescription());
-        binding.setEnabled(src.isEnabled());
-        binding.setLastUpdated(src.getLastChangedDate());
-        binding.setLastUpdatedBy(src.getLastChangedBy());
-        binding.setProperties(src.getProperties());
-        binding.setRegistered(true);
-        binding.setRoutingUUID(src.getRoutingUUID());
-        binding.setServiceID(0); // TODO:
-        
-        // Binding state needs to be converted into pool state; until then we use
-        // binding state  as pool state.
-        try {
-        	ConnectorStatus status = getDataService().getConnectorBindingState(src.getDeployedName());
-        	switch(status) {
-        	case OPEN:
-        		binding.setState(org.teiid.adminapi.ConnectorBinding.STATE_OPEN);
-        		break;
-        	case NOT_INITIALIZED:
-        		binding.setState(org.teiid.adminapi.ConnectorBinding.STATE_NOT_INITIALIZED);
-        		break;
-        	case CLOSED:
-        		binding.setState(org.teiid.adminapi.ConnectorBinding.STATE_CLOSED);
-        		break;
-        	case DATA_SOURCE_UNAVAILABLE:
-        		binding.setState(org.teiid.adminapi.ConnectorBinding.STATE_DATA_SOURCE_UNAVAILABLE);
-        		break;
-        	case INIT_FAILED:
-        		binding.setState(org.teiid.adminapi.ConnectorBinding.STATE_INIT_FAILED);
-        		break;
-        	case UNABLE_TO_CHECK:
-        		binding.setState(org.teiid.adminapi.ConnectorBinding.STATE_FAILED_TO_CHECK);
-        		break;
-        	}        	
-        }catch(MetaMatrixComponentException e) {
-            binding.setState(org.teiid.adminapi.ConnectorBinding.STATE_NOT_DEPLOYED);            
-        }
-        binding.setStateChangedTime(src.getLastChangedDate());
-        return binding;       
-    }
-
-    /** 
-     * @param type
-     * @return
-     * @since 4.3
-     */
-    private org.teiid.adminapi.ConnectorType convertConnectorType(final com.metamatrix.common.config.api.ConnectorBindingType src, final Object parent) {
-        MMConnectorType type = new MMConnectorType(new String[] {src.getName()});
-        type.setCreated(src.getCreatedDate());
-        type.setCreatedBy(src.getCreatedBy());
-        type.setEnabled(true);
-        type.setLastUpdated(src.getLastChangedDate());
-        type.setRegistered(true);
-        
-        return type;       
-    }
-
-    /** 
-     * @param vdb
-     * @return
-     * @since 4.3
-     */
-    private org.teiid.adminapi.VDB convertVDB(final com.metamatrix.common.vdb.api.VDBDefn src, final Object parent) {
-        
-        MMVDB vdb = new MMVDB(new String[] {src.getName(), src.getVersion()});
-        vdb.setCreated(src.getDateCreated());
-        vdb.setCreatedBy(src.getCreatedBy());
-        vdb.setEnabled(src.isActiveStatus());
-        vdb.setLastUpdated(src.getDateCreated());
-        vdb.setLastUpdatedBy(src.getCreatedBy());
-        vdb.setMaterializedViews(src.getMatertializationModel() != null);
-        vdb.setModels((Collection)convertToAdminObjects(src.getModels(), src));
-        vdb.setProperties(null);
-        vdb.setRegistered(true);
-        vdb.setStatus(src.getStatus());
-        vdb.setUID(0); // TODO: src.getUUID());
-        vdb.setVersionedBy(src.getCreatedBy());
-        vdb.setVersionedDate(src.getDateCreated());
-        vdb.setHasWSDL(src.hasWSDLDefined());
-        
-        return vdb;        
-    }
-    
-    private org.teiid.adminapi.Model convertModel(final com.metamatrix.common.vdb.api.ModelInfo src, final Object parent) {
-        final com.metamatrix.common.vdb.api.VDBDefn vdb = (com.metamatrix.common.vdb.api.VDBDefn)parent;
-        MMModel model = new MMModel(new String[] {src.getName()});
-        model.setCreated(vdb.getDateCreated());
-        model.setCreatedBy(vdb.getCreatedBy());
-        model.setEnabled(vdb.isActiveStatus());
-        model.setLastUpdated(vdb.getDateCreated());
-        model.setLastUpdatedBy(vdb.getCreatedBy());
-        model.setModelType(src.getModelTypeName());
-        model.setModelURI(src.getModelURI());
-        model.setMaterialization(src.isMaterialization());
-        model.setPhysical(src.isPhysical());
-        model.setRegistered(true);        
-        model.setSupportsMultiSourceBindings(src.isMultiSourceBindingEnabled());
-        model.setVisible(src.isVisible());
-        if (src.isPhysical()) {
-            List bindings = src.getConnectorBindingNames();
-            if (bindings != null && !bindings.isEmpty()) {
-                List names = new ArrayList();
-                for (int i=0; i<bindings.size();i++) {
-                    names.add(convertToAdminObject(vdb.getConnectorBindingByName((String)bindings.get(i)), parent));
-                }
-                model.setConnectorBindingNames(names);
-            }
-        }
-        return model;
-    }
-
-    private org.teiid.adminapi.Request convertRequest(final RequestInfo src) {
-        
-        String connId = src.getRequestID().getConnectionID();
-        
-        MMRequest request = null;
-        if (src.getConnectorBindingUUID() != null) {
-            request = new MMRequest(new String[] {connId, String.valueOf(src.getRequestID().getExecutionID()), String.valueOf(src.getNodeID()), String.valueOf(src.getExecutionID())}); 
-        }
-        else {
-            request = new MMRequest(new String[] {connId, String.valueOf(src.getRequestID().getExecutionID())}); 
-        }
-        
-        request.setSqlCommand(src.getCommand());
-        
-        request.setCreated(src.getProcessingTimestamp());
-        
-        if (src.getConnectorBindingUUID() != null) {
-            request.setSource(true);
-            request.setNodeID(String.valueOf(src.getNodeID()));
-        }
-        return request;
-    }
-    
-    /**
-     * Get the connection connection object for the given id. 
-     * @param identifier
-     * @return
-     * @since 4.3
-     */
-    MetaMatrixSessionInfo getClientConnection(String identifier) throws AdminException {
-        Collection<MetaMatrixSessionInfo> sessions = getClientConnections();
-        for (MetaMatrixSessionInfo info:sessions) {
-            if (info.getSessionID().toString().equals(identifier)) {
-                return info;
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Get all the available connections 
-     * @return
-     * @throws AdminException
-     */
-    Collection<MetaMatrixSessionInfo> getClientConnections() throws AdminException {
-        try {
-			return getSessionService().getActiveSessions();
-		} catch (SessionServiceException e) {
-			// SessionServiceException not in the client known exception (in common-internal)
-			throw new AdminComponentException(e.getMessage(), e.getCause());
-		}
-    }
-
-    boolean matches(String regEx, String value) {
-        regEx = regEx.replaceAll(AdminObject.ESCAPED_WILDCARD, ".*"); //$NON-NLS-1$ 
-        regEx = regEx.replaceAll(AdminObject.ESCAPED_DELIMITER, ""); //$NON-NLS-1$ 
-        return value.matches(regEx);
-    }
-    
-    List matchedCollection(String identifier, List adminObjects) {
-        ArrayList matched = new ArrayList();
-        for (Iterator i = adminObjects.iterator(); i.hasNext();) {
-            AdminObject aObj = (AdminObject)i.next();
-            if (matches(identifier, aObj.getName()) || matches(identifier, aObj.getIdentifier())) {
-                matched.add(aObj);
-            }
-        }        
-        return matched;
-    }
-    
-    /**
-     * Get list of available connector bindings 
-     * @param identifier
-     */
-    Collection getConnectorBindings(String identifier) throws AdminException{
-        try {
-            List connectorBindings = getDataService().getConnectorBindings();
-            connectorBindings = (List)convertToAdminObjects(connectorBindings);
-            return matchedCollection(identifier, connectorBindings);
-        } catch (MetaMatrixComponentException e) {
-            throw new AdminComponentException(e);
-        }
-    }
-    
-    
-    /**
-     * Get list of available connector types 
-     * @param identifier
-     */
-    Collection getConnectorTypes(String identifier) throws AdminException{
-   
-        try {
-            List connectorTypes = getConfigurationService().getConnectorTypes();
-            connectorTypes = (List)convertToAdminObjects(connectorTypes);
-            return matchedCollection(identifier, connectorTypes);
-        } catch (MetaMatrixComponentException err) {
-            throw new AdminComponentException(err);
-        } 
-    }
-
-    boolean isMaskedProperty(String  propName, ComponentType type) {
-        if (type != null) {
-            ComponentTypeDefn typeDef = type.getComponentTypeDefinition(propName);
-            if (typeDef != null && typeDef.getPropertyDefinition().isMasked()) {
-                return true;
-            }
-        }
-        return false;
-    }
-    
-    /**
-     * Encrypt a string 
-     * @param value
-     * @return
-     * @throws AdminException
-     * @since 4.3
-     */
-    String encryptString(String value) throws AdminException {
-        try {
-            return CryptoUtil.stringEncrypt(value);
-        } catch (CryptoException e) {
-            throw new AdminComponentException(e);
-        }
-    }
-    
-    
-    
-    /**
-     * Convert a ComponentType and a set of properties into a Collection of 
-     * com.metamatrix.admin.api.objects.PropertyDefinition objects
-     * @param ctype
-     * @param properties
-     * @return
-     * @since 4.3
-     */
-    protected Collection convertPropertyDefinitions(ComponentType ctype, Properties properties) {
-        ArrayList results = new ArrayList();
-        for (Iterator iter = ctype.getComponentTypeDefinitions().iterator(); iter.hasNext(); ) {
-            ComponentTypeDefn cdefn = (ComponentTypeDefn) iter.next();
-            PropertyDefinition pdefn = cdefn.getPropertyDefinition();
-                        
-            MMPropertyDefinition result = new MMPropertyDefinition(new String[] {pdefn.getName()});
-            result.setAllowedValues(pdefn.getAllowedValues());
-            result.setDefaultValue(pdefn.getDefaultValue());
-            result.setDescription(pdefn.getShortDescription());
-            result.setDisplayName(pdefn.getDisplayName());
-            result.setExpert(pdefn.isExpert());
-            result.setMasked(pdefn.isMasked());
-            result.setModifiable(pdefn.isModifiable());
-            result.setPropertyType(pdefn.getPropertyType().getDisplayName());
-            result.setPropertyTypeClassName(pdefn.getPropertyType().getClassName());
-            result.setRequired(pdefn.isRequired());
-            result.setRequiresRestart(pdefn.getRequiresRestart());
-            
-            String value = properties.getProperty(pdefn.getName());
-            result.setValue(value);
-            
-            results.add(result);
-        }
-        
-        
-        return results;
-    }
-    
-    
-    /**
-     * Convert a set of properties into a Collection of 
-     * com.metamatrix.admin.api.objects.PropertyDefinition objects
-     *  
-     * @param ctype
-     * @param properties
-     * @return
-     * @since 4.3
-     */
-    protected Collection convertPropertyDefinitions(Properties properties) {
-        ArrayList results = new ArrayList();
-        for (Iterator iter = properties.keySet().iterator(); iter.hasNext(); ) {
-            String key = (String) iter.next();
-            String value = properties.getProperty(key);
-                        
-            MMPropertyDefinition result = new MMPropertyDefinition(new String[] {key});
-            result.setDisplayName(key);
-            result.setValue(value);
-            
-            results.add(result);
-        }
-        
-        
-        return results;
-    }
-    
-    protected SessionToken validateSession() {
-        return DQPWorkContext.getWorkContext().getSessionToken();
-    }
-    
-    protected void changeVDBStatus(String name, String version, int status)
-			throws AdminException {
-		try {
-
-			if (name == null || version == null || !name.matches(SINGLE_WORD_REGEX)) {
-				throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_vdb_name")); //$NON-NLS-1$
-			}
-
-			// Now change the VDB status it self
-			this.getVDBService().changeVDBStatus(name, version, status);
-
-			// If the VDB is modified and if its status changed to DELETED, then
-			// we can remove all the connector bindings associated with this VDB
-			// the above delete will also remove them
-		} catch (ApplicationLifecycleException e) {
-			throw new AdminComponentException(e);
-		} catch (MetaMatrixComponentException e) {
-			throw new AdminComponentException(e);
-		}
-	}    
-    
-}

Deleted: branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java
===================================================================
--- branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPConfigAdminImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,1055 +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.dqp.embedded.admin;
-
-import java.io.IOException;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
-import java.util.StringTokenizer;
-
-import org.teiid.adminapi.AdminComponentException;
-import org.teiid.adminapi.AdminException;
-import org.teiid.adminapi.AdminOptions;
-import org.teiid.adminapi.AdminProcessingException;
-import org.teiid.adminapi.ConfigurationAdmin;
-import org.teiid.adminapi.EmbeddedLogger;
-import org.teiid.adminapi.LogConfiguration;
-import org.teiid.adminapi.VDB;
-
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.common.application.exception.ApplicationLifecycleException;
-import com.metamatrix.common.config.api.ComponentType;
-import com.metamatrix.common.config.api.ComponentTypeDefn;
-import com.metamatrix.common.config.api.ComponentTypeID;
-import com.metamatrix.common.config.api.ConnectorArchive;
-import com.metamatrix.common.config.api.ConnectorBinding;
-import com.metamatrix.common.config.api.ConnectorBindingType;
-import com.metamatrix.common.config.api.ExtensionModule;
-import com.metamatrix.common.config.model.BasicConnectorArchive;
-import com.metamatrix.common.config.model.BasicExtensionModule;
-import com.metamatrix.common.log.LogManager;
-import com.metamatrix.common.util.crypto.CryptoException;
-import com.metamatrix.common.util.crypto.CryptoUtil;
-import com.metamatrix.common.vdb.api.VDBArchive;
-import com.metamatrix.common.vdb.api.VDBDefn;
-import com.metamatrix.core.vdb.VDBStatus;
-import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
-import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
-import com.metamatrix.dqp.embedded.configuration.ConnectorConfigurationReader;
-import com.metamatrix.dqp.embedded.configuration.ConnectorConfigurationWriter;
-import com.metamatrix.dqp.embedded.configuration.VDBConfigurationReader;
-import com.metamatrix.dqp.service.ConfigurationService;
-import com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl;
-
-
-/** 
- * DQP implementation of the Config Admin API
- * @since 4.3
- */
-public class DQPConfigAdminImpl extends BaseAdmin implements ConfigurationAdmin {
-    
-    public DQPConfigAdminImpl(EmbeddedConnectionFactoryImpl manager) {
-        super(manager);
-    }
-
-    /** 
-     * @see org.teiid.adminapi.ConfigurationAdmin#setProperty(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
-     * @since 4.3
-     */
-    public void setConnectorBindingProperty(String deployedName, String propertyName, String propertyValue)
-        throws AdminException {
-
-        try {
-			ConnectorBinding binding = getConfigurationService().getConnectorBinding(deployedName);
-			if (binding == null) {
-				throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.cb_doesnot_exist", deployedName)); //$NON-NLS-1$
-			}
-			
-			ComponentTypeID id = binding.getComponentTypeID();
-			ConnectorBindingType type = getConfigurationService().getConnectorType(id.getName());
-			
-			boolean needsEncryption = isMaskedProperty(propertyName, type);
-			if (needsEncryption) {
-			    propertyValue = encryptString(propertyValue);
-			}
-			
-			Properties p = new Properties();
-			p.setProperty(propertyName, propertyValue);
-			
-			//update the configuration
-			binding = ConnectorConfigurationReader.addConnectorBindingProperties(binding, p);
-			getConfigurationService().updateConnectorBinding(binding);
-		} catch (MetaMatrixComponentException e) {
-			throw new AdminComponentException(e);
-		}
-    }
-    
-    /** 
-     * @see org.teiid.adminapi.ConfigurationAdmin#addConnectorType(java.lang.String, char[])
-     * @since 4.3
-     */
-    public void addConnectorType(String deployName, char[] cdkFile) 
-        throws AdminException {
-        try {
-            if (deployName == null || !deployName.matches(MULTIPLE_WORDS_REGEX)) {
-                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_ct_name")); //$NON-NLS-1$                
-            }
-            if (cdkFile == null || cdkFile.length == 0) {
-                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_ct_source")); //$NON-NLS-1$
-            }
-            
-            // This is only place we check the existence in admin. Generally the Admin is not the
-            // guy to decide, if it can take in or not, it should be the service. I did not 
-            // want add in the configuration service beacuse, it may need to allow this behavior 
-            // in case we are updating.  
-            if (getConfigurationService().getConnectorType(deployName) == null) {            
-                ConnectorBindingType type = ConnectorConfigurationReader.loadConnectorType(cdkFile);            
-                saveConnectorType(type);
-            }
-            else {
-                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Connector_type_exists", deployName)); //$NON-NLS-1$
-            }
-        } catch (MetaMatrixComponentException e) {
-        	throw new AdminComponentException(e);
-		}            
-    }
-
-    /** 
-     * @see org.teiid.adminapi.ConfigurationAdmin#deleteConnectorType(java.lang.String)
-     * @since 4.3
-     */
-    public void deleteConnectorType(String deployName) 
-        throws AdminException {
-        try {
-            if (deployName == null || !deployName.matches(MULTIPLE_WORDS_REGEX)) {
-                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_ct_name")); //$NON-NLS-1$                
-            }            
-            getConfigurationService().deleteConnectorType(deployName);
-        } catch (MetaMatrixComponentException e) {
-        	throw new AdminComponentException(e);
-		}         
-    }
-
-    /** 
-     * @see org.teiid.adminapi.ConfigurationAdmin#addConnectorBinding(java.lang.String, java.lang.String, java.util.Properties, AdminOptions)
-     * @since 4.3
-     */
-    public org.teiid.adminapi.ConnectorBinding addConnectorBinding(String deployName, String type, Properties properties, AdminOptions options) 
-        throws AdminException {
-        // if the options object is null treat as if it is IGNORE as default
-        if (options == null) {
-            options = new AdminOptions(AdminOptions.OnConflict.IGNORE);
-        }
-
-        if (deployName == null || !deployName.matches(MULTIPLE_WORDS_REGEX)) {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_cb_name")); //$NON-NLS-1$                
-        }
-        
-        if (type == null || !type.matches(MULTIPLE_WORDS_REGEX)) {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_ct_name")); //$NON-NLS-1$                
-        }
-                
-        ConnectorBinding binding = null;
-        try {
-            // Check if the binding exists already, if does take action based on user
-            // preferences in the admin options
-            if (bindingExists(deployName)) {
-                // Based on users preference, either add or replace or ignore 
-                if (options.containsOption(AdminOptions.OnConflict.EXCEPTION)) {
-                    throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.addBindingEixists", deployName)); //$NON-NLS-1$
-                }
-                else if (options.containsOption(AdminOptions.OnConflict.IGNORE)) {
-                    binding = getDataService().getConnectorBinding(deployName);
-                    return (org.teiid.adminapi.ConnectorBinding) convertToAdminObjects(binding);
-                }
-            }
-            
-            // Get the connector type
-            ConnectorBindingType ctype = getConfigurationService().getConnectorType(type);
-            if (ctype == null) {
-                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.connector_type_not_exists", type)); //$NON-NLS-1$
-            }
-            
-            // Build the connector binding with informatin we know.
-            binding = ConnectorConfigurationReader.loadConnectorBinding(deployName, properties, ctype);
-            
-            // Check that the connector binding passwords can be decrypted
-            try {
-            	checkDecryption(binding, ctype);
-            } catch(CryptoException e) {
-            	if (!options.containsOption(AdminOptions.BINDINGS_IGNORE_DECRYPT_ERROR)) {
-            		throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.CODE_DECRYPTION_FAILED", binding.getFullName())); //$NON-NLS-1$		
-            	}
-            }
-            
-            // now that all of the input parameters validated, add the connector binding
-            binding = addConnectorBinding(deployName, binding, ctype, false);
-            
-        } catch (MetaMatrixComponentException e) {
-        	throw new AdminComponentException(e);
-        }
-        return (org.teiid.adminapi.ConnectorBinding) convertToAdminObjects(binding);
-    }
-
-    boolean bindingExists(String name) throws MetaMatrixComponentException {
-        ConnectorBinding binding = getDataService().getConnectorBinding(name);
-        return (binding != null);
-    }
-    
-    boolean bindingTypeExists(String name) throws MetaMatrixComponentException {
-        ConnectorBindingType type = getConfigurationService().getConnectorType(name);
-        return (type != null);
-    }
-    
-    /** 
-     * @see org.teiid.adminapi.ConfigurationAdmin#addConnectorBinding(java.lang.String, char[], AdminOptions)
-     * @since 4.3
-     */
-    public org.teiid.adminapi.ConnectorBinding addConnectorBinding(String deployName, char[] xmlFile, AdminOptions options) 
-        throws AdminException {
-        
-        // if the options object is null treat as if it is IGNORE as default
-        if (options == null) {
-            options = new AdminOptions(AdminOptions.OnConflict.IGNORE);
-        }
-
-        if (deployName == null || !deployName.matches(MULTIPLE_WORDS_REGEX)) {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_cb_name")); //$NON-NLS-1$                
-        }
-        if (xmlFile == null || xmlFile.length == 0) {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_cb_source")); //$NON-NLS-1$
-        }
-                
-        ConnectorBinding binding = null;
-        try {
-            // Check if the binding exists already, if does take action based on user
-            // preferences in the admin options
-            if (bindingExists(deployName)) {
-                // Based on users preference, either add or replace or ignore 
-                if (options.containsOption(AdminOptions.OnConflict.EXCEPTION)) {
-                    throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.addBindingEixists", deployName)); //$NON-NLS-1$
-                }
-                else if (options.containsOption(AdminOptions.OnConflict.IGNORE)) {
-                    binding = getDataService().getConnectorBinding(deployName);
-                    return (org.teiid.adminapi.ConnectorBinding) convertToAdminObjects(binding);
-                }
-            }
-            
-            // now we are in situation we do have the connector or overwriting it.
-            // before we add the connector binding we need to add the connector type
-            // as the connector binding only references to type by identifier.
-            ConnectorBindingType type = ConnectorConfigurationReader.loadConnectorType(xmlFile);
-            
-            // Check if the binding type exists already, if does take action based on user
-            // preferences in the admin options, same rules apply as binding. 
-            boolean addType = true;
-            if (bindingTypeExists(type.getName())) {
-                if (options.containsOption(AdminOptions.OnConflict.EXCEPTION)) {
-                    throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.addBinding_type_exists", deployName, type.getName())); //$NON-NLS-1$
-                }
-                else if (options.containsOption(AdminOptions.OnConflict.IGNORE)) {
-                	addType = false;
-                }                
-            }
-            
-            binding = ConnectorConfigurationReader.loadConnectorBinding(deployName, xmlFile);
-            
-            // Check that the connector binding passwords can be decrypted
-            try {
-            	checkDecryption(binding, type);
-            } catch(CryptoException e) {
-            	if (!options.containsOption(AdminOptions.BINDINGS_IGNORE_DECRYPT_ERROR)) {
-            		throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.CODE_DECRYPTION_FAILED", binding.getFullName())); //$NON-NLS-1$		
-            	}
-            }
-
-            // now that all of the input parameters validated, add the connector binding
-            binding = addConnectorBinding(deployName, binding, type, addType);
-                                
-        } catch (MetaMatrixComponentException e) {
-        	throw new AdminComponentException(e);
-        }
-        
-        return (org.teiid.adminapi.ConnectorBinding) convertToAdminObjects(binding);
-    }
-
-    /**
-     * Helper method to add the connector binding.. 
-     * @param deployName
-     * @param binding
-     * @param type
-     * @param options
-     * @throws AdminException
-     */
-    ConnectorBinding addConnectorBinding(String deployName, ConnectorBinding binding, ConnectorBindingType type, boolean addType) 
-        throws AdminException {
-        // Make sure we have both correctly configured
-        if (type != null && binding != null) {
-            if (binding.getComponentTypeID().getName().equals(type.getName())) {
-                try {
-                    
-                    // First add the connector type if one is not already in here.
-                    if (getConfigurationService().getConnectorType(type.getName()) == null || addType) {
-                        saveConnectorType(type);
-                    }
-                    // Now add the connector binding.
-                    binding = getConfigurationService().addConnectorBinding(deployName, binding, true);
-                    return binding;
-                } catch (MetaMatrixComponentException e) {
-                	throw new AdminComponentException(e);
-                } 
-            }
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.connector_load_failed_wrong_type", deployName));  //$NON-NLS-1$                    
-        }
-        throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.connector_load_failed_wrong_contents", deployName));  //$NON-NLS-1$        
-    }
-    
-    /** 
-     * @see org.teiid.adminapi.ConfigurationAdmin#deleteConnectorBinding(java.lang.String)
-     * @since 4.3
-     */
-    public void deleteConnectorBinding(String identifier) 
-        throws AdminException {
-        try {
-            if (identifier == null || !identifier.matches(MULTIPLE_WORD_WILDCARD_REGEX)) {
-                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_cb_name")); //$NON-NLS-1$
-            }
-            getConfigurationService().deleteConnectorBinding(identifier);
-        } catch (MetaMatrixComponentException e) {
-        	throw new AdminComponentException(e);
-        }          
-    }
-
-    /** 
-     * @see org.teiid.adminapi.ConfigurationAdmin#addVDB(java.lang.String, byte[], char[], AdminOptions)
-     * @since 4.3
-     */
-    private VDB addVDB(String deployName, byte[] vdbFile, char[] defFile, AdminOptions options) 
-        throws AdminException {
-        
-        // if the options object is null treat as if it is BINDINGS_ADD as default
-        if (options == null) {
-            options = new AdminOptions(AdminOptions.OnConflict.IGNORE);
-        }
-        
-        if (deployName == null || !deployName.matches(SINGLE_WORD_REGEX)) {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_vdb_name")); //$NON-NLS-1$                
-        }
-        if (vdbFile == null || vdbFile.length == 0) {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_vdb_source")); //$NON-NLS-1$
-        }        
-        
-        if (defFile == null) {
-            DQPEmbeddedPlugin.logInfo("Admin.load_combined_vdb", new Object[] {deployName}); //$NON-NLS-1$
-        }
-        
-        VDBArchive vdb = null;
-        try {
-        	// Load the VDB from the files
-        	if (defFile == null) {
-        		vdb = VDBConfigurationReader.loadVDB(deployName, vdbFile);
-        	}
-        	else {
-        		vdb = VDBConfigurationReader.loadVDB(deployName, defFile, vdbFile);    
-        	}
-
-            // Add the connector binding in the VDB to the system
-            validateConnectorBindingsInVdb(vdb, options);
-            
-            // now deploy the VDB into the system. Flag is to 
-            VDBArchive deployedVDB = getConfigurationService().addVDB(vdb, !options.containsOption(AdminOptions.OnConflict.IGNORE));
-
-            // If the connector bindings are correctly initialized and VDB is active
-            // start the bindings automatically.
-            if ( (deployedVDB.getStatus() == VDBStatus.ACTIVE) ||
-              	  (deployedVDB.getStatus() == VDBStatus.ACTIVE_DEFAULT) ) {
-                try {
-                    startVDBConnectorBindings(deployedVDB);
-                } catch (MetaMatrixComponentException e) {
-                } catch (ApplicationLifecycleException e) {
-                    // we can safely ignore these because the cause of the not starting is already recorded
-                    // and more likely VDB deployment succeeded.
-                }
-            }
-            
-            return (VDB) convertToAdminObjects(deployedVDB);
-        } catch (MetaMatrixComponentException e) {
-        	throw new AdminComponentException(e);
-        }
-    }
-
-    /** 
-     * Start the connector bindings in the given VDB
-     * @param vdb
-     */
-    private void startVDBConnectorBindings(VDBArchive vdb) throws MetaMatrixComponentException,
-        ApplicationLifecycleException {
-        
-    	VDBDefn def = vdb.getConfigurationDef();
-    	Collection<ConnectorBinding> bindings = def.getConnectorBindings().values();
- 	 	for (ConnectorBinding binding:bindings) {
- 	 		getDataService().startConnectorBinding(binding.getDeployedName());
- 	 	}        
-    }
-    
-    /**
-     * Validate the connector bindings in a VDB. Since the connector bindings in VDB
-     * are VDB scoped there is no meaning for the admin options provided. Just check
-     * the decrypt properties.
-     */
-    void validateConnectorBindingsInVdb(VDBArchive vdb, AdminOptions options) 
-        throws MetaMatrixComponentException, AdminProcessingException, AdminException {
-        
-    	VDBDefn def = vdb.getConfigurationDef();
-    	
-        int version = 0; 
-        VDBArchive existing = null;
-        do {
-            version++;
-            existing = getConfigurationService().getVDB(def.getName(), String.valueOf(version));            
-        } while(existing != null);
-                
-        // Look for the connector bindings in the VDB            
-        // Based on users preference, either add or replace or throw exception
-        List vdbbindings = new ArrayList(def.getConnectorBindings().values());        
-        
-        for (Iterator i = vdbbindings.iterator(); i.hasNext();) {        
-            ConnectorBinding binding = (ConnectorBinding)i.next();
-
-            String deployName = binding.getDeployedName();
-            if (deployName == null) {
-            	deployName = binding.getFullName();
-            }
-            
-            if (bindingExists(deployName)) {
-                if (options.containsOption(AdminOptions.OnConflict.EXCEPTION)) {
-                    throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.addBindingEixists", binding.getDeployedName())); //$NON-NLS-1$
-                }                    
-            }
-            
-            // when the binding is not found it falls in "add", "overwrite" or "ignore"
-            // first two cases we need to add.
-            ConnectorBindingType type = (ConnectorBindingType)def.getConnectorType(binding.getComponentTypeID().getName());
-            
-            // Check that the connector binding passwords can be decrypted
-            try {
-            	checkDecryption(binding, type);
-            } catch(CryptoException e) {
-            	if (!options.containsOption(AdminOptions.BINDINGS_IGNORE_DECRYPT_ERROR)) {
-            		throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.CODE_DECRYPTION_FAILED", binding.getFullName())); //$NON-NLS-1$		
-            	}
-            }
-        }
-    }
-
-    /**
-     * Check that the properties of the specified ConnectorBinding can be decrypted.
-     * @param 
-     * @return
-     * @since 4.3
-     */
-    private void checkDecryption(ConnectorBinding binding, ConnectorBindingType type) throws CryptoException {
-        Properties props = binding.getProperties();
-        Iterator it = props.keySet().iterator();
-        while (it.hasNext()) {
-            String name = (String)it.next();
-            if (isMaskedProperty(name, type)) {
-                decryptProperty(props.getProperty(name));
-            }
-        }
-    }
-       
-    /**
-     * Check to see if the property read is a masked/encoded property 
-     * @param propName
-     * @param type
-     * @return
-     */
-    boolean isMaskedProperty(String  propName, ComponentType type) {
-        if (type != null) {
-            ComponentTypeDefn typeDef = type.getComponentTypeDefinition(propName);
-            if (typeDef != null && typeDef.getPropertyDefinition().isMasked()) {
-                return true;
-            }
-        }
-        return false;
-    }
-    
-    /**
-     * Decrypt the given property using the Crypto libraries. 
-     * @param value
-     * @return decrypted property.
-     */
-    String decryptProperty(String value) throws CryptoException{
-        if (value != null && value.length() > 0 && CryptoUtil.isValueEncrypted(value)) {
-           return CryptoUtil.stringDecrypt(value);
-        }
-        return value;
-    }     
-    
-    /** 
-     * @see org.teiid.adminapi.ConfigurationAdmin#addVDB(java.lang.String, byte[], AdminOptions)
-     * @since 4.3
-     */
-    public VDB addVDB(String deployName, byte[] vdbFile, AdminOptions options) 
-        throws AdminException {
-        return addVDB(deployName, vdbFile, null, options);
-    }
-    
-    @Override
-    public void deleteVDB(String vdbName, String vdbVersion) throws AdminException {
-    	super.changeVDBStatus(vdbName, vdbVersion, VDB.DELETED);
-    }
-        
-    /** 
-     * @see org.teiid.adminapi.ConfigurationAdmin#addExtensionModule(java.lang.String, java.lang.String, byte[], java.lang.String)
-     * @since 4.3
-     */
-    public void addExtensionModule(String type, String sourceName, byte[] source, String description) 
-        throws AdminException {
-        try {
-            if (sourceName == null) {
-                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_ext_source_name")); //$NON-NLS-1$                
-            }            
-            if (source == null || source.length == 0) {
-                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_ext_source")); //$NON-NLS-1$
-            }
-            if (!sourceName.endsWith(".jar") && !sourceName.endsWith(".xmi")) { //$NON-NLS-1$ //$NON-NLS-2$
-                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_ext_module")); //$NON-NLS-1$                
-            }   
-            ExtensionModule previousModule = null;
-
-            try {
-                previousModule = getConfigurationService().getExtensionModule(sourceName);
-            }catch(MetaMatrixComponentException e) {
-                // this is OK, we did not find any thing
-            }
-            
-            if ( previousModule == null) {
-                // Now add it.
-                BasicExtensionModule extModule = new BasicExtensionModule(sourceName, type, description, source);
-                getConfigurationService().saveExtensionModule(extModule);
-            }
-            else {
-                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.extension_module_exists", sourceName)); //$NON-NLS-1$
-            }
-        } catch (MetaMatrixComponentException e) {
-        	throw new AdminComponentException(e);
-        }
-    }
-
-    /** 
-     * @see org.teiid.adminapi.ConfigurationAdmin#deleteExtensionModule(java.lang.String)
-     * @since 4.3
-     */
-    public void deleteExtensionModule(String sourceName) 
-        throws AdminException {        
-        try {
-            if (sourceName == null) {
-                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_ext_source_name")); //$NON-NLS-1$                
-            }                        
-            getConfigurationService().deleteExtensionModule(sourceName);
-        } catch (MetaMatrixComponentException e) {
-        	throw new AdminComponentException(e);
-        }        
-    }
-
-    /** 
-     * @see org.teiid.adminapi.ConfigurationAdmin#assignBindingToModel(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
-     * @since 4.3
-     */
-    public void assignBindingToModel(String deployedConnectorBindingName, String vdbName, String vdbVersion, String modelName) 
-        throws AdminException {
-
-        if (deployedConnectorBindingName == null || !deployedConnectorBindingName.matches(MULTIPLE_WORD_WILDCARD_REGEX)) {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_cb_name")); //$NON-NLS-1$                
-        }
-        
-        if (vdbName == null || vdbVersion == null || !vdbName.matches(SINGLE_WORD_REGEX)) {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_vdb_name")); //$NON-NLS-1$
-        }
-
-        if (modelName == null || !modelName.matches(MULTIPLE_WORDS_REGEX)) {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_model_name")); //$NON-NLS-1$
-        }
-        
-        // find the connector binding if found in the configuration service
-        // add to the vdb binding.
-        try {
-            ConnectorBinding binding = getDataService().getConnectorBinding(deployedConnectorBindingName);
-            if (binding != null) {
-                List list = new ArrayList();
-                list.add(binding);            
-                getConfigurationService().assignConnectorBinding(vdbName, vdbVersion, modelName, (ConnectorBinding[])list.toArray(new ConnectorBinding[list.size()]));
-            }
-            else {
-                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Vdb_or_Model_notfound")); //$NON-NLS-1$
-            }
-        } catch (MetaMatrixComponentException e) {
-        	throw new AdminComponentException(e);
-        }                        
-    }
-    
-    public void assignBindingsToModel(String[] deployedConnectorBindingName, String vdbName, String vdbVersion, String modelName) throws AdminException {
-        if (deployedConnectorBindingName == null || deployedConnectorBindingName.length == 0) {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_cb_name")); //$NON-NLS-1$                
-        }
-        
-        if (vdbName == null || vdbVersion == null || !vdbName.matches(SINGLE_WORD_REGEX)) {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_vdb_name")); //$NON-NLS-1$
-        }
-
-        if (modelName == null || !modelName.matches(MULTIPLE_WORDS_REGEX)) {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_model_name")); //$NON-NLS-1$
-        }
-        
-        // find the connector binding if found in the configuration service
-        // add to the vdb binding.
-        try {
-        	List list = new ArrayList();
-        	for (int i = 0; i < deployedConnectorBindingName.length; i++) {
-        		ConnectorBinding binding = getDataService().getConnectorBinding(deployedConnectorBindingName[i]);
-                if (binding != null) {
-                    list.add(binding);
-                }
-        	}
-            
-            if (!list.isEmpty()) {
-                getConfigurationService().assignConnectorBinding(vdbName, vdbVersion, modelName, (ConnectorBinding[])list.toArray(new ConnectorBinding[list.size()]));
-            }
-            else {
-                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Vdb_or_Model_notfound")); //$NON-NLS-1$
-            }
-        } catch (MetaMatrixComponentException e) {
-        	throw new AdminComponentException(e);
-        }                        
-    	
-    }
-
-    /** 
-     * @see org.teiid.adminapi.ConfigurationAdmin#getLogConfiguration()
-     * @since 4.3
-     */
-    public LogConfiguration getLogConfiguration() 
-        throws AdminException {
-            return (LogConfiguration)convertToAdminObjects(LogManager.getLogConfigurationCopy());
-    }
-
-    /** 
-     * @see org.teiid.adminapi.ConfigurationAdmin#setLogConfiguration(org.teiid.adminapi.LogConfiguration)
-     * @since 4.3
-     */
-    public void setLogConfiguration(LogConfiguration config) 
-        throws AdminException {
-        LogManager.setLogConfiguration((com.metamatrix.common.log.LogConfiguration)convertToNativeObjects(config));
-    }
-    
-    /** 
-     * @see com.metamatrix.admin.api.embedded.EmbeddedRuntimeStateAdmin#setLogListener(java.lang.Object)
-     * @since 4.3
-     */
-    public void setLogListener(EmbeddedLogger listener) 
-        throws AdminException {
-        if(listener != null) {
-        	LogManager.setLogListener(new DQPLogListener(listener));
-        }
-        else {
-            throw new AdminProcessingException("Admin_invalid_log_listener"); //$NON-NLS-1$
-        }
-    }    
-
-    /** 
-     * @see org.teiid.adminapi.ConfigurationAdmin#exportExtensionModule(java.lang.String)
-     * @since 4.3
-     */
-    public byte[] exportExtensionModule(String sourceName) throws AdminException {
-        try {
-            if (sourceName == null) {
-                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_ext_source_name")); //$NON-NLS-1$                
-            }            
-            
-            ExtensionModule extModule = getConfigurationService().getExtensionModule(sourceName);            
-            return extModule.getFileContents();
-        } catch (MetaMatrixComponentException e) {
-        	throw new AdminComponentException(e);
-        }
-    }
-
-    /** 
-     * @see org.teiid.adminapi.ConfigurationAdmin#exportConfiguration()
-     * @since 4.3
-     */
-    public char[] exportConfiguration() throws AdminException {
-        try {
-        	StringWriter sw = new StringWriter();
-            Properties props = getConfigurationService().getSystemProperties();
-            props.store(sw, "Export of Teiid Configuration Properties"); //$NON-NLS-1$
-            return sw.toString().toCharArray();
-        } catch (IOException e) {
-        	throw new AdminComponentException(e);
-        }
-    }
-
-    /** 
-     * @see org.teiid.adminapi.ConfigurationAdmin#exportConnectorBinding(java.lang.String)
-     * @since 4.3
-     */
-    public char[] exportConnectorBinding(String identifier) 
-        throws AdminException {
-        try {
-            if (identifier == null || !identifier.matches(MULTIPLE_WORD_WILDCARD_REGEX)) {
-                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_cb_name")); //$NON-NLS-1$                
-            }
-            
-            List bindingList = getDataService().getConnectorBindings();
-            List matchedList = new ArrayList();
-            for (Iterator i = bindingList.iterator(); i.hasNext();) {
-                ConnectorBinding binding = (ConnectorBinding)i.next();
-                if (matches(identifier, binding.getDeployedName())) {
-                    matchedList.add(binding);
-                }
-            }
-            
-            if (!matchedList.isEmpty()) {
-                ConnectorBinding[] bindings = (ConnectorBinding[])matchedList.toArray(new ConnectorBinding[matchedList.size()]);
-                ConnectorBindingType[] types = new ConnectorBindingType[bindings.length];
-                
-                for (int i = 0; i < bindings.length; i++) {
-                    types[i] = getConfigurationService().getConnectorType(bindings[i].getComponentTypeID().getName());                
-                }
-                return ConnectorConfigurationWriter.writeToCharArray(bindings, types);
-            }
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Connector_binding_does_not_exists", identifier)); //$NON-NLS-1$
-        } catch (MetaMatrixComponentException e) {
-        	throw new AdminComponentException(e);
-        } 
-    }
-
-    /** 
-     * @see org.teiid.adminapi.ConfigurationAdmin#exportConnectorType(java.lang.String)
-     * @since 4.3
-     */
-    public char[] exportConnectorType(String identifier) 
-        throws AdminException {
-        try {
-            if (identifier == null || !identifier.matches(MULTIPLE_WORDS_REGEX)) {
-                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_ct_name")); //$NON-NLS-1$                
-            }
-            
-            List typesList = getConfigurationService().getConnectorTypes();
-            List matchedList = new ArrayList();
-            for (Iterator i = typesList.iterator(); i.hasNext();) {
-                ConnectorBindingType type = (ConnectorBindingType)i.next();
-                if (matches(identifier, type.getName())) {
-                    matchedList.add(type);
-                }
-            }
-            
-            if (!matchedList.isEmpty()) {
-                ConnectorBindingType[] types = (ConnectorBindingType[])matchedList.toArray(new ConnectorBindingType[matchedList.size()]);
-                return ConnectorConfigurationWriter.writeToCharArray(types);
-            }
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Connector_type_does_not_exists", identifier)); //$NON-NLS-1$
-        } catch (MetaMatrixComponentException e) {
-        	throw new AdminComponentException(e);
-        } 
-    }
-
-    /**  
-     * @see org.teiid.adminapi.ConfigurationAdmin#exportVDB(java.lang.String, java.lang.String)
-     * @since 4.3
-     */
-    public byte[] exportVDB(String name, String version) 
-        throws AdminException {     
-    	
-        try {
-            if (name == null || version == null || !name.matches(SINGLE_WORD_REGEX)) {
-                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_vdb_name")); //$NON-NLS-1$                
-            }
-            
-            VDBArchive vdb = getConfigurationService().getVDB(name, version); 
-            if (vdb != null) {
-                return VDBArchive.writeToByteArray(vdb);
-            }
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.vdb_does_not_exists", name, version)); //$NON-NLS-1$
-        } catch (MetaMatrixComponentException e) {
-        	throw new AdminComponentException(e);
-        }
-    }
-
-    /** 
-     * @see org.teiid.adminapi.ConfigurationAdmin#addConnectorArchive(byte[], org.teiid.adminapi.AdminOptions)
-     * @since 4.3.2
-     */
-    public void addConnectorArchive(byte[] contents, AdminOptions options) throws AdminException {
-        
-        // if the options object is null treat as if it is IGNORE as default
-        if (options == null) {
-            options = new AdminOptions(AdminOptions.OnConflict.IGNORE);
-        }
-
-        if (contents == null || contents.length == 0) {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_ct_source")); //$NON-NLS-1$
-        }
-        
-        try {            
-            // Load the connector Archive from the file            
-            HashSet previouslyAddedModules = new HashSet();
-            ConnectorArchive archive = ConnectorConfigurationReader.loadConnectorArchive(contents);
-            ConnectorBindingType[] connectorTypes = archive.getConnectorTypes();
-                           
-            // Loop through each type and add all of them based on the option.
-            for (int typeIndex = 0; typeIndex < connectorTypes.length; typeIndex++) {
-                
-                // first make sure we do not already have this connector type
-                String connectorName = connectorTypes[typeIndex].getName();
-                ConnectorBindingType type = getConfigurationService().getConnectorType(connectorName);
-                if (type == null) {
-                    type = connectorTypes[typeIndex];
-                    ExtensionModule[] extModules = archive.getExtensionModules(type);
-                    checkDuplicateExtensionModules(extModules, options, previouslyAddedModules);
-                    saveConnectorType(type);
-
-                } else {
-                
-                    // if not asked to overwrite/skip writing them
-                    if (options.containsOption(AdminOptions.OnConflict.EXCEPTION)) {
-                        throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Connector_type_exists", connectorName)); //$NON-NLS-1$            
-                    } else if (options.containsOption(AdminOptions.OnConflict.IGNORE)) {
-                        continue;
-                    } else if (options.containsOption(AdminOptions.OnConflict.OVERWRITE)){
-                        deleteConnectorType(connectorName);
-                        // Now that we know we need to add this to configuration; let's get on with it
-                        type = connectorTypes[typeIndex];
-                        ExtensionModule[] extModules = archive.getExtensionModules(type);
-                        checkDuplicateExtensionModules(extModules, options, previouslyAddedModules);
-                        saveConnectorType(type);
-                    }                
-                }
-                // Now that we know we need to add this to configuration; let's get on with it
-                type = connectorTypes[typeIndex];
-                ExtensionModule[] extModules = archive.getExtensionModules(type);
-                checkDuplicateExtensionModules(extModules, options, previouslyAddedModules);
-            }
-            
-            // Now add the extension modules
-            for (Iterator i = previouslyAddedModules.iterator(); i.hasNext();) {
-                ExtensionModule extModule = (ExtensionModule)i.next();
-                addExtensionModule(extModule.getModuleType(), extModule.getFullName(), extModule.getFileContents(), extModule.getDescription());
-            }        
-                        
-        } catch (MetaMatrixComponentException e) {
-            throw new AdminComponentException(e);
-        }
-    }
-
-    /**
-     * This method checks the passed in connector type's extension module is not already in the
-     * system, if it there takes the appropriate action. Otherwise keeps tracks of all modules 
-     * to add. 
-     * @param type - connector type
-     * @param extModules - Extension modules for the Connector Type
-     * @param options - Admin Options
-     * @param ignorableModules - Modules which are already added, can be ignored for adding
-     */
-    void checkDuplicateExtensionModules(ExtensionModule[] extModules, AdminOptions options, HashSet ignorableModules) 
-        throws AdminException  {
-
-        // Now check if the the extension modules are already there        
-        for (int i = 0; i < extModules.length; i++) {
-            boolean add = true;
-            
-            String moduleName = extModules[i].getFullName();
-            ExtensionModule previousModule = null;
-            
-            // see if we can ignore this, because we may have just added this during import of
-            // another connector type through this archive
-            if (ignorableModules.contains(extModules[i])) {
-                continue;
-            }
-            
-            // we have not already added this this time around, now check if this available 
-            // from configuration service
-            try {
-                previousModule = getConfigurationService().getExtensionModule(moduleName);
-            }catch(MetaMatrixComponentException e) {
-                // this is OK, we did not find any thing
-            }
-            
-            // if we found it take appropriate action.
-            if(previousModule != null && options.containsOption(AdminOptions.OnConflict.EXCEPTION)) {
-                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.extension_module_exists", previousModule.getFullName())); //$NON-NLS-1$
-            }
-            else if (previousModule != null && options.containsOption(AdminOptions.OnConflict.IGNORE)) {
-                add = false;
-            }
-            else if (previousModule != null && options.containsOption(AdminOptions.OnConflict.OVERWRITE)) {
-                // since we are overwrite, first delete and then add, there is no safe way to overwrite
-                deleteExtensionModule(previousModule.getFullName());
-            }
-                            
-            // Now keep track what extension modules to add; also to ignore in future
-            // adds
-            if (add) {                
-                ignorableModules.add(extModules[i]);
-            }
-        }                    
-    }
-    
-    /** 
-     * @see org.teiid.adminapi.ConfigurationAdmin#exportConnectorArchive(java.lang.String)
-     * @since 4.3
-     */
-    public byte[] exportConnectorArchive(String identifier) throws AdminException {
-        try {
-            if (identifier == null || !identifier.matches(MULTIPLE_WORD_WILDCARD_REGEX)) {
-                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_ct_name")); //$NON-NLS-1$                
-            }
-            
-            // first build the connector archive object
-            BasicConnectorArchive archive = new BasicConnectorArchive();
-            List connectorTypes = getConfigurationService().getConnectorTypes();
-            
-            for (Iterator i = connectorTypes.iterator(); i.hasNext();) {
-                ConnectorBindingType type = (ConnectorBindingType)i.next();
-                
-                // If the types name matches with the pattern sent in add to archive
-                if (type != null && matches(identifier, type.getName())) {
-                    
-                    // Add connector type first
-                    archive.addConnectorType(type);
-    
-                    // Get the extension modules required for the type
-                    String[] extModules = type.getExtensionModules();
-                    for (int m = 0; m < extModules.length; m++) {
-                        // Get the extension module from the configuration and add to the archive
-                        ExtensionModule extModule = getConfigurationService().getExtensionModule(extModules[m]);
-                        if (extModule != null) {
-                            archive.addExtensionModule(type, extModule);
-                        }
-                        else {
-                            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("DataService.ext_module_not_found", extModules[m])); //$NON-NLS-1$                            
-                        }                        
-                    }                    
-                }
-            }
-                
-            // if no types found to the identifier pattern, then throw an exception
-            if (archive.getConnectorTypes().length == 0) {
-                throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Connector_type_does_not_exists", identifier)); //$NON-NLS-1$    
-            }
-                            
-            // now convert the object into file form
-            return ConnectorConfigurationWriter.writeToByteArray(archive);
-           
-        } catch (MetaMatrixComponentException e) {
-        	throw new AdminComponentException(e);
-        } 
-    }
-    
-    private void saveConnectorType(ConnectorBindingType type) throws MetaMatrixComponentException {
-        getConfigurationService().saveConnectorType(type);
-    }
-    
-    
-    @Override
-	public void addUDF(byte[] modelFileContents, String classpath)
-			throws AdminException {
-		if (modelFileContents == null || modelFileContents.length == 0) {
-			throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_UDF_contents")); //$NON-NLS-1$               
-		}
-
-		try {
-		
-			getConfigurationService().unloadUDF();
-			
-			// delete any extension module by the same name first
-			try {
-				deleteExtensionModule(ConfigurationService.USER_DEFINED_FUNCTION_MODEL);
-			} catch (AdminException e) {
-				// if not found then it is OK to fail
-			}
-			
-			// add the function definitions as extension modules
-			addExtensionModule(ExtensionModule.FUNCTION_DEFINITION_TYPE,ConfigurationService.USER_DEFINED_FUNCTION_MODEL,modelFileContents, "User Defined Functions File"); //$NON-NLS-1$
-			
-	        String commonpath = getConfigurationService().getSystemProperties().getProperty(DQPEmbeddedProperties.COMMON_EXTENSION_CLASPATH, ""); //$NON-NLS-1$
-	        
-	        StringBuilder sb = new StringBuilder();
-	        if (classpath != null && classpath.length() > 0 ) {
-	        	StringTokenizer st = new StringTokenizer(classpath, ";"); //$NON-NLS-1$
-	        	while (st.hasMoreTokens()) {
-	        		String partpath = st.nextToken();
-	        		if (commonpath.indexOf(partpath) == -1) {
-	        			sb.append(partpath).append(";"); //$NON-NLS-1$
-	        		}
-	        	}
-	        }
-	        getConfigurationService().setSystemProperty(DQPEmbeddedProperties.COMMON_EXTENSION_CLASPATH, sb.toString()+commonpath);
-			
-			
-			// then update the properties
-			Properties p = new Properties();
-			p.setProperty(DQPEmbeddedProperties.COMMON_EXTENSION_CLASPATH, classpath);
-			getConfigurationService().updateSystemProperties(p);
-			// reload the new UDF
-			getConfigurationService().loadUDF();
-		} catch (MetaMatrixComponentException e) {
-			throw new AdminComponentException(e);
-		}
-	}
-
-	@Override
-	public void deleteUDF() throws AdminException {
-		try {
-			getConfigurationService().unloadUDF();
-			deleteExtensionModule(ConfigurationService.USER_DEFINED_FUNCTION_MODEL); 
-		} catch (MetaMatrixComponentException e) {
-			throw new AdminComponentException(e);
-		}
-	}
-	
-	@Override
-	public void extensionModuleModified(String name) throws AdminException {
-		try {
-			getConfigurationService().clearClassLoaderCache();
-			getConfigurationService().loadUDF();
-		} catch (MetaMatrixComponentException e) {
-			throw new AdminComponentException(e);
-		}		
-	}
-
-	@Override
-	public void setProcessProperty(String processIdentifier, String propertyName, String propertyValue) throws AdminException{
-		try {
-			getConfigurationService().setSystemProperty(propertyName, propertyValue);
-		} catch (MetaMatrixComponentException e) {
-			throw new AdminComponentException(e);
-		}
-	}
-}

Deleted: branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPLogListener.java
===================================================================
--- branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPLogListener.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPLogListener.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -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.dqp.embedded.admin;
-
-import org.teiid.adminapi.EmbeddedLogger;
-import org.teiid.adminapi.LogConfiguration;
-
-import com.metamatrix.core.log.LogListener;
-import com.metamatrix.core.log.MessageLevel;
-
-
-public class DQPLogListener implements LogListener {
-    
-    private EmbeddedLogger logger;
-    
-    public DQPLogListener(EmbeddedLogger logger) {
-        this.logger = logger;
-    }
-
-    public void log(int level, String context, Object msg) {
-        logger.log(convertLevel(level), System.currentTimeMillis(), context, Thread.currentThread().getName(), msg.toString(), null);        
-    }
-
-    public void log(int level, String context, Throwable t, Object msg) {
-    	logger.log(convertLevel(level), System.currentTimeMillis(), context, Thread.currentThread().getName(), msg.toString(), t);
-    }    
-    
-	private int convertLevel(int level) {
-		int logLevel = LogConfiguration.INFO;
-        
-        switch(level) {
-            case MessageLevel.WARNING:
-                logLevel = LogConfiguration.WARNING;
-                break;
-            case MessageLevel.ERROR:
-                logLevel = LogConfiguration.ERROR;
-                break;
-            case MessageLevel.DETAIL:
-                logLevel = LogConfiguration.DETAIL;
-                break;
-            case MessageLevel.TRACE:
-                logLevel = LogConfiguration.TRACE;
-                break;
-            case MessageLevel.NONE:
-                logLevel = LogConfiguration.NONE;
-                break;
-                
-            default:
-                logLevel = LogConfiguration.INFO;
-        }
-		return logLevel;
-	}
-    
-    public void shutdown() {
-    }
-}

Deleted: branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPMonitoringAdminImpl.java
===================================================================
--- branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPMonitoringAdminImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPMonitoringAdminImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,329 +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.dqp.embedded.admin;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import org.teiid.adminapi.AdminComponentException;
-import org.teiid.adminapi.AdminException;
-import org.teiid.adminapi.AdminProcessingException;
-import org.teiid.adminapi.Cache;
-import org.teiid.adminapi.ConnectionPool;
-import org.teiid.adminapi.ConnectorBinding;
-import org.teiid.adminapi.ConnectorType;
-import org.teiid.adminapi.ExtensionModule;
-import org.teiid.adminapi.MonitoringAdmin;
-import org.teiid.adminapi.ProcessObject;
-import org.teiid.adminapi.PropertyDefinition;
-import org.teiid.adminapi.QueueWorkerPool;
-import org.teiid.adminapi.Request;
-import org.teiid.adminapi.Session;
-import org.teiid.adminapi.Transaction;
-import org.teiid.adminapi.VDB;
-
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.common.config.api.ConnectorBindingType;
-import com.metamatrix.common.vdb.api.VDBArchive;
-import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
-import com.metamatrix.dqp.service.TransactionService;
-import com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl;
-import com.metamatrix.server.serverapi.RequestInfo;
-
-
-/** 
- * DQP implementation of the Monitoring API
- * @since 4.3
- */
-public class DQPMonitoringAdminImpl extends BaseAdmin implements MonitoringAdmin {
-
-    public DQPMonitoringAdminImpl(EmbeddedConnectionFactoryImpl manager) {
-        super(manager);
-    }
-
-    /** 
-     * @see org.teiid.adminapi.MonitoringAdmin#getConnectorTypes(java.lang.String)
-     * @since 4.3
-     */
-    public Collection<ConnectorType> getConnectorTypes(String identifier) 
-        throws AdminException {
-
-        if (identifier == null || !identifier.matches(MULTIPLE_WORD_WILDCARD_REGEX)) {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_identifier")); //$NON-NLS-1$                
-        }
-        
-        return super.getConnectorTypes(identifier);
-    }
-
-    /** 
-     * @see org.teiid.adminapi.MonitoringAdmin#getVDBs(java.lang.String)
-     * @since 4.3
-     */
-    public Collection<VDB> getVDBs(String identifier) 
-        throws AdminException {
-        
-        if (identifier == null || !identifier.matches(VDB_REGEX)) {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_identifier")); //$NON-NLS-1$                
-        }
-        
-        // if . and * not specified, add a STAR at the end to compensate for the
-        // version number matching.
-        if (identifier.indexOf(DOT) == -1 && identifier.indexOf(STAR) == -1) {
-            identifier = identifier +DOT+STAR;
-        }
-        
-        try {
-            List<VDBArchive> vdbs = getVDBService().getAvailableVDBs();
-            List matchedVdbs = new ArrayList();
-            for (VDBArchive vdb:vdbs) {
-                if (matches(identifier, vdb.getName()+"."+vdb.getVersion())) { //$NON-NLS-1$
-                    matchedVdbs.add(vdb);
-                }
-            }                        
-            return (List)convertToAdminObjects(matchedVdbs);
-        } catch (MetaMatrixComponentException e) {
-        	throw new AdminComponentException(e);
-        }
-    }
-
-    /** 
-     * @see org.teiid.adminapi.MonitoringAdmin#getConnectorBindings(java.lang.String)
-     * @since 4.3
-     */
-    public Collection<ConnectorBinding> getConnectorBindings(String identifier) 
-        throws AdminException {
-        
-        if (identifier == null) {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_identifier")); //$NON-NLS-1$                
-        }                
-        return super.getConnectorBindings(identifier);
-    }
-    
-
-    @Override
-    public Collection<ConnectorBinding> getConnectorBindingsInVDB(String vdbName, String vdbVersion)  throws AdminException{
-        try {
-            VDBArchive vdb = getConfigurationService().getVDB(vdbName, vdbVersion); 
-            if (vdb != null) {
-            	return (List)convertToAdminObjects(vdb.getConfigurationDef().getConnectorBindings().values());
-            }
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.vdb_does_not_exists", vdbVersion, vdbVersion)); //$NON-NLS-1$
-            
-        } catch (MetaMatrixComponentException e) {
-        	throw new AdminComponentException(e);
-        }      
-    }    
-    
-    /** 
-     * @see org.teiid.adminapi.MonitoringAdmin#getExtensionModules(java.lang.String)
-     * @since 4.3
-     */
-    public Collection<ExtensionModule> getExtensionModules(String identifier) 
-        throws AdminException {
-        
-        if (identifier == null || !identifier.matches(WORD_AND_DOT_WILDCARD_REGEX)) {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_identifier")); //$NON-NLS-1$                
-        }
-                
-        try {
-            List extModules = getConfigurationService().getExtensionModules();
-            extModules = (List)convertToAdminObjects(extModules);
-            return matchedCollection(identifier, extModules);            
-        } catch (MetaMatrixComponentException e) {
-        	throw new AdminComponentException(e);
-        }
-    }
-
-    /** 
-     * @see org.teiid.adminapi.MonitoringAdmin#getQueueWorkerPools(java.lang.String)
-     * @since 4.3
-     */
-    public Collection<QueueWorkerPool> getQueueWorkerPools(String identifier) 
-        throws AdminException {
-        
-        if (identifier == null || !identifier.matches(MULTIPLE_WORD_WILDCARD_REGEX)) {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_identifier")); //$NON-NLS-1$                
-        }
-        
-        List results = new ArrayList();
-        if (matches(identifier, "dqp")) { //$NON-NLS-1$
-            // First get the queue statistics for the DQP
-            Collection c = getManager().getDQP().getQueueStatistics();;
-            if (c != null && !c.isEmpty()) {
-                results.addAll(c);
-            }
-        }
-        
-        try {
-            // Now get for all the connector bindings
-            Collection bindings = super.getConnectorBindings(identifier);
-            for (Iterator i = bindings.iterator(); i.hasNext();) {
-                ConnectorBinding binding = (ConnectorBinding)i.next();
-                Collection c = getDataService().getConnectorBindingStatistics(binding.getName());
-                if (c != null && !c.isEmpty()) {
-                    results.addAll(c);
-                }                
-            }
-        } catch (MetaMatrixComponentException e) {
-        	throw new AdminComponentException(e);
-        }
-                
-        if (!results.isEmpty()) {
-            return (List)convertToAdminObjects(results);
-        }
-        return Collections.EMPTY_LIST;
-    }
-
-    /** 
-     * @see org.teiid.adminapi.MonitoringAdmin#getCaches(java.lang.String)
-     * @since 4.3
-     */
-    public Collection<Cache> getCaches(String identifier) 
-        throws AdminException {
-        
-        if (identifier == null || !identifier.matches(SINGLE_WORD_WILDCARD_REGEX)) {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_identifier")); //$NON-NLS-1$                
-        }
-        
-        List cacheList = new ArrayList();
-        for (int i =0; i < cacheTypes.length; i++) {
-            if (matches(identifier, cacheTypes[i])) {
-                cacheList.add(cacheTypes[i]);
-            }            
-        }
-        return cacheList;
-    }
-
-    /** 
-     * @see org.teiid.adminapi.MonitoringAdmin#getSessions(java.lang.String)
-     * @since 4.3
-     */
-    public Collection<Session> getSessions(String identifier) 
-        throws AdminException {
-        
-        if (identifier == null || !identifier.matches(NUMBER_REGEX)) {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_identifier")); //$NON-NLS-1$                
-        }
-        return matchedCollection(identifier, (List)convertToAdminObjects(getClientConnections()));
-    }
-        
-    /** 
-     * @see org.teiid.adminapi.MonitoringAdmin#getRequests(java.lang.String)
-     * @since 4.3
-     */
-    public Collection<Request> getRequests(String identifier) 
-        throws AdminException {
-
-        if (identifier == null || !identifier.matches(NUMBER_DOT_REGEX)) {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_identifier")); //$NON-NLS-1$                
-        }
-        
-        ArrayList requestList = new ArrayList();
-        // List contains both top and atomic requests, only add the top requests
-    	List<RequestInfo> requests = getManager().getDQP().getRequests();                 
-        for(RequestInfo request:requests) {
-        	if (request.getConnectorBindingUUID() == null) {
-        		requestList.add(request);
-        	}
-        }
-        return matchedCollection(identifier, (List)convertToAdminObjects(requestList));
-    }
-
-    /** 
-     * @see org.teiid.adminapi.MonitoringAdmin#getSourceRequests(java.lang.String)
-     * @since 4.3
-     */
-    public Collection<Request> getSourceRequests(String identifier) 
-        throws AdminException {
-        
-        if (identifier == null || !identifier.matches(NUMBER_DOT_REGEX)) {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_identifier")); //$NON-NLS-1$                
-        }
-        
-        ArrayList atomicRequestList = new ArrayList();
-    	List<RequestInfo> requests = getManager().getDQP().getRequests();
-        for (RequestInfo request:requests) {
-        	if (request.getConnectorBindingUUID() != null) {
-        		atomicRequestList.add(request);
-        	}
-        }
-        return matchedCollection(identifier, (List)convertToAdminObjects(atomicRequestList));
-    }
-    
-    /** 
-     * @see org.teiid.adminapi.MonitoringAdmin#getPropertyDefinitions(java.lang.String, java.lang.String)
-     * @since 4.3
-     */
-    public Collection<PropertyDefinition> getConnectorTypePropertyDefinitions(String typeName) throws AdminException {
-    	
-        if (typeName == null || !typeName.matches(MULTIPLE_WORDS_REGEX)) {
-        	throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_ct_name")); //$NON-NLS-1$                
-        }
-
-        try {
-			ConnectorBindingType type = getConfigurationService().getConnectorType(typeName);
-			if (type == null) {
-				throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.ct_doesnot_exist", typeName)); //$NON-NLS-1$
-			}
-   
-			return convertPropertyDefinitions(type, new Properties());
-		} catch (MetaMatrixComponentException e) {
-			throw new AdminComponentException(e);
-		}
-    }
-
-    @Override
-    public Collection<Transaction> getTransactions()
-    		throws AdminException {
-    	TransactionService ts = getTransactionService();
-    	if (ts == null) {
-    		return Collections.emptyList();
-    	}
-    	return ts.getTransactions();
-    }
-
-	@Override
-	public Collection<? extends ConnectionPool> getConnectionPoolStats(String identifier)
-			throws AdminException {
-		
-		try {
-			return this.getDataService().getConnectionPoolStatistics(identifier);
-		} catch (MetaMatrixComponentException e) {
-			throw new AdminComponentException(e);
-		}
-
-	}
-
-	@Override
-	public Collection<ProcessObject> getProcesses(String processIdentifier) throws AdminException {
-		ArrayList<ProcessObject> list = new ArrayList<ProcessObject>();
-		list.add(getManager().getProcess());
-		return list;
-	}
-}

Deleted: branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPRuntimeStateAdminImpl.java
===================================================================
--- branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPRuntimeStateAdminImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPRuntimeStateAdminImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,305 +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.dqp.embedded.admin;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-
-import javax.transaction.xa.Xid;
-
-import org.teiid.adminapi.AdminComponentException;
-import org.teiid.adminapi.AdminException;
-import org.teiid.adminapi.AdminObject;
-import org.teiid.adminapi.AdminProcessingException;
-import org.teiid.adminapi.Cache;
-import org.teiid.adminapi.ConnectorBinding;
-import org.teiid.adminapi.EmbeddedLogger;
-import org.teiid.adminapi.Request;
-import org.teiid.adminapi.RuntimeStateAdmin;
-import org.teiid.dqp.internal.process.DQPWorkContext;
-
-import com.metamatrix.admin.objects.MMRequest;
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.common.application.exception.ApplicationLifecycleException;
-import com.metamatrix.common.log.LogManager;
-import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
-import com.metamatrix.dqp.message.AtomicRequestID;
-import com.metamatrix.dqp.message.RequestID;
-import com.metamatrix.dqp.service.TransactionService;
-import com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl;
-import com.metamatrix.platform.security.api.MetaMatrixSessionInfo;
-
-
-/** 
- * @since 4.3
- */
-public class DQPRuntimeStateAdminImpl  extends BaseAdmin implements RuntimeStateAdmin {
-
-    public DQPRuntimeStateAdminImpl(EmbeddedConnectionFactoryImpl manager) {
-        super(manager);
-    }
-
-    /** 
-     * @see com.metamatrix.admin.api.embedded.EmbeddedRuntimeStateAdmin#stop(int)
-     * @since 4.3
-     */
-    public void shutdown(int millisToWait) throws AdminException {        
-        // TODO: rreddy need to implement the time to wait.
-        // First terminate all the sessions to the DQP currently have
-        terminateSession(AdminObject.WILDCARD);
-        
-        getManager().shutdown(false);
-    }
-
-    /** 
-     * @see com.metamatrix.admin.api.embedded.EmbeddedRuntimeStateAdmin#restart()
-     * @since 4.3
-     */
-    public void restart() throws AdminException {
-        // First terminate all the sessions to the DQP currently have
-        terminateSession(AdminObject.WILDCARD);
-        
-        // Now shutdown the DQP, it will automatically start next timea new connection is 
-        // requested.
-        getManager().shutdown(true);                        
-    }
-
-    /** 
-     * @see org.teiid.adminapi.RuntimeStateAdmin#startConnectorBinding(java.lang.String)
-     * @since 4.3
-     */
-    public void startConnectorBinding(String identifier) 
-        throws AdminException {
-        
-        if (identifier == null || !identifier.matches(MULTIPLE_WORD_WILDCARD_REGEX)) {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_identifier")); //$NON-NLS-1$                
-        }
-        
-        AdminException exceptionWrapper = null;
-        // Get all matching connector bindings
-        Collection bindings = getConnectorBindings(identifier);
-        if (bindings != null && !bindings.isEmpty()) {
-            for (Iterator i = bindings.iterator(); i.hasNext();) {
-                try {
-                    AdminObject binding = (AdminObject)i.next();
-                    getDataService().startConnectorBinding(binding.getName());
-                } catch (ApplicationLifecycleException e) {
-                    exceptionWrapper = accumulateSystemException(exceptionWrapper, e);
-                } catch (MetaMatrixComponentException e) {
-                    exceptionWrapper = accumulateSystemException(exceptionWrapper, e);
-                }
-            }
-        }
-        else {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Connector_binding_does_not_exists", new Object[] {identifier})); //$NON-NLS-1$            
-        }
-
-        // If any errors occurred then thow the exception.
-        if (exceptionWrapper != null) {
-            throw exceptionWrapper;
-        }
-    }
-
-    /** 
-     * @see org.teiid.adminapi.RuntimeStateAdmin#stopConnectorBinding(java.lang.String, boolean)
-     * @since 4.3
-     */
-    public void stopConnectorBinding(String identifier, boolean stopNow) 
-        throws AdminException {
-        // TODO: need to implement "now" part
-        if (identifier == null || !identifier.matches(MULTIPLE_WORD_WILDCARD_REGEX)) {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_identifier")); //$NON-NLS-1$                
-        }
-        
-        AdminException exceptionWrapper = null;
-        // Get all matching connector bindings        
-        Collection bindings = getConnectorBindings(identifier);
-        if (bindings != null && !bindings.isEmpty()) {
-            for (Iterator i = bindings.iterator(); i.hasNext();) {
-                try {
-                    AdminObject binding = (AdminObject)i.next();
-                    getDataService().stopConnectorBinding(binding.getName());
-                } catch (ApplicationLifecycleException e) {
-                    exceptionWrapper = accumulateSystemException(exceptionWrapper, e);
-                } catch (MetaMatrixComponentException e) {
-                    exceptionWrapper = accumulateSystemException(exceptionWrapper, e);
-                }
-            }
-        }
-        else {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Connector_binding_does_not_exists", new Object[] {identifier})); //$NON-NLS-1$            
-        }
-
-        // If any errors occurred then thow the exception.
-        if (exceptionWrapper != null) {
-            throw exceptionWrapper;
-        }
-    }
-
-    /** 
-     * @see org.teiid.adminapi.RuntimeStateAdmin#clearCache(java.lang.String)
-     * @since 4.3
-     */
-    public void clearCache(String identifier) 
-        throws AdminException {
-        
-        if (identifier == null || !identifier.matches(SINGLE_WORD_WILDCARD_REGEX)) {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_identifier")); //$NON-NLS-1$                
-        }
-        boolean processed = false;
-        
-        for (int i = 0; i < cacheTypes.length; i++) {
-            if (matches(identifier, cacheTypes[i])) {
-                if(cacheTypes[i].equals(Cache.CODE_TABLE_CACHE)) {
-                    processed = true;
-                    getManager().getDQP().clearCodeTableCache();
-                } else if(cacheTypes[i].equals(Cache.PREPARED_PLAN_CACHE)) {
-                    processed = true;
-                    getManager().getDQP().clearPlanCache();
-                } else if(cacheTypes[i].equals( Cache.QUERY_SERVICE_RESULT_SET_CACHE)) {
-                    processed = true;
-                    getManager().getDQP().clearResultSetCache();
-                } else if (cacheTypes[i].equals(Cache.CONNECTOR_RESULT_SET_CACHE)) {
-                    processed = true;
-                    try {
-                        // Now get for all the connector bindings
-                        Collection bindings = super.getConnectorBindings("*"); //$NON-NLS-1$
-                        for (Iterator iter = bindings.iterator(); iter.hasNext();) {
-                            ConnectorBinding binding = (ConnectorBinding)iter.next();
-                            getDataService().clearConnectorBindingCache(binding.getName());
-                        }
-                    } catch (MetaMatrixComponentException e) {
-                    	throw new AdminComponentException(e);
-                    }                                        
-                } 
-            }
-        }
-        
-        if (!processed) {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.invalid_request", new Object[] {identifier})); //$NON-NLS-1$
-        }        
-    }
-    
-    /** 
-     * @see org.teiid.adminapi.RuntimeStateAdmin#terminateSession(java.lang.String)
-     * @since 4.3
-     */
-    public void terminateSession(String identifier) 
-        throws AdminException {
-        
-        Collection<MetaMatrixSessionInfo> sessions = getClientConnections();
-        ArrayList<MetaMatrixSessionInfo> matchedConnections = new ArrayList<MetaMatrixSessionInfo>();
-        
-        for (MetaMatrixSessionInfo info:sessions) {
-            String id = info.getSessionID().toString();
-            if (matches(identifier, id)) {
-                matchedConnections.add(info);
-            }
-        }
-
-        // terminate the sessions.
-        for (MetaMatrixSessionInfo info: matchedConnections) {
-        	getSessionService().terminateSession(info.getSessionID(), DQPWorkContext.getWorkContext().getSessionId());
-        }
-    }
-    
-    /** 
-     * @see org.teiid.adminapi.RuntimeStateAdmin#cancelRequest(java.lang.String)
-     * @since 4.3
-     */
-    public void cancelRequest(String identifier) 
-        throws AdminException {
-
-        if (identifier == null || !identifier.matches("\\d+\\" + Request.DELIMITER + "\\d+")) { //$NON-NLS-1$ //$NON-NLS-2$
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_identifier")); //$NON-NLS-1$                
-        }
-                
-        String[] identifierParts = MMRequest.buildIdentifierArray(identifier);
-        String connId = identifierParts[0];
-        long requestId = Long.parseLong(identifierParts[1]);
-        
-        // get the client connection
-        RequestID id = new RequestID(connId, requestId);    
-        
-        try {
-        	getManager().getDQP().cancelRequest(id);
-		} catch (MetaMatrixComponentException e) {
-			throw new AdminComponentException(e);
-		}
-    }
-
-    /** 
-     * @see org.teiid.adminapi.RuntimeStateAdmin#cancelSourceRequest(java.lang.String)
-     * @since 4.3
-     */
-    public void cancelSourceRequest(String identifier) 
-        throws AdminException {
-        
-        if (identifier == null || !identifier.matches("\\d+\\" + Request.DELIMITER + "\\d+\\" + Request.DELIMITER + "\\d+" + Request.DELIMITER + "\\d+")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("Admin.Invalid_identifier")); //$NON-NLS-1$                
-        }
-        
-        String[] identifierParts = MMRequest.buildIdentifierArray(identifier);
-
-        String connId = identifierParts[0];
-        long requestId = Long.parseLong(identifierParts[1]);
-        int nodeId = Integer.parseInt(identifierParts[2]);
-        int executionId = Integer.parseInt(identifierParts[3]);
-        AtomicRequestID id = new AtomicRequestID(new RequestID(connId, requestId), nodeId, executionId);
-
-        try {
-        	getManager().getDQP().cancelAtomicRequest(id);
-		} catch (MetaMatrixComponentException e) {
-			throw new AdminComponentException(e);
-		}
-    }
-
-    /** 
-     * @see org.teiid.adminapi.RuntimeStateAdmin#changeVDBStatus(java.lang.String, java.lang.String, int)
-     * @since 4.3
-     */
-    public void changeVDBStatus(String name, String version, int status) 
-        throws AdminException {
-    	super.changeVDBStatus(name, version, status);
-    }
-    
-        
-    @Override
-    public void terminateTransaction(String transactionId, String sessionId)
-    		throws AdminException {
-    	TransactionService ts = getTransactionService();
-    	if (ts != null) {
-    		ts.terminateTransaction(transactionId, sessionId);
-    	}
-    }
-    
-    @Override
-    public void terminateTransaction(Xid transactionId) throws AdminException {
-    	TransactionService ts = getTransactionService();
-    	if (ts != null) {
-    		ts.terminateTransaction(transactionId);
-    	}
-    }
-    
-}

Deleted: branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPSecurityAdminImpl.java
===================================================================
--- branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPSecurityAdminImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/admin/DQPSecurityAdminImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,286 +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.dqp.embedded.admin;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.teiid.adminapi.AdminComponentException;
-import org.teiid.adminapi.AdminException;
-import org.teiid.adminapi.AdminObject;
-import org.teiid.adminapi.AdminOptions;
-import org.teiid.adminapi.AdminProcessingException;
-import org.teiid.adminapi.Group;
-import org.teiid.adminapi.SecurityAdmin;
-import org.xml.sax.SAXException;
-
-import com.metamatrix.admin.api.exception.security.InvalidSessionException;
-import com.metamatrix.admin.api.exception.security.MetaMatrixSecurityException;
-import com.metamatrix.admin.objects.MMGroup;
-import com.metamatrix.admin.objects.MMRole;
-import com.metamatrix.api.exception.security.AuthorizationException;
-import com.metamatrix.api.exception.security.AuthorizationMgmtException;
-import com.metamatrix.api.exception.security.MembershipServiceException;
-import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
-import com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl;
-import com.metamatrix.platform.admin.api.EntitlementMigrationReport;
-import com.metamatrix.platform.security.api.AuthorizationPolicy;
-import com.metamatrix.platform.security.api.AuthorizationPolicyFactory;
-import com.metamatrix.platform.security.api.AuthorizationRealm;
-import com.metamatrix.platform.security.api.Credentials;
-import com.metamatrix.platform.security.api.MetaMatrixPrincipal;
-import com.metamatrix.platform.security.api.MetaMatrixPrincipalName;
-
-
-/** 
- * @since 4.3
- */
-public class DQPSecurityAdminImpl  extends BaseAdmin implements SecurityAdmin {
-
-    public DQPSecurityAdminImpl(EmbeddedConnectionFactoryImpl manager) {
-        super(manager);
-    }
-    
-    /** 
-     * @see com.metamatrix.admin.api.server.ServerSecurityAdmin#addRoleToGroup(java.lang.String, java.lang.String)
-     * @since 4.3
-     */
-    public void assignRoleToGroup(String roleIdentifier, String groupIdentifier) throws AdminException {
-    	throw new AdminComponentException(DQPEmbeddedPlugin.Util.getString("ServerSecurityAdminImpl.not_implemented")); //$NON-NLS-1$
-    }
-    
-    /** 
-     * @see com.metamatrix.admin.api.server.ServerSecurityAdmin#removeRoleFromGroup(java.lang.String, java.lang.String)
-     * @since 4.3
-     */
-    public void removeRoleFromGroup(String roleIdentifier, String groupIdentifier) throws AdminException {
-    	throw new AdminComponentException(DQPEmbeddedPlugin.Util.getString("ServerSecurityAdminImpl.not_implemented")); //$NON-NLS-1$
-    }
-    
-    public boolean authenticateUser(String username, char[] credentials, Serializable trustePayload, String applicationName) throws AdminException {
-        try {
-			return getMembershipService().authenticateUser(username, new Credentials(credentials), trustePayload, applicationName).isAuthenticated();
-		} catch (MembershipServiceException e) {
-			throw new AdminComponentException(e);
-		} 
-    }
-    
-
-    /** 
-     * @see com.metamatrix.admin.api.server.ServerSecurityAdmin#getGroupsForUser(java.lang.String, boolean)
-     * @since 4.3
-     */
-    public Collection<Group> getGroupsForUser(String userIdentifier) throws AdminException {
-        if (userIdentifier == null) {
-            throwProcessingException("AdminImpl.requiredparameter", new Object[] {}); //$NON-NLS-1$
-        }
-        
-        if ( userIdentifier.equals(AdminObject.WILDCARD) ) {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("ServerSecurityAdminImpl.Cant_use_wildcard")); //$NON-NLS-1$
-        }
-        Collection groups = new ArrayList();
-        // Get all memberships - explicit and implicit
-        Set allMemberships = null;
-        try {
-            allMemberships = getMembershipService().getGroupsForUser(userIdentifier);
-        } catch (MetaMatrixSecurityException e) {
-            throw new AdminComponentException(e);
-        }
-        Iterator allMembershipsItr = allMemberships.iterator();
-        while ( allMembershipsItr.hasNext() ) {
-            groups.add(new MMGroup(new String[] {(String)allMembershipsItr.next()}));
-        }
-        return groups;
-    }
-
-    /** 
-     * @see com.metamatrix.admin.api.server.ServerSecurityAdmin#getGroups(java.lang.String)
-     * @since 4.3
-     */
-    public Collection<Group> getGroups(String groupIdentifier) throws AdminException {
-        if (groupIdentifier == null) {
-            throwProcessingException("AdminImpl.requiredparameter", new Object[] {}); //$NON-NLS-1$
-        }
-        
-        Collection<Group> groups = new ArrayList<Group>();
-        Collection allGroups = null;
-        // Add all groups from internal membership domain
-        try {
-            allGroups = getMembershipService().getGroupNames();
-        } catch (MetaMatrixSecurityException e) {
-        	throw new AdminComponentException(e);
-        }
-
-        Iterator groupItr = allGroups.iterator();
-        while ( groupItr.hasNext() ) {
-            String groupName = (String) groupItr.next();
-
-            if (!groupIdentifier.equals(AdminObject.WILDCARD) && !groupName.equals(groupIdentifier)) {
-                continue;
-            }
-
-            groups.add(new MMGroup(new String[] {groupName}));
-        }
-        return groups;
-    }
-
-
-    /** 
-     * @see com.metamatrix.admin.api.server.ServerSecurityAdmin#getRolesForGroup(java.lang.String)
-     * @since 4.3
-     */
-    public Collection getRolesForGroup(String groupIdentifier) throws AdminException {
-        if (groupIdentifier == null) {
-            throwProcessingException("AdminImpl.requiredparameter", new Object[] {}); //$NON-NLS-1$
-        }
-        
-        if ( groupIdentifier.equals(AdminObject.WILDCARD) ) {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("ServerSecurityAdminImpl.Cant_use_wildcard")); //$NON-NLS-1$
-        }
-        Collection roleNames = null;
-        try {
-            roleNames = getAuthorizationService().getRoleNamesForPrincipal(new MetaMatrixPrincipalName(groupIdentifier, MetaMatrixPrincipal.TYPE_GROUP));
-        } catch (InvalidSessionException e) {
-        	throw new AdminComponentException(e);
-        } catch (AuthorizationMgmtException e) {
-        	throw new AdminComponentException(e);
-        } catch (AuthorizationException e) {
-        	throw new AdminComponentException(e);
-        }
-        Collection roles = new ArrayList();
-        Iterator roleNameItr = roleNames.iterator();
-        while ( roleNameItr.hasNext() ) {
-             String roleName = (String)roleNameItr.next();
-             roles.add(new MMRole(new String[] {roleName}));
-        }
-        return roles;
-    }
-       
-    /**
-     * @see com.metamatrix.admin.api.server.ServerSecurityAdmin#importDataRoles(java.lang.String, java.lang.String, char[], org.teiid.adminapi.AdminOptions)
-     */
-    public String importDataRoles(String vdbName, String vdbVersion, char[] xmlContents, AdminOptions options) 
-        throws AdminException{
-        
-        if (vdbName == null) {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("ServerSecurityAdminImpl.vdbName_can_not_be_null")); //$NON-NLS-1$
-        }
-        
-        if (vdbVersion == null) {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("ServerSecurityAdminImpl.vdbVersion_can_not_be_null")); //$NON-NLS-1$
-        }
-        
-        if (options == null) {
-            
-            options = new AdminOptions(AdminOptions.OnConflict.IGNORE);
-        }
-
-        try {
-        	EntitlementMigrationReport rpt = new EntitlementMigrationReport("from file", vdbName + " " + vdbVersion); //$NON-NLS-1$ //$NON-NLS-2$
-        	
-            Collection<AuthorizationPolicy> roles = AuthorizationPolicyFactory.buildPolicies(vdbName, vdbVersion, xmlContents);
-
-            AuthorizationRealm realm = new AuthorizationRealm(vdbName, vdbVersion);
-            
-            getAuthorizationService().updatePoliciesInRealm(realm, roles);
-
-            return rpt.toString();
-        } catch (AuthorizationMgmtException e) {
-        	throw new AdminProcessingException(e);
-   		} catch (SAXException e) {
-   			throw new AdminComponentException(e);
-   		} catch (IOException e) {
-   			throw new AdminComponentException(e);
-   		} catch (ParserConfigurationException e) {
-   			throw new AdminComponentException(e);
-        }
-    }
-
-    /**
-     * @see com.metamatrix.admin.api.server.ServerSecurityAdmin#exportDataRoles(java.lang.String, java.lang.String)
-     */
-    public char[] exportDataRoles(String vdbName, String vdbVersion) throws AdminException {
-        
-        if (vdbName == null) {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("ServerSecurityAdminImpl.vdbName_can_not_be_null")); //$NON-NLS-1$
-        }
-        
-        if (vdbVersion == null) {
-            throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString("ServerSecurityAdminImpl.vdbVersion_can_not_be_null")); //$NON-NLS-1$
-        }
-	     
-        Collection roles = null;
-		try {
-			roles = getAuthorizationService().getPoliciesInRealm(new AuthorizationRealm(vdbName, vdbVersion));
-			if (roles != null && !roles.isEmpty()) {
-				return AuthorizationPolicyFactory.exportPolicies(roles);
-			}
-			return null;
-		} catch (AuthorizationMgmtException e) {
-			throw new AdminProcessingException(e);
-		} catch (AuthorizationException e) {
-			throw new AdminProcessingException(e);
-		} catch (IOException e) {
-			throw new AdminComponentException(e);
-		}
-	}
-    
-    @Override
-    public List<String> getDomainNames() throws AdminException {
-    	try {
-			return this.getMembershipService().getDomainNames();
-		} catch (MembershipServiceException e) {
-			throw new AdminComponentException(e);
-		}
-    }
-    
-    @Override
-    public Collection<Group> getGroupsForDomain(String domainName)
-    		throws AdminException {
-        if (domainName == null) {
-            throwProcessingException("AdminImpl.requiredparameter", new Object[] {}); //$NON-NLS-1$
-        }
-        try {
-        	Collection<String> groupNames = this.getMembershipService().getGroupsForDomain(domainName);
-        	List<Group> result = new ArrayList<Group>(groupNames.size());
-        	for (String groupName : groupNames) {
-        		result.add(new MMGroup(new String[] {groupName}));
-			}
-        	return result;
-        } catch (MembershipServiceException e) {
-        	throw new AdminComponentException(e);
-        }
-    }
-    
-     void throwProcessingException(String key, Object[] objects) throws AdminException {
-        throw new AdminProcessingException(DQPEmbeddedPlugin.Util.getString(key, objects));
-    }    
- 
-}

Deleted: branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/configuration/ExtensionModuleReader.java
===================================================================
--- branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/configuration/ExtensionModuleReader.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/configuration/ExtensionModuleReader.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,151 +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.dqp.embedded.configuration;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.common.config.api.ExtensionModule;
-import com.metamatrix.common.config.model.BasicExtensionModule;
-import com.metamatrix.common.protocol.URLHelper;
-import com.metamatrix.common.util.ByteArrayHelper;
-import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
-
-
-/** 
- * @since 4.3
- */
-public class ExtensionModuleReader {
-    public static final String MM_JAR_PROTOCOL = "extensionjar"; //$NON-NLS-1$
-    
-    /**
-     * Load the extension module from the file system
-     * @return
-     * @since 4.3
-     */
-    public static ExtensionModule loadExtensionModule(String extModuleName, URL[] contexts) throws MetaMatrixComponentException{
-        byte[] contents = null;
-        InputStream in =  null;
-        try {
-        	URL extModuleURL = resolveExtensionModule(MM_JAR_PROTOCOL+":"+extModuleName, contexts); //$NON-NLS-1$
-        	if (extModuleURL != null) {
-	            in = extModuleURL.openStream();                               
-	            contents = ByteArrayHelper.toByteArray(in);
-        	}
-        	else {
-        		throw new MetaMatrixComponentException(DQPEmbeddedPlugin.Util.getString("ExtensionModuleReader.ext_module_does_not_exist", extModuleName)); //$NON-NLS-1$
-        	}
-        } catch (FileNotFoundException e) {
-            throw new MetaMatrixComponentException(DQPEmbeddedPlugin.Util.getString("ExtensionModuleReader.ext_module_does_not_exist", extModuleName)); //$NON-NLS-1$
-        } catch (IOException e) {
-            throw new MetaMatrixComponentException(e, DQPEmbeddedPlugin.Util.getString("ExtensionModuleReader.ext_module_failed_to_read", extModuleName)); //$NON-NLS-1$
-        } finally {
-            if (in != null) {
-                try{in.close();}catch(IOException e) {}
-            }
-        }
-        return new BasicExtensionModule(extModuleName, ExtensionModule.JAR_FILE_TYPE, "Jar File", contents); //$NON-NLS-1$            
-    }
-    
-    /**
-     * Load all the Extension modules from the given directory 
-     * @param extModuleDirectory
-     * @return list of Extension Modules {@link com.metamatrix.common.config.api.ExtensionModule}
-     * @since 4.3
-     */
-    public static List<ExtensionModule> loadExtensionModules(URL[] contexts) throws MetaMatrixComponentException{
-            
-        ObjectInputStream in =  null;
-        List<ExtensionModule> extModuleList = new ArrayList<ExtensionModule>();
-        
-        for (URL extensionPathURL: contexts) {
-        	String extensionPath = extensionPathURL.toString()+"?action=list&filter=.jar"; //$NON-NLS-1$
-                
-	        try {
-	            extensionPathURL = URLHelper.buildURL(extensionPath);        
-	            in = new ObjectInputStream(extensionPathURL.openStream());
-	            String[] jarFiles = (String[])in.readObject();
-	            for (int i = 0; i < jarFiles.length; i++) {
-	                String jarName = jarFiles[i];
-	                jarName = jarName.substring(jarName.lastIndexOf('/')+1);
-	                byte[] contents = null;                
-	                try {
-	                    URL jarFileURL = URLHelper.buildURL(jarFiles[i]);
-	                    InputStream jarStream = jarFileURL.openStream();
-	                    contents = ByteArrayHelper.toByteArray(jarStream);
-	                    jarStream.close();
-	                } catch (IOException e) {
-	                    throw new MetaMatrixComponentException(e, DQPEmbeddedPlugin.Util.getString("ExtensionModuleReader.ext_module_failed_to_read", new Object[] {jarFiles[i]})); //$NON-NLS-1$
-	                }
-	                extModuleList.add(new BasicExtensionModule(jarName, ExtensionModule.JAR_FILE_TYPE, "Jar File", contents)); //$NON-NLS-1$
-	            }
-	        } catch (FileNotFoundException e) {
-	            // if the file not found then it means no extensions directory and no extension 
-	            // modules, just return a empty list.
-	        } catch (IOException e) {
-	            throw new MetaMatrixComponentException(e);
-	        } catch(ClassNotFoundException e){
-	        	throw new MetaMatrixComponentException(e);
-	        } finally {
-	            if (in != null) {
-	                try{in.close();}catch(IOException e) {}
-	            }
-	        }
-        }
-        return extModuleList;
-    }
-    
-    public static URL resolveExtensionModule(String extModule, URL[] contexts) throws MalformedURLException {
-		int idx = extModule.indexOf(MM_JAR_PROTOCOL);
-		if (idx != -1) {
-			for (URL context : contexts) {
-				URL entry = URLHelper.buildURL(context, extModule.substring(idx + MM_JAR_PROTOCOL.length() + 1));
-				if (urlExists(entry)) {
-					return entry;
-				}
-			}
-
-		} else {
-			return new URL(extModule);
-		}
-		return null;
-	}
-    
-    private static boolean urlExists(URL url) {
-        InputStream in = null;
-        try {
-            in = url.openStream();
-            in.close();
-            return true;
-        } catch (IOException e) {
-        }
-    	return false;
-    }
-}

Deleted: branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/configuration/ExtensionModuleWriter.java
===================================================================
--- branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/configuration/ExtensionModuleWriter.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/configuration/ExtensionModuleWriter.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,103 +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.dqp.embedded.configuration;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URL;
-import java.net.URLConnection;
-
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.common.config.api.ExtensionModule;
-import com.metamatrix.common.protocol.URLHelper;
-import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
-
-
-/** 
- * Utility to abstract the Extension Module's persistence.
- * @since 4.3
- */
-public class ExtensionModuleWriter {
-    
-    public static void write(ExtensionModule extModule, URL[] contexts) throws MetaMatrixComponentException {
-        OutputStream out = null;
-        try {
-            String extFile = extModule.getFullName()+"?action=write"; //$NON-NLS-1$
-            // NOTE: only write to the very first context.
-            URL extModuleURL = URLHelper.buildURL(contexts[0], extFile);
-                        
-            URLConnection conn = extModuleURL.openConnection();
-            out =  conn.getOutputStream();
-            out.write(extModule.getFileContents());
-            DQPEmbeddedPlugin.logInfo("ExtensionModuleWriter.ext_module_save", new Object[] {extModule.getFullName(), extModuleURL}); //$NON-NLS-1$
-        } catch (IOException e) {
-            throw new MetaMatrixComponentException(e);
-        } finally {
-            if (out != null) {
-                try{out.close();}catch(IOException e) {}
-            }
-        }
-    }
-    
-    /**
-     * Delete the extension module from the file system. 
-     * @param extModule
-     * @since 4.3
-     */
-    public static void deleteModule(String extModuleName, URL[] contexts) throws MetaMatrixComponentException{
-
-        URL extModuleURL = null;
-		try {
-			extModuleURL = ExtensionModuleReader.resolveExtensionModule(ExtensionModuleReader.MM_JAR_PROTOCOL+":"+extModuleName, contexts); //$NON-NLS-1$
-			if (extModuleURL == null) {
-				throw new MetaMatrixComponentException(DQPEmbeddedPlugin.Util.getString("ExtensionModuleReader.ext_module_does_not_exist", extModuleName)); //$NON-NLS-1$
-			}
-		} catch (IOException e) {
-			throw new MetaMatrixComponentException(DQPEmbeddedPlugin.Util.getString("ExtensionModuleReader.ext_module_does_not_exist", extModuleName)); //$NON-NLS-1$
-		}
-        
-        String extFile = extModuleURL.toString()+"?action=delete"; //$NON-NLS-1$
-        
-        InputStream in = null;
-        try {
-            extModuleURL = URLHelper.buildURL(extFile);        
-            in = extModuleURL.openStream();
-            if (in != null) {
-                // now delete file from the extensions directory..        
-                throw new MetaMatrixComponentException(DQPEmbeddedPlugin.Util.getString("ExtensionModuleWriter.ext_module_delete_failed", new Object[] {extModuleURL})); //$NON-NLS-1$
-            }
-            DQPEmbeddedPlugin.logInfo("ExtensionModuleWriter.ext_module_delete", new Object[] {extModuleName, extModuleURL}); //$NON-NLS-1$
-        }catch(FileNotFoundException e) {
-            // this is what we should expect if open the stream.
-            DQPEmbeddedPlugin.logInfo("ExtensionModuleWriter.ext_module_delete", new Object[] {extModuleName, extModuleURL}); //$NON-NLS-1$                                    
-        }catch(IOException e) {
-            throw new MetaMatrixComponentException(DQPEmbeddedPlugin.Util.getString("ExtensionModuleWriter.ext_module_delete_failed", new Object[] {extModuleURL})); //$NON-NLS-1$            
-        } finally {
-            if (in != null) {
-                try {in.close();}catch(IOException e) {}
-            }
-        }
-    }                                              
-}

Deleted: branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/configuration/ServerConfigFileReader.java
===================================================================
--- branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/configuration/ServerConfigFileReader.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/configuration/ServerConfigFileReader.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,186 +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.dqp.embedded.configuration;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import com.metamatrix.common.config.api.ComponentType;
-import com.metamatrix.common.config.api.ComponentTypeDefn;
-import com.metamatrix.common.config.api.ComponentTypeID;
-import com.metamatrix.common.config.api.Configuration;
-import com.metamatrix.common.config.api.ConfigurationModelContainer;
-import com.metamatrix.common.config.api.ConnectorBinding;
-import com.metamatrix.common.config.api.exceptions.ConfigurationException;
-import com.metamatrix.common.config.model.BasicComponentType;
-import com.metamatrix.common.config.model.ConfigurationModelContainerAdapter;
-
-/**
- * This class loades the server configuration file <code>ServerConfig.xml</code>
- */
-public class ServerConfigFileReader {
-
-    private static final String QUERY_SERVICE= "QueryService"; //$NON-NLS-1$
-    private Properties properties = new Properties();
-    private Map connectorBindings = new HashMap();
-    private Map connectorTypes = new HashMap();
-    private ConfigurationModelContainer configuration = null;
-    
-    /**
-     * Load the server configuration
-     * @param configFile Server Config File
-     */
-    public ServerConfigFileReader(URL configFile) throws IOException {                       
-        loadConfigFile(configFile);
-    }       
-
-    private void loadConfigFile(URL configFile) throws IOException {
-
-        InputStream in = null;
-        try {
-            in = configFile.openStream();
-            ConfigurationModelContainerAdapter configAdapter = new ConfigurationModelContainerAdapter();
-
-            configuration = configAdapter.readConfigurationModel(in, Configuration.NEXT_STARTUP_ID);
-           
-            // Get DQP properties
-            Properties globalProps = configuration.getConfiguration().getProperties();
-            
-            Properties qs = configuration.getConfiguration().getServiceComponentDefn(QUERY_SERVICE).getProperties();            
-            this.properties.putAll(globalProps);
-            this.properties.putAll(qs);
-            
-            // get connector types
-            Collection componentTypes = configuration.getComponentTypes().values();
-            for (Iterator i = componentTypes.iterator(); i.hasNext();) {
-                ComponentType type = (ComponentType)i.next();
-                if (type.getComponentTypeCode() == ComponentType.CONNECTOR_COMPONENT_TYPE_CODE) {
-                    connectorTypes.put(type.getName(), resolvePropertyDefns(type, this.configuration));
-                }
-            }
-
-            // Load connector bindings, do we ever need connector types?
-            Collection bindings = configuration.getConfiguration().getConnectorBindings();
-            Iterator it = bindings.iterator();
-            while(it.hasNext()) {
-                ConnectorBinding binding = (ConnectorBinding)it.next();
-                connectorBindings.put(binding.getFullName(), binding);
-            }            
-        } catch (ConfigurationException e) {
-            throw new IOException(e.getMessage());
-        } finally {
-            if (in != null) {
-                in.close();
-            }
-        }
-    }
-    
-    /**
-     * Get properties defined for the System/Query Service 
-     * @return properties of the system
-     * @since 4.3
-     */
-    public Properties getSystemProperties() {
-        return this.properties;
-    }
-    
-    /**
-     * Will return a map of connector binding properties if the
-     * configuration file contained any,
-     * key->binding name    value->Map of binding properties
-     * @return map of the connector bindings.
-     */
-    public Map getConnectorBindings() {
-        return connectorBindings;
-    }       
-    
-    /**
-     * Get Server Configuration 
-     * @return
-     * @since 4.3
-     */
-    public ConfigurationModelContainer getConfiguration() {
-        return configuration;
-    }
-    
-    /**
-     * Return the Connector types registered with the server configuration 
-     * @return
-     * @since 4.3
-     */
-    public Map getConnectorTypes() {
-        return connectorTypes;
-    }
-    
-    public static ComponentType resolvePropertyDefns(ComponentType type, ConfigurationModelContainer configuration) {
-    	BasicComponentType baseType = (BasicComponentType)type;
-    	Collection c = configuration.getAllComponentTypeDefinitions((ComponentTypeID)baseType.getID());
-
-    	// if the type is found in the configuration.xml, then add its prop-definitions; else look for parent
-    	if (c == null || c.isEmpty()) {
-    		// this means user has added a new connector type
-    		c = configuration.getAllComponentTypeDefinitions(type.getSuperComponentTypeID());
-    	}
-    		
-		if (c != null && !c.isEmpty()) {
-			Set<ComponentTypeDefn> defns = new HashSet<ComponentTypeDefn>();
-			defns.addAll(c);
-			
-			// Hashset does not add, if the object is already present in the collection through addall
-			// so they need to added one by one.
-			Collection<ComponentTypeDefn> overwriteDefns = type.getComponentTypeDefinitions();
-			for (ComponentTypeDefn pd:overwriteDefns) {
-				if (defns.contains(pd)) {
-					defns.remove(pd);
-				}
-				defns.add(pd);
-			}
-			
-			baseType.setComponentTypeDefinitions(defns);
-		}
-		return baseType;
-	}
-
-	public static boolean containsBinding(ConfigurationModelContainer configuration, String name) {
-        // Load connector bindings, do we ever need connector types?
-        Collection<ConnectorBinding> bindings = configuration.getConfiguration().getConnectorBindings();
-        for(ConnectorBinding binding:bindings) {
-        	String deployedName = binding.getDeployedName();
-        	if (deployedName == null) {
-        		deployedName = binding.getFullName();
-        	}
-        	if (deployedName.equalsIgnoreCase(name)) {
-        		return true;
-        	}
-        }
-        return false;
-	}    
-}

Deleted: branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/configuration/ServerConfigFileWriter.java
===================================================================
--- branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/configuration/ServerConfigFileWriter.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/configuration/ServerConfigFileWriter.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,202 +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.dqp.embedded.configuration;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.net.URL;
-import java.util.Properties;
-
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.common.application.exception.ApplicationInitializationException;
-import com.metamatrix.common.config.api.ComponentDefnID;
-import com.metamatrix.common.config.api.ConfigurationModelContainer;
-import com.metamatrix.common.config.api.ConnectorBinding;
-import com.metamatrix.common.config.api.ConnectorBindingType;
-import com.metamatrix.common.config.model.BasicConfiguration;
-import com.metamatrix.common.config.model.BasicConfigurationObjectEditor;
-import com.metamatrix.common.config.model.BasicServiceComponentDefn;
-import com.metamatrix.common.config.model.ConfigurationModelContainerAdapter;
-import com.metamatrix.common.config.model.ConfigurationModelContainerImpl;
-import com.metamatrix.common.protocol.URLHelper;
-
-
-/** 
- * A utility to write/convert the ServerConfig file from its object form. 
- * @since 4.3
- */
-public class ServerConfigFileWriter {
-    private static final String QUERY_SERVICE= "QueryService"; //$NON-NLS-1$
-    
-    /**
-     * Write the Server Configuration into supplied file, in the known Server 
-     * Configuration format as in config.xml (This is clearly a hack without Mr.Halbert's help) 
-     * @param properties
-     * @return
-     * @throws ApplicationInitializationException
-     * @since 4.3
-     */
-    public static char[] writeToCharArray(ConfigurationModelContainer model) 
-        throws MetaMatrixComponentException{
-    
-        try {
-            ConfigurationModelContainerAdapter configAdapter = new ConfigurationModelContainerAdapter();            
-            ByteArrayOutputStream bos = new ByteArrayOutputStream(1024);
-            configAdapter.writeConfigurationModel(bos, model, "DQP"); //$NON-NLS-1$            
-            char[] contents = bos.toString().toCharArray();
-            bos.close();
-            return contents;
-        } catch (Exception e) {
-            throw new MetaMatrixComponentException(e);
-        }
-    }
-    
-    /**
-     * Write the Server Configuration into supplied file, in the known Server 
-     * Configuration format as in config.xml 
-     * @param properties
-     * @param configFileURL
-     * @throws ApplicationInitializationException
-     * @since 4.3
-     */
-    public static void write(ConfigurationModelContainer model, URL configFileURL) 
-        throws MetaMatrixComponentException{    
-        ConfigurationModelContainerAdapter configAdapter = new ConfigurationModelContainerAdapter();
-        OutputStream out = null;
-        try {
-            String configFile = configFileURL.toString()+"?action=write"; //$NON-NLS-1$
-            configFileURL = URLHelper.buildURL(configFile);
-            out = configFileURL.openConnection().getOutputStream();
-            configAdapter.writeConfigurationModel(out, model, "DQP"); //$NON-NLS-1$            
-        } catch (Exception e) {
-            throw new MetaMatrixComponentException(e);
-        } finally {
-            if (out != null) {                
-                try {out.close();} catch (IOException e) {}
-            }
-        }
-    }    
-    
-    /**
-     * Add the Connector Bindings to the Configuration object and return the modified
-     * object  
-     * @param model - Configuration to be changed.
-     * @param binding - Connector binding to add/replace
-     * @return modified object
-     * @since 4.3
-     */
-    public static ConfigurationModelContainer addConnectorBinding(ConfigurationModelContainer model, ConnectorBinding binding) 
-        throws MetaMatrixComponentException{
-        ConfigurationModelContainerImpl config = (ConfigurationModelContainerImpl)model;
-        ((BasicConfiguration)config.getConfiguration()).addComponentDefn(binding);
-        return config;
-    }
-    
-    /**
-     * Remove the Connector Bindings to the Configuration object and return the modified
-     * object  
-     * @param model - Configuration to be changed.
-     * @param binding - Connector binding to add/replace
-     * @return modified object
-     * @since 4.3
-     */
-    public static ConfigurationModelContainer deleteConnectorBinding(ConfigurationModelContainer model, ConnectorBinding binding)
-        throws MetaMatrixComponentException{
-        ConfigurationModelContainerImpl config = (ConfigurationModelContainerImpl)model;
-        ((BasicConfiguration)config.getConfiguration()).removeComponentObject((ComponentDefnID)binding.getID());
-        return config;        
-    }
-    
-    /**
-     * Add the connector Type to the configuration object supplied and return the modified
-     * object 
-     * @param model - current configuration to be modified
-     * @param type - connector type to be added/replaced
-     * @return - modified configuration
-     * @since 4.3
-     */
-    public static ConfigurationModelContainer addConnectorType(ConfigurationModelContainer model, ConnectorBindingType type)
-        throws MetaMatrixComponentException{
-        ConfigurationModelContainerImpl config = (ConfigurationModelContainerImpl)model;
-        config.addComponentType(type);
-        return config;
-    }
-    
-    
-    /**
-     * Delete the connector Type to the configuration object supplied and return the modified
-     * object 
-     * @param model - current configuration to be modified
-     * @param type - connector type to be added/replaced
-     * @return - modified configuration
-     * @since 4.3
-     */
-    public static ConfigurationModelContainer deleteConnectorType(ConfigurationModelContainer model, ConnectorBindingType type)
-        throws MetaMatrixComponentException{
-        ConfigurationModelContainerImpl config = (ConfigurationModelContainerImpl)model;
-        config.remove(type.getID());
-        return config;
-    }
-    
-    /**
-     * Add the given property to the configuration object and return the modified object 
-     * @param model - model to be modified
-     * @param propertyName - Property Name
-     * @param propertyValue - value to be added/replaced.
-     * @return - modified configuration object
-     * @since 4.3
-     */
-    public static ConfigurationModelContainer addProperty(ConfigurationModelContainer model, String propertyName, String propertyValue)
-        throws MetaMatrixComponentException {
-        BasicServiceComponentDefn component = (BasicServiceComponentDefn)model.getConfiguration().getServiceComponentDefn(QUERY_SERVICE);        
-        BasicConfigurationObjectEditor editor = new BasicConfigurationObjectEditor();
-        
-        Properties currentProperties = component.getProperties();
-        currentProperties.put(propertyName, propertyValue);
-        editor.modifyProperties(component, currentProperties, BasicConfigurationObjectEditor.SET);
-        
-        return model;
-    }
-    
-    
-    /**
-     * Add the specified properties to the configuration object and return the modified object 
-     * @param model - model to be modified
-     * @param properties - properties to add/replace.
-     * @return - modified configuration object
-     * @since 4.3
-     */
-    public static ConfigurationModelContainer addProperties(ConfigurationModelContainer model, Properties properties)
-        throws MetaMatrixComponentException {
-        BasicServiceComponentDefn component = (BasicServiceComponentDefn)model.getConfiguration().getServiceComponentDefn(QUERY_SERVICE);        
-        BasicConfigurationObjectEditor editor = new BasicConfigurationObjectEditor();
-        
-        Properties currentProperties = component.getProperties();
-        currentProperties.putAll(properties);
-        
-        editor.modifyProperties(component, currentProperties, BasicConfigurationObjectEditor.SET);
-        
-        return model;
-    }
-}

Deleted: branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/services/DefaultIndexConnectorBinding.java
===================================================================
--- branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/services/DefaultIndexConnectorBinding.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/services/DefaultIndexConnectorBinding.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,242 +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.dqp.embedded.services;
-
-import java.util.Date;
-import java.util.Properties;
-
-import org.teiid.connector.api.ConnectorPropertyNames;
-
-import com.metamatrix.common.config.api.ComponentTypeID;
-import com.metamatrix.common.config.api.ConfigurationID;
-import com.metamatrix.common.config.api.ConnectorBinding;
-import com.metamatrix.common.config.model.ConfigurationVisitor;
-import com.metamatrix.common.namedobject.BaseID;
-import com.metamatrix.core.MetaMatrixRuntimeException;
-
-
-/** 
- * This is default class which will used by the VDBs as ConnectorBinding for the 
- * CoreConstants.SYSTEM_PHYSICAL_MODEL_NAME. This is same connector in all the
- * VDBs, however this is not included in the VDB.
- * 
- * @since 4.3
- */
-class DefaultIndexConnectorBinding implements ConnectorBinding {
-        
-    private static final String INDEX_CONNECTOR_NAME = "Index_Connector"; //$NON-NLS-1$
-    private static final String INDEX_CONNECTOR_CLASS_NAME = "com.metamatrix.connector.metadata.IndexConnector"; //$NON-NLS-1$
-    private static final String INDEX_CONNECTOR_MAX_ROWS = "0"; //$NON-NLS-1$
-    
-    private Properties props = new Properties();
-    private Date creationTime = new Date(System.currentTimeMillis());
-    
-    /**
-     * ctor  
-     * @since 4.3
-     */
-    public DefaultIndexConnectorBinding() {
-        this.props.setProperty(ConnectorPropertyNames.CONNECTOR_CLASS, INDEX_CONNECTOR_CLASS_NAME );
-        this.props.setProperty(ConnectorPropertyNames.MAX_RESULT_ROWS, INDEX_CONNECTOR_MAX_ROWS ); 
-    }
-    
-    /** 
-     * @see com.metamatrix.common.config.api.ConnectorBinding#getDeployedName()
-     */
-    public String getDeployedName() {
-        return INDEX_CONNECTOR_NAME;
-    }
-    
-
-    /** 
-     * @see com.metamatrix.common.config.api.ServiceComponentDefn#accept(com.metamatrix.common.config.model.ConfigurationVisitor)
-     * @since 4.3
-     */
-    public void accept(ConfigurationVisitor visitor) {         
-        // no configuratio needed
-    }
-
-    /** 
-     * @see com.metamatrix.common.config.api.ServiceComponentDefn#getRoutingUUID()
-     * @since 4.3
-     */
-    public String getRoutingUUID() {
-        return INDEX_CONNECTOR_NAME;
-    }
-    
-    
-    /** 
-      * @since 6.1
-     */
-	public boolean isXASupported() {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	/** 
-     * @see com.metamatrix.common.config.api.ComponentDefn#getConfigurationID()
-     * @since 4.3
-     */
-    public ConfigurationID getConfigurationID() {
-        return null;
-    }
-
-    /** 
-     * @see com.metamatrix.common.config.api.ComponentDefn#isEnabled()
-     * @since 4.3
-     */
-    public boolean isEnabled() {
-        return true;
-    }
-
-    /** 
-     * @see com.metamatrix.common.config.api.ComponentObject#getName()
-     * @since 4.3
-     */
-    public String getName() {
-        return INDEX_CONNECTOR_NAME;
-    }
-
-    /** 
-     * @see com.metamatrix.common.config.api.ComponentObject#getProperties()
-     * @since 4.3
-     */
-    public Properties getProperties() {
-        return props;
-    }
-
-    /** 
-     * @see com.metamatrix.common.config.api.ComponentObject#getProperty(java.lang.String)
-     * @since 4.3
-     */
-    public String getProperty(String name) {
-        return props.getProperty(name);
-    }
-
-    /** 
-     * @see com.metamatrix.common.config.api.ComponentObject#getComponentTypeID()
-     * @since 4.3
-     */
-    public ComponentTypeID getComponentTypeID() {
-        return new ComponentTypeID(INDEX_CONNECTOR_NAME);
-    }
-
-    /** 
-     * @see com.metamatrix.common.config.api.ComponentObject#getDescription()
-     * @since 4.3
-     */
-    public String getDescription() {
-        return INDEX_CONNECTOR_NAME;
-    }
-
-    /** 
-     * @see com.metamatrix.common.config.api.ComponentObject#getCreatedBy()
-     * @since 4.3
-     */
-    public String getCreatedBy() {
-        return "system.runtime"; //$NON-NLS-1$
-    }
-
-    /** 
-     * @see com.metamatrix.common.config.api.ComponentObject#getCreatedDate()
-     * @since 4.3
-     */
-    public Date getCreatedDate() {
-        return creationTime;
-    }
-
-    /** 
-     * @see com.metamatrix.common.config.api.ComponentObject#getLastChangedBy()
-     * @since 4.3
-     */
-    public String getLastChangedBy() {
-        return "none"; //$NON-NLS-1$
-    }
-
-    /** 
-     * @see com.metamatrix.common.config.api.ComponentObject#getLastChangedDate()
-     * @since 4.3
-     */
-    public Date getLastChangedDate() {
-        return creationTime;
-    }
-
-    /** 
-     * @see com.metamatrix.common.config.api.ComponentObject#isDependentUpon(com.metamatrix.common.namedobject.BaseID)
-     * @since 4.3
-     */
-    public boolean isDependentUpon(BaseID componentObjectId) {
-        return false;
-    }
-
-    /** 
-     * @see com.metamatrix.common.namedobject.BaseObject#getID()
-     * @since 4.3
-     */
-    public BaseID getID() {
-        return null;
-    }
-
-    /** 
-     * @see com.metamatrix.common.namedobject.BaseObject#getFullName()
-     * @since 4.3
-     */
-    public String getFullName() {
-        return INDEX_CONNECTOR_NAME;
-    }
-
-    /** 
-     * @see com.metamatrix.common.namedobject.BaseObject#compareTo(java.lang.Object)
-     * @since 4.3
-     */
-    public int compareTo(Object obj) {
-        return 0;
-    }
-    /**
-     * Return a deep cloned instance of this object.  Subclasses must override
-     * this method.
-     * @return the object that is the clone of this instance.
-     */
-    public Object clone() {
-        try {
-			return super.clone();
-		} catch (CloneNotSupportedException e) {
-			throw new MetaMatrixRuntimeException(e);
-		}
-    }
-
-    /** 
-     * @see com.metamatrix.common.config.api.ConnectorBinding#getConnectorClass()
-     * @since 4.3
-     */
-    public String getConnectorClass() {
-        return INDEX_CONNECTOR_CLASS_NAME;
-    }
-
-    /** 
-     * @see com.metamatrix.common.config.api.ComponentDefn#isEssential()
-     */
-    public boolean isEssential() {
-        return false;
-    }
-}

Modified: branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedBaseDQPService.java
===================================================================
--- branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedBaseDQPService.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedBaseDQPService.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -32,7 +32,6 @@
 import com.metamatrix.common.application.exception.ApplicationLifecycleException;
 import com.metamatrix.common.vdb.api.VDBArchive;
 import com.metamatrix.common.vdb.api.VDBDefn;
-import com.metamatrix.core.CoreConstants;
 import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
 import com.metamatrix.dqp.service.ConfigurationService;
 import com.metamatrix.dqp.service.DQPServiceNames;
@@ -44,9 +43,8 @@
  * @since 4.3
  */
 public abstract class EmbeddedBaseDQPService implements ApplicationService {
-    public static final String SYSTEM_PHYSICAL_MODEL_NAME = CoreConstants.SYSTEM_PHYSICAL_MODEL_NAME;
-    
-    private boolean started = false;
+	public static final String INDEX_CONNECTOR_NAME = "java:index-connector-binding"; //$NON-NLS-1$
+	private boolean started = false;
     private boolean initialized = false;    
     private ApplicationEnvironment environment;
     

Modified: branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java
===================================================================
--- branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedConfigurationService.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -34,37 +34,24 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
-import java.util.StringTokenizer;
 
-import com.google.inject.Inject;
-import com.google.inject.name.Named;
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.security.SessionServiceException;
-import com.metamatrix.common.application.AbstractClassLoaderManager;
 import com.metamatrix.common.application.ApplicationEnvironment;
 import com.metamatrix.common.application.exception.ApplicationInitializationException;
 import com.metamatrix.common.application.exception.ApplicationLifecycleException;
-import com.metamatrix.common.config.api.ComponentType;
-import com.metamatrix.common.config.api.ComponentTypeID;
-import com.metamatrix.common.config.api.ConfigurationModelContainer;
 import com.metamatrix.common.config.api.ConnectorBinding;
 import com.metamatrix.common.config.api.ConnectorBindingType;
-import com.metamatrix.common.config.api.ExtensionModule;
 import com.metamatrix.common.config.model.BasicConnectorBinding;
 import com.metamatrix.common.log.LogManager;
 import com.metamatrix.common.protocol.URLHelper;
 import com.metamatrix.common.vdb.api.ModelInfo;
 import com.metamatrix.common.vdb.api.VDBArchive;
 import com.metamatrix.common.vdb.api.VDBDefn;
-import com.metamatrix.core.MetaMatrixRuntimeException;
 import com.metamatrix.core.util.Assertion;
 import com.metamatrix.core.vdb.VDBStatus;
 import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
 import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
-import com.metamatrix.dqp.embedded.configuration.ExtensionModuleReader;
-import com.metamatrix.dqp.embedded.configuration.ExtensionModuleWriter;
-import com.metamatrix.dqp.embedded.configuration.ServerConfigFileReader;
-import com.metamatrix.dqp.embedded.configuration.ServerConfigFileWriter;
 import com.metamatrix.dqp.embedded.configuration.VDBConfigurationReader;
 import com.metamatrix.dqp.embedded.configuration.VDBConfigurationWriter;
 import com.metamatrix.dqp.service.ConfigurationService;
@@ -94,47 +81,18 @@
  */
 public class EmbeddedConfigurationService extends EmbeddedBaseDQPService implements ConfigurationService {
     
-    private static final String VDB_LIST_SEPARATOR = ";"; //$NON-NLS-1$
     private static final String VDB = ".vdb"; //$NON-NLS-1$
-    private static final String DEF = ".def"; //$NON-NLS-1$
     
-	public final static String PROPERTIES_URL = "dqp.bootstrap"; //$NON-NLS-1$
-    
     private Properties userPreferences;
-    private URL bootStrapURL;
     private Map<VDBKey, VDBArchive> loadedVDBs = new HashMap<VDBKey, VDBArchive>();
     Map<String, ConnectorBinding> loadedConnectorBindings = new HashMap<String, ConnectorBinding>();
-    Map<String, ComponentType> loadedConnectorTypes = new HashMap<String, ComponentType>(); 
 
     // load time constructs
     private Map<VDBKey, URL> availableVDBFiles = new HashMap<VDBKey, URL>();
-    ConfigurationModelContainer configurationModel;
     private ArrayList<VDBLifeCycleListener> vdbLifeCycleListeners = new ArrayList<VDBLifeCycleListener>();
     private ArrayList<ConnectorBindingLifeCycleListener> connectorBindingLifeCycleListeners = new ArrayList<ConnectorBindingLifeCycleListener>();
     private UDFSource udfSource;
-    private Map<ConnectorBindingType, Properties> defaultConnectorTypePropertiesCache = new HashMap<ConnectorBindingType, Properties>();
     
-    private AbstractClassLoaderManager classLoaderManager = new AbstractClassLoaderManager(Thread.currentThread().getContextClassLoader(), true, true) {
-    	
-    	@Override
-    	public String getCommonExtensionClassPath() {
-    		return getUserPreferences().getProperty(DQPEmbeddedProperties.COMMON_EXTENSION_CLASPATH, ""); //$NON-NLS-1$
-    	}
-    	
-    	@Override
-    	public URL parseURL(String url) throws MalformedURLException {
-    		return ExtensionModuleReader.resolveExtensionModule(url, getExtensionPath());
-    	}
-    };
-    
-    public URL getBootStrapURL() {
-		return bootStrapURL;
-	}
-    
-    @Inject public void setBootStrapURL(@Named("BootstrapURL") URL bootStrapURL) {
-		this.bootStrapURL = bootStrapURL;
-	}
-    
     boolean valid(String str) {
         if (str != null) {
             str = str.trim();
@@ -148,10 +106,6 @@
      * @since 4.3
      */
     public URL getSystemVdb() {
-        String systemVDB = getUserPreferences().getProperty(DQPEmbeddedProperties.DQP_METADATA_SYSTEMURL);
-        if (valid(systemVDB)) {
-            return getFullyQualifiedPath(systemVDB);
-        }
         return Thread.currentThread().getContextClassLoader().getResource("System.vdb"); //$NON-NLS-1$
     }
 
@@ -162,101 +116,22 @@
     public Properties getSystemProperties() {
         return getUserPreferences();
     }
-
-    /** 
-     * @see com.metamatrix.dqp.service.ConfigurationService#setSystemProperty(java.lang.String, java.lang.String)
-     * @since 4.3
-     */
-    public void setSystemProperty(String key, String value) throws MetaMatrixComponentException {
-        getUserPreferences().setProperty(key, value);
-        DQPEmbeddedPlugin.logInfo("EmbeddedConfigurationService.add_system_property", new Object[] {key, value}); //$NON-NLS-1$
-        this.configurationModel = ServerConfigFileWriter.addProperty(getSystemConfiguration(), key, value);
-        saveSystemConfiguration(configurationModel);
-    }
     
+       
     /** 
-     * @see com.metamatrix.dqp.service.ConfigurationService#updateSystemProperties(java.util.Properties)
-     * @since 4.3
-     */
-    public void updateSystemProperties(Properties properties) throws MetaMatrixComponentException {
-        getUserPreferences().putAll(properties);
-        DQPEmbeddedPlugin.logInfo("EmbeddedConfigurationService.update_system_properties", new Object[] {properties}); //$NON-NLS-1$
-        this.configurationModel = ServerConfigFileWriter.addProperties(getSystemConfiguration(), properties);
-        saveSystemConfiguration(configurationModel);
-    }
-    
-    
-    
-    /** 
-     * @see com.metamatrix.dqp.service.ConfigurationService#getSystemConfiguration()
-     * @since 4.3
-     */
-    public ConfigurationModelContainer getSystemConfiguration() 
-        throws MetaMatrixComponentException {
-        if (this.configurationModel == null) {            
-            try {
-                URL configFile = getConfigFile();
-                ServerConfigFileReader configReader = new ServerConfigFileReader(configFile);
-                this.configurationModel = configReader.getConfiguration();
-            } catch (IOException e) {
-                throw new MetaMatrixComponentException(e);
-            } 
-        }
-        return this.configurationModel;
-    }
-    
-    /** 
-     * @see com.metamatrix.dqp.service.ConfigurationService#saveSystemConfiguration(com.metamatrix.common.config.api.ConfigurationModelContainer)
-     * @since 4.3
-     */
-    void saveSystemConfiguration(ConfigurationModelContainer model) 
-        throws MetaMatrixComponentException {        
-        DQPEmbeddedPlugin.logInfo("EmbeddedConfigurationService.savingConfiguration", null); //$NON-NLS-1$                
-        URL configFile = getConfigFile();
-        ServerConfigFileWriter.write(model, configFile);
-    }
-    
-    /**  
-     * @see com.metamatrix.dqp.service.ConfigurationService#getConfigFile()
-     */
-    public URL getConfigFile() {
-        String configFile = getUserPreferences().getProperty(DQPEmbeddedProperties.DQP_CONFIGFILE);
-        if (valid(configFile)) {
-            return getFullyQualifiedPath(configFile);
-        }
-        return Thread.currentThread().getContextClassLoader().getResource("configuration.xml"); //$NON-NLS-1$
-    }
-    
-    /** 
      * @see com.metamatrix.dqp.service.ConfigurationService#getUDFFile()
      * @since 4.3
      */
     public URL getUDFFile() {
-        try {
-			String udfFile = getUserPreferences().getProperty(DQPEmbeddedProperties.USER_DEFINED_FUNCTIONS);
-			if (valid(udfFile)) {
-				return ExtensionModuleReader.resolveExtensionModule(udfFile, getExtensionPath());
-			}
-			return ExtensionModuleReader.resolveExtensionModule(ExtensionModuleReader.MM_JAR_PROTOCOL+":"+USER_DEFINED_FUNCTION_MODEL, getExtensionPath()); //$NON-NLS-1$
-		} catch (IOException e) {
+    	//TODO: UDF handling needs to be re-done
+		String udfFile = getUserPreferences().getProperty(DQPEmbeddedProperties.USER_DEFINED_FUNCTIONS);
+		if (valid(udfFile)) {
 			return null;
 		}
+		return null;
     }
     
-    @Override
-    public ClassLoader getCommonClassLoader(String urls) {
-    	return this.classLoaderManager.getCommonClassLoader(urls);
-    }
     
-    @Override
-    public ClassLoader getPostDelegationClassLoader(String urls) {
-    	return this.classLoaderManager.getPostDelegationClassLoader(urls);
-    }
-    
-    public AbstractClassLoaderManager getClassLoaderManager() {
-		return classLoaderManager;
-	}
-    
     /** 
      * @see com.metamatrix.dqp.service.ConfigurationService#getVDBs()
      * @since 4.3
@@ -281,29 +156,24 @@
      * @return URL - never null;
      * @since 4.3
      */
-    URL getNewVDBLocation(VDBArchive vdb) {
+    URL getNewVDBLocation(VDBArchive vdb) throws MetaMatrixComponentException {
         // This is a new VDB, so where other vdbs are stored. Also since we storing this as
         // single VDB/DEF combination, update the archive file info.
-        String vdbName = vdb.getName()+"_"+vdb.getVersion()+VDB; //$NON-NLS-1$
-        URL fileToSave = getFullyQualifiedPath(getVDBSaveLocation(), vdbName);  
-        
-		BasicVDBDefn def = vdb.getConfigurationDef();
-		def.setFileName(vdbName);     
-        
-        return fileToSave;
+        try {
+			String vdbName = vdb.getName()+"_"+vdb.getVersion()+VDB; //$NON-NLS-1$
+
+			URL vdbLocation = (URL)this.userPreferences.get(DQPEmbeddedProperties.VDB_DEFINITION);
+			URL fileToSave = URLHelper.buildURL(vdbLocation, vdbName);  
+			
+			BasicVDBDefn def = vdb.getConfigurationDef();
+			def.setFileName(vdbName);     
+			
+			return fileToSave;
+		} catch (MalformedURLException e) {
+			throw new MetaMatrixComponentException(e);
+		}
     }
     
-    URL getVDBSaveLocation() {
-        URL[] urls = getVDBLocations();
-        for (int i = 0; i < urls.length; i++) {
-            String vdblocation = urls[i].toString().toLowerCase();
-            if (!vdblocation.endsWith(VDB) && !vdblocation.endsWith(DEF)) {
-                return urls[i];
-            }
-        }
-        return urls[0];
-    }    
-    
     /** 
      * @see com.metamatrix.dqp.service.ConfigurationService#saveVDB(com.metamatrix.metadata.runtime.admin.vdb.VDBDefn)
      * @since 4.3
@@ -342,7 +212,7 @@
         if (vdbFile == null) {
         	vdbFile = getNewVDBLocation(srcVdb);
         	VDBConfigurationWriter.write(srcVdb, vdbFile);
-        	srcVdb = VDBConfigurationReader.loadVDB(vdbFile, getDeployDir());
+        	srcVdb = VDBConfigurationReader.loadVDB(vdbFile, getVDBWorkDir());
 			deployVDB(vdbFile, srcVdb);
         	notifyVDBLoad(def.getName(), def.getVersion());
         } 
@@ -356,9 +226,6 @@
         	throw new MetaMatrixComponentException(DQPEmbeddedPlugin.Util.getString("EmbeddedConfigurationService.invalid_vdb", vdb.getName())); //$NON-NLS-1$
         }
                                       
-        // add connector types from the VDB to the configuration
-        addConnectorTypesInVDB(vdb, replaceBindings);
-        
         // now try to add the connector bindings in the VDB to the configuration service
         addConnectorBindingsInVDB(vdb, replaceBindings);
         
@@ -430,7 +297,7 @@
             // as bindings are vdb scoped they will never find one, unless there is shared one, 
             // then we need to use that one
             if (existing == null || replace) {
-                saveConnectorBinding(deployedBindingName, binding, false);
+                saveConnectorBinding(deployedBindingName, binding);
             }
             else {
                 // if the not being replaced, need to use the current one, then
@@ -443,24 +310,6 @@
     }    
     
     /**
-     * Add connector types from the VDB to the configuration.  
-     */
-    void addConnectorTypesInVDB(VDBArchive vdb, boolean replace) 
-        throws MetaMatrixComponentException{
-        
-    	BasicVDBDefn def = vdb.getConfigurationDef();
-        Map types = def.getConnectorTypes();
-        for (final Iterator i = types.keySet().iterator(); i.hasNext();) {
-            final String typeName = (String)i.next();
-            ConnectorBindingType localType = getConnectorType(typeName);
-            if (localType == null || replace) {
-                final ConnectorBindingType type = (ConnectorBindingType)types.get(typeName);
-               	saveConnectorType(type, false);
-            }                        
-        } // for
-    }
-    
-    /**
      * Find the latest version of the given vdb  
      * @param vdb
      * @param latestVersion
@@ -548,12 +397,8 @@
                     // inside the vdb
                     newBindingNames.add(tgtBinding.getFullName());
                     
-                    // get connector type from the configuration service
-                    ComponentType type = getConnectorType(tgtBinding.getComponentTypeID().getName());
-
                     // Also add into the new binding into the VDB, Since they are stored in hash
                     // only one copy is stored, or replaced.
-                    def.addConnectorType(type);
                     def.addConnectorBinding(model.getName(), tgtBinding);
                 }                           
                 
@@ -606,29 +451,6 @@
     	return loadedConnectorBindings.get(deployedBindingName);
     }
     
-    /**
-     * Get the default properties for the connector binding given.
-     * @param binding
-     * @return properties for the connector binding given
-     */   
-    public Properties getDefaultProperties(ConnectorBindingType type) {
-    	if (type != null) {
-	    	Properties props = null;
-	    	synchronized (this.defaultConnectorTypePropertiesCache) {
-	    		props = this.defaultConnectorTypePropertiesCache.get(type);
-	    		if (props == null) {
-	    	    	props = new Properties(getUserPreferences());
-	    	        props = configurationModel.getDefaultPropertyValues(props, (ComponentTypeID)type.getID());
-	    	        if (props.isEmpty()) {
-	    	        	props = type.getDefaultPropertyValues(props);
-	    	        }      
-	    	        this.defaultConnectorTypePropertiesCache.put(type, props);
-	    		}
-			}
-	        return props;
-    	}
-    	return new Properties(getUserPreferences());
-    }
     
     /**
      * Return a list of VDBs which are using the given connector binding 
@@ -657,8 +479,6 @@
     public ConnectorBinding addConnectorBinding(String deployedBindingName, ConnectorBinding binding, boolean replace) 
         throws MetaMatrixComponentException {
         
-        boolean add = true;
-
         // check to see if the binding already exists
         ConnectorBinding existingBinding = getConnectorBinding(deployedBindingName);
         if (existingBinding != null) {
@@ -676,24 +496,9 @@
                 }
             }
             else {
-                add = false;
                 DQPEmbeddedPlugin.logInfo("DataService.Connector_exists", new Object[] {existingBinding.getDeployedName()}); //$NON-NLS-1$
             }
         }
-
-        // now that we figured we need to add this to the configuration
-        if (add) {
-            // Check if we have connector type for the binding
-            String typeName = binding.getComponentTypeID().getName();
-            ComponentType type = getConnectorType(typeName);           
-            if (type != null) {
-                // Ask the Configuration Manager to save the connector Binding
-                binding = saveConnectorBinding(deployedBindingName, binding, true);
-                DQPEmbeddedPlugin.logInfo("DataService.Connector_Added", new Object[] {binding.getDeployedName()}); //$NON-NLS-1$                
-                return binding;
-            }
-            throw new MetaMatrixComponentException(DQPEmbeddedPlugin.Util.getString("DataService.Connector_type_does_not_exists", new Object[] {typeName})); //$NON-NLS-1$ 
-        }
         return binding;
     }
         
@@ -702,13 +507,13 @@
      */
     public ConnectorBinding updateConnectorBinding(ConnectorBinding binding) 
         throws MetaMatrixComponentException {
-       return saveConnectorBinding(binding.getDeployedName(), binding, false); 
+       return saveConnectorBinding(binding.getDeployedName(), binding); 
     }
     
     /**
      * Save the Connector Binding to the internal list.  
      */
-    ConnectorBinding saveConnectorBinding(String deployedBindingName, ConnectorBinding binding, boolean updateConfiguration) 
+    ConnectorBinding saveConnectorBinding(String deployedBindingName, ConnectorBinding binding) 
         throws MetaMatrixComponentException {        
         
         if (binding != null) {         
@@ -729,19 +534,10 @@
                     saveVDB(vdb, vdb.getVersion());                    
                 }
             }
-            
-            if (updateConfiguration || isGlobalConnectorBinding(binding)) {
-	            this.configurationModel = ServerConfigFileWriter.addConnectorBinding(configurationModel, binding);
-	            saveSystemConfiguration(this.configurationModel);
-	            DQPEmbeddedPlugin.logInfo("EmbeddedConfigurationService.connector_save", new Object[] {deployedBindingName}); //$NON-NLS-1$
-            }
         }        
         return binding;
     }
     
-    private boolean isGlobalConnectorBinding(ConnectorBinding binding) {
-    	return ServerConfigFileReader.containsBinding(this.configurationModel, binding.getDeployedName());
-	}
 
 	/** 
      * @see com.metamatrix.dqp.service.ConfigurationService#deleteConnectorBinding(java.lang.String)
@@ -766,137 +562,13 @@
             // as they probably already been saved, when they mapped to another binding.
             DQPEmbeddedPlugin.logInfo("EmbeddedConfigurationService.connector_delete", new Object[] {binding.getDeployedName()}); //$NON-NLS-1$            
             loadedConnectorBindings.remove(binding.getDeployedName());
-
-            if (isGlobalConnectorBinding(binding)) {
-	            // only save to the configuration xml only if the shared tag is set to true
-	            this.configurationModel = ServerConfigFileWriter.deleteConnectorBinding(configurationModel, binding);
-	            saveSystemConfiguration(this.configurationModel);
-            }
         }
         else {
             throw new MetaMatrixComponentException(DQPEmbeddedPlugin.Util.getString("EmbeddedConfigurationService.connector_binding_delete_failed", deployedConnectorBindingName)); //$NON-NLS-1$
         }
     }
-        
-    /** 
-     * @see com.metamatrix.dqp.service.ConfigurationService#getConnectorTypes()
-     * @since 4.3
-     */
-    public List getConnectorTypes() throws MetaMatrixComponentException {
-        return new ArrayList(loadedConnectorTypes.values());
-    } 
     
-    /** 
-     * @see com.metamatrix.dqp.service.ConfigurationService#getExtensionPath()
-     * @since 4.3
-     */
-    public URL[] getExtensionPath() {
-        String path = getUserPreferences().getProperty(DQPEmbeddedProperties.DQP_EXTENSIONS, "./extensions/"); //$NON-NLS-1$
-        if (valid(path)) {
-        	ArrayList<URL> urlPaths = new ArrayList<URL>();
-        	StringTokenizer st = new StringTokenizer(path, ";"); //$NON-NLS-1$
-        	while(st.hasMoreElements()) {
-        		String extPath = st.nextToken();
-        		if (!extPath.endsWith("/")) { //$NON-NLS-1$
-        			extPath = extPath + "/"; //$NON-NLS-1$
-        		}
-        		urlPaths.add(getFullyQualifiedPath(extPath));
-        	}
-            return urlPaths.toArray(new URL[urlPaths.size()]);
-        }
-        return new URL[0];
-    }
     
-    /**  
-     * @see com.metamatrix.dqp.service.ConfigurationService#useExtensionClasspath()
-     */
-    public boolean useExtensionClasspath() {
-        String path = getUserPreferences().getProperty(DQPEmbeddedProperties.DQP_EXTENSIONS);
-        return valid(path);
-    }
-    
-    /** 
-     * @see com.metamatrix.dqp.service.ConfigurationService#getExtensionModule(java.lang.String)
-     * @since 4.3
-     */
-    public ExtensionModule getExtensionModule(String extModuleName) throws MetaMatrixComponentException {
-    	return ExtensionModuleReader.loadExtensionModule(extModuleName, getExtensionPath());
-    }
-    
-    /** 
-     * @see com.metamatrix.dqp.service.ConfigurationService#getExtensionModules()
-     * @since 4.3
-     */
-    public List<ExtensionModule> getExtensionModules() throws MetaMatrixComponentException {
-    	return ExtensionModuleReader.loadExtensionModules(getExtensionPath());
-    }
-    
-    /** 
-     * @see com.metamatrix.dqp.service.ConfigurationService#saveExtensionModule(com.metamatrix.common.config.api.ExtensionModule)
-     * @since 4.3
-     */
-    public void saveExtensionModule(ExtensionModule extModule) throws MetaMatrixComponentException {
-    	this.classLoaderManager.clearCache();
-        ExtensionModuleWriter.write(extModule, getExtensionPath());                 
-    }
-
-    /** 
-     * @see com.metamatrix.dqp.service.ConfigurationService#deleteExtensionModule(java.lang.String)
-     * @since 4.3
-     */
-    public void deleteExtensionModule(String extModuleName) throws MetaMatrixComponentException {
-    	this.classLoaderManager.clearCache();
-    	ExtensionModuleWriter.deleteModule(extModuleName, getExtensionPath());
-    }    
-    
-    /** 
-     * @see com.metamatrix.dqp.service.ConfigurationService#getConnectorType(com.metamatrix.common.config.api.ComponentTypeID)
-     * @since 4.3
-     */
-    public ConnectorBindingType getConnectorType(String connectorType) throws MetaMatrixComponentException {
-        return (ConnectorBindingType)loadedConnectorTypes.get(connectorType);
-    }
-
-    /** 
-     * @see com.metamatrix.dqp.service.ConfigurationService#addConnectorType(com.metamatrix.common.config.api.ComponentType)
-     * @since 4.3
-     */
-    public void saveConnectorType(ConnectorBindingType type) throws MetaMatrixComponentException {
-    	saveConnectorType(type, true);
-    }
-    
-    private void saveConnectorType(ConnectorBindingType type, boolean updateConfiguration) throws MetaMatrixComponentException {
-    	type = (ConnectorBindingType)ServerConfigFileReader.resolvePropertyDefns(type, this.configurationModel);
-        loadedConnectorTypes.put(type.getName(), type);
-
-        if (updateConfiguration) {
-	        // Also add binding type to the configuration and save.        
-	        DQPEmbeddedPlugin.logInfo("EmbeddedConfigurationService.connector_type_save", new Object[] {type.getName()}); //$NON-NLS-1$
-	        this.configurationModel = ServerConfigFileWriter.addConnectorType(configurationModel, type);
-	        saveSystemConfiguration(this.configurationModel);
-        }
-    }    
-
-    /** 
-     * @see com.metamatrix.dqp.service.ConfigurationService#deleteConnectorType(java.lang.String)
-     * @since 4.3
-     */
-    public void deleteConnectorType(String deployedConnectorType) throws MetaMatrixComponentException {
-        ConnectorBindingType type = (ConnectorBindingType)loadedConnectorTypes.remove(deployedConnectorType);
-        if (type != null) {
-            if (isConnectorTypeInUse(type)) {
-                throw new MetaMatrixComponentException(DQPEmbeddedPlugin.Util.getString("EmbeddedConfigurationService.connector_type_in_use", deployedConnectorType)); //$NON-NLS-1$
-            }
-            // Also delete binding type to the configuration and save.        
-            DQPEmbeddedPlugin.logInfo("EmbeddedConfigurationService.connector_type_delete", new Object[] {deployedConnectorType}); //$NON-NLS-1$
-            this.configurationModel = ServerConfigFileWriter.deleteConnectorType(configurationModel, type);
-            saveSystemConfiguration(this.configurationModel);
-        }
-        else {
-            throw new MetaMatrixComponentException(DQPEmbeddedPlugin.Util.getString("EmbeddedConfigurationService.connector_type_delete_failed", deployedConnectorType)); //$NON-NLS-1$
-        }
-    }   
-     
     /**
      * Check to see if the connector type is currently in use. 
      * @param type - Connector Type
@@ -925,7 +597,7 @@
             	// un-register the old UDF model, if there is one.
             	unloadUDF();
 
-        		this.udfSource = new UDFSource(udfFile.openStream(), getCommonClassLoader(null));
+        		this.udfSource = new UDFSource(udfFile.openStream(), Thread.currentThread().getContextClassLoader());
 				FunctionLibraryManager.registerSource(this.udfSource);
 				LogManager.logInfo(LogConstants.CTX_DQP, DQPEmbeddedPlugin.Util.getString("EmbeddedConfigurationService.udf_load", udfFile)); //$NON-NLS-1$
 			} catch (IOException e) {
@@ -974,19 +646,6 @@
                         
             DQPEmbeddedPlugin.logInfo("EmbeddedConfigurationService.dqp_loading", new Object[] {getProcessName()}); //$NON-NLS-1$
             
-            // load the configuration file.
-            this.configurationModel = getSystemConfiguration();        
-            ServerConfigFileReader configReader = loadServerConfigFile();
-            
-            // Get the alternate connector bindings from the server configuration
-            Map connectorBindings = configReader.getConnectorBindings();
-            
-            // Add all the connector types.
-            Map connectorTypes = configReader.getConnectorTypes();
-            
-            // load the connector bindings
-            loadConnectorBindings(connectorBindings, connectorTypes);
-            
             // Load the User defined functions 
             loadUDF();
                         
@@ -1017,59 +676,11 @@
     	}
         loadedVDBs.clear();
         loadedConnectorBindings.clear();                       
-        loadedConnectorTypes.clear();
         availableVDBFiles.clear();
         unloadUDF();
     }
-        
-    /**
-     * Get path(s) for VDB(s) that are available from the configuration to the DQP
-     * engine. 
-     * @return URLs to the resources.
-     */
-    public URL[] getVDBLocations() {
-        ArrayList vdbs = new ArrayList();
-        String vdbProperty = getUserPreferences().getProperty(DQPEmbeddedProperties.VDB_DEFINITION); 
-		if (vdbProperty != null  && vdbProperty.length() != 0) {
-            StringTokenizer st = new StringTokenizer(vdbProperty, VDB_LIST_SEPARATOR);
-            while( st.hasMoreTokens() ) {
-                String token = st.nextToken();
-                String vdbLocation = token.toLowerCase();
-                URL vdbURL = null;
-                if (!vdbLocation.endsWith(VDB) && !vdbLocation.endsWith(DEF) && !vdbLocation.endsWith("/")) { //$NON-NLS-1$
-                    token = token+"/"; //$NON-NLS-1$
-                }
-                vdbURL = getFullyQualifiedPath(token);
-                vdbs.add(vdbURL);
-            }            
-        }
-        return (URL[])vdbs.toArray(new URL[vdbs.size()]);
-    }
- 
-    /**
-     * Load the Connector Bindings from the VDBS and ServerConfig.xml
-     * file. VDB based bindings are preferred, however if a "useConfigFileBindings" is
-     * set then the bindings from the config file are used, or they are also used
-     * if one binding is not specified in the VDB   
-     */
-    void loadConnectorBindings(Map configBindings, Map configTypes) 
-        throws MetaMatrixComponentException{
 
-        this.loadedConnectorTypes = configTypes;
-        
-        // assign deploy names to the bindings that are loaded from the configuration.
- 	 	for (Iterator i = configBindings.keySet().iterator(); i.hasNext();) {
-			String key = (String) i.next();
-			BasicConnectorBinding binding = (BasicConnectorBinding) configBindings.get(key);
-			if (binding.getDeployedName() == null) {
-				binding.setDeployedName(binding.getFullName());
-			}
-			deployConnectorBinding(binding.getDeployedName(), binding);
-		} 	 	
-    }
 
-
-
 	/** 
      * Add the connector binding with new deployment name
      * @param binding
@@ -1104,7 +715,8 @@
         // Get the files to load
         HashMap<URL, VDBArchive> vdbFiles;
 		try {
-			vdbFiles = VDBConfigurationReader.loadVDBS(getVDBLocations(), getDeployDir()); 
+			URL vdbLocation = (URL)this.userPreferences.get(DQPEmbeddedProperties.VDB_DEFINITION);
+			vdbFiles = VDBConfigurationReader.loadVDBS(new URL[] {vdbLocation}, getVDBWorkDir()); 
 		} catch (MetaMatrixComponentException e) {
 			throw new ApplicationInitializationException(e);
 		}
@@ -1133,71 +745,16 @@
 		DQPEmbeddedPlugin.logInfo("EmbeddedConfigurationService.loaded_vdb", new Object[] {vdbURL}); //$NON-NLS-1$
 	}
 
-	protected File getDeployDir() {
-        String deployDirectory = getUserPreferences().getProperty(DQPEmbeddedProperties.DQP_DEPLOYDIR);
-        File deployDir = new File(deployDirectory);
-        return deployDir;
+	protected File getVDBWorkDir() {
+        File dir = new File(getWorkDir(), "vdbs"); //$NON-NLS-1$
+        
+        // create the directory if not already exists.
+        if (!dir.exists()) {
+            dir.mkdirs();
+        }        
+        return dir;
 	}
         
-    /**
-     * Load a config.xml server configuration file.  This is optional as we are really
-     * only grabbing properties out of here.  As an alternative, you can just specify 
-     * the properties in the main properties file - those properties should override
-     * anything in this config file. 
-     */
-    ServerConfigFileReader loadServerConfigFile() throws ApplicationInitializationException {
-        
-        // get the URL to the configuration file
-        URL configFile = getConfigFile();
-        try {
-            if(configFile != null) {
-                ServerConfigFileReader configReader = new ServerConfigFileReader(configFile);
-                return configReader;                    
-            }
-            DQPEmbeddedPlugin.logError("EmbeddedConfigurationService.Server_Config_notdefined", null); //$NON-NLS-1$
-            throw new ApplicationInitializationException(DQPEmbeddedPlugin.Util.getString("EmbeddedConfigurationService.Server_Config_notdefined")); //$NON-NLS-1$                
-        } catch (IOException e) {
-            DQPEmbeddedPlugin.logError("EmbeddedConfigurationService.Server_Config_failedload", new Object[] {configFile}); //$NON-NLS-1$
-            throw new ApplicationInitializationException(DQPEmbeddedPlugin.Util.getString("EmbeddedConfigurationService.Server_Config_failedload", new Object[] {configFile})); //$NON-NLS-1$
-        } 
-    }
-        
-    
-    /**
-     * Based on the DQP.properties file, get the absolute path to the given file location  
-     * @param file - relative or abs path
-     * @return - abs path always
-     * @throws MetaMatrixComponentException
-     * @since 4.3
-     */
-    URL getFullyQualifiedPath(String file){
-        if (file != null) {
-            try {
-                // since DQP can use metamatrix specific URLs to load the DQP, and we can not
-                // register the URLStreamHandler, we need to create the URL with correct handler
-                // URLHelper will let us do that.
-                return URLHelper.buildURL(bootStrapURL, file);
-            } catch (MalformedURLException e) {
-                throw new MetaMatrixRuntimeException(e);
-            }
-        }
-        throw new MetaMatrixRuntimeException("bad configuration"); //$NON-NLS-1$
-    }
-    
-    URL getFullyQualifiedPath(URL context, String file){
-        if (file != null) {
-            try {                
-                // since DQP can use metamatrix specific URLs to load the DQP, and we can not
-                // register the URLStreamHandler, we need to create the URL with correct handler
-                // URLHelper will let us do that.
-                return URLHelper.buildURL(context, file);
-            } catch (MalformedURLException e) {
-                throw new MetaMatrixRuntimeException(e);
-            }
-        }
-        throw new MetaMatrixRuntimeException("bad configuration"); //$NON-NLS-1$
-    }    
-        
     /** 
      * @see com.metamatrix.dqp.service.ConfigurationService#getConnectionListener()
      * @since 4.3.2
@@ -1269,15 +826,6 @@
                     DQPEmbeddedPlugin.logWarning("VDBService.vdb_missing_bindings", new Object[] {vdb.getName(), vdb.getVersion()}); //$NON-NLS-1$
                     return false;
                 }
-
-                // make sure we have connector binding in the 
-                // configuration service. 
-                String bindingName = (String)model.getConnectorBindingNames().get(0); 
-                ConnectorBinding binding = def.getConnectorBindingByName(bindingName);
-                if (binding == null || getConnectorBinding(binding.getDeployedName()) == null) {
-                    DQPEmbeddedPlugin.logWarning("VDBService.vdb_missing_bindings", new Object[] {vdb.getName(), vdb.getVersion()}); //$NON-NLS-1$
-                    return false;
-                }
             }
         }   
         return true;
@@ -1392,18 +940,8 @@
 		this.connectorBindingLifeCycleListeners.remove(listener);
 	}    
 	
-	@Override
-	public void clearClassLoaderCache() throws MetaMatrixComponentException {
-		this.classLoaderManager.clearCache();
-	}
-
 	void setUserPreferences(Properties userPreferences) {
 		this.userPreferences = userPreferences;
-		//test hack
-		URL url = (URL)userPreferences.get(PROPERTIES_URL);
-		if (url != null) {
-			this.bootStrapURL = url;
-		}
 	}
 
 	Properties getUserPreferences() {

Modified: branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedDataService.java
===================================================================
--- branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedDataService.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedDataService.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -24,44 +24,36 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
-import java.util.concurrent.atomic.AtomicInteger;
 
-import org.teiid.adminapi.ConnectionPool;
+import javax.resource.spi.work.WorkManager;
+
 import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.api.ConnectorPropertyNames;
 import org.teiid.connector.metadata.runtime.ConnectorMetadata;
 import org.teiid.dqp.internal.datamgr.impl.ConnectorManager;
-import org.teiid.dqp.internal.process.DQPWorkContext;
 
-import com.metamatrix.admin.objects.MMConnectionPool;
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
 import com.metamatrix.api.exception.ComponentNotFoundException;
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.common.application.ApplicationEnvironment;
 import com.metamatrix.common.application.exception.ApplicationInitializationException;
 import com.metamatrix.common.application.exception.ApplicationLifecycleException;
 import com.metamatrix.common.comm.api.ResultsReceiver;
-import com.metamatrix.common.config.api.ComponentType;
-import com.metamatrix.common.config.api.ComponentTypeDefn;
-import com.metamatrix.common.config.api.ComponentTypeID;
-import com.metamatrix.common.config.api.ConnectorBinding;
-import com.metamatrix.common.config.api.ConnectorBindingType;
-import com.metamatrix.common.util.PropertiesUtils;
-import com.metamatrix.common.util.crypto.CryptoException;
-import com.metamatrix.common.util.crypto.CryptoUtil;
+import com.metamatrix.common.queue.WorkerPoolStats;
+import com.metamatrix.common.vdb.api.ModelInfo;
 import com.metamatrix.common.vdb.api.VDBArchive;
 import com.metamatrix.common.vdb.api.VDBDefn;
 import com.metamatrix.core.vdb.VDBStatus;
 import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
-import com.metamatrix.dqp.internal.datamgr.ConnectorID;
 import com.metamatrix.dqp.message.AtomicRequestID;
 import com.metamatrix.dqp.message.AtomicRequestMessage;
 import com.metamatrix.dqp.message.AtomicResultsMessage;
-import com.metamatrix.dqp.message.RequestMessage;
 import com.metamatrix.dqp.service.ConnectorBindingLifeCycleListener;
 import com.metamatrix.dqp.service.ConnectorStatus;
 import com.metamatrix.dqp.service.DQPServiceNames;
@@ -75,323 +67,174 @@
  * @since 4.3
  */
 public class EmbeddedDataService extends EmbeddedBaseDQPService implements DataService {
-    // Map of connector binding name to ConnectorID
-    private Map connectorIDs = new HashMap();
-
+	
     // Map of ConnectorID to ConnectorData
-    private Map connectorMgrs = new HashMap();
+    private Map<String, ConnectorManager> connectorMgrs = Collections.synchronizedMap(new HashMap<String, ConnectorManager>());
     
-    // A counter to keep track of connector ids
-    private AtomicInteger counter = new AtomicInteger();
-    
-    // Connector List
-    private Map loadedConnectorBindingsMap = new HashMap();
-    
     private ApplicationEnvironment env;
     
+    @Inject @Named("TeiidWorkManager")
+    private WorkManager workManager;
+    
     private ConnectorBindingLifeCycleListener listener = new ConnectorBindingLifeCycleListener() {
 
         public void loaded(String bindingName) {
             try {
 				startConnectorBinding(bindingName);
-			} catch (Exception e) {
+			} catch (ApplicationLifecycleException e) {
 				DQPEmbeddedPlugin.logError(e, "DataService.FailedStart", new Object[] {bindingName}); //$NON-NLS-1$
-			} 
+			} catch(MetaMatrixComponentException e) {
+				DQPEmbeddedPlugin.logError(e, "DataService.FailedStart", new Object[] {bindingName}); //$NON-NLS-1$
+			}
         }
 
         public void unloaded(String bindingName) {
             try {
                 stopConnectorBinding(bindingName);
-            } catch (Exception e) {
+            } catch (ApplicationLifecycleException e) {
                 DQPEmbeddedPlugin.logError(e, "DataService.FailedStop", new Object[] {bindingName}); //$NON-NLS-1$
+            } catch(MetaMatrixComponentException e) {
+            	DQPEmbeddedPlugin.logError(e, "DataService.FailedStop", new Object[] {bindingName}); //$NON-NLS-1$
             }
         }                
     };
     
-    /**
-     * Select a connector to use for the given connector binding.
-     * @param deployedConnectorBindingName Connector binding identifier
-     * @return ConnectorID identifying a connector instance
-     */
-    public ConnectorID selectConnector(String deployedConnectorBindingName) 
-        throws MetaMatrixComponentException {        
-        ConnectorID id = (ConnectorID) connectorIDs.get(deployedConnectorBindingName);
-        if (id == null) {
-            ConnectorBinding binding = getConnectorBinding(deployedConnectorBindingName);
-            if (binding != null) {
-                id = (ConnectorID) connectorIDs.get(binding.getDeployedName());
-            }
-            if (id == null) {
-                throw new ComponentNotFoundException(DQPEmbeddedPlugin.Util.getString("DataService.Connector_State_invalid", new Object[] { deployedConnectorBindingName })); //$NON-NLS-1$
-            }
-        }
-        return id;
-    }
-    
+        
     @Override
-    public ConnectorMetadata getConnectorMetadata(String vdbName,
-    		String vdbVersion, String modelName, Properties importProperties) throws MetaMatrixComponentException {
+    public ConnectorMetadata getConnectorMetadata(String vdbName, String vdbVersion, String modelName) throws MetaMatrixComponentException {
     	VDBService vdbService = (VDBService)this.lookupService(DQPServiceNames.VDB_SERVICE);
     	List<String> bindingNames = vdbService.getConnectorBindingNames(vdbName, vdbVersion, modelName);
     	if (bindingNames.isEmpty()) {
     		throw new MetaMatrixComponentException(DQPEmbeddedPlugin.Util.getString("DataService.no_connectors_defined")); //$NON-NLS-1$
     	}
-    	String deployedConnectorBindingName = bindingNames.get(0);
-    	ConnectorID connector = selectConnector(deployedConnectorBindingName);
-    	ConnectorManager mgr = getConnectorManager(connector);
-    	if (mgr == null) {
-    		throw new ComponentNotFoundException(DQPEmbeddedPlugin.Util.getString("DataService.Unable_to_find_connector_manager_for_{0}_1", new Object[] { connector })); //$NON-NLS-1$
-    	}
-    	
+    	String deployedConnectorName = bindingNames.get(0);
+    	ConnectorManager mgr = getConnectorManager(deployedConnectorName);
     	try {
-			return mgr.getMetadata(modelName, importProperties);
+			return mgr.getMetadata(modelName);
 		} catch (ConnectorException e) {
 			throw new MetaMatrixComponentException(e);
 		}
     }
     
-     /**
-     * Execute the given request on a <code>Connector</code>. The results are passed in to the 
-     * listener object. 
-      * @see com.metamatrix.dqp.service.DataService#executeRequest(com.metamatrix.dqp.message.AtomicRequestMessage, com.metamatrix.dqp.internal.datamgr.ConnectorID, com.metamatrix.common.comm.api.MessageListener)
-      * @since 4.3
-      */
-	public void executeRequest(AtomicRequestMessage request,
-			ConnectorID connector,
-			ResultsReceiver<AtomicResultsMessage> resultListener)
+    @Override
+	public void executeRequest(AtomicRequestMessage request, String deployedConnectorName, ResultsReceiver<AtomicResultsMessage> resultListener)
 			throws MetaMatrixComponentException {
-        ConnectorManager mgr = getConnectorManager(connector);
-        if(mgr != null) {
+        ConnectorManager mgr = getConnectorManager(deployedConnectorName, false);
+		try {
 			mgr.executeRequest(resultListener, request);
-        }
-        else {
-            throw new ComponentNotFoundException(DQPEmbeddedPlugin.Util.getString("DataService.Unable_to_find_connector_manager_for_{0}_1", new Object[] { connector })); //$NON-NLS-1$
-        }
+		} catch (ConnectorException e) {
+			throw new ComponentNotFoundException(e.getCause(), e.getMessage());
+		}        
     }
 	
-	public void cancelRequest(AtomicRequestID request, ConnectorID connectorId)
-			throws MetaMatrixComponentException {
-        ConnectorManager mgr = getConnectorManager(connectorId);
-        if (mgr == null ) {                        
-            throw new ComponentNotFoundException(DQPEmbeddedPlugin.Util.getString("DataService.Unable_to_find_connector_manager_for_{0}_1", new Object[] { connectorId })); //$NON-NLS-1$            
-        }
+    @Override
+	public void cancelRequest(AtomicRequestID request, String deployedConnectorName) throws MetaMatrixComponentException {
+        ConnectorManager mgr = getConnectorManager(deployedConnectorName, false);
         mgr.cancelRequest(request);
 	}
 
-	public void closeRequest(AtomicRequestID request, ConnectorID connectorId)
-			throws MetaMatrixComponentException {
-        ConnectorManager mgr = getConnectorManager(connectorId);
-        if (mgr == null ) {                        
-            throw new ComponentNotFoundException(DQPEmbeddedPlugin.Util.getString("DataService.Unable_to_find_connector_manager_for_{0}_1", new Object[] { connectorId })); //$NON-NLS-1$            
-        }
+    @Override
+	public void closeRequest(AtomicRequestID request, String deployedConnectorName) throws MetaMatrixComponentException {
+        ConnectorManager mgr = getConnectorManager(deployedConnectorName, false);
         mgr.closeRequest(request);
 	}
 	
-	public void requestBatch(AtomicRequestID request, ConnectorID connectorId)
-		throws MetaMatrixComponentException {
-        ConnectorManager mgr = getConnectorManager(connectorId);
-        if (mgr == null ) {                        
-            throw new ComponentNotFoundException(DQPEmbeddedPlugin.Util.getString("DataService.Unable_to_find_connector_manager_for_{0}_1", new Object[] { connectorId })); //$NON-NLS-1$            
-        }
+	public void requestBatch(AtomicRequestID request, String deployedConnectorName) throws MetaMatrixComponentException {
+        ConnectorManager mgr = getConnectorManager(deployedConnectorName, false);
         mgr.requstMore(request);
 	}
 
-	public SourceCapabilities getCapabilities(RequestMessage request,
-			DQPWorkContext dqpWorkContext, ConnectorID connector)
-			throws MetaMatrixComponentException {
-        ConnectorManager mgr = getConnectorManager(connector);
-        if (mgr != null ) {                        
-            try {
-				return mgr.getCapabilities(dqpWorkContext.getRequestID(request.getExecutionId()), request.getExecutionPayload(), dqpWorkContext);
-			} catch (ConnectorException e) {
-				throw new MetaMatrixComponentException(e);
-			}
-        }
-        throw new ComponentNotFoundException(DQPEmbeddedPlugin.Util.getString("DataService.Unable_to_find_connector_manager_for_{0}_1", new Object[] { connector })); //$NON-NLS-1$            
+	@Override
+	public SourceCapabilities getCapabilities(String deployedConnectorName) throws MetaMatrixComponentException {
+        ConnectorManager mgr = getConnectorManager(deployedConnectorName, false);
+        try {
+			return mgr.getCapabilities();
+		} catch (ConnectorException e) {
+			throw new MetaMatrixComponentException(e);
+		}        
 	}
-
-    /** 
-     * @see com.metamatrix.dqp.service.DataService#getConnectorBindingStatistics(java.lang.String)
-     * @since 4.3
-     */
-    public Collection getConnectorBindingStatistics(String connectorBindingName) throws MetaMatrixComponentException {
-    	ConnectorBinding binding = getConnectorBinding(connectorBindingName);
-        if (binding != null) {
-            ConnectorManager mgr = getConnectorManager(binding);
-            if (mgr != null ) {            
-                return mgr.getQueueStatistics();
-            }
-        }
-        throw new ComponentNotFoundException(DQPEmbeddedPlugin.Util.getString("DataService.Unable_to_find_connector_manager_for_{0}_1", new Object[] { connectorBindingName })); //$NON-NLS-1$
-    }  
+	
+	@Override
+    public Collection<WorkerPoolStats> getConnectorStatistics(String deployedConnectorName) throws MetaMatrixComponentException {
+        ConnectorManager mgr = getConnectorManager(deployedConnectorName, false);
+        return mgr.getQueueStatistics();
+    } 	
     
-    /** 
-     * @see com.metamatrix.dqp.service.DataService#getConnectionPoolStatistics(java.lang.String)
-     * @since 6.1
-     */
-    public Collection<? extends ConnectionPool> getConnectionPoolStatistics(String connectorBindingName) throws MetaMatrixComponentException {
-    	ConnectorBinding binding = getConnectorBinding(connectorBindingName);
-        if (binding != null) {
-            ConnectorManager mgr = getConnectorManager(binding);
-            if (mgr != null ) {  
-            	Collection<MMConnectionPool> result = mgr.getConnectionPoolStats();
-            	for (MMConnectionPool mmConnectionPool : result) {
-					mmConnectionPool.setConnectorBindingIdentifier(binding.getDeployedName());
-				}
-            	return result;
-            }
-        }
-        throw new ComponentNotFoundException(DQPEmbeddedPlugin.Util.getString("DataService.Unable_to_find_connector_manager_for_{0}_1", new Object[] { connectorBindingName })); //$NON-NLS-1$
-    }     
-    
-    /** 
-     * @see com.metamatrix.dqp.service.DataService#clearConnectorBindingCache(java.lang.String)
-     * @since 4.3
-     */
-    public void clearConnectorBindingCache(String connectorBindingName) throws MetaMatrixComponentException {
-    	ConnectorBinding binding = getConnectorBinding(connectorBindingName);
-    	if (binding != null) {
-            ConnectorManager mgr = getConnectorManager(binding);
-            if (mgr != null ) {            
-                mgr.clearCache();
-                return;
-            }
-        }
-        throw new ComponentNotFoundException(DQPEmbeddedPlugin.Util.getString("DataService.Unable_to_find_connector_manager_for_{0}_1", new Object[] { connectorBindingName })); //$NON-NLS-1$       
+	@Override
+    public void clearConnectorBindingCache(String deployedConnectorName) throws MetaMatrixComponentException {
+        ConnectorManager mgr = getConnectorManager(deployedConnectorName, false);
+        mgr.clearCache();    
     }    
 
-    /** 
-     * @see com.metamatrix.dqp.service.DataService#startConnectorBinding(java.lang.String)
-     * @since 4.3
-     */
-    public void startConnectorBinding(String deployedConnectorBindingName) 
-        throws ApplicationLifecycleException, MetaMatrixComponentException {
+    private void startConnectorBinding(String deployedConnectorName) throws ApplicationLifecycleException, MetaMatrixComponentException {
         
-        ConnectorBinding binding = getConnectorBinding(deployedConnectorBindingName);
-        if (binding != null) {
-            ConnectorManager mgr = getConnectorManager(binding);
-            if (mgr != null && mgr.getStatus() == ConnectorStatus.NOT_INITIALIZED) {
-                // Start the manager
-                mgr.start(env);
-                
-                // Add the references to the mgr as loaded.
-                ConnectorID connID = mgr.getConnectorID(); 
-                this.connectorIDs.put(binding.getDeployedName(), connID);
-                this.connectorMgrs.put(connID, mgr);                
-                this.loadedConnectorBindingsMap.put(binding.getDeployedName(), binding);
-                
-                DQPEmbeddedPlugin.logInfo("DataService.Connector_Started", new Object[] {binding.getDeployedName()}); //$NON-NLS-1$
-            }
+        ConnectorManager mgr = getConnectorManager(deployedConnectorName);
+        	
+        if (mgr.getStatus() == ConnectorStatus.NOT_INITIALIZED) {
+            // Start the manager
+            mgr.start(env);
+            
+            // Add the references to the mgr as loaded.
+            this.connectorMgrs.put(mgr.getName(), mgr);                
+            
+            DQPEmbeddedPlugin.logInfo("DataService.Connector_Started", new Object[] {deployedConnectorName}); //$NON-NLS-1$
         }
-        else {
-            throw new ApplicationLifecycleException(DQPEmbeddedPlugin.Util.getString("DataService.Unable_to_find_connector", deployedConnectorBindingName)); //$NON-NLS-1$
-        }        
     }
 
-    /** 
-     * @see com.metamatrix.dqp.service.DataService#stopConnectorBinding(java.lang.String)
-     * @since 4.3
-     */
-    public void stopConnectorBinding(String deployedConnectorBindingName) 
-        throws ApplicationLifecycleException, MetaMatrixComponentException {
 
-        ConnectorBinding binding = getConnectorBinding(deployedConnectorBindingName);
-        if (binding != null) {
-            ConnectorManager mgr = getConnectorManager(binding, false);
-            if (mgr != null ) {
-                // Run the stop command no matter what state they are in, since the Alive status is not
-                // always reliable, it is only based on the Connector implementation. This is fool proof. 
-                mgr.stop();
-                
-                // remove from the local configuration. We want to create a new connector binding each time
-                // we start, so that we can initialize with correct properties, in case they chnaged.
-                removeConnectorBinding(binding.getDeployedName());
-                
-                DQPEmbeddedPlugin.logInfo("DataService.Connector_Stopped", new Object[] {binding.getDeployedName()}); //$NON-NLS-1$
-            }
+    private void stopConnectorBinding(String deployedConnectorName) throws ApplicationLifecycleException, MetaMatrixComponentException {
+        ConnectorManager mgr = getConnectorManager(deployedConnectorName, false);
+        if (mgr != null ) {
+            // Run the stop command no matter what state they are in, since the Alive status is not
+            // always reliable, it is only based on the Connector implementation. This is fool proof. 
+            mgr.stop();
+            
+            // remove from the local configuration. We want to create a new connector binding each time
+            // we start, so that we can initialize with correct properties, in case they changed.
+            connectorMgrs.remove(deployedConnectorName);   
+            
+            DQPEmbeddedPlugin.logInfo("DataService.Connector_Stopped", new Object[] {deployedConnectorName}); //$NON-NLS-1$
         }
-        else {
-            throw new ApplicationLifecycleException(DQPEmbeddedPlugin.Util.getString("DataService.Unable_to_find_connector", deployedConnectorBindingName)); //$NON-NLS-1$
-        }
     }
 
-    /** 
-     * @see com.metamatrix.dqp.service.DataService#getConnectorBindings()
-     * @since 4.3
-     */
-    public List getConnectorBindings() throws MetaMatrixComponentException {
-        List list =  getConfigurationService().getConnectorBindings();
-//        ConnectorBinding indexConnector = (ConnectorBinding)loadedConnectorBindingsMap.get(SYSTEM_PHYSICAL_MODEL_NAME);
-//        list.remove(indexConnector);
-        return list;
-    }
-    
-    /** 
-     * @see com.metamatrix.dqp.service.DataService#getConnectorBindingState(java.lang.String)
-     * @since 4.3
-     */
-    public ConnectorStatus getConnectorBindingState(String deployedConnectorBindingName) 
-        throws MetaMatrixComponentException {
-        ConnectorBinding binding = getConnectorBinding(deployedConnectorBindingName);
-        if (binding != null) {
-            ConnectorManager mgr = getConnectorManager(binding);
-            if (mgr != null) {
-                return mgr.getStatus();
-            }
-            return ConnectorStatus.CLOSED;
-        }
-        throw new MetaMatrixComponentException(DQPEmbeddedPlugin.Util.getString("DataService.Unable_to_find_connector", deployedConnectorBindingName)); //$NON-NLS-1$
-    } 
-    
-    /**
-     * Initialize the service with the specified properties.
-     * @param props Initialialization properties
-     * @throws com.metamatrix.common.application.exception.ApplicationInitializationException If an error occurs during initialization
-     */
+    @Override
     public void initializeService(Properties props) throws ApplicationInitializationException {
     }
 
-    /**
-     * Start the service with the specified environment.  The environment can
-     * be used to find other services or resources.
-     * @param environment Environment
-     * @throws com.metamatrix.common.application.exception.ApplicationLifecycleException If an error occurs while starting
-     */
-    public void startService(ApplicationEnvironment environment) 
-        throws ApplicationLifecycleException {
+    @Override
+    public void startService(ApplicationEnvironment environment) throws ApplicationLifecycleException {
     	this.env = environment;
         getConfigurationService().register(this.listener);
 
         try {                
             // Start System Model connector Binding
-            startConnectorBinding(SYSTEM_PHYSICAL_MODEL_NAME);
+            startConnectorBinding(INDEX_CONNECTOR_NAME);
                         
             // Loop through the available ACTIVE VDBS and only start those
             // connector bindings that are ACTIVE VDBS.
-            List otherBindings = new ArrayList();
+            List<String> connectorNames = new ArrayList();
             List<VDBArchive> vdbs = getConfigurationService().getVDBs();
             for (VDBArchive vdb:vdbs) {
             	VDBDefn def = vdb.getConfigurationDef();
-                if (vdb.getStatus() == VDBStatus.ACTIVE || vdb.getStatus() == VDBStatus.ACTIVE_DEFAULT) {                                        
-                    for (final Iterator it = def.getConnectorBindings().values().iterator(); it.hasNext();) {
-                    	final ConnectorBinding binding = (ConnectorBinding)it.next();
-                 	 	otherBindings.add(binding);                   
-                	} // for                    
+                if (vdb.getStatus() == VDBStatus.ACTIVE || vdb.getStatus() == VDBStatus.ACTIVE_DEFAULT) {       
+                	for (Iterator models = def.getModels().iterator(); models.hasNext();) {
+                		ModelInfo model = (ModelInfo)models.next();
+	                    for (final Iterator it = model.getConnectorBindingNames().iterator(); it.hasNext();) {
+	                    	final String binding = (String)it.next();
+	                 	 	connectorNames.add(binding);                   
+	                	} // for     
+                	}
                 }                
             }
                         
             // Now start any other vdb related connectors.
-            for(Iterator i = otherBindings.iterator(); i.hasNext();) {
-                ConnectorBinding binding = null;
+            for(String connectorName:connectorNames) {
                 try {
-                	binding = (ConnectorBinding)i.next();     
-                	startConnectorBinding(binding.getDeployedName());
+                	startConnectorBinding(connectorName);
                 } catch (ApplicationLifecycleException e) {
                     // we need continue loading connectors even if one fails  
-                    DQPEmbeddedPlugin.logError(e, "DataService.Connector_failed_start", new Object[] {binding.getDeployedName()}); //$NON-NLS-1$                    
-                } catch(MetaMatrixComponentException e) {
-                    DQPEmbeddedPlugin.logError(e, "DataService.Connector_failed_start", new Object[] {binding.getDeployedName()}); //$NON-NLS-1$
-                }
+                    DQPEmbeddedPlugin.logError(e, "DataService.Connector_failed_start", new Object[] {connectorName}); //$NON-NLS-1$                    
+                } 
             }            
             DQPEmbeddedPlugin.logInfo("DataService.Started", null); //$NON-NLS-1$            
         } catch (MetaMatrixComponentException e) {
@@ -406,21 +249,15 @@
      */
     public void stopService() throws ApplicationLifecycleException {
     	getConfigurationService().unregister(this.listener);
-        // Avoid concurrent modification as stop binding also modifies the 
-        // map.
-        String[] connectorBindings = (String[])loadedConnectorBindingsMap.keySet().toArray(new String[loadedConnectorBindingsMap.keySet().size()]);        
-        for(int i = 0; i < connectorBindings.length; i++) {
-            try {
-                stopConnectorBinding(connectorBindings[i]);
-            } catch (MetaMatrixComponentException e) {
-                throw new ApplicationLifecycleException(e);
-            }
-        }
-               
+
+    	synchronized (connectorMgrs) {
+			for (ConnectorManager cm: connectorMgrs.values()) {
+				cm.stop();
+			}
+		}
+              
         // remove every thing to be gc'ed
         connectorMgrs.clear();   
-        connectorIDs.clear();
-        loadedConnectorBindingsMap.clear();
         
         DQPEmbeddedPlugin.logInfo("DataService.Stopped", null); //$NON-NLS-1$        
     }
@@ -430,152 +267,25 @@
      * load the connector binding from the configuration service and add a connector
      * manager. This is needed to startConnectorBinding
      */    
-    ConnectorManager getConnectorManager(ConnectorBinding binding, boolean create) 
-        throws MetaMatrixComponentException{
+    ConnectorManager getConnectorManager(String deployedConnectorName, boolean create) throws MetaMatrixComponentException {
         
-        ConnectorID connectionId = (ConnectorID)connectorIDs.get(binding.getDeployedName());
-        if (connectionId == null && create) {
-            return createConnectorManger(binding);
+    	ConnectorManager mgr = connectorMgrs.get(deployedConnectorName);
+        if (mgr == null) {
+        	if (create) {
+        		return createConnectorManger(deployedConnectorName);
+        	}
+            throw new ComponentNotFoundException(DQPEmbeddedPlugin.Util.getString("DataService.Unable_to_find_connector_manager_for_{0}_1", new Object[] { deployedConnectorName })); //$NON-NLS-1$
         }
-        return (ConnectorManager)connectorMgrs.get(connectionId);
+        return mgr;
     }
 
-    ConnectorManager getConnectorManager(ConnectorBinding binding) 
-        throws MetaMatrixComponentException{
-        return getConnectorManager(binding, true);
+    ConnectorManager getConnectorManager(String deployedConnectorName) throws MetaMatrixComponentException {
+        return getConnectorManager(deployedConnectorName, true);
     }
     
-    /**
-     * When somebody asks for the connector manager by their ID, that means
-     * Manager has been already created, we do not need to load the connector
-     * binding. 
-     */
-    ConnectorManager getConnectorManager(ConnectorID connID) {        
-        if (connID != null) {
-            return (ConnectorManager)connectorMgrs.get(connID);
-        }
-        return null;
-    }    
-
-    public ConnectorBinding getConnectorBinding(String deployedConnectorBindingName) 
-        throws MetaMatrixComponentException{
         
-        ConnectorBinding binding = (ConnectorBinding)loadedConnectorBindingsMap.get(deployedConnectorBindingName);
-        if (binding == null) {
-            if (SYSTEM_PHYSICAL_MODEL_NAME.equals(deployedConnectorBindingName)) {
-                binding = getSystemModelBinding();
-            }
-            else {
-                // if connector binding not found load from the configuration service.
-                binding = getConfigurationService().getConnectorBinding(deployedConnectorBindingName);
-            }
-        }
-        return binding;
-    }    
-    
-      
-    ConnectorManager createConnectorManger(ConnectorBinding binding) 
-        throws MetaMatrixComponentException{
-                
-        // Decrypt properties first
-        Properties connectorProperties = getDecryptedProperties(binding);
-        
-        String connectorId = String.valueOf(counter.getAndIncrement());
-        connectorProperties.setProperty(ConnectorPropertyNames.CONNECTOR_ID, connectorId);
-        connectorProperties.setProperty(ConnectorPropertyNames.CONNECTOR_BINDING_NAME, binding.getFullName());
-        
-        try {
-            ConnectorManager mgr = new ConnectorManager();       
-            mgr.setClassLoaderManager(this.getConfigurationService());
-            mgr.initialize(connectorProperties);            
-            return mgr;
-        } catch(Exception e) {
-            DQPEmbeddedPlugin.logError(e, "DataService.Failed_Initialize_CM", new Object[] {binding.getDeployedName()}); //$NON-NLS-1$            
-            throw new MetaMatrixComponentException(e);
-        }
+    ConnectorManager createConnectorManger(String deployedConnectorName) {
+        ConnectorManager mgr = new ConnectorManager(deployedConnectorName, this.workManager);       
+        return mgr;
     }
-    
-    private void removeConnectorBinding(String connectorBindingName) 
-        throws MetaMatrixComponentException {
-        // do house cleanup of the objects.
-        ConnectorID id = selectConnector(connectorBindingName);
-        connectorMgrs.remove(id);   
-        connectorIDs.remove(connectorBindingName);
-        loadedConnectorBindingsMap.remove(connectorBindingName);                    
-    }
-
-    Properties getDecryptedProperties(ConnectorBinding binding) 
-        throws MetaMatrixComponentException{
-                
-        Properties decryptedProperties = null;        
-        
-        // Get all the default properties for the connector type, so that
-        // if the connector binding does not have all the properties then these
-        // will take over, otherwise the connector binding ones overwrite
-        ComponentTypeID id = binding.getComponentTypeID();
-        ConnectorBindingType type = getConfigurationService().getConnectorType(id.getName());
-
-        // Index connector has no formal definition in the configuration file. 
-        decryptedProperties = new Properties(getConfigurationService().getDefaultProperties(type));
-
-        Properties bindingProperties = binding.getProperties();
-        
-        // now overlay the custom properties from the default properties.
-        decryptedProperties.putAll(bindingProperties);
-        
-        Iterator it = bindingProperties.keySet().iterator();
-        while(it.hasNext()) {
-            String name = (String)it.next();
-            if (isMaskedProperty(name, type)) {
-                try {
-                    String value = decryptProperty(bindingProperties.getProperty(name));
-                    decryptedProperties.setProperty(name, value);
-                } catch (CryptoException e) {
-                    DQPEmbeddedPlugin.logError(e, "DataService.decryption_failed", new Object[] {binding.getDeployedName(), name}); //$NON-NLS-1$
-                }
-            }
-        }
-        return PropertiesUtils.resolveNestedProperties(decryptedProperties);
-    }
-    
-    /**
-     * Check to see if the property read is a masked/encoded property 
-     * @param propName
-     * @param type
-     * @return
-     * @since 4.3
-     */
-    protected boolean isMaskedProperty(String  propName, ComponentType type) {
-        if (type != null) {
-            ComponentTypeDefn typeDef = type.getComponentTypeDefinition(propName);
-            if (typeDef != null && typeDef.getPropertyDefinition().isMasked()) {
-                return true;
-            }
-        }
-        return false;
-    }
-    
-    /**
-     * Decrypt the given property using the Crypto libraries. 
-     * @param value
-     * @return decrypted property.
-     * @since 4.3
-     */
-    protected String decryptProperty(String value) 
-        throws CryptoException{
-        if (value != null && value.length() > 0 && CryptoUtil.isValueEncrypted(value)) {
-            return CryptoUtil.stringDecrypt(value);
-        }
-        return value;
-    }    
-    
-    /**
-     * Create a Connector Binding for the System Model. 
-     * @return
-     * @since 4.3
-     */
-    ConnectorBinding getSystemModelBinding() {
-        return new DefaultIndexConnectorBinding();          
-    }    
-        
 }

Modified: branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedTransactionService.java
===================================================================
--- branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedTransactionService.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedTransactionService.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -24,27 +24,30 @@
 
 import java.util.Properties;
 
+import javax.resource.spi.XATerminator;
+
+import org.teiid.dqp.internal.transaction.ContainerTransactionProvider;
 import org.teiid.dqp.internal.transaction.TransactionServerImpl;
+import org.teiid.dqp.internal.transaction.XidFactory;
 
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
 import com.metamatrix.common.application.exception.ApplicationInitializationException;
-import com.metamatrix.common.xa.XATransactionException;
 import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
-import com.metamatrix.dqp.service.TransactionService;
-import com.metamatrix.xa.arjuna.ArjunaTransactionProvider;
 
 public class EmbeddedTransactionService extends TransactionServerImpl {
 
+	@Inject @Named("TeiidXATerminator")
+	private XATerminator xaTerminator;
+	
+	@Inject
+	private XidFactory xidfactory;	
+	
     @Override
-    public void initialize(Properties props)
-    		throws ApplicationInitializationException {
-        try {
-        	props = new Properties(props);
-            props.setProperty(TransactionService.PROCESSNAME, props.getProperty(DQPEmbeddedProperties.PROCESSNAME));
-            props.setProperty(TransactionService.TXN_STORE_DIR, props.getProperty(DQPEmbeddedProperties.DQP_WORKDIR));
-            this.setTransactionProvider(ArjunaTransactionProvider.getInstance(props));
-        } catch (XATransactionException e) {
-            throw new ApplicationInitializationException(e);
-        } 
+    public void initialize(Properties props) throws ApplicationInitializationException {
+        this.setTransactionProvider(new ContainerTransactionProvider(this.xaTerminator));
+        this.setProcessName(props.getProperty(DQPEmbeddedProperties.PROCESSNAME));
+        this.setXidFactory(xidfactory);
     }
     
 }

Modified: branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedVDBService.java
===================================================================
--- branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedVDBService.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/main/java/com/metamatrix/dqp/embedded/services/EmbeddedVDBService.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -26,7 +26,6 @@
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 import java.util.Properties;
 
 import org.teiid.dqp.internal.cache.DQPContextCache;
@@ -36,11 +35,11 @@
 import com.metamatrix.common.application.ApplicationEnvironment;
 import com.metamatrix.common.application.exception.ApplicationInitializationException;
 import com.metamatrix.common.application.exception.ApplicationLifecycleException;
-import com.metamatrix.common.config.api.ConnectorBinding;
 import com.metamatrix.common.vdb.api.ModelInfo;
 import com.metamatrix.common.vdb.api.SystemVdbUtility;
 import com.metamatrix.common.vdb.api.VDBArchive;
 import com.metamatrix.common.vdb.api.VDBDefn;
+import com.metamatrix.core.CoreConstants;
 import com.metamatrix.core.util.StringUtil;
 import com.metamatrix.core.vdb.VDBStatus;
 import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
@@ -57,6 +56,7 @@
  * @since 4.3
  */
 public class EmbeddedVDBService extends EmbeddedBaseDQPService implements VDBService, VDBLifeCycleListener {   
+	public static final String SYSTEM_PHYSICAL_MODEL_NAME = CoreConstants.SYSTEM_PHYSICAL_MODEL_NAME;
     static final String[] VDB_STATUS = {"INCOMPLETE", "INACTIVE", "ACTIVE", "DELETED"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
     
     @Inject
@@ -100,13 +100,13 @@
      * @see com.metamatrix.dqp.service.VDBService#getConnectorBindings(java.lang.String, java.lang.String, java.lang.String)
      * @since 4.3
      */
-    public List getConnectorBindingNames(String vdbName, String vdbVersion, String modelName) 
+    public List<String> getConnectorBindingNames(String vdbName, String vdbVersion, String modelName) 
         throws MetaMatrixComponentException {
 
         // If the request for System model, we have a single name always
         if (isSystemModel(modelName)) {
             List list = new ArrayList();
-            list.add(SYSTEM_PHYSICAL_MODEL_NAME);
+            list.add(INDEX_CONNECTOR_NAME);
             return list;
         }
         
@@ -123,17 +123,7 @@
             return bindingList;            
         }
         List<String> localNames = m.getConnectorBindingNames();
-        Map deployedBindingsMap = def.getConnectorBindings();
-        ArrayList<String> matches = new ArrayList<String>();
- 		if (localNames != null && !localNames.isEmpty()) {
- 			for(String localName:localNames) {
- 				ConnectorBinding deployedBinding = (ConnectorBinding)deployedBindingsMap.get(localName);
- 				if (deployedBinding != null) {
- 					matches.add(deployedBinding.getDeployedName());
- 				}
- 			}
- 		}
- 		return matches;
+ 		return localNames;
     }
         
     /** 

Deleted: branches/JCA/runtime/src/main/java/com/metamatrix/jdbc/CacheProvider.java
===================================================================
--- branches/JCA/runtime/src/main/java/com/metamatrix/jdbc/CacheProvider.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/main/java/com/metamatrix/jdbc/CacheProvider.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,54 +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.jdbc;
-
-import java.util.List;
-import java.util.Properties;
-
-import org.jboss.cache.Cache;
-import org.jboss.cache.DefaultCacheFactory;
-import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
-
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-import com.google.inject.Singleton;
-import com.google.inject.name.Named;
-import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
-
- at Singleton
-class CacheProvider implements Provider<org.jboss.cache.Cache> {
-	
-	@Inject @Named("DQPProperties") Properties props;
-
-	public Cache get() {
-		Cache cache = new DefaultCacheFactory().createCache("jboss-cache-configuration.xml", false); //$NON-NLS-1$
-		List<IndividualCacheLoaderConfig> configs = cache.getConfiguration().getCacheLoaderConfig().getIndividualCacheLoaderConfigs();
-		Properties p = configs.get(0).getProperties();
-		String workspaceDir = this.props.getProperty(DQPEmbeddedProperties.DQP_WORKDIR);
-		p.setProperty("location", workspaceDir + "/cache"); //$NON-NLS-1$ //$NON-NLS-2$
-		configs.get(0).setProperties(p);
-		cache.create();
-		cache.start();
-		return cache;
-	}
-}

Modified: branches/JCA/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java
===================================================================
--- branches/JCA/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedConnectionFactoryImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,7 +22,7 @@
 
 package com.metamatrix.jdbc;
 
-import static org.teiid.dqp.internal.process.Util.*;
+import static org.teiid.dqp.internal.process.Util.convertStats;
 
 import java.io.File;
 import java.io.IOException;
@@ -35,11 +35,16 @@
 import java.util.Date;
 import java.util.Properties;
 
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionManager;
+
+import org.teiid.ConnectionInfo;
+import org.teiid.TeiidManagedConnectionFactory;
+import org.teiid.TeiidResourceAdapter;
 import org.teiid.adminapi.Admin;
 import org.teiid.adminapi.AdminProcessingException;
 import org.teiid.dqp.internal.process.DQPCore;
 import org.teiid.transport.AdminAuthorizationInterceptor;
-import org.teiid.transport.LocalServerConnection;
 import org.teiid.transport.LogonImpl;
 import org.teiid.transport.SocketTransport;
 
@@ -68,10 +73,6 @@
 import com.metamatrix.dqp.client.ClientSideDQP;
 import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
 import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
-import com.metamatrix.dqp.embedded.admin.DQPConfigAdminImpl;
-import com.metamatrix.dqp.embedded.admin.DQPMonitoringAdminImpl;
-import com.metamatrix.dqp.embedded.admin.DQPRuntimeStateAdminImpl;
-import com.metamatrix.dqp.embedded.admin.DQPSecurityAdminImpl;
 import com.metamatrix.dqp.service.AuthorizationService;
 import com.metamatrix.dqp.service.ConfigurationService;
 import com.metamatrix.dqp.service.DQPServiceNames;
@@ -96,10 +97,25 @@
     private JMXUtil jmxServer;
     private boolean restart = false;
 	private InetAddress address;
+	private TeiidResourceAdapter ra;
+	private TeiidManagedConnectionFactory mcf;
+	private ConnectionManager cxManager;
     
+	public EmbeddedConnectionFactoryImpl(TeiidResourceAdapter ra, TeiidManagedConnectionFactory mcf, ConnectionManager cxmanager) {
+		this.ra = ra;
+		this.mcf = mcf;
+		this.cxManager = cxmanager;
+	}
+	
 	@Override
-	public ServerConnection createConnection(Properties connectionProperties) throws CommunicationException, ConnectionException {
-        return new LocalServerConnection(connectionProperties, this.clientServices, (SessionServiceInterface)findService(DQPServiceNames.SESSION_SERVICE));
+	public ServerConnection getConnection(Properties connectionProperties) throws CommunicationException, ConnectionException {
+		// unfortunately we can only offer the managed connections for the Embedded, for socket connections those requests come
+		// directly to this class and will not be managed
+		try {
+			return (ServerConnection)cxManager.allocateConnection(this.mcf,new ConnectionInfo(connectionProperties, clientServices, (SessionServiceInterface)findService(DQPServiceNames.SESSION_SERVICE)));
+		} catch (ResourceException e) {
+			throw new ConnectionException(e);
+		}        
 	}
         
     /**
@@ -131,10 +147,11 @@
 	        }
 	        
 	        // if there is no separate vdb-definitions specified then use the deploy directory as the location of the vdb
-	        String vdbDefinitions = props.getProperty(DQPEmbeddedProperties.VDB_DEFINITION);
-	        if (vdbDefinitions == null) {
-	        	props.setProperty(DQPEmbeddedProperties.VDB_DEFINITION, deployDirectory.getCanonicalPath());
+	        String vdbDefinitions = props.getProperty(DQPEmbeddedProperties.VDB_DEFINITION, deployDirectory.getCanonicalPath());
+	        if (!vdbDefinitions.endsWith("/")) {
+	        	vdbDefinitions = vdbDefinitions+"/";
 	        }
+	        props.put(DQPEmbeddedProperties.VDB_DEFINITION, URLHelper.buildURL(bootstrapURL, vdbDefinitions));
 	        
 	        // set the log directory
 	        File logDir = new File(teiidHome, props.getProperty(DQPEmbeddedProperties.DQP_LOGDIR, "log")); //$NON-NLS-1$
@@ -150,7 +167,7 @@
 		this.jmxServer = new JMXUtil(processName);
 		address = resolveHostAddress(props.getProperty(DQPEmbeddedProperties.BIND_ADDRESS));
 
-        EmbeddedGuiceModule config = new EmbeddedGuiceModule(bootstrapURL, props, this.jmxServer, address);
+        EmbeddedGuiceModule config = new EmbeddedGuiceModule(bootstrapURL, props, this.jmxServer, address, this.ra);
 		Injector injector = Guice.createInjector(config);
 		ResourceFinder.setInjector(injector);
 		config.setInjector(injector);
@@ -172,7 +189,7 @@
     	// start socket transport
         boolean enableSocketTransport = PropertiesUtils.getBooleanProperty(props, DQPEmbeddedProperties.ENABLE_SOCKETS, false);
         if (enableSocketTransport) {
-	        this.socketTransport = new SocketTransport(props, this.clientServices, (SessionServiceInterface)findService(DQPServiceNames.SESSION_SERVICE));
+	        this.socketTransport = new SocketTransport(props, this.clientServices, sessionService, this.ra.getWorkManager());
 	        this.socketTransport.start(address);
         }
         
@@ -350,10 +367,11 @@
     private Admin getAdminAPI() {
         
         InvocationHandler handler = new MixinProxy(new Object[] {
-                new DQPConfigAdminImpl(this),                    
-                new DQPMonitoringAdminImpl(this), 
-                new DQPRuntimeStateAdminImpl(this), 
-                new DQPSecurityAdminImpl(this)
+// TODO: This is hook for the admin API - NEEDS TO BE FIXED         		
+//                new DQPConfigAdminImpl(this),                    
+//                new DQPMonitoringAdminImpl(this), 
+//                new DQPRuntimeStateAdminImpl(this), 
+//                new DQPSecurityAdminImpl(this)
         }) {
             
         public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

Modified: branches/JCA/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedGuiceModule.java
===================================================================
--- branches/JCA/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedGuiceModule.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/main/java/com/metamatrix/jdbc/EmbeddedGuiceModule.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -29,9 +29,13 @@
 import java.util.Map;
 import java.util.Properties;
 
-import org.jboss.cache.Cache;
+import javax.resource.spi.XATerminator;
+import javax.resource.spi.work.WorkManager;
+
+import org.teiid.TeiidResourceAdapter;
 import org.teiid.dqp.internal.cache.DQPContextCache;
 import org.teiid.dqp.internal.process.DQPCore;
+import org.teiid.dqp.internal.transaction.XidFactory;
 
 import com.google.inject.AbstractModule;
 import com.google.inject.Injector;
@@ -45,7 +49,6 @@
 import com.metamatrix.common.log.LogConfiguration;
 import com.metamatrix.common.log.LogManager;
 import com.metamatrix.common.util.JMXUtil;
-import com.metamatrix.common.util.PropertiesUtils;
 import com.metamatrix.core.MetaMatrixRuntimeException;
 import com.metamatrix.core.log.LogListener;
 import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
@@ -56,7 +59,6 @@
 import com.metamatrix.dqp.embedded.services.EmbeddedTransactionService;
 import com.metamatrix.dqp.embedded.services.EmbeddedVDBService;
 import com.metamatrix.dqp.service.DQPServiceNames;
-import com.metamatrix.dqp.service.TransactionService;
 import com.metamatrix.platform.security.api.AuthorizationPolicy;
 import com.metamatrix.platform.security.authorization.service.AdminAuthorizationPolicyProvider;
 import com.metamatrix.platform.security.authorization.service.AuthorizationServiceImpl;
@@ -70,18 +72,24 @@
 	private JMXUtil jmx;
 	private InetAddress bindAddress;
 	Injector injector;
+	TeiidResourceAdapter ra;
 	
-	public EmbeddedGuiceModule(URL bootstrapURL, Properties props, JMXUtil jmxUtil, InetAddress bindAddress) {
+	public EmbeddedGuiceModule(URL bootstrapURL, Properties props, JMXUtil jmxUtil, InetAddress bindAddress, TeiidResourceAdapter ra) {
 		this.bootstrapURL = bootstrapURL;
 		this.props = props;
 		this.jmx = jmxUtil;
 		this.bindAddress = bindAddress;
+		this.ra = ra;
 	}
 	
 	@Override
 	protected void configure() {
 		bind(LogConfiguration.class).toProvider(LogConfigurationProvider.class).in(Scopes.SINGLETON);		
 		bind(LogListener.class).toProvider(LogListernerProvider.class).in(Scopes.SINGLETON);  
+
+		bind(WorkManager.class).annotatedWith(Names.named("TeiidWorkManager")).toInstance(ra.getWorkManager());
+		bind(XATerminator.class).annotatedWith(Names.named("TeiidXATerminator")).toInstance(ra.getXATerminator());
+		bind(XidFactory.class).in(Scopes.SINGLETON);
 		
 		bind(URL.class).annotatedWith(Names.named("BootstrapURL")).toInstance(bootstrapURL); //$NON-NLS-1$
 		bind(Properties.class).annotatedWith(Names.named("DQPProperties")).toInstance(this.props); //$NON-NLS-1$
@@ -89,7 +97,6 @@
 
 		bind(InetAddress.class).annotatedWith(Names.named(DQPEmbeddedProperties.HOST_ADDRESS)).toInstance(bindAddress);
 
-		bind(Cache.class).toProvider(CacheProvider.class).in(Scopes.SINGLETON);
 		bind(CacheFactory.class).to(JBossCacheFactory.class).in(Scopes.SINGLETON);
 		
 		bind(DQPContextCache.class).in(Scopes.SINGLETON);
@@ -122,7 +129,6 @@
 	}
 	
 	private Map<String, Class<? extends ApplicationService>> getDefaultServiceClasses() {
-		boolean useTxn = PropertiesUtils.getBooleanProperty(props, TransactionService.TRANSACTIONS_ENABLED, true);
 		
 		Map<String, Class<? extends ApplicationService>> result = new HashMap<String, Class<? extends ApplicationService>>();
 		result.put(DQPServiceNames.CONFIGURATION_SERVICE, EmbeddedConfigurationService.class);
@@ -130,9 +136,7 @@
 		result.put(DQPServiceNames.VDB_SERVICE, EmbeddedVDBService.class);
 		result.put(DQPServiceNames.METADATA_SERVICE, EmbeddedMetadataService.class);
 		result.put(DQPServiceNames.DATA_SERVICE, EmbeddedDataService.class);
-		if (useTxn) {
-			result.put(DQPServiceNames.TRANSACTION_SERVICE, EmbeddedTransactionService.class);
-		}
+		result.put(DQPServiceNames.TRANSACTION_SERVICE, EmbeddedTransactionService.class);
 		result.put(DQPServiceNames.SESSION_SERVICE, SessionServiceImpl.class);
 		result.put(DQPServiceNames.MEMBERSHIP_SERVICE, MembershipServiceImpl.class);
 		result.put(DQPServiceNames.AUTHORIZATION_SERVICE, AuthorizationServiceImpl.class);
@@ -151,6 +155,6 @@
 	@Override
 	public ApplicationService getServiceInstance(Class<? extends ApplicationService> type) {
 		return this.injector.getInstance(type);
-	}	
+	}
 }
 

Modified: branches/JCA/runtime/src/main/java/com/metamatrix/platform/security/membership/service/MembershipServiceImpl.java
===================================================================
--- branches/JCA/runtime/src/main/java/com/metamatrix/platform/security/membership/service/MembershipServiceImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/main/java/com/metamatrix/platform/security/membership/service/MembershipServiceImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -294,7 +294,7 @@
      * @throws MetaMatrixSecurityException
      * @throws MembershipServiceException 
      */
-    public AuthenticationToken authenticateUser(String username, Credentials credential, Serializable trustedPayload, String applicationName) {
+    public AuthenticationToken authenticateUser(String username, Credentials credential, String applicationName) {
         
         LogManager.logTrace(LogConstants.CTX_MEMBERSHIP, new Object[] {"authenticateUser", username, applicationName}); //$NON-NLS-1$
         
@@ -312,7 +312,7 @@
         }
         
         if (!isSecurityEnabled) {
-        	return new SuccessfulAuthenticationToken(trustedPayload, username);
+        	return new SuccessfulAuthenticationToken(username);
         }
         
         if (isSuperUser(username)) {
@@ -329,14 +329,14 @@
         	}
         	// decrypt admin password for comparison
             if ((credential != null && adminCredentials.equals(String.valueOf(credential.getCredentialsAsCharArray())))) {
-                return new SuccessfulAuthenticationToken(trustedPayload, username);
+                return new SuccessfulAuthenticationToken(username);
             }
             return new FailedAuthenticationToken();
         }
         
         if (isWsdlUser(username)) {
         	// No need to check credentials. There is no password for the wsdl user. 
-            return new SuccessfulAuthenticationToken(trustedPayload, username);
+            return new SuccessfulAuthenticationToken(username);
         }
         
         String baseUsername = getBaseUsername(username);
@@ -348,7 +348,7 @@
             MembershipDomainHolder entry = (MembershipDomainHolder)iter.next();
             try {
                 
-                SuccessfulAuthenticationToken auth = entry.getMembershipDomain().authenticateUser(baseUsername, credential, trustedPayload, applicationName);
+                SuccessfulAuthenticationToken auth = entry.getMembershipDomain().authenticateUser(baseUsername, credential, applicationName);
                 
                 if (auth != null) {
                     baseUsername = escapeName(auth.getUserName());
@@ -357,7 +357,7 @@
                     if (auth.getDomainName() != null) {
                         domain = auth.getDomainName();
                     }
-                    return new SuccessfulAuthenticationToken(auth.getPayload(), baseUsername + MembershipServiceInterface.AT + domain);
+                    return new SuccessfulAuthenticationToken(baseUsername + MembershipServiceInterface.AT + domain);
                 }
                 String msg = DQPEmbeddedPlugin.Util.getString("MembershipServiceImpl.Null_authentication", entry.getDomainName(), username ); //$NON-NLS-1$
                 LogManager.logError(LogConstants.CTX_MEMBERSHIP, msg);

Modified: branches/JCA/runtime/src/main/java/com/metamatrix/platform/security/membership/spi/MembershipDomain.java
===================================================================
--- branches/JCA/runtime/src/main/java/com/metamatrix/platform/security/membership/spi/MembershipDomain.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/main/java/com/metamatrix/platform/security/membership/spi/MembershipDomain.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,7 +22,6 @@
 
 package com.metamatrix.platform.security.membership.spi;
 
-import java.io.Serializable;
 import java.util.Properties;
 import java.util.Set;
 
@@ -61,8 +60,6 @@
      *            membership domain implementation uses a mechanism other than username/credential authentication.
      * @param credential
      *            The credentials belonging to the individual seeking authentication. May be <code>null</code> for anonymous authentications.
-     * @param trustedPayload
-     *            The trusted payload set by the client.  May be <code>null</code> if not set by the client.
      * @param applicationName
      *            The name of the application to which the individual is attempting to authenticate. It's provided as a connection
      *            property when the individual connects (via URL or connection properties). This <code>applicationName</code>
@@ -78,7 +75,6 @@
      */
     SuccessfulAuthenticationToken authenticateUser(String username,
                             Credentials credential,
-                            Serializable trustedPayload,
                             String applicationName) throws UnsupportedCredentialException, InvalidUserException, LogonException, MembershipSourceException;
 
     /**

Modified: branches/JCA/runtime/src/main/java/com/metamatrix/platform/security/membership/spi/file/FileMembershipDomain.java
===================================================================
--- branches/JCA/runtime/src/main/java/com/metamatrix/platform/security/membership/spi/file/FileMembershipDomain.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/main/java/com/metamatrix/platform/security/membership/spi/file/FileMembershipDomain.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -23,7 +23,6 @@
 package com.metamatrix.platform.security.membership.spi.file;
 
 import java.io.IOException;
-import java.io.Serializable;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Collections;
@@ -123,7 +122,6 @@
      */
     public SuccessfulAuthenticationToken authenticateUser(String username,
                                                           Credentials credential,
-                                                          Serializable trustedPayload,
                                                           String applicationName) throws UnsupportedCredentialException,
                                                                                  InvalidUserException,
                                                                                  LogonException,
@@ -139,7 +137,7 @@
         }
         
         if (!checkPasswords || password.equals(String.valueOf(credential.getCredentialsAsCharArray()))) {
-            return new SuccessfulAuthenticationToken(trustedPayload, username);
+            return new SuccessfulAuthenticationToken(username);
         }
                                 
         throw new LogonException("user " + username + " could not be authenticated"); //$NON-NLS-1$ //$NON-NLS-2$

Modified: branches/JCA/runtime/src/main/java/com/metamatrix/platform/security/membership/spi/ldap/LDAPMembershipDomain.java
===================================================================
--- branches/JCA/runtime/src/main/java/com/metamatrix/platform/security/membership/spi/ldap/LDAPMembershipDomain.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/main/java/com/metamatrix/platform/security/membership/spi/ldap/LDAPMembershipDomain.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -276,7 +276,6 @@
 
     public SuccessfulAuthenticationToken authenticateUser(String username,
                                                           Credentials credential,
-                                                          Serializable trustedPayload,
                                                           String applicationName) throws UnsupportedCredentialException,
                                                                                  InvalidUserException,
                                                                                  LogonException,
@@ -323,7 +322,7 @@
         	username = "";//$NON-NLS-1$
         }
 
-        return new SuccessfulAuthenticationToken(trustedPayload, username);
+        return new SuccessfulAuthenticationToken(username);
     }
 
     public Set getGroupNames() throws MembershipSourceException {

Modified: branches/JCA/runtime/src/main/java/com/metamatrix/platform/security/session/service/SessionServiceImpl.java
===================================================================
--- branches/JCA/runtime/src/main/java/com/metamatrix/platform/security/session/service/SessionServiceImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/main/java/com/metamatrix/platform/security/session/service/SessionServiceImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,7 +22,6 @@
 
 package com.metamatrix.platform.security.session.service;
 
-import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -39,7 +38,6 @@
 import com.metamatrix.admin.api.exception.security.InvalidSessionException;
 import com.metamatrix.admin.api.exception.security.MetaMatrixSecurityException;
 import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.api.exception.security.AuthorizationException;
 import com.metamatrix.api.exception.security.MetaMatrixAuthenticationException;
 import com.metamatrix.api.exception.security.SessionServiceException;
 import com.metamatrix.common.api.MMURL;
@@ -130,9 +128,9 @@
 	
 	@Override
 	public MetaMatrixSessionInfo createSession(String userName,
-			Credentials credentials, Serializable trustedToken,
-			String applicationName, Properties properties)
-			throws MetaMatrixAuthenticationException, SessionServiceException {
+			Credentials credentials, String applicationName,
+			Properties properties) throws MetaMatrixAuthenticationException,
+			SessionServiceException {
 		ArgCheck.isNotNull(applicationName);
         ArgCheck.isNotNull(properties);
         
@@ -142,7 +140,7 @@
         // Authenticate user...
         // if not authenticated, this method throws exception
         //
-        AuthenticationToken authenticatedToken = this.authenticateUser(userName, credentials, trustedToken, applicationName);
+        AuthenticationToken authenticatedToken = this.authenticateUser(userName, credentials, applicationName);
 
         String authenticatedUserName = authenticatedToken.getUserName();
         
@@ -186,7 +184,6 @@
         										productInfo,
                                                 properties.getProperty(MMURL.CONNECTION.CLIENT_IP_ADDRESS),
                                                 properties.getProperty(MMURL.CONNECTION.CLIENT_HOSTNAME));
-        newSession.setTrustedToken(trustedToken);
         this.sessionCache.put(newSession.getSessionID(), newSession);
         if (this.sessionListener != null) {
         	this.sessionListener.sessionCreated(newSession);
@@ -194,15 +191,13 @@
         return newSession;
 	}
 	
-    private AuthenticationToken authenticateUser(String userName,
-			Credentials credentials, Serializable trustedToken,
-			String applicationName) throws SessionServiceException,
-			MetaMatrixAuthenticationException {
+	private AuthenticationToken authenticateUser(String userName,
+			Credentials credentials, String applicationName)
+			throws SessionServiceException, MetaMatrixAuthenticationException {
 		AuthenticationToken authenticatedToken = null;
 		// Authenticate the principal ...
 		try {
-			authenticatedToken = this.membershipService.authenticateUser(userName,
-							credentials, trustedToken, applicationName);
+			authenticatedToken = this.membershipService.authenticateUser(userName, credentials, applicationName);
 		}catch (MetaMatrixSecurityException e) {
 			String msg = DQPEmbeddedPlugin.Util.getString("SessionServiceImpl.Membership_service_could_not_authenticate_user", new Object[] { userName }); //$NON-NLS-1$
 			SessionServiceException se = new SessionServiceException(e, msg);

Added: branches/JCA/runtime/src/main/java/org/teiid/ConnectionInfo.java
===================================================================
--- branches/JCA/runtime/src/main/java/org/teiid/ConnectionInfo.java	                        (rev 0)
+++ branches/JCA/runtime/src/main/java/org/teiid/ConnectionInfo.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,42 @@
+/*
+ * 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 org.teiid;
+
+import java.util.Properties;
+
+import javax.resource.spi.ConnectionRequestInfo;
+
+import com.metamatrix.common.comm.ClientServiceRegistry;
+import com.metamatrix.platform.security.api.service.SessionServiceInterface;
+
+public class ConnectionInfo implements ConnectionRequestInfo {
+	Properties properties;
+	ClientServiceRegistry clientServices;
+	SessionServiceInterface sessionService;
+	
+	public ConnectionInfo(Properties properties,ClientServiceRegistry clientServices,	SessionServiceInterface sessionService) {
+		this.properties = properties;
+		this.clientServices = clientServices;
+		this.sessionService = sessionService;
+	}
+}


Property changes on: branches/JCA/runtime/src/main/java/org/teiid/ConnectionInfo.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: branches/JCA/runtime/src/main/java/org/teiid/Server.java
===================================================================
--- branches/JCA/runtime/src/main/java/org/teiid/Server.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/main/java/org/teiid/Server.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -54,6 +54,7 @@
 	private Properties props;
 	
 	public Server(Properties props) {
+		super(null, null, null);
 		this.props = props;
 	}
 		
@@ -235,53 +236,7 @@
         
         sb.append(info.getClasspathInfo());
         
-        sb.append("\n\n---- Extension Jars Manifest Info ----\n");  //$NON-NLS-1$             
-
-        logManifestInfoForExtensionModules(sb);
-        
         LogManager.logInfo(LogConstants.CTX_PROCESS_INFO_LOG, sb.toString());
     }
-    
-    private void logManifestInfoForExtensionModules(StringBuffer sb) {
-        try {
-        	EmbeddedConfigurationService ecs = (EmbeddedConfigurationService)getDQP().getEnvironment().findService(DQPServiceNames.CONFIGURATION_SERVICE);
-            for (ExtensionModule module : ecs.getExtensionModules()) {
-                sb.append("\n == Jar: " + module.getFullName() + " ===== " );  //$NON-NLS-1$ //$NON-NLS-2$  
-                
-                File tempArchive = File.createTempFile("teiid", ".jar"); //$NON-NLS-1$ //$NON-NLS-2$
-                tempArchive.deleteOnExit();
-            	FileUtils.write(module.getFileContents(), tempArchive);
-                
-                Manifest m = ZipFileUtil.getManifest(tempArchive);
-                tempArchive.delete();
-                if (m != null) {
-                    // only print the manifest info for MetaMatrix related jars that have
-                    // the product information section
-                    Attributes manifestAttributes = m.getMainAttributes();
-                    if(manifestAttributes == null || manifestAttributes.isEmpty()){
-                        continue;
-                        
-                    } 
-                                                
-                    for (Iterator ita = manifestAttributes.keySet().iterator(); ita.hasNext();) {
-                        Object n =  ita.next();
-                        Object v = manifestAttributes.get(n);
-                        
-                        sb.append("\n");//$NON-NLS-1$
-                        sb.append("   ");//$NON-NLS-1$
-                        sb.append(n.toString());
-                        sb.append(":        "); //$NON-NLS-1$
-                        sb.append(v.toString());
-                        
-                    }
-                    sb.append("\n");//$NON-NLS-1$
-                    
-                } 
-            }
-        } catch(Exception e) {
-            sb.append("**** Error: Unable to list manifest - msg: " + e.getMessage());//$NON-NLS-1$
-        } 
-        
-    }
 
 }

Added: branches/JCA/runtime/src/main/java/org/teiid/TeiidManagedConnection.java
===================================================================
--- branches/JCA/runtime/src/main/java/org/teiid/TeiidManagedConnection.java	                        (rev 0)
+++ branches/JCA/runtime/src/main/java/org/teiid/TeiidManagedConnection.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,152 @@
+/*
+ * 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 org.teiid;
+
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionEvent;
+import javax.resource.spi.ConnectionEventListener;
+import javax.resource.spi.ConnectionRequestInfo;
+import javax.resource.spi.LocalTransaction;
+import javax.resource.spi.ManagedConnection;
+import javax.resource.spi.ManagedConnectionMetaData;
+import javax.security.auth.Subject;
+import javax.transaction.xa.XAResource;
+
+import org.teiid.connector.api.ConnectorException;
+import org.teiid.connector.basic.WrappedConnection;
+import org.teiid.transport.LocalServerConnection;
+
+import com.metamatrix.common.comm.exception.CommunicationException;
+import com.metamatrix.common.comm.exception.ConnectionException;
+
+public class TeiidManagedConnection implements ManagedConnection {
+	protected final Collection<ConnectionEventListener> listeners = new ArrayList<ConnectionEventListener>();
+	private PrintWriter log;
+	private WrappedTeiidConnection conn;
+	
+	public TeiidManagedConnection() {
+		
+	}
+	
+	@Override
+	public void associateConnection(Object handle) throws ResourceException {
+		if (!(handle instanceof WrappedConnection)) {
+			throw new ConnectorException("Wrong connection supplied to assosiate");
+		}
+		conn = (WrappedTeiidConnection)handle;
+		conn.setManagedConnection(this);		
+	}
+
+	@Override
+	public void cleanup() throws ResourceException {
+	}
+
+	@Override
+	public void destroy() throws ResourceException {
+	}
+
+	@Override
+	public Object getConnection(Subject arg0, ConnectionRequestInfo arg1) throws ResourceException {
+		ConnectionInfo ci = (ConnectionInfo)arg1;
+		try {
+			this.conn = new WrappedTeiidConnection(new LocalServerConnection(ci.properties, ci.clientServices, ci.sessionService));
+			this.conn.setManagedConnection(this);
+			return this;
+		} catch (CommunicationException e) {
+			throw new ResourceException(e);
+		} catch (ConnectionException e) {
+			if (e.getCause() instanceof ResourceException) {
+				throw (ResourceException)e.getCause();
+			}
+			throw new ResourceException(e);
+		}
+	}
+
+	@Override
+	public LocalTransaction getLocalTransaction() throws ResourceException {
+		return null;
+	}
+
+	@Override
+	public ManagedConnectionMetaData getMetaData() throws ResourceException {
+		return null;
+	}
+
+	@Override
+	public XAResource getXAResource() throws ResourceException {
+		return null;
+	}
+
+	@Override
+	public void addConnectionEventListener(ConnectionEventListener arg0) {
+		synchronized (listeners) {
+			listeners.add(arg0);
+		}
+	}	
+
+	@Override
+	public void removeConnectionEventListener(ConnectionEventListener arg0) {
+		synchronized (listeners) {
+			listeners.remove(arg0);
+		}
+	}
+	
+	@Override
+	public PrintWriter getLogWriter() throws ResourceException {
+		return this.log;
+	}	
+
+	@Override
+	public void setLogWriter(PrintWriter arg0) throws ResourceException {
+		this.log = arg0;
+	}
+
+	/**
+	 * This method called by wrapped Connection when the connection is closed by the user, which will in turn
+	 * remove the managed connection from the pool
+	 */
+	void connectionClosed() {
+		synchronized (listeners) {
+			for (ConnectionEventListener ce: listeners) {
+				ce.connectionClosed(new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED));
+			}
+		}
+		
+		ConnectionEvent ce = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
+		ce.setConnectionHandle(this.conn);
+		
+		ArrayList<ConnectionEventListener> copy = null;
+		synchronized (this.listeners) {
+			copy = new ArrayList<ConnectionEventListener>(this.listeners);
+		}
+		
+		for(ConnectionEventListener l: copy) {
+			l.connectionClosed(ce);
+		}		
+	}
+
+}


Property changes on: branches/JCA/runtime/src/main/java/org/teiid/TeiidManagedConnection.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: branches/JCA/runtime/src/main/java/org/teiid/TeiidManagedConnectionFactory.java
===================================================================
--- branches/JCA/runtime/src/main/java/org/teiid/TeiidManagedConnectionFactory.java	                        (rev 0)
+++ branches/JCA/runtime/src/main/java/org/teiid/TeiidManagedConnectionFactory.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,135 @@
+/*
+ * 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 org.teiid;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.net.URL;
+import java.util.Properties;
+import java.util.Set;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionManager;
+import javax.resource.spi.ConnectionRequestInfo;
+import javax.resource.spi.ManagedConnection;
+import javax.resource.spi.ManagedConnectionFactory;
+import javax.resource.spi.ResourceAdapter;
+import javax.resource.spi.ResourceAdapterAssociation;
+import javax.security.auth.Subject;
+
+import com.metamatrix.common.util.PropertiesUtils;
+import com.metamatrix.core.MetaMatrixCoreException;
+import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
+import com.metamatrix.jdbc.EmbeddedConnectionFactoryImpl;
+
+public class TeiidManagedConnectionFactory implements ManagedConnectionFactory,ResourceAdapterAssociation {
+	TeiidResourceAdapter ra;
+	PrintWriter log;
+	String deployPropertiesFile;
+	EmbeddedConnectionFactoryImpl connFactory;
+	String teiidHome;
+	
+	@Override
+	public Object createConnectionFactory() throws ResourceException {
+		return new ResourceException("Resource Adapter does not currently support running in a non-managed environment.");
+	}
+
+	@Override
+	public Object createConnectionFactory(ConnectionManager arg0) throws ResourceException {
+		try {
+			connFactory =  new EmbeddedConnectionFactoryImpl(this.ra, this, arg0);
+			connFactory.initialize(getDeployProperties());
+			return connFactory;
+		} catch (MetaMatrixCoreException e) {
+			throw new ResourceException(e);
+		} catch (IOException e) {
+			throw new ResourceException(e);
+		}
+	}
+
+	@Override
+	public ManagedConnection createManagedConnection(Subject arg0, ConnectionRequestInfo arg1) throws ResourceException {
+		return new TeiidManagedConnection();
+	}
+
+	@Override
+	public PrintWriter getLogWriter() throws ResourceException {
+		return this.log;
+	}
+
+	@Override
+	public ManagedConnection matchManagedConnections(Set arg0, Subject arg1, ConnectionRequestInfo arg2) throws ResourceException {
+		return null;
+	}
+
+	@Override
+	public void setLogWriter(PrintWriter arg0) throws ResourceException {
+		this.log = arg0;
+	}
+
+	@Override
+	public ResourceAdapter getResourceAdapter() {
+		return this.ra;
+	}
+
+	@Override
+	public void setResourceAdapter(ResourceAdapter arg0) throws ResourceException {
+		this.ra = (TeiidResourceAdapter)arg0;
+	}
+
+	public void setDeployPropertiesFile(String arg0) {
+		this.deployPropertiesFile = arg0;
+	}	
+	
+	public void setTeiidHome(String arg0) {
+		this.teiidHome = arg0;
+	}
+	
+	public Properties getDeployProperties() throws IOException {
+		Properties props = new Properties(System.getProperties());
+		if (this.deployPropertiesFile == null || this.deployPropertiesFile.trim().length() == 0) {
+			throw new IOException("deploy.properties property value not specified");
+		}
+		
+		URL url = this.getClass().getResource(this.deployPropertiesFile);
+		if (url != null) {
+			props.load(url.openStream());
+		}
+		else {
+			File f = new File(this.deployPropertiesFile);
+			if (!f.exists()) {
+				throw new IOException("deploy.properties not found at location=" + this.deployPropertiesFile);
+			}
+			props.load(new FileReader(f));
+		}
+		
+		// enable socket communication by default.
+		props.setProperty(DQPEmbeddedProperties.ENABLE_SOCKETS, Boolean.TRUE.toString());
+		props.setProperty(DQPEmbeddedProperties.BOOTURL, this.teiidHome);
+		props.setProperty(DQPEmbeddedProperties.TEIID_HOME, this.teiidHome);
+		props = PropertiesUtils.resolveNestedProperties(props);
+		return props;		
+	}
+}


Property changes on: branches/JCA/runtime/src/main/java/org/teiid/TeiidManagedConnectionFactory.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: branches/JCA/runtime/src/main/java/org/teiid/TeiidResourceAdapter.java
===================================================================
--- branches/JCA/runtime/src/main/java/org/teiid/TeiidResourceAdapter.java	                        (rev 0)
+++ branches/JCA/runtime/src/main/java/org/teiid/TeiidResourceAdapter.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.teiid;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ActivationSpec;
+import javax.resource.spi.BootstrapContext;
+import javax.resource.spi.ResourceAdapter;
+import javax.resource.spi.ResourceAdapterInternalException;
+import javax.resource.spi.XATerminator;
+import javax.resource.spi.endpoint.MessageEndpointFactory;
+import javax.resource.spi.work.WorkManager;
+import javax.transaction.xa.XAResource;
+
+public class TeiidResourceAdapter implements ResourceAdapter {
+	BootstrapContext ctx;
+	
+	@Override
+	public void endpointActivation(MessageEndpointFactory endpointFactory, ActivationSpec spec) throws ResourceException {
+	}
+
+	@Override
+	public void endpointDeactivation(MessageEndpointFactory endpointFactory, ActivationSpec spec) {
+	}
+
+	@Override
+	public XAResource[] getXAResources(ActivationSpec[] specs) throws ResourceException {
+		return new XAResource[0];
+	}
+
+	@Override
+	public void start(BootstrapContext ctx) throws ResourceAdapterInternalException {
+		this.ctx = ctx;
+	}
+
+	@Override
+	public void stop() {
+		// TODO: hook up to shutdown.
+	}
+
+	public WorkManager getWorkManager() {
+		return ctx.getWorkManager();
+	}
+	
+	public XATerminator getXATerminator() {
+		return ctx.getXATerminator();
+	}	
+}


Property changes on: branches/JCA/runtime/src/main/java/org/teiid/TeiidResourceAdapter.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: branches/JCA/runtime/src/main/java/org/teiid/WrappedTeiidConnection.java
===================================================================
--- branches/JCA/runtime/src/main/java/org/teiid/WrappedTeiidConnection.java	                        (rev 0)
+++ branches/JCA/runtime/src/main/java/org/teiid/WrappedTeiidConnection.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,73 @@
+/*
+ * 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 org.teiid;
+
+import com.metamatrix.common.comm.api.ServerConnection;
+import com.metamatrix.common.comm.exception.CommunicationException;
+import com.metamatrix.platform.security.api.LogonResult;
+
+public class WrappedTeiidConnection implements ServerConnection {
+
+	ServerConnection delegate;
+	TeiidManagedConnection mc;
+	boolean closed = false;
+	
+	public WrappedTeiidConnection(ServerConnection conn) {
+		this.delegate = conn;		
+	}
+	
+	@Override
+	public LogonResult getLogonResult() {
+		return delegate.getLogonResult();
+	}
+	
+	@Override
+	public <T> T getService(Class<T> iface) {
+		return delegate.getService(iface);
+	}
+
+	@Override
+	public boolean isOpen() {
+		return delegate.isOpen();
+	}
+
+	@Override
+	public boolean isSameInstance(ServerConnection conn)
+			throws CommunicationException {
+		return delegate.isSameInstance(conn);
+	}
+
+	@Override
+	public void close() {
+		if (!this.closed && this.mc != null) {
+			this.closed = true;
+			delegate.close();
+			this.mc.connectionClosed();
+			this.mc = null;
+		}		
+	}
+
+	void setManagedConnection(TeiidManagedConnection teiidManagedConnection) {
+		this.mc = teiidManagedConnection;
+	}
+}


Property changes on: branches/JCA/runtime/src/main/java/org/teiid/WrappedTeiidConnection.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: branches/JCA/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java
===================================================================
--- branches/JCA/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/main/java/org/teiid/transport/LocalServerConnection.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -125,7 +125,7 @@
 		return !shutdown;
 	}
 
-	public void shutdown() {
+	public void close() {
 		if (shutdown) {
 			return;
 		}

Modified: branches/JCA/runtime/src/main/java/org/teiid/transport/LogonImpl.java
===================================================================
--- branches/JCA/runtime/src/main/java/org/teiid/transport/LogonImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/main/java/org/teiid/transport/LogonImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -22,13 +22,8 @@
 
 package org.teiid.transport;
 
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
 import java.util.Properties;
 
-import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.api.CredentialMap;
 import org.teiid.dqp.internal.process.DQPWorkContext;
 
 import com.metamatrix.admin.api.exception.security.InvalidSessionException;
@@ -42,8 +37,6 @@
 import com.metamatrix.common.util.LogConstants;
 import com.metamatrix.core.CoreConstants;
 import com.metamatrix.dqp.client.ResultsFuture;
-import com.metamatrix.dqp.embedded.DQPEmbeddedPlugin;
-import com.metamatrix.jdbc.api.ConnectionProperties;
 import com.metamatrix.platform.security.api.Credentials;
 import com.metamatrix.platform.security.api.ILogon;
 import com.metamatrix.platform.security.api.LogonResult;
@@ -75,15 +68,9 @@
         if (password != null) {
             credential = new Credentials(password.toCharArray());
         }
-        
-        if(connProps.containsKey(ConnectionProperties.PROP_CREDENTIALS)) {
-            handleCredentials(connProps, user, password);
-        }
-        
-		Object payload = connProps.get(MMURL.CONNECTION.CLIENT_TOKEN_PROP);
-        
+               
 		try {
-			MetaMatrixSessionInfo sessionInfo = service.createSession(user,credential, (Serializable) payload, applicationName, connProps);
+			MetaMatrixSessionInfo sessionInfo = service.createSession(user,credential, applicationName, connProps);
 			MetaMatrixSessionID sessionID = updateDQPContext(sessionInfo);
 			LogManager.logDetail(LogConstants.CTX_SESSION, new Object[] {"Logon successful for \"", user, "\" - created SessionID \"", "" + sessionID, "\"" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
 			return new LogonResult(sessionInfo.getSessionToken(), sessionInfo.getProductInfo(), clusterName);
@@ -94,51 +81,11 @@
 		}
 	}
 
-	private void handleCredentials(Properties connProps, String user, String password) throws LogonException {
-
-		// Check if both credentials AND session token are used - if so, this is an error
-		if(connProps.containsKey(ConnectionProperties.PROP_CLIENT_SESSION_PAYLOAD)) {
-		    throw new LogonException(DQPEmbeddedPlugin.Util.getString("LogonImpl.Invalid_use_of_credentials_and_token"));                //$NON-NLS-1$
-		} 
-		
-		// Parse credentials and store CredentialMap as session token
-		try { 
-		    String credentials = connProps.getProperty(ConnectionProperties.PROP_CREDENTIALS);
-		    CredentialMap credentialMap = null;
-		    boolean defaultToLogon = false;
-		    if(credentials.startsWith(ConnectionProperties.DEFAULT_TO_LOGON)) {
-		        defaultToLogon = true;
-		    }
-		    int parenIndex = credentials.indexOf("("); //$NON-NLS-1$
-		    if(parenIndex >= 0) {
-		        credentialMap = CredentialMap.parseCredentials(credentials.substring(parenIndex));                    
-		    } else {
-		        credentialMap = new CredentialMap();
-		    }
-		    if(defaultToLogon) {
-		        credentialMap.setDefaultCredentialMode(CredentialMap.MODE_USE_DEFAULTS_GLOBALLY);
-		        Map<String, String> defaultCredentials = new HashMap<String, String>();
-		        defaultCredentials.put(CredentialMap.USER_KEYWORD, user);
-		        defaultCredentials.put(CredentialMap.PASSWORD_KEYWORD, password);
-		        credentialMap.setDefaultCredentials(defaultCredentials);
-		    } else {
-		        credentialMap.setDefaultCredentialMode(CredentialMap.MODE_IGNORE_DEFAULTS);
-		    }
-		    connProps.put(ConnectionProperties.PROP_CLIENT_SESSION_PAYLOAD, credentialMap);
-		} catch(ConnectorException e) {
-		    throw new LogonException(e.getMessage());
-		}
-		
-		// Remove credentials from info properties
-		connProps.remove(ConnectionProperties.PROP_CREDENTIALS);
-	}
-
 	private MetaMatrixSessionID updateDQPContext(MetaMatrixSessionInfo sessionInfo) {
 		MetaMatrixSessionID sessionID = sessionInfo.getSessionID();
 		DQPWorkContext workContext = DQPWorkContext.getWorkContext();
 		workContext.setSessionToken(sessionInfo.getSessionToken());
 		workContext.setAppName(sessionInfo.getApplicationName());
-		workContext.setTrustedPayload(sessionInfo.getTrustedToken());
 		workContext.setVdbName(sessionInfo.getProductInfo(ProductInfoConstants.VIRTUAL_DB));
 		workContext.setVdbVersion(sessionInfo.getProductInfo(ProductInfoConstants.VDB_VERSION));
 		return sessionID;

Modified: branches/JCA/runtime/src/main/java/org/teiid/transport/ServerWorkItem.java
===================================================================
--- branches/JCA/runtime/src/main/java/org/teiid/transport/ServerWorkItem.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/main/java/org/teiid/transport/ServerWorkItem.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -97,6 +97,7 @@
 			Method m = helper.findBestMethodOnTarget(serviceStruct.methodName, serviceStruct.args);
 			Object methodResult;
 			try {
+				System.out.println("Server Work: executing-\""+m.getName() + "\" on "+instance.getClass());
 				methodResult = m.invoke(instance, serviceStruct.args);
 			} catch (InvocationTargetException e) {
 				throw e.getCause();

Modified: branches/JCA/runtime/src/main/java/org/teiid/transport/SocketClientInstance.java
===================================================================
--- branches/JCA/runtime/src/main/java/org/teiid/transport/SocketClientInstance.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/main/java/org/teiid/transport/SocketClientInstance.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -145,6 +145,7 @@
 		if (LogManager.isMessageToBeRecorded(LogConstants.CTX_SERVER, MessageLevel.DETAIL)) { 
 			LogManager.logDetail(LogConstants.CTX_SERVER, "processing message:" + packet); //$NON-NLS-1$
         }
+		System.out.println("processing message:" + packet.getContents());
 		workerPool.execute(new ServerWorkItem(this, packet.getMessageKey(), packet, this.server, this.sessionService));
 	}
 

Modified: branches/JCA/runtime/src/main/java/org/teiid/transport/SocketListener.java
===================================================================
--- branches/JCA/runtime/src/main/java/org/teiid/transport/SocketListener.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/main/java/org/teiid/transport/SocketListener.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -23,10 +23,12 @@
 package org.teiid.transport;
 
 import java.net.InetSocketAddress;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
+import java.util.concurrent.Executor;
 
 import javax.net.ssl.SSLEngine;
+import javax.resource.spi.work.Work;
+import javax.resource.spi.work.WorkException;
+import javax.resource.spi.work.WorkManager;
 
 import org.jboss.netty.bootstrap.ServerBootstrap;
 import org.jboss.netty.channel.Channel;
@@ -34,6 +36,7 @@
 import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
 import org.teiid.transport.ChannelListener.ChannelListenerFactory;
 
+import com.metamatrix.common.CommonPlugin;
 import com.metamatrix.common.comm.ClientServiceRegistry;
 import com.metamatrix.common.comm.platform.socket.ObjectChannel;
 import com.metamatrix.common.log.LogManager;
@@ -43,7 +46,6 @@
 import com.metamatrix.common.util.ApplicationInfo;
 import com.metamatrix.common.util.LogConstants;
 import com.metamatrix.core.log.MessageLevel;
-import com.metamatrix.core.util.NamedThreadFactory;
 import com.metamatrix.platform.security.api.service.SessionServiceInterface;
 import com.metamatrix.platform.vm.controller.SocketListenerStats;
 
@@ -57,7 +59,7 @@
     private boolean isClientEncryptionEnabled;
     private SessionServiceInterface sessionService;
     private WorkerPool workerPool;
-    private ExecutorService nettyPool;
+    private Executor executor;
     
     /**
      * 
@@ -70,7 +72,7 @@
      * @param engine null if SSL is disabled
      */
     public SocketListener(int port, String bindAddress, ClientServiceRegistry server, int inputBufferSize,
-			int outputBufferSize, int maxWorkers, SSLEngine engine, boolean isClientEncryptionEnabled, SessionServiceInterface sessionService) {
+			int outputBufferSize, int maxWorkers, SSLEngine engine, boolean isClientEncryptionEnabled, SessionServiceInterface sessionService, WorkManager workManager) {
     	this.isClientEncryptionEnabled = isClientEncryptionEnabled;
     	this.sessionService = sessionService;
     	if (port < 0 || port > 0xFFFF) {
@@ -78,13 +80,13 @@
         }
 
        	this.server = server;
-        this.workerPool = WorkerPoolFactory.newWorkerPool("SocketWorker", maxWorkers); //$NON-NLS-1$
-        this.nettyPool = Executors.newCachedThreadPool(new NamedThreadFactory("NIO")); //$NON-NLS-1$
+       	this.executor = new WorkManagerExecutor(workManager);
+        this.workerPool = WorkerPoolFactory.newWorkerPool("SocketWorker", maxWorkers, this.executor); //$NON-NLS-1$
         if (LogManager.isMessageToBeRecorded(LogConstants.CTX_SERVER, MessageLevel.DETAIL)) { 
             LogManager.logDetail(LogConstants.CTX_SERVER, "server = " + bindAddress + "binding to port:" + port); //$NON-NLS-1$ //$NON-NLS-2$
 		}
 		
-        ChannelFactory factory = new NioServerSocketChannelFactory(nettyPool, nettyPool, Math.min(Runtime.getRuntime().availableProcessors(), maxWorkers));
+        ChannelFactory factory = new NioServerSocketChannelFactory(this.executor, this.executor, Math.min(Runtime.getRuntime().availableProcessors(), maxWorkers));
         
         ServerBootstrap bootstrap = new ServerBootstrap(factory);
         this.channelHandler = new SSLAwareChannelHandler(this, engine, Thread.currentThread().getContextClassLoader());
@@ -115,7 +117,6 @@
     public void stop() {
     	this.serverChanel.close();
     	this.workerPool.shutdownNow();
-    	this.nettyPool.shutdownNow();
     }
    
     public SocketListenerStats getStats() {
@@ -131,4 +132,29 @@
 		return new SocketClientInstance(channel, this.workerPool, this.server, this.isClientEncryptionEnabled, this.sessionService);
 	}
 
+	static class WorkManagerExecutor implements Executor{
+		WorkManager workManager;
+		
+		public WorkManagerExecutor(WorkManager workManager){
+			this.workManager = workManager;
+		}
+		
+		@Override
+		public void execute(final Runnable command) {
+			try {
+				workManager.scheduleWork(new Work() {
+					@Override
+					public void run() {
+						command.run();
+					}
+					
+					@Override
+					public void release() {
+					}				
+				});
+			} catch (WorkException e) {
+				LogManager.logError(LogConstants.CTX_POOLING, e, CommonPlugin.Util.getString("WorkerPool.uncaughtException")); //$NON-NLS-1$
+			}
+		}
+	}
 }
\ No newline at end of file

Modified: branches/JCA/runtime/src/main/java/org/teiid/transport/SocketTransport.java
===================================================================
--- branches/JCA/runtime/src/main/java/org/teiid/transport/SocketTransport.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/main/java/org/teiid/transport/SocketTransport.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -27,6 +27,8 @@
 import java.security.GeneralSecurityException;
 import java.util.Properties;
 
+import javax.resource.spi.work.WorkManager;
+
 import com.google.inject.name.Named;
 import com.metamatrix.common.comm.ClientServiceRegistry;
 import com.metamatrix.common.log.LogManager;
@@ -55,11 +57,13 @@
 	
 	private SessionServiceInterface sessionSerice;
 	protected ClientServiceRegistry clientServices;
+	private WorkManager workManager;
 	
-	public SocketTransport(Properties props, ClientServiceRegistry serivices, SessionServiceInterface sessionService) {
+	public SocketTransport(Properties props, ClientServiceRegistry serivices, SessionServiceInterface sessionService, WorkManager workMgr) {
 		this.props = props;
 		this.clientServices = serivices;
 		this.sessionSerice = sessionService;
+		this.workManager = workMgr;
 	}
 	
     public void start(@Named(DQPEmbeddedProperties.HOST_ADDRESS) InetAddress hostAddress) {
@@ -74,7 +78,7 @@
 			helper.init(this.props);
 			
 			LogManager.logDetail(LogConstants.CTX_SERVER, DQPEmbeddedPlugin.Util.getString("SocketTransport.1", new Object[] {bindAddress, String.valueOf(socketPort)})); //$NON-NLS-1$
-			this.listener = new SocketListener(socketPort, bindAddress, this.clientServices, inputBufferSize, outputBufferSize, maxThreads, helper.getServerSSLEngine(), helper.isClientEncryptionEnabled(), this.sessionSerice);
+			this.listener = new SocketListener(socketPort, bindAddress, this.clientServices, inputBufferSize, outputBufferSize, maxThreads, helper.getServerSSLEngine(), helper.isClientEncryptionEnabled(), this.sessionSerice, this.workManager);
 			
 		} catch (UnknownHostException e) {
 			throw new MetaMatrixRuntimeException(e, DQPEmbeddedPlugin.Util.getString("SocketTransport.2",new Object[] {bindAddress, String.valueOf(socketPort)})); //$NON-NLS-1$

Modified: branches/JCA/runtime/src/test/java/com/metamatrix/dqp/embedded/EmbeddedTestUtil.java
===================================================================
--- branches/JCA/runtime/src/test/java/com/metamatrix/dqp/embedded/EmbeddedTestUtil.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/test/java/com/metamatrix/dqp/embedded/EmbeddedTestUtil.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -26,11 +26,9 @@
 import java.io.IOException;
 import java.util.Properties;
 
-import com.metamatrix.common.protocol.URLHelper;
 import com.metamatrix.common.util.PropertiesUtils;
 import com.metamatrix.core.util.FileUtils;
 import com.metamatrix.core.util.UnitTestUtil;
-import com.metamatrix.dqp.embedded.services.EmbeddedConfigurationService;
 
 public class EmbeddedTestUtil {
 	
@@ -45,8 +43,7 @@
 	}
 	
     public static Properties getProperties(String file) throws IOException {
-        Properties props = PropertiesUtils.load(file);        
-        props.put(EmbeddedConfigurationService.PROPERTIES_URL, URLHelper.buildURL(file));
+        Properties props = PropertiesUtils.load(file);                
         return props;
     }
     

Modified: branches/JCA/runtime/src/test/java/com/metamatrix/dqp/embedded/TestEmbeddedConfigSource.java
===================================================================
--- branches/JCA/runtime/src/test/java/com/metamatrix/dqp/embedded/TestEmbeddedConfigSource.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/test/java/com/metamatrix/dqp/embedded/TestEmbeddedConfigSource.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -27,8 +27,14 @@
 import java.net.URL;
 import java.util.Properties;
 
+import javax.resource.spi.XATerminator;
+
 import junit.framework.TestCase;
 
+import org.mockito.Mockito;
+import org.teiid.TeiidResourceAdapter;
+import org.teiid.dqp.internal.datamgr.impl.FakeWorkManager;
+
 import com.google.inject.Guice;
 import com.google.inject.Injector;
 import com.metamatrix.common.protocol.URLHelper;
@@ -55,7 +61,10 @@
     	URL url = buildDQPUrl(UnitTestUtil.getTestDataPath() + "/bqt/fakebqt.properties"); //$NON-NLS-1$
     	p.load(url.openStream());
     	
-    	EmbeddedGuiceModule source = new EmbeddedGuiceModule(url, p, new JMXUtil("test"), InetAddress.getLocalHost() ); //$NON-NLS-1$       
+    	TeiidResourceAdapter ra = Mockito.mock(TeiidResourceAdapter.class);
+    	Mockito.stub(ra.getWorkManager()).toReturn(new FakeWorkManager());
+    	Mockito.stub(ra.getXATerminator()).toReturn(Mockito.mock(XATerminator.class));
+    	EmbeddedGuiceModule source = new EmbeddedGuiceModule(url, p, new JMXUtil("test"), InetAddress.getLocalHost(), ra); //$NON-NLS-1$       
 		Injector injector = Guice.createInjector(source);
 		source.setInjector(injector);
 

Deleted: branches/JCA/runtime/src/test/java/com/metamatrix/dqp/embedded/admin/TestBaseAdmin.java
===================================================================
--- branches/JCA/runtime/src/test/java/com/metamatrix/dqp/embedded/admin/TestBaseAdmin.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/test/java/com/metamatrix/dqp/embedded/admin/TestBaseAdmin.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,101 +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.dqp.embedded.admin;
-
-import junit.framework.TestCase;
-
-
-/** 
- * @since 4.3
- */
-public class TestBaseAdmin extends TestCase {
-
-    public void testRegexStuff() {
-        assertTrue("RegEx Failed", "one".matches(BaseAdmin.MULTIPLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertTrue("RegEx Failed", "one two".matches(BaseAdmin.MULTIPLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertFalse("RegEx Failed", "one two three ".matches(BaseAdmin.MULTIPLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertTrue("RegEx Failed", "one9_two_Three".matches(BaseAdmin.MULTIPLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertFalse("RegEx Failed", "one9_two*Three".matches(BaseAdmin.MULTIPLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertFalse("RegEx Failed", "#one9_two Three".matches(BaseAdmin.MULTIPLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        
-        assertTrue("RegEx Failed", "one".matches(BaseAdmin.SINGLE_WORD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertFalse("RegEx Failed", "one ".matches(BaseAdmin.SINGLE_WORD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertFalse("RegEx Failed", "one*".matches(BaseAdmin.SINGLE_WORD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertFalse("RegEx Failed", "one two".matches(BaseAdmin.SINGLE_WORD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertTrue("RegEx Failed", "one_TWO_three".matches(BaseAdmin.SINGLE_WORD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        
-        assertTrue("RegEx Failed", "one*".matches(BaseAdmin.MULTIPLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertTrue("RegEx Failed", "one two*".matches(BaseAdmin.MULTIPLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertFalse("RegEx Failed", "one two *".matches(BaseAdmin.MULTIPLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertFalse("RegEx Failed", "*one two*".matches(BaseAdmin.MULTIPLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertTrue("RegEx Failed", "*".matches(BaseAdmin.MULTIPLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertFalse("RegEx Failed", "#two*".matches(BaseAdmin.MULTIPLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertFalse("RegEx Failed", "one.*".matches(BaseAdmin.MULTIPLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertTrue("RegEx Failed", "one.two".matches(BaseAdmin.MULTIPLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertTrue("RegEx Failed", "one.two*".matches(BaseAdmin.MULTIPLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        
-        
-        assertTrue("RegEx Failed", "*".matches(BaseAdmin.SINGLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertTrue("RegEx Failed", "one*".matches(BaseAdmin.SINGLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertTrue("RegEx Failed", "one_TWO_three*".matches(BaseAdmin.SINGLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertFalse("RegEx Failed", "*one".matches(BaseAdmin.SINGLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertFalse("RegEx Failed", "* one".matches(BaseAdmin.SINGLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertFalse("RegEx Failed", "*.*".matches(BaseAdmin.SINGLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertFalse("RegEx Failed", "one.*".matches(BaseAdmin.SINGLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-
-        
-        assertTrue("RegEx Failed", "*".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertTrue("RegEx Failed", "one.*".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertTrue("RegEx Failed", "one".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertTrue("RegEx Failed", "one.two".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertFalse("RegEx Failed", "*.one".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertFalse("RegEx Failed", "one_two *".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertTrue("RegEx Failed", "one.two*".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$       
-        assertTrue("RegEx Failed", "one.two*.three*".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$        
-        assertFalse("RegEx Failed", "one.two**".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$                       
-        assertTrue("RegEx Failed", "one.two.*".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$        
-        assertTrue("RegEx Failed", "one*".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertFalse("RegEx Failed", "one.".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertTrue("RegEx Failed", "0.10.*".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertFalse("RegEx Failed", "0.10..*".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertFalse("RegEx Failed", "0.10..".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertFalse("RegEx Failed", ".one*".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertFalse("RegEx Failed", ".one_two".matches(BaseAdmin.WORD_AND_DOT_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        
-        assertTrue("RegEx Failed", "One".matches(BaseAdmin.VDB_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertTrue("RegEx Failed", "One.1".matches(BaseAdmin.VDB_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertTrue("RegEx Failed", "*.1".matches(BaseAdmin.VDB_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertFalse("RegEx Failed", "One.One".matches(BaseAdmin.VDB_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertTrue("RegEx Failed", "One*".matches(BaseAdmin.VDB_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertTrue("RegEx Failed", "One*.101".matches(BaseAdmin.VDB_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertFalse("RegEx Failed", "*.*".matches(BaseAdmin.VDB_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertFalse("RegEx Failed", "100.*".matches(BaseAdmin.VDB_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertTrue("RegEx Failed", ".1".matches(BaseAdmin.VDB_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        //assertTrue("RegEx Failed", "V0.*".matches(BaseAdmin.VDB_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        
-        assertTrue("RegEx Failed", "XML-Relational File Connector".matches(BaseAdmin.MULTIPLE_WORDS_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertTrue("RegEx Failed", "XML Connector".matches(BaseAdmin.MULTIPLE_WORDS_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        assertFalse("RegEx Failed", "XML&Relational Connector".matches(BaseAdmin.MULTIPLE_WORDS_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-        //assertTrue("RegEx Failed", "".matches(BaseAdmin.MULTIPLE_WORD_WILDCARD_REGEX)); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-}

Modified: branches/JCA/runtime/src/test/java/com/metamatrix/dqp/embedded/services/TestEmbeddedConfigurationService.java
===================================================================
--- branches/JCA/runtime/src/test/java/com/metamatrix/dqp/embedded/services/TestEmbeddedConfigurationService.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/test/java/com/metamatrix/dqp/embedded/services/TestEmbeddedConfigurationService.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -25,33 +25,24 @@
 import java.io.File;
 import java.io.FileWriter;
 import java.net.URL;
-import java.util.Collection;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 import java.util.Properties;
 
 import junit.framework.TestCase;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.common.application.ApplicationEnvironment;
-import com.metamatrix.common.config.api.ComponentType;
 import com.metamatrix.common.config.api.ComponentTypeID;
 import com.metamatrix.common.config.api.ConfigurationID;
 import com.metamatrix.common.config.api.ConnectorBinding;
 import com.metamatrix.common.config.api.ConnectorBindingID;
-import com.metamatrix.common.config.api.ExtensionModule;
 import com.metamatrix.common.config.model.BasicConnectorBinding;
-import com.metamatrix.common.config.model.BasicConnectorBindingType;
-import com.metamatrix.common.config.model.BasicExtensionModule;
 import com.metamatrix.common.vdb.api.VDBArchive;
-import com.metamatrix.common.vdb.api.VDBDefn;
 import com.metamatrix.core.util.FileUtils;
 import com.metamatrix.core.util.UnitTestUtil;
 import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
 import com.metamatrix.dqp.embedded.EmbeddedTestUtil;
-import com.metamatrix.dqp.embedded.configuration.VDBConfigurationReader;
 import com.metamatrix.dqp.service.ConfigurationService;
 import com.metamatrix.dqp.service.DQPServiceNames;
 
@@ -73,40 +64,8 @@
 
     protected void tearDown() throws Exception {
         service.stop();
-        FileUtils.removeDirectoryAndChildren(service.getDeployDir());
+        FileUtils.removeDirectoryAndChildren(service.getVDBWorkDir());
     }
-
-    public void testUseExtensionPath() throws Exception {
-        service.setUserPreferences(EmbeddedTestUtil.getProperties()); 
-        assertTrue(service.useExtensionClasspath());
-    }
-    
-    public void testUseExtensionPathFalse()  throws Exception {
-        Properties p = EmbeddedTestUtil.getProperties(); 
-        p.remove("dqp.extensions"); //$NON-NLS-1$        
-        service.setUserPreferences(p);        
-        assertFalse(service.useExtensionClasspath());
-    }
-    
-    public void testGetAvailableVDBFiles() throws Exception {
-        service.setUserPreferences(EmbeddedTestUtil.getProperties());
-        HashMap vdbFiles = VDBConfigurationReader.loadVDBS(service.getVDBLocations(), service.getDeployDir());
-        int count = vdbFiles.keySet().size();
-        assertEquals(2, count);   
-        // admin.vdb is ignored because it did not have any models
-        for (Iterator i = vdbFiles.keySet().iterator(); i.hasNext();){                                           
-            URL vdbURL = (URL)i.next();            
-            String path = vdbURL.getPath();
-            if (!path.endsWith("QT_Ora9DS.vdb") && !path.endsWith("Admin.vdb")) { //$NON-NLS-1$ //$NON-NLS-2$
-                fail("wrong file found"); //$NON-NLS-1$
-            }
-        }        
-    }
-    
-    public void testGetConfigFileURL() throws Exception {
-        service.setUserPreferences(EmbeddedTestUtil.getProperties()); 
-        assertTrue(service.getConfigFile().toString().endsWith("dqp/config/ServerConfig.xml"));            //$NON-NLS-1$
-    }
         
     public void testGetAlternateBinding2() throws Exception {
         BasicConnectorBinding binding = new BasicConnectorBinding(new ConfigurationID("foo"), new ConnectorBindingID(new ConfigurationID("foo"), "foo"), new ComponentTypeID("foo type")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
@@ -119,19 +78,6 @@
         // we did not set use alternate.
         assertTrue(service.getConnectorBinding(binding.getFullName())==alternatebinding);
     }    
-    
-    public void testGetDefaultExtensionPath()  throws Exception {
-        Properties p = EmbeddedTestUtil.getProperties(); 
-        p.remove(DQPEmbeddedProperties.DQP_EXTENSIONS);
-        service.setUserPreferences(p);        
-        assertTrue(service.getExtensionPath()[0].toString().endsWith("dqp/extensions/")); //$NON-NLS-1$
-    }
-    
-    public void testGetDirectoryToStoreVDBS() throws Exception {
-        Properties p = EmbeddedTestUtil.getProperties(); 
-        service.setUserPreferences(p);  
-        assertTrue(service.getVDBSaveLocation().toString().endsWith("dqp/config/QT_Ora9DS.vdb")); //$NON-NLS-1$
-    }
 
     public void testGetDirectoryToStoreVDBSByVDBName() throws Exception {
         Properties p = EmbeddedTestUtil.getProperties(); 
@@ -157,20 +103,7 @@
         URL f = service.getNewVDBLocation(vdb);
         assertTrue(f.toString().endsWith("dqp/config/Foo_2.vdb")); //$NON-NLS-1$
     }
-    
-    public void testGetFullyQualifiedPath() throws Exception{
-        Properties p = EmbeddedTestUtil.getProperties(); 
-        service.setUserPreferences(p);       
-        assertTrue(service.getFullyQualifiedPath("http://lib/foo.txt").toString().endsWith("http://lib/foo.txt")); //$NON-NLS-1$ //$NON-NLS-2$
-        assertTrue(service.getFullyQualifiedPath("file:/c:/lib/foo.txt").toString().endsWith("file:/c:/lib/foo.txt"));//$NON-NLS-1$ //$NON-NLS-2$
-        assertTrue(service.getFullyQualifiedPath("/lib/foo.txt").toString().endsWith("mmfile:/lib/foo.txt"));//$NON-NLS-1$ //$NON-NLS-2$
-        assertTrue(service.getFullyQualifiedPath("../lib/foo.txt").toString().endsWith("mmfile:"+UnitTestUtil.getTestScratchPath()+"/lib/foo.txt"));//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        assertTrue(service.getFullyQualifiedPath("lib/foo.txt").toString().endsWith("mmfile:"+UnitTestUtil.getTestScratchPath()+"/dqp/lib/foo.txt"));//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        assertTrue(service.getFullyQualifiedPath("./lib/foo.txt").toString().endsWith("mmfile:"+UnitTestUtil.getTestScratchPath()+"/dqp/lib/foo.txt"));//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        assertTrue(service.getFullyQualifiedPath("c:\\lib\\foo.txt").toString().endsWith("mmfile:/c:/lib/foo.txt"));//$NON-NLS-1$ //$NON-NLS-2$
-        assertTrue(service.getFullyQualifiedPath("c:/lib/foo.txt").toString().endsWith("mmfile:/c:/lib/foo.txt"));//$NON-NLS-1$ //$NON-NLS-2$              
-    }
-    
+        
     public void testGetNextVdbVersion() throws Exception{        
         Properties p = EmbeddedTestUtil.getProperties(); 
         service.setUserPreferences(p);
@@ -217,43 +150,6 @@
         assertNull(service.getConnectorBinding("QT_ORA9DS_1.BQT2 Oracle 9i Simple Cap")); //$NON-NLS-1$
     }    
     
-    
-    public void testDeleteConnectorType() throws Exception{        
-        Properties p = EmbeddedTestUtil.getProperties();
-        service.setUserPreferences(p);
-        service.initializeService(p);         
-        
-        try {
-            service.deleteConnectorType("UNKNOWN"); //$NON-NLS-1$
-        }catch(MetaMatrixComponentException e){
-            //pass
-        }
-        
-        assertNotNull(service.getConnectorType("File XMLSource Connector"));//$NON-NLS-1$
-        service.deleteConnectorType("File XMLSource Connector"); //$NON-NLS-1$
-        
-        try {
-            service.deleteConnectorType("File XMLSource Connector"); //$NON-NLS-1$
-        }catch(MetaMatrixComponentException e){
-            //pass
-        }               
-    }     
-    
-    public void testDeleteConnectorTypeInUse() throws Exception{        
-        Properties p = EmbeddedTestUtil.getProperties(); 
-        service.setUserPreferences(p);
-        service.initializeService(p);         
-        
-        assertNotNull(service.getConnectorType("Oracle ANSI JDBC Connector"));//$NON-NLS-1$
-        
-        try {
-            service.deleteConnectorType("Oracle ANSI JDBC Connector"); //$NON-NLS-1$
-            fail("Must have failed in deleteing the in use connector type"); //$NON-NLS-1$
-        }catch(MetaMatrixComponentException e){
-            //pass
-        }               
-    }     
-    
     public void testDeleteVDB() throws Exception{
         Properties p = EmbeddedTestUtil.getProperties(); 
         service.setUserPreferences(p);
@@ -278,16 +174,8 @@
         assertEquals("100", sp.getProperty("MaxPlanCacheSize")); //$NON-NLS-1$ //$NON-NLS-2$
         assertEquals("20000", sp.getProperty("MaxFetchSize")); //$NON-NLS-1$ //$NON-NLS-2$
     }
+
     
-    public void testGetSystemConfiguration() throws Exception{
-        Properties p = EmbeddedTestUtil.getProperties();       
-        service.setUserPreferences(p);         
-        assertNull(service.configurationModel);
-        
-        service.getSystemConfiguration();
-        assertNotNull(service.configurationModel);
-    }
-    
     public void testGetSystemVDB() throws Exception {
         Properties p = EmbeddedTestUtil.getProperties(); 
         service.setUserPreferences(p);
@@ -323,7 +211,7 @@
         p.remove(DQPEmbeddedProperties.USER_DEFINED_FUNCTIONS);
         assertNull(service.getUDFFile());
 
-        service.saveExtensionModule(new BasicExtensionModule(ConfigurationService.USER_DEFINED_FUNCTION_MODEL, "adding extension module", "xmi", "testing extension modules".getBytes())); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$        
+        //service.saveExtensionModule(new BasicExtensionModule(ConfigurationService.USER_DEFINED_FUNCTION_MODEL, "adding extension module", "xmi", "testing extension modules".getBytes())); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$        
         
         assertTrue(service.getUDFFile().toString().endsWith("/dqp/foo/"+ConfigurationService.USER_DEFINED_FUNCTION_MODEL)); //$NON-NLS-1$
         
@@ -337,62 +225,7 @@
         assertTrue(service.getVDBs().size() == 2); 
     }
     
-    public void testSaveConnectorBinding() throws Exception{
-        Properties p = EmbeddedTestUtil.getProperties();      
-        service.setUserPreferences(p);
-        service.initializeService(p);
-        
-        String msg = "Test update of the connector binding"; //$NON-NLS-1$
-        BasicConnectorBinding binding = (BasicConnectorBinding)service.getConnectorBinding("QT_ORA9DS_1.BQT2 Oracle 9i Simple Cap"); //$NON-NLS-1$
-        binding.setDescription(msg);
-        
-        service.saveConnectorBinding(binding.getFullName(), binding, true);
-        
-        // Test and make sure the VDB updated
-        VDBArchive vdb = service.getVDB("QT_Ora9DS", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-        VDBDefn def = vdb.getConfigurationDef();
-        
-        Map bindings = def.getConnectorBindings();
-        ConnectorBinding savedBinding = (ConnectorBinding)bindings.get("BQT2 Oracle 9i Simple Cap"); //$NON-NLS-1$
-        assertEquals(msg, savedBinding.getDescription());
-        
-        // Test and make sure the server config updated        
-        Collection configBindings = service.getSystemConfiguration().getConfiguration().getConnectorBindings();
-        Iterator it = configBindings.iterator();
-        while(it.hasNext()) {
-            ConnectorBinding b = (ConnectorBinding)it.next();
-            if (b.getFullName().equals("BQT2 Oracle 9i Simple Cap")) { //$NON-NLS-1$
-                assertEquals(msg, b.getDescription());
-            }
-        }         
-    }
-    
 
-    public void testSaveConnectorType() throws Exception{
-        Properties p = EmbeddedTestUtil.getProperties();    
-        service.setUserPreferences(p);
-        service.initializeService(p);
-        
-        String msg = "Test update of the connector type"; //$NON-NLS-1$
-        
-        BasicConnectorBindingType type = (BasicConnectorBindingType)service.getConnectorType("File XMLSource Connector"); //$NON-NLS-1$
-        type.setDescription(msg);
-        service.saveConnectorType(type);
-        
-        assertEquals(msg, service.getConnectorType("File XMLSource Connector").getDescription()); //$NON-NLS-1$
-        
-        Collection componentTypes = service.getSystemConfiguration().getComponentTypes().values();
-        for (Iterator i = componentTypes.iterator(); i.hasNext();) {
-            ComponentType t = (ComponentType)i.next();
-            if (t.getComponentTypeCode() == ComponentType.CONNECTOR_COMPONENT_TYPE_CODE) {
-                if (t.getFullName().equals("File XMLSource Connector")) { //$NON-NLS-1$
-                    assertEquals(msg, t.getDescription()); 
-                }
-            }
-        }
-    }
-
-    
     public void testSaveVDB() throws Exception{
         Properties p = EmbeddedTestUtil.getProperties(); 
         service.setUserPreferences(p);
@@ -455,99 +288,5 @@
         assertEquals(1, vdbs.size());
         assertEquals("QT_Ora9DS", vdbs.get(0).getName()); //$NON-NLS-1$
     }
-    
-    public void testGetConnectorTypes() throws Exception {
-        Properties p = EmbeddedTestUtil.getProperties();      
-        service.setUserPreferences(p);
-        service.initializeService(p);
-        
-        assertEquals(23, service.loadedConnectorTypes.size());
-    }
-    
-    public void testUseMultipleExtensionPath()  throws Exception {
-        Properties p = EmbeddedTestUtil.getProperties();
-        p.setProperty("dqp.extensions", "/foo/;../x/bar/"); //$NON-NLS-1$ //$NON-NLS-2$
-        service.setUserPreferences(p);        
-        assertEquals("mmfile:/foo/", service.getExtensionPath()[0].toExternalForm()); //$NON-NLS-1$
-        assertEquals("mmfile:target/scratch/x/bar/", service.getExtensionPath()[1].toExternalForm()); //$NON-NLS-1$
-    }    
-    
-    public void testGetExtensionModule()  throws Exception {
-        Properties p = EmbeddedTestUtil.getProperties();
-        
-        File f = new File("target/scratch/dqp/bar"); //$NON-NLS-1$
-        f.mkdirs();
-        FileWriter fw = new FileWriter("target/scratch/dqp/bar/extfile.jar"); //$NON-NLS-1$
-        fw.write("testing extension modules"); //$NON-NLS-1$
-        fw.flush();
-        fw.close();
-        
-        p.setProperty("dqp.extensions", "./foo/;./bar/"); //$NON-NLS-1$ //$NON-NLS-2$
-        service.setUserPreferences(p);
-        
-        // get all the modules in the system.
-        List<ExtensionModule> modules = service.getExtensionModules();
-        assertEquals("extfile.jar", modules.get(0).getID().getFullName()); //$NON-NLS-1$
-        assertEquals("testing extension modules", new String(modules.get(0).getFileContents())); //$NON-NLS-1$
-        
-        // get individual module
-        ExtensionModule m = service.getExtensionModule("extfile.jar"); //$NON-NLS-1$
-        assertEquals("testing extension modules", new String(m.getFileContents())); //$NON-NLS-1$
-        
-        // test adding of the extension module
-        service.saveExtensionModule(new BasicExtensionModule("added-ext.jar", "adding extension module", "jar", "testing extension modules".getBytes())); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-        modules = service.getExtensionModules();
-        assertEquals(2, modules.size());
-        
-        m = service.getExtensionModule("added-ext.jar"); //$NON-NLS-1$
-        assertEquals("testing extension modules", new String(m.getFileContents())); //$NON-NLS-1$
-        
-        modules = service.getExtensionModules();
-        assertEquals(2,  modules.size()); 
-        
-        // test common class path; also makes sure that the connect in position (1) has the newly added module
-        service.getUserPreferences().setProperty("dqp.extension.CommonClasspath", "extensionjar:added-ext.jar;extensionjar:extfile.jar"); //$NON-NLS-1$ //$NON-NLS-2$
-        URL[] urls  = service.getClassLoaderManager().parseURLs(service.getClassLoaderManager().getCommonExtensionClassPath());
-        assertEquals("mmfile:target/scratch/dqp/foo/added-ext.jar", urls[0].toString()); //$NON-NLS-1$
-        assertEquals("mmfile:target/scratch/dqp/bar/extfile.jar", urls[1].toString()); //$NON-NLS-1$
-        
-        // test delete 
-        service.deleteExtensionModule("added-ext.jar"); //$NON-NLS-1$
-        modules = service.getExtensionModules();
-        assertEquals(1,  modules.size()); 
-        
-        // test for non-existent module
-        try {
-			m = service.getExtensionModule("added-ext.jar"); //$NON-NLS-1$
-			fail("must have failed to find"); //$NON-NLS-1$
-		} catch (MetaMatrixComponentException e) {
-		}
-		
-		f.delete();
-    }      
-    
-    public void testCommonExtensionPath() throws Exception{
-        Properties p = EmbeddedTestUtil.getProperties();
-        File f = new File("target/scratch/dqp/bar"); //$NON-NLS-1$
-        f.mkdirs();
-        FileWriter fw = new FileWriter("target/scratch/dqp/bar/extfile.jar"); //$NON-NLS-1$
-        fw.write("testing extension modules"); //$NON-NLS-1$
-        fw.flush();
-        fw.close();
-        
-        fw = new FileWriter("target/scratch/dqp/bar/driver.jar"); //$NON-NLS-1$
-        fw.write("testing extension modules"); //$NON-NLS-1$
-        fw.flush();
-        fw.close();        
-        
-        p.setProperty("dqp.extensions", "./foo/;./bar/"); //$NON-NLS-1$ //$NON-NLS-2$
-        service.setUserPreferences(p);
-        
-        assertEquals("", service.getClassLoaderManager().getCommonExtensionClassPath()); //$NON-NLS-1$
-        
-        p.setProperty(DQPEmbeddedProperties.COMMON_EXTENSION_CLASPATH, "extensionjar:extfile.jar"); //$NON-NLS-1$
-               
-        URL[] urls  = service.getClassLoaderManager().parseURLs(service.getClassLoaderManager().getCommonExtensionClassPath());
-        assertEquals("mmfile:target/scratch/dqp/bar/extfile.jar", urls[0].toString()); //$NON-NLS-1$
-    }
+
 }

Modified: branches/JCA/runtime/src/test/java/com/metamatrix/dqp/embedded/services/TestEmbeddedVDBService.java
===================================================================
--- branches/JCA/runtime/src/test/java/com/metamatrix/dqp/embedded/services/TestEmbeddedVDBService.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/test/java/com/metamatrix/dqp/embedded/services/TestEmbeddedVDBService.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -23,7 +23,6 @@
 package com.metamatrix.dqp.embedded.services;
 
 import java.io.FileInputStream;
-import java.util.ArrayList;
 import java.util.List;
 import java.util.Properties;
 
@@ -31,14 +30,11 @@
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.common.application.Application;
-import com.metamatrix.common.config.api.ConnectorBinding;
-import com.metamatrix.common.config.api.ConnectorBindingType;
 import com.metamatrix.common.vdb.api.VDBArchive;
 import com.metamatrix.core.util.FileUtils;
 import com.metamatrix.core.util.UnitTestUtil;
 import com.metamatrix.core.vdb.VDBStatus;
 import com.metamatrix.dqp.embedded.EmbeddedTestUtil;
-import com.metamatrix.dqp.embedded.configuration.ConnectorConfigurationReader;
 import com.metamatrix.dqp.service.DQPServiceNames;
 
 
@@ -61,7 +57,7 @@
     protected void tearDown() throws Exception {
     	vdbService.stop();
         configService.stop();
-        FileUtils.removeDirectoryAndChildren(configService.getDeployDir());
+        FileUtils.removeDirectoryAndChildren(configService.getVDBWorkDir());
     }
 
     public void testGetTestVDB() throws Exception {        
@@ -87,9 +83,9 @@
         configService.initializeService(p);
         
         // asking "vdb.name" and stored "vdb.name"
-        List names = vdbService.getConnectorBindingNames("QT_Ora9DS", "1", EmbeddedBaseDQPService.SYSTEM_PHYSICAL_MODEL_NAME); //$NON-NLS-1$ //$NON-NLS-2$ 
+        List names = vdbService.getConnectorBindingNames("QT_Ora9DS", "1", EmbeddedVDBService.SYSTEM_PHYSICAL_MODEL_NAME); //$NON-NLS-1$ //$NON-NLS-2$ 
         assertEquals(1, names.size());
-        assertEquals(EmbeddedBaseDQPService.SYSTEM_PHYSICAL_MODEL_NAME, (String)names.get(0)); 
+        assertEquals(EmbeddedBaseDQPService.INDEX_CONNECTOR_NAME, (String)names.get(0)); 
     }
 
     // new VDB connector binding scope names
@@ -130,16 +126,16 @@
         props.setProperty("WaitTime", "0");//$NON-NLS-1$ //$NON-NLS-2$
         props.setProperty("DeployedName", "Loopy"); //$NON-NLS-1$ //$NON-NLS-2$
 
-        ConnectorBindingType ctype = configService.getConnectorType("Loopback Connector"); //$NON-NLS-1$
-        ConnectorBinding binding = ConnectorConfigurationReader.loadConnectorBinding("Loopy", props, ctype); //$NON-NLS-1$        
-        List list = new ArrayList();
-        list.add(binding);
+//        ConnectorBindingType ctype = configService.getConnectorType("Loopback Connector"); //$NON-NLS-1$
+//        ConnectorBinding binding = ConnectorConfigurationReader.loadConnectorBinding("Loopy", props, ctype); //$NON-NLS-1$        
+//        List list = new ArrayList();
+//        list.add(binding);
 
         assertEquals(3, configService.getConnectorBindings().size());
         VDBArchive vdb = vdbService.getVDB("QT_Ora9DS", "1"); //$NON-NLS-1$ //$NON-NLS-2$
 
-        assertEquals(2, vdb.getConfigurationDef().getConnectorBindings().size()); 
-        configService.assignConnectorBinding("QT_Ora9DS", "1", "BQT1", (ConnectorBinding[])list.toArray(new ConnectorBinding[list.size()])); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+//        assertEquals(2, vdb.getConfigurationDef().getConnectorBindings().size()); 
+//        configService.assignConnectorBinding("QT_Ora9DS", "1", "BQT1", (ConnectorBinding[])list.toArray(new ConnectorBinding[list.size()])); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
         
         // make sure we still have two bindings
         vdb = vdbService.getVDB("QT_Ora9DS", "1"); //$NON-NLS-1$ //$NON-NLS-2$

Modified: branches/JCA/runtime/src/test/java/com/metamatrix/platform/security/membership/service/TestMembershipServiceImpl.java
===================================================================
--- branches/JCA/runtime/src/test/java/com/metamatrix/platform/security/membership/service/TestMembershipServiceImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/test/java/com/metamatrix/platform/security/membership/service/TestMembershipServiceImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -69,7 +69,7 @@
         assertEquals(0, membershipServiceImpl.getDomains().size());
         assertFalse(membershipServiceImpl.isSecurityEnabled());
         
-        assertTrue(membershipServiceImpl.authenticateUser("foo", new Credentials("bar".toCharArray()), null, null) instanceof SuccessfulAuthenticationToken); //$NON-NLS-1$ //$NON-NLS-2$
+        assertTrue(membershipServiceImpl.authenticateUser("foo", new Credentials("bar".toCharArray()), null) instanceof SuccessfulAuthenticationToken); //$NON-NLS-1$ //$NON-NLS-2$
     }
     
     public void testBaseUsername() throws Exception {
@@ -98,15 +98,15 @@
         membershipService.setAllowedAddresses(Pattern.compile("192[.]168[.]0[.]2")); //$NON-NLS-1$
         membershipService.setAdminCredentials("pass1"); //$NON-NLS-1$
         
-        AuthenticationToken at = membershipService.authenticateUser(MembershipServiceImpl.DEFAULT_ADMIN_USERNAME, new Credentials("pass1".toCharArray()), null, null); //$NON-NLS-1$ 
+        AuthenticationToken at = membershipService.authenticateUser(MembershipServiceImpl.DEFAULT_ADMIN_USERNAME, new Credentials("pass1".toCharArray()), null); //$NON-NLS-1$ 
         
         assertFalse(at.isAuthenticated()); 
         DQPWorkContext.getWorkContext().setClientAddress("192.168.0.1"); //$NON-NLS-1$
-        at = membershipService.authenticateUser(MembershipServiceImpl.DEFAULT_ADMIN_USERNAME, new Credentials("pass1".toCharArray()), null, null); //$NON-NLS-1$ 
+        at = membershipService.authenticateUser(MembershipServiceImpl.DEFAULT_ADMIN_USERNAME, new Credentials("pass1".toCharArray()), null); //$NON-NLS-1$ 
         
         assertFalse(at.isAuthenticated()); 
         DQPWorkContext.getWorkContext().setClientAddress("192.168.0.2"); //$NON-NLS-1$
-        at = membershipService.authenticateUser(MembershipServiceImpl.DEFAULT_ADMIN_USERNAME, new Credentials("pass1".toCharArray()), null, null); //$NON-NLS-1$ 
+        at = membershipService.authenticateUser(MembershipServiceImpl.DEFAULT_ADMIN_USERNAME, new Credentials("pass1".toCharArray()), null); //$NON-NLS-1$ 
         
         assertTrue(at.isAuthenticated()); 
     }
@@ -122,7 +122,7 @@
     public void testAuthenticate() throws Exception {
         MembershipServiceImpl membershipService = createMembershipService();
         
-        AuthenticationToken at = membershipService.authenticateUser("user1", new Credentials("pass1".toCharArray()), null, null); //$NON-NLS-1$ //$NON-NLS-2$
+        AuthenticationToken at = membershipService.authenticateUser("user1", new Credentials("pass1".toCharArray()), null); //$NON-NLS-1$ //$NON-NLS-2$
         
         assertEquals("user1 at testFile", at.getUserName()); //$NON-NLS-1$
     }

Modified: branches/JCA/runtime/src/test/java/com/metamatrix/platform/security/membership/spi/file/TestFileMembershipDomain.java
===================================================================
--- branches/JCA/runtime/src/test/java/com/metamatrix/platform/security/membership/spi/file/TestFileMembershipDomain.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/test/java/com/metamatrix/platform/security/membership/spi/file/TestFileMembershipDomain.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -171,22 +171,13 @@
         }
     }
     
-    /** 
-     * testValidUserAuthentication - tests valid user
-     */
-    public void testValidUserAuthentication() throws Exception {
-        FileMembershipDomain domain = createFileMembershipDomain();
 
-        SuccessfulAuthenticationToken sat = domain.authenticateUser("user1", new Credentials("pass1".toCharArray()), null, null); //$NON-NLS-1$ //$NON-NLS-2$
-
-        assertNull(sat.getPayload());
-    }
     
     public void testInValidUserAuthentication() throws Exception {
         FileMembershipDomain domain = createFileMembershipDomain();
 
         try {
-            domain.authenticateUser("user1", null, null, null); //$NON-NLS-1$
+            domain.authenticateUser("user1", null, null); //$NON-NLS-1$
             fail("Expected exception"); //$NON-NLS-1$
         } catch (UnsupportedCredentialException uce) {
             //expected
@@ -222,7 +213,7 @@
         FileMembershipDomain domain = createFileMembershipDomain();
 
         try {
-        	domain.authenticateUser("joe", new Credentials("pass1".toCharArray()), null, null); //$NON-NLS-1$ //$NON-NLS-2$
+        	domain.authenticateUser("joe", new Credentials("pass1".toCharArray()), null); //$NON-NLS-1$ //$NON-NLS-2$
         	fail("expected exception"); //$NON-NLS-1$
         } catch (InvalidUserException e) {
         	assertEquals(e.getMessage(),"user joe is invalid"); //$NON-NLS-1$
@@ -236,7 +227,7 @@
         FileMembershipDomain domain = createFileMembershipDomain();
 
         try {
-        	domain.authenticateUser("user1", new Credentials("pass2".toCharArray()), null, null); //$NON-NLS-1$ //$NON-NLS-2$
+        	domain.authenticateUser("user1", new Credentials("pass2".toCharArray()), null); //$NON-NLS-1$ //$NON-NLS-2$
         	fail("expected exception"); //$NON-NLS-1$
         } catch (LogonException e) {
         	assertEquals(e.getMessage(),"user user1 could not be authenticated"); //$NON-NLS-1$
@@ -250,25 +241,14 @@
         FileMembershipDomain domain = createFileMembershipDomain();
 
         try {
-        	domain.authenticateUser("joe", new Credentials("pass1".toCharArray()), null, null); //$NON-NLS-1$ //$NON-NLS-2$
+        	domain.authenticateUser("joe", new Credentials("pass1".toCharArray()), null); //$NON-NLS-1$ //$NON-NLS-2$
         	fail("expected exception"); //$NON-NLS-1$
         } catch (InvalidUserException e) {
         	assertEquals(e.getMessage(),"user joe is invalid"); //$NON-NLS-1$
         }
     }
     
-    /** 
-     * testInvalidPasswordWithCheckingFalse - tests valid user but invalid password with checking turned off
-     */
-    public void testInvalidPasswordWithCheckingFalse() throws Exception {
-        FileMembershipDomain domain = createFileMembershipDomain(false);
 
-        SuccessfulAuthenticationToken sat = domain.authenticateUser("user1", new Credentials("pass2".toCharArray()), null, null); //$NON-NLS-1$ //$NON-NLS-2$
-
-        assertNull(sat.getPayload());
-    }
-
-
     /** 
      * testGetGroupNames - tests get groupNames.
      */

Modified: branches/JCA/runtime/src/test/java/com/metamatrix/platform/security/session/service/TestSessionServiceImpl.java
===================================================================
--- branches/JCA/runtime/src/test/java/com/metamatrix/platform/security/session/service/TestSessionServiceImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/test/java/com/metamatrix/platform/security/session/service/TestSessionServiceImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -18,7 +18,7 @@
 	public void testValidateSession() throws Exception {
 		SessionServiceImpl ssi = new SessionServiceImpl();
 		MembershipServiceInterface msi = Mockito.mock(MembershipServiceInterface.class);
-		Mockito.stub(msi.authenticateUser("steve", null, null, "foo")).toReturn(new SuccessfulAuthenticationToken(null, "steve at somedomain")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		Mockito.stub(msi.authenticateUser("steve", null, "foo")).toReturn(new SuccessfulAuthenticationToken("steve at somedomain")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 		ssi.setMembershipService(msi);
 		SessionListener listener = Mockito.mock(SessionListener.class);
 		ssi.register(listener);
@@ -31,7 +31,7 @@
 			
 		}
 		
-		MetaMatrixSessionInfo info = ssi.createSession("steve", null, null, "foo", new Properties()); //$NON-NLS-1$ //$NON-NLS-2$
+		MetaMatrixSessionInfo info = ssi.createSession("steve", null, "foo", new Properties()); //$NON-NLS-1$ //$NON-NLS-2$
 		id1 = info.getSessionID();
 		ssi.validateSession(id1);
 		

Modified: branches/JCA/runtime/src/test/java/org/teiid/transport/TestCommSockets.java
===================================================================
--- branches/JCA/runtime/src/test/java/org/teiid/transport/TestCommSockets.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/test/java/org/teiid/transport/TestCommSockets.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -35,6 +35,7 @@
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import org.teiid.dqp.internal.datamgr.impl.FakeWorkManager;
 
 import com.metamatrix.api.exception.ComponentNotFoundException;
 import com.metamatrix.api.exception.security.LogonException;
@@ -73,13 +74,13 @@
 		SessionServiceInterface sessionService = mock(SessionServiceInterface.class);
 		csr.registerClientService(ILogon.class, new LogonImpl(sessionService, "fakeCluster"), "foo"); //$NON-NLS-1$ //$NON-NLS-2$
 		listener = new SocketListener(addr.getPort(), addr.getAddress().getHostAddress(),
-				csr, 1024, 1024, 1, null, true, sessionService);
+				csr, 1024, 1024, 1, null, true, sessionService, new FakeWorkManager());
 
 		try {
 			Properties p = new Properties();
 			String url = new MMURL(addr.getHostName(), listener.getPort() - 1, false).getAppServerURL();
 			p.setProperty(MMURL.CONNECTION.SERVER_URL, url); //wrong port
-			SocketServerConnectionFactory.getInstance().createConnection(p);
+			SocketServerConnectionFactory.getInstance().getConnection(p);
 			fail("exception expected"); //$NON-NLS-1$
 		} catch (CommunicationException e) {
 
@@ -93,7 +94,7 @@
 		SocketListenerStats stats = listener.getStats();
 		assertEquals(2, stats.objectsRead); // handshake response, logon,
 		assertEquals(1, stats.sockets);
-		conn.shutdown();
+		conn.close();
 		stats = listener.getStats();
 		assertEquals(1, stats.maxSockets);
 		assertEquals(3, stats.objectsRead); // handshake response, logon, logoff
@@ -111,14 +112,14 @@
 		SocketListenerStats stats = listener.getStats();
 		assertEquals(2, stats.objectsRead); // handshake response, logon,
 		assertEquals(1, stats.sockets);
-		conn.shutdown();
+		conn.close();
 		stats = listener.getStats();
 		assertEquals(1, stats.maxSockets);
 		assertEquals(3, stats.objectsRead); // handshake response, logon, logoff
 		stats = listener.getStats();
 		assertEquals(1, stats.sockets);
 		conn = helpEstablishConnection(false, null);
-		conn.shutdown();
+		conn.close();
 		stats = listener.getStats();
 		assertEquals(1, stats.sockets);
 		assertEquals(1, stats.maxSockets);
@@ -128,7 +129,7 @@
 	@Test public void testConnectWithoutClientEncryption() throws Exception {
 		SocketServerConnection conn = helpEstablishConnection(false, null, false, new Properties());
 		assertTrue(conn.selectServerInstance().getCryptor() instanceof NullCryptor);
-		conn.shutdown();
+		conn.close();
 	}
 
 	private SocketServerConnection helpEstablishConnection(boolean secure,
@@ -150,7 +151,7 @@
 				}
 			}, "foo"); //$NON-NLS-1$
 			listener = new SocketListener(addr.getPort(), addr.getAddress().getHostAddress(),
-					csr, 1024, 1024, 1, serverSSL, isClientEncryptionEnabled, sessionService);
+					csr, 1024, 1024, 1, serverSSL, isClientEncryptionEnabled, sessionService, new FakeWorkManager());
 			SocketListenerStats stats = listener.getStats();
 			assertEquals(0, stats.maxSockets);
 			assertEquals(0, stats.objectsRead);
@@ -166,7 +167,7 @@
 			sscf = new SocketServerConnectionFactory();
 			sscf.initialize(socketConfig);
 		}
-		return sscf.createConnection(p);
+		return sscf.getConnection(p);
 	}
 
 	@Test public void testSSLConnectWithNonSSLServer() throws Exception {
@@ -185,7 +186,7 @@
 		Properties p = new Properties();
 		p.setProperty(SocketUtil.TRUSTSTORE_FILENAME, SocketUtil.NONE);
 		SocketServerConnection conn = helpEstablishConnection(true, engine, true, p);
-		conn.shutdown();
+		conn.close();
 	}
 	
 }

Modified: branches/JCA/runtime/src/test/java/org/teiid/transport/TestLogonImpl.java
===================================================================
--- branches/JCA/runtime/src/test/java/org/teiid/transport/TestLogonImpl.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/runtime/src/test/java/org/teiid/transport/TestLogonImpl.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -29,7 +29,6 @@
 
 import org.mockito.Mockito;
 
-import com.metamatrix.api.exception.security.LogonException;
 import com.metamatrix.common.api.MMURL;
 import com.metamatrix.platform.security.api.LogonResult;
 import com.metamatrix.platform.security.api.MetaMatrixSessionID;
@@ -52,7 +51,7 @@
 				new MetaMatrixSessionID(1), userName, 0, applicationName, new Properties(),
 				null, null); 
 
-		Mockito.stub(ssi.createSession(userName, null, null, applicationName,
+		Mockito.stub(ssi.createSession(userName, null, applicationName,
 								p)).toReturn(resultInfo);
 
 		LogonImpl impl = new LogonImpl(ssi, "fakeCluster"); //$NON-NLS-1$
@@ -62,29 +61,5 @@
 		assertEquals(new MetaMatrixSessionID(1), result.getSessionID());
 	}
 	
-	public void testCredentials() throws Exception {
-		SessionServiceInterface ssi = Mockito.mock(SessionServiceInterface.class);
-		LogonImpl impl = new LogonImpl(ssi, "fakeCluster"); //$NON-NLS-1$
-		Properties p = new Properties();
-		p.put(MMURL.CONNECTION.CLIENT_TOKEN_PROP, new Object());
-		//invalid credentials
-		p.setProperty(MMURL.JDBC.CREDENTIALS, "(...)"); //$NON-NLS-1$
-		
-		try {
-			impl.logon(p);
-			fail("exception expected"); //$NON-NLS-1$
-		} catch (LogonException e) {
-			assertEquals("Conflicting use of both client session token and credentials.", e.getMessage()); //$NON-NLS-1$
-		}
-		
-		p.remove(MMURL.CONNECTION.CLIENT_TOKEN_PROP);
-		
-		try {
-			impl.logon(p);
-			fail("exception expected"); //$NON-NLS-1$
-		} catch (LogonException e) {
-			assertEquals("Credentials string must contain \"system\" property.", e.getMessage()); //$NON-NLS-1$
-		}
-	}
 	
 }

Added: branches/JCA/test-integration/db/src/main/resources/datasources/derby/connection.properties
===================================================================
--- branches/JCA/test-integration/db/src/main/resources/datasources/derby/connection.properties	                        (rev 0)
+++ branches/JCA/test-integration/db/src/main/resources/datasources/derby/connection.properties	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,18 @@
+# db.type must match a ddl folder
+db.type=derby
+# db.connectortype must match a connector type defined in the configuration.xml
+db.connectortype=Apache Derby Network XA Connector
+
+
+driver=org.apache.derby.jdbc.ClientDriver
+URL=jdbc:derby://localhost:1527/teiid/txntest
+User=rareddy
+Password=mm
+
+ServerName=localhost
+DatabaseNMame=txntest
+PortNumber=1527
+ds-jndiname=localhost_1527
+
+Immutable=true
+


Property changes on: branches/JCA/test-integration/db/src/main/resources/datasources/derby/connection.properties
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: branches/JCA/test-integration/db/src/main/resources/datasources/mysql/connection.properties
===================================================================
--- branches/JCA/test-integration/db/src/main/resources/datasources/mysql/connection.properties	                        (rev 0)
+++ branches/JCA/test-integration/db/src/main/resources/datasources/mysql/connection.properties	2009-11-02 19:41:28 UTC (rev 1544)
@@ -0,0 +1,20 @@
+# db.type must match a ddl folder
+db.type=mysql
+# db.connectortype must match a connector type defined in the configuration.xml
+db.connectortype=MySQL JDBC XA Connector
+
+
+driver=com.mysql.jdbc.Driver
+URL=jdbc:mysql://localhost:3306/txntest
+User=rareddy
+Password=mm
+
+ServerName=txntest
+DatabaseName=localhost
+PortNumber=3306
+ds-jndiname=mysql_3306
+
+
+
+
+


Property changes on: branches/JCA/test-integration/db/src/main/resources/datasources/mysql/connection.properties
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: branches/JCA/test-integration/db/src/main/resources/ddl/mysql/create_tables.sql
===================================================================
--- branches/JCA/test-integration/db/src/main/resources/ddl/mysql/create_tables.sql	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/test-integration/db/src/main/resources/ddl/mysql/create_tables.sql	2009-11-02 19:41:28 UTC (rev 1544)
@@ -1,6 +1,6 @@
 
 -- these tables are used by custom junit test for testing transactions
 
-create Table g1 (e1 NUMERIC(5) PRIMARY KEY,   e2 varchar(50));
-create Table g2 (e1 NUMERIC(5) REFERENCES g1 (e1), e2 varchar(50));
+create Table g1 (e1 NUMERIC(5) PRIMARY KEY,   e2 varchar(50))ENGINE=InnoDB;
+create Table g2 (e1 NUMERIC(5), e2 varchar(50), FOREIGN KEY (e1) REFERENCES g1(e1))ENGINE=InnoDB;
    
\ No newline at end of file

Modified: branches/JCA/test-integration/db/src/main/resources/default-config.properties
===================================================================
--- branches/JCA/test-integration/db/src/main/resources/default-config.properties	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/test-integration/db/src/main/resources/default-config.properties	2009-11-02 19:41:28 UTC (rev 1544)
@@ -4,7 +4,7 @@
 
 
 # local, xa, jndi
-transaction-type=local
+#transaction-type=local
 
 process-batch = 20
 connector-batch = 20
@@ -17,13 +17,14 @@
 # properties for Teiid connection
 ##########################################
 #driver=org.teiid.jdbc.TeiidDriver
-driver=com.metamatrix.jdbc.EmbeddedDataSource
-URL=jdbc:metamatrix:Transaction at target/classes/transactions/transaction.properties;user=admin;password=teiid
+driver=org.teiid.jdbc.TeiidDataSource
+
+URL=jdbc:teiid:Transaction at mm://localhost:31000;user=admin;password=teiid
 User=admin
 Password=teiid
-databasename=Transaction
-servername=target/classes/transactions/transaction.properties
-portnumber=0
+DatabaseName=Transaction
+ServerName=localhost
+PortNumber=31000
 application-name=txn-test
 
 # jboss
@@ -34,20 +35,18 @@
 mm.ds-jndiname=mmXA
 usertxn-jndiname=java:comp/UserTransaction
 
-# === Mode-to-Datasource Mapping ======
-#  <model>=<datasource type name>
 
-# This mapping will be used by the set of testcases that load this config file.
-# These mapping control what datasource is mapped to which model 
+# These mappings control what datasource is mapped to which model when the -Dusedatasources=<comma seperated datasource names> option is used
+#		or the system environment is set.
 #
-# See the resources/datasources/datasource_mapping.xml for the available datasource type names
+# By providing the numerical order, it indicates which datasource to assign based on the order in the usedatasources property.
 #
-# 	<datasource type name> can be the name of either a datasourcegroup or datasource 
+# If -Dusedatasources is not set, then the datasource will be assigned in the order they are calling to obtain a datasource. 
 #
 #
 
-pm1=nonxa
-pm2=nonxa
+pm1=1
+pm2=2
 
 
 ##########################################

Modified: branches/JCA/test-integration/pom.xml
===================================================================
--- branches/JCA/test-integration/pom.xml	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/test-integration/pom.xml	2009-11-02 19:41:28 UTC (rev 1544)
@@ -96,6 +96,7 @@
             <version>${project.version}</version>
             <type>test-jar</type>
         </dependency>        
+        <!-- 
 		<dependency>
 			<groupId>org.jboss.teiid.connectors</groupId>
 			<artifactId>connector-loopback</artifactId>
@@ -112,7 +113,7 @@
 			<type>test-jar</type>
 			<version>${project.version}</version>
 		</dependency>
-
+        
 		<dependency>
 			<groupId>org.jboss.teiid.connectors</groupId>
 			<artifactId>connector-jdbc</artifactId>
@@ -124,7 +125,8 @@
 			<type>test-jar</type>
 			<version>${project.version}</version>
 		</dependency>
-
+        -->
+        
 		<!-- external dependencies -->
 		<dependency>
 			<groupId>org.apache.derby</groupId>
@@ -135,6 +137,7 @@
 	</dependencies>
 
   <modules>
-    <module>common</module>
+    <!--module>common</module-->
+    <module>db</module>
   </modules>
 </project>
\ No newline at end of file

Modified: branches/JCA/txn-jbossts/src/main/java/com/metamatrix/xa/arjuna/ArjunaTransactionProvider.java
===================================================================
--- branches/JCA/txn-jbossts/src/main/java/com/metamatrix/xa/arjuna/ArjunaTransactionProvider.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/txn-jbossts/src/main/java/com/metamatrix/xa/arjuna/ArjunaTransactionProvider.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -23,12 +23,14 @@
 package com.metamatrix.xa.arjuna;
 
 import java.io.File;
+import java.sql.SQLException;
 import java.util.Properties;
 
 import javax.resource.spi.XATerminator;
 import javax.transaction.Transaction;
 import javax.transaction.TransactionManager;
 import javax.transaction.xa.XAException;
+import javax.transaction.xa.XAResource;
 
 import org.teiid.dqp.internal.transaction.TransactionProvider;
 
@@ -47,10 +49,22 @@
 import com.arjuna.ats.jta.common.jtaPropertyManager;
 import com.metamatrix.common.xa.MMXid;
 import com.metamatrix.common.xa.XATransactionException;
-import com.metamatrix.dqp.service.TransactionService;
+import com.metamatrix.dqp.embedded.DQPEmbeddedProperties;
 
 public class ArjunaTransactionProvider implements TransactionProvider {
     
+	public static final String TRANSACTIONS_ENABLED = "xa.enabled"; //$NON-NLS-1$
+    public static final String MAX_TIMEOUT = "xa.max_timeout"; //$NON-NLS-1$
+    public static final String TXN_STORE_DIR = "xa.txnstore_dir"; //$NON-NLS-1$
+    public static final String TXN_STATUS_PORT = "xa.txnstatus_port"; //$NON-NLS-1$
+    public static final String TXN_ENABLE_RECOVERY = "xa.enable_recovery"; //$NON-NLS-1$
+    
+    public static final String PROCESSNAME = DQPEmbeddedProperties.PROCESSNAME;
+    
+    public static final String DEFAULT_TXN_MGR_LOG_DIR = "txnlog"; //$NON-NLS-1$
+    public static final String DEFAULT_TXN_TIMEOUT = "120"; //$NON-NLS-1$ //2 mins
+    public static final String DEFAULT_TXN_STATUS_PORT = "0"; //$NON-NLS-1$
+    
     private static final String NO = "NO"; //$NON-NLS-1$
     
     private XATerminatorImple terminator = new XATerminatorImple();
@@ -77,16 +91,16 @@
      */
     public void init(Properties props) throws XATransactionException {
         // unique name for this txn manager
-        String vmName = props.getProperty(TransactionService.PROCESSNAME);        
+        String vmName = props.getProperty(PROCESSNAME);        
         String txnMgrUniqueName = "txnmgr_" + "_" + vmName; //$NON-NLS-1$ //$NON-NLS-2$
 
         // set the directory for storing the in-flight transactions
-        String baseDir = props.getProperty(TransactionService.TXN_STORE_DIR, System.getProperty("java.io.tmpdir")); //$NON-NLS-1$
+        String baseDir = props.getProperty(TXN_STORE_DIR, System.getProperty("java.io.tmpdir")); //$NON-NLS-1$
         Configuration.setObjectStoreRoot(baseDir + File.separator +  "TeiidTxnStore" + File.separator + txnMgrUniqueName); //$NON-NLS-1$        
         
         // common properties
         arjPropertyManager.propertyManager.setProperty(com.arjuna.ats.arjuna.common.Environment.XA_NODE_IDENTIFIER, txnMgrUniqueName);
-        arjPropertyManager.propertyManager.setProperty("com.arjuna.ats.arjuna.recovery.transactionStatusManagerPort",  props.getProperty(TransactionService.TXN_STATUS_PORT, TransactionService.DEFAULT_TXN_STATUS_PORT)) ; //$NON-NLS-1$        
+        arjPropertyManager.propertyManager.setProperty("com.arjuna.ats.arjuna.recovery.transactionStatusManagerPort",  props.getProperty(TXN_STATUS_PORT, DEFAULT_TXN_STATUS_PORT)) ; //$NON-NLS-1$        
 
         // jta specific properties
         jtaPropertyManager.propertyManager.setProperty(Environment.JTA_TSR_IMPLEMENTATION, TransactionSynchronizationRegistryImple.class.getName());
@@ -97,10 +111,10 @@
         jtaPropertyManager.propertyManager.setProperty(XARecoveryModule.XARecoveryPropertyNamePrefix+"MM", XAConnectorRecovery.class.getName()); //$NON-NLS-1$ 
 
         // get the timeout property
-        int timeout = Integer.parseInt(props.getProperty(TransactionService.MAX_TIMEOUT, TransactionService.DEFAULT_TXN_TIMEOUT));
+        int timeout = Integer.parseInt(props.getProperty(MAX_TIMEOUT, DEFAULT_TXN_TIMEOUT));
         TxControl.setDefaultTimeout(timeout);
 
-        boolean startRecovery = Boolean.valueOf(props.getProperty(TransactionService.TXN_ENABLE_RECOVERY, "true")).booleanValue(); //$NON-NLS-1$
+        boolean startRecovery = Boolean.valueOf(props.getProperty(TXN_ENABLE_RECOVERY, "true")).booleanValue(); //$NON-NLS-1$
         if (startRecovery) {
             RecoveryManager.delayRecoveryManagerThread();
             recoveryManager = RecoveryManager.manager();
@@ -145,12 +159,20 @@
             this.recoveryManager.stop();
         }
     }
-
-    public void registerRecoverySource(String name, XAConnectionSource connector) {
-        XAConnectorRecovery.addConnector(name, connector);
-    }
     
-    public void removeRecoverySource(String name) {
-        XAConnectorRecovery.removeConnector(name);
-    }
+	public interface XAConnectionSource {
+		
+		XAResource getXAResource() throws SQLException;
+		
+		void close();
+		
+	}    
+//
+//    public void registerRecoverySource(String name, XAConnectionSource connector) {
+//        XAConnectorRecovery.addConnector(name, connector);
+//    }
+//    
+//    public void removeRecoverySource(String name) {
+//        XAConnectorRecovery.removeConnector(name);
+//    }
 }

Modified: branches/JCA/txn-jbossts/src/test/java/com/metamatrix/xa/arjuna/FakeXAConnection.java
===================================================================
--- branches/JCA/txn-jbossts/src/test/java/com/metamatrix/xa/arjuna/FakeXAConnection.java	2009-10-27 01:18:06 UTC (rev 1543)
+++ branches/JCA/txn-jbossts/src/test/java/com/metamatrix/xa/arjuna/FakeXAConnection.java	2009-11-02 19:41:28 UTC (rev 1544)
@@ -31,10 +31,9 @@
 import org.teiid.connector.basic.BasicConnection;
 import org.teiid.connector.language.ICommand;
 import org.teiid.connector.metadata.runtime.RuntimeMetadata;
-import org.teiid.connector.xa.api.XAConnection;
 
 
-class FakeXAConnection extends BasicConnection implements XAConnection {
+class FakeXAConnection extends BasicConnection {
     String name;
     boolean released = false;
     boolean failToCreateXAResource = false;



More information about the teiid-commits mailing list