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(a)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@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@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.
- */
-@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.
*/
-@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.removeTr