teiid SVN: r3221 - in tags: teiid-parent-7.5.0.Alpha1 and 133 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2011-06-05 14:45:10 -0400 (Sun, 05 Jun 2011)
New Revision: 3221
Added:
tags/teiid-parent-7.5.0.Alpha1/
tags/teiid-parent-7.5.0.Alpha1/adminshell/pom.xml
tags/teiid-parent-7.5.0.Alpha1/api/pom.xml
tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/CommandContext.java
tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/logging/AuditMessage.java
tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/logging/LogManager.java
tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/logging/LogMessage.java
tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/metadata/Table.java
tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/translator/BaseDelegatingExecutionFactory.java
tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/translator/ExecutionContext.java
tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/translator/ExecutionFactory.java
tags/teiid-parent-7.5.0.Alpha1/api/src/test/java/org/teiid/logging/TestLogManager.java
tags/teiid-parent-7.5.0.Alpha1/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
tags/teiid-parent-7.5.0.Alpha1/build/kits/jboss-container/teiid-releasenotes.html
tags/teiid-parent-7.5.0.Alpha1/build/pom.xml
tags/teiid-parent-7.5.0.Alpha1/cache-jbosscache/pom.xml
tags/teiid-parent-7.5.0.Alpha1/cache-jbosscache/src/main/java/org/teiid/events/jboss/JGroupsEventDistributor.java
tags/teiid-parent-7.5.0.Alpha1/client-jdk15/pom.xml
tags/teiid-parent-7.5.0.Alpha1/client-jdk15/src/main/java/net/sf/retrotranslator/runtime/java/net/
tags/teiid-parent-7.5.0.Alpha1/client/pom.xml
tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/adminapi/Session.java
tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java
tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java
tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/jdbc/ConnectionImpl.java
tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/jdbc/EmbeddedProfile.java
tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/jdbc/JDBCURL.java
tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/jdbc/StatementImpl.java
tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/net/TeiidURL.java
tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/net/socket/SocketServerConnectionFactory.java
tags/teiid-parent-7.5.0.Alpha1/client/src/test/java/org/teiid/jdbc/TestStatement.java
tags/teiid-parent-7.5.0.Alpha1/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java
tags/teiid-parent-7.5.0.Alpha1/common-core/pom.xml
tags/teiid-parent-7.5.0.Alpha1/common-core/src/main/java/org/teiid/core/util/PropertiesUtils.java
tags/teiid-parent-7.5.0.Alpha1/connectors/connector-file/pom.xml
tags/teiid-parent-7.5.0.Alpha1/connectors/connector-ldap/pom.xml
tags/teiid-parent-7.5.0.Alpha1/connectors/connector-salesforce/pom.xml
tags/teiid-parent-7.5.0.Alpha1/connectors/connector-ws/pom.xml
tags/teiid-parent-7.5.0.Alpha1/connectors/pom.xml
tags/teiid-parent-7.5.0.Alpha1/connectors/salesforce-api/pom.xml
tags/teiid-parent-7.5.0.Alpha1/connectors/sandbox/pom.xml
tags/teiid-parent-7.5.0.Alpha1/connectors/sandbox/translator-yahoo/pom.xml
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-file/pom.xml
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/pom.xml
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/ingres/IngresExecutionFactory.java
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/intersyscache/InterSystemsCacheExecutionFactory.java
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/modeshape/ModeShapeExecutionFactory.java
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/teradata/TeradataExecutionFactory.java
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/TranslationHelper.java
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleTranslator.java
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/sqlserver/TestSqlServerConversionVisitor.java
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/teradata/TestTeradataTranslator.java
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-ldap/pom.xml
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-ldap/src/test/java/org/teiid/translator/ldap/TestIQueryToLdapSearchParser.java
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-loopback/pom.xml
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-olap/pom.xml
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-salesforce/pom.xml
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/SalesForceExecutionFactory.java
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/visitors/TestVisitors.java
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-ws/pom.xml
tags/teiid-parent-7.5.0.Alpha1/console/pom.xml
tags/teiid-parent-7.5.0.Alpha1/documentation/admin-guide/pom.xml
tags/teiid-parent-7.5.0.Alpha1/documentation/caching-guide/pom.xml
tags/teiid-parent-7.5.0.Alpha1/documentation/client-developers-guide/pom.xml
tags/teiid-parent-7.5.0.Alpha1/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml
tags/teiid-parent-7.5.0.Alpha1/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-extensions.xml
tags/teiid-parent-7.5.0.Alpha1/documentation/client-developers-guide/src/main/docbook/en-US/content/odbc.xml
tags/teiid-parent-7.5.0.Alpha1/documentation/client-developers-guide/src/main/docbook/en-US/content/ssl.xml
tags/teiid-parent-7.5.0.Alpha1/documentation/developer-guide/pom.xml
tags/teiid-parent-7.5.0.Alpha1/documentation/developer-guide/src/main/docbook/en-US/content/logging.xml
tags/teiid-parent-7.5.0.Alpha1/documentation/developer-guide/src/main/docbook/en-US/content/udf.xml
tags/teiid-parent-7.5.0.Alpha1/documentation/pom.xml
tags/teiid-parent-7.5.0.Alpha1/documentation/quick-start-example/pom.xml
tags/teiid-parent-7.5.0.Alpha1/documentation/reference/pom.xml
tags/teiid-parent-7.5.0.Alpha1/documentation/reference/src/main/docbook/en-US/content/federated_planning.xml
tags/teiid-parent-7.5.0.Alpha1/documentation/reference/src/main/docbook/en-US/content/sql_support.xml
tags/teiid-parent-7.5.0.Alpha1/engine/pom.xml
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/common/buffer/BlockedException.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/dqp/internal/datamgr/ConnectorManager.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/dqp/internal/datamgr/ConnectorWorkItem.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/dqp/internal/datamgr/ExecutionContextImpl.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/dqp/internal/datamgr/RuntimeMetadataImpl.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/dqp/internal/process/AbstractWorkItem.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/dqp/internal/process/AuthorizationValidationVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/dqp/internal/process/AuthorizationValidator.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/dqp/internal/process/DataRoleAuthorizationValidator.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/dqp/internal/process/PreparedStatementRequest.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/eval/Evaluator.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/mapping/xml/MappingAttribute.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/mapping/xml/MappingBaseNode.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/mapping/xml/MappingCriteriaNode.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/mapping/xml/MappingDocument.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/mapping/xml/MappingElement.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/mapping/xml/MappingNode.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/mapping/xml/MappingNodeConstants.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/mapping/xml/MappingOutputter.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/mapping/xml/MappingRecursiveElement.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/mapping/xml/MappingVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/mapping/xml/ResultSetInfo.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/metadata/CompositeMetadataStore.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/metadata/TempMetadataAdapter.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/metadata/TempMetadataID.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/capabilities/BasicSourceCapabilities.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/capabilities/SourceCapabilities.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/relational/plantree/NodeConstants.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CapabilitiesUtil.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleChooseDependent.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleCollapseSource.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleImplementJoinStrategy.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleMergeCriteria.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePlaceAccess.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePlanJoins.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushAggregates.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRaiseAccess.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/xml/ContextReplacerVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/xml/CriteriaPlanner.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/xml/MarkExcludeVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/xml/NameInSourceResolverVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/xml/SourceNodePlannerVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/xml/ValidateMappedCriteriaVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/xml/XMLNodeMappingVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/xml/XMLPlanToProcessVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/xml/XMLPlanner.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/xml/XMLProjectionMinimizer.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/xml/XMLQueryPlanner.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/xml/XMLStagaingQueryPlanner.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/parser/SQLParserUtil.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/processor/relational/AccessNode.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/processor/relational/DependentCriteriaProcessor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/processor/relational/DependentValueSource.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/processor/relational/EnhancedSortMergeJoinStrategy.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/processor/relational/JoinNode.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/processor/relational/ProjectIntoNode.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/processor/relational/SortNode.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/processor/relational/UnionAllNode.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/processor/xml/XMLContext.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/resolver/command/InsertResolver.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/resolver/command/SimpleQueryResolver.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/resolver/command/XMLQueryResolver.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/resolver/util/ResolverUtil.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/sql/LanguageObject.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/sql/lang/ArrayTable.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/sql/lang/ExistsCriteria.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/sql/lang/FromClause.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/sql/lang/JoinPredicate.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/sql/lang/Select.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/sql/lang/SubqueryFromClause.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/sql/lang/TableFunctionReference.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/sql/lang/TextTable.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/sql/lang/UnaryFromClause.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/sql/lang/XMLTable.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/sql/util/ValueIteratorSource.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/sql/visitor/PredicateCollectorVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/util/CommandContext.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/security/Credentials.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/resources/org/teiid/query/i18n.properties
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestConnectorWorkItem.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestElementImpl.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestGroupImpl.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestInsertImpl.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestMetadataFactory.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/datamgr/TstLanguageBridgeFactory.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/process/TestAuthorizationValidationVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/process/TestCallableStatement.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/process/TestConnectorCapabilitiesFinder.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/process/TestMetaDataProcessor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatementBatchedUpdate.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/process/TestWorkItemState.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourceElementReplacementVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourceMetadataWrapper.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/function/TestFunctionLibrary.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/function/TestFunctionTree.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/function/TestResolvedFunctions.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/mapping/xml/TestMappingElement.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestAccessPatterns.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestAnsiJoinPushdown.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestBatchedUpdatePlanner.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestDependentJoins.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestExpressionsInGroupBy.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestInlineView.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestJoinOptimization.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestJoinPushdownRestrictions.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestLimit.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestOptionalJoins.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestPartitionedJoinPlanning.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestRuleMergeVirtual.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestRuleRaiseNull.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestRuleRemoveSorts.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestSortOptimization.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestStoredProcedurePlanning.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestSubqueryPushdown.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestUnionPlanning.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/proc/TestProcedurePlanner.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/relational/TestAliasGenerator.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestCalculateCostUtil.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestCapabilitiesUtil.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestCriteriaCapabilityValidatorVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleAccessPatternValidation.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleAssignOutputElements.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleChooseDependent.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRulePlaceAccess.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRulePushSelectCriteria.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleValidateWhereAll.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/xml/TestMarkExcludeVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/xml/TestNameInSourceResolverVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/xml/TestXMLNodeMappingVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/xml/TestXMLPlanner.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/parser/TestOptionsAndHints.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/parser/TestParser.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/FakeDataStore.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/TestDependentJoins.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/TestInsertProcessing.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/TestJoinWithFunction.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/TestOptionalJoins.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/TestOrderByProcessing.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/TestProcedureRelational.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/TestSecurityFunctions.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/TestSetProcessing.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/TestTempTables.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/TestTextTable.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/TestVirtualDepJoin.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/TestWithClauseProcessing.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/relational/TestAccessNode.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/relational/TestBatchedUpdateNode.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/relational/TestGroupingNode.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/relational/TestJoinNode.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/relational/TestProjectNode.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/relational/TestSelectNode.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/xml/TestInstructions.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/xml/TestSourceNodeGenaratorVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/xml/TestXMLPlanningEnhancements.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/xml/TestXMLProcessor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/resolver/TestFunctionResolving.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/resolver/TestProcedureResolving.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/resolver/TestResolver.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/resolver/TestXMLResolver.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/rewriter/TestOrderByRewrite.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/rewriter/TestQueryRewriter.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/sql/util/TestElementSymbolOptimizer.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/sql/visitor/TestEvaluatableVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/sql/visitor/TestSQLStringVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/validator/TestUpdateValidator.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/validator/TestValidator.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/resources/text/cdm_dos_win.txt
tags/teiid-parent-7.5.0.Alpha1/hibernate-dialect/pom.xml
tags/teiid-parent-7.5.0.Alpha1/jboss-integration/pom.xml
tags/teiid-parent-7.5.0.Alpha1/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
tags/teiid-parent-7.5.0.Alpha1/metadata/pom.xml
tags/teiid-parent-7.5.0.Alpha1/metadata/src/test/java/org/teiid/cdk/api/TranslationUtility.java
tags/teiid-parent-7.5.0.Alpha1/metadata/src/test/java/org/teiid/cdk/unittest/FakeTranslationFactory.java
tags/teiid-parent-7.5.0.Alpha1/metadata/src/test/java/org/teiid/metadata/index/TestStagingTable.java
tags/teiid-parent-7.5.0.Alpha1/metadata/src/test/resources/test.vdb
tags/teiid-parent-7.5.0.Alpha1/pom.xml
tags/teiid-parent-7.5.0.Alpha1/runtime/pom.xml
tags/teiid-parent-7.5.0.Alpha1/runtime/src/main/java/org/teiid/odbc/ODBCClientRemote.java
tags/teiid-parent-7.5.0.Alpha1/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java
tags/teiid-parent-7.5.0.Alpha1/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
tags/teiid-parent-7.5.0.Alpha1/runtime/src/main/java/org/teiid/services/TeiidLoginContext.java
tags/teiid-parent-7.5.0.Alpha1/runtime/src/main/java/org/teiid/transport/LogonImpl.java
tags/teiid-parent-7.5.0.Alpha1/runtime/src/main/java/org/teiid/transport/ODBCSocketListener.java
tags/teiid-parent-7.5.0.Alpha1/runtime/src/main/java/org/teiid/transport/PgBackendProtocol.java
tags/teiid-parent-7.5.0.Alpha1/runtime/src/main/resources/org/teiid/runtime/i18n.properties
tags/teiid-parent-7.5.0.Alpha1/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java
tags/teiid-parent-7.5.0.Alpha1/test-integration/common/pom.xml
tags/teiid-parent-7.5.0.Alpha1/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestCrossSourceStarJoin.java
tags/teiid-parent-7.5.0.Alpha1/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestRelate.java
tags/teiid-parent-7.5.0.Alpha1/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestXMLTypeTranslations.java
tags/teiid-parent-7.5.0.Alpha1/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
tags/teiid-parent-7.5.0.Alpha1/test-integration/common/src/test/java/org/teiid/jdbc/TestLocalConnections.java
tags/teiid-parent-7.5.0.Alpha1/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java
tags/teiid-parent-7.5.0.Alpha1/test-integration/common/src/test/resources/relate/
tags/teiid-parent-7.5.0.Alpha1/test-integration/db/pom.xml
tags/teiid-parent-7.5.0.Alpha1/test-integration/pom.xml
Removed:
tags/teiid-parent-7.5.0.Alpha1/adminshell/pom.xml
tags/teiid-parent-7.5.0.Alpha1/api/pom.xml
tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/CommandContext.java
tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/logging/AuditMessage.java
tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/logging/LogManager.java
tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/logging/LogMessage.java
tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/metadata/Table.java
tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/translator/BaseDelegatingExecutionFactory.java
tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/translator/ExecutionContext.java
tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/translator/ExecutionFactory.java
tags/teiid-parent-7.5.0.Alpha1/api/src/test/java/org/teiid/logging/TestLogManager.java
tags/teiid-parent-7.5.0.Alpha1/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
tags/teiid-parent-7.5.0.Alpha1/build/kits/jboss-container/teiid-releasenotes.html
tags/teiid-parent-7.5.0.Alpha1/build/pom.xml
tags/teiid-parent-7.5.0.Alpha1/cache-jbosscache/pom.xml
tags/teiid-parent-7.5.0.Alpha1/cache-jbosscache/src/main/java/org/teiid/events/jboss/JGroupsEventDistributor.java
tags/teiid-parent-7.5.0.Alpha1/client-jdk15/pom.xml
tags/teiid-parent-7.5.0.Alpha1/client/pom.xml
tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/adminapi/Session.java
tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java
tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java
tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/jdbc/ConnectionImpl.java
tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/jdbc/EmbeddedProfile.java
tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/jdbc/JDBCURL.java
tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/jdbc/StatementImpl.java
tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/net/TeiidURL.java
tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/net/socket/SocketServerConnectionFactory.java
tags/teiid-parent-7.5.0.Alpha1/client/src/test/java/org/teiid/jdbc/TestStatement.java
tags/teiid-parent-7.5.0.Alpha1/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java
tags/teiid-parent-7.5.0.Alpha1/common-core/pom.xml
tags/teiid-parent-7.5.0.Alpha1/common-core/src/main/java/org/teiid/core/util/PropertiesUtils.java
tags/teiid-parent-7.5.0.Alpha1/connectors/connector-file/pom.xml
tags/teiid-parent-7.5.0.Alpha1/connectors/connector-ldap/pom.xml
tags/teiid-parent-7.5.0.Alpha1/connectors/connector-salesforce/pom.xml
tags/teiid-parent-7.5.0.Alpha1/connectors/connector-ws/pom.xml
tags/teiid-parent-7.5.0.Alpha1/connectors/pom.xml
tags/teiid-parent-7.5.0.Alpha1/connectors/salesforce-api/pom.xml
tags/teiid-parent-7.5.0.Alpha1/connectors/sandbox/pom.xml
tags/teiid-parent-7.5.0.Alpha1/connectors/sandbox/translator-yahoo/pom.xml
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-file/pom.xml
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/pom.xml
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/ingres/IngresExecutionFactory.java
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/intersyscache/InterSystemsCacheExecutionFactory.java
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/modeshape/ModeShapeExecutionFactory.java
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleSpatialFunctions.java
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/teradata/TeradataExecutionFactory.java
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/TranslationHelper.java
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleTranslator.java
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/sqlserver/TestSqlServerConversionVisitor.java
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/teradata/TestTeradataTranslator.java
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-ldap/pom.xml
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-ldap/src/test/java/org/teiid/translator/ldap/TestIQueryToLdapSearchParser.java
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-loopback/pom.xml
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-olap/pom.xml
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-salesforce/pom.xml
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/SalesForceExecutionFactory.java
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/visitors/TestVisitors.java
tags/teiid-parent-7.5.0.Alpha1/connectors/translator-ws/pom.xml
tags/teiid-parent-7.5.0.Alpha1/console/pom.xml
tags/teiid-parent-7.5.0.Alpha1/documentation/admin-guide/pom.xml
tags/teiid-parent-7.5.0.Alpha1/documentation/caching-guide/pom.xml
tags/teiid-parent-7.5.0.Alpha1/documentation/client-developers-guide/pom.xml
tags/teiid-parent-7.5.0.Alpha1/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml
tags/teiid-parent-7.5.0.Alpha1/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-extensions.xml
tags/teiid-parent-7.5.0.Alpha1/documentation/client-developers-guide/src/main/docbook/en-US/content/odbc.xml
tags/teiid-parent-7.5.0.Alpha1/documentation/client-developers-guide/src/main/docbook/en-US/content/ssl.xml
tags/teiid-parent-7.5.0.Alpha1/documentation/developer-guide/pom.xml
tags/teiid-parent-7.5.0.Alpha1/documentation/developer-guide/src/main/docbook/en-US/content/logging.xml
tags/teiid-parent-7.5.0.Alpha1/documentation/developer-guide/src/main/docbook/en-US/content/udf.xml
tags/teiid-parent-7.5.0.Alpha1/documentation/pom.xml
tags/teiid-parent-7.5.0.Alpha1/documentation/quick-start-example/pom.xml
tags/teiid-parent-7.5.0.Alpha1/documentation/reference/pom.xml
tags/teiid-parent-7.5.0.Alpha1/documentation/reference/src/main/docbook/en-US/content/federated_planning.xml
tags/teiid-parent-7.5.0.Alpha1/documentation/reference/src/main/docbook/en-US/content/sql_support.xml
tags/teiid-parent-7.5.0.Alpha1/engine/pom.xml
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/common/buffer/BlockedException.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/common/buffer/TupleBuffer.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/dqp/internal/datamgr/ConnectorManager.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/dqp/internal/datamgr/ConnectorWorkItem.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/dqp/internal/datamgr/ExecutionContextImpl.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/dqp/internal/datamgr/RuntimeMetadataImpl.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/dqp/internal/process/AbstractWorkItem.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/dqp/internal/process/AuthorizationValidationVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/dqp/internal/process/AuthorizationValidator.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/dqp/internal/process/DataRoleAuthorizationValidator.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/dqp/internal/process/DataTierTupleSource.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/dqp/internal/process/PreparedStatementRequest.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/eval/Evaluator.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/mapping/xml/MappingAttribute.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/mapping/xml/MappingBaseNode.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/mapping/xml/MappingCriteriaNode.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/mapping/xml/MappingDocument.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/mapping/xml/MappingElement.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/mapping/xml/MappingNode.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/mapping/xml/MappingNodeConstants.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/mapping/xml/MappingOutputter.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/mapping/xml/MappingRecursiveElement.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/mapping/xml/MappingVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/mapping/xml/ResultSetInfo.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/metadata/CompositeMetadataStore.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/metadata/TempMetadataAdapter.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/metadata/TempMetadataID.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/metadata/TransformationMetadata.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/capabilities/BasicSourceCapabilities.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/capabilities/SourceCapabilities.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/relational/PlanToProcessConverter.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/relational/plantree/NodeConstants.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CapabilitiesUtil.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleChooseDependent.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleCollapseSource.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleImplementJoinStrategy.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleMergeCriteria.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePlaceAccess.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePlanJoins.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushAggregates.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRaiseAccess.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/xml/ContextReplacerVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/xml/CriteriaPlanner.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/xml/MarkExcludeVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/xml/NameInSourceResolverVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/xml/SourceNodePlannerVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/xml/ValidateMappedCriteriaVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/xml/XMLNodeMappingVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/xml/XMLPlanToProcessVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/xml/XMLPlanner.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/xml/XMLQueryPlanner.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/optimizer/xml/XMLStagaingQueryPlanner.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/parser/SQLParserUtil.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/processor/relational/AccessNode.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/processor/relational/DependentCriteriaProcessor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/processor/relational/DependentValueSource.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/processor/relational/EnhancedSortMergeJoinStrategy.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/processor/relational/JoinNode.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/processor/relational/ProjectIntoNode.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/processor/relational/SortNode.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/processor/relational/UnionAllNode.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/processor/xml/JoinedWhileInstruction.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/processor/xml/XMLContext.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/resolver/command/InsertResolver.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/resolver/command/SimpleQueryResolver.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/resolver/command/XMLQueryResolver.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/resolver/util/ResolverUtil.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/sql/LanguageObject.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/sql/lang/ArrayTable.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/sql/lang/ExistsCriteria.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/sql/lang/FromClause.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/sql/lang/JoinPredicate.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/sql/lang/Select.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/sql/lang/SubqueryFromClause.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/sql/lang/TableFunctionReference.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/sql/lang/TextTable.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/sql/lang/UnaryFromClause.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/sql/lang/XMLTable.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/sql/util/ValueIteratorSource.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/sql/visitor/PredicateCollectorVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/query/util/CommandContext.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/java/org/teiid/security/Credentials.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/main/resources/org/teiid/query/i18n.properties
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestConnectorWorkItem.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestElementImpl.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestGroupImpl.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestInsertImpl.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestMetadataFactory.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/datamgr/TstLanguageBridgeFactory.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/process/TestAuthorizationValidationVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/process/TestCallableStatement.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/process/TestConnectorCapabilitiesFinder.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/process/TestMetaDataProcessor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatement.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedStatementBatchedUpdate.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/process/TestRequest.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/process/TestWorkItemState.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourceElementReplacementVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourceMetadataWrapper.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/function/TestFunctionLibrary.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/function/TestFunctionTree.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/function/TestResolvedFunctions.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/mapping/xml/TestMappingElement.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestAccessPatterns.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestAnsiJoinPushdown.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestBatchedUpdatePlanner.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestDependentJoins.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestExpressionsInGroupBy.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestInlineView.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestJoinOptimization.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestJoinPushdownRestrictions.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestLimit.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestOptimizer.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestOptionalJoins.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestPartitionedJoinPlanning.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestRuleMergeVirtual.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestRuleRaiseNull.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestRuleRemoveSorts.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestSortOptimization.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestStoredProcedurePlanning.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestSubqueryPushdown.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/TestUnionPlanning.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/proc/TestProcedurePlanner.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/relational/TestAliasGenerator.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestCalculateCostUtil.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestCapabilitiesUtil.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestCriteriaCapabilityValidatorVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleAccessPatternValidation.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleAssignOutputElements.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleChooseDependent.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRulePlaceAccess.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRulePushSelectCriteria.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleValidateWhereAll.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/xml/TestMarkExcludeVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/xml/TestNameInSourceResolverVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/xml/TestXMLNodeMappingVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/optimizer/xml/TestXMLPlanner.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/parser/TestOptionsAndHints.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/parser/TestParser.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/FakeDataStore.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/TestAggregateProcessing.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/TestDependentJoins.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/TestInsertProcessing.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/TestJoinWithFunction.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/TestOptionalJoins.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/TestOrderByProcessing.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/TestProcedureRelational.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/TestSecurityFunctions.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/TestSetProcessing.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/TestTempTables.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/TestTextTable.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/TestVirtualDepJoin.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/TestWithClauseProcessing.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/eval/TestExpressionEvaluator.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/proc/TestProcedureProcessor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/relational/TestAccessNode.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/relational/TestBatchedUpdateNode.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/relational/TestGroupingNode.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/relational/TestJoinNode.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/relational/TestProjectNode.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/relational/TestSelectNode.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/xml/TestInstructions.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/xml/TestSourceNodeGenaratorVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/xml/TestXMLPlanningEnhancements.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/processor/xml/TestXMLProcessor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/resolver/TestFunctionResolving.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/resolver/TestProcedureResolving.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/resolver/TestResolver.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/resolver/TestXMLResolver.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/rewriter/TestOrderByRewrite.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/rewriter/TestQueryRewriter.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/sql/util/TestElementSymbolOptimizer.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/sql/visitor/TestEvaluatableVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/sql/visitor/TestSQLStringVisitor.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/unittest/FakeMetadataFacade.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/unittest/FakeMetadataFactory.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/unittest/FakeMetadataObject.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/unittest/FakeMetadataStore.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/validator/TestUpdateValidator.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/java/org/teiid/query/validator/TestValidator.java
tags/teiid-parent-7.5.0.Alpha1/engine/src/test/resources/text/cdm_dos_win.txt
tags/teiid-parent-7.5.0.Alpha1/hibernate-dialect/pom.xml
tags/teiid-parent-7.5.0.Alpha1/jboss-integration/pom.xml
tags/teiid-parent-7.5.0.Alpha1/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
tags/teiid-parent-7.5.0.Alpha1/metadata/pom.xml
tags/teiid-parent-7.5.0.Alpha1/metadata/src/test/java/org/teiid/cdk/api/TranslationUtility.java
tags/teiid-parent-7.5.0.Alpha1/metadata/src/test/java/org/teiid/cdk/unittest/FakeTranslationFactory.java
tags/teiid-parent-7.5.0.Alpha1/pom.xml
tags/teiid-parent-7.5.0.Alpha1/runtime/pom.xml
tags/teiid-parent-7.5.0.Alpha1/runtime/src/main/java/org/teiid/odbc/ODBCClientRemote.java
tags/teiid-parent-7.5.0.Alpha1/runtime/src/main/java/org/teiid/odbc/ODBCServerRemoteImpl.java
tags/teiid-parent-7.5.0.Alpha1/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
tags/teiid-parent-7.5.0.Alpha1/runtime/src/main/java/org/teiid/services/TeiidLoginContext.java
tags/teiid-parent-7.5.0.Alpha1/runtime/src/main/java/org/teiid/transport/LogonImpl.java
tags/teiid-parent-7.5.0.Alpha1/runtime/src/main/java/org/teiid/transport/ODBCSocketListener.java
tags/teiid-parent-7.5.0.Alpha1/runtime/src/main/java/org/teiid/transport/PgBackendProtocol.java
tags/teiid-parent-7.5.0.Alpha1/runtime/src/main/resources/org/teiid/runtime/i18n.properties
tags/teiid-parent-7.5.0.Alpha1/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java
tags/teiid-parent-7.5.0.Alpha1/test-integration/common/pom.xml
tags/teiid-parent-7.5.0.Alpha1/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestCrossSourceStarJoin.java
tags/teiid-parent-7.5.0.Alpha1/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestXMLTypeTranslations.java
tags/teiid-parent-7.5.0.Alpha1/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
tags/teiid-parent-7.5.0.Alpha1/test-integration/common/src/test/java/org/teiid/jdbc/TestLocalConnections.java
tags/teiid-parent-7.5.0.Alpha1/test-integration/common/src/test/java/org/teiid/transport/TestODBCSocketTransport.java
tags/teiid-parent-7.5.0.Alpha1/test-integration/db/pom.xml
tags/teiid-parent-7.5.0.Alpha1/test-integration/pom.xml
Modified:
tags/teiid-parent-7.5.0.Alpha1/metadata/
Log:
[maven-release-plugin] copy for tag teiid-parent-7.5.0.Alpha1
Deleted: tags/teiid-parent-7.5.0.Alpha1/adminshell/pom.xml
===================================================================
--- trunk/adminshell/pom.xml 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/adminshell/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>teiid-parent</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha1-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>teiid-adminshell</artifactId>
- <name>Adminshell</name>
- <description>Adminshell for Teiid</description>
- <dependencies>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <type>test-jar</type>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-client</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy-all</artifactId>
- <version>1.7.2</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.4</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>jline</groupId>
- <artifactId>jline</artifactId>
- <version>0.9.94</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.fusesource.jansi</groupId>
- <artifactId>jansi</artifactId>
- <version>1.2.1</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>commons-cli</groupId>
- <artifactId>commons-cli</artifactId>
- <version>1.2</version>
- <scope>compile</scope>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.5.0.Alpha1/adminshell/pom.xml (from rev 3220, trunk/adminshell/pom.xml)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/adminshell/pom.xml (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/adminshell/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>teiid-parent</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.5.0.Alpha1</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>teiid-adminshell</artifactId>
+ <name>Adminshell</name>
+ <description>Adminshell for Teiid</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <type>test-jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-client</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-all</artifactId>
+ <version>1.7.2</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>jline</groupId>
+ <artifactId>jline</artifactId>
+ <version>0.9.94</version>
+ <scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.fusesource.jansi</groupId>
+ <artifactId>jansi</artifactId>
+ <version>1.2.1</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-cli</groupId>
+ <artifactId>commons-cli</artifactId>
+ <version>1.2</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.5.0.Alpha1/api/pom.xml
===================================================================
--- trunk/api/pom.xml 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/api/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>teiid-parent</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha1-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>teiid-api</artifactId>
- <name>Teiid Translator API</name>
- <description>API for creating Translators and other common extenders in Teiid</description>
-
- <dependencies>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>javax.resource</groupId>
- <artifactId>connector-api</artifactId>
- <scope>provided</scope>
- </dependency>
-
- </dependencies>
-</project>
Copied: tags/teiid-parent-7.5.0.Alpha1/api/pom.xml (from rev 3220, trunk/api/pom.xml)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/api/pom.xml (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/api/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>teiid-parent</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.5.0.Alpha1</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>teiid-api</artifactId>
+ <name>Teiid API</name>
+ <description>API for creating Translators and other extensions to Teiid</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-client</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+</project>
Deleted: tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/CommandContext.java
===================================================================
--- trunk/api/src/main/java/org/teiid/CommandContext.java 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/CommandContext.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -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;
-
-import java.util.Properties;
-import java.util.TimeZone;
-
-import javax.security.auth.Subject;
-
-/**
- * Context information for the currently executing command.
- * Can be used as an argument to UDFs.
- */
-public interface CommandContext {
-
- String getUserName();
-
- String getVdbName();
-
- int getVdbVersion();
-
- String getConnectionID();
-
- Properties getEnvironmentProperties();
-
- double getNextRand();
-
- double getNextRand(long seed);
-
- int getProcessorBatchSize();
-
- TimeZone getServerTimeZone();
-
- Subject getSubject();
-
-}
Copied: tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/CommandContext.java (from rev 3218, trunk/api/src/main/java/org/teiid/CommandContext.java)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/CommandContext.java (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/CommandContext.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -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;
+
+import java.io.Serializable;
+import java.util.Properties;
+import java.util.TimeZone;
+
+import javax.security.auth.Subject;
+
+import org.teiid.adminapi.Session;
+
+/**
+ * Context information for the currently executing command.
+ * Can be used as an argument to UDFs.
+ */
+public interface CommandContext {
+
+ /**
+ * Get the current user name
+ * @return
+ */
+ String getUserName();
+
+ /**
+ * Get the current vdb name
+ * @return
+ */
+ String getVdbName();
+
+ /**
+ * Get the current vdb version
+ * @return
+ */
+ int getVdbVersion();
+
+ /**
+ * Get the connection id
+ * @return
+ */
+ String getConnectionID();
+
+ /**
+ * Get the environment properties. The returned properties are associated only with the currently executing command.
+ * The only built-in key/value in the properties is the key "sessionid" with the same value as getConnectionID()
+ * @return
+ * @deprecated
+ */
+ Properties getEnvironmentProperties();
+
+ /**
+ * Get the next random double value
+ * @return
+ */
+ double getNextRand();
+
+ /**
+ * Sets the seed value and returns the next random double value.
+ * Additional calls to {@link #getNextRand()} will be based upon the seed value.
+ * @param seed
+ * @return
+ */
+ double getNextRand(long seed);
+
+ /**
+ * Get the processor batch size set on the BufferManager
+ * @return
+ */
+ int getProcessorBatchSize();
+
+ /**
+ * Get the server {@link TimeZone}
+ * @return
+ */
+ TimeZone getServerTimeZone();
+
+ /**
+ * Get the current subject
+ * @return
+ */
+ Subject getSubject();
+
+ /**
+ * Get the current session
+ * @return
+ */
+ Session getSession();
+
+ /**
+ * Get the current command payload
+ * @return may be null if the client did not set a payload
+ */
+ Serializable getCommandPayload();
+
+ /**
+ * Get the current request id
+ * @return
+ */
+ String getRequestId();
+
+}
Deleted: tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/logging/AuditMessage.java
===================================================================
--- trunk/api/src/main/java/org/teiid/logging/AuditMessage.java 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/logging/AuditMessage.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -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.logging;
-
-import java.util.Arrays;
-
-/**
- * Log format for auditing.
- */
-public class AuditMessage {
- private String context;
- private String activity;
- private String principal;
- private Object[] resources;
-
- public AuditMessage(String context, String activity, String principal, String[] resources ) {
- this.context = context;
- this.activity = activity;
- this.principal = principal;
- this.resources = resources;
- }
-
- public String getContext() {
- return this.context;
- }
-
- public String getActivity() {
- return this.activity;
- }
-
- public String getPrincipal() {
- return this.principal;
- }
-
- public Object[] getResources() {
- return this.resources;
- }
-
- public String toString() {
- StringBuffer msg = new StringBuffer();
- msg.append(" ["); //$NON-NLS-1$
- msg.append( getPrincipal() );
- msg.append("] <"); //$NON-NLS-1$
- msg.append( getContext() );
- msg.append('.');
- msg.append( getActivity() );
- msg.append("> "); //$NON-NLS-1$
- msg.append( Arrays.toString(resources) );
- return msg.toString();
- }
-
-}
Copied: tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/logging/AuditMessage.java (from rev 3218, trunk/api/src/main/java/org/teiid/logging/AuditMessage.java)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/logging/AuditMessage.java (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/logging/AuditMessage.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -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.logging;
+
+import java.util.Arrays;
+
+import org.teiid.CommandContext;
+
+/**
+ * Log format for auditing.
+ */
+public class AuditMessage {
+ private String context;
+ private String activity;
+ private String[] resources;
+ private CommandContext commandContext;
+
+ public AuditMessage(String context, String activity, String[] resources, CommandContext commandContext) {
+ this.context = context;
+ this.activity = activity;
+ this.resources = resources;
+ this.commandContext = commandContext;
+ }
+
+ public String getContext() {
+ return this.context;
+ }
+
+ public String getActivity() {
+ return this.activity;
+ }
+
+ public String getPrincipal() {
+ return this.commandContext.getUserName();
+ }
+
+ public String[] getResources() {
+ return this.resources;
+ }
+
+ public CommandContext getCommandContext() {
+ return commandContext;
+ }
+
+ public String toString() {
+ StringBuffer msg = new StringBuffer();
+ msg.append( this.commandContext.getRequestId());
+ msg.append(" ["); //$NON-NLS-1$
+ msg.append( getPrincipal() );
+ msg.append("] <"); //$NON-NLS-1$
+ msg.append( getContext() );
+ msg.append('.');
+ msg.append( getActivity() );
+ msg.append("> "); //$NON-NLS-1$
+ msg.append( Arrays.toString(resources) );
+ return msg.toString();
+ }
+
+}
Deleted: tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/logging/LogManager.java
===================================================================
--- trunk/api/src/main/java/org/teiid/logging/LogManager.java 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/logging/LogManager.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,399 +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.logging;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-
-
-
-/**
- * This class represents the interface to a single logging framework
- * that is easily accessible by any component. Using the LogManager, a component
- * can quickly submit a log message, and can rely upon the LogManager to determine
- * (a) whether that message is to be recorded or discarded; and (b) where
- * to send any recorded messages. Thus, the component's code that submits
- * messages does not have to be modified to alter the logging behavior of the
- * application.
- * <p>
- * By default, all context(s) are logged by the LogManager. The messages that
- * the LogManager actually records and sends to the destinations
- * can be controlled using two different and orthogonal parameters.
- * The first is a message <i>level</i> that filters messages based upon detail,
- * and the second is a message <i>context</i> that filters messages based upon
- * origin. The LogManager tracks only those context(s) that should NOT be
- * logged. Only if a message (which also is defined with these two parameters)
- * passes both filters will it be sent to the destinations.
- * <p>
- * Each message is submitted with one of the following levels (determined
- * by the particular method used to submit the message), sorted from the
- * least detailed to the greatest:
- * <li><b>Critical</b>: This level of message is generally
- * used to record an event or error that must be recorded (if any logging
- * is used). If it is used to record an error, it generally means that the
- * system encountered a critical error which affects the integrity, accuracy,
- * reliability and/or capability of the system.</li>
- * <li><b>Error</b>: Error messages are generally used
- * to record unexpected problems, or errors that are not critical in nature
- * and from which the system can automatically recover.</li>
- * <li><b>Warning</b>: Warning messages generally described
- * expected errors from which the system should recover. However, this level
- * is used to record the fact that such an error or event did occur.</li>
- * <li><b>Information</b>: This level of logging is the usually
- * the normal level. All interesting periodic events should be logged at this
- * level so someone looking through the log can see the amount and kind of
- * processing happening in the system.</li>
- * <li><b>Detail</b>: Such messages are moderately detailed,
- * and help to debug typical problems in the system. Generally, these
- * messages are not so detailed that the big picture gets lost.</li>
- * <li><b>Trace</b>: A trace message is the most detailed
- * logging level, used to trace system execution for really nasty problems.
- * At this level, logging will be so verbose that the system performance
- * may be affected.</li>
- * <p>
- * The context for a message is any application-specified String. Again, only
- * those message contexts that match those in the LogManager's configuration will
- * be sent to the destinations.
- *
- */
-public final class LogManager {
-
- public static class LoggingProxy implements InvocationHandler {
- private final Object instance;
- private final String loggingContext;
- private final int level;
-
- public LoggingProxy(Object instance, String loggingContext, int level) {
- this.instance = instance;
- this.loggingContext = loggingContext;
- this.level = level;
- }
-
- public Object invoke(Object proxy,
- Method method,
- Object[] args) throws Throwable {
- boolean log = LogManager.isMessageToBeRecorded(loggingContext, level);
- if (log) {
- StringBuffer message = new StringBuffer();
- message.append("before "); //$NON-NLS-1$
- message.append(method.getName());
- message.append(":"); //$NON-NLS-1$
- message.append(instance);
- message.append("("); //$NON-NLS-1$
- if (args != null) {
- for (int i = 0; i < args.length; i++) {
- if (args[i] != null) {
- message.append(args[i]);
- } else {
- message.append("null"); //$NON-NLS-1$
- }
- if (i != args.length - 1) {
- message.append(","); //$NON-NLS-1$
- }
- }
- }
- message.append(")"); //$NON-NLS-1$
- LogManager.log(level, loggingContext, message.toString());
- }
- try {
- Object result = method.invoke(instance, args);
- if (log) {
- LogManager.log(level, loggingContext,
- "after " + method.getName()+ " : "+result); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return result;
- } catch (InvocationTargetException e) {
- throw e.getTargetException();
- }
- }
- }
-
- static Logger logListener = new JavaLogger(); // either injected or manually set using the set methods
-
- /**
- * Send a critical message to the log. This level of message is generally
- * used to record an event or error that must be recorded (if any logging
- * is used). If it is used to record an error, it generally means that the
- * system encountered a critical error which affects the integrity, accuracy,
- * reliability and/or capability of the system.
- * <p>
- * Only if the log manager is configured to send such messages to the
- * destination will the message be recorded.
- * @param context the context for this log message (for example, the component
- * that is generating this message).
- * @param message the log message; the message is
- * not logged if this parameter is null
- */
- public static void logCritical(String context, String message) {
- logMessage(MessageLevel.CRITICAL, context, message);
- }
-
- /**
- * Send a critical message to the log. This level of message is generally
- * used to record an event or error that must be recorded (if any logging
- * is used). If it is used to record an error, it generally means that the
- * system encountered a critical error which affects the integrity, accuracy,
- * reliability and/or capability of the system.
- * <p>
- * Only if the log manager is configured to send such messages to the
- * destination will the message be recorded.
- * @param context the context for this log message (for example, the component
- * that is generating this message).
- * @param e the exception that is to be logged; the message is
- * not logged if this parameter is null
- * @param message the log message (may be null)
- */
- public static void logCritical(String context, Throwable e, String message) {
- log(MessageLevel.CRITICAL,context,e,message);
- }
-
- /**
- * Send an error message to the log. Error messages are generally used
- * to record unexpected problems, or errors that are not critical in nature
- * and from which the system can automatically recover.
- * <p>
- * Only if the log manager is configured to send such messages to the
- * destination will the message be recorded.
- * @param context the context for this log message (for example, the component
- * that is generating this message).
- * @param message the log message; the message is
- * not logged if this parameter is null
- */
- public static void logError(String context, String message) {
- logMessage(MessageLevel.ERROR, context,message);
- }
-
- /**
- * Send an error message to the log. Error messages are generally used
- * to record unexpected problems, or errors that are not critical in nature
- * and from which the system can automatically recover.
- * <p>
- * Only if the log manager is configured to send such messages to the
- * destination will the message be recorded.
- * @param context the context for this log message (for example, the component
- * that is generating this message).
- * @param e the exception that is to be logged; the message is
- * not logged if this parameter is null
- * @param message the log message (may be null)
- */
- public static void logError(String context, Throwable e, String message) {
- log(MessageLevel.ERROR,context,e,message);
- }
-
- /**
- * Send a warning message to the log. Warning messages generally described
- * expected errors from which the system should recover. However, this level
- * is used to record the fact that such an error or event did occur.
- * <p>
- * Only if the log manager is configured to send such messages to the
- * destination will the message be recorded.
- * @param context the context for this log message (for example, the component
- * that is generating this message).
- * @param message the log message; the message is
- * not logged if this parameter is null
- */
- public static void logWarning(String context, String message) {
- logMessage(MessageLevel.WARNING, context,message);
- }
-
- /**
- * Send a warning message to the log. Warning messages generally described
- * expected errors from which the system should recover. However, this level
- * is used to record the fact that such an error or event did occur.
- * <p>
- * Only if the log manager is configured to send such messages to the
- * destination will the message be recorded.
- * @param context the context for this log message (for example, the component
- * that is generating this message).
- * @param e the exception that is to be logged; the message is
- * not logged if this parameter is null
- * @param message the log message (may be null)
- */
- public static void logWarning(String context, Throwable e, String message) {
- log(MessageLevel.WARNING,context,e,message);
- }
-
- /**
- * Send a information message to the log. This level of logging is the usually
- * the normal level. All interesting periodic events should be logged at this
- * level so someone looking through the log can see the amount and kind of
- * processing happening in the system.
- * <p>
- * Only if the log manager is configured to send such messages to the
- * destination will the message be recorded.
- * @param context the context for this log message (for example, the component
- * that is generating this message).
- * @param message the log message; the message is
- * not logged if this parameter is null
- */
- public static void logInfo(String context, String message) {
- logMessage(MessageLevel.INFO, context,message);
- }
-
- /**
- * Send a detail message to the log. Such messages are moderately detailed,
- * and help to debug typical problems in the system. Generally, these
- * messages are not so detailed that the big picture gets lost.
- * <p>
- * Only if the log manager is configured to send such messages to the
- * destination will the message be recorded.
- * @param context the context for this log message (for example, the component
- * that is generating this message).
- * @param msgParts the individual parts of the log message; the message is
- * not logged if this parameter is null
- */
- public static void logDetail(String context, Object ... msgParts) {
- logMessage(MessageLevel.DETAIL, context, msgParts);
- }
-
- /**
- * Send a detail message to the log. Such messages are moderately detailed,
- * and help to debug typical problems in the system. Generally, these
- * messages are not so detailed that the big picture gets lost.
- * <p>
- * Only if the log manager is configured to send such messages to the
- * destination will the message be recorded.
- * @param context the context for this log message (for example, the component
- * that is generating this message).
- * @param e the exception that is to be logged; the message is
- * not logged if this parameter is null
- * @param message the log message (may be null)
- */
- public static void logDetail(String context, Throwable e, Object ... message) {
- log(MessageLevel.DETAIL,context,e,message);
- }
-
- /**
- * Send a trace message to the log. A trace message is the most detailed
- * logging level, used to trace system execution for really nasty problems.
- * At this level, logging will be so verbose that the system performance
- * may be affected.
- * <p>
- * Only if the log manager is configured to send such messages to the
- * destination will the message be recorded.
- * @param context the context for this log message (for example, the component
- * that is generating this message).
- * @param msgParts the individual parts of the log message; the message is
- * not logged if this parameter is null
- */
- public static void logTrace(String context, Object ... msgParts) {
- logMessage(MessageLevel.TRACE, context, msgParts);
- }
-
- /**
- * Send a trace message to the log. A trace message is the most detailed
- * logging level, used to trace system execution for really nasty problems.
- * At this level, logging will be so verbose that the system performance
- * may be affected.
- * <p>
- * Only if the log manager is configured to send such messages to the
- * destination will the message be recorded.
- * @param context the context for this log message (for example, the component
- * that is generating this message).
- * @param e the exception that is to be logged; the message is
- * not logged if this parameter is null
- * @param msgParts the individual parts of the log message (may be null)
- */
- public static void logTrace(String context, Throwable e, Object ... msgParts) {
- logMessage(MessageLevel.TRACE,context,e,msgParts);
- }
-
- /**
- * Send a message of the specified level to the log.
- * <p>
- * Only if the log manager is configured to send such messages to the
- * destination will the message be recorded.
- * @param msgLevel
- * @param context the context for this log message (for example, the component
- * that is generating this message).
- * @param message the individual parts of the log message; the message is
- * not logged if this parameter is null
- */
- public static void log(int msgLevel, String context, Object message) {
- logMessage(msgLevel, context, message);
- }
-
- /**
- * Send a message of the specified level to the log.
- * <p>
- * Only if the log manager is configured to send such messages to the
- * destination will the message be recorded.
- * @param context the context for this log message (for example, the component
- * that is generating this message).
- * @param e the exception that is to be logged; the message is
- * not logged if this parameter is null
- * @param message the individual parts of the log message; the message is
- * not logged if this parameter is null
- */
- public static void log(int msgLevel, String context, Throwable e, Object message) {
- if (!isMessageToBeRecorded(context, msgLevel)) {
- return;
- }
- logListener.log(msgLevel, context, e, message);
- }
-
- public static void setLogListener(Logger listener) {
- logListener.shutdown();
- if (listener != null) {
- logListener = listener;
- }
- else {
- logListener = new JavaLogger();
- }
- }
-
- /**
- * Utility method to identify whether a log message with the specified
- * context and level will be recorded in the LogManager's destinations.
- * @param context
- * @param msgLevel
- * @return true if the message would be recorded if sent to the LogManager,
- * or false if it would be discarded by the LogManager.
- */
- public static boolean isMessageToBeRecorded(String context, int msgLevel) {
- if (logListener != null) {
- return logListener.isEnabled(context, msgLevel);
- }
- return true;
- }
-
- private static void logMessage(int level, String context, Object ... msgParts) {
- if (msgParts == null || msgParts.length == 0 || !isMessageToBeRecorded(context, level)) {
- return;
- }
- logListener.log(level, context, new LogMessage(msgParts));
- }
-
-
- /**
- * Create a logging proxy, that logs at entry and exit points of the method calls on the provided interfaces.
- */
- public static Object createLoggingProxy(final String loggingContext,
- final Object instance,
- final Class<?>[] interfaces,
- final int level) {
- return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, new LoggingProxy(instance, loggingContext, level));
- }
-}
Copied: tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/logging/LogManager.java (from rev 3218, trunk/api/src/main/java/org/teiid/logging/LogManager.java)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/logging/LogManager.java (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/logging/LogManager.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,402 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License 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.logging;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+
+
+/**
+ * This class represents the interface to a single logging framework
+ * that is easily accessible by any component. Using the LogManager, a component
+ * can quickly submit a log message, and can rely upon the LogManager to determine
+ * (a) whether that message is to be recorded or discarded; and (b) where
+ * to send any recorded messages. Thus, the component's code that submits
+ * messages does not have to be modified to alter the logging behavior of the
+ * application.
+ * <p>
+ * By default, all context(s) are logged by the LogManager. The messages that
+ * the LogManager actually records and sends to the destinations
+ * can be controlled using two different and orthogonal parameters.
+ * The first is a message <i>level</i> that filters messages based upon detail,
+ * and the second is a message <i>context</i> that filters messages based upon
+ * origin. The LogManager tracks only those context(s) that should NOT be
+ * logged. Only if a message (which also is defined with these two parameters)
+ * passes both filters will it be sent to the destinations.
+ * <p>
+ * Each message is submitted with one of the following levels (determined
+ * by the particular method used to submit the message), sorted from the
+ * least detailed to the greatest:
+ * <li><b>Critical</b>: This level of message is generally
+ * used to record an event or error that must be recorded (if any logging
+ * is used). If it is used to record an error, it generally means that the
+ * system encountered a critical error which affects the integrity, accuracy,
+ * reliability and/or capability of the system.</li>
+ * <li><b>Error</b>: Error messages are generally used
+ * to record unexpected problems, or errors that are not critical in nature
+ * and from which the system can automatically recover.</li>
+ * <li><b>Warning</b>: Warning messages generally described
+ * expected errors from which the system should recover. However, this level
+ * is used to record the fact that such an error or event did occur.</li>
+ * <li><b>Information</b>: This level of logging is the usually
+ * the normal level. All interesting periodic events should be logged at this
+ * level so someone looking through the log can see the amount and kind of
+ * processing happening in the system.</li>
+ * <li><b>Detail</b>: Such messages are moderately detailed,
+ * and help to debug typical problems in the system. Generally, these
+ * messages are not so detailed that the big picture gets lost.</li>
+ * <li><b>Trace</b>: A trace message is the most detailed
+ * logging level, used to trace system execution for really nasty problems.
+ * At this level, logging will be so verbose that the system performance
+ * may be affected.</li>
+ * <p>
+ * The context for a message is any application-specified String. Again, only
+ * those message contexts that match those in the LogManager's configuration will
+ * be sent to the destinations.
+ *
+ */
+public final class LogManager {
+
+ public static class LoggingProxy implements InvocationHandler {
+ private final Object instance;
+ private final String loggingContext;
+ private final int level;
+
+ public LoggingProxy(Object instance, String loggingContext, int level) {
+ this.instance = instance;
+ this.loggingContext = loggingContext;
+ this.level = level;
+ }
+
+ public Object invoke(Object proxy,
+ Method method,
+ Object[] args) throws Throwable {
+ boolean log = LogManager.isMessageToBeRecorded(loggingContext, level);
+ if (log) {
+ StringBuffer message = new StringBuffer();
+ message.append("before "); //$NON-NLS-1$
+ message.append(method.getName());
+ message.append(":"); //$NON-NLS-1$
+ message.append(instance);
+ message.append("("); //$NON-NLS-1$
+ if (args != null) {
+ for (int i = 0; i < args.length; i++) {
+ if (args[i] != null) {
+ message.append(args[i]);
+ } else {
+ message.append("null"); //$NON-NLS-1$
+ }
+ if (i != args.length - 1) {
+ message.append(","); //$NON-NLS-1$
+ }
+ }
+ }
+ message.append(")"); //$NON-NLS-1$
+ LogManager.log(level, loggingContext, message.toString());
+ }
+ try {
+ Object result = method.invoke(instance, args);
+ if (log) {
+ LogManager.log(level, loggingContext,
+ "after " + method.getName()+ " : "+result); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return result;
+ } catch (InvocationTargetException e) {
+ throw e.getTargetException();
+ }
+ }
+ }
+
+ static Logger logListener = new JavaLogger(); // either injected or manually set using the set methods
+
+ /**
+ * Send a critical message to the log. This level of message is generally
+ * used to record an event or error that must be recorded (if any logging
+ * is used). If it is used to record an error, it generally means that the
+ * system encountered a critical error which affects the integrity, accuracy,
+ * reliability and/or capability of the system.
+ * <p>
+ * Only if the log manager is configured to send such messages to the
+ * destination will the message be recorded.
+ * @param context the context for this log message (for example, the component
+ * that is generating this message).
+ * @param message the log message; the message is
+ * not logged if this parameter is null
+ */
+ public static void logCritical(String context, String message) {
+ logMessage(MessageLevel.CRITICAL, context, message);
+ }
+
+ /**
+ * Send a critical message to the log. This level of message is generally
+ * used to record an event or error that must be recorded (if any logging
+ * is used). If it is used to record an error, it generally means that the
+ * system encountered a critical error which affects the integrity, accuracy,
+ * reliability and/or capability of the system.
+ * <p>
+ * Only if the log manager is configured to send such messages to the
+ * destination will the message be recorded.
+ * @param context the context for this log message (for example, the component
+ * that is generating this message).
+ * @param e the exception that is to be logged; the message is
+ * not logged if this parameter is null
+ * @param message the log message (may be null)
+ */
+ public static void logCritical(String context, Throwable e, String message) {
+ log(MessageLevel.CRITICAL,context,e,message);
+ }
+
+ /**
+ * Send an error message to the log. Error messages are generally used
+ * to record unexpected problems, or errors that are not critical in nature
+ * and from which the system can automatically recover.
+ * <p>
+ * Only if the log manager is configured to send such messages to the
+ * destination will the message be recorded.
+ * @param context the context for this log message (for example, the component
+ * that is generating this message).
+ * @param message the log message; the message is
+ * not logged if this parameter is null
+ */
+ public static void logError(String context, String message) {
+ logMessage(MessageLevel.ERROR, context,message);
+ }
+
+ /**
+ * Send an error message to the log. Error messages are generally used
+ * to record unexpected problems, or errors that are not critical in nature
+ * and from which the system can automatically recover.
+ * <p>
+ * Only if the log manager is configured to send such messages to the
+ * destination will the message be recorded.
+ * @param context the context for this log message (for example, the component
+ * that is generating this message).
+ * @param e the exception that is to be logged; the message is
+ * not logged if this parameter is null
+ * @param message the log message (may be null)
+ */
+ public static void logError(String context, Throwable e, String message) {
+ log(MessageLevel.ERROR,context,e,message);
+ }
+
+ /**
+ * Send a warning message to the log. Warning messages generally described
+ * expected errors from which the system should recover. However, this level
+ * is used to record the fact that such an error or event did occur.
+ * <p>
+ * Only if the log manager is configured to send such messages to the
+ * destination will the message be recorded.
+ * @param context the context for this log message (for example, the component
+ * that is generating this message).
+ * @param message the log message; the message is
+ * not logged if this parameter is null
+ */
+ public static void logWarning(String context, String message) {
+ logMessage(MessageLevel.WARNING, context,message);
+ }
+
+ /**
+ * Send a warning message to the log. Warning messages generally described
+ * expected errors from which the system should recover. However, this level
+ * is used to record the fact that such an error or event did occur.
+ * <p>
+ * Only if the log manager is configured to send such messages to the
+ * destination will the message be recorded.
+ * @param context the context for this log message (for example, the component
+ * that is generating this message).
+ * @param e the exception that is to be logged; the message is
+ * not logged if this parameter is null
+ * @param message the log message (may be null)
+ */
+ public static void logWarning(String context, Throwable e, String message) {
+ log(MessageLevel.WARNING,context,e,message);
+ }
+
+ /**
+ * Send a information message to the log. This level of logging is the usually
+ * the normal level. All interesting periodic events should be logged at this
+ * level so someone looking through the log can see the amount and kind of
+ * processing happening in the system.
+ * <p>
+ * Only if the log manager is configured to send such messages to the
+ * destination will the message be recorded.
+ * @param context the context for this log message (for example, the component
+ * that is generating this message).
+ * @param message the log message; the message is
+ * not logged if this parameter is null
+ */
+ public static void logInfo(String context, String message) {
+ logMessage(MessageLevel.INFO, context,message);
+ }
+
+ /**
+ * Send a detail message to the log. Such messages are moderately detailed,
+ * and help to debug typical problems in the system. Generally, these
+ * messages are not so detailed that the big picture gets lost.
+ * <p>
+ * Only if the log manager is configured to send such messages to the
+ * destination will the message be recorded.
+ * @param context the context for this log message (for example, the component
+ * that is generating this message).
+ * @param msgParts the individual parts of the log message; the message is
+ * not logged if this parameter is null
+ */
+ public static void logDetail(String context, Object ... msgParts) {
+ logMessage(MessageLevel.DETAIL, context, msgParts);
+ }
+
+ /**
+ * Send a detail message to the log. Such messages are moderately detailed,
+ * and help to debug typical problems in the system. Generally, these
+ * messages are not so detailed that the big picture gets lost.
+ * <p>
+ * Only if the log manager is configured to send such messages to the
+ * destination will the message be recorded.
+ * @param context the context for this log message (for example, the component
+ * that is generating this message).
+ * @param e the exception that is to be logged; the message is
+ * not logged if this parameter is null
+ * @param message the log message (may be null)
+ */
+ public static void logDetail(String context, Throwable e, Object ... message) {
+ log(MessageLevel.DETAIL,context,e,message);
+ }
+
+ /**
+ * Send a trace message to the log. A trace message is the most detailed
+ * logging level, used to trace system execution for really nasty problems.
+ * At this level, logging will be so verbose that the system performance
+ * may be affected.
+ * <p>
+ * Only if the log manager is configured to send such messages to the
+ * destination will the message be recorded.
+ * @param context the context for this log message (for example, the component
+ * that is generating this message).
+ * @param msgParts the individual parts of the log message; the message is
+ * not logged if this parameter is null
+ */
+ public static void logTrace(String context, Object ... msgParts) {
+ logMessage(MessageLevel.TRACE, context, msgParts);
+ }
+
+ /**
+ * Send a trace message to the log. A trace message is the most detailed
+ * logging level, used to trace system execution for really nasty problems.
+ * At this level, logging will be so verbose that the system performance
+ * may be affected.
+ * <p>
+ * Only if the log manager is configured to send such messages to the
+ * destination will the message be recorded.
+ * @param context the context for this log message (for example, the component
+ * that is generating this message).
+ * @param e the exception that is to be logged; the message is
+ * not logged if this parameter is null
+ * @param msgParts the individual parts of the log message (may be null)
+ */
+ public static void logTrace(String context, Throwable e, Object ... msgParts) {
+ logMessage(MessageLevel.TRACE,context,e,msgParts);
+ }
+
+ /**
+ * Send a message of the specified level to the log.
+ * <p>
+ * Only if the log manager is configured to send such messages to the
+ * destination will the message be recorded.
+ * @param msgLevel
+ * @param context the context for this log message (for example, the component
+ * that is generating this message).
+ * @param message the individual parts of the log message; the message is
+ * not logged if this parameter is null
+ */
+ public static void log(int msgLevel, String context, Object message) {
+ logMessage(msgLevel, context, message);
+ }
+
+ /**
+ * Send a message of the specified level to the log.
+ * <p>
+ * Only if the log manager is configured to send such messages to the
+ * destination will the message be recorded.
+ * @param context the context for this log message (for example, the component
+ * that is generating this message).
+ * @param e the exception that is to be logged; the message is
+ * not logged if this parameter is null
+ * @param message the individual parts of the log message; the message is
+ * not logged if this parameter is null
+ */
+ public static void log(int msgLevel, String context, Throwable e, Object message) {
+ if (!isMessageToBeRecorded(context, msgLevel)) {
+ return;
+ }
+ if (message != null && message.getClass().isArray()) {
+ message = new LogMessage((Object[]) message);
+ }
+ logListener.log(msgLevel, context, e, message);
+ }
+
+ public static void setLogListener(Logger listener) {
+ logListener.shutdown();
+ if (listener != null) {
+ logListener = listener;
+ }
+ else {
+ logListener = new JavaLogger();
+ }
+ }
+
+ /**
+ * Utility method to identify whether a log message with the specified
+ * context and level will be recorded in the LogManager's destinations.
+ * @param context
+ * @param msgLevel
+ * @return true if the message would be recorded if sent to the LogManager,
+ * or false if it would be discarded by the LogManager.
+ */
+ public static boolean isMessageToBeRecorded(String context, int msgLevel) {
+ if (logListener != null) {
+ return logListener.isEnabled(context, msgLevel);
+ }
+ return true;
+ }
+
+ private static void logMessage(int level, String context, Object ... msgParts) {
+ if (msgParts == null || msgParts.length == 0 || !isMessageToBeRecorded(context, level)) {
+ return;
+ }
+ logListener.log(level, context, msgParts.length == 1? msgParts[0] : new LogMessage(msgParts));
+ }
+
+
+ /**
+ * Create a logging proxy, that logs at entry and exit points of the method calls on the provided interfaces.
+ */
+ public static Object createLoggingProxy(final String loggingContext,
+ final Object instance,
+ final Class<?>[] interfaces,
+ final int level) {
+ return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, new LoggingProxy(instance, loggingContext, level));
+ }
+}
Deleted: tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/logging/LogMessage.java
===================================================================
--- trunk/api/src/main/java/org/teiid/logging/LogMessage.java 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/logging/LogMessage.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,62 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.logging;
-
-import java.io.Serializable;
-
-
-public class LogMessage implements Serializable{
-
- private Object[] msgParts;
-
- public LogMessage(Object[] msgParts) {
- this.msgParts = msgParts;
- }
-
- public Object[] getMessageParts() {
- return this.msgParts;
- }
-
- public String getText() {
- StringBuffer text = null;
- if(msgParts != null) {
- text = new StringBuffer();
- for(int i=0; i<msgParts.length; i++) {
- if (i>0) text.append(" "); //$NON-NLS-1$
- Object omsg = msgParts[i];
- if ( omsg != null ) {
- text.append(omsg.toString());
- }
- }
- }
-
- if (text == null) {
- return "NULL"; //$NON-NLS-1$
- }
- return text.toString();
- }
-
- public String toString() {
- return getText();
- }
-}
Copied: tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/logging/LogMessage.java (from rev 3218, trunk/api/src/main/java/org/teiid/logging/LogMessage.java)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/logging/LogMessage.java (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/logging/LogMessage.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -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.logging;
+
+import java.io.Serializable;
+
+
+public class LogMessage implements Serializable{
+
+ private static final long serialVersionUID = -134503344442009940L;
+
+ private Object[] msgParts;
+
+ public LogMessage(Object[] msgParts) {
+ this.msgParts = msgParts;
+ }
+
+ public Object[] getMessageParts() {
+ return this.msgParts;
+ }
+
+ public String getText() {
+ StringBuffer text = null;
+ if(msgParts != null) {
+ text = new StringBuffer();
+ for(int i=0; i<msgParts.length; i++) {
+ if (i>0) text.append(" "); //$NON-NLS-1$
+ Object omsg = msgParts[i];
+ if ( omsg != null ) {
+ text.append(omsg.toString());
+ }
+ }
+ }
+
+ if (text == null) {
+ return "NULL"; //$NON-NLS-1$
+ }
+ return text.toString();
+ }
+
+ public String toString() {
+ return getText();
+ }
+}
Deleted: tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/metadata/Table.java
===================================================================
--- trunk/api/src/main/java/org/teiid/metadata/Table.java 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/metadata/Table.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,336 +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.metadata;
-
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.teiid.core.types.DataTypeManager;
-import org.teiid.metadata.AbstractMetadataRecord.DataModifiable;
-import org.teiid.metadata.AbstractMetadataRecord.Modifiable;
-
-public class Table extends ColumnSet<Schema> implements Modifiable, DataModifiable {
-
- private static final long serialVersionUID = 4891356771125218672L;
-
- public enum Type {
- Table,
- View,
- Document,
- XmlMappingClass,
- XmlStagingTable,
- MaterializedTable
- }
-
- public static enum TriggerEvent {
- INSERT,
- UPDATE,
- DELETE
- }
-
- private int cardinality;
- private Type tableType;
- private boolean isVirtual;
- private boolean isSystem;
- private boolean isMaterialized;
- private boolean supportsUpdate;
- private List<ForeignKey> foriegnKeys = new LinkedList<ForeignKey>();
- private List<KeyRecord> indexes = new LinkedList<KeyRecord>();
- private List<KeyRecord> uniqueKeys = new LinkedList<KeyRecord>();
- private List<KeyRecord> accessPatterns = new LinkedList<KeyRecord>();
- private KeyRecord primaryKey;
-
- //view information
- private String selectTransformation;
- private String insertPlan;
- private String updatePlan;
- private String deletePlan;
- private boolean insertPlanEnabled;
- private boolean updatePlanEnabled;
- private boolean deletePlanEnabled;
- private Table materializedStageTable;
- private Table materializedTable;
-
- //XML specific
- private List<String> bindings;
- private List<String> schemaPaths;
- private String resourcePath;
-
- private transient long lastModified;
- private transient long lastDataModification;
-
- public List<String> getBindings() {
- return bindings;
- }
-
- public void setBindings(List<String> bindings) {
- this.bindings = bindings;
- }
-
- public List<String> getSchemaPaths() {
- return schemaPaths;
- }
-
- public void setSchemaPaths(List<String> schemaPaths) {
- this.schemaPaths = schemaPaths;
- }
-
- public int getCardinality() {
- return cardinality;
- }
-
- public boolean isVirtual() {
- return isVirtual;
- }
-
- public boolean isMaterialized() {
- return isMaterialized;
- }
-
- public boolean isPhysical() {
- return !isVirtual();
- }
-
- public boolean isSystem() {
- return isSystem;
- }
-
- public Type getTableType() {
- if (tableType == null) {
- return Type.Table;
- }
- return tableType;
- }
-
- public boolean supportsUpdate() {
- return supportsUpdate;
- }
-
- /**
- * @param i
- */
- public void setCardinality(int i) {
- cardinality = i;
- }
-
- /**
- * @param i
- */
- public void setTableType(Type i) {
- tableType = i;
- }
-
- /**
- * @param b
- */
- public void setSupportsUpdate(boolean b) {
- supportsUpdate = b;
- }
-
- /**
- * @param b
- */
- public void setVirtual(boolean b) {
- isVirtual = b;
- }
-
- /**
- * @param isMaterialized The isMaterialized to set.
- * @since 4.2
- */
- public void setMaterialized(boolean isMaterialized) {
- this.isMaterialized = isMaterialized;
- }
-
- /**
- * @param b
- */
- public void setSystem(boolean b) {
- isSystem = b;
- }
-
- public String getInsertPlan() {
- return insertPlan;
- }
-
- public String getUpdatePlan() {
- return updatePlan;
- }
-
- public String getDeletePlan() {
- return deletePlan;
- }
-
- public void setInsertPlan(String insertPlan) {
- this.insertPlan = DataTypeManager.getCanonicalString(insertPlan);
- this.insertPlanEnabled = true;
- }
-
- public void setUpdatePlan(String updatePlan) {
- this.updatePlan = DataTypeManager.getCanonicalString(updatePlan);
- this.updatePlanEnabled = true;
- }
-
- public void setDeletePlan(String deletePlan) {
- this.deletePlan = DataTypeManager.getCanonicalString(deletePlan);
- this.deletePlanEnabled = true;
- }
-
- public List<ForeignKey> getForeignKeys() {
- return this.foriegnKeys;
- }
-
- public void setForiegnKeys(List<ForeignKey> foriegnKeys) {
- this.foriegnKeys = foriegnKeys;
- }
-
- public List<KeyRecord> getIndexes() {
- return this.indexes;
- }
-
- public void setIndexes(List<KeyRecord> indexes) {
- this.indexes = indexes;
- }
-
- public List<KeyRecord> getUniqueKeys() {
- return this.uniqueKeys;
- }
-
- public void setUniqueKeys(List<KeyRecord> uniqueKeys) {
- this.uniqueKeys = uniqueKeys;
- }
-
- public List<KeyRecord> getAccessPatterns() {
- return this.accessPatterns;
- }
-
- public void setAccessPatterns(List<KeyRecord> accessPatterns) {
- this.accessPatterns = accessPatterns;
- }
-
- public KeyRecord getPrimaryKey() {
- return this.primaryKey;
- }
-
- public void setPrimaryKey(KeyRecord primaryKey) {
- this.primaryKey = primaryKey;
- }
-
- public String getSelectTransformation() {
- return selectTransformation;
- }
-
- public void setSelectTransformation(String selectTransformation) {
- this.selectTransformation = DataTypeManager.getCanonicalString(selectTransformation);
- }
-
- public Table getMaterializedStageTable() {
- return materializedStageTable;
- }
-
- public Table getMaterializedTable() {
- return materializedTable;
- }
-
- public void setMaterializedStageTable(Table materializedStageTable) {
- this.materializedStageTable = materializedStageTable;
- }
-
- public void setMaterializedTable(Table materializedTable) {
- this.materializedTable = materializedTable;
- }
-
- public void setResourcePath(String resourcePath) {
- this.resourcePath = DataTypeManager.getCanonicalString(resourcePath);
- }
-
- public String getResourcePath() {
- return resourcePath;
- }
-
- public Collection<KeyRecord> getAllKeys() {
- Collection<KeyRecord> keys = new LinkedList<KeyRecord>();
- if (getPrimaryKey() != null) {
- keys.add(getPrimaryKey());
- }
- keys.addAll(getForeignKeys());
- keys.addAll(getAccessPatterns());
- keys.addAll(getIndexes());
- keys.addAll(getUniqueKeys());
- return keys;
- }
-
- @Override
- public void addColumn(Column column) {
- super.addColumn(column);
- column.setParent(this);
- }
-
- public long getLastDataModification() {
- return lastDataModification;
- }
-
- public long getLastModified() {
- return lastModified;
- }
-
- public void setLastDataModification(long lastDataModification) {
- this.lastDataModification = lastDataModification;
- }
-
- public void setLastModified(long lastModified) {
- this.lastModified = lastModified;
- }
-
- public void setTableStats(TableStats stats) {
- if (stats.getCardinality() != null) {
- setCardinality(stats.getCardinality());
- }
- }
-
- public boolean isDeletePlanEnabled() {
- return deletePlanEnabled;
- }
-
- public boolean isInsertPlanEnabled() {
- return insertPlanEnabled;
- }
-
- public boolean isUpdatePlanEnabled() {
- return updatePlanEnabled;
- }
-
- public void setInsertPlanEnabled(boolean insertPlanEnabled) {
- this.insertPlanEnabled = insertPlanEnabled;
- }
-
- public void setDeletePlanEnabled(boolean deletePlanEnabled) {
- this.deletePlanEnabled = deletePlanEnabled;
- }
-
- public void setUpdatePlanEnabled(boolean updatePlanEnabled) {
- this.updatePlanEnabled = updatePlanEnabled;
- }
-
-}
\ No newline at end of file
Copied: tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/metadata/Table.java (from rev 3218, trunk/api/src/main/java/org/teiid/metadata/Table.java)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/metadata/Table.java (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/metadata/Table.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,382 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License 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.metadata;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.teiid.core.types.DataTypeManager;
+import org.teiid.metadata.AbstractMetadataRecord.DataModifiable;
+import org.teiid.metadata.AbstractMetadataRecord.Modifiable;
+
+public class Table extends ColumnSet<Schema> implements Modifiable, DataModifiable {
+
+ private static final long serialVersionUID = 4891356771125218672L;
+
+ public enum Type {
+ Table,
+ View,
+ Document,
+ XmlMappingClass,
+ XmlStagingTable,
+ MaterializedTable
+ }
+
+ public static enum TriggerEvent {
+ INSERT,
+ UPDATE,
+ DELETE
+ }
+
+ private int cardinality;
+ private Type tableType;
+ private boolean isVirtual;
+ private boolean isSystem;
+ private boolean isMaterialized;
+ private boolean supportsUpdate;
+ private List<ForeignKey> foriegnKeys = new LinkedList<ForeignKey>();
+ private List<KeyRecord> indexes = new LinkedList<KeyRecord>();
+ private List<KeyRecord> uniqueKeys = new LinkedList<KeyRecord>();
+ private List<KeyRecord> accessPatterns = new LinkedList<KeyRecord>();
+ private KeyRecord primaryKey;
+
+ //view information
+ private String selectTransformation;
+ private String insertPlan;
+ private String updatePlan;
+ private String deletePlan;
+ private boolean insertPlanEnabled;
+ private boolean updatePlanEnabled;
+ private boolean deletePlanEnabled;
+ private Table materializedStageTable;
+ private Table materializedTable;
+
+ //XML specific
+ private List<String> bindings;
+ private List<String> schemaPaths;
+ private String resourcePath;
+
+ private transient long lastModified;
+ private transient long lastDataModification;
+
+ private transient Map<Class<?>, Object> attachments;
+
+ public List<String> getBindings() {
+ return bindings;
+ }
+
+ public void setBindings(List<String> bindings) {
+ this.bindings = bindings;
+ }
+
+ public List<String> getSchemaPaths() {
+ return schemaPaths;
+ }
+
+ public void setSchemaPaths(List<String> schemaPaths) {
+ this.schemaPaths = schemaPaths;
+ }
+
+ public int getCardinality() {
+ return cardinality;
+ }
+
+ public boolean isVirtual() {
+ return isVirtual;
+ }
+
+ public boolean isMaterialized() {
+ return isMaterialized;
+ }
+
+ public boolean isPhysical() {
+ return !isVirtual();
+ }
+
+ public boolean isSystem() {
+ return isSystem;
+ }
+
+ public Type getTableType() {
+ if (tableType == null) {
+ return Type.Table;
+ }
+ return tableType;
+ }
+
+ public boolean supportsUpdate() {
+ return supportsUpdate;
+ }
+
+ /**
+ * @param i
+ */
+ public void setCardinality(int i) {
+ cardinality = i;
+ }
+
+ /**
+ * @param i
+ */
+ public void setTableType(Type i) {
+ tableType = i;
+ }
+
+ /**
+ * @param b
+ */
+ public void setSupportsUpdate(boolean b) {
+ supportsUpdate = b;
+ }
+
+ /**
+ * @param b
+ */
+ public void setVirtual(boolean b) {
+ isVirtual = b;
+ }
+
+ /**
+ * @param isMaterialized The isMaterialized to set.
+ * @since 4.2
+ */
+ public void setMaterialized(boolean isMaterialized) {
+ this.isMaterialized = isMaterialized;
+ }
+
+ /**
+ * @param b
+ */
+ public void setSystem(boolean b) {
+ isSystem = b;
+ }
+
+ public String getInsertPlan() {
+ return insertPlan;
+ }
+
+ public String getUpdatePlan() {
+ return updatePlan;
+ }
+
+ public String getDeletePlan() {
+ return deletePlan;
+ }
+
+ public void setInsertPlan(String insertPlan) {
+ this.insertPlan = DataTypeManager.getCanonicalString(insertPlan);
+ this.insertPlanEnabled = true;
+ }
+
+ public void setUpdatePlan(String updatePlan) {
+ this.updatePlan = DataTypeManager.getCanonicalString(updatePlan);
+ this.updatePlanEnabled = true;
+ }
+
+ public void setDeletePlan(String deletePlan) {
+ this.deletePlan = DataTypeManager.getCanonicalString(deletePlan);
+ this.deletePlanEnabled = true;
+ }
+
+ public List<ForeignKey> getForeignKeys() {
+ return this.foriegnKeys;
+ }
+
+ public void setForiegnKeys(List<ForeignKey> foriegnKeys) {
+ this.foriegnKeys = foriegnKeys;
+ }
+
+ public List<KeyRecord> getIndexes() {
+ return this.indexes;
+ }
+
+ public void setIndexes(List<KeyRecord> indexes) {
+ this.indexes = indexes;
+ }
+
+ public List<KeyRecord> getUniqueKeys() {
+ return this.uniqueKeys;
+ }
+
+ public void setUniqueKeys(List<KeyRecord> uniqueKeys) {
+ this.uniqueKeys = uniqueKeys;
+ }
+
+ public List<KeyRecord> getAccessPatterns() {
+ return this.accessPatterns;
+ }
+
+ public void setAccessPatterns(List<KeyRecord> accessPatterns) {
+ this.accessPatterns = accessPatterns;
+ }
+
+ public KeyRecord getPrimaryKey() {
+ return this.primaryKey;
+ }
+
+ public void setPrimaryKey(KeyRecord primaryKey) {
+ this.primaryKey = primaryKey;
+ }
+
+ public String getSelectTransformation() {
+ return selectTransformation;
+ }
+
+ public void setSelectTransformation(String selectTransformation) {
+ this.selectTransformation = DataTypeManager.getCanonicalString(selectTransformation);
+ }
+
+ public Table getMaterializedStageTable() {
+ return materializedStageTable;
+ }
+
+ public Table getMaterializedTable() {
+ return materializedTable;
+ }
+
+ public void setMaterializedStageTable(Table materializedStageTable) {
+ this.materializedStageTable = materializedStageTable;
+ }
+
+ public void setMaterializedTable(Table materializedTable) {
+ this.materializedTable = materializedTable;
+ }
+
+ public void setResourcePath(String resourcePath) {
+ this.resourcePath = DataTypeManager.getCanonicalString(resourcePath);
+ }
+
+ public String getResourcePath() {
+ return resourcePath;
+ }
+
+ public Collection<KeyRecord> getAllKeys() {
+ Collection<KeyRecord> keys = new LinkedList<KeyRecord>();
+ if (getPrimaryKey() != null) {
+ keys.add(getPrimaryKey());
+ }
+ keys.addAll(getForeignKeys());
+ keys.addAll(getAccessPatterns());
+ keys.addAll(getIndexes());
+ keys.addAll(getUniqueKeys());
+ return keys;
+ }
+
+ @Override
+ public void addColumn(Column column) {
+ super.addColumn(column);
+ column.setParent(this);
+ }
+
+ public long getLastDataModification() {
+ return lastDataModification;
+ }
+
+ public long getLastModified() {
+ return lastModified;
+ }
+
+ public void setLastDataModification(long lastDataModification) {
+ this.lastDataModification = lastDataModification;
+ }
+
+ public void setLastModified(long lastModified) {
+ this.lastModified = lastModified;
+ }
+
+ public void setTableStats(TableStats stats) {
+ if (stats.getCardinality() != null) {
+ setCardinality(stats.getCardinality());
+ }
+ }
+
+ public boolean isDeletePlanEnabled() {
+ return deletePlanEnabled;
+ }
+
+ public boolean isInsertPlanEnabled() {
+ return insertPlanEnabled;
+ }
+
+ public boolean isUpdatePlanEnabled() {
+ return updatePlanEnabled;
+ }
+
+ public void setInsertPlanEnabled(boolean insertPlanEnabled) {
+ this.insertPlanEnabled = insertPlanEnabled;
+ }
+
+ public void setDeletePlanEnabled(boolean deletePlanEnabled) {
+ this.deletePlanEnabled = deletePlanEnabled;
+ }
+
+ public void setUpdatePlanEnabled(boolean updatePlanEnabled) {
+ this.updatePlanEnabled = updatePlanEnabled;
+ }
+
+ /**
+ * Add attachment
+ *
+ * @param <T> the expected type
+ * @param attachment the attachment
+ * @param type the type
+ * @return any previous attachment
+ * @throws IllegalArgumentException for a null name, attachment or type
+ * @throws UnsupportedOperationException when not supported by the implementation
+ */
+ synchronized public <T> T addAttchment(Class<T> type, T attachment) {
+ if (type == null)
+ throw new IllegalArgumentException("Null type"); //$NON-NLS-1$
+ if (this.attachments == null) {
+ this.attachments = new HashMap<Class<?>, Object>();
+ }
+ Object result = this.attachments.put(type, attachment);
+ if (result == null)
+ return null;
+ return type.cast(result);
+ }
+
+ /**
+ * Get attachment
+ *
+ * @param <T> the expected type
+ * @param type the type
+ * @return the attachment or null if not present
+ * @throws IllegalArgumentException for a null name or type
+ */
+ synchronized public <T> T getAttachment(Class<T> type) {
+ if (type == null)
+ throw new IllegalArgumentException("Null type"); //$NON-NLS-1$
+ if (this.attachments == null) {
+ return null;
+ }
+ Object result = this.attachments.get(type.getName());
+ if (result == null)
+ return null;
+ return type.cast(result);
+ }
+
+}
\ No newline at end of file
Deleted: tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/translator/BaseDelegatingExecutionFactory.java
===================================================================
--- trunk/api/src/main/java/org/teiid/translator/BaseDelegatingExecutionFactory.java 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/translator/BaseDelegatingExecutionFactory.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,351 +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.translator;
-
-import java.util.List;
-
-import org.teiid.language.Call;
-import org.teiid.language.Command;
-import org.teiid.language.LanguageFactory;
-import org.teiid.language.QueryExpression;
-import org.teiid.metadata.FunctionMethod;
-import org.teiid.metadata.MetadataFactory;
-import org.teiid.metadata.RuntimeMetadata;
-
-/**
- * Delegate translator. User can define a {@link ExecutionFactory} of their own and have this translator
- * delegate all the calls to that class. Please note that your 'vdb.xml' file will contain
- * an xml fragment like the following to configure a delegating translator.
- * <pre>
- * {@code
- <translator type="delegate" name="my-translator" description="custom translator">
- <property value="delegateName" name="name of the delegate instance"/>
- </translator>
- }
- * </pre>
- *
- */
-public class BaseDelegatingExecutionFactory<F, C> extends ExecutionFactory<F, C> implements DelegatingExecutionFactory<F, C> {
-
- private String delegateName;
- private ExecutionFactory<F, C> delegate;
-
- /**
- * For testing only
- */
- ExecutionFactory<F, C> getDelegate() {
- return this.delegate;
- }
-
- public void setDelegate(ExecutionFactory<F, C> delegate) {
- this.delegate = delegate;
- }
-
- @TranslatorProperty(display="Delegate name", required = true)
- public String getDelegateName() {
- return this.delegateName;
- }
-
- public void setDelegateName(String delegateName) {
- this.delegateName = delegateName;
- }
-
- @Override
- public void start() throws TranslatorException {
- this.delegate.start();
- }
-
- @Override
- public boolean areLobsUsableAfterClose() {
- return delegate.areLobsUsableAfterClose();
- }
- @Override
- public void closeConnection(C connection, F factory) {
- delegate.closeConnection(connection, factory);
- }
- @Override
- public Execution createExecution(Command command,
- ExecutionContext executionContext, RuntimeMetadata metadata,
- C connection) throws TranslatorException {
- return delegate.createExecution(command, executionContext, metadata,
- connection);
- }
- @Override
- public ProcedureExecution createProcedureExecution(Call command,
- ExecutionContext executionContext, RuntimeMetadata metadata,
- C connection) throws TranslatorException {
- return delegate.createProcedureExecution(command, executionContext,
- metadata, connection);
- }
- @Override
- public ResultSetExecution createResultSetExecution(QueryExpression command,
- ExecutionContext executionContext, RuntimeMetadata metadata,
- C connection) throws TranslatorException {
- return delegate.createResultSetExecution(command, executionContext,
- metadata, connection);
- }
- @Override
- public UpdateExecution createUpdateExecution(Command command,
- ExecutionContext executionContext, RuntimeMetadata metadata,
- C connection) throws TranslatorException {
- return delegate.createUpdateExecution(command, executionContext,
- metadata, connection);
- }
- @Override
- public C getConnection(F factory) throws TranslatorException {
- return delegate.getConnection(factory);
- }
- @Override
- public NullOrder getDefaultNullOrder() {
- return delegate.getDefaultNullOrder();
- }
- @Override
- public LanguageFactory getLanguageFactory() {
- return delegate.getLanguageFactory();
- }
- @Override
- public int getMaxFromGroups() {
- return delegate.getMaxFromGroups();
- }
- @Override
- public void getMetadata(MetadataFactory metadataFactory, C conn)
- throws TranslatorException {
- delegate.getMetadata(metadataFactory, conn);
- }
- @Override
- public List<FunctionMethod> getPushDownFunctions() {
- return delegate.getPushDownFunctions();
- }
- @Override
- public List<String> getSupportedFunctions() {
- return delegate.getSupportedFunctions();
- }
- @Override
- public TypeFacility getTypeFacility() {
- return delegate.getTypeFacility();
- }
- @Override
- public boolean isImmutable() {
- return delegate.isImmutable();
- }
- @Override
- public boolean isSourceRequired() {
- return delegate.isSourceRequired();
- }
- @Override
- public boolean supportsAggregatesAvg() {
- return delegate.supportsAggregatesAvg();
- }
- @Override
- public boolean supportsAggregatesCount() {
- return delegate.supportsAggregatesCount();
- }
- @Override
- public boolean supportsAggregatesCountStar() {
- return delegate.supportsAggregatesCountStar();
- }
- @Override
- public boolean supportsAggregatesDistinct() {
- return delegate.supportsAggregatesDistinct();
- }
- @Override
- public boolean supportsAggregatesEnhancedNumeric() {
- return delegate.supportsAggregatesEnhancedNumeric();
- }
- @Override
- public boolean supportsAggregatesMax() {
- return delegate.supportsAggregatesMax();
- }
- @Override
- public boolean supportsAggregatesMin() {
- return delegate.supportsAggregatesMin();
- }
- @Override
- public boolean supportsAggregatesSum() {
- return delegate.supportsAggregatesSum();
- }
- @Override
- public boolean supportsAliasedTable() {
- return delegate.supportsAliasedTable();
- }
- @Override
- public boolean supportsBatchedUpdates() {
- return delegate.supportsBatchedUpdates();
- }
- @Override
- public boolean supportsBetweenCriteria() {
- return delegate.supportsBetweenCriteria();
- }
- @Override
- public boolean supportsBulkUpdate() {
- return delegate.supportsBulkUpdate();
- }
- @Override
- public boolean supportsCaseExpressions() {
- return delegate.supportsCaseExpressions();
- }
- @Override
- public boolean supportsCommonTableExpressions() {
- return delegate.supportsCommonTableExpressions();
- }
- @Override
- public boolean supportsCompareCriteriaEquals() {
- return delegate.supportsCompareCriteriaEquals();
- }
- @Override
- public boolean supportsCompareCriteriaOrdered() {
- return delegate.supportsCompareCriteriaOrdered();
- }
- @Override
- public boolean supportsCorrelatedSubqueries() {
- return delegate.supportsCorrelatedSubqueries();
- }
- @Override
- public boolean supportsExcept() {
- return delegate.supportsExcept();
- }
- @Override
- public boolean supportsExistsCriteria() {
- return delegate.supportsExistsCriteria();
- }
- @Override
- public boolean supportsFunctionsInGroupBy() {
- return delegate.supportsFunctionsInGroupBy();
- }
- @Override
- public boolean supportsGroupBy() {
- return delegate.supportsGroupBy();
- }
- @Override
- public boolean supportsHaving() {
- return delegate.supportsHaving();
- }
- @Override
- public boolean supportsInCriteria() {
- return delegate.supportsInCriteria();
- }
- @Override
- public boolean supportsInCriteriaSubquery() {
- return delegate.supportsInCriteriaSubquery();
- }
- @Override
- public boolean supportsInlineViews() {
- return delegate.supportsInlineViews();
- }
- @Override
- public boolean supportsInsertWithIterator() {
- return delegate.supportsInsertWithIterator();
- }
- @Override
- public boolean supportsInsertWithQueryExpression() {
- return delegate.supportsInsertWithQueryExpression();
- }
- @Override
- public boolean supportsIntersect() {
- return delegate.supportsIntersect();
- }
- @Override
- public boolean supportsIsNullCriteria() {
- return delegate.supportsIsNullCriteria();
- }
- @Override
- public boolean supportsLikeCriteria() {
- return delegate.supportsLikeCriteria();
- }
- @Override
- public boolean supportsLikeCriteriaEscapeCharacter() {
- return delegate.supportsLikeCriteriaEscapeCharacter();
- }
- @Override
- public boolean supportsNotCriteria() {
- return delegate.supportsNotCriteria();
- }
- @Override
- public boolean supportsOrCriteria() {
- return delegate.supportsOrCriteria();
- }
- @Override
- public boolean supportsOrderByNullOrdering() {
- return delegate.supportsOrderByNullOrdering();
- }
- @Override
- public boolean supportsOrderByUnrelated() {
- return delegate.supportsOrderByUnrelated();
- }
- @Override
- public boolean supportsQuantifiedCompareCriteriaAll() {
- return delegate.supportsQuantifiedCompareCriteriaAll();
- }
- @Override
- public boolean supportsQuantifiedCompareCriteriaSome() {
- return delegate.supportsQuantifiedCompareCriteriaSome();
- }
- @Override
- public boolean supportsRowLimit() {
- return delegate.supportsRowLimit();
- }
- @Override
- public boolean supportsRowOffset() {
- return delegate.supportsRowOffset();
- }
- @Override
- public boolean supportsScalarSubqueries() {
- return delegate.supportsScalarSubqueries();
- }
- @Override
- public boolean supportsSearchedCaseExpressions() {
- return delegate.supportsSearchedCaseExpressions();
- }
- @Override
- public boolean supportsSelectExpression() {
- return delegate.supportsSelectExpression();
- }
- @Override
- public boolean supportsSelfJoins() {
- return delegate.supportsSelfJoins();
- }
- @Override
- public boolean supportsSetQueryOrderBy() {
- return delegate.supportsSetQueryOrderBy();
- }
- @Override
- public boolean supportsUnions() {
- return delegate.supportsUnions();
- }
- @Override
- public String toString() {
- return delegate.toString();
- }
- @Override
- public boolean useAnsiJoin() {
- return delegate.useAnsiJoin();
- }
- @Override
- public boolean equals(Object obj) {
- return delegate.equals(obj);
- }
- @Override
- public int hashCode() {
- return delegate.hashCode();
- }
-}
Copied: tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/translator/BaseDelegatingExecutionFactory.java (from rev 3218, trunk/api/src/main/java/org/teiid/translator/BaseDelegatingExecutionFactory.java)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/translator/BaseDelegatingExecutionFactory.java (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/translator/BaseDelegatingExecutionFactory.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,350 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License 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.translator;
+
+import java.util.List;
+
+import org.teiid.language.Call;
+import org.teiid.language.Command;
+import org.teiid.language.LanguageFactory;
+import org.teiid.language.QueryExpression;
+import org.teiid.metadata.FunctionMethod;
+import org.teiid.metadata.MetadataFactory;
+import org.teiid.metadata.RuntimeMetadata;
+
+/**
+ * Delegate translator. User can define a {@link ExecutionFactory} of their own and have this translator
+ * delegate all the calls to that class. Please note that your 'vdb.xml' file will contain
+ * an xml fragment like the following to configure a delegating translator.
+ * <pre>
+ * {@code
+ <translator type="delegate" name="my-translator" description="custom translator">
+ <property value="delegateName" name="name of the delegate instance"/>
+ </translator>
+ }
+ * </pre>
+ *
+ */
+public class BaseDelegatingExecutionFactory<F, C> extends ExecutionFactory<F, C> implements DelegatingExecutionFactory<F, C> {
+
+ private String delegateName;
+ private ExecutionFactory<F, C> delegate;
+
+ /**
+ * For testing only
+ */
+ ExecutionFactory<F, C> getDelegate() {
+ return this.delegate;
+ }
+
+ public void setDelegate(ExecutionFactory<F, C> delegate) {
+ this.delegate = delegate;
+ }
+
+ @TranslatorProperty(display="Delegate name", required = true)
+ public String getDelegateName() {
+ return this.delegateName;
+ }
+
+ public void setDelegateName(String delegateName) {
+ this.delegateName = delegateName;
+ }
+
+ @Override
+ public void start() throws TranslatorException {
+ this.delegate.start();
+ }
+
+ @Override
+ public boolean areLobsUsableAfterClose() {
+ return delegate.areLobsUsableAfterClose();
+ }
+ @Override
+ public void closeConnection(C connection, F factory) {
+ delegate.closeConnection(connection, factory);
+ }
+ @Override
+ public Execution createExecution(Command command,
+ ExecutionContext executionContext, RuntimeMetadata metadata,
+ C connection) throws TranslatorException {
+ return delegate.createExecution(command, executionContext, metadata,
+ connection);
+ }
+ @Override
+ public ProcedureExecution createProcedureExecution(Call command,
+ ExecutionContext executionContext, RuntimeMetadata metadata,
+ C connection) throws TranslatorException {
+ return delegate.createProcedureExecution(command, executionContext,
+ metadata, connection);
+ }
+ @Override
+ public ResultSetExecution createResultSetExecution(QueryExpression command,
+ ExecutionContext executionContext, RuntimeMetadata metadata,
+ C connection) throws TranslatorException {
+ return delegate.createResultSetExecution(command, executionContext,
+ metadata, connection);
+ }
+ @Override
+ public UpdateExecution createUpdateExecution(Command command,
+ ExecutionContext executionContext, RuntimeMetadata metadata,
+ C connection) throws TranslatorException {
+ return delegate.createUpdateExecution(command, executionContext,
+ metadata, connection);
+ }
+ public C getConnection(F factory, ExecutionContext executionContext) throws TranslatorException {
+ return delegate.getConnection(factory, executionContext);
+ }
+ @Override
+ public NullOrder getDefaultNullOrder() {
+ return delegate.getDefaultNullOrder();
+ }
+ @Override
+ public LanguageFactory getLanguageFactory() {
+ return delegate.getLanguageFactory();
+ }
+ @Override
+ public int getMaxFromGroups() {
+ return delegate.getMaxFromGroups();
+ }
+ @Override
+ public void getMetadata(MetadataFactory metadataFactory, C conn)
+ throws TranslatorException {
+ delegate.getMetadata(metadataFactory, conn);
+ }
+ @Override
+ public List<FunctionMethod> getPushDownFunctions() {
+ return delegate.getPushDownFunctions();
+ }
+ @Override
+ public List<String> getSupportedFunctions() {
+ return delegate.getSupportedFunctions();
+ }
+ @Override
+ public TypeFacility getTypeFacility() {
+ return delegate.getTypeFacility();
+ }
+ @Override
+ public boolean isImmutable() {
+ return delegate.isImmutable();
+ }
+ @Override
+ public boolean isSourceRequired() {
+ return delegate.isSourceRequired();
+ }
+ @Override
+ public boolean supportsAggregatesAvg() {
+ return delegate.supportsAggregatesAvg();
+ }
+ @Override
+ public boolean supportsAggregatesCount() {
+ return delegate.supportsAggregatesCount();
+ }
+ @Override
+ public boolean supportsAggregatesCountStar() {
+ return delegate.supportsAggregatesCountStar();
+ }
+ @Override
+ public boolean supportsAggregatesDistinct() {
+ return delegate.supportsAggregatesDistinct();
+ }
+ @Override
+ public boolean supportsAggregatesEnhancedNumeric() {
+ return delegate.supportsAggregatesEnhancedNumeric();
+ }
+ @Override
+ public boolean supportsAggregatesMax() {
+ return delegate.supportsAggregatesMax();
+ }
+ @Override
+ public boolean supportsAggregatesMin() {
+ return delegate.supportsAggregatesMin();
+ }
+ @Override
+ public boolean supportsAggregatesSum() {
+ return delegate.supportsAggregatesSum();
+ }
+ @Override
+ public boolean supportsAliasedTable() {
+ return delegate.supportsAliasedTable();
+ }
+ @Override
+ public boolean supportsBatchedUpdates() {
+ return delegate.supportsBatchedUpdates();
+ }
+ @Override
+ public boolean supportsBetweenCriteria() {
+ return delegate.supportsBetweenCriteria();
+ }
+ @Override
+ public boolean supportsBulkUpdate() {
+ return delegate.supportsBulkUpdate();
+ }
+ @Override
+ public boolean supportsCaseExpressions() {
+ return delegate.supportsCaseExpressions();
+ }
+ @Override
+ public boolean supportsCommonTableExpressions() {
+ return delegate.supportsCommonTableExpressions();
+ }
+ @Override
+ public boolean supportsCompareCriteriaEquals() {
+ return delegate.supportsCompareCriteriaEquals();
+ }
+ @Override
+ public boolean supportsCompareCriteriaOrdered() {
+ return delegate.supportsCompareCriteriaOrdered();
+ }
+ @Override
+ public boolean supportsCorrelatedSubqueries() {
+ return delegate.supportsCorrelatedSubqueries();
+ }
+ @Override
+ public boolean supportsExcept() {
+ return delegate.supportsExcept();
+ }
+ @Override
+ public boolean supportsExistsCriteria() {
+ return delegate.supportsExistsCriteria();
+ }
+ @Override
+ public boolean supportsFunctionsInGroupBy() {
+ return delegate.supportsFunctionsInGroupBy();
+ }
+ @Override
+ public boolean supportsGroupBy() {
+ return delegate.supportsGroupBy();
+ }
+ @Override
+ public boolean supportsHaving() {
+ return delegate.supportsHaving();
+ }
+ @Override
+ public boolean supportsInCriteria() {
+ return delegate.supportsInCriteria();
+ }
+ @Override
+ public boolean supportsInCriteriaSubquery() {
+ return delegate.supportsInCriteriaSubquery();
+ }
+ @Override
+ public boolean supportsInlineViews() {
+ return delegate.supportsInlineViews();
+ }
+ @Override
+ public boolean supportsInsertWithIterator() {
+ return delegate.supportsInsertWithIterator();
+ }
+ @Override
+ public boolean supportsInsertWithQueryExpression() {
+ return delegate.supportsInsertWithQueryExpression();
+ }
+ @Override
+ public boolean supportsIntersect() {
+ return delegate.supportsIntersect();
+ }
+ @Override
+ public boolean supportsIsNullCriteria() {
+ return delegate.supportsIsNullCriteria();
+ }
+ @Override
+ public boolean supportsLikeCriteria() {
+ return delegate.supportsLikeCriteria();
+ }
+ @Override
+ public boolean supportsLikeCriteriaEscapeCharacter() {
+ return delegate.supportsLikeCriteriaEscapeCharacter();
+ }
+ @Override
+ public boolean supportsNotCriteria() {
+ return delegate.supportsNotCriteria();
+ }
+ @Override
+ public boolean supportsOrCriteria() {
+ return delegate.supportsOrCriteria();
+ }
+ @Override
+ public boolean supportsOrderByNullOrdering() {
+ return delegate.supportsOrderByNullOrdering();
+ }
+ @Override
+ public boolean supportsOrderByUnrelated() {
+ return delegate.supportsOrderByUnrelated();
+ }
+ @Override
+ public boolean supportsQuantifiedCompareCriteriaAll() {
+ return delegate.supportsQuantifiedCompareCriteriaAll();
+ }
+ @Override
+ public boolean supportsQuantifiedCompareCriteriaSome() {
+ return delegate.supportsQuantifiedCompareCriteriaSome();
+ }
+ @Override
+ public boolean supportsRowLimit() {
+ return delegate.supportsRowLimit();
+ }
+ @Override
+ public boolean supportsRowOffset() {
+ return delegate.supportsRowOffset();
+ }
+ @Override
+ public boolean supportsScalarSubqueries() {
+ return delegate.supportsScalarSubqueries();
+ }
+ @Override
+ public boolean supportsSearchedCaseExpressions() {
+ return delegate.supportsSearchedCaseExpressions();
+ }
+ @Override
+ public boolean supportsSelectExpression() {
+ return delegate.supportsSelectExpression();
+ }
+ @Override
+ public boolean supportsSelfJoins() {
+ return delegate.supportsSelfJoins();
+ }
+ @Override
+ public boolean supportsSetQueryOrderBy() {
+ return delegate.supportsSetQueryOrderBy();
+ }
+ @Override
+ public boolean supportsUnions() {
+ return delegate.supportsUnions();
+ }
+ @Override
+ public String toString() {
+ return delegate.toString();
+ }
+ @Override
+ public boolean useAnsiJoin() {
+ return delegate.useAnsiJoin();
+ }
+ @Override
+ public boolean equals(Object obj) {
+ return delegate.equals(obj);
+ }
+ @Override
+ public int hashCode() {
+ return delegate.hashCode();
+ }
+}
Deleted: tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/translator/ExecutionContext.java
===================================================================
--- trunk/api/src/main/java/org/teiid/translator/ExecutionContext.java 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/translator/ExecutionContext.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,141 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.translator;
-
-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.
- *
- * As of 4.2, the SecurityContext is a sub-interface of ExecutionContext such
- * that both interfaces contain all of the methods from the prior independent
- * interfaces. Thus, these interfaces can now be used interchangeably.
- *
- */
-public interface ExecutionContext {
-
- /**
- * Get the identifier for the current connector running the command
- * @return Connector identifier; never null
- */
- String getConnectorIdentifier();
-
- /**
- * 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();
-
- /**
- * This specifies the node id for the atomic request in the relational plan of query.
- * when combined with the request identifier, uniquely identifies a command sent to a connector.
- */
- String getPartIdentifier();
-
- /**
- * Execution count defines an id; where every access to the connector from
- * 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.
- */
- String getExecutionCountIdentifier();
-
- /**
- * Get the name of the VDB this query is being run against.
- * @return VDB name, never null
- */
- String getVirtualDatabaseName();
-
- /**
- * Get the version of the VDB this query is being run against.
- * @return VDB version, never null
- */
- int getVirtualDatabaseVersion();
-
- /**
- * Get the user for the user running this query.
- * @return User, never null
- */
- Subject getSubject();
-
- /**
- * Get the trusted payload passed when the user statement was executed.
- * 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>Given that the Execution Payload is not authenticated by the Teiid
- * system, connector writers are responsible for ensuring its validity. </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 Teiid system
- * @return Connection identifier
- */
- String getConnectionIdentifier();
-
- /**
- * When the execution is turned on with "alive=true", the execution object will not
- * be implicitly closed at the end of the last batch. It will only be closed at end
- * of the user query.
- * <p>
- * The engine will already detect situations when the connection should stay open for
- * LOB (clob/blob/xml) streaming.
- * <p>
- * Keeping the execution alive unnecessarily may cause issues with connection usage
- * as the connection instance may not be usable by other queries.
- *
- * @param alive
- */
- void keepExecutionAlive(boolean alive);
-
- /**
- * Return the current connector batch size. This may be used as a hint to the underlying source query.
- * @return the Connector batch size.
- */
- int getBatchSize();
-
- /**
- * Add an exception as a warning to this Execution.
- * @param ex
- */
- void addWarning(Exception ex);
-
- /**
- * Flag indicates that the operation needs to be executed in a XA transaction.
- * @return
- */
- boolean isTransactional();
-}
Copied: tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/translator/ExecutionContext.java (from rev 3218, trunk/api/src/main/java/org/teiid/translator/ExecutionContext.java)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/translator/ExecutionContext.java (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/translator/ExecutionContext.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,149 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License 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.translator;
+
+import java.io.Serializable;
+
+import javax.security.auth.Subject;
+
+import org.teiid.adminapi.Session;
+
+
+
+/**
+ * The security context provides information about the user context in which
+ * this query is being run.
+ *
+ * As of 4.2, the SecurityContext is a sub-interface of ExecutionContext such
+ * that both interfaces contain all of the methods from the prior independent
+ * interfaces. Thus, these interfaces can now be used interchangeably.
+ *
+ */
+public interface ExecutionContext {
+
+ /**
+ * Get the identifier for the current connector running the command
+ * @return Connector identifier; never null
+ */
+ String getConnectorIdentifier();
+
+ /**
+ * 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();
+
+ /**
+ * This specifies the node id for the atomic request in the relational plan of query.
+ * when combined with the request identifier, uniquely identifies a command sent to a connector.
+ */
+ String getPartIdentifier();
+
+ /**
+ * Execution count defines an id; where every access to the connector from
+ * 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.
+ */
+ String getExecutionCountIdentifier();
+
+ /**
+ * Get the name of the VDB this query is being run against.
+ * @return VDB name, never null
+ */
+ String getVirtualDatabaseName();
+
+ /**
+ * Get the version of the VDB this query is being run against.
+ * @return VDB version, never null
+ */
+ int getVirtualDatabaseVersion();
+
+ /**
+ * Get the user for the user running this query.
+ * @return User, never null
+ */
+ Subject getSubject();
+
+ /**
+ * Get the trusted payload passed when the user statement was executed.
+ * 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>Given that the Execution Payload is not authenticated by the Teiid
+ * system, connector writers are responsible for ensuring its validity. </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 Teiid system
+ * @return Connection identifier
+ */
+ String getConnectionIdentifier();
+
+ /**
+ * When the execution is turned on with "alive=true", the execution object will not
+ * be implicitly closed at the end of the last batch. It will only be closed at end
+ * of the user query.
+ * <p>
+ * The engine will already detect situations when the connection should stay open for
+ * LOB (clob/blob/xml) streaming.
+ * <p>
+ * Keeping the execution alive unnecessarily may cause issues with connection usage
+ * as the connection instance may not be usable by other queries.
+ *
+ * @param alive
+ */
+ void keepExecutionAlive(boolean alive);
+
+ /**
+ * Return the current connector batch size. This may be used as a hint to the underlying source query.
+ * @return the Connector batch size.
+ */
+ int getBatchSize();
+
+ /**
+ * Add an exception as a warning to this Execution.
+ * @param ex
+ */
+ void addWarning(Exception ex);
+
+ /**
+ * Flag indicates that the operation needs to be executed in a XA transaction.
+ * @return
+ */
+ boolean isTransactional();
+
+ /**
+ * Get the current session.
+ * @return
+ */
+ Session getSession();
+}
Deleted: tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/translator/ExecutionFactory.java
===================================================================
--- trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/translator/ExecutionFactory.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,824 +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.translator;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.resource.ResourceException;
-import javax.resource.cci.Connection;
-import javax.resource.cci.ConnectionFactory;
-
-import org.teiid.core.TeiidException;
-import org.teiid.core.util.ReflectionHelper;
-import org.teiid.language.BatchedUpdates;
-import org.teiid.language.Call;
-import org.teiid.language.Command;
-import org.teiid.language.LanguageFactory;
-import org.teiid.language.QueryExpression;
-import org.teiid.language.Select;
-import org.teiid.language.SetQuery;
-import org.teiid.logging.LogConstants;
-import org.teiid.logging.LogManager;
-import org.teiid.metadata.FunctionMethod;
-import org.teiid.metadata.MetadataFactory;
-import org.teiid.metadata.RuntimeMetadata;
-
-
-
-/**
- * <p>The primary entry point for a Translator. This class should be extended by the custom translator writer.</p>
- *
- * The deployer instantiates this class through reflection. So it is important to have no-arg constructor. Once constructed
- * the "start" method is called. This class represents the basic capabilities of the translator.
- */
-public class ExecutionFactory<F, C> {
-
- public enum SupportedJoinCriteria {
- /**
- * Indicates that any supported criteria is allowed.
- */
- ANY,
- /**
- * Indicates that any simple comparison of elements is allowed.
- */
- THETA,
- /**
- * Indicates that only equality predicates of elements are allowed.
- */
- EQUI,
- /**
- * Indicates that only equality predicates between
- * exactly one primary and foreign key is allowed per join.
- */
- KEY
- }
-
- public enum NullOrder {
- HIGH,
- LOW,
- FIRST,
- LAST,
- UNKNOWN
- }
-
- public static final int DEFAULT_MAX_FROM_GROUPS = -1;
- public static final int DEFAULT_MAX_IN_CRITERIA_SIZE = -1;
-
- private static final TypeFacility TYPE_FACILITY = new TypeFacility();
-
- /*
- * Managed execution properties
- */
- private boolean immutable;
- private boolean sourceRequired = true;
-
- /*
- * Support properties
- */
- private boolean supportsSelectDistinct;
- private boolean supportsOuterJoins;
- private SupportedJoinCriteria supportedJoinCriteria = SupportedJoinCriteria.ANY;
- private boolean supportsOrderBy;
- private boolean supportsInnerJoins;
- private boolean supportsFullOuterJoins;
- private boolean requiresCriteria;
- private int maxInSize = DEFAULT_MAX_IN_CRITERIA_SIZE;
- private int maxDependentInPredicates = DEFAULT_MAX_IN_CRITERIA_SIZE;
-
- /**
- * Initialize the connector with supplied configuration
- */
- @SuppressWarnings("unused")
- public void start() throws TranslatorException {
- }
-
- /**
- * Defines if the Connector is read-only connector
- * @return
- */
- @TranslatorProperty(display="Is Immutable",description="Is Immutable, True if the source never changes.",advanced=true)
- public boolean isImmutable() {
- return immutable;
- }
-
- public void setImmutable(boolean arg0) {
- this.immutable = arg0;
- }
-
- /**
- * Return a connection object from the given connection factory.
- *
- * The default implementation assumes a JCA {@link ConnectionFactory}. Subclasses should override, if they use
- * another type of connection factory.
- *
- * @param factory
- * @return
- * @throws TranslatorException
- */
- @SuppressWarnings("unchecked")
- public C getConnection(F factory) throws TranslatorException {
- if (factory == null) {
- return null;
- }
- if (factory instanceof ConnectionFactory) {
- try {
- return (C) ((ConnectionFactory)factory).getConnection();
- } catch (ResourceException e) {
- throw new TranslatorException(e);
- }
- }
- throw new AssertionError("A connection factory was supplied, but no implementation was provided getConnection"); //$NON-NLS-1$
- }
-
- /**
- * Closes a connection object from the given connection factory.
- *
- * The default implementation assumes a JCA {@link Connection}. Subclasses should override, if they use
- * another type of connection.
- *
- * @param connection
- * @param factory
- */
- public void closeConnection(C connection, F factory) {
- if (connection == null) {
- return;
- }
- if (connection instanceof Connection) {
- try {
- ((Connection)connection).close();
- } catch (ResourceException e) {
- LogManager.logDetail(LogConstants.CTX_CONNECTOR, e, "Error closing"); //$NON-NLS-1$
- }
- return;
- }
- throw new AssertionError("A connection was created, but no implementation provided for closeConnection"); //$NON-NLS-1$
- }
-
- /**
- * Flag that indicates if a underlying source connection required for this execution factory to work
- * @return
- */
- public boolean isSourceRequired() {
- return sourceRequired;
- }
-
- public void setSourceRequired(boolean value) {
- this.sourceRequired = value;
- }
-
- /**
- * Obtain a reference to the default LanguageFactory that can be used to construct
- * new language interface objects. This is typically needed when modifying the language
- * objects passed to the connector or for testing when objects need to be created.
- */
- public LanguageFactory getLanguageFactory() {
- return LanguageFactory.INSTANCE;
- }
-
- /**
- * Obtain a reference to the type facility, which can be used to perform many type
- * conversions supplied by the Connector API.
- */
- public TypeFacility getTypeFacility() {
- return TYPE_FACILITY;
- }
-
- /**
- * 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 command being executed
- * @param metadata Access to runtime metadata if needed to translate the command
- * @param connection connection factory object to the data source
- * @return An execution object that can use to execute the command
- */
- public Execution createExecution(Command command, ExecutionContext executionContext, RuntimeMetadata metadata, C connection) throws TranslatorException {
- if (command instanceof QueryExpression) {
- return createResultSetExecution((QueryExpression)command, executionContext, metadata, connection);
- }
- if (command instanceof Call) {
- return createProcedureExecution((Call)command, executionContext, metadata, connection);
- }
- return createUpdateExecution(command, executionContext, metadata, connection);
- }
-
- @SuppressWarnings("unused")
- public ResultSetExecution createResultSetExecution(QueryExpression command, ExecutionContext executionContext, RuntimeMetadata metadata, C connection) throws TranslatorException {
- throw new TranslatorException("Unsupported Execution"); //$NON-NLS-1$
- }
-
- @SuppressWarnings("unused")
- public ProcedureExecution createProcedureExecution(Call command, ExecutionContext executionContext, RuntimeMetadata metadata, C connection) throws TranslatorException {
- throw new TranslatorException("Unsupported Execution");//$NON-NLS-1$
- }
-
- @SuppressWarnings("unused")
- public UpdateExecution createUpdateExecution(Command command, ExecutionContext executionContext, RuntimeMetadata metadata, C connection) throws TranslatorException {
- throw new TranslatorException("Unsupported Execution");//$NON-NLS-1$
- }
-
- /**
- * Support indicates connector can accept queries with SELECT DISTINCT
- * @since 3.1 SP2
- */
- @TranslatorProperty(display="Supports Select Distinct", description="True, if this connector supports SELECT DISTINCT", advanced=true)
- public final boolean supportsSelectDistinct() {
- return supportsSelectDistinct;
- }
-
- public void setSupportsSelectDistinct(boolean supportsSelectDistinct) {
- this.supportsSelectDistinct = supportsSelectDistinct;
- }
-
- /**
- * Support indicates connector can accept expressions other than element
- * symbols in the SELECT clause. Specific supports for the expression
- * type are still checked.
- * @since 6.1.0
- */
- public boolean supportsSelectExpression() {
- return false;
- }
-
- /**
- * Support indicates connector can accept groups with aliases
- * @since 3.1 SP2
- */
- public boolean supportsAliasedTable() {
- return false;
- }
-
- /**
- * Get the supported join criteria. A null return value will be treated
- * as {@link SupportedJoinCriteria#ANY}
- * @since 6.1.0
- */
- @TranslatorProperty(display="Supported Join Criteria", description="Returns one of any, theta, equi, or key", advanced=true)
- public final SupportedJoinCriteria getSupportedJoinCriteria() {
- return supportedJoinCriteria;
- }
-
- public void setSupportedJoinCriteria(
- SupportedJoinCriteria supportedJoinCriteria) {
- this.supportedJoinCriteria = supportedJoinCriteria;
- }
-
- /**
- * Support indicates connector can accept inner or cross joins
- * @since 6.1.0
- */
- @TranslatorProperty(display="Supports Inner Joins", description="True, if this connector supports inner joins", advanced=true)
- public final boolean supportsInnerJoins() {
- return supportsInnerJoins;
- }
-
- public void setSupportsInnerJoins(boolean supportsInnerJoins) {
- this.supportsInnerJoins = supportsInnerJoins;
- }
-
- /**
- * Support indicates connector can accept self-joins where a
- * group is joined to itself with aliases. Connector must also support
- * {@link #supportsAliasedTable()}.
- * @since 3.1 SP2
- */
- public boolean supportsSelfJoins() {
- return false;
- }
-
- /**
- * Support indicates connector can accept left outer joins
- * @since 3.1 SP2
- */
- @TranslatorProperty(display="Supports Outer Joins", description="True, if this connector supports outer joins", advanced=true)
- public final boolean supportsOuterJoins() {
- return supportsOuterJoins;
- }
-
- public void setSupportsOuterJoins(boolean supportsOuterJoins) {
- this.supportsOuterJoins = supportsOuterJoins;
- }
-
- /**
- * Support indicates connector can accept full outer joins
- * @since 3.1 SP2
- */
- @TranslatorProperty(display="Supports Full Outer Joins", description="True, if this connector supports full outer joins", advanced=true)
- public final boolean supportsFullOuterJoins() {
- return supportsFullOuterJoins;
- }
-
- public void setSupportsFullOuterJoins(boolean supportsFullOuterJoins) {
- this.supportsFullOuterJoins = supportsFullOuterJoins;
- }
-
- /**
- * Support indicates connector can accept inline views (subqueries
- * in the FROM clause).
- * @since 4.1
- */
- public boolean supportsInlineViews() {
- return false;
- }
-
- /**
- * Support indicates connector accepts criteria of form (element BETWEEN constant AND constant)
- * <br>NOT CURRENTLY USED - between is rewritten as compound compare criteria
- * @since 4.0
- */
- public boolean supportsBetweenCriteria() {
- return false;
- }
-
- /**
- * Support indicates connector accepts criteria of form (element = constant)
- * @since 3.1 SP2
- */
- public boolean supportsCompareCriteriaEquals() {
- return false;
- }
-
- /**
- * Support indicates connector accepts criteria of form (element <=|>= constant)
- * <br>The query engine will may pushdown queries containing < or > if NOT is also
- * supported.
- * @since 3.1 SP2
- */
- public boolean supportsCompareCriteriaOrdered() {
- return false;
- }
-
- /**
- * Support indicates connector accepts criteria of form (element LIKE constant)
- * @since 3.1 SP2
- */
- public boolean supportsLikeCriteria() {
- return false;
- }
-
- /**
- * Support indicates connector accepts criteria of form (element LIKE constant ESCAPE char)
- * @since 3.1 SP2
- */
- public boolean supportsLikeCriteriaEscapeCharacter() {
- return false;
- }
-
- /**
- * Support indicates connector accepts criteria of form (element IN set)
- * @since 3.1 SP2
- */
- public boolean supportsInCriteria() {
- return false;
- }
-
- /**
- * Support indicates connector accepts IN criteria with a subquery on the right side
- * @since 4.0
- */
- public boolean supportsInCriteriaSubquery() {
- return false;
- }
-
- /**
- * Support indicates connector accepts criteria of form (element IS NULL)
- * @since 3.1 SP2
- */
- public boolean supportsIsNullCriteria() {
- return false;
- }
-
- /**
- * Support indicates connector accepts logical criteria connected by OR
- * @since 3.1 SP2
- */
- public boolean supportsOrCriteria() {
- return false;
- }
-
- /**
- * Support indicates connector accepts logical criteria NOT
- * @since 3.1 SP2
- */
- public boolean supportsNotCriteria() {
- return false;
- }
-
- /**
- * Support indicates connector accepts the EXISTS criteria
- * @since 4.0
- */
- public boolean supportsExistsCriteria() {
- return false;
- }
-
- /**
- * Support indicates connector accepts the quantified comparison criteria that
- * use SOME
- * @since 4.0
- */
- public boolean supportsQuantifiedCompareCriteriaSome() {
- return false;
- }
-
- /**
- * Support indicates connector accepts the quantified comparison criteria that
- * use ALL
- * @since 4.0
- */
- public boolean supportsQuantifiedCompareCriteriaAll() {
- return false;
- }
-
- /**
- * Support indicates connector accepts ORDER BY clause, including multiple elements
- * and ascending and descending sorts.
- * @since 3.1 SP2
- */
- @TranslatorProperty(display="Supports ORDER BY", description="True, if this connector supports ORDER BY", advanced=true)
- public final boolean supportsOrderBy() {
- return supportsOrderBy;
- }
-
- public void setSupportsOrderBy(boolean supportsOrderBy) {
- this.supportsOrderBy = supportsOrderBy;
- }
-
- /**
- * Support indicates connector accepts ORDER BY clause with columns not from the select
- * @since 6.2
- * @return
- */
- public boolean supportsOrderByUnrelated() {
- return false;
- }
-
- /**
- * Returns the default null ordering
- * @since 7.1
- * @return the {@link NullOrder}
- */
- public NullOrder getDefaultNullOrder() {
- return NullOrder.UNKNOWN;
- }
-
- /**
- * Returns whether the database supports explicit join ordering.
- * @since 7.1
- * @return true if nulls first/last can be specified
- */
- public boolean supportsOrderByNullOrdering() {
- return false;
- }
-
- /**
- * Whether the source supports an explicit GROUP BY clause
- * @since 6.1
- */
- public boolean supportsGroupBy() {
- return false;
- }
-
- /**
- * Whether the source supports the HAVING clause
- * @since 6.1
- */
- public boolean supportsHaving() {
- return false;
- }
-
- /**
- * Support indicates connector can accept the SUM aggregate function
- * @since 3.1 SP2
- */
- public boolean supportsAggregatesSum() {
- return false;
- }
-
- /**
- * Support indicates connector can accept the AVG aggregate function
- * @since 3.1 SP2
- */
- public boolean supportsAggregatesAvg() {
- return false;
- }
-
- /**
- * Support indicates connector can accept the MIN aggregate function
- * @since 3.1 SP2
- */
- public boolean supportsAggregatesMin() {
- return false;
- }
-
- /**
- * Support indicates connector can accept the MAX aggregate function
- * @since 3.1 SP2
- */
- public boolean supportsAggregatesMax() {
- return false;
- }
-
- /**
- * Support indicates connector can accept the COUNT aggregate function
- * @since 3.1 SP2
- */
- public boolean supportsAggregatesCount() {
- return false;
- }
-
- /**
- * Support indicates connector can accept the COUNT(*) aggregate function
- * @since 3.1 SP2
- */
- public boolean supportsAggregatesCountStar() {
- return false;
- }
-
- /**
- * Support indicates connector can accept DISTINCT within aggregate functions
- * @since 3.1 SP2
- */
- public boolean supportsAggregatesDistinct() {
- return false;
- }
-
- /**
- * Support indicates connector can accept STDDEV_POP, STDDEV_VAR, VAR_POP, VAR_SAMP
- * @since 7.1
- */
- public boolean supportsAggregatesEnhancedNumeric() {
- return false;
- }
-
- /**
- * Support indicates connector can accept scalar subqueries in the SELECT, WHERE, and
- * HAVING clauses
- * @since 4.0
- */
- public boolean supportsScalarSubqueries() {
- return false;
- }
-
- /**
- * Support indicates connector can accept correlated subqueries wherever subqueries
- * are accepted
- * @since 4.0
- */
- public boolean supportsCorrelatedSubqueries() {
- return false;
- }
-
- /**
- * Support indicates connector can accept queries with non-searched
- * CASE <expression> WHEN <expression> ... END
- * <br>NOT CURRENTLY USED - case is pushed down as searched case
- * @since 4.0
- */
- public boolean supportsCaseExpressions() {
- return false;
- }
-
- /**
- * Support indicates connector can accept queries with searched CASE WHEN <criteria> ... END
- * @since 4.0
- */
- public boolean supportsSearchedCaseExpressions() {
- return false;
- }
-
- /**
- * Support indicates that the connector supports the UNION of two queries.
- * @since 4.2
- */
- public boolean supportsUnions() {
- return false;
- }
-
- /**
- * Support indicates that the connector supports an ORDER BY on a SetQuery.
- * @since 5.6
- */
- public boolean supportsSetQueryOrderBy() {
- return false;
- }
-
- /**
- * Support indicates that the connector supports the INTERSECT of two queries.
- * @since 5.6
- */
- public boolean supportsIntersect() {
- return false;
- }
-
- /**
- * Support indicates that the connector supports the EXCEPT of two queries.
- * @since 5.6
- */
- public boolean supportsExcept() {
- return false;
- }
-
- /**
- * Get list of all supported function names. Arithmetic functions have names like
- * "+".
- * @since 3.1 SP3
- */
- public List<String> getSupportedFunctions() {
- return null;
- }
-
- public List<FunctionMethod> getPushDownFunctions(){
- return Collections.emptyList();
- }
-
- /**
- * Get the integer value representing the number of values allowed in an IN criteria
- * in the WHERE clause of a query
- * @since 5.0
- */
- @TranslatorProperty(display="Max number of IN predicate entries", advanced=true)
- public final int getMaxInCriteriaSize() {
- return maxInSize;
- }
-
- public void setMaxInCriteriaSize(int maxInSize) {
- this.maxInSize = maxInSize;
- }
-
- /**
- * Get the integer value representing the number of values allowed in an IN criteria
- * in the WHERE clause of a query
- * @since 5.0
- */
- @TranslatorProperty(display="Max number of dependent values across all IN predicates", advanced=true)
- public int getMaxDependentInPredicates() {
- return maxDependentInPredicates;
- }
-
- public void setMaxDependentInPredicates(int maxDependentInPredicates) {
- this.maxDependentInPredicates = maxDependentInPredicates;
- }
-
- /**
- * <p>Support indicates that the connector supports functions in GROUP BY, such as:
- * <code>SELECT dayofmonth(theDate), COUNT(*) FROM table GROUP BY dayofmonth(theDate)</code></p>
- *
- * <br>NOT CURRENTLY USED - group by expressions create an inline view for pushdown
- * @since 5.0
- */
- public boolean supportsFunctionsInGroupBy() {
- return false;
- }
-
- /**
- * Gets whether the connector can limit the number of rows returned by a query.
- * @since 5.0 SP1
- */
- public boolean supportsRowLimit() {
- return false;
- }
-
- /**
- * Gets whether the connector supports a SQL clause (similar to the LIMIT with an offset) that can return
- * result sets that start in the middle of the resulting rows returned by a query
- * @since 5.0 SP1
- */
- public boolean supportsRowOffset() {
- return false;
- }
-
- /**
- * The number of groups supported in the from clause. Added for a Sybase limitation.
- * @since 5.6
- * @return the number of groups supported in the from clause, or -1 if there is no limit
- */
- public int getMaxFromGroups() {
- return DEFAULT_MAX_FROM_GROUPS;
- }
-
- /**
- * Whether the source prefers to use ANSI style joins.
- * @since 6.0
- */
- public boolean useAnsiJoin() {
- return false;
- }
-
- /**
- * Whether the source supports queries without criteria.
- * @since 6.0
- */
- @TranslatorProperty(display="Requries Criteria", description="True, if this connector requires criteria on source queries", advanced=true)
- public final boolean requiresCriteria() {
- return requiresCriteria;
- }
-
- public void setRequiresCriteria(boolean requiresCriteria) {
- this.requiresCriteria = requiresCriteria;
- }
-
- /**
- * Whether the source supports {@link BatchedUpdates}
- * @since 6.0
- */
- public boolean supportsBatchedUpdates() {
- return false;
- }
-
- /**
- * Whether the source supports updates with multiple value sets
- * @since 6.0
- */
- public boolean supportsBulkUpdate() {
- return false;
- }
-
- /**
- * Support indicates that the connector can accept INSERTs with
- * values specified by a {@link SetQuery} or {@link Select}
- * @since 6.1
- */
- public boolean supportsInsertWithQueryExpression() {
- return false;
- }
-
- /**
- * Support indicates that the connector can accept INSERTs
- * with values specified by an {@link Iterator}
- * @since 7.1
- * @return
- */
- public boolean supportsInsertWithIterator() {
- return false;
- }
-
- public static <T> T getInstance(Class<T> expectedType, String className, Collection<?> ctorObjs, Class<? extends T> defaultClass) throws TranslatorException {
- try {
- if (className == null) {
- if (defaultClass == null) {
- throw new TranslatorException("Neither class name nor default class specified to create an instance"); //$NON-NLS-1$
- }
- return expectedType.cast(defaultClass.newInstance());
- }
- return expectedType.cast(ReflectionHelper.create(className, ctorObjs, Thread.currentThread().getContextClassLoader()));
- } catch (TeiidException e) {
- throw new TranslatorException(e);
- } catch (IllegalAccessException e) {
- throw new TranslatorException(e);
- } catch(InstantiationException e) {
- throw new TranslatorException(e);
- }
- }
-
- /**
- * Implement to provide metadata to the metadata for use by the engine. This is the
- * primary method of creating metadata for dynamic VDBs.
- * @param metadataFactory
- * @param conn
- * @throws TranslatorException
- */
- public void getMetadata(MetadataFactory metadataFactory, C conn) throws TranslatorException {
-
- }
-
- /**
- * Indicates if LOBs are usable after the execution is closed.
- * @return true if LOBs can be used after close
- * @since 7.2
- */
- public boolean areLobsUsableAfterClose() {
- return false;
- }
-
- /**
- * @return true if the WITH clause is supported
- * @since 7.2
- */
- public boolean supportsCommonTableExpressions() {
- return false;
- }
-}
Copied: tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/translator/ExecutionFactory.java (from rev 3218, trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/translator/ExecutionFactory.java (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/api/src/main/java/org/teiid/translator/ExecutionFactory.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,864 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License 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.translator;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.resource.ResourceException;
+import javax.resource.cci.Connection;
+import javax.resource.cci.ConnectionFactory;
+
+import org.teiid.core.TeiidException;
+import org.teiid.core.util.ReflectionHelper;
+import org.teiid.language.BatchedUpdates;
+import org.teiid.language.Call;
+import org.teiid.language.Command;
+import org.teiid.language.LanguageFactory;
+import org.teiid.language.QueryExpression;
+import org.teiid.language.Select;
+import org.teiid.language.SetQuery;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.metadata.FunctionMethod;
+import org.teiid.metadata.FunctionParameter;
+import org.teiid.metadata.MetadataFactory;
+import org.teiid.metadata.RuntimeMetadata;
+
+
+
+/**
+ * <p>The primary entry point for a Translator. This class should be extended by the custom translator writer.</p>
+ *
+ * The deployer instantiates this class through reflection. So it is important to have no-arg constructor. Once constructed
+ * the "start" method is called. This class represents the basic capabilities of the translator.
+ */
+public class ExecutionFactory<F, C> {
+
+ public enum SupportedJoinCriteria {
+ /**
+ * Indicates that any supported criteria is allowed.
+ */
+ ANY,
+ /**
+ * Indicates that any simple comparison of elements is allowed.
+ */
+ THETA,
+ /**
+ * Indicates that only equality predicates of elements are allowed.
+ */
+ EQUI,
+ /**
+ * Indicates that only equality predicates between
+ * exactly one primary and foreign key is allowed per join.
+ */
+ KEY
+ }
+
+ public enum NullOrder {
+ HIGH,
+ LOW,
+ FIRST,
+ LAST,
+ UNKNOWN
+ }
+
+ public static final int DEFAULT_MAX_FROM_GROUPS = -1;
+ public static final int DEFAULT_MAX_IN_CRITERIA_SIZE = -1;
+
+ private static final TypeFacility TYPE_FACILITY = new TypeFacility();
+
+ /*
+ * Managed execution properties
+ */
+ private boolean immutable;
+ private boolean sourceRequired = true;
+
+ /*
+ * Support properties
+ */
+ private boolean supportsSelectDistinct;
+ private boolean supportsOuterJoins;
+ private SupportedJoinCriteria supportedJoinCriteria = SupportedJoinCriteria.ANY;
+ private boolean supportsOrderBy;
+ private boolean supportsInnerJoins;
+ private boolean supportsFullOuterJoins;
+ private boolean requiresCriteria;
+ private int maxInSize = DEFAULT_MAX_IN_CRITERIA_SIZE;
+ private int maxDependentInPredicates = DEFAULT_MAX_IN_CRITERIA_SIZE;
+
+ private LinkedList<FunctionMethod> pushdownFunctionMethods = new LinkedList<FunctionMethod>();
+
+ /**
+ * Initialize the connector with supplied configuration
+ */
+ @SuppressWarnings("unused")
+ public void start() throws TranslatorException {
+ }
+
+ /**
+ * Defines if the Connector is read-only connector
+ * @return
+ */
+ @TranslatorProperty(display="Is Immutable",description="Is Immutable, True if the source never changes.",advanced=true)
+ public boolean isImmutable() {
+ return immutable;
+ }
+
+ public void setImmutable(boolean arg0) {
+ this.immutable = arg0;
+ }
+
+ /**
+ * Return a connection object from the given connection factory.
+ *
+ * The default implementation assumes a JCA {@link ConnectionFactory}. Subclasses should override, if they use
+ * another type of connection factory.
+ *
+ * @deprecated
+ * @see #getConnection(Object, ExecutionContext)
+ * @param factory
+ * @return a connection
+ * @throws TranslatorException
+ */
+ @SuppressWarnings("unchecked")
+ public C getConnection(F factory) throws TranslatorException {
+ if (factory == null) {
+ return null;
+ }
+ if (factory instanceof ConnectionFactory) {
+ try {
+ return (C) ((ConnectionFactory)factory).getConnection();
+ } catch (ResourceException e) {
+ throw new TranslatorException(e);
+ }
+ }
+ throw new AssertionError("A connection factory was supplied, but no implementation was provided getConnection"); //$NON-NLS-1$
+ }
+
+ /**
+ * Return a connection object from the given connection factory.
+ *
+ * The default implementation assumes a JCA {@link ConnectionFactory}. Subclasses should override, if they use
+ * another type of connection factory or wish to use the {@link ExecutionContext}. By default calls {@link #getConnection(Object)}
+ *
+ * @param factory
+ * @param executionContext null if this is a system request for a connection
+ * @return a connection
+ * @throws TranslatorException
+ */
+ public C getConnection(F factory,
+ ExecutionContext executionContext) throws TranslatorException {
+ return getConnection(factory);
+ }
+
+ /**
+ * Closes a connection object from the given connection factory.
+ *
+ * The default implementation assumes a JCA {@link Connection}. Subclasses should override, if they use
+ * another type of connection.
+ *
+ * @param connection
+ * @param factory
+ */
+ public void closeConnection(C connection, F factory) {
+ if (connection == null) {
+ return;
+ }
+ if (connection instanceof Connection) {
+ try {
+ ((Connection)connection).close();
+ } catch (ResourceException e) {
+ LogManager.logDetail(LogConstants.CTX_CONNECTOR, e, "Error closing"); //$NON-NLS-1$
+ }
+ return;
+ }
+ throw new AssertionError("A connection was created, but no implementation provided for closeConnection"); //$NON-NLS-1$
+ }
+
+ /**
+ * Flag that indicates if a underlying source connection required for this execution factory to work
+ * @return
+ */
+ public boolean isSourceRequired() {
+ return sourceRequired;
+ }
+
+ public void setSourceRequired(boolean value) {
+ this.sourceRequired = value;
+ }
+
+ /**
+ * Obtain a reference to the default LanguageFactory that can be used to construct
+ * new language interface objects. This is typically needed when modifying the language
+ * objects passed to the connector or for testing when objects need to be created.
+ */
+ public LanguageFactory getLanguageFactory() {
+ return LanguageFactory.INSTANCE;
+ }
+
+ /**
+ * Obtain a reference to the type facility, which can be used to perform many type
+ * conversions supplied by the Connector API.
+ */
+ public TypeFacility getTypeFacility() {
+ return TYPE_FACILITY;
+ }
+
+ /**
+ * 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 command being executed
+ * @param metadata Access to runtime metadata if needed to translate the command
+ * @param connection connection factory object to the data source
+ * @return An execution object that can use to execute the command
+ */
+ public Execution createExecution(Command command, ExecutionContext executionContext, RuntimeMetadata metadata, C connection) throws TranslatorException {
+ if (command instanceof QueryExpression) {
+ return createResultSetExecution((QueryExpression)command, executionContext, metadata, connection);
+ }
+ if (command instanceof Call) {
+ return createProcedureExecution((Call)command, executionContext, metadata, connection);
+ }
+ return createUpdateExecution(command, executionContext, metadata, connection);
+ }
+
+ @SuppressWarnings("unused")
+ public ResultSetExecution createResultSetExecution(QueryExpression command, ExecutionContext executionContext, RuntimeMetadata metadata, C connection) throws TranslatorException {
+ throw new TranslatorException("Unsupported Execution"); //$NON-NLS-1$
+ }
+
+ @SuppressWarnings("unused")
+ public ProcedureExecution createProcedureExecution(Call command, ExecutionContext executionContext, RuntimeMetadata metadata, C connection) throws TranslatorException {
+ throw new TranslatorException("Unsupported Execution");//$NON-NLS-1$
+ }
+
+ @SuppressWarnings("unused")
+ public UpdateExecution createUpdateExecution(Command command, ExecutionContext executionContext, RuntimeMetadata metadata, C connection) throws TranslatorException {
+ throw new TranslatorException("Unsupported Execution");//$NON-NLS-1$
+ }
+
+ /**
+ * Support indicates connector can accept queries with SELECT DISTINCT
+ * @since 3.1 SP2
+ */
+ @TranslatorProperty(display="Supports Select Distinct", description="True, if this connector supports SELECT DISTINCT", advanced=true)
+ public final boolean supportsSelectDistinct() {
+ return supportsSelectDistinct;
+ }
+
+ public void setSupportsSelectDistinct(boolean supportsSelectDistinct) {
+ this.supportsSelectDistinct = supportsSelectDistinct;
+ }
+
+ /**
+ * Support indicates connector can accept expressions other than element
+ * symbols in the SELECT clause. Specific supports for the expression
+ * type are still checked.
+ * @since 6.1.0
+ */
+ public boolean supportsSelectExpression() {
+ return false;
+ }
+
+ /**
+ * Support indicates connector can accept groups with aliases
+ * @since 3.1 SP2
+ */
+ public boolean supportsAliasedTable() {
+ return false;
+ }
+
+ /**
+ * Get the supported join criteria. A null return value will be treated
+ * as {@link SupportedJoinCriteria#ANY}
+ * @since 6.1.0
+ */
+ @TranslatorProperty(display="Supported Join Criteria", description="Returns one of any, theta, equi, or key", advanced=true)
+ public final SupportedJoinCriteria getSupportedJoinCriteria() {
+ return supportedJoinCriteria;
+ }
+
+ public void setSupportedJoinCriteria(
+ SupportedJoinCriteria supportedJoinCriteria) {
+ this.supportedJoinCriteria = supportedJoinCriteria;
+ }
+
+ /**
+ * Support indicates connector can accept inner or cross joins
+ * @since 6.1.0
+ */
+ @TranslatorProperty(display="Supports Inner Joins", description="True, if this connector supports inner joins", advanced=true)
+ public final boolean supportsInnerJoins() {
+ return supportsInnerJoins;
+ }
+
+ public void setSupportsInnerJoins(boolean supportsInnerJoins) {
+ this.supportsInnerJoins = supportsInnerJoins;
+ }
+
+ /**
+ * Support indicates connector can accept self-joins where a
+ * group is joined to itself with aliases. Connector must also support
+ * {@link #supportsAliasedTable()}.
+ * @since 3.1 SP2
+ */
+ public boolean supportsSelfJoins() {
+ return false;
+ }
+
+ /**
+ * Support indicates connector can accept left outer joins
+ * @since 3.1 SP2
+ */
+ @TranslatorProperty(display="Supports Outer Joins", description="True, if this connector supports outer joins", advanced=true)
+ public final boolean supportsOuterJoins() {
+ return supportsOuterJoins;
+ }
+
+ public void setSupportsOuterJoins(boolean supportsOuterJoins) {
+ this.supportsOuterJoins = supportsOuterJoins;
+ }
+
+ /**
+ * Support indicates connector can accept full outer joins
+ * @since 3.1 SP2
+ */
+ @TranslatorProperty(display="Supports Full Outer Joins", description="True, if this connector supports full outer joins", advanced=true)
+ public final boolean supportsFullOuterJoins() {
+ return supportsFullOuterJoins;
+ }
+
+ public void setSupportsFullOuterJoins(boolean supportsFullOuterJoins) {
+ this.supportsFullOuterJoins = supportsFullOuterJoins;
+ }
+
+ /**
+ * Support indicates connector can accept inline views (subqueries
+ * in the FROM clause).
+ * @since 4.1
+ */
+ public boolean supportsInlineViews() {
+ return false;
+ }
+
+ /**
+ * Support indicates connector accepts criteria of form (element BETWEEN constant AND constant)
+ * <br>NOT CURRENTLY USED - between is rewritten as compound compare criteria
+ * @since 4.0
+ */
+ public boolean supportsBetweenCriteria() {
+ return false;
+ }
+
+ /**
+ * Support indicates connector accepts criteria of form (element = constant)
+ * @since 3.1 SP2
+ */
+ public boolean supportsCompareCriteriaEquals() {
+ return false;
+ }
+
+ /**
+ * Support indicates connector accepts criteria of form (element <=|>= constant)
+ * <br>The query engine will may pushdown queries containing < or > if NOT is also
+ * supported.
+ * @since 3.1 SP2
+ */
+ public boolean supportsCompareCriteriaOrdered() {
+ return false;
+ }
+
+ /**
+ * Support indicates connector accepts criteria of form (element LIKE constant)
+ * @since 3.1 SP2
+ */
+ public boolean supportsLikeCriteria() {
+ return false;
+ }
+
+ /**
+ * Support indicates connector accepts criteria of form (element LIKE constant ESCAPE char)
+ * @since 3.1 SP2
+ */
+ public boolean supportsLikeCriteriaEscapeCharacter() {
+ return false;
+ }
+
+ /**
+ * Support indicates connector accepts criteria of form (element IN set)
+ * @since 3.1 SP2
+ */
+ public boolean supportsInCriteria() {
+ return false;
+ }
+
+ /**
+ * Support indicates connector accepts IN criteria with a subquery on the right side
+ * @since 4.0
+ */
+ public boolean supportsInCriteriaSubquery() {
+ return false;
+ }
+
+ /**
+ * Support indicates connector accepts criteria of form (element IS NULL)
+ * @since 3.1 SP2
+ */
+ public boolean supportsIsNullCriteria() {
+ return false;
+ }
+
+ /**
+ * Support indicates connector accepts logical criteria connected by OR
+ * @since 3.1 SP2
+ */
+ public boolean supportsOrCriteria() {
+ return false;
+ }
+
+ /**
+ * Support indicates connector accepts logical criteria NOT
+ * @since 3.1 SP2
+ */
+ public boolean supportsNotCriteria() {
+ return false;
+ }
+
+ /**
+ * Support indicates connector accepts the EXISTS criteria
+ * @since 4.0
+ */
+ public boolean supportsExistsCriteria() {
+ return false;
+ }
+
+ /**
+ * Support indicates connector accepts the quantified comparison criteria that
+ * use SOME
+ * @since 4.0
+ */
+ public boolean supportsQuantifiedCompareCriteriaSome() {
+ return false;
+ }
+
+ /**
+ * Support indicates connector accepts the quantified comparison criteria that
+ * use ALL
+ * @since 4.0
+ */
+ public boolean supportsQuantifiedCompareCriteriaAll() {
+ return false;
+ }
+
+ /**
+ * Support indicates connector accepts ORDER BY clause, including multiple elements
+ * and ascending and descending sorts.
+ * @since 3.1 SP2
+ */
+ @TranslatorProperty(display="Supports ORDER BY", description="True, if this connector supports ORDER BY", advanced=true)
+ public final boolean supportsOrderBy() {
+ return supportsOrderBy;
+ }
+
+ public void setSupportsOrderBy(boolean supportsOrderBy) {
+ this.supportsOrderBy = supportsOrderBy;
+ }
+
+ /**
+ * Support indicates connector accepts ORDER BY clause with columns not from the select
+ * @since 6.2
+ * @return
+ */
+ public boolean supportsOrderByUnrelated() {
+ return false;
+ }
+
+ /**
+ * Returns the default null ordering
+ * @since 7.1
+ * @return the {@link NullOrder}
+ */
+ public NullOrder getDefaultNullOrder() {
+ return NullOrder.UNKNOWN;
+ }
+
+ /**
+ * Returns whether the database supports explicit join ordering.
+ * @since 7.1
+ * @return true if nulls first/last can be specified
+ */
+ public boolean supportsOrderByNullOrdering() {
+ return false;
+ }
+
+ /**
+ * Whether the source supports an explicit GROUP BY clause
+ * @since 6.1
+ */
+ public boolean supportsGroupBy() {
+ return false;
+ }
+
+ /**
+ * Whether the source supports the HAVING clause
+ * @since 6.1
+ */
+ public boolean supportsHaving() {
+ return false;
+ }
+
+ /**
+ * Support indicates connector can accept the SUM aggregate function
+ * @since 3.1 SP2
+ */
+ public boolean supportsAggregatesSum() {
+ return false;
+ }
+
+ /**
+ * Support indicates connector can accept the AVG aggregate function
+ * @since 3.1 SP2
+ */
+ public boolean supportsAggregatesAvg() {
+ return false;
+ }
+
+ /**
+ * Support indicates connector can accept the MIN aggregate function
+ * @since 3.1 SP2
+ */
+ public boolean supportsAggregatesMin() {
+ return false;
+ }
+
+ /**
+ * Support indicates connector can accept the MAX aggregate function
+ * @since 3.1 SP2
+ */
+ public boolean supportsAggregatesMax() {
+ return false;
+ }
+
+ /**
+ * Support indicates connector can accept the COUNT aggregate function
+ * @since 3.1 SP2
+ */
+ public boolean supportsAggregatesCount() {
+ return false;
+ }
+
+ /**
+ * Support indicates connector can accept the COUNT(*) aggregate function
+ * @since 3.1 SP2
+ */
+ public boolean supportsAggregatesCountStar() {
+ return false;
+ }
+
+ /**
+ * Support indicates connector can accept DISTINCT within aggregate functions
+ * @since 3.1 SP2
+ */
+ public boolean supportsAggregatesDistinct() {
+ return false;
+ }
+
+ /**
+ * Support indicates connector can accept STDDEV_POP, STDDEV_VAR, VAR_POP, VAR_SAMP
+ * @since 7.1
+ */
+ public boolean supportsAggregatesEnhancedNumeric() {
+ return false;
+ }
+
+ /**
+ * Support indicates connector can accept scalar subqueries in the SELECT, WHERE, and
+ * HAVING clauses
+ * @since 4.0
+ */
+ public boolean supportsScalarSubqueries() {
+ return false;
+ }
+
+ /**
+ * Support indicates connector can accept correlated subqueries wherever subqueries
+ * are accepted
+ * @since 4.0
+ */
+ public boolean supportsCorrelatedSubqueries() {
+ return false;
+ }
+
+ /**
+ * Support indicates connector can accept queries with non-searched
+ * CASE <expression> WHEN <expression> ... END
+ * <br>NOT CURRENTLY USED - case is pushed down as searched case
+ * @since 4.0
+ */
+ public boolean supportsCaseExpressions() {
+ return false;
+ }
+
+ /**
+ * Support indicates connector can accept queries with searched CASE WHEN <criteria> ... END
+ * @since 4.0
+ */
+ public boolean supportsSearchedCaseExpressions() {
+ return false;
+ }
+
+ /**
+ * Support indicates that the connector supports the UNION of two queries.
+ * @since 4.2
+ */
+ public boolean supportsUnions() {
+ return false;
+ }
+
+ /**
+ * Support indicates that the connector supports an ORDER BY on a SetQuery.
+ * @since 5.6
+ */
+ public boolean supportsSetQueryOrderBy() {
+ return false;
+ }
+
+ /**
+ * Support indicates that the connector supports the INTERSECT of two queries.
+ * @since 5.6
+ */
+ public boolean supportsIntersect() {
+ return false;
+ }
+
+ /**
+ * Support indicates that the connector supports the EXCEPT of two queries.
+ * @since 5.6
+ */
+ public boolean supportsExcept() {
+ return false;
+ }
+
+ /**
+ * Get list of all supported function names. Arithmetic functions have names like
+ * "+".
+ * @since 3.1 SP3
+ */
+ public List<String> getSupportedFunctions() {
+ return null;
+ }
+
+ /**
+ * Get a list of {@link FunctionMethod}s that will be contributed to the SYS schema.
+ * To avoid conflicts with system functions, the function name should contain a
+ * qualifier - typically <translator name>.<function name>
+ * @see ExecutionFactory#addPushDownFunction(String, String, FunctionParameter, FunctionParameter...)
+ * @return
+ */
+ public List<FunctionMethod> getPushDownFunctions(){
+ return pushdownFunctionMethods;
+ }
+
+ protected FunctionMethod addPushDownFunction(String qualifier, String name, String returnType, String...paramTypes) {
+ FunctionParameter[] params = new FunctionParameter[paramTypes.length];
+ for (int i = 0; i < paramTypes.length; i++) {
+ params[i] = new FunctionParameter("param" + (i+1), paramTypes[i]); //$NON-NLS-1$
+ }
+ FunctionMethod method = new FunctionMethod(qualifier + '.' + name, name, qualifier, params, new FunctionParameter("result", returnType)); //$NON-NLS-1$
+ method.setNameInSource(name);
+ pushdownFunctionMethods.add(method);
+ return method;
+ }
+
+ /**
+ * Get the integer value representing the number of values allowed in an IN criteria
+ * in the WHERE clause of a query
+ * @since 5.0
+ */
+ @TranslatorProperty(display="Max number of IN predicate entries", advanced=true)
+ public final int getMaxInCriteriaSize() {
+ return maxInSize;
+ }
+
+ public void setMaxInCriteriaSize(int maxInSize) {
+ this.maxInSize = maxInSize;
+ }
+
+ /**
+ * Get the integer value representing the number of values allowed in an IN criteria
+ * in the WHERE clause of a query
+ * @since 5.0
+ */
+ @TranslatorProperty(display="Max number of dependent values across all IN predicates", advanced=true)
+ public int getMaxDependentInPredicates() {
+ return maxDependentInPredicates;
+ }
+
+ public void setMaxDependentInPredicates(int maxDependentInPredicates) {
+ this.maxDependentInPredicates = maxDependentInPredicates;
+ }
+
+ /**
+ * <p>Support indicates that the connector supports functions in GROUP BY, such as:
+ * <code>SELECT dayofmonth(theDate), COUNT(*) FROM table GROUP BY dayofmonth(theDate)</code></p>
+ *
+ * <br>NOT CURRENTLY USED - group by expressions create an inline view for pushdown
+ * @since 5.0
+ */
+ public boolean supportsFunctionsInGroupBy() {
+ return false;
+ }
+
+ /**
+ * Gets whether the connector can limit the number of rows returned by a query.
+ * @since 5.0 SP1
+ */
+ public boolean supportsRowLimit() {
+ return false;
+ }
+
+ /**
+ * Gets whether the connector supports a SQL clause (similar to the LIMIT with an offset) that can return
+ * result sets that start in the middle of the resulting rows returned by a query
+ * @since 5.0 SP1
+ */
+ public boolean supportsRowOffset() {
+ return false;
+ }
+
+ /**
+ * The number of groups supported in the from clause. Added for a Sybase limitation.
+ * @since 5.6
+ * @return the number of groups supported in the from clause, or -1 if there is no limit
+ */
+ public int getMaxFromGroups() {
+ return DEFAULT_MAX_FROM_GROUPS;
+ }
+
+ /**
+ * Whether the source prefers to use ANSI style joins.
+ * @since 6.0
+ */
+ public boolean useAnsiJoin() {
+ return false;
+ }
+
+ /**
+ * Whether the source supports queries without criteria.
+ * @since 6.0
+ */
+ @TranslatorProperty(display="Requries Criteria", description="True, if this connector requires criteria on source queries", advanced=true)
+ public final boolean requiresCriteria() {
+ return requiresCriteria;
+ }
+
+ public void setRequiresCriteria(boolean requiresCriteria) {
+ this.requiresCriteria = requiresCriteria;
+ }
+
+ /**
+ * Whether the source supports {@link BatchedUpdates}
+ * @since 6.0
+ */
+ public boolean supportsBatchedUpdates() {
+ return false;
+ }
+
+ /**
+ * Whether the source supports updates with multiple value sets
+ * @since 6.0
+ */
+ public boolean supportsBulkUpdate() {
+ return false;
+ }
+
+ /**
+ * Support indicates that the connector can accept INSERTs with
+ * values specified by a {@link SetQuery} or {@link Select}
+ * @since 6.1
+ */
+ public boolean supportsInsertWithQueryExpression() {
+ return false;
+ }
+
+ /**
+ * Support indicates that the connector can accept INSERTs
+ * with values specified by an {@link Iterator}
+ * @since 7.1
+ * @return
+ */
+ public boolean supportsInsertWithIterator() {
+ return false;
+ }
+
+ public static <T> T getInstance(Class<T> expectedType, String className, Collection<?> ctorObjs, Class<? extends T> defaultClass) throws TranslatorException {
+ try {
+ if (className == null) {
+ if (defaultClass == null) {
+ throw new TranslatorException("Neither class name nor default class specified to create an instance"); //$NON-NLS-1$
+ }
+ return expectedType.cast(defaultClass.newInstance());
+ }
+ return expectedType.cast(ReflectionHelper.create(className, ctorObjs, Thread.currentThread().getContextClassLoader()));
+ } catch (TeiidException e) {
+ throw new TranslatorException(e);
+ } catch (IllegalAccessException e) {
+ throw new TranslatorException(e);
+ } catch(InstantiationException e) {
+ throw new TranslatorException(e);
+ }
+ }
+
+ /**
+ * Implement to provide metadata to the metadata for use by the engine. This is the
+ * primary method of creating metadata for dynamic VDBs.
+ * @param metadataFactory
+ * @param conn
+ * @throws TranslatorException
+ */
+ public void getMetadata(MetadataFactory metadataFactory, C conn) throws TranslatorException {
+
+ }
+
+ /**
+ * Indicates if LOBs are usable after the execution is closed.
+ * @return true if LOBs can be used after close
+ * @since 7.2
+ */
+ public boolean areLobsUsableAfterClose() {
+ return false;
+ }
+
+ /**
+ * @return true if the WITH clause is supported
+ * @since 7.2
+ */
+ public boolean supportsCommonTableExpressions() {
+ return false;
+ }
+
+}
Deleted: tags/teiid-parent-7.5.0.Alpha1/api/src/test/java/org/teiid/logging/TestLogManager.java
===================================================================
--- trunk/api/src/test/java/org/teiid/logging/TestLogManager.java 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/api/src/test/java/org/teiid/logging/TestLogManager.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,159 +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.logging;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.teiid.logging.Logger;
-import org.teiid.logging.LogManager;
-import org.teiid.logging.MessageLevel;
-
-import junit.framework.TestCase;
-
-
-/**
- * This test case tests the LogManager.
- */
-public class TestLogManager extends TestCase {
-
- String context = "SomeContext"; //$NON-NLS-1$
-
- /**
- * Constructor for TestLogManager.
- * @param name
- */
- public TestLogManager(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- ListLogger logger = new ListLogger();
- logger.setLogLevel(context, MessageLevel.DETAIL);
- LogManager.logListener = logger;
- }
-
- // =========================================================================
- // T E S T C A S E S
- // =========================================================================
-
- /*
- * Test for boolean isMessageToBeRecorded(String, int)
- */
- public void testIsMessageToBeRecordedString() {
- assertTrue(LogManager.isMessageToBeRecorded(context, MessageLevel.CRITICAL) );
-
- ListLogger cfg = (ListLogger)LogManager.logListener;
- cfg.setLogLevel(context, MessageLevel.NONE);
- assertFalse(LogManager.isMessageToBeRecorded(context, MessageLevel.CRITICAL) );
- }
-
- /**
- * Test that all msgs logged are equal and output in same order.
- */
- public void testLogMessage() throws Exception {
- ListLogger cfg = (ListLogger)LogManager.logListener;
- cfg.setLogLevel(context, MessageLevel.INFO );
-
- List<String> sentMsgList = new ArrayList<String>();
- sentMsgList.add("A message 1"); //$NON-NLS-1$
- sentMsgList.add("A message 2"); //$NON-NLS-1$
- sentMsgList.add("A message 3"); //$NON-NLS-1$
- sentMsgList.add("A message 4"); //$NON-NLS-1$
- sentMsgList.add("A message 5"); //$NON-NLS-1$
- sentMsgList.add("A message 6"); //$NON-NLS-1$
-
- for (Iterator iter = sentMsgList.iterator(); iter.hasNext();) {
- String msg = (String) iter.next();
- LogManager.logInfo(context, msg);
- }
-
- List recevedMsgList = cfg.getLoggedMessages();
- assertEquals(sentMsgList.size(), recevedMsgList.size());
- assertEquals(sentMsgList, recevedMsgList);
- }
-
- /**
- *
- * A log listener that saves messages (IStatus)s in a
- * List for later comparison.
- */
- class ListLogger implements Logger {
- private List<String> messages = new ArrayList<String>();
- private Map<String, Integer> contextMap = new HashMap<String, Integer>();
- private int defaultLevel;
-
- public ListLogger() {
- }
-
- public void log(int level, String context, Object msg){
- this.messages.add(msg.toString());
- }
-
- public void log(int level, String context, Throwable t, Object msg) {
- this.messages.add(msg.toString());
- }
-
- public void shutdown() {
- messages.clear();
- messages = null;
-
- }
-
- public int size() {
- return this.messages.size();
- }
-
- public List getLoggedMessages() {
- return this.messages;
- }
-
- public Set<String> getContexts() {
- return this.contextMap.keySet();
- }
-
- public int getLogLevel(String context) {
- Integer level = this.contextMap.get(context);
- if (level != null) {
- return level;
- }
- return defaultLevel;
- }
-
- public void setLogLevel(String context, int logLevel) {
- this.contextMap.put(context, logLevel);
- }
-
- @Override
- public boolean isEnabled(String context, int msgLevel) {
- int level = getLogLevel(context);
- return level >= msgLevel;
- }
- }
-
-}
Copied: tags/teiid-parent-7.5.0.Alpha1/api/src/test/java/org/teiid/logging/TestLogManager.java (from rev 3218, trunk/api/src/test/java/org/teiid/logging/TestLogManager.java)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/api/src/test/java/org/teiid/logging/TestLogManager.java (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/api/src/test/java/org/teiid/logging/TestLogManager.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,159 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License 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.logging;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.teiid.logging.Logger;
+import org.teiid.logging.LogManager;
+import org.teiid.logging.MessageLevel;
+
+import junit.framework.TestCase;
+
+
+/**
+ * This test case tests the LogManager.
+ */
+public class TestLogManager extends TestCase {
+
+ private static final String CONTEXT = "SomeContext"; //$NON-NLS-1$
+
+ /**
+ * Constructor for TestLogManager.
+ * @param name
+ */
+ public TestLogManager(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ ListLogger logger = new ListLogger();
+ logger.setLogLevel(CONTEXT, MessageLevel.DETAIL);
+ LogManager.logListener = logger;
+ }
+
+ // =========================================================================
+ // T E S T C A S E S
+ // =========================================================================
+
+ /*
+ * Test for boolean isMessageToBeRecorded(String, int)
+ */
+ public void testIsMessageToBeRecordedString() {
+ assertTrue(LogManager.isMessageToBeRecorded(CONTEXT, MessageLevel.CRITICAL) );
+
+ ListLogger cfg = (ListLogger)LogManager.logListener;
+ cfg.setLogLevel(CONTEXT, MessageLevel.NONE);
+ assertFalse(LogManager.isMessageToBeRecorded(CONTEXT, MessageLevel.CRITICAL) );
+ }
+
+ /**
+ * Test that all msgs logged are equal and output in same order.
+ */
+ public void testLogMessage() throws Exception {
+ ListLogger cfg = (ListLogger)LogManager.logListener;
+ cfg.setLogLevel(CONTEXT, MessageLevel.INFO );
+
+ List<String> sentMsgList = new ArrayList<String>();
+ sentMsgList.add("A message 1"); //$NON-NLS-1$
+ sentMsgList.add("A message 2"); //$NON-NLS-1$
+ sentMsgList.add("A message 3"); //$NON-NLS-1$
+ sentMsgList.add("A message 4"); //$NON-NLS-1$
+ sentMsgList.add("A message 5"); //$NON-NLS-1$
+ sentMsgList.add("A message 6"); //$NON-NLS-1$
+
+ for (Iterator<String> iter = sentMsgList.iterator(); iter.hasNext();) {
+ String msg = iter.next();
+ LogManager.logInfo(CONTEXT, msg);
+ }
+
+ List<String> recevedMsgList = cfg.getLoggedMessages();
+ assertEquals(sentMsgList.size(), recevedMsgList.size());
+ assertEquals(sentMsgList, recevedMsgList);
+ }
+
+ /**
+ *
+ * A log listener that saves messages (IStatus)s in a
+ * List for later comparison.
+ */
+ class ListLogger implements Logger {
+ private List<String> messages = new ArrayList<String>();
+ private Map<String, Integer> contextMap = new HashMap<String, Integer>();
+ private int defaultLevel;
+
+ public ListLogger() {
+ }
+
+ public void log(int level, String context, Object msg){
+ this.messages.add(msg.toString());
+ }
+
+ public void log(int level, String context, Throwable t, Object msg) {
+ this.messages.add(msg.toString());
+ }
+
+ public void shutdown() {
+ messages.clear();
+ messages = null;
+
+ }
+
+ public int size() {
+ return this.messages.size();
+ }
+
+ public List<String> getLoggedMessages() {
+ return this.messages;
+ }
+
+ public Set<String> getContexts() {
+ return this.contextMap.keySet();
+ }
+
+ public int getLogLevel(String context) {
+ Integer level = this.contextMap.get(context);
+ if (level != null) {
+ return level;
+ }
+ return defaultLevel;
+ }
+
+ public void setLogLevel(String context, int logLevel) {
+ this.contextMap.put(context, logLevel);
+ }
+
+ @Override
+ public boolean isEnabled(String context, int msgLevel) {
+ int level = getLogLevel(context);
+ return level >= msgLevel;
+ }
+ }
+
+}
Deleted: tags/teiid-parent-7.5.0.Alpha1/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
===================================================================
--- trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,257 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
-
- <!-- Teiid Services -->
- <bean name="SessionService" class="org.teiid.services.SessionServiceImpl">
- <property name="VDBRepository"><inject bean="VDBRepository"/></property>
- <property name="securityHelper"><inject bean="SecurityHelper"/></property>
- <!-- Comma separated list of domains to be used to login into Teiid using JDBC connection-->
- <property name="securityDomains">teiid-security</property>
- <!-- security domain to be used with Admin API (please do not change this, as this should be same as profile service) -->
- <property name="adminSecurityDomain">jmx-console</property>
- <!-- Maximum number of sessions allowed by the system (default 5000) -->
- <property name="sessionMaxLimit">5000</property>
- <!-- Max allowed time before the session is terminated by the system, 0 indicates unlimited (default 0) -->
- <property name="sessionExpirationTimeLimit">0</property>
- </bean>
-
- <bean name="BufferService" class="org.teiid.services.BufferServiceImpl">
- <!-- Use disk for buffer management -->
- <property name="useDisk">true</property>
- <!-- Directory location for the buffer files -->
- <property name="diskDirectory">${jboss.server.temp.dir}/teiid</property>
- <!-- The max row count of a batch sent internally within the query processor. Should be <= the connectorBatchSize. (default 512) -->
- <property name="processorBatchSize">512</property>
- <!-- The max row count of a batch from a connector. Should be even multiple of processorBatchSize. (default 1024) -->
- <property name="connectorBatchSize">1024</property>
- <!--
- The number of batch columns to allow in buffer memory. -1 means to automatically calculate a value (default -1).
- See the admin guide for more.
- -->
- <property name="maxReserveBatchColumns">-1</property>
- <!--
- The number of batch columns guaranteed to a processing operation. -1 means to automatically calculate a value (default -1).
- See the admin guide for more.
- -->
- <property name="maxProcessingBatchesColumns">-1</property>
- <!-- Max File size in MB (default 2GB)-->
- <property name="maxFileSize">2048</property>
- <!-- Max storage space, in MB, to be used for buffer files (default 50G) -->
- <property name="maxBufferSpace">51200</property>
- <!-- Max open buffer files (default 64) -->
- <property name="maxOpenFiles">64</property>
- </bean>
-
- <bean name="CacheFactory" class="org.teiid.cache.jboss.ClusterableCacheFactory">
- <property name="enabled">true</property>
- <property name="cacheManager">java:TeiidCacheManager</property>
- <property name="resultsetCacheName">teiid-resultset-cache</property>
- </bean>
-
- <!-- Configuration for result set caching.
- There will be 2 caches with these settings.
- One cache holds results that are specific to sessions.
- The other cache holds vdb scoped results and can
- be replicated.
- -->
- <bean name="ResultsetCacheConfig" class="org.teiid.cache.CacheConfiguration">
- <property name="name">ResultSetCacheConfig</property>
- <property name="enabled">true</property>
- <!-- Max Entries allowed (default 1024) -->
- <property name="maxEntries">1024</property>
- <!-- Max age in seconds (default 7200 - 2 hours) -->
- <property name="maxAgeInSeconds">7200</property>
- <!-- Max staleness in seconds. Modifications are based upon data updates
- -1 indicates no max. (default 60 - 1 minute) -->
- <property name="maxStaleness">60</property>
- <!-- Allowed values are LRU, EXPIRATION.
- Setting this value to LRU will cause cache hint TTL values
- to be ignored. (default EXPIRATION) -->
- <property name="type">EXPIRATION</property>
- <property name="location">resultset</property>
- </bean>
-
- <!-- Configuration for prepared plan caching. (local memory only)
- -->
- <bean name="PreparedPlanCacheConfig" class="org.teiid.cache.CacheConfiguration">
- <property name="name">PreparedPlanCacheConfig</property>
- <!-- Max Entries allowed (default 512) -->
- <property name="maxEntries">512</property>
- <!-- Max age in seconds (default 28800 - 8 hours) -->
- <property name="maxAgeInSeconds">28800</property>
- <!-- Max staleness in seconds. Modifications are based upon costing/metadata updates
- -1 indicates no max. (default 0) -->
- <property name="maxStaleness">0</property>
- </bean>
-
- <bean name="RuntimeEngineDeployer" class="org.teiid.jboss.deployers.RuntimeEngineDeployer">
- <property name="jndiName">teiid/engine-deployer</property>
- <property name="profileService"><inject bean="ProfileService"/></property>
- <property name="jdbcSocketConfiguration"><inject bean="JdbcSocketConfiguration"/></property>
- <property name="adminSocketConfiguration"><inject bean="AdminSocketConfiguration"/></property>
- <property name="odbcSocketConfiguration"><inject bean="OdbcSocketConfiguration"/></property>
- <property name="workManager"><inject bean="WorkManager"/></property>
- <property name="XATerminator"><inject bean="TransactionManager" property="XATerminator"/></property>
- <property name="transactionManager"><inject bean="TransactionManager" property="transactionManager"/></property>
- <property name="sessionService"><inject bean="SessionService"/></property>
- <property name="bufferService"><inject bean="BufferService"/></property>
- <property name="securityHelper"><inject bean="SecurityHelper"/></property>
- <property name="VDBRepository"><inject bean="VDBRepository"/></property>
- <property name="VDBStatusChecker"><inject bean="VDBStatusChecker"/></property>
- <property name="cacheFactory"><inject bean="CacheFactory"/></property>
- <property name="resultsetCacheConfig"><inject bean="ResultsetCacheConfig"/></property>
- <property name="preparedPlanCacheConfig"><inject bean="PreparedPlanCacheConfig"/></property>
-
- <!-- Process pool maximum thread count. (default 64) -->
- <property name="maxThreads">64</property>
- <!-- Max active plans (default 20). Increase this value on highly concurrent systems - but ensure that the underlying pools can handle the increased load without timeouts. -->
- <property name="maxActivePlans">20</property>
- <!-- Max source query concurrency per user request (default 0).
- 0 indicates use the default calculated value based on max active plans and max threads - approximately 2*(max threads)/(max active plans).
- 1 forces serial execution in the processing thread, just as is done for a transactional request.
- Any number greater than 1 limits the maximum number of concurrently executing source requests accordingly. -->
- <property name="userRequestSourceConcurrency">0</property>
- <!-- Query processor time slice, in milliseconds. (default 2000) -->
- <property name="timeSliceInMilli">2000</property>
- <!-- Maximum allowed fetch size, set via JDBC. User requested value ignored above this value. (default 20480) -->
- <property name="maxRowsFetchSize">20480</property>
- <!-- The max lob chunk size in KB transferred each time when processing blobs, clobs (100KB default) -->
- <property name="lobChunkSizeInKB">100</property>
- <!-- Turn on role checking based upon the data roles defined in VDBs. (default true) -->
- <property name="useDataRoles">true</property>
- <!-- Sets whether temporary table usage is allowed by default with data roles enabled. If false, the user must have a role that grants creates temporary table rights to use temporary tables. (default true) -->
- <property name="allowCreateTemporaryTablesByDefault">true</property>
- <!-- Sets whether functions may be called by default with data roles enabled. If false, a specific permission must exist to call the function. (default true) -->
- <property name="allowFunctionCallsByDefault">true</property>
- <!-- Long running query threshold, after which a alert can be generated by tooling if configured-->
- <property name="queryThresholdInSecs">600</property>
- <!-- Maximum rows allowed from a source query. -1 indicates no limit. (default -1)-->
- <property name="maxSourceRows">-1</property>
- <!-- Indicates if an exception should be thrown if the specified value for Maximum Source Rows is exceeded; only up to the maximum rows will be consumed. (default true) -->
- <property name="exceptionOnMaxSourceRows">true</property>
- <!-- Maximum size of lob allowed through ODBC connection in bytes (default 5MB) -->
- <property name="maxODBCLobSizeAllowed">5242880</property>
- <!-- The JNDI name of the Teiid Event Distributor -->
- <property name="eventDistributorName">teiid/event-distributor</property>
- <!-- Set to true for the engine to detect local change events. Should be disabled if using external change data capture tools. (default true) -->
- <property name="detectingChangeEvents">true</property>
- </bean>
-
- <!-- JDBC Socket connection properties (SSL see below) -->
- <bean name="JdbcSocketConfiguration" class="org.teiid.transport.SocketConfiguration">
- <property name="name">JdbcSocketConfiguration</property>
- <property name="enabled">true</property>
- <property name="bindAddress">${jboss.bind.address}</property>
- <property name="portNumber">31000</property>
- <!-- Max number of threads dedicated to initial request processing.
- Zero indicates the system default of max available processors. (default 0)
- Setting this value above the max available processors is not recommended. -->
- <property name="maxSocketThreads">0</property>
- <!-- SO_RCVBUF size, 0 indicates that system default should be used (default 0) -->
- <property name="inputBufferSize">0</property>
- <!-- SO_SNDBUF size, 0 indicates that system default should be used (default 0) -->
- <property name="outputBufferSize">0</property>
- <property name="SSLConfiguration"><inject bean="JdbcSslConfiguration"/></property>
- </bean>
-
- <bean name="JdbcSslConfiguration" class="org.teiid.transport.SSLConfiguration">
- <!-- can be one of disabled, login, or enabled
- disabled = no transport or message level security will be used
- login = only the login traffic will be encrypted at a message level
- using 128 bit AES with an ephemerial DH key exchange.
- No other config values are needed in this mode
- enabled = traffic will be secured using this configuration
- -->
- <property name="mode">login</property>
- <property name="keystoreFilename">cert.keystore</property>
- <property name="keystorePassword">passwd</property>
- <property name="keystoreType">JKS</property>
- <property name="sslProtocol">SSLv3</property>
- <property name="keymanagementAlgorithm">false</property>
- <property name="truststoreFilename">cert.truststore</property>
- <property name="truststorePassword">passwd</property>
- <!-- 1-way, 2-way, anonymous -->
- <property name="authenticationMode">1-way</property>
- </bean>
-
- <!-- Admin Socket connection settings (SSL see below) -->
- <bean name="AdminSocketConfiguration" class="org.teiid.transport.SocketConfiguration">
- <property name="name">AdminSocketConfiguration</property>
- <property name="enabled">true</property>
- <property name="bindAddress">${jboss.bind.address}</property>
- <property name="portNumber">31443</property>
- <!-- Max number of threads dedicated to Admin request processing.
- Zero indicates the system default of max available processors. (default 4) -->
- <property name="maxSocketThreads">4</property>
- <!-- SO_RCVBUF size, 0 indicates that system default should be used (default 0) -->
- <property name="inputBufferSize">0</property>
- <!-- SO_SNDBUF size, 0 indicates that system default should be used (default 0) -->
- <property name="outputBufferSize">0</property>
- <property name="SSLConfiguration"><inject bean="AdminSslConfiguration"/></property>
- </bean>
-
- <bean name="AdminSslConfiguration" class="org.teiid.transport.SSLConfiguration">
- <!-- can be one of disabled, login, or enabled
- disabled = no transport or message level security will be used
- login = only the login traffic will be encrypted at a message level
- using 128 bit AES with an ephemerial DH key exchange.
- No other config values are needed in this mode
- enabled = traffic will be secured using this configuration
- -->
- <property name="mode">enabled</property>
- <property name="keystoreFilename">cert.keystore</property>
- <property name="keystorePassword">passwd</property>
- <property name="keystoreType">JKS</property>
- <property name="sslProtocol">SSLv3</property>
- <property name="keymanagementAlgorithm">false</property>
- <property name="truststoreFilename">cert.truststore</property>
- <property name="truststorePassword">passwd</property>
- <!-- 1-way, 2-way, anonymous -->
- <property name="authenticationMode">anonymous</property>
- </bean>
-
- <!-- JDBC Socket connection properties (SSL see below) -->
- <bean name="OdbcSocketConfiguration" class="org.teiid.transport.SocketConfiguration">
- <property name="name">OdbcSocketConfiguration</property>
- <property name="enabled">true</property>
- <property name="bindAddress">${jboss.bind.address}</property>
- <property name="portNumber">35432</property>
- <!-- Max number of threads dedicated to ODBC request processing.
- Zero indicates the system default of max available processors. (default 0) -->
- <property name="maxSocketThreads">0</property>
- <!-- SO_RCVBUF size, 0 indicates that system default should be used (default 0) -->
- <property name="inputBufferSize">0</property>
- <!-- SO_SNDBUF size, 0 indicates that system default should be used (default 0) -->
- <property name="outputBufferSize">0</property>
- <property name="SSLConfiguration"><inject bean="OdbcSslConfiguration"/></property>
- </bean>
-
- <bean name="OdbcSslConfiguration" class="org.teiid.transport.SSLConfiguration">
- <!-- can be one of disabled or enabled
- disabled = no transport or message level security will be used
- enabled = traffic will be secured using this configuration
- -->
- <property name="mode">disabled</property>
- <property name="keystoreFilename">cert.keystore</property>
- <property name="keystorePassword">passwd</property>
- <property name="keystoreType">JKS</property>
- <property name="sslProtocol">SSLv3</property>
- <property name="keymanagementAlgorithm">false</property>
- <property name="truststoreFilename">cert.truststore</property>
- <property name="truststorePassword">passwd</property>
- <!-- 1-way, 2-way, anonymous -->
- <property name="authenticationMode">1-way</property>
- </bean>
-
- <!-- teiid's default security domain, replace this with your own if needs to be any other JAAS domain -->
- <application-policy xmlns="urn:jboss:security-beans:1.0" name="teiid-security">
- <authentication>
- <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule" flag="required">
- <!-- property files can found under conf/props directory -->
- <module-option name="usersProperties">props/teiid-security-users.properties</module-option>
- <module-option name="rolesProperties">props/teiid-security-roles.properties</module-option>
- </login-module>
- </authentication>
- </application-policy>
-
-</deployment>
Copied: tags/teiid-parent-7.5.0.Alpha1/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml (from rev 3218, trunk/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,257 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <!-- Teiid Services -->
+ <bean name="SessionService" class="org.teiid.services.SessionServiceImpl">
+ <property name="VDBRepository"><inject bean="VDBRepository"/></property>
+ <property name="securityHelper"><inject bean="SecurityHelper"/></property>
+ <!-- Comma separated list of domains to be used to login into Teiid using JDBC connection-->
+ <property name="securityDomains">teiid-security</property>
+ <!-- security domain to be used with Admin API (please do not change this, as this should be same as profile service) -->
+ <property name="adminSecurityDomain">jmx-console</property>
+ <!-- Maximum number of sessions allowed by the system (default 5000) -->
+ <property name="sessionMaxLimit">5000</property>
+ <!-- Max allowed time before the session is terminated by the system, 0 indicates unlimited (default 0) -->
+ <property name="sessionExpirationTimeLimit">0</property>
+ </bean>
+
+ <bean name="BufferService" class="org.teiid.services.BufferServiceImpl">
+ <!-- Use disk for buffer management -->
+ <property name="useDisk">true</property>
+ <!-- Directory location for the buffer files -->
+ <property name="diskDirectory">${jboss.server.temp.dir}/teiid</property>
+ <!-- The max row count of a batch sent internally within the query processor. Should be <= the connectorBatchSize. (default 512) -->
+ <property name="processorBatchSize">512</property>
+ <!-- The max row count of a batch from a connector. Should be even multiple of processorBatchSize. (default 1024) -->
+ <property name="connectorBatchSize">1024</property>
+ <!--
+ The number of batch columns to allow in buffer memory. -1 means to automatically calculate a value (default -1).
+ See the admin guide for more.
+ -->
+ <property name="maxReserveBatchColumns">-1</property>
+ <!--
+ The number of batch columns guaranteed to a processing operation. -1 means to automatically calculate a value (default -1).
+ See the admin guide for more.
+ -->
+ <property name="maxProcessingBatchesColumns">-1</property>
+ <!-- Max File size in MB (default 2GB)-->
+ <property name="maxFileSize">2048</property>
+ <!-- Max storage space, in MB, to be used for buffer files (default 50G) -->
+ <property name="maxBufferSpace">51200</property>
+ <!-- Max open buffer files (default 64) -->
+ <property name="maxOpenFiles">64</property>
+ </bean>
+
+ <bean name="CacheFactory" class="org.teiid.cache.jboss.ClusterableCacheFactory">
+ <property name="enabled">true</property>
+ <property name="cacheManager">java:TeiidCacheManager</property>
+ <property name="resultsetCacheName">teiid-resultset-cache</property>
+ </bean>
+
+ <!-- Configuration for result set caching.
+ There will be 2 caches with these settings.
+ One cache holds results that are specific to sessions.
+ The other cache holds vdb scoped results and can
+ be replicated.
+ -->
+ <bean name="ResultsetCacheConfig" class="org.teiid.cache.CacheConfiguration">
+ <property name="name">ResultSetCacheConfig</property>
+ <property name="enabled">true</property>
+ <!-- Max Entries allowed (default 1024) -->
+ <property name="maxEntries">1024</property>
+ <!-- Max age in seconds (default 7200 - 2 hours) -->
+ <property name="maxAgeInSeconds">7200</property>
+ <!-- Max staleness in seconds. Modifications are based upon data updates
+ -1 indicates no max. (default 60 - 1 minute) -->
+ <property name="maxStaleness">60</property>
+ <!-- Allowed values are LRU, EXPIRATION.
+ Setting this value to LRU will cause cache hint TTL values
+ to be ignored. (default EXPIRATION) -->
+ <property name="type">EXPIRATION</property>
+ <property name="location">resultset</property>
+ </bean>
+
+ <!-- Configuration for prepared plan caching. (local memory only)
+ -->
+ <bean name="PreparedPlanCacheConfig" class="org.teiid.cache.CacheConfiguration">
+ <property name="name">PreparedPlanCacheConfig</property>
+ <!-- Max Entries allowed (default 512) -->
+ <property name="maxEntries">512</property>
+ <!-- Max age in seconds (default 28800 - 8 hours) -->
+ <property name="maxAgeInSeconds">28800</property>
+ <!-- Max staleness in seconds. Modifications are based upon costing/metadata updates
+ -1 indicates no max. (default 0) -->
+ <property name="maxStaleness">0</property>
+ </bean>
+
+ <bean name="RuntimeEngineDeployer" class="org.teiid.jboss.deployers.RuntimeEngineDeployer">
+ <property name="jndiName">teiid/engine-deployer</property>
+ <property name="profileService"><inject bean="ProfileService"/></property>
+ <property name="jdbcSocketConfiguration"><inject bean="JdbcSocketConfiguration"/></property>
+ <property name="adminSocketConfiguration"><inject bean="AdminSocketConfiguration"/></property>
+ <property name="odbcSocketConfiguration"><inject bean="OdbcSocketConfiguration"/></property>
+ <property name="workManager"><inject bean="WorkManager"/></property>
+ <property name="XATerminator"><inject bean="TransactionManager" property="XATerminator"/></property>
+ <property name="transactionManager"><inject bean="TransactionManager" property="transactionManager"/></property>
+ <property name="sessionService"><inject bean="SessionService"/></property>
+ <property name="bufferService"><inject bean="BufferService"/></property>
+ <property name="securityHelper"><inject bean="SecurityHelper"/></property>
+ <property name="VDBRepository"><inject bean="VDBRepository"/></property>
+ <property name="VDBStatusChecker"><inject bean="VDBStatusChecker"/></property>
+ <property name="cacheFactory"><inject bean="CacheFactory"/></property>
+ <property name="resultsetCacheConfig"><inject bean="ResultsetCacheConfig"/></property>
+ <property name="preparedPlanCacheConfig"><inject bean="PreparedPlanCacheConfig"/></property>
+
+ <!-- Process pool maximum thread count. (default 64) -->
+ <property name="maxThreads">64</property>
+ <!-- Max active plans (default 20). Increase this value on highly concurrent systems - but ensure that the underlying pools can handle the increased load without timeouts. -->
+ <property name="maxActivePlans">20</property>
+ <!-- Max source query concurrency per user request (default 0).
+ 0 indicates use the default calculated value based on max active plans and max threads - approximately 2*(max threads)/(max active plans).
+ 1 forces serial execution in the processing thread, just as is done for a transactional request.
+ Any number greater than 1 limits the maximum number of concurrently executing source requests accordingly. -->
+ <property name="userRequestSourceConcurrency">0</property>
+ <!-- Query processor time slice, in milliseconds. (default 2000) -->
+ <property name="timeSliceInMilli">2000</property>
+ <!-- Maximum allowed fetch size, set via JDBC. User requested value ignored above this value. (default 20480) -->
+ <property name="maxRowsFetchSize">20480</property>
+ <!-- The max lob chunk size in KB transferred each time when processing blobs, clobs (100KB default) -->
+ <property name="lobChunkSizeInKB">100</property>
+ <!-- Turn on role checking based upon the data roles defined in VDBs. (default true) -->
+ <property name="useDataRoles">true</property>
+ <!-- Sets whether temporary table usage is allowed by default with data roles enabled. If false, the user must have a role that grants creates temporary table rights to use temporary tables. (default true) -->
+ <property name="allowCreateTemporaryTablesByDefault">true</property>
+ <!-- Sets whether functions may be called by default with data roles enabled. If false, a specific permission must exist to call the function. (default true) -->
+ <property name="allowFunctionCallsByDefault">true</property>
+ <!-- Long running query threshold, after which a alert can be generated by tooling if configured-->
+ <property name="queryThresholdInSecs">600</property>
+ <!-- Maximum rows allowed from a source query. -1 indicates no limit. (default -1)-->
+ <property name="maxSourceRows">-1</property>
+ <!-- Indicates if an exception should be thrown if the specified value for Maximum Source Rows is exceeded; only up to the maximum rows will be consumed. (default true) -->
+ <property name="exceptionOnMaxSourceRows">true</property>
+ <!-- Maximum size of lob allowed through ODBC connection in bytes (default 5MB) -->
+ <property name="maxODBCLobSizeAllowed">5242880</property>
+ <!-- The JNDI name of the Teiid Event Distributor -->
+ <property name="eventDistributorName">teiid/event-distributor</property>
+ <!-- Set to true for the engine to detect local change events. Should be disabled if using external change data capture tools. (default true) -->
+ <property name="detectingChangeEvents">true</property>
+ </bean>
+
+ <!-- JDBC Socket connection properties (SSL see below) -->
+ <bean name="JdbcSocketConfiguration" class="org.teiid.transport.SocketConfiguration">
+ <property name="name">JdbcSocketConfiguration</property>
+ <property name="enabled">true</property>
+ <property name="bindAddress">${jboss.bind.address}</property>
+ <property name="portNumber">31000</property>
+ <!-- Max number of threads dedicated to initial request processing.
+ Zero indicates the system default of max available processors. (default 0)
+ Setting this value above the max available processors is not recommended. -->
+ <property name="maxSocketThreads">0</property>
+ <!-- SO_RCVBUF size, 0 indicates that system default should be used (default 0) -->
+ <property name="inputBufferSize">0</property>
+ <!-- SO_SNDBUF size, 0 indicates that system default should be used (default 0) -->
+ <property name="outputBufferSize">0</property>
+ <property name="SSLConfiguration"><inject bean="JdbcSslConfiguration"/></property>
+ </bean>
+
+ <bean name="JdbcSslConfiguration" class="org.teiid.transport.SSLConfiguration">
+ <!-- can be one of disabled, login, or enabled
+ disabled = no transport or message level security will be used
+ login = only the login traffic will be encrypted at a message level
+ using 128 bit AES with an ephemerial DH key exchange.
+ No other config values are needed in this mode
+ enabled = traffic will be secured using this configuration
+ -->
+ <property name="mode">login</property>
+ <property name="keystoreFilename">cert.keystore</property>
+ <property name="keystorePassword">passwd</property>
+ <property name="keystoreType">JKS</property>
+ <property name="sslProtocol">SSLv3</property>
+ <property name="keymanagementAlgorithm">false</property>
+ <property name="truststoreFilename">cert.truststore</property>
+ <property name="truststorePassword">passwd</property>
+ <!-- 1-way, 2-way, anonymous -->
+ <property name="authenticationMode">1-way</property>
+ </bean>
+
+ <!-- Admin Socket connection settings (SSL see below) -->
+ <bean name="AdminSocketConfiguration" class="org.teiid.transport.SocketConfiguration">
+ <property name="name">AdminSocketConfiguration</property>
+ <property name="enabled">true</property>
+ <property name="bindAddress">${jboss.bind.address}</property>
+ <property name="portNumber">31443</property>
+ <!-- Max number of threads dedicated to Admin request processing.
+ Zero indicates the system default of max available processors. (default 4) -->
+ <property name="maxSocketThreads">4</property>
+ <!-- SO_RCVBUF size, 0 indicates that system default should be used (default 0) -->
+ <property name="inputBufferSize">0</property>
+ <!-- SO_SNDBUF size, 0 indicates that system default should be used (default 0) -->
+ <property name="outputBufferSize">0</property>
+ <property name="SSLConfiguration"><inject bean="AdminSslConfiguration"/></property>
+ </bean>
+
+ <bean name="AdminSslConfiguration" class="org.teiid.transport.SSLConfiguration">
+ <!-- can be one of disabled, login, or enabled
+ disabled = no transport or message level security will be used
+ login = only the login traffic will be encrypted at a message level
+ using 128 bit AES with an ephemerial DH key exchange.
+ No other config values are needed in this mode
+ enabled = traffic will be secured using this configuration
+ -->
+ <property name="mode">enabled</property>
+ <property name="keystoreFilename">cert.keystore</property>
+ <property name="keystorePassword">passwd</property>
+ <property name="keystoreType">JKS</property>
+ <property name="sslProtocol">SSLv3</property>
+ <property name="keymanagementAlgorithm">false</property>
+ <property name="truststoreFilename">cert.truststore</property>
+ <property name="truststorePassword">passwd</property>
+ <!-- 1-way, 2-way, anonymous -->
+ <property name="authenticationMode">anonymous</property>
+ </bean>
+
+ <!-- JDBC Socket connection properties (SSL see below) -->
+ <bean name="OdbcSocketConfiguration" class="org.teiid.transport.SocketConfiguration">
+ <property name="name">OdbcSocketConfiguration</property>
+ <property name="enabled">true</property>
+ <property name="bindAddress">${jboss.bind.address}</property>
+ <property name="portNumber">35432</property>
+ <!-- Max number of threads dedicated to ODBC request processing.
+ Zero indicates the system default of max available processors. (default 0) -->
+ <property name="maxSocketThreads">0</property>
+ <!-- SO_RCVBUF size, 0 indicates that system default should be used (default 0) -->
+ <property name="inputBufferSize">0</property>
+ <!-- SO_SNDBUF size, 0 indicates that system default should be used (default 0) -->
+ <property name="outputBufferSize">0</property>
+ <property name="SSLConfiguration"><inject bean="OdbcSslConfiguration"/></property>
+ </bean>
+
+ <bean name="OdbcSslConfiguration" class="org.teiid.transport.SSLConfiguration">
+ <!-- can be one of disabled or enabled
+ disabled = no transport or message level security will be used
+ enabled = traffic will be secured using this configuration if the client supports SSL
+ -->
+ <property name="mode">disabled</property>
+ <property name="keystoreFilename">cert.keystore</property>
+ <property name="keystorePassword">passwd</property>
+ <property name="keystoreType">JKS</property>
+ <property name="sslProtocol">SSLv3</property>
+ <property name="keymanagementAlgorithm">false</property>
+ <property name="truststoreFilename">cert.truststore</property>
+ <property name="truststorePassword">passwd</property>
+ <!-- 1-way, 2-way, anonymous -->
+ <property name="authenticationMode">1-way</property>
+ </bean>
+
+ <!-- teiid's default security domain, replace this with your own if needs to be any other JAAS domain -->
+ <application-policy xmlns="urn:jboss:security-beans:1.0" name="teiid-security">
+ <authentication>
+ <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule" flag="required">
+ <!-- property files can found under conf/props directory -->
+ <module-option name="usersProperties">props/teiid-security-users.properties</module-option>
+ <module-option name="rolesProperties">props/teiid-security-roles.properties</module-option>
+ </login-module>
+ </authentication>
+ </application-policy>
+
+</deployment>
Deleted: tags/teiid-parent-7.5.0.Alpha1/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- trunk/build/kits/jboss-container/teiid-releasenotes.html 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/build/kits/jboss-container/teiid-releasenotes.html 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,228 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<HTML>
-<HEAD>
- <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
- <TITLE>Teiid ${project.version} Release Notes</TITLE>
- <META NAME="CHANGEDBY" CONTENT="Steve Hawkins">
- </STYLE>
-</HEAD>
-<BODY LANG="en-US" DIR="LTR">
-<P><A HREF="http://www.teiid.org/"><IMG SRC="https://www.jboss.org/dms/teiid/images/teiid-banner.png" NAME="graphics1" ALT="Teiid" ALIGN=BOTTOM WIDTH=800></A>
-
-<H1>Teiid ${project.version} Release Notes</H1>
-<P>Teiid ${project.version} adds performance, integration, and runtime metadata update features.
-
-<H2>Overview</H2>
-<UL>
- <LI><A HREF="#Highlights">Highlights</A>
- <LI><A HREF="#Compatibility">Compatibility Issues</A>
- <LI><A HREF="#Configuration">Configuration Issues</A>
- <LI><A HREF="#Other">Other Issues</A>
- <LI><A HREF="#LibraryUpdates">Thirdparty Library Updates</A>
- <LI><A HREF="#Details">Detailed Release Notes</A>
- <LI><A HREF="#Documentation">Additional Docs and Help</A>
- <LI><A HREF="#Licenses">Licenses</A>
- <LI><A HREF="#About">About JBoss</A>
-</UL>
-<H2><A NAME="Highlights"></A>Highlights</H2>
-
-<h2><a name="Compatibility">Compatibility Issues</a></h2>
-<ul>
- <li>TRANSLATE/HAS CRITERIA has been deprecated. An alternative approach to update procedures will be introduced in a subsequent version.
- <li>Support for named parameter syntax using param=value has been deprecated, since it is ambiguous with a comparison predicate boolean value expression. param<b>=></b>value should be used instead.
-</ul>
-
-<h4>from 7.3</h4>
-<ul>
- <li>SYS.PROPERTIES has a new column, ClobValue, to get values exceeding the max string length
- <li>SYS.COLUMNS has two new columns to get statistical information: DistinctCount and NullCount
- <li>ARRAY_AGG is now a reserved word</li>
- <li>The use of an IN procedure parameter with the name "source_name" in a multi-source model, will now be treated the parameter that controls which source
- the procedure will execute against.
- <li>Dynamic VDB functions injected via ExecutionFactory.getPushdownFunctions are now scoped to the SYS schema and have a fully qualified name that includes their source type. For example, instead of oracle_model.relate - which was only valid against the oracle_model source, there is now the SYS.oracle_sdo.relate function that is valid for all Oracle sources. Any fully-qualified reference to these functions will need updated.
-</ul>
-
-<h4>from 7.2</h4>
-<ul>
- <li>The default JDBC credentials are user/user - not admin/teiid
- <li>Unordered limits are no longer pushed through conditions, dup removal, or UNION not all. This prevents the possibility of getting less results than the logical intent of the limit.
-</ul>
-
-<h4>from 7.1</h4>
-<ul>
- <li>Subqueries are no longer allowed to be SELECT INTO.
- <li>INSERT/UPDATE/DELETE cannot be used to create implicit return cursors in non-update virtual procedures. You can instead use "UPDATE ...; SELECT VARIABLES.ROWCOUNT;".
- <li>The SYSADMIN schema was created to hold procedures and tables that should not be generally accessible. SYS and pg_catalog are now always accessible - permissions do not apply to these schemas. The SYS.getBinaryVDBResource, SYS.getCharacterVDBResource, and SYS.getVDBResourcePaths have been replaced with the
- SYSADMIN.VDBResources table. The Matviews table and the refreshMatView/refreshMatViewRow procedures were also moved into SYSADMIN.
- <li>Overwriting an existing VDB will cause old connections to be terminated. Production systems should rely on VDB versioning.
- <li>The jdbc:metamatrix JDBC URL prefix is no longer accepted. Use jdbc:teiid instead.
- <li>Model visibility no longer restricts access to tables and procedures. Setting visible to false will only hide entries from system tables. Data roles should be used to restrict data access.
- <li>Admin API "getWorkManagerStats" methods renamed to "getWorkerPoolStats". Also, "setRuntimeProperty" and "getProcesses" methods were removed.
- <li>By default the "ENV" system function is now turned off. To enable it, edit the teiid-jboss-beans.xml configuration file.
- <li>The use of VARIABLES.ROWCOUNT is now reserved.
- <li>Exec statements of the form "var = EXEC foo()" are only valid if the procedure foo has a return parameter.
- <li>Cache hint now supports "scope" definition. For ex: /* cache(scope:user) */ select * from T1; This hint will override the computed scope based on the query.
-</ul>
-<h4>from 7.0</h4>
-<ul>
- <li>The term data policy was replaced with data role. The AdminAPI methods for adding role mappings have changed from addRoleToDataPolicy and removeRoleFromDataPolicy to addDataRoleMapping and removeDataRoleMapping respectively.
-</ul>
-<h4>from 6.2</h4>
-<ul>
- <li>The connector API has changed substantially. Custom connectors need to be retargeted to the new Translator API. See <a href="https://jira.jboss.org/browse/TEIID-1003">TEIID-1003</a> and the <a href="teiid-docs/teiid_developers_guide.pdf">Developer's Guide</a> for more information.
- <li>Connector bindings are no longer valid. Use the Designer Tooling or see the AdminShell download for a migration utility.
- <li>Calling out to web services and xml processing has been dramatically simplified and improved, but is a breaking change from prior releases.
- XML/Relational processing has been replaced by XMLTABLE, retrieving XML from file has been replaced by the File Translator/Resource Adapter, and
- web service calls have been replaced by the WS Translator/Resource Adapter. See <a href="https://jira.jboss.org/browse/TEIID-1118">TEIID-1118</a>, <a href="https://jira.jboss.org/browse/TEIID-1114">TEIID-1114</a>, and the <a href="teiid-docs/teiid_reference.pdf">Reference</a> guide for more information.
- <li>The direct usage of XQuery has been replaced with the XMLQuery function.
- <li>The text connector file processing has been replaced with the TEXTTABLE function. See <a href="https://jira.jboss.org/browse/TEIID-1102">TEIID-1102</a> and the <a href="teiid-docs/teiid_reference.pdf">Reference</a> guide for more information
- <li>Double quoted values are now parsed as identifiers by default. See <a href="https://jira.jboss.org/browse/TEIID-145">TEIID-145</a> and the <a href="teiid-docs/teiid_reference.pdf">Reference</a> guide for more information.
- <li>The system information schema has changed from System to SYS. The tables and table structures have also changed. See <a href="https://jira.jboss.org/browse/TEIID-871">TEIID-871</a> and the <a href="teiid-docs/teiid_reference.pdf">Reference</a> guide for more information.
- <li>Client control over query plans has changed. OPTION PLANONLY, DEBUG, and SHOWPLAN are no longer allowed. This behavior should not be controlled by the SET statement, SET SHOWPLAN (ON|OFF|DEBUG) and SET NOEXEC (ON|OFF). Usage of the client PlanNode class will also need to be updated.
- <li>Teiid specific JDBC client interfaces and methods have changed. In general these custom features have mostly been moved to other more standard locations or been removed. See <a href="https://jira.jboss.org/browse/TEIID-1020">TEIID-1020</a> and the <a href="teiid-docs/teiid_client_developers_guide.pdf">Client Developers</a> guide for more information.
- <li>Teiid's reserved words have changed. Many of the Teiid specific reserved words have become non-reserved words. All of SQL Foundation and SQL/MED 2003, and SQL/XML from SQL 2006 reserved words have been added as reserved words. It is generally required to double quote all reserved words. It is advisable to double quote all non-reserved words as well. The use of the INPUT qualifier for procedure inputs has been deprecated in favor of INPUTS. The use of the USING qualifier for dynamic SQL inputs has been deprecated in favor of DVARS.
- <li>The AdminApi has been redesigned for use with the new Translator/JCA split and for deployment in JBoss AS.
- <li>The AdminShell is based on Groovy. Most BeanShell syntax is also valid in Groovy, but there are extensive changes in the AdminAPI that may necessitate rewriting scripts.
- <li>OPTION NO CACHE <table list> will now only by-pass cache for the given tables at their immediate view layer. Previously all caches would have transitively been skipped. See <a href="https://jira.jboss.org/browse/TEIID-900">TEIID-900</a> for more information.
- <li>Nan and +-Infinity are no longer allowed as numerical results by default. This may be changed via the system property org.teiid.allowNanInfinity.
- <li>The scale of BigDecimal values is now adjusted to allow for more intuitive results. Conversion from floating numeric types will preserve the approximate scale and division results will allow for additional scale. See <a href="https://jira.jboss.org/browse/TEIID-159">TEIID-159</a> for more information.
- <li>The 7.0 client is not compatible with 6.x or vice versa. It is expected that 7.0 clients will be compatible with 7.x releases for standard JDBC operations.
-</ul>
-
-<h2><a name="Configuration">Configuration Issues</a></h2>
-
-See the <a href="teiid-docs/teiid_admin_guide.pdf">Admin Guide</a> for more on configuration and installation.
-
-<h4>from 7.3</h4>
-<ul>
- <LI>The default value for the JDBC dynamic vdb importer setting importer.useFullSchemaName is now true, which matches the expected behavior from the documentation.
- <LI>The prepared plan cache is now configured via the PreparedPlanCacheConfig bean, rather than through properties on the RuntimeEngineDeployer
- <LI>SocketConfiguration.maxSocketThreads will interpret a setting of 0 to mean use the system default of max available processors. Both the ODBC and JDBC transports now default to the 0 setting.
- <LI>maxReserveBatchColumns and maxProcessingBatchesColumns will interpret a setting of -1 to mean auto-calculate acceptable values given the max heap and other information. See the admin guide for more.
- <LI>The default for org.teiid.useValueCache has changed to false, since typical installations will not greatly benefit from the additional lookup cost.
- <LI>The property RuntimeEngineDeployer.allowFunctionCallsByDefault was added so that Teiid 7.4 behavior is compatible with Teiid 7.3. Set this property to false to require permissions for function calls when data roles are enabled.
-</ul>
-
-<h4>from 7.2</h4>
-<ul>
- <LI>Temporary tables can now be restricted by data roles. Use the data-role attribute allow-create-temporary-tables to explicitly enable or disable the usage of temporary tables.
-There is also a allowCreateTemporaryTablesByDefault property in the teiid-jboss-beans.xml to control whether usage is allowed by default. For compatibility with prior 7.x releases, the default is to allow
-temporary table access.
-</ul>
-
-<h4>from 7.1</h4>
-<ul>
- <li>Teiid clients now allow the usage of anonymous SSL by default.
- This changes allows the admin port (default 31443) to use anonymous SSL by default, rather than just securing login traffic.
- Admin clients should therefore use the mms protocol instead of mm. This will encrypt all admin traffic and ensure that any passwords in configuration files will
- be encrypted in transit. See the Admin Guide to upgrade from anonymous SSL to 1-way or 2-way authentication.
- The config properties sslEnabled and clientEncryptionEnabled for SSLConfiguration beans have been combined to a single property mode, that can have the values disabled|login|enabled.
- <li>Apache CXF is now expected to be used as the web services stack provider through JBossWS-CXF. See the Admin Guide for instructions on
- installing CXF for use with Teiid's Salesforce and web service connectors. The WS Resource Adapter's -ds.xml files should no longer use
- WSSecurityConfigURL and WSSecurityConfigName, rather they should be ConfigFile and ConfigName respectively. The property values should no longer
- refer to jboss-wsse-client.xml, but instead they should reference a CXF Spring configuration file and particular port configuration. See the Admin Guide
- for more on using CXF configuration files.
- <li>The default for data role checking is now "true". However only VDBs with data roles will have roles enforced.
- <li>The default prepared plan cache size was increased to 512, since it is targeted by internal plans as well.
-</ul>
-
-<h4>from 7.0</h4>
-<ul>
- <li>The property to enable data roles in teiid-jboss-beans.xml has changed from useEntitlements to useDataRoles.
- <li>Rar file names no longer contain version numbers. -ds.xml files should be updated from connector-XXX-version.rar to teiid-connector-XXX.rar
- <li>Code table relate configuration properties have been removed. Code tables are now implemented as materialized views.
-</ul>
-
-<h4>from 6.2</h4>
-<ul>
- <li>A JBoss AS instance is now required. Embedded mode is also currently not supported.</li>
- <li>Engine configuration is now handled through the admin console or deploy/teiid/teiid-jboss-beans.xml
- <li>Logging is now done through the container's log4j instance. Any Teiid specific logging changes, see the conf/jboss-teiid-log4j.xml, need to be incorporated into the master jboss-log4j.xml.
-</ul>
-
-<h2><a name="Other">Other Issues</a></h2>
-<ul>
- <li>TEIID-1170 - correlated subqueries are not allowed in UPDATEs or DELETEs against internal Teiid tables (internal materialized views or temporary tables).
- <li>TEIID-1281 - Negative start indexing is not supported by DB2 and Derby databases. Usage of the Teiid SUBSTRING against these sources should not use negative start values.
- <li>TEIID-1008 - Most versions of Oracle and MySQL do not support deeply nested correlated references. There is currently no workaround for this issue.
- <li>For compatibility with the 7.0 release if a stored procedure parameter list begins with identifier=, then it will be parsed as a named parameter invocation even if the intent was to use a comparison predicate
- as the first parameter value. The workaround is to use nesting parens, e.g. call proc((identifier=value), ...), which clarifies that this is positional value. This workaround will not be needed in later releases.
- <li><a url="https://issues.jboss.org/browse/TEIID-1511">TEIID-1511<a/> - When a VDB is deployed and undeployed a socket is left open, which may lead to "too manay open files". Check the defect comments for details.
-</ul>
-<h4>from 7.0</h4>
-<ul>
- <li>Fixed xsd type handling for SQL/XML and XML document models. xsd:date, xsd:dateTime, and xsd:time types will now all be displayed using the GMT timezone (Z). SQL types, such as timestamp, used for an XMLTABLE column will now expect their values to be in the form of the corresponding xsd type.
-</ul>
-<h4>From 6.2</h4>
-<ul>
- <li>Start time is now significantly longer due to the container deployment. However many operations can be performed on configruation files that will trigger a redeployment without the need for a restart.
- <li>Inversion of parse, format, and convert system functions is not used if it can be narrowing. In situations where a predicate has the form: parseTime(column, 'format') = {t 'time value'} may lead to reduced performance, since
- the parseTime function cannot be pushed down. This should be addressed in future releases.
-</ul>
-
-<h2><a name="LibraryUpdates">Thirdparty Library Updates</a></h2>
-
-The following components have been updated:
-<h4>From 7.1</h4>
-<ul>
- <li>json-simple 1.1 was added.
- <li>Netty was upgraded to 3.2.1
-</ul>
-<h4>From 7.0</h4>
-<ul>
- <li>Direct integration of JBossCache jars was removed.
- <li>Netty was upgraded to 3.2.0
- <li>JDOM was removed.
-</ul>
-<h4>From 6.2</h4>
-<ul>
- <li>Netty was upgraded to 3.1.5
- <li>Saxon was upgraded to 9.1.0.8
- <li>A 5.1 container's version of Arjuna is newer than what was previously included in Teiid 6.x.
- <li>Various other dependencies have been removed as they are no longer needed or now provided by the container.
-</ul>
-
-<h2><a name="Details">Detailed Release Notes</a></h2>
- Detailed Release Notes - Teiid - Version ${project.version}
-
-<h2><a name="Documentation">Documentation and Help</a></h2>
-
-The <a href="http://www.jboss.org/teiid/">Teiid community project</a> is hosted on jboss.org.
-Documentation and help may be obtained from the local distribution under <a href="teiid-docs">teiid-docs</a> or the following locations.
-<ul>
-
-<li><a href="http://www.jboss.org/teiid/docs">Online Documentation</a></li>
-<li><a href="https://community.jboss.org/wiki/TheTeiidProject">Wiki</a></li>
-<li><a href="http://jira.jboss.org/jira/browse/TEIID">JIRA</a></li>
-<li><a href="http://community.jboss.org/en/teiid?view=discussions">Forums</a></li>
-</ul>
-
-
-<h2><a name="Licenses">Licenses</a></h2>
-
-<p>Teiid is licensed under the <a href="LICENSE-lgpl-2.1.txt">LGPL</a>. The
-license texts for Teiid and the thirdparty components it uses may be found in the <a href="teiid-docs/licenses">teiid-docs/licenses</a>
-directory of the distribution.
-
-</p>
-
-<h2><a name="About">About JBoss, a
-division of Red Hat</a></h2>
-
-<p>JBoss, a division of <a href="http://www.redhat.com/jboss/">Red
-Hat</a>, is in the business of
-providing
-superior technical support to our customers. Our goal is to make
-Professional Open Source™ the <b>SAFE
-CHOICE</b>
-for you. We accomplish this by backing up our open source Java products
-with technical support services that are delivered by the core
-developers themselves. We can help you to train your staff and provide
-you with support at every stage of the application lifecycle - from
-development and integration through deployment and maintenance. Visit
-the <a href="http://www.jboss.com/services/index">JBoss
-Services</a> page for more
-information.</p>
-
-</BODY>
-</HTML>
\ No newline at end of file
Copied: tags/teiid-parent-7.5.0.Alpha1/build/kits/jboss-container/teiid-releasenotes.html (from rev 3218, trunk/build/kits/jboss-container/teiid-releasenotes.html)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/build/kits/jboss-container/teiid-releasenotes.html (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/build/kits/jboss-container/teiid-releasenotes.html 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,234 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
+ <TITLE>Teiid ${project.version} Release Notes</TITLE>
+ <META NAME="CHANGEDBY" CONTENT="Steve Hawkins">
+ </STYLE>
+</HEAD>
+<BODY LANG="en-US" DIR="LTR">
+<P><A HREF="http://www.teiid.org/"><IMG SRC="https://www.jboss.org/dms/teiid/images/teiid-banner.png" NAME="graphics1" ALT="Teiid" ALIGN=BOTTOM WIDTH=800></A>
+
+<H1>Teiid ${project.version} Release Notes</H1>
+<P>Teiid ${project.version} adds performance, integration, and runtime metadata update features.
+
+<H2>Overview</H2>
+<UL>
+ <LI><A HREF="#Highlights">Highlights</A>
+ <LI><A HREF="#Compatibility">Compatibility Issues</A>
+ <LI><A HREF="#Configuration">Configuration Issues</A>
+ <LI><A HREF="#Other">Other Issues</A>
+ <LI><A HREF="#LibraryUpdates">Thirdparty Library Updates</A>
+ <LI><A HREF="#Details">Detailed Release Notes</A>
+ <LI><A HREF="#Documentation">Additional Docs and Help</A>
+ <LI><A HREF="#Licenses">Licenses</A>
+ <LI><A HREF="#About">About JBoss</A>
+</UL>
+<H2><A NAME="Highlights"></A>Highlights</H2>
+<UL>
+ <LI><B>Subquery optimization control</B> - added the DJ hint to indicate that a subquery should be the independent side of a dependent join.
+ <LI><B>MAKEIND Hint</B> - The MAKEIND hint can be used to indicate that the other side of the join should be made dependent.
+ <LI><B>ODBC SSL</B> - added support for SSL encrypted ODBC connections.
+ <LI><B>Reauthentication Statement</B> - SET SESSION AUTHORIZATION can now be used to perform a reauthentication via JDBC or ODBC.
+</UL>
+<h2><a name="Compatibility">Compatibility Issues</a></h2>
+<ul>
+ <li>TRANSLATE/HAS CRITERIA has been deprecated. An alternative approach to update procedures will be introduced in a subsequent version.
+ <li>Support for named parameter syntax using param=value has been deprecated, since it is ambiguous with a comparison predicate boolean value expression. param<b>=></b>value should be used instead.
+ <li>Support for using the FROM clause post item hints MAKEDEP/MAKENOTDEP has been deprecated. Use the pre item comment hint syntax instead, e.g. /*+ MAKEDEP */ tbl
+</ul>
+
+<h4>from 7.3</h4>
+<ul>
+ <li>SYS.PROPERTIES has a new column, ClobValue, to get values exceeding the max string length
+ <li>SYS.COLUMNS has two new columns to get statistical information: DistinctCount and NullCount
+ <li>ARRAY_AGG is now a reserved word</li>
+ <li>The use of an IN procedure parameter with the name "source_name" in a multi-source model, will now be treated the parameter that controls which source
+ the procedure will execute against.
+ <li>Dynamic VDB functions injected via ExecutionFactory.getPushdownFunctions are now scoped to the SYS schema and have a fully qualified name that includes their source type. For example, instead of oracle_model.relate - which was only valid against the oracle_model source, there is now the SYS.oracle_sdo.relate function that is valid for all Oracle sources. Any fully-qualified reference to these functions will need updated.
+</ul>
+
+<h4>from 7.2</h4>
+<ul>
+ <li>The default JDBC credentials are user/user - not admin/teiid
+ <li>Unordered limits are no longer pushed through conditions, dup removal, or UNION not all. This prevents the possibility of getting less results than the logical intent of the limit.
+</ul>
+
+<h4>from 7.1</h4>
+<ul>
+ <li>Subqueries are no longer allowed to be SELECT INTO.
+ <li>INSERT/UPDATE/DELETE cannot be used to create implicit return cursors in non-update virtual procedures. You can instead use "UPDATE ...; SELECT VARIABLES.ROWCOUNT;".
+ <li>The SYSADMIN schema was created to hold procedures and tables that should not be generally accessible. SYS and pg_catalog are now always accessible - permissions do not apply to these schemas. The SYS.getBinaryVDBResource, SYS.getCharacterVDBResource, and SYS.getVDBResourcePaths have been replaced with the
+ SYSADMIN.VDBResources table. The Matviews table and the refreshMatView/refreshMatViewRow procedures were also moved into SYSADMIN.
+ <li>Overwriting an existing VDB will cause old connections to be terminated. Production systems should rely on VDB versioning.
+ <li>The jdbc:metamatrix JDBC URL prefix is no longer accepted. Use jdbc:teiid instead.
+ <li>Model visibility no longer restricts access to tables and procedures. Setting visible to false will only hide entries from system tables. Data roles should be used to restrict data access.
+ <li>Admin API "getWorkManagerStats" methods renamed to "getWorkerPoolStats". Also, "setRuntimeProperty" and "getProcesses" methods were removed.
+ <li>By default the "ENV" system function is now turned off. To enable it, edit the teiid-jboss-beans.xml configuration file.
+ <li>The use of VARIABLES.ROWCOUNT is now reserved.
+ <li>Exec statements of the form "var = EXEC foo()" are only valid if the procedure foo has a return parameter.
+ <li>Cache hint now supports "scope" definition. For ex: /* cache(scope:user) */ select * from T1; This hint will override the computed scope based on the query.
+</ul>
+<h4>from 7.0</h4>
+<ul>
+ <li>The term data policy was replaced with data role. The AdminAPI methods for adding role mappings have changed from addRoleToDataPolicy and removeRoleFromDataPolicy to addDataRoleMapping and removeDataRoleMapping respectively.
+</ul>
+<h4>from 6.2</h4>
+<ul>
+ <li>The connector API has changed substantially. Custom connectors need to be retargeted to the new Translator API. See <a href="https://jira.jboss.org/browse/TEIID-1003">TEIID-1003</a> and the <a href="teiid-docs/teiid_developers_guide.pdf">Developer's Guide</a> for more information.
+ <li>Connector bindings are no longer valid. Use the Designer Tooling or see the AdminShell download for a migration utility.
+ <li>Calling out to web services and xml processing has been dramatically simplified and improved, but is a breaking change from prior releases.
+ XML/Relational processing has been replaced by XMLTABLE, retrieving XML from file has been replaced by the File Translator/Resource Adapter, and
+ web service calls have been replaced by the WS Translator/Resource Adapter. See <a href="https://jira.jboss.org/browse/TEIID-1118">TEIID-1118</a>, <a href="https://jira.jboss.org/browse/TEIID-1114">TEIID-1114</a>, and the <a href="teiid-docs/teiid_reference.pdf">Reference</a> guide for more information.
+ <li>The direct usage of XQuery has been replaced with the XMLQuery function.
+ <li>The text connector file processing has been replaced with the TEXTTABLE function. See <a href="https://jira.jboss.org/browse/TEIID-1102">TEIID-1102</a> and the <a href="teiid-docs/teiid_reference.pdf">Reference</a> guide for more information
+ <li>Double quoted values are now parsed as identifiers by default. See <a href="https://jira.jboss.org/browse/TEIID-145">TEIID-145</a> and the <a href="teiid-docs/teiid_reference.pdf">Reference</a> guide for more information.
+ <li>The system information schema has changed from System to SYS. The tables and table structures have also changed. See <a href="https://jira.jboss.org/browse/TEIID-871">TEIID-871</a> and the <a href="teiid-docs/teiid_reference.pdf">Reference</a> guide for more information.
+ <li>Client control over query plans has changed. OPTION PLANONLY, DEBUG, and SHOWPLAN are no longer allowed. This behavior should not be controlled by the SET statement, SET SHOWPLAN (ON|OFF|DEBUG) and SET NOEXEC (ON|OFF). Usage of the client PlanNode class will also need to be updated.
+ <li>Teiid specific JDBC client interfaces and methods have changed. In general these custom features have mostly been moved to other more standard locations or been removed. See <a href="https://jira.jboss.org/browse/TEIID-1020">TEIID-1020</a> and the <a href="teiid-docs/teiid_client_developers_guide.pdf">Client Developers</a> guide for more information.
+ <li>Teiid's reserved words have changed. Many of the Teiid specific reserved words have become non-reserved words. All of SQL Foundation and SQL/MED 2003, and SQL/XML from SQL 2006 reserved words have been added as reserved words. It is generally required to double quote all reserved words. It is advisable to double quote all non-reserved words as well. The use of the INPUT qualifier for procedure inputs has been deprecated in favor of INPUTS. The use of the USING qualifier for dynamic SQL inputs has been deprecated in favor of DVARS.
+ <li>The AdminApi has been redesigned for use with the new Translator/JCA split and for deployment in JBoss AS.
+ <li>The AdminShell is based on Groovy. Most BeanShell syntax is also valid in Groovy, but there are extensive changes in the AdminAPI that may necessitate rewriting scripts.
+ <li>OPTION NO CACHE <table list> will now only by-pass cache for the given tables at their immediate view layer. Previously all caches would have transitively been skipped. See <a href="https://jira.jboss.org/browse/TEIID-900">TEIID-900</a> for more information.
+ <li>Nan and +-Infinity are no longer allowed as numerical results by default. This may be changed via the system property org.teiid.allowNanInfinity.
+ <li>The scale of BigDecimal values is now adjusted to allow for more intuitive results. Conversion from floating numeric types will preserve the approximate scale and division results will allow for additional scale. See <a href="https://jira.jboss.org/browse/TEIID-159">TEIID-159</a> for more information.
+ <li>The 7.0 client is not compatible with 6.x or vice versa. It is expected that 7.0 clients will be compatible with 7.x releases for standard JDBC operations.
+</ul>
+
+<h2><a name="Configuration">Configuration Issues</a></h2>
+
+See the <a href="teiid-docs/teiid_admin_guide.pdf">Admin Guide</a> for more on configuration and installation.
+
+<h4>from 7.3</h4>
+<ul>
+ <LI>The default value for the JDBC dynamic vdb importer setting importer.useFullSchemaName is now true, which matches the expected behavior from the documentation.
+ <LI>The prepared plan cache is now configured via the PreparedPlanCacheConfig bean, rather than through properties on the RuntimeEngineDeployer
+ <LI>SocketConfiguration.maxSocketThreads will interpret a setting of 0 to mean use the system default of max available processors. Both the ODBC and JDBC transports now default to the 0 setting.
+ <LI>maxReserveBatchColumns and maxProcessingBatchesColumns will interpret a setting of -1 to mean auto-calculate acceptable values given the max heap and other information. See the admin guide for more.
+ <LI>The default for org.teiid.useValueCache has changed to false, since typical installations will not greatly benefit from the additional lookup cost.
+ <LI>The property RuntimeEngineDeployer.allowFunctionCallsByDefault was added so that Teiid 7.4 behavior is compatible with Teiid 7.3. Set this property to false to require permissions for function calls when data roles are enabled.
+</ul>
+
+<h4>from 7.2</h4>
+<ul>
+ <LI>Temporary tables can now be restricted by data roles. Use the data-role attribute allow-create-temporary-tables to explicitly enable or disable the usage of temporary tables.
+There is also a allowCreateTemporaryTablesByDefault property in the teiid-jboss-beans.xml to control whether usage is allowed by default. For compatibility with prior 7.x releases, the default is to allow
+temporary table access.
+</ul>
+
+<h4>from 7.1</h4>
+<ul>
+ <li>Teiid clients now allow the usage of anonymous SSL by default.
+ This changes allows the admin port (default 31443) to use anonymous SSL by default, rather than just securing login traffic.
+ Admin clients should therefore use the mms protocol instead of mm. This will encrypt all admin traffic and ensure that any passwords in configuration files will
+ be encrypted in transit. See the Admin Guide to upgrade from anonymous SSL to 1-way or 2-way authentication.
+ The config properties sslEnabled and clientEncryptionEnabled for SSLConfiguration beans have been combined to a single property mode, that can have the values disabled|login|enabled.
+ <li>Apache CXF is now expected to be used as the web services stack provider through JBossWS-CXF. See the Admin Guide for instructions on
+ installing CXF for use with Teiid's Salesforce and web service connectors. The WS Resource Adapter's -ds.xml files should no longer use
+ WSSecurityConfigURL and WSSecurityConfigName, rather they should be ConfigFile and ConfigName respectively. The property values should no longer
+ refer to jboss-wsse-client.xml, but instead they should reference a CXF Spring configuration file and particular port configuration. See the Admin Guide
+ for more on using CXF configuration files.
+ <li>The default for data role checking is now "true". However only VDBs with data roles will have roles enforced.
+ <li>The default prepared plan cache size was increased to 512, since it is targeted by internal plans as well.
+</ul>
+
+<h4>from 7.0</h4>
+<ul>
+ <li>The property to enable data roles in teiid-jboss-beans.xml has changed from useEntitlements to useDataRoles.
+ <li>Rar file names no longer contain version numbers. -ds.xml files should be updated from connector-XXX-version.rar to teiid-connector-XXX.rar
+ <li>Code table relate configuration properties have been removed. Code tables are now implemented as materialized views.
+</ul>
+
+<h4>from 6.2</h4>
+<ul>
+ <li>A JBoss AS instance is now required. Embedded mode is also currently not supported.</li>
+ <li>Engine configuration is now handled through the admin console or deploy/teiid/teiid-jboss-beans.xml
+ <li>Logging is now done through the container's log4j instance. Any Teiid specific logging changes, see the conf/jboss-teiid-log4j.xml, need to be incorporated into the master jboss-log4j.xml.
+</ul>
+
+<h2><a name="Other">Other Issues</a></h2>
+<ul>
+ <li>TEIID-1170 - correlated subqueries are not allowed in UPDATEs or DELETEs against internal Teiid tables (internal materialized views or temporary tables).
+ <li>TEIID-1281 - Negative start indexing is not supported by DB2 and Derby databases. Usage of the Teiid SUBSTRING against these sources should not use negative start values.
+ <li>TEIID-1008 - Most versions of Oracle and MySQL do not support deeply nested correlated references. There is currently no workaround for this issue.
+ <li>For compatibility with the 7.0 release if a stored procedure parameter list begins with identifier=, then it will be parsed as a named parameter invocation even if the intent was to use a comparison predicate
+ as the first parameter value. The workaround is to use nesting parens, e.g. call proc((identifier=value), ...), which clarifies that this is positional value. This workaround will not be needed in later releases.
+ <li><a url="https://issues.jboss.org/browse/TEIID-1511">TEIID-1511<a/> - When a VDB is deployed and undeployed a socket is left open, which may lead to "too manay open files". Check the defect comments for details.
+</ul>
+<h4>from 7.0</h4>
+<ul>
+ <li>Fixed xsd type handling for SQL/XML and XML document models. xsd:date, xsd:dateTime, and xsd:time types will now all be displayed using the GMT timezone (Z). SQL types, such as timestamp, used for an XMLTABLE column will now expect their values to be in the form of the corresponding xsd type.
+</ul>
+<h4>From 6.2</h4>
+<ul>
+ <li>Start time is now significantly longer due to the container deployment. However many operations can be performed on configruation files that will trigger a redeployment without the need for a restart.
+ <li>Inversion of parse, format, and convert system functions is not used if it can be narrowing. In situations where a predicate has the form: parseTime(column, 'format') = {t 'time value'} may lead to reduced performance, since
+ the parseTime function cannot be pushed down. This should be addressed in future releases.
+</ul>
+
+<h2><a name="LibraryUpdates">Thirdparty Library Updates</a></h2>
+
+The following components have been updated:
+<h4>From 7.1</h4>
+<ul>
+ <li>json-simple 1.1 was added.
+ <li>Netty was upgraded to 3.2.1
+</ul>
+<h4>From 7.0</h4>
+<ul>
+ <li>Direct integration of JBossCache jars was removed.
+ <li>Netty was upgraded to 3.2.0
+ <li>JDOM was removed.
+</ul>
+<h4>From 6.2</h4>
+<ul>
+ <li>Netty was upgraded to 3.1.5
+ <li>Saxon was upgraded to 9.1.0.8
+ <li>A 5.1 container's version of Arjuna is newer than what was previously included in Teiid 6.x.
+ <li>Various other dependencies have been removed as they are no longer needed or now provided by the container.
+</ul>
+
+<h2><a name="Details">Detailed Release Notes</a></h2>
+ Detailed Release Notes - Teiid - Version ${project.version}
+
+<h2><a name="Documentation">Documentation and Help</a></h2>
+
+The <a href="http://www.jboss.org/teiid/">Teiid community project</a> is hosted on jboss.org.
+Documentation and help may be obtained from the local distribution under <a href="teiid-docs">teiid-docs</a> or the following locations.
+<ul>
+
+<li><a href="http://www.jboss.org/teiid/docs">Online Documentation</a></li>
+<li><a href="https://community.jboss.org/wiki/TheTeiidProject">Wiki</a></li>
+<li><a href="http://jira.jboss.org/jira/browse/TEIID">JIRA</a></li>
+<li><a href="http://community.jboss.org/en/teiid?view=discussions">Forums</a></li>
+</ul>
+
+
+<h2><a name="Licenses">Licenses</a></h2>
+
+<p>Teiid is licensed under the <a href="LICENSE-lgpl-2.1.txt">LGPL</a>. The
+license texts for Teiid and the thirdparty components it uses may be found in the <a href="teiid-docs/licenses">teiid-docs/licenses</a>
+directory of the distribution.
+
+</p>
+
+<h2><a name="About">About JBoss, a
+division of Red Hat</a></h2>
+
+<p>JBoss, a division of <a href="http://www.redhat.com/jboss/">Red
+Hat</a>, is in the business of
+providing
+superior technical support to our customers. Our goal is to make
+Professional Open Source™ the <b>SAFE
+CHOICE</b>
+for you. We accomplish this by backing up our open source Java products
+with technical support services that are delivered by the core
+developers themselves. We can help you to train your staff and provide
+you with support at every stage of the application lifecycle - from
+development and integration through deployment and maintenance. Visit
+the <a href="http://www.jboss.com/services/index">JBoss
+Services</a> page for more
+information.</p>
+
+</BODY>
+</HTML>
\ No newline at end of file
Deleted: tags/teiid-parent-7.5.0.Alpha1/build/pom.xml
===================================================================
--- trunk/build/pom.xml 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/build/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,136 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>teiid-parent</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha1-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>teiid</artifactId>
- <name>Build</name>
- <description>Teiid Build</description>
- <dependencies>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-client-jdk15</artifactId>
- <version>${version}</version>
- </dependency>
- <dependency>
- <groupId>net.sf.retrotranslator</groupId>
- <artifactId>retrotranslator-runtime</artifactId>
- <version>1.2.9</version>
- </dependency>
-
- <dependency>
- <groupId>net.sf.retrotranslator</groupId>
- <artifactId>retrotranslator-transformer</artifactId>
- <version>1.2.9</version>
- </dependency>
- </dependencies>
- <build>
- <outputDirectory>target/kits</outputDirectory>
- <resources>
- <resource>
- <directory>kits</directory>
- <filtering>true</filtering>
- <includes>
- <include>**/*.xml</include>
- <include>**/*.properties</include>
- <include>**/*.sh</include>
- <include>**/*.bat</include>
- <include>**/*.html</include>
- </includes>
- </resource>
- <resource>
- <directory>kits</directory>
- <filtering>false</filtering>
- <excludes>
- <exclude>**/*.xml</exclude>
- <exclude>**/*.properties</exclude>
- <exclude>**/*.sh</exclude>
- <exclude>**/*.bat</exclude>
- <exclude>**/*.html</exclude>
- </excludes>
- </resource>
- </resources>
- <pluginManagement>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- </plugin>
- </plugins>
- </pluginManagement>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
-
- <configuration>
- <descriptors>
- <descriptor>assembly/client-jar.xml</descriptor>
- <descriptor>assembly/jboss-container/dist.xml</descriptor>
- <descriptor>assembly/adminshell/adminshell-dist.xml</descriptor>
- </descriptors>
- </configuration>
-
- <executions>
- <execution>
- <id>create-assemblies</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
- <profiles>
- <profile>
- <!--
- This profile is activated manually, as in "mvn ... -P release ..."
- -->
- <id>release</id>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <descriptors>
- <descriptor>assembly/src.xml</descriptor>
- <descriptor>assembly/docs.xml</descriptor>
- <descriptor>assembly/client-jar.xml</descriptor>
- <descriptor>assembly/jboss-container/dist.xml</descriptor>
- <descriptor>assembly/adminshell/adminshell-dist.xml</descriptor>
- </descriptors>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <version>1.1.1</version>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>java</goal>
- </goals>
- <configuration>
- <mainClass>net.sf.retrotranslator.transformer.Retrotranslator</mainClass>
- <arguments>
- <argument>-srcjar</argument>
- <argument>${pom.basedir}/target/teiid-${pom.version}-client.jar</argument>
- <argument>-destjar</argument>
- <argument>${pom.basedir}/target/teiid-${pom.version}-client-jdk15.jar</argument>
- <argument>-embed</argument>
- <argument>org.teiid.retroruntime</argument>
- </arguments>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.5.0.Alpha1/build/pom.xml (from rev 3220, trunk/build/pom.xml)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/build/pom.xml (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/build/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,136 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>teiid-parent</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.5.0.Alpha1</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>teiid</artifactId>
+ <name>Build</name>
+ <description>Teiid Build</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-client-jdk15</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.retrotranslator</groupId>
+ <artifactId>retrotranslator-runtime</artifactId>
+ <version>1.2.9</version>
+ </dependency>
+
+ <dependency>
+ <groupId>net.sf.retrotranslator</groupId>
+ <artifactId>retrotranslator-transformer</artifactId>
+ <version>1.2.9</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <outputDirectory>target/kits</outputDirectory>
+ <resources>
+ <resource>
+ <directory>kits</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*.xml</include>
+ <include>**/*.properties</include>
+ <include>**/*.sh</include>
+ <include>**/*.bat</include>
+ <include>**/*.html</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>kits</directory>
+ <filtering>false</filtering>
+ <excludes>
+ <exclude>**/*.xml</exclude>
+ <exclude>**/*.properties</exclude>
+ <exclude>**/*.sh</exclude>
+ <exclude>**/*.bat</exclude>
+ <exclude>**/*.html</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+
+ <configuration>
+ <descriptors>
+ <descriptor>assembly/client-jar.xml</descriptor>
+ <descriptor>assembly/jboss-container/dist.xml</descriptor>
+ <descriptor>assembly/adminshell/adminshell-dist.xml</descriptor>
+ </descriptors>
+ </configuration>
+
+ <executions>
+ <execution>
+ <id>create-assemblies</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <!--
+ This profile is activated manually, as in "mvn ... -P release ..."
+ -->
+ <id>release</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptors>
+ <descriptor>assembly/src.xml</descriptor>
+ <descriptor>assembly/docs.xml</descriptor>
+ <descriptor>assembly/client-jar.xml</descriptor>
+ <descriptor>assembly/jboss-container/dist.xml</descriptor>
+ <descriptor>assembly/adminshell/adminshell-dist.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.1.1</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ <configuration>
+ <mainClass>net.sf.retrotranslator.transformer.Retrotranslator</mainClass>
+ <arguments>
+ <argument>-srcjar</argument>
+ <argument>${pom.basedir}/target/teiid-${pom.version}-client.jar</argument>
+ <argument>-destjar</argument>
+ <argument>${pom.basedir}/target/teiid-${pom.version}-client-jdk15.jar</argument>
+ <argument>-embed</argument>
+ <argument>org.teiid.retroruntime</argument>
+ </arguments>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.5.0.Alpha1/cache-jbosscache/pom.xml
===================================================================
--- trunk/cache-jbosscache/pom.xml 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/cache-jbosscache/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>teiid-parent</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha1-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>teiid-cache-jbosscache</artifactId>
- <name>JBoss Cache</name>
- <description>JBossCache provider.</description>
- <dependencies>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-engine</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.cache</groupId>
- <artifactId>jbosscache-core</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.man</groupId>
- <artifactId>jboss-managed</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.5.0.Alpha1/cache-jbosscache/pom.xml (from rev 3220, trunk/cache-jbosscache/pom.xml)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/cache-jbosscache/pom.xml (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/cache-jbosscache/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>teiid-parent</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.5.0.Alpha1</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>teiid-cache-jbosscache</artifactId>
+ <name>JBoss Cache</name>
+ <description>JBossCache provider.</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-engine</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.cache</groupId>
+ <artifactId>jbosscache-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-managed</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.5.0.Alpha1/cache-jbosscache/src/main/java/org/teiid/events/jboss/JGroupsEventDistributor.java
===================================================================
--- trunk/cache-jbosscache/src/main/java/org/teiid/events/jboss/JGroupsEventDistributor.java 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/cache-jbosscache/src/main/java/org/teiid/events/jboss/JGroupsEventDistributor.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,173 +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.events.jboss;
-
-import java.io.Serializable;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.Vector;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import org.jboss.util.naming.Util;
-import org.jgroups.Address;
-import org.jgroups.Channel;
-import org.jgroups.JChannelFactory;
-import org.jgroups.ReceiverAdapter;
-import org.jgroups.View;
-import org.jgroups.blocks.GroupRequest;
-import org.jgroups.blocks.MethodCall;
-import org.jgroups.blocks.RpcDispatcher;
-import org.teiid.events.EventDistributor;
-
-public class JGroupsEventDistributor extends ReceiverAdapter implements Serializable {
-
- private static final long serialVersionUID = -1140683411842561358L;
-
- private transient JChannelFactory channelFactory;
- private String multiplexerStack;
- private String clusterName;
- private String jndiName;
- private String localEventDistributorName;
-
- private transient EventDistributor proxyEventDistributor;
- private transient EventDistributor localEventDistributor;
-
- private transient Channel channel;
- private transient RpcDispatcher rpcDispatcher;
- private transient Vector<Address> members;
-
- public JChannelFactory getChannelFactory() {
- return channelFactory;
- }
-
- public void setJndiName(String jndiName) {
- this.jndiName = jndiName;
- }
-
- public String getJndiName() {
- return jndiName;
- }
-
- public String getLocalEventDistributorName() {
- return localEventDistributorName;
- }
-
- public void setLocalEventDistributorName(String localEventDistributorName) {
- this.localEventDistributorName = localEventDistributorName;
- }
-
- public String getMultiplexerStack() {
- return multiplexerStack;
- }
-
- public String getClusterName() {
- return clusterName;
- }
-
- public void setChannelFactory(JChannelFactory channelFactory) {
- this.channelFactory = channelFactory;
- }
-
- public void setClusterName(String clusterName) {
- this.clusterName = clusterName;
- }
-
- public void setMultiplexerStack(String multiplexerStack) {
- this.multiplexerStack = multiplexerStack;
- }
-
- public void start() throws Exception {
- if (this.channelFactory == null) {
- return; //no need to distribute events
- }
- channel = this.channelFactory.createMultiplexerChannel(this.multiplexerStack, null);
- channel.connect(this.clusterName);
-
- proxyEventDistributor = (EventDistributor) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {EventDistributor.class}, new InvocationHandler() {
-
- @Override
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable {
- rpcDispatcher.callRemoteMethods(members, new MethodCall(method, args), GroupRequest.GET_NONE, 0);
- return null;
- }
- });
- //wrap the local in a proxy to prevent unintended methods from being called
- rpcDispatcher = new RpcDispatcher(channel, this, this, Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {EventDistributor.class}, new InvocationHandler() {
-
- @Override
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable {
- EventDistributor local = getLocalEventDistributor();
- if (local == null) {
- return null;
- }
- return method.invoke(local, args);
- }
- }));
- rpcDispatcher.setDeadlockDetection(false);
- if (jndiName != null) {
- final InitialContext ic = new InitialContext();
- Util.bind(ic, jndiName, proxyEventDistributor);
- }
- }
-
- private EventDistributor getLocalEventDistributor() {
- if (localEventDistributor == null && this.localEventDistributorName != null) {
- try {
- Context ctx = new InitialContext();
- return (EventDistributor) ctx.lookup(this.localEventDistributorName);
- } catch (NamingException e) {
- return null;
- }
- }
- return localEventDistributor;
- }
-
- @Override
- public void viewAccepted(View newView) {
- Vector<Address> new_members = new Vector<Address>(newView.getMembers());
- new_members.remove(this.channel.getLocalAddress());
- this.members = new_members;
- }
-
- public void stop() {
- if (jndiName != null) {
- final InitialContext ic ;
- try {
- ic = new InitialContext() ;
- Util.unbind(ic, jndiName) ;
- } catch (final NamingException ne) {
- }
- }
- if (this.channel != null) {
- this.channel.close();
- this.rpcDispatcher.stop();
- }
- }
-
-}
Copied: tags/teiid-parent-7.5.0.Alpha1/cache-jbosscache/src/main/java/org/teiid/events/jboss/JGroupsEventDistributor.java (from rev 3218, trunk/cache-jbosscache/src/main/java/org/teiid/events/jboss/JGroupsEventDistributor.java)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/cache-jbosscache/src/main/java/org/teiid/events/jboss/JGroupsEventDistributor.java (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/cache-jbosscache/src/main/java/org/teiid/events/jboss/JGroupsEventDistributor.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,178 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License 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.events.jboss;
+
+import java.io.Serializable;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.Vector;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.util.naming.Util;
+import org.jgroups.Address;
+import org.jgroups.Channel;
+import org.jgroups.ChannelFactory;
+import org.jgroups.ReceiverAdapter;
+import org.jgroups.View;
+import org.jgroups.blocks.GroupRequest;
+import org.jgroups.blocks.MethodCall;
+import org.jgroups.blocks.RpcDispatcher;
+import org.teiid.events.EventDistributor;
+
+public class JGroupsEventDistributor extends ReceiverAdapter implements Serializable {
+
+ private final class ProxyHandler implements InvocationHandler, Serializable {
+ private static final long serialVersionUID = 3879554695890338832L;
+
+ @Override
+ public Object invoke(Object proxy, Method method, Object[] args)
+ throws Throwable {
+ rpcDispatcher.callRemoteMethods(members, new MethodCall(method, args), GroupRequest.GET_NONE, 0);
+ return null;
+ }
+ }
+
+ private static final long serialVersionUID = -1140683411842561358L;
+
+ private transient ChannelFactory channelFactory;
+ private String multiplexerStack;
+ private String clusterName;
+ private String jndiName;
+ private String localEventDistributorName;
+
+ private transient EventDistributor proxyEventDistributor;
+ private transient EventDistributor localEventDistributor;
+
+ private transient Channel channel;
+ private transient RpcDispatcher rpcDispatcher;
+ private transient Vector<Address> members;
+
+ public ChannelFactory getChannelFactory() {
+ return channelFactory;
+ }
+
+ public void setJndiName(String jndiName) {
+ this.jndiName = jndiName;
+ }
+
+ public String getJndiName() {
+ return jndiName;
+ }
+
+ public String getLocalEventDistributorName() {
+ return localEventDistributorName;
+ }
+
+ public void setLocalEventDistributorName(String localEventDistributorName) {
+ this.localEventDistributorName = localEventDistributorName;
+ }
+
+ public String getMultiplexerStack() {
+ return multiplexerStack;
+ }
+
+ public String getClusterName() {
+ return clusterName;
+ }
+
+ public void setChannelFactory(ChannelFactory channelFactory) {
+ this.channelFactory = channelFactory;
+ }
+
+ public void setClusterName(String clusterName) {
+ this.clusterName = clusterName;
+ }
+
+ public void setMultiplexerStack(String multiplexerStack) {
+ this.multiplexerStack = multiplexerStack;
+ }
+
+ public void start() throws Exception {
+ if (this.channelFactory == null) {
+ return; //no need to distribute events
+ }
+ channel = this.channelFactory.createMultiplexerChannel(this.multiplexerStack, "teiid-events"); //$NON-NLS-1$
+ channel.connect(this.clusterName);
+ if (channel.getView() != null) {
+ viewAccepted(channel.getView());
+ }
+ proxyEventDistributor = (EventDistributor) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {EventDistributor.class}, new ProxyHandler());
+ //wrap the local in a proxy to prevent unintended methods from being called
+ rpcDispatcher = new RpcDispatcher(channel, this, this, Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {EventDistributor.class}, new InvocationHandler() {
+
+ @Override
+ public Object invoke(Object proxy, Method method, Object[] args)
+ throws Throwable {
+ EventDistributor local = getLocalEventDistributor();
+ if (local == null) {
+ return null;
+ }
+ return method.invoke(local, args);
+ }
+ }));
+ rpcDispatcher.setDeadlockDetection(false);
+ if (jndiName != null) {
+ final InitialContext ic = new InitialContext();
+ Util.bind(ic, jndiName, proxyEventDistributor);
+ }
+ }
+
+ private EventDistributor getLocalEventDistributor() {
+ if (localEventDistributor == null && this.localEventDistributorName != null) {
+ try {
+ Context ctx = new InitialContext();
+ return (EventDistributor) ctx.lookup(this.localEventDistributorName);
+ } catch (NamingException e) {
+ return null;
+ }
+ }
+ return localEventDistributor;
+ }
+
+ @Override
+ public void viewAccepted(View newView) {
+ Vector<Address> new_members = new Vector<Address>(newView.getMembers());
+ new_members.remove(this.channel.getLocalAddress());
+ this.members = new_members;
+ }
+
+ public void stop() {
+ if (jndiName != null) {
+ final InitialContext ic ;
+ try {
+ ic = new InitialContext() ;
+ Util.unbind(ic, jndiName) ;
+ } catch (final NamingException ne) {
+ }
+ }
+ if (this.channel != null) {
+ this.channel.close();
+ this.rpcDispatcher.stop();
+ }
+ }
+
+}
Deleted: tags/teiid-parent-7.5.0.Alpha1/client/pom.xml
===================================================================
--- trunk/client/pom.xml 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/client/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>teiid-parent</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha1-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>teiid-client</artifactId>
- <name>Client</name>
- <description>Contains the packages related to communication, administrative api,
- sessioning and transport level messaging.</description>
- <dependencies>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <type>test-jar</type>
- </dependency>
- <dependency>
- <groupId>org.jboss.man</groupId>
- <artifactId>jboss-managed</artifactId>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.5.0.Alpha1/client/pom.xml (from rev 3220, trunk/client/pom.xml)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/client/pom.xml (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/client/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>teiid-parent</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.5.0.Alpha1</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>teiid-client</artifactId>
+ <name>Client</name>
+ <description>Contains the packages related to communication, administrative api,
+ sessioning and transport level messaging.</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <type>test-jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-managed</artifactId>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/adminapi/Session.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/Session.java 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/adminapi/Session.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,105 +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.adminapi;
-
-
-/**
- * A Session is a lasting connection between a client and a Teiid System.
- *
- * A user may be allowed to have multiple sessions active simultaneously.
- *
- */
-public interface Session extends AdminObject {
-
- /**
- * Get the Last time Client has check to see if the server is still available
- *
- * @return Date of the last ping to the server.
- */
- public long getLastPingTime();
-
-
- /**
- * Get the Application Name
- *
- * @return String of the Application Name
- */
- public String getApplicationName();
-
- /**
- * Get the unique Teiid session
- * within a given Teiid System
- *
- * @return String of the Session ID
- */
- public String getSessionId();
-
- /**
- * Get User Name for this Session
- *
- * @return String of UserName
- */
- public String getUserName();
-
- /**
- * Get the VDB Name for this Session
- *
- * @return String name of the VDB
- */
- public String getVDBName();
-
- /**
- * Get the VDB Version for this Session
- *
- * @return String name/number of the VDB Version
- */
- public int getVDBVersion();
-
- /**
- * Get the IPAddress for this Session. Note this value is reported from the client.
- * @return
- */
- public String getIPAddress();
-
-
- /**
- * Get the host name of the machine the client is
- * accessing from. Note this value is reported from the client.
- * @return
- */
- public String getClientHostName();
-
- /**
- * Get the time the {@link Session} was created.
- * @return
- */
- public long getCreatedTime();
-
-
- /**
- * Security Domain user logged into currently
- * @return
- */
- public String getSecurityDomain();
-
-}
\ No newline at end of file
Copied: tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/adminapi/Session.java (from rev 3218, trunk/client/src/main/java/org/teiid/adminapi/Session.java)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/adminapi/Session.java (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/adminapi/Session.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License 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.adminapi;
+
+
+/**
+ * A Session represents a single connection between a client and the server.
+ *
+ * A user is allowed to have multiple sessions active simultaneously.
+ */
+public interface Session extends AdminObject {
+
+ /**
+ * Get the Last time Client has check to see if the server is still available
+ *
+ * @return Date of the last ping to the server.
+ */
+ public long getLastPingTime();
+
+
+ /**
+ * Get the Application Name
+ *
+ * @return String of the Application Name
+ */
+ public String getApplicationName();
+
+ /**
+ * Get the unique Teiid session
+ * within a given Teiid System
+ *
+ * @return String of the Session ID
+ */
+ public String getSessionId();
+
+ /**
+ * Get User Name for this Session
+ *
+ * @return String of UserName
+ */
+ public String getUserName();
+
+ /**
+ * Get the VDB Name for this Session
+ *
+ * @return String name of the VDB
+ */
+ public String getVDBName();
+
+ /**
+ * Get the VDB Version for this Session
+ *
+ * @return String name/number of the VDB Version
+ */
+ public int getVDBVersion();
+
+ /**
+ * Get the IPAddress for this Session. Note this value is reported from the client.
+ * @return
+ */
+ public String getIPAddress();
+
+
+ /**
+ * Get the host name of the machine the client is
+ * accessing from. Note this value is reported from the client.
+ * @return
+ */
+ public String getClientHostName();
+
+ /**
+ * Get the client hardware (typically MAC) address. Note this value is reported from the client.
+ * @return the hardware address as a hex string or null if not available.
+ */
+ public String getClientHardwareAddress();
+
+ /**
+ * Get the time the {@link Session} was created.
+ * @return
+ */
+ public long getCreatedTime();
+
+
+ /**
+ * Security Domain user logged into currently
+ * @return
+ */
+ public String getSecurityDomain();
+
+}
\ No newline at end of file
Deleted: tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,221 +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.adminapi.impl;
-
-import java.util.Date;
-
-import javax.security.auth.Subject;
-import javax.security.auth.login.LoginContext;
-
-import org.jboss.managed.api.annotation.ManagementProperty;
-import org.jboss.metatype.api.annotations.MetaMapping;
-import org.teiid.adminapi.Session;
-import org.teiid.client.security.SessionToken;
-
-
-
-/**
- * Add and delete properties also in the Mapper class for correct wrapping for profile service.
- */
-(a)MetaMapping(SessionMetadataMapper.class)
-public class SessionMetadata extends AdminObjectImpl implements Session {
-
- private static final long serialVersionUID = 918638989081830034L;
- private String applicationName;
- private long lastPingTime = System.currentTimeMillis();
- private long createdTime;
- private String ipAddress;
- private String clientHostName;
- private String userName;
- private String vdbName;
- private int vdbVersion;
- private String sessionId;
- private String securityDomain;
-
- //server session state
- private transient VDBMetaData vdb;
- private transient SessionToken sessionToken;
- private transient LoginContext loginContext;
- private transient Object securityContext;
- private transient boolean embedded;
-
- @Override
- @ManagementProperty(description="Application assosiated with Session", readOnly=true)
- public String getApplicationName() {
- return this.applicationName;
- }
-
- public void setApplicationName(String applicationName) {
- this.applicationName = applicationName;
- }
-
- @Override
- @ManagementProperty(description="When session created", readOnly=true)
- public long getCreatedTime() {
- return this.createdTime;
- }
-
- public void setCreatedTime(long createdTime) {
- this.createdTime = createdTime;
- }
-
- @Override
- @ManagementProperty(description="Host name from where the session created", readOnly=true)
- public String getClientHostName() {
- return this.clientHostName;
- }
-
- public void setClientHostName(String clientHostname) {
- this.clientHostName = clientHostname;
- }
-
- @Override
- @ManagementProperty(description="IP address from where session is created", readOnly=true)
- public String getIPAddress() {
- return this.ipAddress;
- }
-
- public void setIPAddress(String ipAddress) {
- this.ipAddress = ipAddress;
- }
-
- @Override
- @ManagementProperty(description="Last ping time", readOnly=true)
- public long getLastPingTime() {
- return this.lastPingTime;
- }
-
- public void setLastPingTime(long lastPingTime) {
- this.lastPingTime = lastPingTime;
- }
-
- @Override
- @ManagementProperty(description="Session ID", readOnly=true)
- public String getSessionId() {
- return this.sessionId;
- }
-
- public void setSessionId(String sessionId) {
- this.sessionId = sessionId;
- }
-
- @Override
- @ManagementProperty(description="User name assosiated with session", readOnly=true)
- public String getUserName() {
- return this.userName;
- }
-
- public void setUserName(String userName) {
- this.userName = userName;
- }
-
- @Override
- @ManagementProperty(description="VDB name assosiated with session", readOnly=true)
- public String getVDBName() {
- return this.vdbName;
- }
-
- public void setVDBName(String vdbName) {
- this.vdbName = vdbName;
- }
-
- @Override
- @ManagementProperty(description="VDB version name assosiated with session", readOnly=true)
- public int getVDBVersion() {
- return this.vdbVersion;
- }
-
- public void setVDBVersion(int vdbVersion) {
- this.vdbVersion = vdbVersion;
- }
-
- @Override
- @ManagementProperty(description="Security Domain that session logged into", readOnly=true)
- public String getSecurityDomain() {
- return this.securityDomain;
- }
-
- public void setSecurityDomain(String domain) {
- this.securityDomain = domain;
- }
-
- @SuppressWarnings("nls")
- public String toString() {
- StringBuilder str = new StringBuilder();
- str.append("session: sessionid=").append(sessionId);
- str.append("; userName=").append(userName);
- str.append("; vdbName=").append(vdbName);
- str.append("; vdbVersion=").append(vdbVersion);
- str.append("; createdTime=").append(new Date(createdTime));
- str.append("; applicationName=").append(applicationName);
- str.append("; clientHostName=").append(clientHostName);
- str.append("; IPAddress=").append(ipAddress);
- str.append("; securityDomain=").append(securityDomain);
- str.append("; lastPingTime=").append(new Date(lastPingTime));
- return str.toString();
- }
-
- public VDBMetaData getVdb() {
- return vdb;
- }
-
- public void setVdb(VDBMetaData vdb) {
- this.vdb = vdb;
- }
-
- public SessionToken getSessionToken() {
- return sessionToken;
- }
-
- public void setSessionToken(SessionToken sessionToken) {
- this.sessionToken = sessionToken;
- }
-
- public LoginContext getLoginContext() {
- return loginContext;
- }
-
- public void setLoginContext(LoginContext loginContext) {
- this.loginContext = loginContext;
- }
-
- public Object getSecurityContext() {
- return securityContext;
- }
-
- public void setSecurityContext(Object securityContext) {
- this.securityContext = securityContext;
- }
-
- public Subject getSubject() {
- return this.loginContext.getSubject();
- }
-
- public void setEmbedded(boolean embedded) {
- this.embedded = embedded;
- }
-
- public boolean isEmbedded() {
- return embedded;
- }
-
-}
Copied: tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java (from rev 3218, trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/adminapi/impl/SessionMetadata.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,236 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License 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.adminapi.impl;
+
+import java.util.Date;
+
+import javax.security.auth.Subject;
+import javax.security.auth.login.LoginContext;
+
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.jboss.metatype.api.annotations.MetaMapping;
+import org.teiid.adminapi.Session;
+import org.teiid.client.security.SessionToken;
+
+
+
+/**
+ * Add and delete properties also in the Mapper class for correct wrapping for profile service.
+ *
+ */
+/* TODO: it would probably be good to let ipAddress denote the connecting address
+ and add clientIpAdress as the client reported value */
+(a)MetaMapping(SessionMetadataMapper.class)
+public class SessionMetadata extends AdminObjectImpl implements Session {
+
+ private static final long serialVersionUID = 918638989081830034L;
+ private String applicationName;
+ private long lastPingTime = System.currentTimeMillis();
+ private long createdTime;
+ private String ipAddress;
+ private String clientHostName;
+ private String clientHardwareAddress;
+ private String userName;
+ private String vdbName;
+ private int vdbVersion;
+ private String sessionId;
+ private String securityDomain;
+
+ //server session state
+ private transient VDBMetaData vdb;
+ private transient SessionToken sessionToken;
+ private transient LoginContext loginContext;
+ private transient Object securityContext;
+ private transient boolean embedded;
+
+ @Override
+ @ManagementProperty(description="Application associated with Session", readOnly=true)
+ public String getApplicationName() {
+ return this.applicationName;
+ }
+
+ public void setApplicationName(String applicationName) {
+ this.applicationName = applicationName;
+ }
+
+ @Override
+ @ManagementProperty(description="When session created", readOnly=true)
+ public long getCreatedTime() {
+ return this.createdTime;
+ }
+
+ public void setCreatedTime(long createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ @Override
+ @ManagementProperty(description="Host name from where the session created", readOnly=true)
+ public String getClientHostName() {
+ return this.clientHostName;
+ }
+
+ public void setClientHostName(String clientHostname) {
+ this.clientHostName = clientHostname;
+ }
+
+ @Override
+ @ManagementProperty(description="IP address of session client", readOnly=true)
+ public String getIPAddress() {
+ return this.ipAddress;
+ }
+
+ public void setIPAddress(String ipAddress) {
+ this.ipAddress = ipAddress;
+ }
+
+ @Override
+ @ManagementProperty(description="Last ping time", readOnly=true)
+ public long getLastPingTime() {
+ return this.lastPingTime;
+ }
+
+ public void setLastPingTime(long lastPingTime) {
+ this.lastPingTime = lastPingTime;
+ }
+
+ @Override
+ @ManagementProperty(description="Session ID", readOnly=true)
+ public String getSessionId() {
+ return this.sessionId;
+ }
+
+ public void setSessionId(String sessionId) {
+ this.sessionId = sessionId;
+ }
+
+ @Override
+ @ManagementProperty(description="User name associated with session", readOnly=true)
+ public String getUserName() {
+ return this.userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ @Override
+ @ManagementProperty(description="VDB name associated with session", readOnly=true)
+ public String getVDBName() {
+ return this.vdbName;
+ }
+
+ public void setVDBName(String vdbName) {
+ this.vdbName = vdbName;
+ }
+
+ @Override
+ @ManagementProperty(description="VDB version name associated with session", readOnly=true)
+ public int getVDBVersion() {
+ return this.vdbVersion;
+ }
+
+ public void setVDBVersion(int vdbVersion) {
+ this.vdbVersion = vdbVersion;
+ }
+
+ @Override
+ @ManagementProperty(description="Security Domain that session logged into", readOnly=true)
+ public String getSecurityDomain() {
+ return this.securityDomain;
+ }
+
+ public void setSecurityDomain(String domain) {
+ this.securityDomain = domain;
+ }
+
+ @SuppressWarnings("nls")
+ public String toString() {
+ StringBuilder str = new StringBuilder();
+ str.append("session: sessionid=").append(sessionId);
+ str.append("; userName=").append(userName);
+ str.append("; vdbName=").append(vdbName);
+ str.append("; vdbVersion=").append(vdbVersion);
+ str.append("; createdTime=").append(new Date(createdTime));
+ str.append("; applicationName=").append(applicationName);
+ str.append("; clientHostName=").append(clientHostName);
+ str.append("; clientHardwareAddress=").append(clientHardwareAddress);
+ str.append("; IPAddress=").append(ipAddress);
+ str.append("; securityDomain=").append(securityDomain);
+ str.append("; lastPingTime=").append(new Date(lastPingTime));
+ return str.toString();
+ }
+
+ public VDBMetaData getVdb() {
+ return vdb;
+ }
+
+ public void setVdb(VDBMetaData vdb) {
+ this.vdb = vdb;
+ }
+
+ public SessionToken getSessionToken() {
+ return sessionToken;
+ }
+
+ public void setSessionToken(SessionToken sessionToken) {
+ this.sessionToken = sessionToken;
+ }
+
+ public LoginContext getLoginContext() {
+ return loginContext;
+ }
+
+ public void setLoginContext(LoginContext loginContext) {
+ this.loginContext = loginContext;
+ }
+
+ public Object getSecurityContext() {
+ return securityContext;
+ }
+
+ public void setSecurityContext(Object securityContext) {
+ this.securityContext = securityContext;
+ }
+
+ public Subject getSubject() {
+ return this.loginContext.getSubject();
+ }
+
+ public void setEmbedded(boolean embedded) {
+ this.embedded = embedded;
+ }
+
+ public boolean isEmbedded() {
+ return embedded;
+ }
+
+ @Override
+ @ManagementProperty(description="Hardware address reported by the client", readOnly=true)
+ public String getClientHardwareAddress() {
+ return this.clientHardwareAddress;
+ }
+
+ public void setClientHardwareAddress(String clientHardwareAddress) {
+ this.clientHardwareAddress = clientHardwareAddress;
+ }
+
+}
Deleted: tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,124 +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.adminapi.impl;
-
-import java.lang.reflect.Type;
-
-import org.jboss.metatype.api.types.CompositeMetaType;
-import org.jboss.metatype.api.types.MetaType;
-import org.jboss.metatype.api.types.SimpleMetaType;
-import org.jboss.metatype.api.values.CompositeValue;
-import org.jboss.metatype.api.values.CompositeValueSupport;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.metatype.api.values.MetaValueFactory;
-import org.jboss.metatype.api.values.SimpleValueSupport;
-import org.jboss.metatype.plugins.types.MutableCompositeMetaType;
-import org.jboss.metatype.spi.values.MetaMapper;
-
-public class SessionMetadataMapper extends MetaMapper<SessionMetadata> {
- private static final String SECURITY_DOMAIN = "securityDomain"; //$NON-NLS-1$
- private static final String VDB_VERSION = "VDBVersion"; //$NON-NLS-1$
- private static final String VDB_NAME = "VDBName"; //$NON-NLS-1$
- private static final String USER_NAME = "userName"; //$NON-NLS-1$
- private static final String SESSION_ID = "sessionId"; //$NON-NLS-1$
- private static final String LAST_PING_TIME = "lastPingTime"; //$NON-NLS-1$
- private static final String IP_ADDRESS = "IPAddress"; //$NON-NLS-1$
- private static final String CLIENT_HOST_NAME = "clientHostName"; //$NON-NLS-1$
- private static final String CREATED_TIME = "createdTime"; //$NON-NLS-1$
- private static final String APPLICATION_NAME = "applicationName"; //$NON-NLS-1$
- private static final MutableCompositeMetaType metaType;
- private static final MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
-
- static {
- metaType = new MutableCompositeMetaType(SessionMetadata.class.getName(), "The Session domain meta data"); //$NON-NLS-1$
- metaType.addItem(APPLICATION_NAME, APPLICATION_NAME, SimpleMetaType.STRING);
- metaType.addItem(CREATED_TIME, CREATED_TIME, SimpleMetaType.LONG_PRIMITIVE);
- metaType.addItem(CLIENT_HOST_NAME, CLIENT_HOST_NAME, SimpleMetaType.STRING);
- metaType.addItem(IP_ADDRESS, IP_ADDRESS, SimpleMetaType.STRING);
- metaType.addItem(LAST_PING_TIME, LAST_PING_TIME, SimpleMetaType.LONG_PRIMITIVE);
- metaType.addItem(SESSION_ID, SESSION_ID, SimpleMetaType.STRING);
- metaType.addItem(USER_NAME, USER_NAME, SimpleMetaType.STRING);
- metaType.addItem(VDB_NAME, VDB_NAME, SimpleMetaType.STRING);
- metaType.addItem(VDB_VERSION, VDB_VERSION, SimpleMetaType.INTEGER_PRIMITIVE);
- metaType.addItem(SECURITY_DOMAIN, SECURITY_DOMAIN, SimpleMetaType.STRING);
- metaType.freeze();
- }
-
- @Override
- public Type mapToType() {
- return SessionMetadata.class;
- }
-
- @Override
- public MetaType getMetaType() {
- return metaType;
- }
-
- @Override
- public MetaValue createMetaValue(MetaType metaType, SessionMetadata object) {
- if (object == null)
- return null;
- if (metaType instanceof CompositeMetaType) {
- CompositeMetaType composite = (CompositeMetaType) metaType;
- CompositeValueSupport session = new CompositeValueSupport(composite);
-
- session.set(APPLICATION_NAME, SimpleValueSupport.wrap(object.getApplicationName()));
- session.set(CREATED_TIME, SimpleValueSupport.wrap(object.getCreatedTime()));
- session.set(CLIENT_HOST_NAME, SimpleValueSupport.wrap(object.getClientHostName()));
- session.set(IP_ADDRESS, SimpleValueSupport.wrap(object.getIPAddress()));
- session.set(LAST_PING_TIME, SimpleValueSupport.wrap(object.getLastPingTime()));
- session.set(SESSION_ID, SimpleValueSupport.wrap(object.getSessionId()));
- session.set(USER_NAME, SimpleValueSupport.wrap(object.getUserName()));
- session.set(VDB_NAME,SimpleValueSupport.wrap(object.getVDBName()));
- session.set(VDB_VERSION, SimpleValueSupport.wrap(object.getVDBVersion()));
- session.set(SECURITY_DOMAIN, SimpleValueSupport.wrap(object.getSecurityDomain()));
-
- return session;
- }
- throw new IllegalArgumentException("Cannot convert session " + object); //$NON-NLS-1$
- }
-
- @Override
- public SessionMetadata unwrapMetaValue(MetaValue metaValue) {
- if (metaValue == null)
- return null;
-
- if (metaValue instanceof CompositeValue) {
- CompositeValue compositeValue = (CompositeValue) metaValue;
-
- SessionMetadata session = new SessionMetadata();
- session.setApplicationName((String) metaValueFactory.unwrap(compositeValue.get(APPLICATION_NAME)));
- session.setCreatedTime((Long) metaValueFactory.unwrap(compositeValue.get(CREATED_TIME)));
- session.setClientHostName((String) metaValueFactory.unwrap(compositeValue.get(CLIENT_HOST_NAME)));
- session.setIPAddress((String) metaValueFactory.unwrap(compositeValue.get(IP_ADDRESS)));
- session.setLastPingTime((Long) metaValueFactory.unwrap(compositeValue.get(LAST_PING_TIME)));
- session.setSessionId((String) metaValueFactory.unwrap(compositeValue.get(SESSION_ID)));
- session.setUserName((String) metaValueFactory.unwrap(compositeValue.get(USER_NAME)));
- session.setVDBName((String) metaValueFactory.unwrap(compositeValue.get(VDB_NAME)));
- session.setVDBVersion((Integer) metaValueFactory.unwrap(compositeValue.get(VDB_VERSION)));
- session.setSecurityDomain((String) metaValueFactory.unwrap(compositeValue.get(SECURITY_DOMAIN)));
- return session;
- }
- throw new IllegalStateException("Unable to unwrap session " + metaValue); //$NON-NLS-1$
- }
-
-}
Copied: tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java (from rev 3218, trunk/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,127 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License 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.adminapi.impl;
+
+import java.lang.reflect.Type;
+
+import org.jboss.metatype.api.types.CompositeMetaType;
+import org.jboss.metatype.api.types.MetaType;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.CompositeValue;
+import org.jboss.metatype.api.values.CompositeValueSupport;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.MetaValueFactory;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.metatype.plugins.types.MutableCompositeMetaType;
+import org.jboss.metatype.spi.values.MetaMapper;
+
+public class SessionMetadataMapper extends MetaMapper<SessionMetadata> {
+ private static final String SECURITY_DOMAIN = "securityDomain"; //$NON-NLS-1$
+ private static final String VDB_VERSION = "VDBVersion"; //$NON-NLS-1$
+ private static final String VDB_NAME = "VDBName"; //$NON-NLS-1$
+ private static final String USER_NAME = "userName"; //$NON-NLS-1$
+ private static final String SESSION_ID = "sessionId"; //$NON-NLS-1$
+ private static final String LAST_PING_TIME = "lastPingTime"; //$NON-NLS-1$
+ private static final String IP_ADDRESS = "IPAddress"; //$NON-NLS-1$
+ private static final String CLIENT_HOST_NAME = "clientHostName"; //$NON-NLS-1$
+ private static final String CLIENT_MAC = "clientMAC"; //$NON-NLS-1$
+ private static final String CREATED_TIME = "createdTime"; //$NON-NLS-1$
+ private static final String APPLICATION_NAME = "applicationName"; //$NON-NLS-1$
+ private static final MutableCompositeMetaType metaType;
+ private static final MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
+
+ static {
+ metaType = new MutableCompositeMetaType(SessionMetadata.class.getName(), "The Session domain meta data"); //$NON-NLS-1$
+ metaType.addItem(APPLICATION_NAME, APPLICATION_NAME, SimpleMetaType.STRING);
+ metaType.addItem(CREATED_TIME, CREATED_TIME, SimpleMetaType.LONG_PRIMITIVE);
+ metaType.addItem(CLIENT_HOST_NAME, CLIENT_HOST_NAME, SimpleMetaType.STRING);
+ metaType.addItem(IP_ADDRESS, IP_ADDRESS, SimpleMetaType.STRING);
+ metaType.addItem(LAST_PING_TIME, LAST_PING_TIME, SimpleMetaType.LONG_PRIMITIVE);
+ metaType.addItem(SESSION_ID, SESSION_ID, SimpleMetaType.STRING);
+ metaType.addItem(USER_NAME, USER_NAME, SimpleMetaType.STRING);
+ metaType.addItem(VDB_NAME, VDB_NAME, SimpleMetaType.STRING);
+ metaType.addItem(VDB_VERSION, VDB_VERSION, SimpleMetaType.INTEGER_PRIMITIVE);
+ metaType.addItem(SECURITY_DOMAIN, SECURITY_DOMAIN, SimpleMetaType.STRING);
+ metaType.addItem(CLIENT_MAC, CLIENT_MAC, SimpleMetaType.STRING);
+ metaType.freeze();
+ }
+
+ @Override
+ public Type mapToType() {
+ return SessionMetadata.class;
+ }
+
+ @Override
+ public MetaType getMetaType() {
+ return metaType;
+ }
+
+ @Override
+ public MetaValue createMetaValue(MetaType metaType, SessionMetadata object) {
+ if (object == null)
+ return null;
+ if (metaType instanceof CompositeMetaType) {
+ CompositeMetaType composite = (CompositeMetaType) metaType;
+ CompositeValueSupport session = new CompositeValueSupport(composite);
+
+ session.set(APPLICATION_NAME, SimpleValueSupport.wrap(object.getApplicationName()));
+ session.set(CREATED_TIME, SimpleValueSupport.wrap(object.getCreatedTime()));
+ session.set(CLIENT_HOST_NAME, SimpleValueSupport.wrap(object.getClientHostName()));
+ session.set(IP_ADDRESS, SimpleValueSupport.wrap(object.getIPAddress()));
+ session.set(LAST_PING_TIME, SimpleValueSupport.wrap(object.getLastPingTime()));
+ session.set(SESSION_ID, SimpleValueSupport.wrap(object.getSessionId()));
+ session.set(USER_NAME, SimpleValueSupport.wrap(object.getUserName()));
+ session.set(VDB_NAME,SimpleValueSupport.wrap(object.getVDBName()));
+ session.set(VDB_VERSION, SimpleValueSupport.wrap(object.getVDBVersion()));
+ session.set(SECURITY_DOMAIN, SimpleValueSupport.wrap(object.getSecurityDomain()));
+ session.set(CLIENT_MAC, SimpleValueSupport.wrap(object.getSecurityDomain()));
+ return session;
+ }
+ throw new IllegalArgumentException("Cannot convert session " + object); //$NON-NLS-1$
+ }
+
+ @Override
+ public SessionMetadata unwrapMetaValue(MetaValue metaValue) {
+ if (metaValue == null)
+ return null;
+
+ if (metaValue instanceof CompositeValue) {
+ CompositeValue compositeValue = (CompositeValue) metaValue;
+
+ SessionMetadata session = new SessionMetadata();
+ session.setApplicationName((String) metaValueFactory.unwrap(compositeValue.get(APPLICATION_NAME)));
+ session.setCreatedTime((Long) metaValueFactory.unwrap(compositeValue.get(CREATED_TIME)));
+ session.setClientHostName((String) metaValueFactory.unwrap(compositeValue.get(CLIENT_HOST_NAME)));
+ session.setIPAddress((String) metaValueFactory.unwrap(compositeValue.get(IP_ADDRESS)));
+ session.setLastPingTime((Long) metaValueFactory.unwrap(compositeValue.get(LAST_PING_TIME)));
+ session.setSessionId((String) metaValueFactory.unwrap(compositeValue.get(SESSION_ID)));
+ session.setUserName((String) metaValueFactory.unwrap(compositeValue.get(USER_NAME)));
+ session.setVDBName((String) metaValueFactory.unwrap(compositeValue.get(VDB_NAME)));
+ session.setVDBVersion((Integer) metaValueFactory.unwrap(compositeValue.get(VDB_VERSION)));
+ session.setSecurityDomain((String) metaValueFactory.unwrap(compositeValue.get(SECURITY_DOMAIN)));
+ session.setClientHardwareAddress((String) metaValueFactory.unwrap(compositeValue.get(CLIENT_MAC)));
+ return session;
+ }
+ throw new IllegalStateException("Unable to unwrap session " + metaValue); //$NON-NLS-1$
+ }
+
+}
Deleted: tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/jdbc/ConnectionImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/ConnectionImpl.java 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/jdbc/ConnectionImpl.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,1015 +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.jdbc;
-
-import java.sql.Array;
-import java.sql.Blob;
-import java.sql.CallableStatement;
-import java.sql.Clob;
-import java.sql.Connection;
-import java.sql.NClob;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLClientInfoException;
-import java.sql.SQLException;
-import java.sql.SQLWarning;
-import java.sql.SQLXML;
-import java.sql.Savepoint;
-import java.sql.Statement;
-import java.sql.Struct;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.transaction.xa.Xid;
-
-import org.teiid.client.DQP;
-import org.teiid.client.plan.Annotation;
-import org.teiid.client.plan.PlanNode;
-import org.teiid.client.util.ResultsFuture;
-import org.teiid.client.xa.XATransactionException;
-import org.teiid.client.xa.XidImpl;
-import org.teiid.core.util.SqlUtil;
-import org.teiid.net.CommunicationException;
-import org.teiid.net.ConnectionException;
-import org.teiid.net.ServerConnection;
-import org.teiid.net.TeiidURL;
-import org.teiid.net.socket.SocketServerConnection;
-
-/**
- * Teiid's Connection implementation.
- */
-public class ConnectionImpl extends WrapperImpl implements TeiidConnection {
- private static Logger logger = Logger.getLogger("org.teiid.jdbc"); //$NON-NLS-1$
-
- public static final int DEFAULT_ISOLATION = Connection.TRANSACTION_READ_COMMITTED;
-
- // constant value giving product name
- private final static String SERVER_NAME = "Teiid Server"; //$NON-NLS-1$
- private final static String EMBEDDED_NAME = "Teiid Embedded"; //$NON-NLS-1$
-
- // Unique request ID generator
- private long requestIDGenerator;
-
- // url used to create the connection
- private String url;
-
- // properties object containing the connection properties.
- protected Properties propInfo;
-
- // status of connection object
- private boolean closed = false;
- // determines if a statement executed should be immediately committed.
- private boolean autoCommitFlag = true;
- private boolean inLocalTxn;
-
- // collection of all open statements on this connection
- private Collection<StatementImpl> statements = new ArrayList<StatementImpl>();
- // cached DatabaseMetadata
- private DatabaseMetaDataImpl dbmm;
-
- //Xid for participating in TXN
- private XidImpl transactionXid;
-
- // Flag to represent if the connection state needs to be readOnly, default value false.
- private boolean readOnly = false;
-
- private boolean disableLocalTransactions = false;
- private DQP dqp;
- protected ServerConnection serverConn;
- private int transactionIsolation = DEFAULT_ISOLATION;
-
- // the last query plan description
- private PlanNode currentPlanDescription;
- // the last query debug log
- private String debugLog;
- // the last query annotations
- private Collection<Annotation> annotations;
- private Properties connectionProps;
-
- public ConnectionImpl(ServerConnection serverConn, Properties info, String url) {
- this.connectionProps = info;
- this.serverConn = serverConn;
- this.url = url;
- this.dqp = serverConn.getService(DQP.class);
-
- logger.fine(JDBCPlugin.Util.getString("MMConnection.Session_success")); //$NON-NLS-1$
- logConnectionProperties(url, info);
-
- setExecutionProperties(info);
-
- this.disableLocalTransactions = Boolean.valueOf(this.propInfo.getProperty(ExecutionProperties.DISABLE_LOCAL_TRANSACTIONS)).booleanValue();
- }
-
- boolean isInLocalTxn() {
- return inLocalTxn;
- }
-
- private void setExecutionProperties(Properties info) {
- this.propInfo = new Properties();
-
- String overrideProp = info.getProperty(ExecutionProperties.PROP_TXN_AUTO_WRAP);
- if ( overrideProp == null || overrideProp.trim().length() == 0 ) {
- propInfo.put(ExecutionProperties.PROP_TXN_AUTO_WRAP, ExecutionProperties.TXN_WRAP_DETECT);
- }
-
- String defaultFetchSize = info.getProperty(ExecutionProperties.PROP_FETCH_SIZE);
- if (defaultFetchSize != null) {
- propInfo.put(ExecutionProperties.PROP_FETCH_SIZE, defaultFetchSize);
- } else {
- propInfo.put(ExecutionProperties.PROP_FETCH_SIZE, String.valueOf(BaseDataSource.DEFAULT_FETCH_SIZE));
- }
-
- String partialResultsMode = info.getProperty(ExecutionProperties.PROP_PARTIAL_RESULTS_MODE);
- if (partialResultsMode != null) {
- propInfo.put(ExecutionProperties.PROP_PARTIAL_RESULTS_MODE, partialResultsMode);
- } else {
- propInfo.put(ExecutionProperties.PROP_PARTIAL_RESULTS_MODE, BaseDataSource.DEFAULT_PARTIAL_RESULTS_MODE);
- }
-
- String resultSetCacheMode = info.getProperty(ExecutionProperties.RESULT_SET_CACHE_MODE);
- if (resultSetCacheMode != null) {
- propInfo.put(ExecutionProperties.RESULT_SET_CACHE_MODE, resultSetCacheMode);
- } else {
- propInfo.put(ExecutionProperties.RESULT_SET_CACHE_MODE, BaseDataSource.DEFAULT_RESULT_SET_CACHE_MODE);
- }
-
- String ansiQuotes = info.getProperty(ExecutionProperties.ANSI_QUOTED_IDENTIFIERS);
- if (ansiQuotes != null) {
- propInfo.put(ExecutionProperties.ANSI_QUOTED_IDENTIFIERS, ansiQuotes);
- } else {
- propInfo.put(ExecutionProperties.ANSI_QUOTED_IDENTIFIERS, Boolean.TRUE.toString());
- }
-
- for (String key : info.stringPropertyNames()) {
- for (String prop : JDBCURL.EXECUTION_PROPERTIES) {
- if (prop.equalsIgnoreCase(key)) {
- propInfo.setProperty(key, info.getProperty(key));
- break;
- }
- }
- }
- }
-
- public Collection<Annotation> getAnnotations() {
- return annotations;
- }
-
- public void setAnnotations(Collection<Annotation> annotations) {
- this.annotations = annotations;
- }
-
- public String getDebugLog() {
- return debugLog;
- }
-
- public void setDebugLog(String debugLog) {
- this.debugLog = debugLog;
- }
-
- public PlanNode getCurrentPlanDescription() {
- return currentPlanDescription;
- }
-
- public void setCurrentPlanDescription(PlanNode currentPlanDescription) {
- this.currentPlanDescription = currentPlanDescription;
- }
-
- protected Properties getExecutionProperties() {
- return this.propInfo;
- }
-
- DQP getDQP() {
- return this.dqp;
- }
-
- /**
- * Remove password & trusted token and log all other properties
- * @param connUrl - URL used to connect to server
- * @param info - properties object supplied
- */
- private void logConnectionProperties(String connUrl, Properties info) {
- StringBuffer modifiedUrl = new StringBuffer();
-
- // If we have valid URL
- if (connUrl != null) {
- // We need wipe out the password here, before we write to the log
- int startIndex = connUrl.indexOf("password="); //$NON-NLS-1$
- if (startIndex != -1) {
- modifiedUrl.append(connUrl.substring(0, startIndex));
- modifiedUrl.append("password=***"); //$NON-NLS-1$
- int endIndex = connUrl.indexOf(";", startIndex+9); //$NON-NLS-1$
- if (endIndex != -1) {
- modifiedUrl.append(";").append(connUrl.substring(endIndex)); //$NON-NLS-1$
- }
- }
- logger.fine("Connection Url="+modifiedUrl); //$NON-NLS-1$
- }
-
- // Now clone the properties object and remove password and trusted token
- if (info != null) {
- Enumeration enumeration = info.keys();
- while (enumeration.hasMoreElements()) {
- String key = (String)enumeration.nextElement();
- Object anObj = info.get(key);
- // Log each property except for password and token.
- if (!TeiidURL.CONNECTION.PASSWORD.equalsIgnoreCase(key)) {
- logger.fine(key+"="+anObj); //$NON-NLS-1$
- }
- }
- }
- }
-
- String getUrl() {
- return this.url;
- }
-
- /**
- * Connection identifier of this connection
- * @return identifier
- * @throws SQLException
- */
- public String getConnectionId() {
- return this.serverConn.getLogonResult().getSessionID();
- }
-
- long currentRequestId() {
- return requestIDGenerator;
- }
-
- /**
- * Generate the next unique requestID for matching up requests with responses.
- * These IDs should be unique only in the context of a ServerConnection instance.
- * @return Request ID
- */
- long nextRequestID() {
- return requestIDGenerator++;
- }
-
- public void clearWarnings() throws SQLException {
- // do nothing
- }
-
- public void close() throws SQLException {
- Throwable firstException = null;
-
- if(closed) {
- return;
- }
-
- try {
- // close any statements that were created on this connection
- try {
- closeStatements();
- } catch (SQLException se) {
- firstException = se;
- } finally {
- this.serverConn.close();
- if ( firstException != null )
- throw (SQLException)firstException;
- }
- } catch (SQLException se) {
- throw TeiidSQLException.create(se, JDBCPlugin.Util.getString("MMConnection.Err_connection_close", se.getMessage())); //$NON-NLS-1$
- } finally {
- logger.fine(JDBCPlugin.Util.getString("MMConnection.Connection_close_success")); //$NON-NLS-1$
- // set the status of the connection to closed
- closed = true;
- }
- }
-
- /**
- * <p>
- * Close all the statements open on this connection
- * </p>
- *
- * @throws SQLException
- * server statement object could not be closed.
- */
- void closeStatements() throws SQLException {
- // Closing the statement will cause the
- // MMConnection.closeStatement() method to be called,
- // which will modify this.statements. So, we do this iteration
- // in a separate safe copy of the list
- List<StatementImpl> statementsSafe = new ArrayList<StatementImpl>(this.statements);
- SQLException ex = null;
- for (StatementImpl statement : statementsSafe) {
- try {
- statement.close();
- } catch (SQLException e) {
- ex = e;
- }
- }
- if (ex != null) {
- throw TeiidSQLException.create(ex, JDBCPlugin.Util.getString("MMConnection.Err_closing_stmts")); //$NON-NLS-1$
- }
- }
-
- /**
- * Called by MMStatement to notify the connection that the
- * statement has been closed.
- * @param statement
- */
- void closeStatement(Statement statement) {
- this.statements.remove(statement);
- }
-
- /**
- * <p>This method makes any changes involved in a transaction permanent and releases
- * any locks held by the connection object. This is only used when auto-commit
- * is set to false.</p>
- * @throws SQLException if the transaction had been rolled back or marked to roll back.
- */
- public void commit() throws SQLException {
- checkConnection();
- if (!autoCommitFlag) {
- try {
- directCommit();
- } finally {
- inLocalTxn = false;
- }
- }
- }
-
- private void directCommit() throws SQLException {
- if (inLocalTxn) {
- try {
- ResultsFuture<?> future = this.dqp.commit();
- future.get();
- } catch (Exception e) {
- throw TeiidSQLException.create(e);
- }
- logger.fine(JDBCPlugin.Util.getString("MMConnection.Commit_success")); //$NON-NLS-1$
- }
- }
-
- void beginLocalTxnIfNeeded() throws SQLException {
- if (this.transactionXid != null || inLocalTxn || this.autoCommitFlag || disableLocalTransactions) {
- return;
- }
- try {
- try {
- this.dqp.begin();
- } catch (XATransactionException e) {
- throw TeiidSQLException.create(e);
- }
- inLocalTxn = true;
- } finally {
- if (!inLocalTxn) {
- autoCommitFlag = true;
- }
- }
- }
-
- public StatementImpl createStatement() throws SQLException {
- return createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
- }
-
- /**
- * <p>Creates a Statement object that will produce ResultSet objects of the type
- * resultSetType and concurrency level resultSetConcurrency.</p>
- * @param intvalue indicating the ResultSet's type
- * @param intValue indicating the ResultSet's concurrency
- * @return Statement object.
- */
- public StatementImpl createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
- //Check to see the connection is open
- checkConnection();
-
- validateResultSetType(resultSetType);
- validateResultSetConcurrency(resultSetConcurrency);
-
- // add the statement object to the map
- StatementImpl newStatement = StatementImpl.newInstance(this, resultSetType, resultSetConcurrency);
- statements.add(newStatement);
-
- return newStatement;
- }
-
- /**
- * @param resultSetType
- * @throws TeiidSQLException
- * @since 4.3
- */
- private void validateResultSetType(int resultSetType) throws TeiidSQLException {
- if (resultSetType == ResultSet.TYPE_SCROLL_SENSITIVE ) {
- String msg = JDBCPlugin.Util.getString("MMConnection.Scrollable_type_not_supported", "ResultSet.TYPE_SCROLL_SENSITIVE"); //$NON-NLS-1$ //$NON-NLS-2$
- throw new TeiidSQLException(msg);
- }
- }
-
- /**
- * @param resultSetConcurrency
- * @throws TeiidSQLException
- * @since 4.3
- */
- private void validateResultSetConcurrency(int resultSetConcurrency) throws TeiidSQLException {
- if (resultSetConcurrency == ResultSet.CONCUR_UPDATABLE) {
- String msg = JDBCPlugin.Util.getString("MMConnection.Concurrency_type_not_supported", "ResultSet.CONCUR_UPDATABLE"); //$NON-NLS-1$ //$NON-NLS-2$
- throw new TeiidSQLException(msg);
- }
- }
-
- public boolean getAutoCommit() throws SQLException {
- //Check to see the connection is open
- checkConnection();
- return autoCommitFlag;
- }
-
- public String getCatalog() throws SQLException {
- //Check to see the connection is open
- checkConnection();
- //catalogs are not supported
- return this.serverConn.getLogonResult().getVdbName();
- }
-
- /**
- * <p>This method gets the ServerConnection object wrapped by this object.</p>
- * @return ServerConnection object
- */
- ServerConnection getServerConnection() throws SQLException {
- //Check to see the connection is open
- checkConnection();
- return serverConn;
- }
-
- String getVDBName() throws SQLException {
- //Check to see the connection is open
- checkConnection();
- //get the virtual database name to which we are connected.
-
- return this.serverConn.getLogonResult().getVdbName();
- }
-
- public int getVDBVersion() throws SQLException {
- checkConnection();
- return this.serverConn.getLogonResult().getVdbVersion();
- }
-
- /**
- * Get's the name of the user who got this connection.
- * @return Sring object giving the user name
- * @throws SQLException if the connection is closed
- */
- String getUserName() throws SQLException {
- checkConnection();
-
- return this.serverConn.getLogonResult().getUserName();
- }
-
- public DatabaseMetaDataImpl getMetaData() throws SQLException {
- //Check to see the connection is open
- checkConnection();
-
- if (dbmm == null) {
- dbmm = new DatabaseMetaDataImpl(this);
- }
- return dbmm;
- }
-
- /**
- * Get the database name that this connection is representing
- * @return String name of the database
- */
- public String getDatabaseName() {
- if (this.serverConn instanceof SocketServerConnection) {
- return SERVER_NAME;
- }
- return EMBEDDED_NAME;
- }
-
- /**
- * Retrieves the current holdability of ResultSet objects created using this Connection object.
- * @param holdability int indicating the holdability
- * @return int holdability
- * @throws SQLException
- */
- public int getHoldability() throws SQLException {
- return ResultSet.HOLD_CURSORS_OVER_COMMIT;
- }
-
- public int getTransactionIsolation() throws SQLException {
- return this.transactionIsolation;
- }
-
- /**
- * Retreives the type map associated with this Connection object. The type map
- * contains entries for undefined types. This method always returns an empty
- * map since it is not possible to add entries to this type map
- * @return map containing undefined types(empty)
- * @throws SQLException, should never occur
- */
- public Map getTypeMap() throws SQLException {
- //Check to see the connection is open
- checkConnection();
- return new HashMap();
- }
-
- /**
- * <p>This method will return the first warning reported by calls on this connection,
- * or null if none exist.</p>
- * @return A SQLWarning object if there are any warnings.
- * @throws SQLException, should never occur
- */
- public SQLWarning getWarnings() throws SQLException {
- //Check to see the connection is open
- checkConnection();
- return null; // we don't have any warnings
- }
-
- /**
- * <p>This method will return whether this connection is closed or not.</p>
- * @return booleanvalue indicating if the connection is closed
- * @throws SQLException, should never occur
- */
- public boolean isClosed() throws SQLException {
- return closed;
- }
-
- public boolean isReadOnly() throws SQLException {
- return readOnly;
- }
-
- public String nativeSQL(String sql) throws SQLException {
- // return the string argument without any modifications.
- // escape syntaxes are directly supported in the server
- return sql;
- }
-
- /**
- * <p>Creates a CallableStatement object that contains sql and that will produce
- * ResultSet objects that are non-scrollable and non-updatable. A SQL stored
- * procedure call statement is handled by creating a CallableStatement for it.</p>
- * @param sql String(escape syntax) for invoking a stored procedure.
- * @return CallableStatement object that can be used to execute the storedProcedure
- * @throws SQLException if there is an error creating the callable statement object
- */
- public CallableStatement prepareCall(String sql) throws SQLException {
- //there is a problem setting the result set type to be non-scrollable
- //See defect 17768
- return prepareCall(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
- }
-
- /**
- * <p>Creates a CallableStatement object that contains a sql and that will produce
- * ResultSet objects of the type resultSetType and with a concurrency level of
- * resultSetConcurrency. A SQL stored procedure call statement is handled by
- * creating a CallableStatement for it.</p>
- * @param sql String(escape syntax) for invoking a stored procedure.
- * @param intvalue indicating the ResultSet's type
- * @param intValue indicating the ResultSet's concurrency
- * @return CallableStatement object that can be used to execute the storedProcedure
- */
- public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
- //Check to see the connection is open
- checkConnection();
-
- validateResultSetType(resultSetType);
- validateResultSetConcurrency(resultSetConcurrency);
- validateSQL(sql);
-
- // add the statement object to the map
- CallableStatementImpl newStatement = CallableStatementImpl.newInstance(this, sql, resultSetType, resultSetConcurrency);
- statements.add(newStatement);
- return newStatement;
- }
-
- /**
- * @param sql
- * @throws TeiidSQLException
- * @since 4.3
- */
- private void validateSQL(String sql) throws TeiidSQLException {
- if (sql == null) {
- String msg = JDBCPlugin.Util.getString("MMConnection.SQL_cannot_be_null"); //$NON-NLS-1$
- throw new TeiidSQLException(msg);
- }
- }
-
- public PreparedStatementImpl prepareStatement(String sql) throws SQLException {
- return prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
- }
-
- /**
- * <p>Creates a PreparedStatement object that contains a sql and that will produce
- * ResultSet objects of the type resultSetType and with a concurrency level of
- * resultSetConcurrency.</p>
- * @param sql string representing a prepared statement
- * @param intvalue indicating the ResultSet's type
- * @param intValue indicating the ResultSet's concurrency
- * @return a PreparedStatement object
- */
- public PreparedStatementImpl prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
- //Check to see the connection is open
- checkConnection();
-
- validateResultSetType(resultSetType);
- validateResultSetConcurrency(resultSetConcurrency);
- validateSQL(sql);
-
- // add the statement object to the map
- PreparedStatementImpl newStatement = PreparedStatementImpl.newInstance(this, sql, resultSetType, resultSetConcurrency);
- statements.add(newStatement);
- return newStatement;
- }
-
- public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency,
- int resultSetHoldability ) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void rollback() throws SQLException {
- rollback(true);
- }
-
- /**
- * Rollback the current local transaction
- * @param startTxn
- * @throws SQLException
- */
- public void rollback(boolean startTxn) throws SQLException {
-
- //Check to see the connection is open
- checkConnection();
- if (!autoCommitFlag) {
- try {
- if (this.inLocalTxn) {
- this.inLocalTxn = false;
- try {
- ResultsFuture<?> future = this.dqp.rollback();
- future.get();
- } catch (Exception e) {
- throw TeiidSQLException.create(e);
- }
- logger.fine(JDBCPlugin.Util.getString("MMConnection.Rollback_success")); //$NON-NLS-1$
- }
- } finally {
- if (startTxn) {
- this.inLocalTxn = false;
- }
- else {
- this.autoCommitFlag = true;
- }
- }
- }
- }
-
- public ResultsFuture<?> submitSetAutoCommitTrue(boolean commit) throws SQLException {
- //Check to see the connection is open
- checkConnection();
-
- if (this.autoCommitFlag) {
- return ResultsFuture.NULL_FUTURE;
- }
-
- this.autoCommitFlag = true;
-
- try {
- if (commit) {
- return dqp.commit();
- }
- return dqp.rollback();
- } catch (XATransactionException e) {
- throw TeiidSQLException.create(e);
- }
- }
-
- public void setAutoCommit(boolean autoCommit) throws SQLException {
- //Check to see the connection is open
- checkConnection();
-
- if (autoCommit == this.autoCommitFlag) {
- return;
- }
-
- this.autoCommitFlag = autoCommit;
-
- if (autoCommit) {
- directCommit();
- } else {
- inLocalTxn = false;
- }
- }
-
- /**
- * <p>Teiid does not allow setting a catalog through a connection. This
- * method silently ignores the request as per the specification.</p>
- * @param The string values which sets the catalog name on the connection.
- * @throws SQLException This should never occur.
- */
- public void setCatalog(String catalog) throws SQLException {
- // do nothing, silently ignore the request
- }
-
- /**
- * @param A boolean value specifying whether the connection is readonly.
- * @throws throws SQLException.
- */
- public void setReadOnly(boolean readOnly) throws SQLException {
- if (this.readOnly == readOnly) {
- return;
- }
- // During transaction do not allow to change this flag
- if (!autoCommitFlag || this.transactionXid != null) {
- throw new TeiidSQLException(JDBCPlugin.Util.getString("MMStatement.Invalid_During_Transaction", "setReadOnly(" + readOnly + ")"));//$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$
- }
- this.readOnly = readOnly;
- }
-
- /**
- * <p> This utility method checks if the jdbc connection is closed and
- * throws an exception if it is closed. </p>
- * @throws SQLException if the connection object is closed.
- */
- void checkConnection() throws SQLException{
- //Check to see the connection is closed and proceed if it is not
- if (closed) {
- throw new TeiidSQLException(JDBCPlugin.Util.getString("MMConnection.Cant_use_closed_connection")); //$NON-NLS-1$
- }
- }
-
- protected void commitTransaction(XidImpl arg0, boolean arg1) throws SQLException {
- checkConnection();
- transactionXid = null;
- this.autoCommitFlag = true;
- try {
- ResultsFuture<?> future = this.dqp.commit(arg0, arg1);
- future.get();
- } catch (Exception e) {
- throw TeiidSQLException.create(e);
- }
- }
-
- protected void endTransaction(XidImpl arg0, int arg1) throws SQLException {
- checkConnection();
- this.autoCommitFlag = true;
- try {
- ResultsFuture<?> future = this.dqp.end(arg0, arg1);
- future.get();
- } catch (Exception e) {
- throw TeiidSQLException.create(e);
- }
- }
-
- protected void forgetTransaction(XidImpl arg0) throws SQLException {
- checkConnection();
- try {
- ResultsFuture<?> future = this.dqp.forget(arg0);
- future.get();
- } catch (Exception e) {
- throw TeiidSQLException.create(e);
- }
- }
-
- protected int prepareTransaction(XidImpl arg0) throws SQLException {
- checkConnection();
- transactionXid = null;
- try {
- ResultsFuture<Integer> future = this.dqp.prepare(arg0);
- return future.get();
- } catch (Exception e) {
- throw TeiidSQLException.create(e);
- }
- }
-
- protected Xid[] recoverTransaction(int arg0) throws SQLException {
- checkConnection();
- try {
- ResultsFuture<Xid[]> future = this.dqp.recover(arg0);
- return future.get();
- } catch (Exception e) {
- throw TeiidSQLException.create(e);
- }
- }
-
- protected void rollbackTransaction(XidImpl arg0) throws SQLException {
- checkConnection();
- transactionXid = null;
- this.autoCommitFlag = true;
- try {
- ResultsFuture<?> future = this.dqp.rollback(arg0);
- future.get();
- } catch (Exception e) {
- throw TeiidSQLException.create(e);
- }
- }
-
- protected void startTransaction(XidImpl arg0, int arg1, int timeout) throws SQLException {
- checkConnection();
- try {
- ResultsFuture<?> future = this.dqp.start(arg0, arg1, timeout);
- future.get();
- } catch (Exception e) {
- throw TeiidSQLException.create(e);
- }
- transactionXid = arg0;
- this.autoCommitFlag = false;
- }
-
- protected XidImpl getTransactionXid() {
- return transactionXid;
- }
-
- public boolean isValid(int timeout) throws SQLException {
- return this.getServerConnection().isOpen(timeout * 1000);
- }
-
- public void recycleConnection() {
- try {
- //close all open statements
- this.closeStatements();
- } catch (SQLException e) {
- logger.log(Level.WARNING, JDBCPlugin.Util.getString("MMXAConnection.rolling_back_error"), e); //$NON-NLS-1$
- }
- try {
- //rollback if still in a transaction
- if (!this.getAutoCommit()) {
- logger.warning(JDBCPlugin.Util.getString("MMXAConnection.rolling_back")); //$NON-NLS-1$
-
- if (this.getTransactionXid() == null) {
- this.rollback(false);
- } else {
- this.rollbackTransaction(getTransactionXid());
- }
- }
- } catch (SQLException e) {
- logger.log(Level.WARNING, JDBCPlugin.Util.getString("MMXAConnection.rolling_back_error"), e); //$NON-NLS-1$
- }
-
- this.serverConn.cleanUp();
- }
-
- public boolean isSameProcess(ConnectionImpl conn) throws CommunicationException {
- return this.serverConn.isSameInstance(conn.serverConn);
- }
-
- public void setClientInfo(Properties properties)
- throws SQLClientInfoException {
- }
-
- public void setClientInfo(String name, String value)
- throws SQLClientInfoException {
- }
-
- public Properties getClientInfo() throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public String getClientInfo(String name) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public Array createArrayOf(String typeName, Object[] elements)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public Blob createBlob() throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public Clob createClob() throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public NClob createNClob() throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public SQLXML createSQLXML() throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public Statement createStatement(int resultSetType,
- int resultSetConcurrency, int resultSetHoldability)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
-
- }
-
- public Struct createStruct(String typeName, Object[] attributes)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public CallableStatement prepareCall(String sql, int resultSetType,
- int resultSetConcurrency, int resultSetHoldability)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
-
- }
-
- public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
-
- }
-
- public PreparedStatement prepareStatement(String sql, int[] columnIndexes)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
-
- }
-
- public PreparedStatement prepareStatement(String sql, String[] columnNames)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
-
- }
-
- public void releaseSavepoint(Savepoint savepoint) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
-
- }
-
- public void rollback(Savepoint savepoint) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
-
- }
-
- public void setHoldability(int holdability) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public Savepoint setSavepoint() throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public Savepoint setSavepoint(String name) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void setTransactionIsolation(int level) throws SQLException {
- this.transactionIsolation = level;
- }
-
- public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- @Override
- public void changeUser(String userName, String newPassword)
- throws SQLException {
- //TODO: recycleConnection();
- Object oldName = null;
- Object oldPassword = null;
- if (userName != null) {
- oldName = this.connectionProps.put(TeiidURL.CONNECTION.USER_NAME, userName);
- } else {
- oldName = this.connectionProps.remove(TeiidURL.CONNECTION.USER_NAME);
- }
- if (newPassword != null) {
- oldPassword = this.connectionProps.put(TeiidURL.CONNECTION.PASSWORD, newPassword);
- } else {
- oldPassword = this.connectionProps.remove(TeiidURL.CONNECTION.PASSWORD);
- }
- boolean success = false;
- try {
- this.serverConn.authenticate();
- success = true;
- } catch (ConnectionException e) {
- throw TeiidSQLException.create(e);
- } catch (CommunicationException e) {
- throw TeiidSQLException.create(e);
- } finally {
- if (!success) {
- if (oldName != null) {
- this.connectionProps.put(TeiidURL.CONNECTION.USER_NAME, oldName);
- } else {
- this.connectionProps.remove(TeiidURL.CONNECTION.USER_NAME);
- }
- if (oldPassword != null) {
- this.connectionProps.put(TeiidURL.CONNECTION.PASSWORD, oldPassword);
- } else {
- this.connectionProps.remove(TeiidURL.CONNECTION.PASSWORD);
- }
- }
- }
- }
-
-}
Copied: tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/jdbc/ConnectionImpl.java (from rev 3218, trunk/client/src/main/java/org/teiid/jdbc/ConnectionImpl.java)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/jdbc/ConnectionImpl.java (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/jdbc/ConnectionImpl.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,1022 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License 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.jdbc;
+
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.CallableStatement;
+import java.sql.Clob;
+import java.sql.Connection;
+import java.sql.NClob;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLClientInfoException;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.SQLXML;
+import java.sql.Savepoint;
+import java.sql.Statement;
+import java.sql.Struct;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.transaction.xa.Xid;
+
+import org.teiid.client.DQP;
+import org.teiid.client.plan.Annotation;
+import org.teiid.client.plan.PlanNode;
+import org.teiid.client.util.ResultsFuture;
+import org.teiid.client.xa.XATransactionException;
+import org.teiid.client.xa.XidImpl;
+import org.teiid.core.util.SqlUtil;
+import org.teiid.net.CommunicationException;
+import org.teiid.net.ConnectionException;
+import org.teiid.net.ServerConnection;
+import org.teiid.net.TeiidURL;
+import org.teiid.net.socket.SocketServerConnection;
+
+/**
+ * Teiid's Connection implementation.
+ */
+public class ConnectionImpl extends WrapperImpl implements TeiidConnection {
+ private static Logger logger = Logger.getLogger("org.teiid.jdbc"); //$NON-NLS-1$
+
+ public static final int DEFAULT_ISOLATION = Connection.TRANSACTION_READ_COMMITTED;
+
+ // constant value giving product name
+ private final static String SERVER_NAME = "Teiid Server"; //$NON-NLS-1$
+ private final static String EMBEDDED_NAME = "Teiid Embedded"; //$NON-NLS-1$
+
+ // Unique request ID generator
+ private long requestIDGenerator;
+
+ // url used to create the connection
+ private String url;
+
+ // properties object containing the connection properties.
+ protected Properties propInfo;
+
+ // status of connection object
+ private boolean closed = false;
+ // determines if a statement executed should be immediately committed.
+ private boolean autoCommitFlag = true;
+ private boolean inLocalTxn;
+
+ // collection of all open statements on this connection
+ private Collection<StatementImpl> statements = new ArrayList<StatementImpl>();
+ // cached DatabaseMetadata
+ private DatabaseMetaDataImpl dbmm;
+
+ //Xid for participating in TXN
+ private XidImpl transactionXid;
+
+ // Flag to represent if the connection state needs to be readOnly, default value false.
+ private boolean readOnly = false;
+
+ private boolean disableLocalTransactions = false;
+ private DQP dqp;
+ protected ServerConnection serverConn;
+ private int transactionIsolation = DEFAULT_ISOLATION;
+
+ // the last query plan description
+ private PlanNode currentPlanDescription;
+ // the last query debug log
+ private String debugLog;
+ // the last query annotations
+ private Collection<Annotation> annotations;
+ private Properties connectionProps;
+
+ public ConnectionImpl(ServerConnection serverConn, Properties info, String url) {
+ this.connectionProps = info;
+ this.serverConn = serverConn;
+ this.url = url;
+ this.dqp = serverConn.getService(DQP.class);
+
+ logger.fine(JDBCPlugin.Util.getString("MMConnection.Session_success")); //$NON-NLS-1$
+ logConnectionProperties(url, info);
+
+ setExecutionProperties(info);
+
+ this.disableLocalTransactions = Boolean.valueOf(this.propInfo.getProperty(ExecutionProperties.DISABLE_LOCAL_TRANSACTIONS)).booleanValue();
+ }
+
+ boolean isInLocalTxn() {
+ return inLocalTxn;
+ }
+
+ private void setExecutionProperties(Properties info) {
+ this.propInfo = new Properties();
+
+ String overrideProp = info.getProperty(ExecutionProperties.PROP_TXN_AUTO_WRAP);
+ if ( overrideProp == null || overrideProp.trim().length() == 0 ) {
+ propInfo.put(ExecutionProperties.PROP_TXN_AUTO_WRAP, ExecutionProperties.TXN_WRAP_DETECT);
+ }
+
+ String defaultFetchSize = info.getProperty(ExecutionProperties.PROP_FETCH_SIZE);
+ if (defaultFetchSize != null) {
+ propInfo.put(ExecutionProperties.PROP_FETCH_SIZE, defaultFetchSize);
+ } else {
+ propInfo.put(ExecutionProperties.PROP_FETCH_SIZE, String.valueOf(BaseDataSource.DEFAULT_FETCH_SIZE));
+ }
+
+ String partialResultsMode = info.getProperty(ExecutionProperties.PROP_PARTIAL_RESULTS_MODE);
+ if (partialResultsMode != null) {
+ propInfo.put(ExecutionProperties.PROP_PARTIAL_RESULTS_MODE, partialResultsMode);
+ } else {
+ propInfo.put(ExecutionProperties.PROP_PARTIAL_RESULTS_MODE, BaseDataSource.DEFAULT_PARTIAL_RESULTS_MODE);
+ }
+
+ String resultSetCacheMode = info.getProperty(ExecutionProperties.RESULT_SET_CACHE_MODE);
+ if (resultSetCacheMode != null) {
+ propInfo.put(ExecutionProperties.RESULT_SET_CACHE_MODE, resultSetCacheMode);
+ } else {
+ propInfo.put(ExecutionProperties.RESULT_SET_CACHE_MODE, BaseDataSource.DEFAULT_RESULT_SET_CACHE_MODE);
+ }
+
+ String ansiQuotes = info.getProperty(ExecutionProperties.ANSI_QUOTED_IDENTIFIERS);
+ if (ansiQuotes != null) {
+ propInfo.put(ExecutionProperties.ANSI_QUOTED_IDENTIFIERS, ansiQuotes);
+ } else {
+ propInfo.put(ExecutionProperties.ANSI_QUOTED_IDENTIFIERS, Boolean.TRUE.toString());
+ }
+
+ for (String key : info.stringPropertyNames()) {
+ for (String prop : JDBCURL.EXECUTION_PROPERTIES) {
+ if (prop.equalsIgnoreCase(key)) {
+ propInfo.setProperty(key, info.getProperty(key));
+ break;
+ }
+ }
+ }
+ }
+
+ public Collection<Annotation> getAnnotations() {
+ return annotations;
+ }
+
+ public void setAnnotations(Collection<Annotation> annotations) {
+ this.annotations = annotations;
+ }
+
+ public String getDebugLog() {
+ return debugLog;
+ }
+
+ public void setDebugLog(String debugLog) {
+ this.debugLog = debugLog;
+ }
+
+ public PlanNode getCurrentPlanDescription() {
+ return currentPlanDescription;
+ }
+
+ public void setCurrentPlanDescription(PlanNode currentPlanDescription) {
+ this.currentPlanDescription = currentPlanDescription;
+ }
+
+ protected Properties getExecutionProperties() {
+ return this.propInfo;
+ }
+
+ DQP getDQP() {
+ return this.dqp;
+ }
+
+ /**
+ * Remove password & trusted token and log all other properties
+ * @param connUrl - URL used to connect to server
+ * @param info - properties object supplied
+ */
+ private void logConnectionProperties(String connUrl, Properties info) {
+ StringBuffer modifiedUrl = new StringBuffer();
+
+ // If we have valid URL
+ if (connUrl != null) {
+ // We need wipe out the password here, before we write to the log
+ int startIndex = connUrl.indexOf("password="); //$NON-NLS-1$
+ if (startIndex != -1) {
+ modifiedUrl.append(connUrl.substring(0, startIndex));
+ modifiedUrl.append("password=***"); //$NON-NLS-1$
+ int endIndex = connUrl.indexOf(";", startIndex+9); //$NON-NLS-1$
+ if (endIndex != -1) {
+ modifiedUrl.append(";").append(connUrl.substring(endIndex)); //$NON-NLS-1$
+ }
+ }
+ logger.fine("Connection Url="+modifiedUrl); //$NON-NLS-1$
+ }
+
+ // Now clone the properties object and remove password and trusted token
+ if (info != null) {
+ Enumeration enumeration = info.keys();
+ while (enumeration.hasMoreElements()) {
+ String key = (String)enumeration.nextElement();
+ Object anObj = info.get(key);
+ // Log each property except for password and token.
+ if (!TeiidURL.CONNECTION.PASSWORD.equalsIgnoreCase(key)) {
+ logger.fine(key+"="+anObj); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+
+ String getUrl() {
+ return this.url;
+ }
+
+ /**
+ * Connection identifier of this connection
+ * @return identifier
+ * @throws SQLException
+ */
+ public String getConnectionId() {
+ return this.serverConn.getLogonResult().getSessionID();
+ }
+
+ long currentRequestId() {
+ return requestIDGenerator;
+ }
+
+ /**
+ * Generate the next unique requestID for matching up requests with responses.
+ * These IDs should be unique only in the context of a ServerConnection instance.
+ * @return Request ID
+ */
+ long nextRequestID() {
+ return requestIDGenerator++;
+ }
+
+ public void clearWarnings() throws SQLException {
+ // do nothing
+ }
+
+ public void close() throws SQLException {
+ Throwable firstException = null;
+
+ if(closed) {
+ return;
+ }
+
+ try {
+ // close any statements that were created on this connection
+ try {
+ closeStatements();
+ } catch (SQLException se) {
+ firstException = se;
+ } finally {
+ this.serverConn.close();
+ if ( firstException != null )
+ throw (SQLException)firstException;
+ }
+ } catch (SQLException se) {
+ throw TeiidSQLException.create(se, JDBCPlugin.Util.getString("MMConnection.Err_connection_close", se.getMessage())); //$NON-NLS-1$
+ } finally {
+ logger.fine(JDBCPlugin.Util.getString("MMConnection.Connection_close_success")); //$NON-NLS-1$
+ // set the status of the connection to closed
+ closed = true;
+ }
+ }
+
+ /**
+ * <p>
+ * Close all the statements open on this connection
+ * </p>
+ *
+ * @throws SQLException
+ * server statement object could not be closed.
+ */
+ void closeStatements() throws SQLException {
+ // Closing the statement will cause the
+ // MMConnection.closeStatement() method to be called,
+ // which will modify this.statements. So, we do this iteration
+ // in a separate safe copy of the list
+ List<StatementImpl> statementsSafe = new ArrayList<StatementImpl>(this.statements);
+ SQLException ex = null;
+ for (StatementImpl statement : statementsSafe) {
+ try {
+ statement.close();
+ } catch (SQLException e) {
+ ex = e;
+ }
+ }
+ if (ex != null) {
+ throw TeiidSQLException.create(ex, JDBCPlugin.Util.getString("MMConnection.Err_closing_stmts")); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Called by MMStatement to notify the connection that the
+ * statement has been closed.
+ * @param statement
+ */
+ void closeStatement(Statement statement) {
+ this.statements.remove(statement);
+ }
+
+ /**
+ * <p>This method makes any changes involved in a transaction permanent and releases
+ * any locks held by the connection object. This is only used when auto-commit
+ * is set to false.</p>
+ * @throws SQLException if the transaction had been rolled back or marked to roll back.
+ */
+ public void commit() throws SQLException {
+ checkConnection();
+ if (!autoCommitFlag) {
+ try {
+ directCommit();
+ } finally {
+ inLocalTxn = false;
+ }
+ }
+ }
+
+ private void directCommit() throws SQLException {
+ if (inLocalTxn) {
+ try {
+ ResultsFuture<?> future = this.dqp.commit();
+ future.get();
+ } catch (Exception e) {
+ throw TeiidSQLException.create(e);
+ }
+ logger.fine(JDBCPlugin.Util.getString("MMConnection.Commit_success")); //$NON-NLS-1$
+ }
+ }
+
+ void beginLocalTxnIfNeeded() throws SQLException {
+ if (this.transactionXid != null || inLocalTxn || this.autoCommitFlag || disableLocalTransactions) {
+ return;
+ }
+ try {
+ try {
+ this.dqp.begin();
+ } catch (XATransactionException e) {
+ throw TeiidSQLException.create(e);
+ }
+ inLocalTxn = true;
+ } finally {
+ if (!inLocalTxn) {
+ autoCommitFlag = true;
+ }
+ }
+ }
+
+ public StatementImpl createStatement() throws SQLException {
+ return createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
+ }
+
+ /**
+ * <p>Creates a Statement object that will produce ResultSet objects of the type
+ * resultSetType and concurrency level resultSetConcurrency.</p>
+ * @param intvalue indicating the ResultSet's type
+ * @param intValue indicating the ResultSet's concurrency
+ * @return Statement object.
+ */
+ public StatementImpl createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
+ //Check to see the connection is open
+ checkConnection();
+
+ validateResultSetType(resultSetType);
+ validateResultSetConcurrency(resultSetConcurrency);
+
+ // add the statement object to the map
+ StatementImpl newStatement = StatementImpl.newInstance(this, resultSetType, resultSetConcurrency);
+ statements.add(newStatement);
+
+ return newStatement;
+ }
+
+ /**
+ * @param resultSetType
+ * @throws TeiidSQLException
+ * @since 4.3
+ */
+ private void validateResultSetType(int resultSetType) throws TeiidSQLException {
+ if (resultSetType == ResultSet.TYPE_SCROLL_SENSITIVE ) {
+ String msg = JDBCPlugin.Util.getString("MMConnection.Scrollable_type_not_supported", "ResultSet.TYPE_SCROLL_SENSITIVE"); //$NON-NLS-1$ //$NON-NLS-2$
+ throw new TeiidSQLException(msg);
+ }
+ }
+
+ /**
+ * @param resultSetConcurrency
+ * @throws TeiidSQLException
+ * @since 4.3
+ */
+ private void validateResultSetConcurrency(int resultSetConcurrency) throws TeiidSQLException {
+ if (resultSetConcurrency == ResultSet.CONCUR_UPDATABLE) {
+ String msg = JDBCPlugin.Util.getString("MMConnection.Concurrency_type_not_supported", "ResultSet.CONCUR_UPDATABLE"); //$NON-NLS-1$ //$NON-NLS-2$
+ throw new TeiidSQLException(msg);
+ }
+ }
+
+ public boolean getAutoCommit() throws SQLException {
+ //Check to see the connection is open
+ checkConnection();
+ return autoCommitFlag;
+ }
+
+ public String getCatalog() throws SQLException {
+ //Check to see the connection is open
+ checkConnection();
+ //catalogs are not supported
+ return this.serverConn.getLogonResult().getVdbName();
+ }
+
+ /**
+ * <p>This method gets the ServerConnection object wrapped by this object.</p>
+ * @return ServerConnection object
+ */
+ ServerConnection getServerConnection() throws SQLException {
+ //Check to see the connection is open
+ checkConnection();
+ return serverConn;
+ }
+
+ String getVDBName() throws SQLException {
+ //Check to see the connection is open
+ checkConnection();
+ //get the virtual database name to which we are connected.
+
+ return this.serverConn.getLogonResult().getVdbName();
+ }
+
+ public int getVDBVersion() throws SQLException {
+ checkConnection();
+ return this.serverConn.getLogonResult().getVdbVersion();
+ }
+
+ /**
+ * Get's the name of the user who got this connection.
+ * @return Sring object giving the user name
+ * @throws SQLException if the connection is closed
+ */
+ String getUserName() throws SQLException {
+ checkConnection();
+
+ return this.serverConn.getLogonResult().getUserName();
+ }
+
+ public DatabaseMetaDataImpl getMetaData() throws SQLException {
+ //Check to see the connection is open
+ checkConnection();
+
+ if (dbmm == null) {
+ dbmm = new DatabaseMetaDataImpl(this);
+ }
+ return dbmm;
+ }
+
+ /**
+ * Get the database name that this connection is representing
+ * @return String name of the database
+ */
+ public String getDatabaseName() {
+ if (this.serverConn instanceof SocketServerConnection) {
+ return SERVER_NAME;
+ }
+ return EMBEDDED_NAME;
+ }
+
+ /**
+ * Retrieves the current holdability of ResultSet objects created using this Connection object.
+ * @param holdability int indicating the holdability
+ * @return int holdability
+ * @throws SQLException
+ */
+ public int getHoldability() throws SQLException {
+ return ResultSet.HOLD_CURSORS_OVER_COMMIT;
+ }
+
+ public int getTransactionIsolation() throws SQLException {
+ return this.transactionIsolation;
+ }
+
+ /**
+ * Retreives the type map associated with this Connection object. The type map
+ * contains entries for undefined types. This method always returns an empty
+ * map since it is not possible to add entries to this type map
+ * @return map containing undefined types(empty)
+ * @throws SQLException, should never occur
+ */
+ public Map getTypeMap() throws SQLException {
+ //Check to see the connection is open
+ checkConnection();
+ return new HashMap();
+ }
+
+ /**
+ * <p>This method will return the first warning reported by calls on this connection,
+ * or null if none exist.</p>
+ * @return A SQLWarning object if there are any warnings.
+ * @throws SQLException, should never occur
+ */
+ public SQLWarning getWarnings() throws SQLException {
+ //Check to see the connection is open
+ checkConnection();
+ return null; // we don't have any warnings
+ }
+
+ /**
+ * <p>This method will return whether this connection is closed or not.</p>
+ * @return booleanvalue indicating if the connection is closed
+ * @throws SQLException, should never occur
+ */
+ public boolean isClosed() throws SQLException {
+ return closed;
+ }
+
+ public boolean isReadOnly() throws SQLException {
+ return readOnly;
+ }
+
+ public String nativeSQL(String sql) throws SQLException {
+ // return the string argument without any modifications.
+ // escape syntaxes are directly supported in the server
+ return sql;
+ }
+
+ /**
+ * <p>Creates a CallableStatement object that contains sql and that will produce
+ * ResultSet objects that are non-scrollable and non-updatable. A SQL stored
+ * procedure call statement is handled by creating a CallableStatement for it.</p>
+ * @param sql String(escape syntax) for invoking a stored procedure.
+ * @return CallableStatement object that can be used to execute the storedProcedure
+ * @throws SQLException if there is an error creating the callable statement object
+ */
+ public CallableStatement prepareCall(String sql) throws SQLException {
+ //there is a problem setting the result set type to be non-scrollable
+ //See defect 17768
+ return prepareCall(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
+ }
+
+ /**
+ * <p>Creates a CallableStatement object that contains a sql and that will produce
+ * ResultSet objects of the type resultSetType and with a concurrency level of
+ * resultSetConcurrency. A SQL stored procedure call statement is handled by
+ * creating a CallableStatement for it.</p>
+ * @param sql String(escape syntax) for invoking a stored procedure.
+ * @param intvalue indicating the ResultSet's type
+ * @param intValue indicating the ResultSet's concurrency
+ * @return CallableStatement object that can be used to execute the storedProcedure
+ */
+ public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
+ //Check to see the connection is open
+ checkConnection();
+
+ validateResultSetType(resultSetType);
+ validateResultSetConcurrency(resultSetConcurrency);
+ validateSQL(sql);
+
+ // add the statement object to the map
+ CallableStatementImpl newStatement = CallableStatementImpl.newInstance(this, sql, resultSetType, resultSetConcurrency);
+ statements.add(newStatement);
+ return newStatement;
+ }
+
+ /**
+ * @param sql
+ * @throws TeiidSQLException
+ * @since 4.3
+ */
+ private void validateSQL(String sql) throws TeiidSQLException {
+ if (sql == null) {
+ String msg = JDBCPlugin.Util.getString("MMConnection.SQL_cannot_be_null"); //$NON-NLS-1$
+ throw new TeiidSQLException(msg);
+ }
+ }
+
+ public PreparedStatementImpl prepareStatement(String sql) throws SQLException {
+ return prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
+ }
+
+ /**
+ * <p>Creates a PreparedStatement object that contains a sql and that will produce
+ * ResultSet objects of the type resultSetType and with a concurrency level of
+ * resultSetConcurrency.</p>
+ * @param sql string representing a prepared statement
+ * @param intvalue indicating the ResultSet's type
+ * @param intValue indicating the ResultSet's concurrency
+ * @return a PreparedStatement object
+ */
+ public PreparedStatementImpl prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
+ //Check to see the connection is open
+ checkConnection();
+
+ validateResultSetType(resultSetType);
+ validateResultSetConcurrency(resultSetConcurrency);
+ validateSQL(sql);
+
+ // add the statement object to the map
+ PreparedStatementImpl newStatement = PreparedStatementImpl.newInstance(this, sql, resultSetType, resultSetConcurrency);
+ statements.add(newStatement);
+ return newStatement;
+ }
+
+ public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency,
+ int resultSetHoldability ) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void rollback() throws SQLException {
+ rollback(true);
+ }
+
+ /**
+ * Rollback the current local transaction
+ * @param startTxn
+ * @throws SQLException
+ */
+ public void rollback(boolean startTxn) throws SQLException {
+
+ //Check to see the connection is open
+ checkConnection();
+ if (!autoCommitFlag) {
+ try {
+ if (this.inLocalTxn) {
+ this.inLocalTxn = false;
+ try {
+ ResultsFuture<?> future = this.dqp.rollback();
+ future.get();
+ } catch (Exception e) {
+ throw TeiidSQLException.create(e);
+ }
+ logger.fine(JDBCPlugin.Util.getString("MMConnection.Rollback_success")); //$NON-NLS-1$
+ }
+ } finally {
+ if (startTxn) {
+ this.inLocalTxn = false;
+ }
+ else {
+ this.autoCommitFlag = true;
+ }
+ }
+ }
+ }
+
+ public ResultsFuture<?> submitSetAutoCommitTrue(boolean commit) throws SQLException {
+ //Check to see the connection is open
+ checkConnection();
+
+ if (this.autoCommitFlag) {
+ return ResultsFuture.NULL_FUTURE;
+ }
+
+ this.autoCommitFlag = true;
+
+ try {
+ if (commit) {
+ return dqp.commit();
+ }
+ return dqp.rollback();
+ } catch (XATransactionException e) {
+ throw TeiidSQLException.create(e);
+ }
+ }
+
+ public void setAutoCommit(boolean autoCommit) throws SQLException {
+ //Check to see the connection is open
+ checkConnection();
+
+ if (autoCommit == this.autoCommitFlag) {
+ return;
+ }
+
+ this.autoCommitFlag = autoCommit;
+
+ if (autoCommit) {
+ directCommit();
+ } else {
+ inLocalTxn = false;
+ }
+ }
+
+ /**
+ * <p>Teiid does not allow setting a catalog through a connection. This
+ * method silently ignores the request as per the specification.</p>
+ * @param The string values which sets the catalog name on the connection.
+ * @throws SQLException This should never occur.
+ */
+ public void setCatalog(String catalog) throws SQLException {
+ // do nothing, silently ignore the request
+ }
+
+ /**
+ * @param A boolean value specifying whether the connection is readonly.
+ * @throws throws SQLException.
+ */
+ public void setReadOnly(boolean readOnly) throws SQLException {
+ if (this.readOnly == readOnly) {
+ return;
+ }
+ // During transaction do not allow to change this flag
+ if (!autoCommitFlag || this.transactionXid != null) {
+ throw new TeiidSQLException(JDBCPlugin.Util.getString("MMStatement.Invalid_During_Transaction", "setReadOnly(" + readOnly + ")"));//$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$
+ }
+ this.readOnly = readOnly;
+ }
+
+ /**
+ * <p> This utility method checks if the jdbc connection is closed and
+ * throws an exception if it is closed. </p>
+ * @throws SQLException if the connection object is closed.
+ */
+ void checkConnection() throws SQLException{
+ //Check to see the connection is closed and proceed if it is not
+ if (closed) {
+ throw new TeiidSQLException(JDBCPlugin.Util.getString("MMConnection.Cant_use_closed_connection")); //$NON-NLS-1$
+ }
+ }
+
+ protected void commitTransaction(XidImpl arg0, boolean arg1) throws SQLException {
+ checkConnection();
+ transactionXid = null;
+ this.autoCommitFlag = true;
+ try {
+ ResultsFuture<?> future = this.dqp.commit(arg0, arg1);
+ future.get();
+ } catch (Exception e) {
+ throw TeiidSQLException.create(e);
+ }
+ }
+
+ protected void endTransaction(XidImpl arg0, int arg1) throws SQLException {
+ checkConnection();
+ this.autoCommitFlag = true;
+ try {
+ ResultsFuture<?> future = this.dqp.end(arg0, arg1);
+ future.get();
+ } catch (Exception e) {
+ throw TeiidSQLException.create(e);
+ }
+ }
+
+ protected void forgetTransaction(XidImpl arg0) throws SQLException {
+ checkConnection();
+ try {
+ ResultsFuture<?> future = this.dqp.forget(arg0);
+ future.get();
+ } catch (Exception e) {
+ throw TeiidSQLException.create(e);
+ }
+ }
+
+ protected int prepareTransaction(XidImpl arg0) throws SQLException {
+ checkConnection();
+ transactionXid = null;
+ try {
+ ResultsFuture<Integer> future = this.dqp.prepare(arg0);
+ return future.get();
+ } catch (Exception e) {
+ throw TeiidSQLException.create(e);
+ }
+ }
+
+ protected Xid[] recoverTransaction(int arg0) throws SQLException {
+ checkConnection();
+ try {
+ ResultsFuture<Xid[]> future = this.dqp.recover(arg0);
+ return future.get();
+ } catch (Exception e) {
+ throw TeiidSQLException.create(e);
+ }
+ }
+
+ protected void rollbackTransaction(XidImpl arg0) throws SQLException {
+ checkConnection();
+ transactionXid = null;
+ this.autoCommitFlag = true;
+ try {
+ ResultsFuture<?> future = this.dqp.rollback(arg0);
+ future.get();
+ } catch (Exception e) {
+ throw TeiidSQLException.create(e);
+ }
+ }
+
+ protected void startTransaction(XidImpl arg0, int arg1, int timeout) throws SQLException {
+ checkConnection();
+ try {
+ ResultsFuture<?> future = this.dqp.start(arg0, arg1, timeout);
+ future.get();
+ } catch (Exception e) {
+ throw TeiidSQLException.create(e);
+ }
+ transactionXid = arg0;
+ this.autoCommitFlag = false;
+ }
+
+ protected XidImpl getTransactionXid() {
+ return transactionXid;
+ }
+
+ public boolean isValid(int timeout) throws SQLException {
+ return this.getServerConnection().isOpen(timeout * 1000);
+ }
+
+ public void recycleConnection() {
+ try {
+ //close all open statements
+ this.closeStatements();
+ } catch (SQLException e) {
+ logger.log(Level.WARNING, JDBCPlugin.Util.getString("MMXAConnection.rolling_back_error"), e); //$NON-NLS-1$
+ }
+ try {
+ //rollback if still in a transaction
+ if (!this.getAutoCommit()) {
+ logger.warning(JDBCPlugin.Util.getString("MMXAConnection.rolling_back")); //$NON-NLS-1$
+
+ if (this.getTransactionXid() == null) {
+ this.rollback(false);
+ } else {
+ this.rollbackTransaction(getTransactionXid());
+ }
+ }
+ } catch (SQLException e) {
+ logger.log(Level.WARNING, JDBCPlugin.Util.getString("MMXAConnection.rolling_back_error"), e); //$NON-NLS-1$
+ }
+
+ this.serverConn.cleanUp();
+ }
+
+ public boolean isSameProcess(ConnectionImpl conn) throws CommunicationException {
+ return this.serverConn.isSameInstance(conn.serverConn);
+ }
+
+ public void setClientInfo(Properties properties)
+ throws SQLClientInfoException {
+ }
+
+ public void setClientInfo(String name, String value)
+ throws SQLClientInfoException {
+ }
+
+ public Properties getClientInfo() throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public String getClientInfo(String name) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public Array createArrayOf(String typeName, Object[] elements)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public Blob createBlob() throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public Clob createClob() throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public NClob createNClob() throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public SQLXML createSQLXML() throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public Statement createStatement(int resultSetType,
+ int resultSetConcurrency, int resultSetHoldability)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+
+ }
+
+ public Struct createStruct(String typeName, Object[] attributes)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public CallableStatement prepareCall(String sql, int resultSetType,
+ int resultSetConcurrency, int resultSetHoldability)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+
+ }
+
+ public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+
+ }
+
+ public PreparedStatement prepareStatement(String sql, int[] columnIndexes)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+
+ }
+
+ public PreparedStatement prepareStatement(String sql, String[] columnNames)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+
+ }
+
+ public void releaseSavepoint(Savepoint savepoint) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+
+ }
+
+ public void rollback(Savepoint savepoint) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+
+ }
+
+ public void setHoldability(int holdability) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public Savepoint setSavepoint() throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public Savepoint setSavepoint(String name) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void setTransactionIsolation(int level) throws SQLException {
+ this.transactionIsolation = level;
+ }
+
+ public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ Object setPassword(Object newPassword) {
+ if (newPassword != null) {
+ return this.connectionProps.put(TeiidURL.CONNECTION.PASSWORD, newPassword);
+ }
+ return this.connectionProps.remove(TeiidURL.CONNECTION.PASSWORD);
+ }
+
+ String getPassword() {
+ Object result = this.connectionProps.get(TeiidURL.CONNECTION.PASSWORD);
+ if (result == null) {
+ return null;
+ }
+ return result.toString();
+ }
+
+ @Override
+ public void changeUser(String userName, String newPassword)
+ throws SQLException {
+ //TODO: recycleConnection();
+ Object oldName = null;
+ Object oldPassword = null;
+ if (userName != null) {
+ oldName = this.connectionProps.put(TeiidURL.CONNECTION.USER_NAME, userName);
+ } else {
+ oldName = this.connectionProps.remove(TeiidURL.CONNECTION.USER_NAME);
+ }
+ oldPassword = setPassword(newPassword);
+ boolean success = false;
+ try {
+ this.serverConn.authenticate();
+ success = true;
+ } catch (ConnectionException e) {
+ throw TeiidSQLException.create(e);
+ } catch (CommunicationException e) {
+ throw TeiidSQLException.create(e);
+ } finally {
+ if (!success) {
+ if (oldName != null) {
+ this.connectionProps.put(TeiidURL.CONNECTION.USER_NAME, oldName);
+ } else {
+ this.connectionProps.remove(TeiidURL.CONNECTION.USER_NAME);
+ }
+ setPassword(oldPassword);
+ }
+ }
+ }
+
+}
Deleted: tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/jdbc/EmbeddedProfile.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/EmbeddedProfile.java 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/jdbc/EmbeddedProfile.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,67 +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.jdbc;
-
-import java.sql.SQLException;
-import java.util.Arrays;
-import java.util.Properties;
-
-import org.teiid.core.TeiidException;
-import org.teiid.core.TeiidRuntimeException;
-import org.teiid.core.util.ReflectionHelper;
-import org.teiid.net.CommunicationException;
-import org.teiid.net.ConnectionException;
-import org.teiid.net.ServerConnection;
-
-
-public class EmbeddedProfile implements ConnectionProfile {
-
- /**
- * This method tries to make a connection to the given URL. This class
- * will return a null if this is not the right driver to connect to the given URL.
- * @param The URL used to establish a connection.
- * @return Connection object created
- * @throws SQLException if it is unable to establish a connection
- */
- public ConnectionImpl connect(String url, Properties info)
- throws TeiidSQLException {
- try {
- ServerConnection sc = createServerConnection(info);
- return new ConnectionImpl(sc, info, url);
- } catch (TeiidRuntimeException e) {
- throw TeiidSQLException.create(e);
- } catch (ConnectionException e) {
- throw TeiidSQLException.create(e);
- } catch (CommunicationException e) {
- throw TeiidSQLException.create(e);
- } catch (TeiidException e) {
- throw TeiidSQLException.create(e);
- }
- }
-
- protected ServerConnection createServerConnection(Properties info)
- throws TeiidException {
- return (ServerConnection)ReflectionHelper.create("org.teiid.transport.LocalServerConnection", Arrays.asList(info, true), Thread.currentThread().getContextClassLoader()); //$NON-NLS-1$
- }
-
-}
Copied: tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/jdbc/EmbeddedProfile.java (from rev 3218, trunk/client/src/main/java/org/teiid/jdbc/EmbeddedProfile.java)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/jdbc/EmbeddedProfile.java (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/jdbc/EmbeddedProfile.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License 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.jdbc;
+
+import java.sql.SQLException;
+import java.util.Arrays;
+import java.util.Properties;
+
+import org.teiid.core.TeiidException;
+import org.teiid.core.TeiidRuntimeException;
+import org.teiid.core.util.PropertiesUtils;
+import org.teiid.core.util.ReflectionHelper;
+import org.teiid.net.CommunicationException;
+import org.teiid.net.ConnectionException;
+import org.teiid.net.ServerConnection;
+
+
+public class EmbeddedProfile implements ConnectionProfile {
+
+ public static final String USE_CALLING_THREAD = "useCallingThread"; //$NON-NLS-1$
+
+ /**
+ * This method tries to make a connection to the given URL. This class
+ * will return a null if this is not the right driver to connect to the given URL.
+ * @param The URL used to establish a connection.
+ * @return Connection object created
+ * @throws SQLException if it is unable to establish a connection
+ */
+ public ConnectionImpl connect(String url, Properties info)
+ throws TeiidSQLException {
+ try {
+ ServerConnection sc = createServerConnection(info);
+ return new ConnectionImpl(sc, info, url);
+ } catch (TeiidRuntimeException e) {
+ throw TeiidSQLException.create(e);
+ } catch (ConnectionException e) {
+ throw TeiidSQLException.create(e);
+ } catch (CommunicationException e) {
+ throw TeiidSQLException.create(e);
+ } catch (TeiidException e) {
+ throw TeiidSQLException.create(e);
+ }
+ }
+
+ protected ServerConnection createServerConnection(Properties info)
+ throws TeiidException {
+ return (ServerConnection)ReflectionHelper.create("org.teiid.transport.LocalServerConnection", Arrays.asList(info, PropertiesUtils.getBooleanProperty(info, USE_CALLING_THREAD, true)), Thread.currentThread().getContextClassLoader()); //$NON-NLS-1$
+ }
+
+}
Deleted: tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/jdbc/JDBCURL.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/JDBCURL.java 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/jdbc/JDBCURL.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,304 +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.jdbc;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.teiid.net.TeiidURL;
-
-/**
- * @since 4.3
- */
-public class JDBCURL {
- private static final String UTF_8 = "UTF-8"; //$NON-NLS-1$
- public static final String JDBC_PROTOCOL = "jdbc:teiid:"; //$NON-NLS-1$
-
- static final String URL_PATTERN = JDBC_PROTOCOL + "([\\w-\\.]+)(?:@([^;]*))?(;.*)?"; //$NON-NLS-1$
- static Pattern urlPattern = Pattern.compile(URL_PATTERN);
-
- public static final Set<String> EXECUTION_PROPERTIES = Collections.unmodifiableSet(new HashSet<String>(Arrays.asList(
- ExecutionProperties.PROP_TXN_AUTO_WRAP,
- ExecutionProperties.PROP_PARTIAL_RESULTS_MODE,
- ExecutionProperties.RESULT_SET_CACHE_MODE,
- ExecutionProperties.ANSI_QUOTED_IDENTIFIERS,
- ExecutionProperties.SQL_OPTION_SHOWPLAN,
- ExecutionProperties.NOEXEC,
- ExecutionProperties.PROP_FETCH_SIZE,
- ExecutionProperties.PROP_XML_FORMAT,
- ExecutionProperties.PROP_XML_VALIDATION,
- ExecutionProperties.DISABLE_LOCAL_TRANSACTIONS)));
-
- public static final Set<String> KNOWN_PROPERTIES = getKnownProperties();
-
- private static Set<String> getKnownProperties() {
- Set<String> props = new HashSet<String>(Arrays.asList(
- BaseDataSource.APP_NAME,
- BaseDataSource.VDB_NAME,
- BaseDataSource.VERSION,
- BaseDataSource.VDB_VERSION,
- BaseDataSource.USER_NAME,
- BaseDataSource.PASSWORD,
- TeiidURL.CONNECTION.AUTO_FAILOVER,
- TeiidURL.CONNECTION.DISCOVERY_STRATEGY,
- TeiidURL.CONNECTION.PASSTHROUGH_AUTHENTICATION));
- props.addAll(EXECUTION_PROPERTIES);
- return Collections.unmodifiableSet(props);
- }
-
- private String vdbName;
- private String connectionURL;
- private Properties properties = new Properties();
-
- public enum ConnectionType {
- Embedded,
- Socket
- }
-
- public static ConnectionType acceptsUrl(String url) {
- Matcher m = urlPattern.matcher(url);
- if (m.matches()) {
- return m.group(2) != null?ConnectionType.Socket:ConnectionType.Embedded;
- }
- return null;
- }
-
- private String urlString;
-
- public JDBCURL(String jdbcURL) {
- parseURL(jdbcURL);
- }
-
- public JDBCURL(String vdbName, String connectionURL, Properties props) {
- if (vdbName == null || vdbName.trim().length() == 0) {
- throw new IllegalArgumentException();
- }
- this.vdbName = vdbName;
- this.connectionURL = connectionURL;
- if (props != null) {
- normalizeProperties(props, this.properties);
- }
- }
-
- public String getVDBName() {
- return vdbName;
- }
-
- public String getConnectionURL() {
- return connectionURL;
- }
-
- public Properties getProperties() {
- // Make a copy of the properties object, including any non-string values that may be contained in the map.
- Properties newProps = new Properties();
- newProps.putAll(this.properties);
- return newProps;
- }
-
- private void parseURL(String jdbcURL) {
- if (jdbcURL == null) {
- throw new IllegalArgumentException();
- }
- // Trim extra spaces
- jdbcURL = jdbcURL.trim();
- if (jdbcURL.length() == 0) {
- throw new IllegalArgumentException();
- }
-
- Matcher m = urlPattern.matcher(jdbcURL);
- if (!m.matches()) {
- throw new IllegalArgumentException();
- }
- vdbName = m.group(1);
- connectionURL = m.group(2);
- if (connectionURL != null) {
- connectionURL = connectionURL.trim();
- }
- String props = m.group(3);
- if (props != null) {
- parseConnectionProperties(props, this.properties);
- }
- }
-
- public static void parseConnectionProperties(String connectionInfo, Properties p) {
- String[] connectionParts = connectionInfo.split(";"); //$NON-NLS-1$
- if (connectionParts.length != 0) {
- // The rest should be connection params
- for (int i = 0; i < connectionParts.length; i++) {
- parseConnectionProperty(connectionParts[i], p);
- }
- }
- }
-
- static void parseConnectionProperty(String connectionProperty, Properties p) {
- if (connectionProperty.length() == 0) {
- // Be tolerant of double-semicolons and dangling semicolons
- return;
- } else if(connectionProperty.length() < 3) {
- // key=value must have at least 3 characters
- throw new IllegalArgumentException();
- }
- int firstEquals = connectionProperty.indexOf('=');
- if(firstEquals < 1) {
- throw new IllegalArgumentException();
- }
- String key = connectionProperty.substring(0, firstEquals).trim();
- String value = connectionProperty.substring(firstEquals+1).trim();
- if(value.indexOf('=') >= 0) {
- throw new IllegalArgumentException();
- }
- addNormalizedProperty(key, getValidValue(value), p);
- }
-
- public String getJDBCURL() {
- if (urlString == null) {
- StringBuffer buf = new StringBuffer(JDBC_PROTOCOL)
- .append(vdbName);
- if (this.connectionURL != null) {
- buf.append('@').append(connectionURL);
- }
- for (Iterator i = properties.entrySet().iterator(); i.hasNext();) {
- Map.Entry entry = (Map.Entry)i.next();
- if (entry.getValue() instanceof String) {
- // get only the string properties, because a non-string property could not have been set on the url.
- buf.append(';')
- .append(entry.getKey())
- .append('=')
- .append(entry.getValue());
- }
- }
- urlString = buf.toString();
- }
- return urlString;
- }
-
- public String getProperty(String key) {
- return properties.getProperty(key);
- }
-
- public String getUserName() {
- return properties.getProperty(BaseDataSource.USER_NAME);
- }
-
- public String getPassword() {
- return properties.getProperty(BaseDataSource.PASSWORD);
- }
-
- public String getVDBVersion() {
- if (properties.contains(BaseDataSource.VDB_VERSION)) {
- return properties.getProperty(BaseDataSource.VDB_VERSION);
- }
- return properties.getProperty(BaseDataSource.VERSION);
- }
-
- public String getTransactionAutowrapMode() {
- return properties.getProperty(ExecutionProperties.PROP_TXN_AUTO_WRAP);
- }
-
- public String getPartialResultsMode() {
- return properties.getProperty(ExecutionProperties.PROP_PARTIAL_RESULTS_MODE);
- }
-
- public String getResultSetCacheMode() {
- return properties.getProperty(ExecutionProperties.RESULT_SET_CACHE_MODE);
- }
-
- public String getAnsiQuotedIdentifiers() {
- return properties.getProperty(ExecutionProperties.ANSI_QUOTED_IDENTIFIERS);
- }
-
- public String getFetchSize() {
- return properties.getProperty(ExecutionProperties.PROP_FETCH_SIZE);
- }
-
- public String getXMLFormat() {
- return properties.getProperty(ExecutionProperties.PROP_XML_FORMAT);
- }
-
- public String getXMLValidation() {
- return properties.getProperty(ExecutionProperties.PROP_XML_VALIDATION);
- }
-
- public String getTransparentFailover() {
- return properties.getProperty(TeiidURL.CONNECTION.AUTO_FAILOVER);
- }
-
- public String getDisableLocalTransactions() {
- return properties.getProperty(ExecutionProperties.DISABLE_LOCAL_TRANSACTIONS);
- }
-
- public String toString() {
- return getJDBCURL();
- }
-
- private static void normalizeProperties(Properties source, Properties target) {
- for (Enumeration e = source.propertyNames(); e.hasMoreElements();) {
- String key = (String)e.nextElement();
- addNormalizedProperty(key, source.get(key), target);
- }
- }
-
- public static void addNormalizedProperty(String key, Object value, Properties target) {
- String validKey = getValidKey(key);
-
- // now add the normalized key and value into the properties object.
- target.put(validKey, value);
- }
-
- public static String getValidKey(String key) {
- for (String prop : KNOWN_PROPERTIES) {
- if (prop.equalsIgnoreCase(key)) {
- return prop;
- }
- }
- return key;
- }
-
- private static Object getValidValue(Object value) {
- if (value instanceof String) {
- try {
- // Decode the value of the property if incase they were encoded.
- return URLDecoder.decode((String)value, UTF_8);
- } catch (UnsupportedEncodingException e) {
- // use the original value
- }
- }
- return value;
- }
-
- public static Properties normalizeProperties(Properties props) {
- normalizeProperties(props, props);
- return props;
- }
-
-}
Copied: tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/jdbc/JDBCURL.java (from rev 3218, trunk/client/src/main/java/org/teiid/jdbc/JDBCURL.java)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/jdbc/JDBCURL.java (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/jdbc/JDBCURL.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,305 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License 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.jdbc;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.teiid.net.TeiidURL;
+
+/**
+ * @since 4.3
+ */
+public class JDBCURL {
+ private static final String UTF_8 = "UTF-8"; //$NON-NLS-1$
+ public static final String JDBC_PROTOCOL = "jdbc:teiid:"; //$NON-NLS-1$
+
+ static final String URL_PATTERN = JDBC_PROTOCOL + "([\\w-\\.]+)(?:@([^;]*))?(;.*)?"; //$NON-NLS-1$
+ static Pattern urlPattern = Pattern.compile(URL_PATTERN);
+
+ public static final Set<String> EXECUTION_PROPERTIES = Collections.unmodifiableSet(new HashSet<String>(Arrays.asList(
+ ExecutionProperties.PROP_TXN_AUTO_WRAP,
+ ExecutionProperties.PROP_PARTIAL_RESULTS_MODE,
+ ExecutionProperties.RESULT_SET_CACHE_MODE,
+ ExecutionProperties.ANSI_QUOTED_IDENTIFIERS,
+ ExecutionProperties.SQL_OPTION_SHOWPLAN,
+ ExecutionProperties.NOEXEC,
+ ExecutionProperties.PROP_FETCH_SIZE,
+ ExecutionProperties.PROP_XML_FORMAT,
+ ExecutionProperties.PROP_XML_VALIDATION,
+ EmbeddedProfile.USE_CALLING_THREAD,
+ ExecutionProperties.DISABLE_LOCAL_TRANSACTIONS)));
+
+ public static final Set<String> KNOWN_PROPERTIES = getKnownProperties();
+
+ private static Set<String> getKnownProperties() {
+ Set<String> props = new HashSet<String>(Arrays.asList(
+ BaseDataSource.APP_NAME,
+ BaseDataSource.VDB_NAME,
+ BaseDataSource.VERSION,
+ BaseDataSource.VDB_VERSION,
+ BaseDataSource.USER_NAME,
+ BaseDataSource.PASSWORD,
+ TeiidURL.CONNECTION.AUTO_FAILOVER,
+ TeiidURL.CONNECTION.DISCOVERY_STRATEGY,
+ TeiidURL.CONNECTION.PASSTHROUGH_AUTHENTICATION));
+ props.addAll(EXECUTION_PROPERTIES);
+ return Collections.unmodifiableSet(props);
+ }
+
+ private String vdbName;
+ private String connectionURL;
+ private Properties properties = new Properties();
+
+ public enum ConnectionType {
+ Embedded,
+ Socket
+ }
+
+ public static ConnectionType acceptsUrl(String url) {
+ Matcher m = urlPattern.matcher(url);
+ if (m.matches()) {
+ return m.group(2) != null?ConnectionType.Socket:ConnectionType.Embedded;
+ }
+ return null;
+ }
+
+ private String urlString;
+
+ public JDBCURL(String jdbcURL) {
+ parseURL(jdbcURL);
+ }
+
+ public JDBCURL(String vdbName, String connectionURL, Properties props) {
+ if (vdbName == null || vdbName.trim().length() == 0) {
+ throw new IllegalArgumentException();
+ }
+ this.vdbName = vdbName;
+ this.connectionURL = connectionURL;
+ if (props != null) {
+ normalizeProperties(props, this.properties);
+ }
+ }
+
+ public String getVDBName() {
+ return vdbName;
+ }
+
+ public String getConnectionURL() {
+ return connectionURL;
+ }
+
+ public Properties getProperties() {
+ // Make a copy of the properties object, including any non-string values that may be contained in the map.
+ Properties newProps = new Properties();
+ newProps.putAll(this.properties);
+ return newProps;
+ }
+
+ private void parseURL(String jdbcURL) {
+ if (jdbcURL == null) {
+ throw new IllegalArgumentException();
+ }
+ // Trim extra spaces
+ jdbcURL = jdbcURL.trim();
+ if (jdbcURL.length() == 0) {
+ throw new IllegalArgumentException();
+ }
+
+ Matcher m = urlPattern.matcher(jdbcURL);
+ if (!m.matches()) {
+ throw new IllegalArgumentException();
+ }
+ vdbName = m.group(1);
+ connectionURL = m.group(2);
+ if (connectionURL != null) {
+ connectionURL = connectionURL.trim();
+ }
+ String props = m.group(3);
+ if (props != null) {
+ parseConnectionProperties(props, this.properties);
+ }
+ }
+
+ public static void parseConnectionProperties(String connectionInfo, Properties p) {
+ String[] connectionParts = connectionInfo.split(";"); //$NON-NLS-1$
+ if (connectionParts.length != 0) {
+ // The rest should be connection params
+ for (int i = 0; i < connectionParts.length; i++) {
+ parseConnectionProperty(connectionParts[i], p);
+ }
+ }
+ }
+
+ static void parseConnectionProperty(String connectionProperty, Properties p) {
+ if (connectionProperty.length() == 0) {
+ // Be tolerant of double-semicolons and dangling semicolons
+ return;
+ } else if(connectionProperty.length() < 3) {
+ // key=value must have at least 3 characters
+ throw new IllegalArgumentException();
+ }
+ int firstEquals = connectionProperty.indexOf('=');
+ if(firstEquals < 1) {
+ throw new IllegalArgumentException();
+ }
+ String key = connectionProperty.substring(0, firstEquals).trim();
+ String value = connectionProperty.substring(firstEquals+1).trim();
+ if(value.indexOf('=') >= 0) {
+ throw new IllegalArgumentException();
+ }
+ addNormalizedProperty(key, getValidValue(value), p);
+ }
+
+ public String getJDBCURL() {
+ if (urlString == null) {
+ StringBuffer buf = new StringBuffer(JDBC_PROTOCOL)
+ .append(vdbName);
+ if (this.connectionURL != null) {
+ buf.append('@').append(connectionURL);
+ }
+ for (Iterator i = properties.entrySet().iterator(); i.hasNext();) {
+ Map.Entry entry = (Map.Entry)i.next();
+ if (entry.getValue() instanceof String) {
+ // get only the string properties, because a non-string property could not have been set on the url.
+ buf.append(';')
+ .append(entry.getKey())
+ .append('=')
+ .append(entry.getValue());
+ }
+ }
+ urlString = buf.toString();
+ }
+ return urlString;
+ }
+
+ public String getProperty(String key) {
+ return properties.getProperty(key);
+ }
+
+ public String getUserName() {
+ return properties.getProperty(BaseDataSource.USER_NAME);
+ }
+
+ public String getPassword() {
+ return properties.getProperty(BaseDataSource.PASSWORD);
+ }
+
+ public String getVDBVersion() {
+ if (properties.contains(BaseDataSource.VDB_VERSION)) {
+ return properties.getProperty(BaseDataSource.VDB_VERSION);
+ }
+ return properties.getProperty(BaseDataSource.VERSION);
+ }
+
+ public String getTransactionAutowrapMode() {
+ return properties.getProperty(ExecutionProperties.PROP_TXN_AUTO_WRAP);
+ }
+
+ public String getPartialResultsMode() {
+ return properties.getProperty(ExecutionProperties.PROP_PARTIAL_RESULTS_MODE);
+ }
+
+ public String getResultSetCacheMode() {
+ return properties.getProperty(ExecutionProperties.RESULT_SET_CACHE_MODE);
+ }
+
+ public String getAnsiQuotedIdentifiers() {
+ return properties.getProperty(ExecutionProperties.ANSI_QUOTED_IDENTIFIERS);
+ }
+
+ public String getFetchSize() {
+ return properties.getProperty(ExecutionProperties.PROP_FETCH_SIZE);
+ }
+
+ public String getXMLFormat() {
+ return properties.getProperty(ExecutionProperties.PROP_XML_FORMAT);
+ }
+
+ public String getXMLValidation() {
+ return properties.getProperty(ExecutionProperties.PROP_XML_VALIDATION);
+ }
+
+ public String getTransparentFailover() {
+ return properties.getProperty(TeiidURL.CONNECTION.AUTO_FAILOVER);
+ }
+
+ public String getDisableLocalTransactions() {
+ return properties.getProperty(ExecutionProperties.DISABLE_LOCAL_TRANSACTIONS);
+ }
+
+ public String toString() {
+ return getJDBCURL();
+ }
+
+ private static void normalizeProperties(Properties source, Properties target) {
+ for (Enumeration e = source.propertyNames(); e.hasMoreElements();) {
+ String key = (String)e.nextElement();
+ addNormalizedProperty(key, source.get(key), target);
+ }
+ }
+
+ public static void addNormalizedProperty(String key, Object value, Properties target) {
+ String validKey = getValidKey(key);
+
+ // now add the normalized key and value into the properties object.
+ target.put(validKey, value);
+ }
+
+ public static String getValidKey(String key) {
+ for (String prop : KNOWN_PROPERTIES) {
+ if (prop.equalsIgnoreCase(key)) {
+ return prop;
+ }
+ }
+ return key;
+ }
+
+ private static Object getValidValue(Object value) {
+ if (value instanceof String) {
+ try {
+ // Decode the value of the property if incase they were encoded.
+ return URLDecoder.decode((String)value, UTF_8);
+ } catch (UnsupportedEncodingException e) {
+ // use the original value
+ }
+ }
+ return value;
+ }
+
+ public static Properties normalizeProperties(Properties props) {
+ normalizeProperties(props, props);
+ return props;
+ }
+
+}
Deleted: tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/jdbc/StatementImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/jdbc/StatementImpl.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,1226 +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.jdbc;
-
-import java.io.Serializable;
-import java.lang.ref.WeakReference;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.sql.SQLWarning;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.TimeZone;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.teiid.client.DQP;
-import org.teiid.client.RequestMessage;
-import org.teiid.client.ResultsMessage;
-import org.teiid.client.RequestMessage.ResultsMode;
-import org.teiid.client.RequestMessage.ShowPlan;
-import org.teiid.client.metadata.ParameterInfo;
-import org.teiid.client.metadata.ResultsMetadataConstants;
-import org.teiid.client.metadata.ResultsMetadataDefaults;
-import org.teiid.client.plan.Annotation;
-import org.teiid.client.plan.PlanNode;
-import org.teiid.client.util.ResultsFuture;
-import org.teiid.core.TeiidComponentException;
-import org.teiid.core.TeiidException;
-import org.teiid.core.TeiidProcessingException;
-import org.teiid.core.types.JDBCSQLTypeInfo;
-import org.teiid.core.types.SQLXMLImpl;
-import org.teiid.core.util.SqlUtil;
-import org.teiid.core.util.StringUtil;
-import org.teiid.jdbc.CancellationTimer.CancelTask;
-
-
-public class StatementImpl extends WrapperImpl implements TeiidStatement {
- private static Logger logger = Logger.getLogger("org.teiid.jdbc"); //$NON-NLS-1$
-
- static CancellationTimer cancellationTimer = new CancellationTimer("Teiid Statement Timeout"); //$NON-NLS-1$
-
- private static final class QueryTimeoutCancelTask extends CancelTask {
- private WeakReference<StatementImpl> ref;
- private QueryTimeoutCancelTask(long delay, StatementImpl stmt) {
- super(delay);
- this.ref = new WeakReference<StatementImpl>(stmt);
- }
-
- @Override
- public void run() {
- StatementImpl stmt = ref.get();
- if (stmt != null) {
- stmt.timeoutOccurred();
- }
- }
- }
-
- enum State {
- RUNNING,
- DONE,
- TIMED_OUT,
- CANCELLED
- }
- protected static final int NO_TIMEOUT = 0;
-
- // integer indicating no maximum limit - used in some metadata-ish methods.
- private static final int NO_LIMIT = 0;
-
- //######## Configuration state #############
- private ConnectionImpl driverConnection;
- private Properties execProps;
-
- // fetch size value. This is the default fetch size used by the server
- private int fetchSize = BaseDataSource.DEFAULT_FETCH_SIZE;
-
- // the fetch direction
- private int fetchDirection = ResultSet.FETCH_FORWARD;
-
- // the result set type
- private int resultSetType = ResultSet.TYPE_FORWARD_ONLY;
- private int resultSetConcurrency = ResultSet.CONCUR_READ_ONLY;
-
- //######## Processing state #############
-
- // boolean to indicate if this statement object is closed
- private boolean isClosed = false;
-
- // Differentiate timeout from cancel in blocking asynch operation
- protected volatile State commandStatus = State.RUNNING;
-
- // number of seconds for the query to timeout.
- protected long queryTimeoutMS = NO_TIMEOUT;
-
- //########## Per-execution state ########
-
- // ID for current request
- protected long currentRequestID = -1;
-
- // the last query plan description
- private PlanNode currentPlanDescription;
-
- // the last query debug log
- private String debugLog;
-
- // the last query annotations
- private Collection<Annotation> annotations;
-
- // resultSet object produced by execute methods on the statement.
- protected volatile ResultSetImpl resultSet;
-
- private List<Exception> serverWarnings;
-
- // the per-execution security payload
- private Serializable payload;
-
- /** List of INSERT, UPDATE, DELETE AND SELECT INTO commands */
- private List batchedUpdates;
-
- /** Array of update counts as returned by executeBatch() */
- protected int[] updateCounts;
-
- /** default Calendar instance for converting date/time/timestamp values */
- private Calendar defaultCalendar;
- /** Max rows to be returned by executing the statement */
- private int maxRows = NO_LIMIT;
- private int maxFieldSize = NO_LIMIT;
-
- //Map<out/inout/return param index --> index in results>
- protected Map outParamIndexMap = new HashMap();
-
- private static Pattern TRANSACTION_STATEMENT = Pattern.compile("\\s*(commit|rollback|(start\\s+transaction))\\s*;?", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$
- private static Pattern SET_STATEMENT = Pattern.compile("\\s*set\\s+(\\w+)\\s*([^;]*);?", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$
- private static Pattern SHOW_STATEMENT = Pattern.compile("\\s*show\\s+(\\w*);?", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$
- /**
- * Factory Constructor
- * @param driverConnection
- * @param resultSetType
- * @param resultSetConcurrency
- */
- static StatementImpl newInstance(ConnectionImpl driverConnection, int resultSetType, int resultSetConcurrency) {
- return new StatementImpl(driverConnection, resultSetType, resultSetConcurrency);
- }
-
- /**
- * MMStatement Constructor.
- * @param driverConnection
- * @param resultSetType
- * @param resultSetConcurrency
- */
- StatementImpl(ConnectionImpl driverConnection, int resultSetType, int resultSetConcurrency) {
- this.driverConnection = driverConnection;
- this.resultSetType = resultSetType;
- this.resultSetConcurrency = resultSetConcurrency;
- this.execProps = new Properties(this.driverConnection.getExecutionProperties());
-
- // Set initial fetch size
- String fetchSizeStr = this.execProps.getProperty(ExecutionProperties.PROP_FETCH_SIZE);
- if(fetchSizeStr != null) {
- try {
- this.fetchSize = Integer.parseInt(fetchSizeStr);
- } catch(Exception e) {
- // silently failover to default
- }
- }
- String queryTimeoutStr = this.execProps.getProperty(ExecutionProperties.QUERYTIMEOUT);
- if(queryTimeoutStr != null) {
- try {
- this.queryTimeoutMS = Integer.parseInt(fetchSizeStr)*1000;
- } catch(Exception e) {
- // silently failover to default
- }
- }
- }
-
- protected DQP getDQP() {
- return this.driverConnection.getDQP();
- }
-
- protected ConnectionImpl getMMConnection() {
- return this.driverConnection;
- }
-
- protected TimeZone getServerTimeZone() throws SQLException {
- return this.driverConnection.getServerConnection().getLogonResult().getTimeZone();
- }
-
- /**
- * Reset all per-execution state - this should be done before executing
- * a new command.
- */
- protected void resetExecutionState() throws SQLException {
- this.currentRequestID = -1;
-
- this.currentPlanDescription = null;
- this.debugLog = null;
- this.annotations = null;
-
- if ( this.resultSet != null ) {
- this.resultSet.close();
- this.resultSet = null;
- }
-
- this.serverWarnings = null;
-
- this.batchedUpdates = null;
- this.updateCounts = null;
- this.outParamIndexMap.clear();
- }
-
- /**
- * Adds sql to this statement object's current list of commands.
- * @param sql statement to be added to the batch
- */
- public void addBatch(String sql) throws SQLException {
- //Check to see the statement is closed and throw an exception
- checkStatement();
- if (batchedUpdates == null) {
- batchedUpdates = new ArrayList();
- }
- batchedUpdates.add(sql);
- }
-
- /**
- * This method can be used by one thread to cancel a statement that is being
- * executed by another thread.
- * @throws SQLException should never occur.
- */
- public void cancel() throws SQLException {
- /* Defect 19848 - Mark the statement cancelled before sending the CANCEL request.
- * Otherwise, it's possible get into a race where the server response is quicker
- * than the exception in the exception in the conditionalWait(), which results in
- * the statement.executeQuery() call throwing the server's exception instead of the
- * one generated by the conditionalWait() method.
- */
- commandStatus = State.CANCELLED;
- cancelRequest();
- }
-
- /**
- * Warning could be schema validation errors or partial results warnings.
- * @throws SQLException should never occur.
- */
- public void clearWarnings() throws SQLException {
- //Check to see the statement is closed and throw an exception
- checkStatement();
-
- // clear all the warnings on this statement, after this, getWarnings() should return null
- serverWarnings = null;
- }
-
- /**
- * Makes the set of commands in the current batch empty.
- *
- * @throws SQLException if a database access error occurs or the
- * driver does not support batch statements
- */
- public void clearBatch() throws SQLException {
- batchedUpdates.clear();
- }
-
- /**
- * In many cases, it is desirable to immediately release a Statements's database
- * and JDBC resources instead of waiting for this to happen when it is automatically
- * closed; the close method provides this immediate release.
- * @throws SQLException should never occur.
- */
- public void close() throws SQLException {
- if ( isClosed ) {
- return;
- }
-
- // close the the server's statement object (if necessary)
- if(resultSet != null) {
- resultSet.close();
- resultSet = null;
- }
-
- isClosed = true;
-
- // Remove link from connection to statement
- this.driverConnection.closeStatement(this);
-
- logger.fine(JDBCPlugin.Util.getString("MMStatement.Close_stmt_success")); //$NON-NLS-1$
- }
-
- /**
- * <p> This utility method checks if the jdbc statement is closed and
- * throws an exception if it is closed. </p>
- * @throws SQLException if the statement object is closed.
- */
- protected void checkStatement() throws TeiidSQLException {
- //Check to see the connection is closed and proceed if it is not
- if ( isClosed ) {
- throw new TeiidSQLException(JDBCPlugin.Util.getString("MMStatement.Stmt_closed")); //$NON-NLS-1$
- }
- }
-
- public ResultsFuture<Boolean> submitExecute(String sql) throws SQLException {
- return executeSql(new String[] {sql}, false, ResultsMode.EITHER, false);
- }
-
- @Override
- public boolean execute(String sql) throws SQLException {
- executeSql(new String[] {sql}, false, ResultsMode.EITHER, true);
- return hasResultSet();
- }
-
- @Override
- public int[] executeBatch() throws SQLException {
- if (batchedUpdates == null || batchedUpdates.isEmpty()) {
- return new int[0];
- }
- String[] commands = (String[])batchedUpdates.toArray(new String[batchedUpdates.size()]);
- executeSql(commands, true, ResultsMode.UPDATECOUNT, true);
- return updateCounts;
- }
-
- @Override
- public ResultSet executeQuery(String sql) throws SQLException {
- executeSql(new String[] {sql}, false, ResultsMode.RESULTSET, true);
- return resultSet;
- }
-
- @Override
- public int executeUpdate(String sql) throws SQLException {
- String[] commands = new String[] {sql};
- executeSql(commands, false, ResultsMode.UPDATECOUNT, true);
- return this.updateCounts[0];
- }
-
- protected boolean hasResultSet() throws SQLException {
- return resultSet != null && resultSet.getMetaData().getColumnCount() > 0;
- }
-
- protected void createResultSet(ResultsMessage resultsMsg) throws SQLException {
- //create out/return parameter index map if there is any
- List listOfParameters = resultsMsg.getParameters();
- if(listOfParameters != null){
- //get the size of result set
- int resultSetSize = 0;
- Iterator iteratorOfParameters = listOfParameters.iterator();
- while(iteratorOfParameters.hasNext()){
- ParameterInfo parameter = (ParameterInfo)iteratorOfParameters.next();
- if(parameter.getType() == ParameterInfo.RESULT_SET){
- resultSetSize = parameter.getNumColumns();
- //one ResultSet only
- break;
- }
- }
-
- //return needs to be the first
- int index = 0; //index in user call - {?=call sp(?)}
- int count = 0;
- iteratorOfParameters = listOfParameters.iterator();
- while(iteratorOfParameters.hasNext()){
- ParameterInfo parameter = (ParameterInfo)iteratorOfParameters.next();
- if(parameter.getType() == ParameterInfo.RETURN_VALUE){
- count++;
- index++;
- outParamIndexMap.put(new Integer(index), new Integer(resultSetSize + count));
- break;
- }
- }
-
- iteratorOfParameters = listOfParameters.iterator();
- while(iteratorOfParameters.hasNext()){
- ParameterInfo parameter = (ParameterInfo)iteratorOfParameters.next();
- if(parameter.getType() != ParameterInfo.RETURN_VALUE && parameter.getType() != ParameterInfo.RESULT_SET){
- index++;
- if(parameter.getType() == ParameterInfo.OUT || parameter.getType() == ParameterInfo.INOUT){
- count++;
- outParamIndexMap.put(new Integer(index), new Integer(resultSetSize + count));
- }
- }
- }
- }
-
- resultSet = new ResultSetImpl(resultsMsg, this, null, outParamIndexMap.size());
- resultSet.setMaxFieldSize(this.maxFieldSize);
- }
-
- @SuppressWarnings("unchecked")
- protected ResultsFuture<Boolean> executeSql(String[] commands, boolean isBatchedCommand, ResultsMode resultsMode, boolean synch)
- throws SQLException {
- checkStatement();
- resetExecutionState();
- if (logger.isLoggable(Level.FINER)) {
- logger.finer("Executing: requestID " + getCurrentRequestID() + " commands: " + Arrays.toString(commands) + " expecting: " + resultsMode); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- if (commands.length == 1) {
- Matcher match = SET_STATEMENT.matcher(commands[0]);
- if (match.matches()) {
- if (resultsMode == ResultsMode.RESULTSET) {
- throw new TeiidSQLException(JDBCPlugin.Util.getString("StatementImpl.set_result_set")); //$NON-NLS-1$
- }
- String key = match.group(1);
- String value = match.group(2);
- if (ExecutionProperties.NEWINSTANCE.equalsIgnoreCase(key) && Boolean.valueOf(value)) {
- this.getMMConnection().getServerConnection().cleanUp();
- } else {
- JDBCURL.addNormalizedProperty(key, value, this.driverConnection.getExecutionProperties());
- }
- this.updateCounts = new int[] {0};
- return booleanFuture(true);
- }
- match = TRANSACTION_STATEMENT.matcher(commands[0]);
- if (match.matches()) {
- logger.finer("Executing as transaction statement"); //$NON-NLS-1$
- if (resultsMode == ResultsMode.RESULTSET) {
- throw new TeiidSQLException(JDBCPlugin.Util.getString("StatementImpl.set_result_set")); //$NON-NLS-1$
- }
- String command = match.group(1);
- Boolean commit = null;
- if (StringUtil.startsWithIgnoreCase(command, "start")) { //$NON-NLS-1$
- //TODO: this should force a start and through an exception if we're already in a txn
- this.getConnection().setAutoCommit(false);
- } else if (command.equalsIgnoreCase("commit")) { //$NON-NLS-1$
- commit = true;
- if (synch) {
- this.getConnection().setAutoCommit(true);
- }
- } else if (command.equalsIgnoreCase("rollback")) { //$NON-NLS-1$
- commit = false;
- if (synch) {
- this.getConnection().rollback(false);
- }
- }
- this.updateCounts = new int[] {0};
- if (commit != null && !synch) {
- ResultsFuture<?> pending = this.getConnection().submitSetAutoCommitTrue(commit);
- final ResultsFuture<Boolean> result = new ResultsFuture<Boolean>();
- pending.addCompletionListener(new ResultsFuture.CompletionListener() {
- @Override
- public void onCompletion(ResultsFuture future) {
- try {
- future.get();
- result.getResultsReceiver().receiveResults(false);
- } catch (Throwable t) {
- result.getResultsReceiver().exceptionOccurred(t);
- }
- }
- });
- return result;
- }
- return booleanFuture(false);
- }
- match = SHOW_STATEMENT.matcher(commands[0]);
- if (match.matches()) {
- logger.finer("Executing as show statement"); //$NON-NLS-1$
- if (resultsMode == ResultsMode.UPDATECOUNT) {
- throw new TeiidSQLException(JDBCPlugin.Util.getString("StatementImpl.show_update_count")); //$NON-NLS-1$
- }
- String show = match.group(1);
- if (show.equalsIgnoreCase("PLAN")) { //$NON-NLS-1$
- List<ArrayList<Object>> records = new ArrayList<ArrayList<Object>>(1);
- PlanNode plan = driverConnection.getCurrentPlanDescription();
- if (plan != null) {
- ArrayList<Object> row = new ArrayList<Object>(3);
- row.add(DataTypeTransformer.getClob(plan.toString()));
- row.add(new SQLXMLImpl(plan.toXml()));
- row.add(DataTypeTransformer.getClob(driverConnection.getDebugLog()));
- records.add(row);
- }
- createResultSet(records, new String[] {"PLAN_TEXT", "PLAN_XML", "DEBUG_LOG"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- new String[] {JDBCSQLTypeInfo.CLOB, JDBCSQLTypeInfo.XML, JDBCSQLTypeInfo.CLOB});
- return booleanFuture(true);
- }
- if (show.equalsIgnoreCase("ANNOTATIONS")) { //$NON-NLS-1$
- List<ArrayList<Object>> records = new ArrayList<ArrayList<Object>>(1);
- Collection<Annotation> annos = driverConnection.getAnnotations();
- for (Annotation annotation : annos) {
- ArrayList<Object> row = new ArrayList<Object>(4);
- row.add(annotation.getCategory());
- row.add(annotation.getPriority().name());
- row.add(annotation.getAnnotation());
- row.add(annotation.getResolution());
- records.add(row);
- }
- createResultSet(records, new String[] {"CATEGORY", "PRIORITY", "ANNOTATION", "RESOLUTION"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- new String[] {JDBCSQLTypeInfo.STRING, JDBCSQLTypeInfo.STRING, JDBCSQLTypeInfo.STRING, JDBCSQLTypeInfo.STRING});
- return booleanFuture(true);
- }
- if (show.equalsIgnoreCase("ALL")) { //$NON-NLS-1$
- List<ArrayList<Object>> records = new ArrayList<ArrayList<Object>>(1);
- for (String key : driverConnection.getExecutionProperties().stringPropertyNames()) {
- ArrayList<Object> row = new ArrayList<Object>(4);
- row.add(key);
- row.add(driverConnection.getExecutionProperties().get(key));
- records.add(row);
- }
- createResultSet(records, new String[] {"NAME", "VALUE"}, //$NON-NLS-1$ //$NON-NLS-2$
- new String[] {JDBCSQLTypeInfo.STRING, JDBCSQLTypeInfo.STRING});
- return booleanFuture(true);
- }
- List<List<String>> records = Collections.singletonList(Collections.singletonList(driverConnection.getExecutionProperties().getProperty(JDBCURL.getValidKey(show))));
- createResultSet(records, new String[] {show}, new String[] {JDBCSQLTypeInfo.STRING});
- return booleanFuture(true);
- }
- }
-
- final RequestMessage reqMessage = createRequestMessage(commands, isBatchedCommand, resultsMode);
- reqMessage.setSync(synch);
- ResultsFuture<ResultsMessage> pendingResult = execute(reqMessage, synch);
- final ResultsFuture<Boolean> result = new ResultsFuture<Boolean>();
- pendingResult.addCompletionListener(new ResultsFuture.CompletionListener<ResultsMessage>() {
- @Override
- public void onCompletion(ResultsFuture<ResultsMessage> future) {
- try {
- postReceiveResults(reqMessage, future.get());
- result.getResultsReceiver().receiveResults(hasResultSet());
- } catch (Throwable t) {
- result.getResultsReceiver().exceptionOccurred(t);
- }
- }
- });
- if (synch) {
- try {
- if (queryTimeoutMS > 0) {
- pendingResult.get(queryTimeoutMS, TimeUnit.MILLISECONDS);
- } else {
- pendingResult.get();
- }
- result.get(); //throw an exception if needed
- return result;
- } catch (ExecutionException e) {
- if (e.getCause() instanceof SQLException) {
- throw (SQLException)e.getCause();
- }
- throw TeiidSQLException.create(e);
- } catch (InterruptedException e) {
- timeoutOccurred();
- } catch (TimeoutException e) {
- timeoutOccurred();
- }
- throw new TeiidSQLException(JDBCPlugin.Util.getString("MMStatement.Timeout_before_complete")); //$NON-NLS-1$
- }
- return result;
- }
-
- private ResultsFuture<ResultsMessage> execute(final RequestMessage reqMsg, boolean synch) throws SQLException,
- TeiidSQLException {
- this.getConnection().beginLocalTxnIfNeeded();
- this.currentRequestID = this.driverConnection.nextRequestID();
- // Create a request message
- reqMsg.setExecutionPayload(this.payload);
- reqMsg.setCursorType(this.resultSetType);
- reqMsg.setFetchSize(this.fetchSize);
- reqMsg.setRowLimit(this.maxRows);
- reqMsg.setTransactionIsolation(this.driverConnection.getTransactionIsolation());
-
- // Get connection properties and set them onto request message
- copyPropertiesToRequest(reqMsg);
-
- reqMsg.setExecutionId(this.currentRequestID);
-
- ResultsFuture.CompletionListener<ResultsMessage> compeletionListener = null;
- if (queryTimeoutMS > 0 && !synch) {
- final CancelTask c = new QueryTimeoutCancelTask(queryTimeoutMS, this);
- cancellationTimer.add(c);
- compeletionListener = new ResultsFuture.CompletionListener<ResultsMessage>() {
- @Override
- public void onCompletion(ResultsFuture<ResultsMessage> future) {
- cancellationTimer.remove(c);
- }
- };
- }
-
- ResultsFuture<ResultsMessage> pendingResult = null;
- try {
- pendingResult = this.getDQP().executeRequest(this.currentRequestID, reqMsg);
- } catch (TeiidException e) {
- throw TeiidSQLException.create(e);
- }
- if (compeletionListener != null) {
- pendingResult.addCompletionListener(compeletionListener);
- }
- return pendingResult;
- }
-
- public static ResultsFuture<Boolean> booleanFuture(boolean isTrue) {
- ResultsFuture<Boolean> rs = new ResultsFuture<Boolean>();
- rs.getResultsReceiver().receiveResults(isTrue);
- return rs;
- }
-
- private void postReceiveResults(RequestMessage reqMessage,
- ResultsMessage resultsMsg) throws TeiidSQLException, SQLException {
- commandStatus = State.DONE;
- // warnings thrown
- List resultsWarning = resultsMsg.getWarnings();
-
- setAnalysisInfo(resultsMsg);
-
- if (resultsMsg.getException() != null) {
- throw TeiidSQLException.create(resultsMsg.getException());
- }
-
- // save warnings if have any
- if (resultsWarning != null) {
- accumulateWarnings(resultsWarning);
- }
-
- if (resultsMsg.isUpdateResult()) {
- List[] results = resultsMsg.getResults();
- this.updateCounts = new int[results.length];
- for (int i = 0; i < results.length; i++) {
- updateCounts[i] = (Integer)results[i].get(0);
- }
- if (logger.isLoggable(Level.FINER)) {
- logger.fine(JDBCPlugin.Util.getString("Recieved update counts: " + Arrays.toString(updateCounts))); //$NON-NLS-1$
- }
- // In update scenarios close the statement implicitly
- try {
- getDQP().closeRequest(getCurrentRequestID());
- } catch (TeiidProcessingException e) {
- throw TeiidSQLException.create(e);
- } catch (TeiidComponentException e) {
- throw TeiidSQLException.create(e);
- }
- } else {
- createResultSet(resultsMsg);
- }
-
- logger.fine(JDBCPlugin.Util.getString("MMStatement.Success_query", reqMessage.getCommandString())); //$NON-NLS-1$
- }
-
- protected RequestMessage createRequestMessage(String[] commands,
- boolean isBatchedCommand, ResultsMode resultsMode) {
- RequestMessage reqMessage = new RequestMessage();
- reqMessage.setCommands(commands);
- reqMessage.setBatchedUpdate(isBatchedCommand);
- reqMessage.setResultsMode(resultsMode);
- return reqMessage;
- }
-
- /**
- * Retreives the fetch direction this Statement object set as a performance hint
- * to the driver. The int returned will be one of the following constants from
- * the ResultSet interface: FETCH_FORWARD, FETCH_REVERSE, or FETCH_UNKNOWN.
- * @return int value indicating the direction in which results need to be fetched
- * @throws SQLException should never occur.
- */
- public int getFetchDirection() throws SQLException {
- return this.fetchDirection;
- }
-
- /**
- * Retreives the fetch size this Statement object set as a performance hint
- * to the driver. This is the number of rows the server fetches at a time when
- * the result set needs more rows.
- * @return int value indicating the number of rows the server fetches
- * @throws SQLException should never occur.
- */
- public int getFetchSize() throws SQLException {
- return fetchSize;
- }
-
- /**
- * Retreives the maximum number of bytes that a result set column may contain.
- * @return int value giving the maximum size of a field
- * @throws SQLException should never occur.
- */
- public int getMaxFieldSize() throws SQLException {
- return maxFieldSize;
- }
-
- /**
- * Retrives the maximum number of rows that a ResultSet object may contain.
- * If the limit is exceeded the excess rows are dropped.
- * @return Max limit on rows on ResultSet.
- * @throws SQLException should never iccure.
- */
- public int getMaxRows() throws SQLException {
- return maxRows;
- }
-
- /**
- * Moves to this Statement object's next result, returns true if
- * it is a ResultSet object, and implicitly closes any current
- * ResultSet object(s) obtained with the method #getResultSet.
- * @return true if the next result is a ResultSet object;
- * false if it is an update count or there are no more results
- * @throws SQLException if there is an error in database.
- */
- public boolean getMoreResults() throws SQLException {
- //Check to see the statement is closed and throw an exception
- checkStatement();
-
- // close any current ResultSet
- if ( resultSet != null ) {
- resultSet.close();
- resultSet = null;
- }
- // set the existing update count to -1
- // indicating that there are no more results
- this.updateCounts = null;
- return false;
- }
-
- /**
- * Moves to this Statement object's next result, deals with any current
- * ResultSet object(s) according to the instructions specified by the
- * given flag, and returns true if the next result is a ResultSet object.
- * @param current flag that gives instruction on what should happen
- * to current ResultSet objects obtained using the method getResultSet(
- * CLOSE_CURRENT_RESULT, KEEP_CURRENT_RESULT, or CLOSE_ALL_RESULTS).
- * @return true if the next result is a ResultSet object; false if it
- * is an update count or there are no more results
- * @throws SQLException if there is an error in database.
- */
- public boolean getMoreResults(int current) throws SQLException {
- checkStatement();
-
- /*if (current == CLOSE_ALL_RESULTS || current == CLOSE_CURRENT_RESULT) {
- // since MetaMatrix only supports one ResultSet per statement,
- // these two cases are handled the same way.
- if (resultSet != null) {
- resultSet.close();
- }
- } else if (current == KEEP_CURRENT_RESULT) {
- // do nothing
- }
-
- rowsAffected = -1;
- */
- return false;
- }
-
-
- /**
- * Return the number of seconds the driver will wait for a statement object
- * to execute
- * @return int value giving the query timeout in seconds
- * @throws SQLException should never occur
- */
- public int getQueryTimeout() throws SQLException {
- //Check to see the statement is closed and throw an exception
- checkStatement();
- return (int)this.queryTimeoutMS/1000;
- }
-
- /**
- * Returns a ResultSet object that was produced by a call to the method execute.
- * We currently do not support execute method which could return multiple result
- * sets.
- * @return ResultSet object giving the next available ResultSet
- * @throws SQLException should never occur
- */
- public ResultSetImpl getResultSet() throws SQLException {
- //Check to see the statement is closed and throw an exception
- checkStatement();
- if (!hasResultSet()) {
- return null;
- }
- return resultSet;
- }
-
- /**
- * Retrieves the concurrency mode for the ResultSet objects generated from
- * queries that this Statement object executes. All ResultSets are currently
- * read only.
- * @return intvalue giving the ResultSet concurrency
- * @throws SQLException should never occur
- */
- public int getResultSetConcurrency() throws SQLException {
- return this.resultSetConcurrency;
- }
-
- /**
- * Retrieves the type of the ResultSet objects generated from queries that this
- * statement executes.
- * @return int value indicating the type of the ResultSet
- * @throws SQLException should never occur
- */
- public int getResultSetType() {
- return this.resultSetType;
- }
-
- /**
- * This method returns the number of rows affected by a statement modifying a table.
- * @return Number of rows affected.
- * @throws SQLException should never occur
- */
- public int getUpdateCount() throws SQLException {
- checkStatement();
- if (this.updateCounts == null) {
- return -1;
- }
- return this.updateCounts[0];
- }
-
- protected void accumulateWarnings(List<Exception> serverWarnings) {
- if (serverWarnings == null || serverWarnings.isEmpty()) {
- return;
- }
- if (this.serverWarnings == null) {
- this.serverWarnings = new ArrayList<Exception>();
- }
- this.serverWarnings.addAll(serverWarnings);
- }
-
- /**
- * This method returns warnings returned by server.
- * @return null value as there are no warnings
- * @throws SQLException should never occur
- */
- public SQLWarning getWarnings() throws SQLException {
- //Check to see the statement is closed and throw an exception
- checkStatement();
-
- if (serverWarnings != null && serverWarnings.size() != 0) {
- return WarningUtil.convertWarnings(serverWarnings);
- }
- return null;
- }
-
- /**
- * This method enbles/disables escape processing. When escape processing is
- * enabled the driver will scan any escape syntax and do escape substitution
- * before sending the escaped sql statement to the server
- * @param enable boolean value indicating if the escape processing should be turned on
- * @throws SQLException should never occur
- */
- public void setEscapeProcessing(boolean enable) throws SQLException {
- //Check to see the statement is closed and throw an exception
- checkStatement();
- // do nothing, escape processing is always enabled.
- }
-
- public void setFetchDirection(int direction) throws SQLException {
- checkStatement();
- }
-
- public void setFetchSize(int rows) throws SQLException {
- //Check to see the statement is closed and throw an exception
- checkStatement();
- if ( rows < 0 ) {
- String msg = JDBCPlugin.Util.getString("MMStatement.Invalid_fetch_size"); //$NON-NLS-1$
- throw new TeiidSQLException(msg);
- }
- // sets the fetch size on this statement
- if (rows == 0) {
- this.fetchSize = BaseDataSource.DEFAULT_FETCH_SIZE;
- } else {
- this.fetchSize = rows;
- }
- }
-
- /**
- * Sets the limit on the maximum number of rows in a ResultSet object. This
- * method is currently implemented to throw an exception as it is not possible
- * to limit the number of rows.
- * @param maxRows int value indicating maximum rows that can be returned in a ResultSet
- */
- public void setMaxRows(int maxRows) throws SQLException {
- //Check to see the statement is closed and throw an exception
- checkStatement();
- this.maxRows = maxRows;
- }
-
- /**
- * This sets to seconds the time limit for the number of seconds for a driver
- * to wait for a statement object to be executed.
- * @param seconds Maximum number of seconds for a statement object to execute.
- * throws SQLException, should never occur
- */
- public void setQueryTimeout(int seconds) throws SQLException {
- //Check to see the statement is closed and throw an exception
- checkStatement();
- if (seconds >= 0) {
- queryTimeoutMS = seconds*1000;
- }
- else {
- throw new TeiidSQLException(JDBCPlugin.Util.getString("MMStatement.Bad_timeout_value")); //$NON-NLS-1$
- }
- }
-
- void setQueryTimeoutMS(int queryTimeoutMS) {
- this.queryTimeoutMS = queryTimeoutMS;
- }
-
- /**
- * Helper method for copy the connection properties to request message.
- * @param res Request message that these properties to be copied to.
- * @throws TeiidSQLException
- */
- protected void copyPropertiesToRequest(RequestMessage res) throws TeiidSQLException {
- // Get partial mode
- String partial = getExecutionProperty(ExecutionProperties.PROP_PARTIAL_RESULTS_MODE);
- res.setPartialResults(Boolean.valueOf(partial).booleanValue());
-
- // Get xml validation mode
- String validate = getExecutionProperty(ExecutionProperties.PROP_XML_VALIDATION);
- if(validate == null) {
- res.setValidationMode(false);
- } else {
- res.setValidationMode(Boolean.valueOf(validate).booleanValue());
- }
-
- // Get xml format mode
- String format = getExecutionProperty(ExecutionProperties.PROP_XML_FORMAT);
- res.setXMLFormat(format);
-
- // Get transaction auto-wrap mode
- String txnAutoWrapMode = getExecutionProperty(ExecutionProperties.PROP_TXN_AUTO_WRAP);
- try {
- res.setTxnAutoWrapMode(txnAutoWrapMode);
- } catch (TeiidProcessingException e) {
- throw TeiidSQLException.create(e);
- }
-
- // Get result set cache mode
- String rsCache = getExecutionProperty(ExecutionProperties.RESULT_SET_CACHE_MODE);
- res.setUseResultSetCache(Boolean.valueOf(rsCache).booleanValue());
-
- res.setAnsiQuotedIdentifiers(Boolean.valueOf(
- getExecutionProperty(ExecutionProperties.ANSI_QUOTED_IDENTIFIERS))
- .booleanValue());
- String showPlan = getExecutionProperty(ExecutionProperties.SQL_OPTION_SHOWPLAN);
- if (showPlan != null) {
- try {
- res.setShowPlan(ShowPlan.valueOf(showPlan.toUpperCase()));
- } catch (IllegalArgumentException e) {
-
- }
- }
- String noExec = getExecutionProperty(ExecutionProperties.NOEXEC);
- if (noExec != null) {
- res.setNoExec(noExec.equalsIgnoreCase("ON")); //$NON-NLS-1$
- }
- }
-
- /**
- * Ends the command and sets the status to TIMED_OUT.
- */
- protected void timeoutOccurred() {
- if (this.commandStatus != State.RUNNING) {
- return;
- }
- logger.warning(JDBCPlugin.Util.getString("MMStatement.Timeout_ocurred_in_Statement.")); //$NON-NLS-1$
- try {
- cancel();
- commandStatus = State.TIMED_OUT;
- queryTimeoutMS = NO_TIMEOUT;
- currentRequestID = -1;
- if (this.resultSet != null) {
- this.resultSet.close();
- }
- } catch (SQLException se) {
- logger.log(Level.SEVERE, JDBCPlugin.Util.getString("MMStatement.Error_timing_out."), se); //$NON-NLS-1$
- }
- }
-
- protected void cancelRequest() throws SQLException {
- checkStatement();
-
- try {
- this.getDQP().cancelRequest(currentRequestID);
- } catch (TeiidProcessingException e) {
- throw TeiidSQLException.create(e);
- } catch (TeiidComponentException e) {
- throw TeiidSQLException.create(e);
- }
- }
-
- /**
- * Set the per-statement security payload. This optional payload will
- * accompany each request to the data source(s) so that the connector
- * will have access to it.
- * <br>Once the payload is set, it will be used for each statment
- * execution until it is set to <code>null</code>, a new payload is set on
- * the statement or the statement is closed.</br>
- *
- * <p>To remove an existing payload from a statement, call this method
- * with a <code>null</code> argument.</p>
- * @param payload The payload that is to accompany requests executed
- * from this statement.
- * @since 4.2
- */
- public void setPayload(Serializable payload) {
- this.payload = payload;
- }
-
- public void setExecutionProperty(String name, String value) {
- this.execProps.setProperty(name, value);
- }
-
- public String getExecutionProperty(String name) {
- return this.execProps.getProperty(name);
- }
-
- long getCurrentRequestID() {
- return this.currentRequestID;
- }
-
- /**
- * Get Query plan description.
- * If the Statement has a resultSet, we get the plan description from the result set
- * If that plan description is null, though, we return the very first plan description
- * that was created from the resultsMessage in the method: setAnalysisInfo.
- * The plan description from the result set can be null if the resultsMsg stored in the
- * result set hasn't been created when getPlanDescription is called.
- * @return Query plan description, if it exists, otherwise null
- */
- public PlanNode getPlanDescription() {
- if(this.resultSet != null) {
- return this.resultSet.getUpdatedPlanDescription();
- }
- if(currentPlanDescription != null) {
- return this.currentPlanDescription;
- }
- return null;
- }
-
- /**
- * Get query planner debug log.
- * @return Query planner debug log, or null if it doesn't exist
- */
- public String getDebugLog() {
- return this.debugLog;
- }
-
- /**
- * Get annotations
- * @return Query planner annotations - Collection of Annotation
- */
- public Collection<Annotation> getAnnotations() {
- return this.annotations;
- }
-
- public String getRequestIdentifier() {
- if(this.currentRequestID >= 0) {
- return Long.toString(this.currentRequestID);
- }
- return null;
- }
-
- /**
- * Check is the statement is closed. Used primarily by the unit tests.
- * @return true if the statement is closed; false otherwise.
- */
- public boolean isClosed() {
- return this.isClosed;
- }
-
- protected void setAnalysisInfo(ResultsMessage resultsMsg) {
- this.debugLog = resultsMsg.getDebugLog();
- this.currentPlanDescription = resultsMsg.getPlanDescription();
- this.annotations = resultsMsg.getAnnotations();
- this.driverConnection.setDebugLog(debugLog);
- this.driverConnection.setCurrentPlanDescription(currentPlanDescription);
- this.driverConnection.setAnnotations(annotations);
- }
-
- Calendar getDefaultCalendar() {
- if (defaultCalendar == null) {
- defaultCalendar = Calendar.getInstance();
- }
- return defaultCalendar;
- }
-
- void setDefaultCalendar(Calendar cal) {
- this.defaultCalendar = cal;
- }
-
- public boolean isPoolable() throws SQLException {
- checkStatement();
- return false;
- }
-
- public void setPoolable(boolean arg0) throws SQLException {
- checkStatement();
- }
-
- public ConnectionImpl getConnection() throws SQLException {
- return this.driverConnection;
- }
-
- public boolean execute(String sql, int autoGeneratedKeys)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public boolean execute(String sql, int[] columnIndexes) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public boolean execute(String sql, String[] columnNames)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public int executeUpdate(String sql, int autoGeneratedKeys)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public int executeUpdate(String sql, int[] columnIndexes)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public int executeUpdate(String sql, String[] columnNames)
- throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public ResultSet getGeneratedKeys() throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public int getResultSetHoldability() throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void setCursorName(String name) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
- }
-
- public void setMaxFieldSize(int max) throws SQLException {
- checkStatement();
- if ( max < 0 ) {
- throw new TeiidSQLException(JDBCPlugin.Util.getString("MMStatement.Invalid_field_size", max)); //$NON-NLS-1$
- }
- this.maxFieldSize = max;
- }
-
- ResultSetImpl createResultSet(List records, String[] columnNames, String[] dataTypes) throws SQLException {
- Map[] metadata = new Map[columnNames.length];
- for (int i = 0; i < columnNames.length; i++) {
- metadata[i] = getColumnMetadata(null, columnNames[i], dataTypes[i], ResultsMetadataConstants.NULL_TYPES.UNKNOWN, driverConnection);
- }
- return createResultSet(records, metadata);
- }
-
- ResultSetImpl createResultSet(List records, Map[] columnMetadata) throws SQLException {
- ResultSetMetaData rsmd = new ResultSetMetaDataImpl(new MetadataProvider(columnMetadata));
-
- return createResultSet(records, rsmd);
- }
-
- ResultSetImpl createResultSet(List records, ResultSetMetaData rsmd) throws SQLException {
- rsmd.getScale(1); //force the load of the metadata
- ResultsMessage resultsMsg = createDummyResultsMessage(null, null, records);
- resultSet = new ResultSetImpl(resultsMsg, this, rsmd, 0);
- resultSet.setMaxFieldSize(this.maxFieldSize);
- return resultSet;
- }
-
- static ResultsMessage createDummyResultsMessage(String[] columnNames, String[] dataTypes, List records) {
- ResultsMessage resultsMsg = new ResultsMessage();
- resultsMsg.setColumnNames(columnNames);
- resultsMsg.setDataTypes(dataTypes);
- resultsMsg.setFirstRow(1);
- resultsMsg.setLastRow(records.size());
- resultsMsg.setFinalRow(records.size());
- resultsMsg.setResults((List[])records.toArray(new List[records.size()]));
- return resultsMsg;
- }
-
- static Map<Integer, Object> getColumnMetadata(String tableName, String columnName, String dataType, Integer nullable, ConnectionImpl driverConnection) throws SQLException {
- return getColumnMetadata(tableName, columnName, dataType, nullable, ResultsMetadataConstants.SEARCH_TYPES.UNSEARCHABLE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE, driverConnection);
- }
-
- static Map<Integer, Object> getColumnMetadata(String tableName, String columnName, String dataType, Integer nullable, Integer searchable, Boolean writable, Boolean signed, Boolean caseSensitive, ConnectionImpl driverConnection) throws SQLException {
-
- // map that would contain metadata details
- Map<Integer, Object> metadataMap = new HashMap<Integer, Object>();
-
- /*******************************************************
- HardCoding Column metadata details for the given column
- ********************************************************/
-
- metadataMap.put(ResultsMetadataConstants.VIRTUAL_DATABASE_NAME, driverConnection.getVDBName());
- metadataMap.put(ResultsMetadataConstants.GROUP_NAME, tableName);
- metadataMap.put(ResultsMetadataConstants.ELEMENT_NAME, columnName);
- metadataMap.put(ResultsMetadataConstants.DATA_TYPE, dataType);
- metadataMap.put(ResultsMetadataConstants.PRECISION, ResultsMetadataDefaults.getDefaultPrecision(dataType));
- metadataMap.put(ResultsMetadataConstants.RADIX, new Integer(10));
- metadataMap.put(ResultsMetadataConstants.SCALE, new Integer(0));
- metadataMap.put(ResultsMetadataConstants.AUTO_INCREMENTING, Boolean.FALSE);
- metadataMap.put(ResultsMetadataConstants.CASE_SENSITIVE, caseSensitive);
- metadataMap.put(ResultsMetadataConstants.NULLABLE, nullable);
- metadataMap.put(ResultsMetadataConstants.SEARCHABLE, searchable);
- metadataMap.put(ResultsMetadataConstants.SIGNED, signed);
- metadataMap.put(ResultsMetadataConstants.WRITABLE, writable);
- metadataMap.put(ResultsMetadataConstants.CURRENCY, Boolean.FALSE);
- metadataMap.put(ResultsMetadataConstants.DISPLAY_SIZE, ResultsMetadataDefaults.getMaxDisplaySize(dataType));
-
- return metadataMap;
- }
-}
\ No newline at end of file
Copied: tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/jdbc/StatementImpl.java (from rev 3218, trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/jdbc/StatementImpl.java (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/jdbc/StatementImpl.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,1238 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License 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.jdbc;
+
+import java.io.Serializable;
+import java.lang.ref.WeakReference;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.TimeZone;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.teiid.client.DQP;
+import org.teiid.client.RequestMessage;
+import org.teiid.client.ResultsMessage;
+import org.teiid.client.RequestMessage.ResultsMode;
+import org.teiid.client.RequestMessage.ShowPlan;
+import org.teiid.client.metadata.ParameterInfo;
+import org.teiid.client.metadata.ResultsMetadataConstants;
+import org.teiid.client.metadata.ResultsMetadataDefaults;
+import org.teiid.client.plan.Annotation;
+import org.teiid.client.plan.PlanNode;
+import org.teiid.client.util.ResultsFuture;
+import org.teiid.core.TeiidComponentException;
+import org.teiid.core.TeiidException;
+import org.teiid.core.TeiidProcessingException;
+import org.teiid.core.types.JDBCSQLTypeInfo;
+import org.teiid.core.types.SQLXMLImpl;
+import org.teiid.core.util.SqlUtil;
+import org.teiid.core.util.StringUtil;
+import org.teiid.jdbc.CancellationTimer.CancelTask;
+import org.teiid.net.TeiidURL;
+
+
+public class StatementImpl extends WrapperImpl implements TeiidStatement {
+ private static Logger logger = Logger.getLogger("org.teiid.jdbc"); //$NON-NLS-1$
+
+ static CancellationTimer cancellationTimer = new CancellationTimer("Teiid Statement Timeout"); //$NON-NLS-1$
+
+ private static final class QueryTimeoutCancelTask extends CancelTask {
+ private WeakReference<StatementImpl> ref;
+ private QueryTimeoutCancelTask(long delay, StatementImpl stmt) {
+ super(delay);
+ this.ref = new WeakReference<StatementImpl>(stmt);
+ }
+
+ @Override
+ public void run() {
+ StatementImpl stmt = ref.get();
+ if (stmt != null) {
+ stmt.timeoutOccurred();
+ }
+ }
+ }
+
+ enum State {
+ RUNNING,
+ DONE,
+ TIMED_OUT,
+ CANCELLED
+ }
+ protected static final int NO_TIMEOUT = 0;
+
+ // integer indicating no maximum limit - used in some metadata-ish methods.
+ private static final int NO_LIMIT = 0;
+
+ //######## Configuration state #############
+ private ConnectionImpl driverConnection;
+ private Properties execProps;
+
+ // fetch size value. This is the default fetch size used by the server
+ private int fetchSize = BaseDataSource.DEFAULT_FETCH_SIZE;
+
+ // the fetch direction
+ private int fetchDirection = ResultSet.FETCH_FORWARD;
+
+ // the result set type
+ private int resultSetType = ResultSet.TYPE_FORWARD_ONLY;
+ private int resultSetConcurrency = ResultSet.CONCUR_READ_ONLY;
+
+ //######## Processing state #############
+
+ // boolean to indicate if this statement object is closed
+ private boolean isClosed = false;
+
+ // Differentiate timeout from cancel in blocking asynch operation
+ protected volatile State commandStatus = State.RUNNING;
+
+ // number of seconds for the query to timeout.
+ protected long queryTimeoutMS = NO_TIMEOUT;
+
+ //########## Per-execution state ########
+
+ // ID for current request
+ protected long currentRequestID = -1;
+
+ // the last query plan description
+ private PlanNode currentPlanDescription;
+
+ // the last query debug log
+ private String debugLog;
+
+ // the last query annotations
+ private Collection<Annotation> annotations;
+
+ // resultSet object produced by execute methods on the statement.
+ protected volatile ResultSetImpl resultSet;
+
+ private List<Exception> serverWarnings;
+
+ // the per-execution security payload
+ private Serializable payload;
+
+ /** List of INSERT, UPDATE, DELETE AND SELECT INTO commands */
+ private List batchedUpdates;
+
+ /** Array of update counts as returned by executeBatch() */
+ protected int[] updateCounts;
+
+ /** default Calendar instance for converting date/time/timestamp values */
+ private Calendar defaultCalendar;
+ /** Max rows to be returned by executing the statement */
+ private int maxRows = NO_LIMIT;
+ private int maxFieldSize = NO_LIMIT;
+
+ //Map<out/inout/return param index --> index in results>
+ protected Map outParamIndexMap = new HashMap();
+
+ private static Pattern TRANSACTION_STATEMENT = Pattern.compile("\\s*(commit|rollback|(start\\s+transaction))\\s*;?", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$
+ private static Pattern SET_STATEMENT = Pattern.compile("\\s*set\\s+((?:session authorization)|(?:\\w+))\\s+(?:([a-zA-Z](?:\\w|_)*)|((?:'[^']*')+));?", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$
+ private static Pattern SHOW_STATEMENT = Pattern.compile("\\s*show\\s+(\\w*);?", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$
+ /**
+ * Factory Constructor
+ * @param driverConnection
+ * @param resultSetType
+ * @param resultSetConcurrency
+ */
+ static StatementImpl newInstance(ConnectionImpl driverConnection, int resultSetType, int resultSetConcurrency) {
+ return new StatementImpl(driverConnection, resultSetType, resultSetConcurrency);
+ }
+
+ /**
+ * MMStatement Constructor.
+ * @param driverConnection
+ * @param resultSetType
+ * @param resultSetConcurrency
+ */
+ StatementImpl(ConnectionImpl driverConnection, int resultSetType, int resultSetConcurrency) {
+ this.driverConnection = driverConnection;
+ this.resultSetType = resultSetType;
+ this.resultSetConcurrency = resultSetConcurrency;
+ this.execProps = new Properties(this.driverConnection.getExecutionProperties());
+
+ // Set initial fetch size
+ String fetchSizeStr = this.execProps.getProperty(ExecutionProperties.PROP_FETCH_SIZE);
+ if(fetchSizeStr != null) {
+ try {
+ this.fetchSize = Integer.parseInt(fetchSizeStr);
+ } catch(Exception e) {
+ // silently failover to default
+ }
+ }
+ String queryTimeoutStr = this.execProps.getProperty(ExecutionProperties.QUERYTIMEOUT);
+ if(queryTimeoutStr != null) {
+ try {
+ this.queryTimeoutMS = Integer.parseInt(fetchSizeStr)*1000;
+ } catch(Exception e) {
+ // silently failover to default
+ }
+ }
+ }
+
+ protected DQP getDQP() {
+ return this.driverConnection.getDQP();
+ }
+
+ protected ConnectionImpl getMMConnection() {
+ return this.driverConnection;
+ }
+
+ protected TimeZone getServerTimeZone() throws SQLException {
+ return this.driverConnection.getServerConnection().getLogonResult().getTimeZone();
+ }
+
+ /**
+ * Reset all per-execution state - this should be done before executing
+ * a new command.
+ */
+ protected void resetExecutionState() throws SQLException {
+ this.currentRequestID = -1;
+
+ this.currentPlanDescription = null;
+ this.debugLog = null;
+ this.annotations = null;
+
+ if ( this.resultSet != null ) {
+ this.resultSet.close();
+ this.resultSet = null;
+ }
+
+ this.serverWarnings = null;
+
+ this.batchedUpdates = null;
+ this.updateCounts = null;
+ this.outParamIndexMap.clear();
+ }
+
+ /**
+ * Adds sql to this statement object's current list of commands.
+ * @param sql statement to be added to the batch
+ */
+ public void addBatch(String sql) throws SQLException {
+ //Check to see the statement is closed and throw an exception
+ checkStatement();
+ if (batchedUpdates == null) {
+ batchedUpdates = new ArrayList();
+ }
+ batchedUpdates.add(sql);
+ }
+
+ /**
+ * This method can be used by one thread to cancel a statement that is being
+ * executed by another thread.
+ * @throws SQLException should never occur.
+ */
+ public void cancel() throws SQLException {
+ /* Defect 19848 - Mark the statement cancelled before sending the CANCEL request.
+ * Otherwise, it's possible get into a race where the server response is quicker
+ * than the exception in the exception in the conditionalWait(), which results in
+ * the statement.executeQuery() call throwing the server's exception instead of the
+ * one generated by the conditionalWait() method.
+ */
+ commandStatus = State.CANCELLED;
+ cancelRequest();
+ }
+
+ /**
+ * Warning could be schema validation errors or partial results warnings.
+ * @throws SQLException should never occur.
+ */
+ public void clearWarnings() throws SQLException {
+ //Check to see the statement is closed and throw an exception
+ checkStatement();
+
+ // clear all the warnings on this statement, after this, getWarnings() should return null
+ serverWarnings = null;
+ }
+
+ /**
+ * Makes the set of commands in the current batch empty.
+ *
+ * @throws SQLException if a database access error occurs or the
+ * driver does not support batch statements
+ */
+ public void clearBatch() throws SQLException {
+ batchedUpdates.clear();
+ }
+
+ /**
+ * In many cases, it is desirable to immediately release a Statements's database
+ * and JDBC resources instead of waiting for this to happen when it is automatically
+ * closed; the close method provides this immediate release.
+ * @throws SQLException should never occur.
+ */
+ public void close() throws SQLException {
+ if ( isClosed ) {
+ return;
+ }
+
+ // close the the server's statement object (if necessary)
+ if(resultSet != null) {
+ resultSet.close();
+ resultSet = null;
+ }
+
+ isClosed = true;
+
+ // Remove link from connection to statement
+ this.driverConnection.closeStatement(this);
+
+ logger.fine(JDBCPlugin.Util.getString("MMStatement.Close_stmt_success")); //$NON-NLS-1$
+ }
+
+ /**
+ * <p> This utility method checks if the jdbc statement is closed and
+ * throws an exception if it is closed. </p>
+ * @throws SQLException if the statement object is closed.
+ */
+ protected void checkStatement() throws TeiidSQLException {
+ //Check to see the connection is closed and proceed if it is not
+ if ( isClosed ) {
+ throw new TeiidSQLException(JDBCPlugin.Util.getString("MMStatement.Stmt_closed")); //$NON-NLS-1$
+ }
+ }
+
+ public ResultsFuture<Boolean> submitExecute(String sql) throws SQLException {
+ return executeSql(new String[] {sql}, false, ResultsMode.EITHER, false);
+ }
+
+ @Override
+ public boolean execute(String sql) throws SQLException {
+ executeSql(new String[] {sql}, false, ResultsMode.EITHER, true);
+ return hasResultSet();
+ }
+
+ @Override
+ public int[] executeBatch() throws SQLException {
+ if (batchedUpdates == null || batchedUpdates.isEmpty()) {
+ return new int[0];
+ }
+ String[] commands = (String[])batchedUpdates.toArray(new String[batchedUpdates.size()]);
+ executeSql(commands, true, ResultsMode.UPDATECOUNT, true);
+ return updateCounts;
+ }
+
+ @Override
+ public ResultSet executeQuery(String sql) throws SQLException {
+ executeSql(new String[] {sql}, false, ResultsMode.RESULTSET, true);
+ return resultSet;
+ }
+
+ @Override
+ public int executeUpdate(String sql) throws SQLException {
+ String[] commands = new String[] {sql};
+ executeSql(commands, false, ResultsMode.UPDATECOUNT, true);
+ return this.updateCounts[0];
+ }
+
+ protected boolean hasResultSet() throws SQLException {
+ return resultSet != null && resultSet.getMetaData().getColumnCount() > 0;
+ }
+
+ protected void createResultSet(ResultsMessage resultsMsg) throws SQLException {
+ //create out/return parameter index map if there is any
+ List listOfParameters = resultsMsg.getParameters();
+ if(listOfParameters != null){
+ //get the size of result set
+ int resultSetSize = 0;
+ Iterator iteratorOfParameters = listOfParameters.iterator();
+ while(iteratorOfParameters.hasNext()){
+ ParameterInfo parameter = (ParameterInfo)iteratorOfParameters.next();
+ if(parameter.getType() == ParameterInfo.RESULT_SET){
+ resultSetSize = parameter.getNumColumns();
+ //one ResultSet only
+ break;
+ }
+ }
+
+ //return needs to be the first
+ int index = 0; //index in user call - {?=call sp(?)}
+ int count = 0;
+ iteratorOfParameters = listOfParameters.iterator();
+ while(iteratorOfParameters.hasNext()){
+ ParameterInfo parameter = (ParameterInfo)iteratorOfParameters.next();
+ if(parameter.getType() == ParameterInfo.RETURN_VALUE){
+ count++;
+ index++;
+ outParamIndexMap.put(new Integer(index), new Integer(resultSetSize + count));
+ break;
+ }
+ }
+
+ iteratorOfParameters = listOfParameters.iterator();
+ while(iteratorOfParameters.hasNext()){
+ ParameterInfo parameter = (ParameterInfo)iteratorOfParameters.next();
+ if(parameter.getType() != ParameterInfo.RETURN_VALUE && parameter.getType() != ParameterInfo.RESULT_SET){
+ index++;
+ if(parameter.getType() == ParameterInfo.OUT || parameter.getType() == ParameterInfo.INOUT){
+ count++;
+ outParamIndexMap.put(new Integer(index), new Integer(resultSetSize + count));
+ }
+ }
+ }
+ }
+
+ resultSet = new ResultSetImpl(resultsMsg, this, null, outParamIndexMap.size());
+ resultSet.setMaxFieldSize(this.maxFieldSize);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected ResultsFuture<Boolean> executeSql(String[] commands, boolean isBatchedCommand, ResultsMode resultsMode, boolean synch)
+ throws SQLException {
+ checkStatement();
+ resetExecutionState();
+ if (logger.isLoggable(Level.FINER)) {
+ logger.finer("Executing: requestID " + getCurrentRequestID() + " commands: " + Arrays.toString(commands) + " expecting: " + resultsMode); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ if (commands.length == 1) {
+ Matcher match = SET_STATEMENT.matcher(commands[0]);
+ if (match.matches()) {
+ if (resultsMode == ResultsMode.RESULTSET) {
+ throw new TeiidSQLException(JDBCPlugin.Util.getString("StatementImpl.set_result_set")); //$NON-NLS-1$
+ }
+ String key = match.group(1);
+ String value = match.group(2);
+ if (value == null) {
+ value = match.group(3);
+ value = StringUtil.replaceAll(value, "''", "'"); //$NON-NLS-1$ //$NON-NLS-2$
+ value = value.substring(1, value.length() - 1);
+ }
+ if ("SESSION AUTHORIZATION".equalsIgnoreCase(key)) { //$NON-NLS-1$
+ this.getMMConnection().changeUser(value, this.getMMConnection().getPassword());
+ } else if (key.equalsIgnoreCase(TeiidURL.CONNECTION.PASSWORD)) {
+ this.getMMConnection().setPassword(value);
+ } else if (ExecutionProperties.NEWINSTANCE.equalsIgnoreCase(key)) {
+ if (Boolean.valueOf(value)) {
+ this.getMMConnection().getServerConnection().cleanUp();
+ }
+ } else {
+ JDBCURL.addNormalizedProperty(key, value, this.driverConnection.getExecutionProperties());
+ }
+ this.updateCounts = new int[] {0};
+ return booleanFuture(true);
+ }
+ match = TRANSACTION_STATEMENT.matcher(commands[0]);
+ if (match.matches()) {
+ logger.finer("Executing as transaction statement"); //$NON-NLS-1$
+ if (resultsMode == ResultsMode.RESULTSET) {
+ throw new TeiidSQLException(JDBCPlugin.Util.getString("StatementImpl.set_result_set")); //$NON-NLS-1$
+ }
+ String command = match.group(1);
+ Boolean commit = null;
+ if (StringUtil.startsWithIgnoreCase(command, "start")) { //$NON-NLS-1$
+ //TODO: this should force a start and through an exception if we're already in a txn
+ this.getConnection().setAutoCommit(false);
+ } else if (command.equalsIgnoreCase("commit")) { //$NON-NLS-1$
+ commit = true;
+ if (synch) {
+ this.getConnection().setAutoCommit(true);
+ }
+ } else if (command.equalsIgnoreCase("rollback")) { //$NON-NLS-1$
+ commit = false;
+ if (synch) {
+ this.getConnection().rollback(false);
+ }
+ }
+ this.updateCounts = new int[] {0};
+ if (commit != null && !synch) {
+ ResultsFuture<?> pending = this.getConnection().submitSetAutoCommitTrue(commit);
+ final ResultsFuture<Boolean> result = new ResultsFuture<Boolean>();
+ pending.addCompletionListener(new ResultsFuture.CompletionListener() {
+ @Override
+ public void onCompletion(ResultsFuture future) {
+ try {
+ future.get();
+ result.getResultsReceiver().receiveResults(false);
+ } catch (Throwable t) {
+ result.getResultsReceiver().exceptionOccurred(t);
+ }
+ }
+ });
+ return result;
+ }
+ return booleanFuture(false);
+ }
+ match = SHOW_STATEMENT.matcher(commands[0]);
+ if (match.matches()) {
+ logger.finer("Executing as show statement"); //$NON-NLS-1$
+ if (resultsMode == ResultsMode.UPDATECOUNT) {
+ throw new TeiidSQLException(JDBCPlugin.Util.getString("StatementImpl.show_update_count")); //$NON-NLS-1$
+ }
+ String show = match.group(1);
+ if (show.equalsIgnoreCase("PLAN")) { //$NON-NLS-1$
+ List<ArrayList<Object>> records = new ArrayList<ArrayList<Object>>(1);
+ PlanNode plan = driverConnection.getCurrentPlanDescription();
+ if (plan != null) {
+ ArrayList<Object> row = new ArrayList<Object>(3);
+ row.add(DataTypeTransformer.getClob(plan.toString()));
+ row.add(new SQLXMLImpl(plan.toXml()));
+ row.add(DataTypeTransformer.getClob(driverConnection.getDebugLog()));
+ records.add(row);
+ }
+ createResultSet(records, new String[] {"PLAN_TEXT", "PLAN_XML", "DEBUG_LOG"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ new String[] {JDBCSQLTypeInfo.CLOB, JDBCSQLTypeInfo.XML, JDBCSQLTypeInfo.CLOB});
+ return booleanFuture(true);
+ }
+ if (show.equalsIgnoreCase("ANNOTATIONS")) { //$NON-NLS-1$
+ List<ArrayList<Object>> records = new ArrayList<ArrayList<Object>>(1);
+ Collection<Annotation> annos = driverConnection.getAnnotations();
+ for (Annotation annotation : annos) {
+ ArrayList<Object> row = new ArrayList<Object>(4);
+ row.add(annotation.getCategory());
+ row.add(annotation.getPriority().name());
+ row.add(annotation.getAnnotation());
+ row.add(annotation.getResolution());
+ records.add(row);
+ }
+ createResultSet(records, new String[] {"CATEGORY", "PRIORITY", "ANNOTATION", "RESOLUTION"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ new String[] {JDBCSQLTypeInfo.STRING, JDBCSQLTypeInfo.STRING, JDBCSQLTypeInfo.STRING, JDBCSQLTypeInfo.STRING});
+ return booleanFuture(true);
+ }
+ if (show.equalsIgnoreCase("ALL")) { //$NON-NLS-1$
+ List<ArrayList<Object>> records = new ArrayList<ArrayList<Object>>(1);
+ for (String key : driverConnection.getExecutionProperties().stringPropertyNames()) {
+ ArrayList<Object> row = new ArrayList<Object>(4);
+ row.add(key);
+ row.add(driverConnection.getExecutionProperties().get(key));
+ records.add(row);
+ }
+ createResultSet(records, new String[] {"NAME", "VALUE"}, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] {JDBCSQLTypeInfo.STRING, JDBCSQLTypeInfo.STRING});
+ return booleanFuture(true);
+ }
+ List<List<String>> records = Collections.singletonList(Collections.singletonList(driverConnection.getExecutionProperties().getProperty(JDBCURL.getValidKey(show))));
+ createResultSet(records, new String[] {show}, new String[] {JDBCSQLTypeInfo.STRING});
+ return booleanFuture(true);
+ }
+ }
+
+ final RequestMessage reqMessage = createRequestMessage(commands, isBatchedCommand, resultsMode);
+ ResultsFuture<ResultsMessage> pendingResult = execute(reqMessage, synch);
+ final ResultsFuture<Boolean> result = new ResultsFuture<Boolean>();
+ pendingResult.addCompletionListener(new ResultsFuture.CompletionListener<ResultsMessage>() {
+ @Override
+ public void onCompletion(ResultsFuture<ResultsMessage> future) {
+ try {
+ postReceiveResults(reqMessage, future.get());
+ result.getResultsReceiver().receiveResults(hasResultSet());
+ } catch (Throwable t) {
+ result.getResultsReceiver().exceptionOccurred(t);
+ }
+ }
+ });
+ if (synch) {
+ try {
+ if (queryTimeoutMS > 0) {
+ pendingResult.get(queryTimeoutMS, TimeUnit.MILLISECONDS);
+ } else {
+ pendingResult.get();
+ }
+ result.get(); //throw an exception if needed
+ return result;
+ } catch (ExecutionException e) {
+ if (e.getCause() instanceof SQLException) {
+ throw (SQLException)e.getCause();
+ }
+ throw TeiidSQLException.create(e);
+ } catch (InterruptedException e) {
+ timeoutOccurred();
+ } catch (TimeoutException e) {
+ timeoutOccurred();
+ }
+ throw new TeiidSQLException(JDBCPlugin.Util.getString("MMStatement.Timeout_before_complete")); //$NON-NLS-1$
+ }
+ return result;
+ }
+
+ private ResultsFuture<ResultsMessage> execute(final RequestMessage reqMsg, boolean synch) throws SQLException,
+ TeiidSQLException {
+ this.getConnection().beginLocalTxnIfNeeded();
+ this.currentRequestID = this.driverConnection.nextRequestID();
+ // Create a request message
+ reqMsg.setExecutionPayload(this.payload);
+ reqMsg.setCursorType(this.resultSetType);
+ reqMsg.setFetchSize(this.fetchSize);
+ reqMsg.setRowLimit(this.maxRows);
+ reqMsg.setTransactionIsolation(this.driverConnection.getTransactionIsolation());
+ String useCallingThread = getExecutionProperty(EmbeddedProfile.USE_CALLING_THREAD);
+ reqMsg.setSync(synch && (useCallingThread == null || Boolean.valueOf(useCallingThread)));
+ // Get connection properties and set them onto request message
+ copyPropertiesToRequest(reqMsg);
+
+ reqMsg.setExecutionId(this.currentRequestID);
+
+ ResultsFuture.CompletionListener<ResultsMessage> compeletionListener = null;
+ if (queryTimeoutMS > 0 && !synch) {
+ final CancelTask c = new QueryTimeoutCancelTask(queryTimeoutMS, this);
+ cancellationTimer.add(c);
+ compeletionListener = new ResultsFuture.CompletionListener<ResultsMessage>() {
+ @Override
+ public void onCompletion(ResultsFuture<ResultsMessage> future) {
+ cancellationTimer.remove(c);
+ }
+ };
+ }
+
+ ResultsFuture<ResultsMessage> pendingResult = null;
+ try {
+ pendingResult = this.getDQP().executeRequest(this.currentRequestID, reqMsg);
+ } catch (TeiidException e) {
+ throw TeiidSQLException.create(e);
+ }
+ if (compeletionListener != null) {
+ pendingResult.addCompletionListener(compeletionListener);
+ }
+ return pendingResult;
+ }
+
+ public static ResultsFuture<Boolean> booleanFuture(boolean isTrue) {
+ ResultsFuture<Boolean> rs = new ResultsFuture<Boolean>();
+ rs.getResultsReceiver().receiveResults(isTrue);
+ return rs;
+ }
+
+ private void postReceiveResults(RequestMessage reqMessage,
+ ResultsMessage resultsMsg) throws TeiidSQLException, SQLException {
+ commandStatus = State.DONE;
+ // warnings thrown
+ List resultsWarning = resultsMsg.getWarnings();
+
+ setAnalysisInfo(resultsMsg);
+
+ if (resultsMsg.getException() != null) {
+ throw TeiidSQLException.create(resultsMsg.getException());
+ }
+
+ // save warnings if have any
+ if (resultsWarning != null) {
+ accumulateWarnings(resultsWarning);
+ }
+
+ if (resultsMsg.isUpdateResult()) {
+ List[] results = resultsMsg.getResults();
+ this.updateCounts = new int[results.length];
+ for (int i = 0; i < results.length; i++) {
+ updateCounts[i] = (Integer)results[i].get(0);
+ }
+ if (logger.isLoggable(Level.FINER)) {
+ logger.finer("Recieved update counts: " + Arrays.toString(updateCounts)); //$NON-NLS-1$
+ }
+ // In update scenarios close the statement implicitly
+ try {
+ getDQP().closeRequest(getCurrentRequestID());
+ } catch (TeiidProcessingException e) {
+ throw TeiidSQLException.create(e);
+ } catch (TeiidComponentException e) {
+ throw TeiidSQLException.create(e);
+ }
+ } else {
+ createResultSet(resultsMsg);
+ }
+
+ logger.fine(JDBCPlugin.Util.getString("MMStatement.Success_query", reqMessage.getCommandString())); //$NON-NLS-1$
+ }
+
+ protected RequestMessage createRequestMessage(String[] commands,
+ boolean isBatchedCommand, ResultsMode resultsMode) {
+ RequestMessage reqMessage = new RequestMessage();
+ reqMessage.setCommands(commands);
+ reqMessage.setBatchedUpdate(isBatchedCommand);
+ reqMessage.setResultsMode(resultsMode);
+ return reqMessage;
+ }
+
+ /**
+ * Retreives the fetch direction this Statement object set as a performance hint
+ * to the driver. The int returned will be one of the following constants from
+ * the ResultSet interface: FETCH_FORWARD, FETCH_REVERSE, or FETCH_UNKNOWN.
+ * @return int value indicating the direction in which results need to be fetched
+ * @throws SQLException should never occur.
+ */
+ public int getFetchDirection() throws SQLException {
+ return this.fetchDirection;
+ }
+
+ /**
+ * Retreives the fetch size this Statement object set as a performance hint
+ * to the driver. This is the number of rows the server fetches at a time when
+ * the result set needs more rows.
+ * @return int value indicating the number of rows the server fetches
+ * @throws SQLException should never occur.
+ */
+ public int getFetchSize() throws SQLException {
+ return fetchSize;
+ }
+
+ /**
+ * Retreives the maximum number of bytes that a result set column may contain.
+ * @return int value giving the maximum size of a field
+ * @throws SQLException should never occur.
+ */
+ public int getMaxFieldSize() throws SQLException {
+ return maxFieldSize;
+ }
+
+ /**
+ * Retrives the maximum number of rows that a ResultSet object may contain.
+ * If the limit is exceeded the excess rows are dropped.
+ * @return Max limit on rows on ResultSet.
+ * @throws SQLException should never iccure.
+ */
+ public int getMaxRows() throws SQLException {
+ return maxRows;
+ }
+
+ /**
+ * Moves to this Statement object's next result, returns true if
+ * it is a ResultSet object, and implicitly closes any current
+ * ResultSet object(s) obtained with the method #getResultSet.
+ * @return true if the next result is a ResultSet object;
+ * false if it is an update count or there are no more results
+ * @throws SQLException if there is an error in database.
+ */
+ public boolean getMoreResults() throws SQLException {
+ //Check to see the statement is closed and throw an exception
+ checkStatement();
+
+ // close any current ResultSet
+ if ( resultSet != null ) {
+ resultSet.close();
+ resultSet = null;
+ }
+ // set the existing update count to -1
+ // indicating that there are no more results
+ this.updateCounts = null;
+ return false;
+ }
+
+ /**
+ * Moves to this Statement object's next result, deals with any current
+ * ResultSet object(s) according to the instructions specified by the
+ * given flag, and returns true if the next result is a ResultSet object.
+ * @param current flag that gives instruction on what should happen
+ * to current ResultSet objects obtained using the method getResultSet(
+ * CLOSE_CURRENT_RESULT, KEEP_CURRENT_RESULT, or CLOSE_ALL_RESULTS).
+ * @return true if the next result is a ResultSet object; false if it
+ * is an update count or there are no more results
+ * @throws SQLException if there is an error in database.
+ */
+ public boolean getMoreResults(int current) throws SQLException {
+ checkStatement();
+
+ /*if (current == CLOSE_ALL_RESULTS || current == CLOSE_CURRENT_RESULT) {
+ // since MetaMatrix only supports one ResultSet per statement,
+ // these two cases are handled the same way.
+ if (resultSet != null) {
+ resultSet.close();
+ }
+ } else if (current == KEEP_CURRENT_RESULT) {
+ // do nothing
+ }
+
+ rowsAffected = -1;
+ */
+ return false;
+ }
+
+
+ /**
+ * Return the number of seconds the driver will wait for a statement object
+ * to execute
+ * @return int value giving the query timeout in seconds
+ * @throws SQLException should never occur
+ */
+ public int getQueryTimeout() throws SQLException {
+ //Check to see the statement is closed and throw an exception
+ checkStatement();
+ return (int)this.queryTimeoutMS/1000;
+ }
+
+ /**
+ * Returns a ResultSet object that was produced by a call to the method execute.
+ * We currently do not support execute method which could return multiple result
+ * sets.
+ * @return ResultSet object giving the next available ResultSet
+ * @throws SQLException should never occur
+ */
+ public ResultSetImpl getResultSet() throws SQLException {
+ //Check to see the statement is closed and throw an exception
+ checkStatement();
+ if (!hasResultSet()) {
+ return null;
+ }
+ return resultSet;
+ }
+
+ /**
+ * Retrieves the concurrency mode for the ResultSet objects generated from
+ * queries that this Statement object executes. All ResultSets are currently
+ * read only.
+ * @return intvalue giving the ResultSet concurrency
+ * @throws SQLException should never occur
+ */
+ public int getResultSetConcurrency() throws SQLException {
+ return this.resultSetConcurrency;
+ }
+
+ /**
+ * Retrieves the type of the ResultSet objects generated from queries that this
+ * statement executes.
+ * @return int value indicating the type of the ResultSet
+ * @throws SQLException should never occur
+ */
+ public int getResultSetType() {
+ return this.resultSetType;
+ }
+
+ /**
+ * This method returns the number of rows affected by a statement modifying a table.
+ * @return Number of rows affected.
+ * @throws SQLException should never occur
+ */
+ public int getUpdateCount() throws SQLException {
+ checkStatement();
+ if (this.updateCounts == null) {
+ return -1;
+ }
+ return this.updateCounts[0];
+ }
+
+ protected void accumulateWarnings(List<Exception> serverWarnings) {
+ if (serverWarnings == null || serverWarnings.isEmpty()) {
+ return;
+ }
+ if (this.serverWarnings == null) {
+ this.serverWarnings = new ArrayList<Exception>();
+ }
+ this.serverWarnings.addAll(serverWarnings);
+ }
+
+ /**
+ * This method returns warnings returned by server.
+ * @return null value as there are no warnings
+ * @throws SQLException should never occur
+ */
+ public SQLWarning getWarnings() throws SQLException {
+ //Check to see the statement is closed and throw an exception
+ checkStatement();
+
+ if (serverWarnings != null && serverWarnings.size() != 0) {
+ return WarningUtil.convertWarnings(serverWarnings);
+ }
+ return null;
+ }
+
+ /**
+ * This method enbles/disables escape processing. When escape processing is
+ * enabled the driver will scan any escape syntax and do escape substitution
+ * before sending the escaped sql statement to the server
+ * @param enable boolean value indicating if the escape processing should be turned on
+ * @throws SQLException should never occur
+ */
+ public void setEscapeProcessing(boolean enable) throws SQLException {
+ //Check to see the statement is closed and throw an exception
+ checkStatement();
+ // do nothing, escape processing is always enabled.
+ }
+
+ public void setFetchDirection(int direction) throws SQLException {
+ checkStatement();
+ }
+
+ public void setFetchSize(int rows) throws SQLException {
+ //Check to see the statement is closed and throw an exception
+ checkStatement();
+ if ( rows < 0 ) {
+ String msg = JDBCPlugin.Util.getString("MMStatement.Invalid_fetch_size"); //$NON-NLS-1$
+ throw new TeiidSQLException(msg);
+ }
+ // sets the fetch size on this statement
+ if (rows == 0) {
+ this.fetchSize = BaseDataSource.DEFAULT_FETCH_SIZE;
+ } else {
+ this.fetchSize = rows;
+ }
+ }
+
+ /**
+ * Sets the limit on the maximum number of rows in a ResultSet object. This
+ * method is currently implemented to throw an exception as it is not possible
+ * to limit the number of rows.
+ * @param maxRows int value indicating maximum rows that can be returned in a ResultSet
+ */
+ public void setMaxRows(int maxRows) throws SQLException {
+ //Check to see the statement is closed and throw an exception
+ checkStatement();
+ this.maxRows = maxRows;
+ }
+
+ /**
+ * This sets to seconds the time limit for the number of seconds for a driver
+ * to wait for a statement object to be executed.
+ * @param seconds Maximum number of seconds for a statement object to execute.
+ * throws SQLException, should never occur
+ */
+ public void setQueryTimeout(int seconds) throws SQLException {
+ //Check to see the statement is closed and throw an exception
+ checkStatement();
+ if (seconds >= 0) {
+ queryTimeoutMS = seconds*1000;
+ }
+ else {
+ throw new TeiidSQLException(JDBCPlugin.Util.getString("MMStatement.Bad_timeout_value")); //$NON-NLS-1$
+ }
+ }
+
+ void setQueryTimeoutMS(int queryTimeoutMS) {
+ this.queryTimeoutMS = queryTimeoutMS;
+ }
+
+ /**
+ * Helper method for copy the connection properties to request message.
+ * @param res Request message that these properties to be copied to.
+ * @throws TeiidSQLException
+ */
+ protected void copyPropertiesToRequest(RequestMessage res) throws TeiidSQLException {
+ // Get partial mode
+ String partial = getExecutionProperty(ExecutionProperties.PROP_PARTIAL_RESULTS_MODE);
+ res.setPartialResults(Boolean.valueOf(partial).booleanValue());
+
+ // Get xml validation mode
+ String validate = getExecutionProperty(ExecutionProperties.PROP_XML_VALIDATION);
+ if(validate == null) {
+ res.setValidationMode(false);
+ } else {
+ res.setValidationMode(Boolean.valueOf(validate).booleanValue());
+ }
+
+ // Get xml format mode
+ String format = getExecutionProperty(ExecutionProperties.PROP_XML_FORMAT);
+ res.setXMLFormat(format);
+
+ // Get transaction auto-wrap mode
+ String txnAutoWrapMode = getExecutionProperty(ExecutionProperties.PROP_TXN_AUTO_WRAP);
+ try {
+ res.setTxnAutoWrapMode(txnAutoWrapMode);
+ } catch (TeiidProcessingException e) {
+ throw TeiidSQLException.create(e);
+ }
+
+ // Get result set cache mode
+ String rsCache = getExecutionProperty(ExecutionProperties.RESULT_SET_CACHE_MODE);
+ res.setUseResultSetCache(Boolean.valueOf(rsCache).booleanValue());
+
+ res.setAnsiQuotedIdentifiers(Boolean.valueOf(
+ getExecutionProperty(ExecutionProperties.ANSI_QUOTED_IDENTIFIERS))
+ .booleanValue());
+ String showPlan = getExecutionProperty(ExecutionProperties.SQL_OPTION_SHOWPLAN);
+ if (showPlan != null) {
+ try {
+ res.setShowPlan(ShowPlan.valueOf(showPlan.toUpperCase()));
+ } catch (IllegalArgumentException e) {
+
+ }
+ }
+ String noExec = getExecutionProperty(ExecutionProperties.NOEXEC);
+ if (noExec != null) {
+ res.setNoExec(noExec.equalsIgnoreCase("ON")); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Ends the command and sets the status to TIMED_OUT.
+ */
+ protected void timeoutOccurred() {
+ if (this.commandStatus != State.RUNNING) {
+ return;
+ }
+ logger.warning(JDBCPlugin.Util.getString("MMStatement.Timeout_ocurred_in_Statement.")); //$NON-NLS-1$
+ try {
+ cancel();
+ commandStatus = State.TIMED_OUT;
+ queryTimeoutMS = NO_TIMEOUT;
+ currentRequestID = -1;
+ if (this.resultSet != null) {
+ this.resultSet.close();
+ }
+ } catch (SQLException se) {
+ logger.log(Level.SEVERE, JDBCPlugin.Util.getString("MMStatement.Error_timing_out."), se); //$NON-NLS-1$
+ }
+ }
+
+ protected void cancelRequest() throws SQLException {
+ checkStatement();
+
+ try {
+ this.getDQP().cancelRequest(currentRequestID);
+ } catch (TeiidProcessingException e) {
+ throw TeiidSQLException.create(e);
+ } catch (TeiidComponentException e) {
+ throw TeiidSQLException.create(e);
+ }
+ }
+
+ /**
+ * Set the per-statement security payload. This optional payload will
+ * accompany each request to the data source(s) so that the connector
+ * will have access to it.
+ * <br>Once the payload is set, it will be used for each statment
+ * execution until it is set to <code>null</code>, a new payload is set on
+ * the statement or the statement is closed.</br>
+ *
+ * <p>To remove an existing payload from a statement, call this method
+ * with a <code>null</code> argument.</p>
+ * @param payload The payload that is to accompany requests executed
+ * from this statement.
+ * @since 4.2
+ */
+ public void setPayload(Serializable payload) {
+ this.payload = payload;
+ }
+
+ public void setExecutionProperty(String name, String value) {
+ this.execProps.setProperty(name, value);
+ }
+
+ public String getExecutionProperty(String name) {
+ return this.execProps.getProperty(name);
+ }
+
+ long getCurrentRequestID() {
+ return this.currentRequestID;
+ }
+
+ /**
+ * Get Query plan description.
+ * If the Statement has a resultSet, we get the plan description from the result set
+ * If that plan description is null, though, we return the very first plan description
+ * that was created from the resultsMessage in the method: setAnalysisInfo.
+ * The plan description from the result set can be null if the resultsMsg stored in the
+ * result set hasn't been created when getPlanDescription is called.
+ * @return Query plan description, if it exists, otherwise null
+ */
+ public PlanNode getPlanDescription() {
+ if(this.resultSet != null) {
+ return this.resultSet.getUpdatedPlanDescription();
+ }
+ if(currentPlanDescription != null) {
+ return this.currentPlanDescription;
+ }
+ return null;
+ }
+
+ /**
+ * Get query planner debug log.
+ * @return Query planner debug log, or null if it doesn't exist
+ */
+ public String getDebugLog() {
+ return this.debugLog;
+ }
+
+ /**
+ * Get annotations
+ * @return Query planner annotations - Collection of Annotation
+ */
+ public Collection<Annotation> getAnnotations() {
+ return this.annotations;
+ }
+
+ public String getRequestIdentifier() {
+ if(this.currentRequestID >= 0) {
+ return Long.toString(this.currentRequestID);
+ }
+ return null;
+ }
+
+ /**
+ * Check is the statement is closed. Used primarily by the unit tests.
+ * @return true if the statement is closed; false otherwise.
+ */
+ public boolean isClosed() {
+ return this.isClosed;
+ }
+
+ protected void setAnalysisInfo(ResultsMessage resultsMsg) {
+ this.debugLog = resultsMsg.getDebugLog();
+ this.currentPlanDescription = resultsMsg.getPlanDescription();
+ this.annotations = resultsMsg.getAnnotations();
+ this.driverConnection.setDebugLog(debugLog);
+ this.driverConnection.setCurrentPlanDescription(currentPlanDescription);
+ this.driverConnection.setAnnotations(annotations);
+ }
+
+ Calendar getDefaultCalendar() {
+ if (defaultCalendar == null) {
+ defaultCalendar = Calendar.getInstance();
+ }
+ return defaultCalendar;
+ }
+
+ void setDefaultCalendar(Calendar cal) {
+ this.defaultCalendar = cal;
+ }
+
+ public boolean isPoolable() throws SQLException {
+ checkStatement();
+ return false;
+ }
+
+ public void setPoolable(boolean arg0) throws SQLException {
+ checkStatement();
+ }
+
+ public ConnectionImpl getConnection() throws SQLException {
+ return this.driverConnection;
+ }
+
+ public boolean execute(String sql, int autoGeneratedKeys)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public boolean execute(String sql, int[] columnIndexes) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public boolean execute(String sql, String[] columnNames)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public int executeUpdate(String sql, int autoGeneratedKeys)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public int executeUpdate(String sql, int[] columnIndexes)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public int executeUpdate(String sql, String[] columnNames)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public ResultSet getGeneratedKeys() throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public int getResultSetHoldability() throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void setCursorName(String name) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ public void setMaxFieldSize(int max) throws SQLException {
+ checkStatement();
+ if ( max < 0 ) {
+ throw new TeiidSQLException(JDBCPlugin.Util.getString("MMStatement.Invalid_field_size", max)); //$NON-NLS-1$
+ }
+ this.maxFieldSize = max;
+ }
+
+ ResultSetImpl createResultSet(List records, String[] columnNames, String[] dataTypes) throws SQLException {
+ Map[] metadata = new Map[columnNames.length];
+ for (int i = 0; i < columnNames.length; i++) {
+ metadata[i] = getColumnMetadata(null, columnNames[i], dataTypes[i], ResultsMetadataConstants.NULL_TYPES.UNKNOWN, driverConnection);
+ }
+ return createResultSet(records, metadata);
+ }
+
+ ResultSetImpl createResultSet(List records, Map[] columnMetadata) throws SQLException {
+ ResultSetMetaData rsmd = new ResultSetMetaDataImpl(new MetadataProvider(columnMetadata));
+
+ return createResultSet(records, rsmd);
+ }
+
+ ResultSetImpl createResultSet(List records, ResultSetMetaData rsmd) throws SQLException {
+ rsmd.getScale(1); //force the load of the metadata
+ ResultsMessage resultsMsg = createDummyResultsMessage(null, null, records);
+ resultSet = new ResultSetImpl(resultsMsg, this, rsmd, 0);
+ resultSet.setMaxFieldSize(this.maxFieldSize);
+ return resultSet;
+ }
+
+ static ResultsMessage createDummyResultsMessage(String[] columnNames, String[] dataTypes, List records) {
+ ResultsMessage resultsMsg = new ResultsMessage();
+ resultsMsg.setColumnNames(columnNames);
+ resultsMsg.setDataTypes(dataTypes);
+ resultsMsg.setFirstRow(1);
+ resultsMsg.setLastRow(records.size());
+ resultsMsg.setFinalRow(records.size());
+ resultsMsg.setResults((List[])records.toArray(new List[records.size()]));
+ return resultsMsg;
+ }
+
+ static Map<Integer, Object> getColumnMetadata(String tableName, String columnName, String dataType, Integer nullable, ConnectionImpl driverConnection) throws SQLException {
+ return getColumnMetadata(tableName, columnName, dataType, nullable, ResultsMetadataConstants.SEARCH_TYPES.UNSEARCHABLE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE, driverConnection);
+ }
+
+ static Map<Integer, Object> getColumnMetadata(String tableName, String columnName, String dataType, Integer nullable, Integer searchable, Boolean writable, Boolean signed, Boolean caseSensitive, ConnectionImpl driverConnection) throws SQLException {
+
+ // map that would contain metadata details
+ Map<Integer, Object> metadataMap = new HashMap<Integer, Object>();
+
+ /*******************************************************
+ HardCoding Column metadata details for the given column
+ ********************************************************/
+
+ metadataMap.put(ResultsMetadataConstants.VIRTUAL_DATABASE_NAME, driverConnection.getVDBName());
+ metadataMap.put(ResultsMetadataConstants.GROUP_NAME, tableName);
+ metadataMap.put(ResultsMetadataConstants.ELEMENT_NAME, columnName);
+ metadataMap.put(ResultsMetadataConstants.DATA_TYPE, dataType);
+ metadataMap.put(ResultsMetadataConstants.PRECISION, ResultsMetadataDefaults.getDefaultPrecision(dataType));
+ metadataMap.put(ResultsMetadataConstants.RADIX, new Integer(10));
+ metadataMap.put(ResultsMetadataConstants.SCALE, new Integer(0));
+ metadataMap.put(ResultsMetadataConstants.AUTO_INCREMENTING, Boolean.FALSE);
+ metadataMap.put(ResultsMetadataConstants.CASE_SENSITIVE, caseSensitive);
+ metadataMap.put(ResultsMetadataConstants.NULLABLE, nullable);
+ metadataMap.put(ResultsMetadataConstants.SEARCHABLE, searchable);
+ metadataMap.put(ResultsMetadataConstants.SIGNED, signed);
+ metadataMap.put(ResultsMetadataConstants.WRITABLE, writable);
+ metadataMap.put(ResultsMetadataConstants.CURRENCY, Boolean.FALSE);
+ metadataMap.put(ResultsMetadataConstants.DISPLAY_SIZE, ResultsMetadataDefaults.getMaxDisplaySize(dataType));
+
+ return metadataMap;
+ }
+}
\ No newline at end of file
Deleted: tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/net/TeiidURL.java
===================================================================
--- trunk/client/src/main/java/org/teiid/net/TeiidURL.java 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/net/TeiidURL.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,332 +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.net;
-
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.teiid.core.util.StringUtil;
-import org.teiid.jdbc.JDBCPlugin;
-
-
-/**
- * Class defines the URL in the Teiid.
- *
- * @since 4.2
- */
-public class TeiidURL {
-
- public static interface JDBC {
- // constant indicating Virtual database name
- public static final String VDB_NAME = "VirtualDatabaseName"; //$NON-NLS-1$
- // constant indicating Virtual database version
- 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 interface CONNECTION {
- public static final String CLIENT_IP_ADDRESS = "clientIpAddress"; //$NON-NLS-1$
- public static final String CLIENT_HOSTNAME = "clientHostName"; //$NON-NLS-1$
- /**
- * If true, will automatically select a new server instance after a communication exception.
- * @since 5.6
- */
- public static final String AUTO_FAILOVER = "autoFailover"; //$NON-NLS-1$
-
- /**
- * A plugable discovery strategy for the client. Defaults to using the AdminApi.
- */
- public static final String DISCOVERY_STRATEGY = "discoveryStategy"; //$NON-NLS-1$
-
- public static final String SERVER_URL = "serverURL"; //$NON-NLS-1$
- /**
- * Non-secure Protocol.
- */
- public static final String NON_SECURE_PROTOCOL = "mm"; //$NON-NLS-1$
- /**
- * Secure Protocol.
- */
- public static final String SECURE_PROTOCOL = "mms"; //$NON-NLS-1$
- // name of the application which is obtaining connection
- public static final String APP_NAME = "ApplicationName"; //$NON-NLS-1$
- // constant for username part of url
- 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 ADMIN = "admin"; //$NON-NLS-1$
-
- public static final String PASSTHROUGH_AUTHENTICATION = "PassthroughAuthentication"; //$NON-NLS-1$
- }
-
- public static final String DOT_DELIMITER = "."; //$NON-NLS-1$
- public static final String DOUBLE_SLASH_DELIMITER = "//"; //$NON-NLS-1$
- public static final String COMMA_DELIMITER = ","; //$NON-NLS-1$
-
- public static final String COLON_DELIMITER = ":"; //$NON-NLS-1$
- public static final String BACKSLASH_DELIMITER = "\\"; //$NON-NLS-1$
- public static final String DEFAULT_PROTOCOL= TeiidURL.CONNECTION.NON_SECURE_PROTOCOL + "://"; //$NON-NLS-1$
- public static final String SECURE_PROTOCOL= TeiidURL.CONNECTION.SECURE_PROTOCOL + "://"; //$NON-NLS-1$
-
- public static final String INVALID_FORMAT_SERVER = JDBCPlugin.Util.getString("MMURL.INVALID_FORMAT"); //$NON-NLS-1$
- /*
- * appserver URL
- */
- private String appServerURL;
- /*
- * List of <code> HostData </code> in a cluster
- */
- private List<HostInfo> hosts = new ArrayList<HostInfo>();
-
- private boolean usingSSL = false;
-
- /**
- * Create an MMURL from the server URL. For use by the server-side.
- * @param serverURL Expected format: mm[s]://server1:port1[,server2:port2]
- * @throws MalformedURLException
- * @since 4.2
- */
- public TeiidURL(String serverURL) throws MalformedURLException {
- if (serverURL == null) {
- throw new MalformedURLException(INVALID_FORMAT_SERVER);
- }
- if (StringUtil.startsWithIgnoreCase(serverURL, SECURE_PROTOCOL)) {
- usingSSL = true;
- } else if (!StringUtil.startsWithIgnoreCase(serverURL, DEFAULT_PROTOCOL)) {
- throw new MalformedURLException(INVALID_FORMAT_SERVER);
- }
-
- appServerURL = serverURL;
- parseServerURL(serverURL.substring(usingSSL?SECURE_PROTOCOL.length():DEFAULT_PROTOCOL.length()), INVALID_FORMAT_SERVER);
- }
-
- public TeiidURL(String host, int port, boolean secure) {
- usingSSL = secure;
- if(host.startsWith("[")) { //$NON-NLS-1$
- host = host.substring(1, host.indexOf(']'));
- }
- hosts.add(new HostInfo(host, port));
- }
-
- /**
- * Validates that a server URL is in the correct format.
- * @param serverURL Expected format: mm[s]://server1:port1[,server2:port2]
- * @since 4.2
- */
- public static boolean isValidServerURL(String serverURL) {
- boolean valid = true;
- try {
- new TeiidURL(serverURL);
- } catch (Exception e) {
- valid = false;
- }
-
- return valid;
- }
-
- public List<HostInfo> getHostInfo() {
- return hosts;
- }
-
- /**
- * Get a list of hosts
- *
- * @return string of host separated by commas
- * @since 4.2
- */
- public String getHosts() {
- StringBuffer hostList = new StringBuffer(""); //$NON-NLS-1$
- if( hosts != null) {
- Iterator<HostInfo> iterator = hosts.iterator();
- while (iterator.hasNext()) {
- HostInfo element = iterator.next();
- hostList.append(element.getHostName());
- if( iterator.hasNext()) {
- hostList.append(COMMA_DELIMITER);
- }
- }
- }
- return hostList.toString();
- }
-
- /**
- * Get a list of ports
- *
- * @return string of ports seperated by commas
- * @since 4.2
- */
- public String getPorts() {
- StringBuffer portList = new StringBuffer(""); //$NON-NLS-1$
- if( hosts != null) {
- Iterator<HostInfo> iterator = hosts.iterator();
- while (iterator.hasNext()) {
- HostInfo element = iterator.next();
- portList.append(element.getPortNumber());
- if( iterator.hasNext()) {
- portList.append(COMMA_DELIMITER);
- }
- }
- }
- return portList.toString();
- }
-
- /**
- * @param url
- * @throws MalformedURLException
- * @since 4.2
- */
- private void parseServerURL(String serverURL, String exceptionMessage) throws MalformedURLException {
- StringTokenizer st = new StringTokenizer(serverURL, COMMA_DELIMITER);
- if (!st.hasMoreTokens()) {
- throw new MalformedURLException(exceptionMessage);
- }
- while (st.hasMoreTokens()) {
- String nextToken = st.nextToken();
- nextToken = nextToken.trim();
- String host = ""; //$NON-NLS-1$
- String port = ""; //$NON-NLS-1$
- if (nextToken.startsWith("[")) { //$NON-NLS-1$
- int hostEnd = nextToken.indexOf("]:"); //$NON-NLS-1$
- if (hostEnd == -1) {
- throw new MalformedURLException(JDBCPlugin.Util.getString("TeiidURL.invalid_ipv6_hostport", nextToken, exceptionMessage)); //$NON-NLS-1$
- }
- host = nextToken.substring(1, hostEnd);
- port = nextToken.substring(hostEnd+2);
- }
- else {
- int hostEnd = nextToken.indexOf(":"); //$NON-NLS-1$
- if (hostEnd == -1) {
- throw new MalformedURLException(JDBCPlugin.Util.getString("TeiidURL.invalid_hostport", nextToken, exceptionMessage)); //$NON-NLS-1$
- }
- host = nextToken.substring(0, hostEnd);
- port = nextToken.substring(hostEnd+1);
- }
- host = host.trim();
- port = port.trim();
- if (host.equals("") || port.equals("")) { //$NON-NLS-1$ //$NON-NLS-2$
- throw new MalformedURLException(JDBCPlugin.Util.getString("TeiidURL.invalid_hostport", nextToken, exceptionMessage)); //$NON-NLS-1$
- }
- int portNumber = validatePort(port);
- HostInfo hostInfo = new HostInfo(host, portNumber);
- hosts.add(hostInfo);
- }
- }
-
- public static int validatePort(String port) throws MalformedURLException {
- int portNumber;
- try {
- portNumber = Integer.parseInt(port);
- } catch (NumberFormatException nfe) {
- throw new MalformedURLException(JDBCPlugin.Util.getString("TeiidURL.non_numeric_port", port)); //$NON-NLS-1$
- }
- String msg = validatePort(portNumber);
- if (msg != null) {
- throw new MalformedURLException(msg);
- }
- return portNumber;
- }
-
- public static String validatePort(int portNumber) {
- if (portNumber < 0 || portNumber > 0xFFFF) {
- return JDBCPlugin.Util.getString("TeiidURL.port_out_of_range", portNumber); //$NON-NLS-1$
- }
- return null;
- }
-
- /**
- * Get the Application Server URL
- *
- * @return String for connection to the Server
- * @since 4.2
- */
- public String getAppServerURL() {
- if (appServerURL == null) {
- StringBuffer sb = new StringBuffer();
- if (usingSSL) {
- sb.append(SECURE_PROTOCOL);
- } else {
- sb.append(DEFAULT_PROTOCOL);
- }
- Iterator<HostInfo> iter = hosts.iterator();
- while (iter.hasNext()) {
- HostInfo host = iter.next();
-
- boolean ipv6HostName = host.getHostName().indexOf(':') != -1;
- if (ipv6HostName) {
- sb.append('[');
- }
- sb.append(host.getHostName());
- if (ipv6HostName) {
- sb.append(']');
- }
- sb.append(COLON_DELIMITER);
- sb.append(host.getPortNumber());
- if (iter.hasNext()) {
- sb.append(COMMA_DELIMITER);
- }
- }
- appServerURL = sb.toString();
- }
- return appServerURL;
- }
-
- /**
- * @see java.lang.Object#toString()
- * @since 4.2
- */
- public String toString() {
- return getAppServerURL();
- }
-
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- * @since 4.2
- */
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- }
- if (!(obj instanceof TeiidURL)) {
- return false;
- }
- TeiidURL url = (TeiidURL)obj;
- return (appServerURL.equals(url.getAppServerURL()));
- }
-
- /**
- * @see java.lang.Object#hashCode()
- * @since 4.2
- */
- public int hashCode() {
- return appServerURL.hashCode();
- }
-
- public boolean isUsingSSL() {
- return usingSSL;
- }
-
-}
Copied: tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/net/TeiidURL.java (from rev 3218, trunk/client/src/main/java/org/teiid/net/TeiidURL.java)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/net/TeiidURL.java (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/net/TeiidURL.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,333 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License 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.net;
+
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.teiid.core.util.StringUtil;
+import org.teiid.jdbc.JDBCPlugin;
+
+
+/**
+ * Class defines the URL in the Teiid.
+ *
+ * @since 4.2
+ */
+public class TeiidURL {
+
+ public static interface JDBC {
+ // constant indicating Virtual database name
+ public static final String VDB_NAME = "VirtualDatabaseName"; //$NON-NLS-1$
+ // constant indicating Virtual database version
+ 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 interface CONNECTION {
+ public static final String CLIENT_IP_ADDRESS = "clientIpAddress"; //$NON-NLS-1$
+ public static final String CLIENT_HOSTNAME = "clientHostName"; //$NON-NLS-1$
+ public static final String CLIENT_MAC = "clientMAC"; //$NON-NLS-1$
+ /**
+ * If true, will automatically select a new server instance after a communication exception.
+ * @since 5.6
+ */
+ public static final String AUTO_FAILOVER = "autoFailover"; //$NON-NLS-1$
+
+ /**
+ * A plugable discovery strategy for the client. Defaults to using the AdminApi.
+ */
+ public static final String DISCOVERY_STRATEGY = "discoveryStategy"; //$NON-NLS-1$
+
+ public static final String SERVER_URL = "serverURL"; //$NON-NLS-1$
+ /**
+ * Non-secure Protocol.
+ */
+ public static final String NON_SECURE_PROTOCOL = "mm"; //$NON-NLS-1$
+ /**
+ * Secure Protocol.
+ */
+ public static final String SECURE_PROTOCOL = "mms"; //$NON-NLS-1$
+ // name of the application which is obtaining connection
+ public static final String APP_NAME = "ApplicationName"; //$NON-NLS-1$
+ // constant for username part of url
+ 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 ADMIN = "admin"; //$NON-NLS-1$
+
+ public static final String PASSTHROUGH_AUTHENTICATION = "PassthroughAuthentication"; //$NON-NLS-1$
+ }
+
+ public static final String DOT_DELIMITER = "."; //$NON-NLS-1$
+ public static final String DOUBLE_SLASH_DELIMITER = "//"; //$NON-NLS-1$
+ public static final String COMMA_DELIMITER = ","; //$NON-NLS-1$
+
+ public static final String COLON_DELIMITER = ":"; //$NON-NLS-1$
+ public static final String BACKSLASH_DELIMITER = "\\"; //$NON-NLS-1$
+ public static final String DEFAULT_PROTOCOL= TeiidURL.CONNECTION.NON_SECURE_PROTOCOL + "://"; //$NON-NLS-1$
+ public static final String SECURE_PROTOCOL= TeiidURL.CONNECTION.SECURE_PROTOCOL + "://"; //$NON-NLS-1$
+
+ public static final String INVALID_FORMAT_SERVER = JDBCPlugin.Util.getString("MMURL.INVALID_FORMAT"); //$NON-NLS-1$
+ /*
+ * appserver URL
+ */
+ private String appServerURL;
+ /*
+ * List of <code> HostData </code> in a cluster
+ */
+ private List<HostInfo> hosts = new ArrayList<HostInfo>();
+
+ private boolean usingSSL = false;
+
+ /**
+ * Create an MMURL from the server URL. For use by the server-side.
+ * @param serverURL Expected format: mm[s]://server1:port1[,server2:port2]
+ * @throws MalformedURLException
+ * @since 4.2
+ */
+ public TeiidURL(String serverURL) throws MalformedURLException {
+ if (serverURL == null) {
+ throw new MalformedURLException(INVALID_FORMAT_SERVER);
+ }
+ if (StringUtil.startsWithIgnoreCase(serverURL, SECURE_PROTOCOL)) {
+ usingSSL = true;
+ } else if (!StringUtil.startsWithIgnoreCase(serverURL, DEFAULT_PROTOCOL)) {
+ throw new MalformedURLException(INVALID_FORMAT_SERVER);
+ }
+
+ appServerURL = serverURL;
+ parseServerURL(serverURL.substring(usingSSL?SECURE_PROTOCOL.length():DEFAULT_PROTOCOL.length()), INVALID_FORMAT_SERVER);
+ }
+
+ public TeiidURL(String host, int port, boolean secure) {
+ usingSSL = secure;
+ if(host.startsWith("[")) { //$NON-NLS-1$
+ host = host.substring(1, host.indexOf(']'));
+ }
+ hosts.add(new HostInfo(host, port));
+ }
+
+ /**
+ * Validates that a server URL is in the correct format.
+ * @param serverURL Expected format: mm[s]://server1:port1[,server2:port2]
+ * @since 4.2
+ */
+ public static boolean isValidServerURL(String serverURL) {
+ boolean valid = true;
+ try {
+ new TeiidURL(serverURL);
+ } catch (Exception e) {
+ valid = false;
+ }
+
+ return valid;
+ }
+
+ public List<HostInfo> getHostInfo() {
+ return hosts;
+ }
+
+ /**
+ * Get a list of hosts
+ *
+ * @return string of host separated by commas
+ * @since 4.2
+ */
+ public String getHosts() {
+ StringBuffer hostList = new StringBuffer(""); //$NON-NLS-1$
+ if( hosts != null) {
+ Iterator<HostInfo> iterator = hosts.iterator();
+ while (iterator.hasNext()) {
+ HostInfo element = iterator.next();
+ hostList.append(element.getHostName());
+ if( iterator.hasNext()) {
+ hostList.append(COMMA_DELIMITER);
+ }
+ }
+ }
+ return hostList.toString();
+ }
+
+ /**
+ * Get a list of ports
+ *
+ * @return string of ports seperated by commas
+ * @since 4.2
+ */
+ public String getPorts() {
+ StringBuffer portList = new StringBuffer(""); //$NON-NLS-1$
+ if( hosts != null) {
+ Iterator<HostInfo> iterator = hosts.iterator();
+ while (iterator.hasNext()) {
+ HostInfo element = iterator.next();
+ portList.append(element.getPortNumber());
+ if( iterator.hasNext()) {
+ portList.append(COMMA_DELIMITER);
+ }
+ }
+ }
+ return portList.toString();
+ }
+
+ /**
+ * @param url
+ * @throws MalformedURLException
+ * @since 4.2
+ */
+ private void parseServerURL(String serverURL, String exceptionMessage) throws MalformedURLException {
+ StringTokenizer st = new StringTokenizer(serverURL, COMMA_DELIMITER);
+ if (!st.hasMoreTokens()) {
+ throw new MalformedURLException(exceptionMessage);
+ }
+ while (st.hasMoreTokens()) {
+ String nextToken = st.nextToken();
+ nextToken = nextToken.trim();
+ String host = ""; //$NON-NLS-1$
+ String port = ""; //$NON-NLS-1$
+ if (nextToken.startsWith("[")) { //$NON-NLS-1$
+ int hostEnd = nextToken.indexOf("]:"); //$NON-NLS-1$
+ if (hostEnd == -1) {
+ throw new MalformedURLException(JDBCPlugin.Util.getString("TeiidURL.invalid_ipv6_hostport", nextToken, exceptionMessage)); //$NON-NLS-1$
+ }
+ host = nextToken.substring(1, hostEnd);
+ port = nextToken.substring(hostEnd+2);
+ }
+ else {
+ int hostEnd = nextToken.indexOf(":"); //$NON-NLS-1$
+ if (hostEnd == -1) {
+ throw new MalformedURLException(JDBCPlugin.Util.getString("TeiidURL.invalid_hostport", nextToken, exceptionMessage)); //$NON-NLS-1$
+ }
+ host = nextToken.substring(0, hostEnd);
+ port = nextToken.substring(hostEnd+1);
+ }
+ host = host.trim();
+ port = port.trim();
+ if (host.equals("") || port.equals("")) { //$NON-NLS-1$ //$NON-NLS-2$
+ throw new MalformedURLException(JDBCPlugin.Util.getString("TeiidURL.invalid_hostport", nextToken, exceptionMessage)); //$NON-NLS-1$
+ }
+ int portNumber = validatePort(port);
+ HostInfo hostInfo = new HostInfo(host, portNumber);
+ hosts.add(hostInfo);
+ }
+ }
+
+ public static int validatePort(String port) throws MalformedURLException {
+ int portNumber;
+ try {
+ portNumber = Integer.parseInt(port);
+ } catch (NumberFormatException nfe) {
+ throw new MalformedURLException(JDBCPlugin.Util.getString("TeiidURL.non_numeric_port", port)); //$NON-NLS-1$
+ }
+ String msg = validatePort(portNumber);
+ if (msg != null) {
+ throw new MalformedURLException(msg);
+ }
+ return portNumber;
+ }
+
+ public static String validatePort(int portNumber) {
+ if (portNumber < 0 || portNumber > 0xFFFF) {
+ return JDBCPlugin.Util.getString("TeiidURL.port_out_of_range", portNumber); //$NON-NLS-1$
+ }
+ return null;
+ }
+
+ /**
+ * Get the Application Server URL
+ *
+ * @return String for connection to the Server
+ * @since 4.2
+ */
+ public String getAppServerURL() {
+ if (appServerURL == null) {
+ StringBuffer sb = new StringBuffer();
+ if (usingSSL) {
+ sb.append(SECURE_PROTOCOL);
+ } else {
+ sb.append(DEFAULT_PROTOCOL);
+ }
+ Iterator<HostInfo> iter = hosts.iterator();
+ while (iter.hasNext()) {
+ HostInfo host = iter.next();
+
+ boolean ipv6HostName = host.getHostName().indexOf(':') != -1;
+ if (ipv6HostName) {
+ sb.append('[');
+ }
+ sb.append(host.getHostName());
+ if (ipv6HostName) {
+ sb.append(']');
+ }
+ sb.append(COLON_DELIMITER);
+ sb.append(host.getPortNumber());
+ if (iter.hasNext()) {
+ sb.append(COMMA_DELIMITER);
+ }
+ }
+ appServerURL = sb.toString();
+ }
+ return appServerURL;
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ * @since 4.2
+ */
+ public String toString() {
+ return getAppServerURL();
+ }
+
+ /**
+ * @see java.lang.Object#equals(java.lang.Object)
+ * @since 4.2
+ */
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof TeiidURL)) {
+ return false;
+ }
+ TeiidURL url = (TeiidURL)obj;
+ return (appServerURL.equals(url.getAppServerURL()));
+ }
+
+ /**
+ * @see java.lang.Object#hashCode()
+ * @since 4.2
+ */
+ public int hashCode() {
+ return appServerURL.hashCode();
+ }
+
+ public boolean isUsingSSL() {
+ return usingSSL;
+ }
+
+}
Deleted: tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/net/socket/SocketServerConnectionFactory.java
===================================================================
--- trunk/client/src/main/java/org/teiid/net/socket/SocketServerConnectionFactory.java 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/net/socket/SocketServerConnectionFactory.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,372 +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.net.socket;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.net.InetAddress;
-import java.net.MalformedURLException;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.teiid.client.security.ILogon;
-import org.teiid.client.security.InvalidSessionException;
-import org.teiid.client.security.SessionToken;
-import org.teiid.core.TeiidException;
-import org.teiid.core.util.PropertiesUtils;
-import org.teiid.core.util.ReflectionHelper;
-import org.teiid.net.CommunicationException;
-import org.teiid.net.ConnectionException;
-import org.teiid.net.HostInfo;
-import org.teiid.net.ServerConnection;
-import org.teiid.net.ServerConnectionFactory;
-import org.teiid.net.TeiidURL;
-
-
-/**
- * Responsible for creating socket based connections
- *
- * The comm approach is object based and layered. Connections manage failover and identity.
- * ServerInstances represent the service layer to a particular cluster member. ObjectChannels
- * abstract the underlying IO.
- *
- */
-public class SocketServerConnectionFactory implements ServerConnectionFactory, SocketServerInstanceFactory {
-
- private static final String URL = "URL"; //$NON-NLS-1$
-
- private static SocketServerConnectionFactory INSTANCE;
- private static Logger log = Logger.getLogger("org.teiid.client.sockets"); //$NON-NLS-1$
-
- private final class ShutdownHandler implements InvocationHandler {
- private final CachedInstance key;
-
- private ShutdownHandler(CachedInstance key) {
- this.key = key;
- }
-
- @Override
- public Object invoke(Object arg0, Method arg1, Object[] arg2)
- throws Throwable {
- if (arg1.getName().equals("shutdown")) { //$NON-NLS-1$
- CachedInstance purge = null;
- if (!key.actual.isOpen()) {
- return null; //nothing to do
- }
- synchronized (instancePool) {
- instancePool.put(key, key);
- if (instancePool.size() > maxCachedInstances) {
- Iterator<CachedInstance> iter = instancePool.keySet().iterator();
- purge = iter.next();
- iter.remove();
- }
- }
- if (purge != null) {
- purge.actual.shutdown();
- }
- return null;
- }
- try {
- return arg1.invoke(key.actual, arg2);
- } catch (InvocationTargetException e) {
- throw e.getTargetException();
- }
- }
- }
-
- private static class CachedInstance {
- HostInfo info;
- Integer instance;
- SocketServerInstance actual;
- SocketServerInstance proxy;
-
- public CachedInstance(HostInfo info) {
- this.info = info;
- }
-
- @Override
- public int hashCode() {
- return info.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (!(obj instanceof CachedInstance)) {
- return false;
- }
- CachedInstance other = (CachedInstance) obj;
- if (!info.equals(other.info)) {
- return false;
- }
- if (instance == null || other.instance == null) {
- return true;
- }
- return instance.equals(other.instance);
- }
- }
-
- private ObjectChannelFactory channelFactory;
- private Timer pingTimer;
-
- private HashMap<HostInfo, Set<SessionToken>> sessions = new HashMap<HostInfo, Set<SessionToken>>();
-
- //instance pooling
- private AtomicInteger instanceCount = new AtomicInteger();
- private Map<CachedInstance, CachedInstance> instancePool = new LinkedHashMap<CachedInstance, CachedInstance>();
-
- //config properties
- private long synchronousTtl = 120000l;
- private int maxCachedInstances=16;
-
- public static synchronized SocketServerConnectionFactory getInstance() {
- if (INSTANCE == null) {
- INSTANCE = new SocketServerConnectionFactory();
- Properties props = System.getProperties();
- InputStream is = SocketServerConnectionFactory.class.getResourceAsStream("/teiid-client-settings.properties"); //$NON-NLS-1$
- if (is != null) {
- props = new Properties(props);
- try {
- props.load(is);
- } catch (IOException e) {
-
- } finally {
- try {
- is.close();
- } catch (IOException e) {
- }
- }
- }
- INSTANCE.initialize(props);
- }
- return INSTANCE;
- }
-
- public SocketServerConnectionFactory() {
-
- }
-
- public void initialize(Properties info) {
- PropertiesUtils.setBeanProperties(this, info, "org.teiid.sockets"); //$NON-NLS-1$
- this.pingTimer = new Timer("SocketPing", true); //$NON-NLS-1$
- this.pingTimer.schedule(new TimerTask() {
-
- @Override
- public void run() {
- Set<Map.Entry<HostInfo, Set<SessionToken>>> sessionEntries = null;
- synchronized (sessions) {
- sessionEntries = new HashSet<Map.Entry<HostInfo, Set<SessionToken>>>(sessions.entrySet());
- }
- for (Map.Entry<HostInfo, Set<SessionToken>> entry : sessionEntries) {
- SocketServerInstance instance = null;
- HashSet<SessionToken> entries = null;
- synchronized (sessions) {
- entries = new HashSet<SessionToken>(entry.getValue());
- }
- try {
- instance = getServerInstance(entry.getKey());
- ILogon logon = instance.getService(ILogon.class);
- if ("7.1.1".compareTo(instance.getServerVersion()) > 0) { //$NON-NLS-1$
- for (SessionToken session : entries) {
- try {
- logon.assertIdentity(session);
- logon.ping();
- log.log(Level.FINER, "issueing ping for session:", session); //$NON-NLS-1$
- } catch (InvalidSessionException e) {
- }
- }
- } else {
- ArrayList<String> sessionStrings = new ArrayList<String>(entry.getValue().size());
- for (SessionToken session : entries) {
- sessionStrings.add(session.getSessionID());
- }
- logon.ping(sessionStrings);
- log.log(Level.FINER, "issueing ping for sessions:", sessionStrings); //$NON-NLS-1$
- }
- } catch (Exception e) {
- log.log(Level.WARNING, "Error performing keep-alive ping", e); //$NON-NLS-1$
- } finally {
- if (instance != null) {
- instance.shutdown();
- }
- }
- }
- }
- }, ServerConnection.PING_INTERVAL, ServerConnection.PING_INTERVAL);
- this.channelFactory = new OioOjbectChannelFactory(info);
- }
-
- @Override
- public SocketServerInstance getServerInstance(HostInfo info) throws CommunicationException, IOException {
- CachedInstance key = null;
- boolean useCache = this.maxCachedInstances > 0;
- if (useCache) {
- CachedInstance instance = null;
- key = new CachedInstance(info);
- synchronized (instancePool) {
- instance = instancePool.remove(key);
- }
- if (instance != null) {
- ILogon logon = instance.actual.getService(ILogon.class);
- boolean valid = false;
- try {
- Future<?> success = logon.ping();
- success.get(this.channelFactory.getSoTimeout(), TimeUnit.MILLISECONDS);
- valid = true;
- } catch (Exception e) {
- log.log(Level.FINE, "Error performing ping, will select another instance", e); //$NON-NLS-1$
- }
- if (valid) {
- return instance.proxy;
- }
- instance.actual.shutdown();
- //technically we only want to remove instances with the same inetaddress
- while (true) {
- CachedInstance invalid = null;
- synchronized (instancePool) {
- invalid = instancePool.remove(key);
- }
- if (invalid == null) {
- break;
- }
- invalid.actual.shutdown();
- }
- }
- }
- SocketServerInstanceImpl ssii = new SocketServerInstanceImpl(info, getSynchronousTtl());
- ssii.connect(this.channelFactory);
- if (useCache) {
- key.actual = ssii;
- key.instance = instanceCount.getAndIncrement();
- //create a proxied socketserverinstance that will pool itself on shutdown
- key.proxy = (SocketServerInstance)Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] {SocketServerInstance.class}, new ShutdownHandler(key));
- return key.proxy;
- }
- return ssii;
- }
-
- /**
- * @param connectionProperties will be updated with additional information before logon
- */
- public SocketServerConnection getConnection(Properties connectionProperties) throws CommunicationException, ConnectionException {
-
- updateConnectionProperties(connectionProperties);
-
- TeiidURL url;
- try {
- url = new TeiidURL(connectionProperties.getProperty(TeiidURL.CONNECTION.SERVER_URL));
- } catch (MalformedURLException e1) {
- throw new ConnectionException(e1);
- }
-
- String discoveryStrategyName = connectionProperties.getProperty(TeiidURL.CONNECTION.DISCOVERY_STRATEGY, URL);
-
- ServerDiscovery discovery;
-
- if (URL.equalsIgnoreCase(discoveryStrategyName)) {
- discovery = new UrlServerDiscovery();
- } else {
- try {
- discovery = (ServerDiscovery)ReflectionHelper.create(discoveryStrategyName, null, this.getClass().getClassLoader());
- } catch (TeiidException e) {
- throw new ConnectionException(e);
- }
- }
-
- discovery.init(url, connectionProperties);
-
- return new SocketServerConnection(this, url.isUsingSSL(), discovery, connectionProperties);
- }
-
- static void updateConnectionProperties(Properties connectionProperties) {
- try {
- InetAddress addr = InetAddress.getLocalHost();
- connectionProperties.put(TeiidURL.CONNECTION.CLIENT_IP_ADDRESS, addr.getHostAddress());
- connectionProperties.put(TeiidURL.CONNECTION.CLIENT_HOSTNAME, addr.getCanonicalHostName());
- } catch (UnknownHostException err1) {
- connectionProperties.put(TeiidURL.CONNECTION.CLIENT_IP_ADDRESS, "UnknownClientAddress"); //$NON-NLS-1$
- }
- }
-
- public long getSynchronousTtl() {
- return synchronousTtl;
- }
-
- public void setSynchronousTtl(long synchronousTTL) {
- this.synchronousTtl = synchronousTTL;
- }
-
- public int getMaxCachedInstances() {
- return maxCachedInstances;
- }
-
- public void setMaxCachedInstances(int maxCachedInstances) {
- this.maxCachedInstances = maxCachedInstances;
- }
-
- @Override
- public void connected(SocketServerInstance instance, SessionToken session) {
- synchronized (sessions) {
- Set<SessionToken> instanceSessions = sessions.get(instance.getHostInfo());
- if (instanceSessions == null) {
- instanceSessions = new HashSet<SessionToken>();
- sessions.put(instance.getHostInfo(), instanceSessions);
- }
- instanceSessions.add(session);
- }
- }
-
- @Override
- public void disconnected(SocketServerInstance instance, SessionToken session) {
- synchronized (sessions) {
- Set<SessionToken> instanceSessions = sessions.get(instance.getHostInfo());
- if (instanceSessions != null) {
- instanceSessions.remove(session);
- if (instanceSessions.isEmpty()) {
- sessions.remove(instance.getHostInfo());
- }
- }
- }
- }
-
-}
Copied: tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/net/socket/SocketServerConnectionFactory.java (from rev 3218, trunk/client/src/main/java/org/teiid/net/socket/SocketServerConnectionFactory.java)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/net/socket/SocketServerConnectionFactory.java (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/client/src/main/java/org/teiid/net/socket/SocketServerConnectionFactory.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,385 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License 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.net.socket;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.net.InetAddress;
+import java.net.MalformedURLException;
+import java.net.NetworkInterface;
+import java.net.SocketException;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.teiid.client.security.ILogon;
+import org.teiid.client.security.InvalidSessionException;
+import org.teiid.client.security.SessionToken;
+import org.teiid.core.TeiidException;
+import org.teiid.core.util.PropertiesUtils;
+import org.teiid.core.util.ReflectionHelper;
+import org.teiid.net.CommunicationException;
+import org.teiid.net.ConnectionException;
+import org.teiid.net.HostInfo;
+import org.teiid.net.ServerConnection;
+import org.teiid.net.ServerConnectionFactory;
+import org.teiid.net.TeiidURL;
+
+
+/**
+ * Responsible for creating socket based connections
+ *
+ * The comm approach is object based and layered. Connections manage failover and identity.
+ * ServerInstances represent the service layer to a particular cluster member. ObjectChannels
+ * abstract the underlying IO.
+ *
+ */
+public class SocketServerConnectionFactory implements ServerConnectionFactory, SocketServerInstanceFactory {
+
+ private static final String URL = "URL"; //$NON-NLS-1$
+
+ private static SocketServerConnectionFactory INSTANCE;
+ private static Logger log = Logger.getLogger("org.teiid.client.sockets"); //$NON-NLS-1$
+
+ private final class ShutdownHandler implements InvocationHandler {
+ private final CachedInstance key;
+
+ private ShutdownHandler(CachedInstance key) {
+ this.key = key;
+ }
+
+ @Override
+ public Object invoke(Object arg0, Method arg1, Object[] arg2)
+ throws Throwable {
+ if (arg1.getName().equals("shutdown")) { //$NON-NLS-1$
+ CachedInstance purge = null;
+ if (!key.actual.isOpen()) {
+ return null; //nothing to do
+ }
+ synchronized (instancePool) {
+ instancePool.put(key, key);
+ if (instancePool.size() > maxCachedInstances) {
+ Iterator<CachedInstance> iter = instancePool.keySet().iterator();
+ purge = iter.next();
+ iter.remove();
+ }
+ }
+ if (purge != null) {
+ purge.actual.shutdown();
+ }
+ return null;
+ }
+ try {
+ return arg1.invoke(key.actual, arg2);
+ } catch (InvocationTargetException e) {
+ throw e.getTargetException();
+ }
+ }
+ }
+
+ private static class CachedInstance {
+ HostInfo info;
+ Integer instance;
+ SocketServerInstance actual;
+ SocketServerInstance proxy;
+
+ public CachedInstance(HostInfo info) {
+ this.info = info;
+ }
+
+ @Override
+ public int hashCode() {
+ return info.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!(obj instanceof CachedInstance)) {
+ return false;
+ }
+ CachedInstance other = (CachedInstance) obj;
+ if (!info.equals(other.info)) {
+ return false;
+ }
+ if (instance == null || other.instance == null) {
+ return true;
+ }
+ return instance.equals(other.instance);
+ }
+ }
+
+ private ObjectChannelFactory channelFactory;
+ private Timer pingTimer;
+
+ private HashMap<HostInfo, Set<SessionToken>> sessions = new HashMap<HostInfo, Set<SessionToken>>();
+
+ //instance pooling
+ private AtomicInteger instanceCount = new AtomicInteger();
+ private Map<CachedInstance, CachedInstance> instancePool = new LinkedHashMap<CachedInstance, CachedInstance>();
+
+ //config properties
+ private long synchronousTtl = 120000l;
+ private int maxCachedInstances=16;
+
+ public static synchronized SocketServerConnectionFactory getInstance() {
+ if (INSTANCE == null) {
+ INSTANCE = new SocketServerConnectionFactory();
+ Properties props = System.getProperties();
+ InputStream is = SocketServerConnectionFactory.class.getResourceAsStream("/teiid-client-settings.properties"); //$NON-NLS-1$
+ if (is != null) {
+ props = new Properties(props);
+ try {
+ props.load(is);
+ } catch (IOException e) {
+
+ } finally {
+ try {
+ is.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+ INSTANCE.initialize(props);
+ }
+ return INSTANCE;
+ }
+
+ public SocketServerConnectionFactory() {
+
+ }
+
+ public void initialize(Properties info) {
+ PropertiesUtils.setBeanProperties(this, info, "org.teiid.sockets"); //$NON-NLS-1$
+ this.pingTimer = new Timer("SocketPing", true); //$NON-NLS-1$
+ this.pingTimer.schedule(new TimerTask() {
+
+ @Override
+ public void run() {
+ Set<Map.Entry<HostInfo, Set<SessionToken>>> sessionEntries = null;
+ synchronized (sessions) {
+ sessionEntries = new HashSet<Map.Entry<HostInfo, Set<SessionToken>>>(sessions.entrySet());
+ }
+ for (Map.Entry<HostInfo, Set<SessionToken>> entry : sessionEntries) {
+ SocketServerInstance instance = null;
+ HashSet<SessionToken> entries = null;
+ synchronized (sessions) {
+ entries = new HashSet<SessionToken>(entry.getValue());
+ }
+ try {
+ instance = getServerInstance(entry.getKey());
+ ILogon logon = instance.getService(ILogon.class);
+ if ("7.1.1".compareTo(instance.getServerVersion()) > 0) { //$NON-NLS-1$
+ for (SessionToken session : entries) {
+ try {
+ logon.assertIdentity(session);
+ logon.ping();
+ log.log(Level.FINER, "issueing ping for session:", session); //$NON-NLS-1$
+ } catch (InvalidSessionException e) {
+ }
+ }
+ } else {
+ ArrayList<String> sessionStrings = new ArrayList<String>(entry.getValue().size());
+ for (SessionToken session : entries) {
+ sessionStrings.add(session.getSessionID());
+ }
+ logon.ping(sessionStrings);
+ log.log(Level.FINER, "issueing ping for sessions:", sessionStrings); //$NON-NLS-1$
+ }
+ } catch (Exception e) {
+ log.log(Level.WARNING, "Error performing keep-alive ping", e); //$NON-NLS-1$
+ } finally {
+ if (instance != null) {
+ instance.shutdown();
+ }
+ }
+ }
+ }
+ }, ServerConnection.PING_INTERVAL, ServerConnection.PING_INTERVAL);
+ this.channelFactory = new OioOjbectChannelFactory(info);
+ }
+
+ @Override
+ public SocketServerInstance getServerInstance(HostInfo info) throws CommunicationException, IOException {
+ CachedInstance key = null;
+ boolean useCache = this.maxCachedInstances > 0;
+ if (useCache) {
+ CachedInstance instance = null;
+ key = new CachedInstance(info);
+ synchronized (instancePool) {
+ instance = instancePool.remove(key);
+ }
+ if (instance != null) {
+ ILogon logon = instance.actual.getService(ILogon.class);
+ boolean valid = false;
+ try {
+ Future<?> success = logon.ping();
+ success.get(this.channelFactory.getSoTimeout(), TimeUnit.MILLISECONDS);
+ valid = true;
+ } catch (Exception e) {
+ log.log(Level.FINE, "Error performing ping, will select another instance", e); //$NON-NLS-1$
+ }
+ if (valid) {
+ return instance.proxy;
+ }
+ instance.actual.shutdown();
+ //technically we only want to remove instances with the same inetaddress
+ while (true) {
+ CachedInstance invalid = null;
+ synchronized (instancePool) {
+ invalid = instancePool.remove(key);
+ }
+ if (invalid == null) {
+ break;
+ }
+ invalid.actual.shutdown();
+ }
+ }
+ }
+ SocketServerInstanceImpl ssii = new SocketServerInstanceImpl(info, getSynchronousTtl());
+ ssii.connect(this.channelFactory);
+ if (useCache) {
+ key.actual = ssii;
+ key.instance = instanceCount.getAndIncrement();
+ //create a proxied socketserverinstance that will pool itself on shutdown
+ key.proxy = (SocketServerInstance)Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] {SocketServerInstance.class}, new ShutdownHandler(key));
+ return key.proxy;
+ }
+ return ssii;
+ }
+
+ /**
+ * @param connectionProperties will be updated with additional information before logon
+ */
+ public SocketServerConnection getConnection(Properties connectionProperties) throws CommunicationException, ConnectionException {
+
+ updateConnectionProperties(connectionProperties);
+
+ TeiidURL url;
+ try {
+ url = new TeiidURL(connectionProperties.getProperty(TeiidURL.CONNECTION.SERVER_URL));
+ } catch (MalformedURLException e1) {
+ throw new ConnectionException(e1);
+ }
+
+ String discoveryStrategyName = connectionProperties.getProperty(TeiidURL.CONNECTION.DISCOVERY_STRATEGY, URL);
+
+ ServerDiscovery discovery;
+
+ if (URL.equalsIgnoreCase(discoveryStrategyName)) {
+ discovery = new UrlServerDiscovery();
+ } else {
+ try {
+ discovery = (ServerDiscovery)ReflectionHelper.create(discoveryStrategyName, null, this.getClass().getClassLoader());
+ } catch (TeiidException e) {
+ throw new ConnectionException(e);
+ }
+ }
+
+ discovery.init(url, connectionProperties);
+
+ return new SocketServerConnection(this, url.isUsingSSL(), discovery, connectionProperties);
+ }
+
+ static void updateConnectionProperties(Properties connectionProperties) {
+ try {
+ InetAddress addr = InetAddress.getLocalHost();
+ connectionProperties.put(TeiidURL.CONNECTION.CLIENT_IP_ADDRESS, addr.getHostAddress());
+ connectionProperties.put(TeiidURL.CONNECTION.CLIENT_HOSTNAME, addr.getCanonicalHostName());
+ NetworkInterface ni = NetworkInterface.getByInetAddress(addr);
+ if (ni != null && ni.getHardwareAddress() != null) {
+ StringBuilder sb = new StringBuilder();
+ for (byte b : ni.getHardwareAddress()) {
+ sb.append(PropertiesUtils.toHex(b >> 4));
+ sb.append(PropertiesUtils.toHex(b));
+ }
+ connectionProperties.put(TeiidURL.CONNECTION.CLIENT_MAC, sb.toString());
+ }
+ } catch (UnknownHostException err1) {
+ connectionProperties.put(TeiidURL.CONNECTION.CLIENT_IP_ADDRESS, "UnknownClientAddress"); //$NON-NLS-1$
+ } catch (SocketException e) {
+
+ }
+ }
+
+ public long getSynchronousTtl() {
+ return synchronousTtl;
+ }
+
+ public void setSynchronousTtl(long synchronousTTL) {
+ this.synchronousTtl = synchronousTTL;
+ }
+
+ public int getMaxCachedInstances() {
+ return maxCachedInstances;
+ }
+
+ public void setMaxCachedInstances(int maxCachedInstances) {
+ this.maxCachedInstances = maxCachedInstances;
+ }
+
+ @Override
+ public void connected(SocketServerInstance instance, SessionToken session) {
+ synchronized (sessions) {
+ Set<SessionToken> instanceSessions = sessions.get(instance.getHostInfo());
+ if (instanceSessions == null) {
+ instanceSessions = new HashSet<SessionToken>();
+ sessions.put(instance.getHostInfo(), instanceSessions);
+ }
+ instanceSessions.add(session);
+ }
+ }
+
+ @Override
+ public void disconnected(SocketServerInstance instance, SessionToken session) {
+ synchronized (sessions) {
+ Set<SessionToken> instanceSessions = sessions.get(instance.getHostInfo());
+ if (instanceSessions != null) {
+ instanceSessions.remove(session);
+ if (instanceSessions.isEmpty()) {
+ sessions.remove(instance.getHostInfo());
+ }
+ }
+ }
+ }
+
+}
Deleted: tags/teiid-parent-7.5.0.Alpha1/client/src/test/java/org/teiid/jdbc/TestStatement.java
===================================================================
--- trunk/client/src/test/java/org/teiid/jdbc/TestStatement.java 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/client/src/test/java/org/teiid/jdbc/TestStatement.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,122 +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.jdbc;
-
-import static org.junit.Assert.*;
-
-import java.sql.ResultSet;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Properties;
-
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.teiid.client.DQP;
-import org.teiid.client.RequestMessage;
-import org.teiid.client.ResultsMessage;
-import org.teiid.client.util.ResultsFuture;
-
-@SuppressWarnings("nls")
-public class TestStatement {
-
- @Test public void testBatchExecution() throws Exception {
- ConnectionImpl conn = Mockito.mock(ConnectionImpl.class);
- DQP dqp = Mockito.mock(DQP.class);
- ResultsFuture<ResultsMessage> results = new ResultsFuture<ResultsMessage>();
- Mockito.stub(dqp.executeRequest(Mockito.anyLong(), (RequestMessage)Mockito.anyObject())).toReturn(results);
- ResultsMessage rm = new ResultsMessage();
- rm.setResults(new List<?>[] {Arrays.asList(1), Arrays.asList(2)});
- rm.setUpdateResult(true);
- results.getResultsReceiver().receiveResults(rm);
- Mockito.stub(conn.getDQP()).toReturn(dqp);
- StatementImpl statement = new StatementImpl(conn, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
- statement.addBatch("delete from table"); //$NON-NLS-1$
- statement.addBatch("delete from table1"); //$NON-NLS-1$
- assertTrue(Arrays.equals(new int[] {1, 2}, statement.executeBatch()));
- }
-
- @Test public void testSetStatement() throws Exception {
- ConnectionImpl conn = Mockito.mock(ConnectionImpl.class);
- Properties p = new Properties();
- Mockito.stub(conn.getExecutionProperties()).toReturn(p);
- StatementImpl statement = new StatementImpl(conn, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
- assertFalse(statement.execute("set foo bar")); //$NON-NLS-1$
- assertEquals("bar", p.get("foo")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- @Test public void testPropertiesOverride() throws Exception {
- ConnectionImpl conn = Mockito.mock(ConnectionImpl.class);
- Properties p = new Properties();
- p.setProperty(ExecutionProperties.ANSI_QUOTED_IDENTIFIERS, Boolean.TRUE.toString());
- Mockito.stub(conn.getExecutionProperties()).toReturn(p);
- StatementImpl statement = new StatementImpl(conn, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
- assertEquals(Boolean.TRUE.toString(), statement.getExecutionProperty(ExecutionProperties.ANSI_QUOTED_IDENTIFIERS));
- statement.setExecutionProperty(ExecutionProperties.ANSI_QUOTED_IDENTIFIERS, Boolean.FALSE.toString());
- assertEquals(Boolean.FALSE.toString(), statement.getExecutionProperty(ExecutionProperties.ANSI_QUOTED_IDENTIFIERS));
- assertEquals(Boolean.TRUE.toString(), p.getProperty(ExecutionProperties.ANSI_QUOTED_IDENTIFIERS));
- }
-
- @Test public void testTransactionStatements() throws Exception {
- ConnectionImpl conn = Mockito.mock(ConnectionImpl.class);
- Properties p = new Properties();
- Mockito.stub(conn.getExecutionProperties()).toReturn(p);
- StatementImpl statement = new StatementImpl(conn, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
- assertFalse(statement.execute("start transaction")); //$NON-NLS-1$
- Mockito.verify(conn).setAutoCommit(false);
- assertFalse(statement.execute("commit")); //$NON-NLS-1$
- Mockito.verify(conn).setAutoCommit(true);
- assertFalse(statement.execute("start transaction")); //$NON-NLS-1$
- assertFalse(statement.execute("rollback")); //$NON-NLS-1$
- Mockito.verify(conn).rollback(false);
- }
-
- @SuppressWarnings("unchecked")
- @Test public void testTransactionStatementsAsynch() throws Exception {
- ConnectionImpl conn = Mockito.mock(ConnectionImpl.class);
- Mockito.stub(conn.submitSetAutoCommitTrue(Mockito.anyBoolean())).toReturn((ResultsFuture)ResultsFuture.NULL_FUTURE);
- Properties p = new Properties();
- Mockito.stub(conn.getExecutionProperties()).toReturn(p);
- StatementImpl statement = new StatementImpl(conn, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
- statement.submitExecute("start transaction"); //$NON-NLS-1$
- Mockito.verify(conn).setAutoCommit(false);
- statement.submitExecute("commit"); //$NON-NLS-1$
- Mockito.verify(conn).submitSetAutoCommitTrue(true);
- statement.submitExecute("start transaction"); //$NON-NLS-1$
- statement.submitExecute("rollback"); //$NON-NLS-1$
- Mockito.verify(conn).submitSetAutoCommitTrue(false);
- }
-
- @Test public void testAsynchTimeout() throws Exception {
- ConnectionImpl conn = Mockito.mock(ConnectionImpl.class);
- StatementImpl statement = new StatementImpl(conn, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
- statement.setQueryTimeoutMS(1);
- DQP dqp = Mockito.mock(DQP.class);
- Mockito.stub(statement.getDQP()).toReturn(dqp);
- ResultsFuture<ResultsMessage> future = new ResultsFuture<ResultsMessage>();
- Mockito.stub(dqp.executeRequest(Mockito.anyLong(), (RequestMessage) Mockito.anyObject())).toReturn(future);
- statement.submitExecute("select 'hello world'");
- Thread.sleep(100);
- Mockito.verify(dqp).cancelRequest(0);
- }
-
-}
Copied: tags/teiid-parent-7.5.0.Alpha1/client/src/test/java/org/teiid/jdbc/TestStatement.java (from rev 3218, trunk/client/src/test/java/org/teiid/jdbc/TestStatement.java)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/client/src/test/java/org/teiid/jdbc/TestStatement.java (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/client/src/test/java/org/teiid/jdbc/TestStatement.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -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.jdbc;
+
+import static org.junit.Assert.*;
+
+import java.sql.ResultSet;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Properties;
+
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.teiid.client.DQP;
+import org.teiid.client.RequestMessage;
+import org.teiid.client.ResultsMessage;
+import org.teiid.client.util.ResultsFuture;
+
+@SuppressWarnings("nls")
+public class TestStatement {
+
+ @Test public void testBatchExecution() throws Exception {
+ ConnectionImpl conn = Mockito.mock(ConnectionImpl.class);
+ DQP dqp = Mockito.mock(DQP.class);
+ ResultsFuture<ResultsMessage> results = new ResultsFuture<ResultsMessage>();
+ Mockito.stub(dqp.executeRequest(Mockito.anyLong(), (RequestMessage)Mockito.anyObject())).toReturn(results);
+ ResultsMessage rm = new ResultsMessage();
+ rm.setResults(new List<?>[] {Arrays.asList(1), Arrays.asList(2)});
+ rm.setUpdateResult(true);
+ results.getResultsReceiver().receiveResults(rm);
+ Mockito.stub(conn.getDQP()).toReturn(dqp);
+ StatementImpl statement = new StatementImpl(conn, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
+ statement.addBatch("delete from table"); //$NON-NLS-1$
+ statement.addBatch("delete from table1"); //$NON-NLS-1$
+ assertTrue(Arrays.equals(new int[] {1, 2}, statement.executeBatch()));
+ }
+
+ @Test public void testSetStatement() throws Exception {
+ ConnectionImpl conn = Mockito.mock(ConnectionImpl.class);
+ Properties p = new Properties();
+ Mockito.stub(conn.getExecutionProperties()).toReturn(p);
+ StatementImpl statement = new StatementImpl(conn, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
+ assertFalse(statement.execute("set foo bar")); //$NON-NLS-1$
+ assertEquals("bar", p.get("foo")); //$NON-NLS-1$ //$NON-NLS-2$
+
+ assertFalse(statement.execute("set foo 'b''ar'")); //$NON-NLS-1$
+ assertEquals("b'ar", p.get("foo")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ @Test public void testSetAuthorizationStatement() throws Exception {
+ ConnectionImpl conn = Mockito.mock(ConnectionImpl.class);
+ Properties p = new Properties();
+ Mockito.stub(conn.getExecutionProperties()).toReturn(p);
+ StatementImpl statement = new StatementImpl(conn, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
+ assertFalse(statement.execute("set session authorization bar")); //$NON-NLS-1$
+ Mockito.verify(conn).changeUser("bar", null);
+ }
+
+ @Test public void testPropertiesOverride() throws Exception {
+ ConnectionImpl conn = Mockito.mock(ConnectionImpl.class);
+ Properties p = new Properties();
+ p.setProperty(ExecutionProperties.ANSI_QUOTED_IDENTIFIERS, Boolean.TRUE.toString());
+ Mockito.stub(conn.getExecutionProperties()).toReturn(p);
+ StatementImpl statement = new StatementImpl(conn, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
+ assertEquals(Boolean.TRUE.toString(), statement.getExecutionProperty(ExecutionProperties.ANSI_QUOTED_IDENTIFIERS));
+ statement.setExecutionProperty(ExecutionProperties.ANSI_QUOTED_IDENTIFIERS, Boolean.FALSE.toString());
+ assertEquals(Boolean.FALSE.toString(), statement.getExecutionProperty(ExecutionProperties.ANSI_QUOTED_IDENTIFIERS));
+ assertEquals(Boolean.TRUE.toString(), p.getProperty(ExecutionProperties.ANSI_QUOTED_IDENTIFIERS));
+ }
+
+ @Test public void testTransactionStatements() throws Exception {
+ ConnectionImpl conn = Mockito.mock(ConnectionImpl.class);
+ Properties p = new Properties();
+ Mockito.stub(conn.getExecutionProperties()).toReturn(p);
+ StatementImpl statement = new StatementImpl(conn, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
+ assertFalse(statement.execute("start transaction")); //$NON-NLS-1$
+ Mockito.verify(conn).setAutoCommit(false);
+ assertFalse(statement.execute("commit")); //$NON-NLS-1$
+ Mockito.verify(conn).setAutoCommit(true);
+ assertFalse(statement.execute("start transaction")); //$NON-NLS-1$
+ assertFalse(statement.execute("rollback")); //$NON-NLS-1$
+ Mockito.verify(conn).rollback(false);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test public void testTransactionStatementsAsynch() throws Exception {
+ ConnectionImpl conn = Mockito.mock(ConnectionImpl.class);
+ Mockito.stub(conn.submitSetAutoCommitTrue(Mockito.anyBoolean())).toReturn((ResultsFuture)ResultsFuture.NULL_FUTURE);
+ Properties p = new Properties();
+ Mockito.stub(conn.getExecutionProperties()).toReturn(p);
+ StatementImpl statement = new StatementImpl(conn, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
+ statement.submitExecute("start transaction"); //$NON-NLS-1$
+ Mockito.verify(conn).setAutoCommit(false);
+ statement.submitExecute("commit"); //$NON-NLS-1$
+ Mockito.verify(conn).submitSetAutoCommitTrue(true);
+ statement.submitExecute("start transaction"); //$NON-NLS-1$
+ statement.submitExecute("rollback"); //$NON-NLS-1$
+ Mockito.verify(conn).submitSetAutoCommitTrue(false);
+ }
+
+ @Test public void testAsynchTimeout() throws Exception {
+ ConnectionImpl conn = Mockito.mock(ConnectionImpl.class);
+ StatementImpl statement = new StatementImpl(conn, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
+ statement.setQueryTimeoutMS(1);
+ DQP dqp = Mockito.mock(DQP.class);
+ Mockito.stub(statement.getDQP()).toReturn(dqp);
+ ResultsFuture<ResultsMessage> future = new ResultsFuture<ResultsMessage>();
+ Mockito.stub(dqp.executeRequest(Mockito.anyLong(), (RequestMessage) Mockito.anyObject())).toReturn(future);
+ statement.submitExecute("select 'hello world'");
+ Thread.sleep(100);
+ Mockito.verify(dqp).cancelRequest(0);
+ }
+
+}
Deleted: tags/teiid-parent-7.5.0.Alpha1/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java
===================================================================
--- trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -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.jdbc;
-
-import static org.junit.Assert.*;
-
-import java.sql.DriverPropertyInfo;
-import java.util.Properties;
-
-import org.junit.Test;
-import org.teiid.net.TeiidURL;
-
-public class TestTeiidDriver {
- TeiidDriver drv = new TeiidDriver();
- public String localhost = "localhost"; //$NON-NLS-1$
-
- @Test public void testAccepts() throws Exception {
- assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:12345")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:12345;user=foo;password=bar")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:vdb")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:vdb@/foo/blah/deploy.properties")); //$NON-NLS-1$
-
- assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:12345")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:12345;user=foo;password=bar")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:vdb")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:vdb@/foo/blah/deploy.properties")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:8294601c-9fe9-4244-9499-4a012c5e1476_vdb")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:8294601c-9fe9-4244-9499-4a012c5e1476_vdb@mm://localhost:12345")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:test_vdb@mm://local-host:12345")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:test_vdb@mm://local_host:12345")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:test_vdb.1@mm://local_host:12345")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:test_vdb.10@mm://local_host:12345")); //$NON-NLS-1$
- }
-
- /** Valid format of urls*/
- @Test public void testAcceptsURL1() throws Exception {
- assertTrue(drv.acceptsURL("jdbc:teiid:jvdb@mm://localhost:1234")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234;version=x")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234,localhost2:12342,localhost3:12343")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234,localhost2:12342,localhost3:12343;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mms://localhost:1234;logLevel=1;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
- assertTrue(!drv.acceptsURL("jdbc:teiid:@mm://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;autoCommitTxn=OFF;paritalResultsMode=true")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:jvdb@mms://localhost:1234")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234;version=x")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234,localhost2:12342,localhost3:12343")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mms://localhost:1234,localhost2:12342,localhost3:12343;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mms://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;autoCommitTxn=OFF;paritalResultsMode=true")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://127.0.0.1:1234;logLevel=2")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mms://127.0.0.1:1234")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://127.0.0.1:1234,localhost.mydomain.com:63636;logLevel=2")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://my-host.mydomain.com:53535,127.0.0.1:1234")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://123.123.123.123:53535,127.0.0.1:1234")); //$NON-NLS-1$
-
- //DQP type
- assertTrue(drv.acceptsURL("jdbc:teiid:jvdb@c:/dqp.properties;version=1")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:jvdb@/foo/dqp.properties;version=1")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:jvdb@../foo/dqp.properties;version=1")); //$NON-NLS-1$
-
- assertTrue(drv.acceptsURL("jdbc:teiid:jvdb@mm://localhost:port")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:vdb@localhost:port;version=x")); //$NON-NLS-1$
- assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234")); //$NON-NLS-1$
- assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234,localhost2:12342,localhost3:12343")); //$NON-NLS-1$
- assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
- assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234,localhost2:12342,localhost3:12343;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
- assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234;logLevel=1;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
- assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
- assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;autoCommitTxn=OFF;paritalResultsMode=true")); //$NON-NLS-1$
- assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234;stickyConnections=false;socketsPerVM=4")); //$NON-NLS-1$
- assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://my_host.mydomain.com:53535,127.0.0.1:1234")); //$NON-NLS-1$
- }
-
- /** Invalid format of urls*/
- @Test public void testAcceptsURL2() throws Exception {
- assertTrue(!drv.acceptsURL("jdbc:matamatrix:test")); //$NON-NLS-1$
- assertTrue(!drv.acceptsURL("metamatrix:test")); //$NON-NLS-1$
- assertTrue(!drv.acceptsURL("jdbc&matamatrix:test")); //$NON-NLS-1$
- assertTrue(!drv.acceptsURL("jdbc;metamatrix:test")); //$NON-NLS-1$
- }
-
- @Test public void testParseURL() throws Exception{
- Properties p = new Properties();
- TeiidDriver.parseURL("jdbc:teiid:BQT@mm://slwxp157:1234", p); //$NON-NLS-1$
- assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT")); //$NON-NLS-1$
- assertTrue(p.getProperty(TeiidURL.CONNECTION.SERVER_URL).equals("mm://slwxp157:1234")); //$NON-NLS-1$
- assertEquals(3, p.size());
- }
-
- @Test public void testParseURL2() throws Exception {
- Properties p = new Properties();
- TeiidDriver.parseURL("jdbc:teiid:BQT@mms://slwxp157:1234;version=3", p); //$NON-NLS-1$
- assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT")); //$NON-NLS-1$
- assertTrue(p.getProperty(BaseDataSource.VDB_VERSION).equals("3")); //$NON-NLS-1$
- assertTrue(p.getProperty(TeiidURL.CONNECTION.SERVER_URL).equals("mms://slwxp157:1234")); //$NON-NLS-1$
- assertTrue(p.getProperty(BaseDataSource.VERSION).equals("3")); //$NON-NLS-1$
- assertTrue(p.getProperty(BaseDataSource.APP_NAME).equals(BaseDataSource.DEFAULT_APP_NAME));
- assertEquals(5, p.size());
- }
-
- @Test public void testParseURL3() throws Exception{
- Properties p = new Properties();
- TeiidDriver.parseURL("jdbc:teiid:BQT@mm://slwxp157:1234,slntmm01:43401,sluxmm09:43302;version=4;autoCommitTxn=ON;partialResultsMode=YES;ApplicationName=Client", p); //$NON-NLS-1$
- assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT")); //$NON-NLS-1$
- assertTrue(p.getProperty(BaseDataSource.VDB_VERSION).equals("4")); //$NON-NLS-1$
- assertTrue(p.getProperty(ExecutionProperties.PROP_TXN_AUTO_WRAP).equals("ON")); //$NON-NLS-1$
- assertTrue(p.getProperty(ExecutionProperties.PROP_PARTIAL_RESULTS_MODE).equals("YES")); //$NON-NLS-1$
- assertTrue(p.getProperty(TeiidURL.CONNECTION.SERVER_URL).equals("mm://slwxp157:1234,slntmm01:43401,sluxmm09:43302")); //$NON-NLS-1$
- assertTrue(p.getProperty(BaseDataSource.VERSION).equals("4")); //$NON-NLS-1$
- assertTrue(p.getProperty(BaseDataSource.APP_NAME).equals("Client")); //$NON-NLS-1$
- assertEquals(7, p.size());
- }
-
- @Test public void testGetPropertyInfo1() throws Exception {
- DriverPropertyInfo info[] = drv.getPropertyInfo("jdbc:teiid:vdb@mm://localhost:12345;applicationName=x", null); //$NON-NLS-1$
-
- assertEquals(19, info.length);
- assertEquals(false, info[0].required);
- assertEquals("ApplicationName", info[0].name); //$NON-NLS-1$
- assertEquals("x", info[0].value); //$NON-NLS-1$
- }
-
-}
Copied: tags/teiid-parent-7.5.0.Alpha1/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java (from rev 3218, trunk/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/client/src/test/java/org/teiid/jdbc/TestTeiidDriver.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,144 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License 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.jdbc;
+
+import static org.junit.Assert.*;
+
+import java.sql.DriverPropertyInfo;
+import java.util.Properties;
+
+import org.junit.Test;
+import org.teiid.net.TeiidURL;
+
+public class TestTeiidDriver {
+ TeiidDriver drv = new TeiidDriver();
+ public String localhost = "localhost"; //$NON-NLS-1$
+
+ @Test public void testAccepts() throws Exception {
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:12345")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:12345;user=foo;password=bar")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@/foo/blah/deploy.properties")); //$NON-NLS-1$
+
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:12345")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:12345;user=foo;password=bar")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@/foo/blah/deploy.properties")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:8294601c-9fe9-4244-9499-4a012c5e1476_vdb")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:8294601c-9fe9-4244-9499-4a012c5e1476_vdb@mm://localhost:12345")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:test_vdb@mm://local-host:12345")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:test_vdb@mm://local_host:12345")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:test_vdb.1@mm://local_host:12345")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:test_vdb.10@mm://local_host:12345")); //$NON-NLS-1$
+ }
+
+ /** Valid format of urls*/
+ @Test public void testAcceptsURL1() throws Exception {
+ assertTrue(drv.acceptsURL("jdbc:teiid:jvdb@mm://localhost:1234")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234;version=x")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234,localhost2:12342,localhost3:12343")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234,localhost2:12342,localhost3:12343;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mms://localhost:1234;logLevel=1;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:@mm://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;autoCommitTxn=OFF;paritalResultsMode=true")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:jvdb@mms://localhost:1234")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234;version=x")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://localhost:1234,localhost2:12342,localhost3:12343")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mms://localhost:1234,localhost2:12342,localhost3:12343;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mms://localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;autoCommitTxn=OFF;paritalResultsMode=true")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://127.0.0.1:1234;logLevel=2")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mms://127.0.0.1:1234")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://127.0.0.1:1234,localhost.mydomain.com:63636;logLevel=2")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://my-host.mydomain.com:53535,127.0.0.1:1234")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://123.123.123.123:53535,127.0.0.1:1234")); //$NON-NLS-1$
+
+ //DQP type
+ assertTrue(drv.acceptsURL("jdbc:teiid:jvdb@c:/dqp.properties;version=1")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:jvdb@/foo/dqp.properties;version=1")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:jvdb@../foo/dqp.properties;version=1")); //$NON-NLS-1$
+
+ assertTrue(drv.acceptsURL("jdbc:teiid:jvdb@mm://localhost:port")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@localhost:port;version=x")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234,localhost2:12342,localhost3:12343")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234,localhost2:12342,localhost3:12343;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234;logLevel=1;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234;logLevel=2;logFile=D:\\metamatrix\\work\\DQP\\log\\jdbcLogFile.log;autoCommitTxn=OFF;paritalResultsMode=true")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc:teiid:@localhost:1234;stickyConnections=false;socketsPerVM=4")); //$NON-NLS-1$
+ assertTrue(drv.acceptsURL("jdbc:teiid:vdb@mm://my_host.mydomain.com:53535,127.0.0.1:1234")); //$NON-NLS-1$
+ }
+
+ /** Invalid format of urls*/
+ @Test public void testAcceptsURL2() throws Exception {
+ assertTrue(!drv.acceptsURL("jdbc:matamatrix:test")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("metamatrix:test")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc&matamatrix:test")); //$NON-NLS-1$
+ assertTrue(!drv.acceptsURL("jdbc;metamatrix:test")); //$NON-NLS-1$
+ }
+
+ @Test public void testParseURL() throws Exception{
+ Properties p = new Properties();
+ TeiidDriver.parseURL("jdbc:teiid:BQT@mm://slwxp157:1234", p); //$NON-NLS-1$
+ assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT")); //$NON-NLS-1$
+ assertTrue(p.getProperty(TeiidURL.CONNECTION.SERVER_URL).equals("mm://slwxp157:1234")); //$NON-NLS-1$
+ assertEquals(3, p.size());
+ }
+
+ @Test public void testParseURL2() throws Exception {
+ Properties p = new Properties();
+ TeiidDriver.parseURL("jdbc:teiid:BQT@mms://slwxp157:1234;version=3", p); //$NON-NLS-1$
+ assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT")); //$NON-NLS-1$
+ assertTrue(p.getProperty(BaseDataSource.VDB_VERSION).equals("3")); //$NON-NLS-1$
+ assertTrue(p.getProperty(TeiidURL.CONNECTION.SERVER_URL).equals("mms://slwxp157:1234")); //$NON-NLS-1$
+ assertTrue(p.getProperty(BaseDataSource.VERSION).equals("3")); //$NON-NLS-1$
+ assertTrue(p.getProperty(BaseDataSource.APP_NAME).equals(BaseDataSource.DEFAULT_APP_NAME));
+ assertEquals(5, p.size());
+ }
+
+ @Test public void testParseURL3() throws Exception{
+ Properties p = new Properties();
+ TeiidDriver.parseURL("jdbc:teiid:BQT@mm://slwxp157:1234,slntmm01:43401,sluxmm09:43302;version=4;autoCommitTxn=ON;partialResultsMode=YES;ApplicationName=Client", p); //$NON-NLS-1$
+ assertTrue(p.getProperty(BaseDataSource.VDB_NAME).equals("BQT")); //$NON-NLS-1$
+ assertTrue(p.getProperty(BaseDataSource.VDB_VERSION).equals("4")); //$NON-NLS-1$
+ assertTrue(p.getProperty(ExecutionProperties.PROP_TXN_AUTO_WRAP).equals("ON")); //$NON-NLS-1$
+ assertTrue(p.getProperty(ExecutionProperties.PROP_PARTIAL_RESULTS_MODE).equals("YES")); //$NON-NLS-1$
+ assertTrue(p.getProperty(TeiidURL.CONNECTION.SERVER_URL).equals("mm://slwxp157:1234,slntmm01:43401,sluxmm09:43302")); //$NON-NLS-1$
+ assertTrue(p.getProperty(BaseDataSource.VERSION).equals("4")); //$NON-NLS-1$
+ assertTrue(p.getProperty(BaseDataSource.APP_NAME).equals("Client")); //$NON-NLS-1$
+ assertEquals(7, p.size());
+ }
+
+ @Test public void testGetPropertyInfo1() throws Exception {
+ DriverPropertyInfo info[] = drv.getPropertyInfo("jdbc:teiid:vdb@mm://localhost:12345;applicationName=x", null); //$NON-NLS-1$
+
+ assertEquals(20, info.length);
+ assertEquals(false, info[0].required);
+ assertEquals("ApplicationName", info[0].name); //$NON-NLS-1$
+ assertEquals("x", info[0].value); //$NON-NLS-1$
+ }
+
+}
Deleted: tags/teiid-parent-7.5.0.Alpha1/client-jdk15/pom.xml
===================================================================
--- trunk/client-jdk15/pom.xml 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/client-jdk15/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>teiid-parent</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha1-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>teiid-client-jdk15</artifactId>
- <name>Client JDK15</name>
- <description>Contains the packages related retrotranslator that will convert 1.6 to 1.5</description>
- <dependencies>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- </dependency>
- </dependencies>
-</project>
Copied: tags/teiid-parent-7.5.0.Alpha1/client-jdk15/pom.xml (from rev 3220, trunk/client-jdk15/pom.xml)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/client-jdk15/pom.xml (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/client-jdk15/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>teiid-parent</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.5.0.Alpha1</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>teiid-client-jdk15</artifactId>
+ <name>Client JDK15</name>
+ <description>Contains the packages related retrotranslator that will convert 1.6 to 1.5</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ </dependency>
+ </dependencies>
+</project>
Deleted: tags/teiid-parent-7.5.0.Alpha1/common-core/pom.xml
===================================================================
--- trunk/common-core/pom.xml 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/common-core/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>teiid-parent</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha1-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>teiid-common-core</artifactId>
- <name>Common Core</name>
- <description>Core shared library</description>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <phase>process-resources</phase>
- <configuration>
- <tasks>
- <tstamp />
- <replace dir="${project.build.outputDirectory}" token="@build-date@" value="${DSTAMP}">
- <include name="**/*.properties" />
- </replace>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>true</filtering>
- <includes>
- <include>**/*.properties</include>
- </includes>
- </resource>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>false</filtering>
- <excludes>
- <exclude>**/*.properties</exclude>
- </excludes>
- </resource>
- </resources>
- </build>
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.5.0.Alpha1/common-core/pom.xml (from rev 3220, trunk/common-core/pom.xml)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/common-core/pom.xml (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/common-core/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>teiid-parent</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.5.0.Alpha1</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>teiid-common-core</artifactId>
+ <name>Common Core</name>
+ <description>Core shared library</description>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>process-resources</phase>
+ <configuration>
+ <tasks>
+ <tstamp />
+ <replace dir="${project.build.outputDirectory}" token="@build-date@" value="${DSTAMP}">
+ <include name="**/*.properties" />
+ </replace>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*.properties</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>false</filtering>
+ <excludes>
+ <exclude>**/*.properties</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ </build>
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.5.0.Alpha1/common-core/src/main/java/org/teiid/core/util/PropertiesUtils.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/util/PropertiesUtils.java 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/common-core/src/main/java/org/teiid/core/util/PropertiesUtils.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,1017 +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.core.util;
-
-import java.io.BufferedReader;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintStream;
-import java.lang.reflect.Method;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import org.teiid.core.CorePlugin;
-import org.teiid.core.TeiidRuntimeException;
-
-
-
-/**
- * Static utility methods for common tasks having to do with
- * java.util.Properties.
- */
-public final class PropertiesUtils {
-
- public static class InvalidPropertyException extends TeiidRuntimeException {
-
- public InvalidPropertyException(String propertyName, String value, Class<?> expectedType, Throwable cause) {
- super(cause, CorePlugin.Util.getString("InvalidPropertyException.message", propertyName, value, expectedType.getSimpleName())); //$NON-NLS-1$
- }
-
- }
-
- /**
- * Returns a list of property names matching the given pattern. A '*' may be
- * given to match the pattern exactly up to the '*', then anything after.
- * Note: Should also implement matching with '?' which means match any single
- * char.
- * @param pattern The property name to match which may include a '*'.
- * @param props The properties to search.
- * @return The List of property names matching given pattern - may be empty
- * but never null.
- */
- public static List filter( String pattern, Properties props ) {
- boolean addAll = false;
- String searchStr = null;
- List propNames = new ArrayList();
- int globIndex = pattern.indexOf('*');
- if ( globIndex == -1 ) {
- searchStr = pattern;
- } else if ( globIndex == 0 ) {
- addAll = true;
- } else {
- searchStr = pattern.substring(0, globIndex);
- }
-
- Enumeration propNameEnum = props.propertyNames();
- while ( propNameEnum.hasMoreElements() ) {
- String name = (String) propNameEnum.nextElement();
- if ( name.startsWith(searchStr) || addAll ) {
- propNames.add(name);
- }
- }
-
- return propNames;
- }
-
-
- /**
- * Obtains from this source the list of all properties that match the pattern specified by the filter.
- * <p>
- * The filter is a string that may contain the '*' character as a wildcard one or more times
- * in the string. For example, the following filter:
- * <p>
- * <pre> *metamatrix.*</pre>
- * <p>
- * finds all properties that contain somewhere in the property name the string "metamatrix.".
- * @param filterPattern the string filter pattern that will be used to narrow the set of properties returned.
- * @param props The properties to search.
- * @return the enumeration of all of the property names of the primary source;
- * the enumeration may be empty if there is an error connecting to the property sources.
- */
- public static Properties getProperties(String filterPattern, Properties props) {
- Properties results = new Properties();
-
- boolean addAll = false;
- String searchStr = null;
- int globIndex = filterPattern.indexOf('*');
- if ( globIndex == -1 ) {
- searchStr = filterPattern;
- } else if ( globIndex == 0 ) {
- addAll = true;
- } else {
- searchStr = filterPattern.substring(0, globIndex);
- }
-
- Enumeration propNameEnum = props.propertyNames();
- while ( propNameEnum.hasMoreElements() ) {
- String name = (String) propNameEnum.nextElement();
- if ( name.startsWith(searchStr)) {
- Object value = props.get(name);
- if (value != null) {
- results.put(name.substring(searchStr.length()), value);
- }
- }
- else if (addAll) {
- results.put(name, props.get(name));
- }
- }
-
- return results;
- }
-
-
- /**
- * Performs a correct deep clone of the properties object by capturing
- * all properties in the default(s) and placing them directly into the
- * new Properties object. If the input is an instance of
- * <code>UnmodifiableProperties</code>, this method returns an
- * <code>UnmodifiableProperties</code> instance around a new (flattened)
- * copy of the underlying Properties object.
- */
- public static Properties clone( Properties props ) {
- return clone(props, null, false);
- }
-
- /**
- * Performs a correct deep clone of the properties object by capturing
- * all properties in the default(s) and placing them directly into the
- * new Properties object. If the input is an instance of
- * <code>UnmodifiableProperties</code>, this method returns an
- * <code>UnmodifiableProperties</code> instance around a new (flattened)
- * copy of the underlying Properties object.
- */
- public static Properties clone( Properties props, Properties defaults, boolean deepClone ) {
- Properties result = null;
- if ( defaults != null ) {
- if ( deepClone ) {
- defaults = clone(defaults);
- }
- result = new Properties(defaults);
- } else {
- result = new Properties();
- }
-
- putAll(result, props);
-
- return result;
- }
-
- /**
- * This method implements a 'compareTo' logic for two Properties objects,
- * equivalent to calling <code>p1.compareTo(p2)</code> if the
- * {@link java.util.Properties Properties} class implemented
- * {@link java.lang.Comparable Comparable} (which it does not).
- * @param p1 the first Properties instance to compare; may be null
- * @param p2 the second Properties instance to compare; may be null
- * @return a negative integer, zero, or a positive integer as <code>p1</code>
- * is less than, equal to, or greater than <code>p2</code>, respectively.
- */
- public static int compare( Properties p1, Properties p2 ) {
- if ( p1 != null ) {
- if ( p2 == null ) {
- return 1;
- }
- } else {
- if ( p2 != null ) {
- return -1;
- }
- return 0;
- }
-
-
- // Compare the number of property values ...
- int diff = p1.size() - p2.size();
- if ( diff != 0 ) {
- return diff;
- }
-
- // Iterate through the properties and compare values ...
- Map.Entry entry = null;
- Object p1Value = null;
- Object p2Value = null;
- Iterator iter = p1.entrySet().iterator();
- while ( iter.hasNext() ) {
- entry = (Map.Entry) iter.next();
- p1Value = entry.getValue();
- p2Value = p2.get(entry.getKey());
- if ( p1Value != null ) {
- if ( p2Value == null ) {
- return 1;
- }
- if ( p1Value instanceof Comparable ) {
- diff = ((Comparable)p1Value).compareTo(p2Value);
- } else {
- diff = p1Value.toString().compareTo(p2Value.toString());
- }
- if ( diff != 0 ) {
- return diff;
- }
- } else {
- if ( p2Value != null ) {
- return -1;
- }
- }
- }
- return 0;
- }
-
- /**
- * <p>This method is intended to replace the use of the <code>putAll</code>
- * method of <code>Properties</code> inherited from <code>java.util.Hashtable</code>.
- * The problem with that method is that, since it is inherited from
- * <code>Hashtable</code>, <i>default</i> properties are lost.
- * </p>
- * <p>For example, the following code
- * <pre><code>
- * Properties a;
- * Properties b;
- * //initialize ...
- * a.putAll(b);
- * </code></pre>
- * will fail <i>if</i> <code>b</code> had been constructed with a default
- * <code>Properties</code> object. Those defaults would be lost and
- * not added to <code>a</code>.</p>
- *
- * <p>The above code could be correctly performed with this method,
- * like this:
- * <pre><code>
- * Properties a;
- * Properties b;
- * //initialize ...
- * PropertiesUtils.putAll(a,b);
- * </code></pre>
- * In the above example, <code>a</code> is modified - properties are added to
- * it (note that if <code>a</code> has defaults they will remain unaffected.)
- * The properties from <code>b</code>, <i>including defaults</i>, will be
- * added to <code>a</code> using its <code>setProperty</code> method -
- * these new properties will overwrite any pre-existing ones of the same
- * name.
- * </p>
- *
- * @param addToThis This Properties object is modified; the properties
- * of the other parameter are added to this. The added property values
- * will replace any current property values of the same names.
- * @param withThese The properties (including defaults) of this
- * object are added to the "addToThis" parameter.
- */
- public static void putAll(Properties addToThis,
- Properties withThese) {
- if ( withThese != null && addToThis != null ) {
- Enumeration enumeration = withThese.propertyNames();
- while ( enumeration.hasMoreElements() ) {
- String propName = (String) enumeration.nextElement();
- Object propValue = withThese.get(propName);
- if ( propValue == null ) {
- //defaults can only be retrieved as strings
- propValue = withThese.getProperty(propName);
- }
- if ( propValue != null ) {
- addToThis.put(propName, propValue);
- }
- }
- }
- }
-
- public static void setOverrideProperies(Properties base, Properties override) {
- Enumeration overrideEnum = override.propertyNames();
- while (overrideEnum.hasMoreElements()) {
- String key = (String)overrideEnum.nextElement();
- String value = base.getProperty(key);
- String overRideValue = override.getProperty(key);
- if (value != null && !value.equals(overRideValue)) {
- base.setProperty(key, overRideValue);
- }
- }
- }
-
- public static int getIntProperty(Properties props, String propName, int defaultValue) throws InvalidPropertyException {
- String stringVal = props.getProperty(propName);
- if(stringVal == null) {
- return defaultValue;
- }
- stringVal = stringVal.trim();
- if (stringVal.length() == 0) {
- return defaultValue;
- }
- try {
- return Integer.parseInt(stringVal);
- } catch(NumberFormatException e) {
- throw new InvalidPropertyException(propName, stringVal, Integer.class, e);
- }
- }
-
- public static long getLongProperty(Properties props, String propName, long defaultValue) {
- String stringVal = props.getProperty(propName);
- if(stringVal == null) {
- return defaultValue;
- }
- stringVal = stringVal.trim();
- if (stringVal.length() == 0) {
- return defaultValue;
- }
- try {
- return Long.parseLong(stringVal);
- } catch(NumberFormatException e) {
- throw new InvalidPropertyException(propName, stringVal, Long.class, e);
- }
- }
-
- public static float getFloatProperty(Properties props, String propName, float defaultValue) {
- String stringVal = props.getProperty(propName);
- if(stringVal == null) {
- return defaultValue;
- }
- stringVal = stringVal.trim();
- if (stringVal.length() == 0) {
- return defaultValue;
- }
- try {
- return Float.parseFloat(stringVal);
- } catch(NumberFormatException e) {
- throw new InvalidPropertyException(propName, stringVal, Float.class, e);
- }
- }
-
- public static double getDoubleProperty(Properties props, String propName, double defaultValue) {
- String stringVal = props.getProperty(propName);
- if(stringVal == null) {
- return defaultValue;
- }
- stringVal = stringVal.trim();
- if (stringVal.length() == 0) {
- return defaultValue;
- }
- try {
- return Double.parseDouble(stringVal);
- } catch(NumberFormatException e) {
- throw new InvalidPropertyException(propName, stringVal, Double.class, e);
- }
- }
-
- public static boolean getBooleanProperty(Properties props, String propName, boolean defaultValue) {
- String stringVal = props.getProperty(propName);
- if(stringVal == null) {
- return defaultValue;
- }
- stringVal = stringVal.trim();
- if (stringVal.length() == 0) {
- return defaultValue;
- }
- try {
- return Boolean.valueOf(stringVal);
- } catch(NumberFormatException e) {
- throw new InvalidPropertyException(propName, stringVal, Float.class, e);
- }
- }
-
- /**
- * Read the header part of a properties file into a String.
- * @param fileName
- * @return
- * @throws IOException
- * @since 4.3
- */
- public static String loadHeader(String fileName) throws IOException {
- FileReader fr = null;
- BufferedReader br = null;
- try {
- fr = new FileReader(fileName);
- br = new BufferedReader(fr);
- String header = br.readLine();
- if (header != null && header.indexOf('#') == 0) {
- header = header.substring(1);
- }
- return header;
- } finally {
- if (br != null) {
- br.close();
- }
- if (fr != null) {
- fr.close();
- }
- }
- }
-
- public static Properties load(String fileName) throws IOException {
- InputStream is = null;
- try {
- Properties props = new Properties();
- is = new FileInputStream(fileName);
- props.load(is);
- return props;
- } finally {
- if (is != null) {
- is.close();
- }
- }
- }
-
- public static Properties loadFromURL(URL url) throws MalformedURLException, IOException {
- Properties result = new Properties();
- InputStream is = null;
- try {
- is = url.openStream();
- result.load(is);
- } finally {
- if (is != null) {
- is.close();
- }
- }
- return result;
- }
-
- public static Properties loadAsResource(Class clazz, String resourceName) throws IOException {
- InputStream is = null;
- Properties configProps = new Properties();
- try {
- is = clazz.getResourceAsStream(resourceName);
- ArgCheck.isNotNull(is);
- if (is != null) {
- configProps.load(is);
- }
- } finally {
- if (is != null) {
- try {
- is.close();
- } catch (Exception ce) {
-
- }
- }
- }
- return configProps;
- }
-
- public static Properties sort(Properties props) {
-
- List names = new ArrayList();
- Enumeration enumeration = props.propertyNames();
- while ( enumeration.hasMoreElements() ) {
- String name = (String) enumeration.nextElement();
- names.add(name);
- }
- Collections.sort(names);
-
- Properties newProps = new Properties();
- Iterator iter = names.iterator();
- while ( iter.hasNext() ) {
- String name = (String) iter.next();
- String propValue = props.getProperty(name);
- if ( propValue != null ) {
- newProps.setProperty(name, propValue);
- }
- }
- return newProps;
- }
-
-
- /**
- * Write the specified properties to the specified file,
- * with the specified header.
- * Results may not be sorted.
- * @param fileName
- * @param props
- * @param header
- * @throws IOException
- * @since 4.3
- */
- public static void print(String fileName, Properties props, String header) throws IOException {
- FileOutputStream stream = null;
- try {
- stream = new FileOutputStream(fileName);
- props.store(stream, header);
- stream.flush();
- } finally {
- try {
- if (stream != null) {
- stream.close();
- }
- } catch (Exception e) {
- }
- }
- }
-
-
-
- /**
- * Write the specified properties to the specified file,
- * with the specified header.
- * Results are sorted by property name.
- */
- public static void print( String fileName, Properties props ) throws IOException {
-
- FileOutputStream stream = null;
- PrintStream writer = null;
-
- try {
-
- stream = new FileOutputStream(fileName);
- writer = new PrintStream(stream);
-
- List names = new ArrayList();
- Enumeration enumeration = props.propertyNames();
- while ( enumeration.hasMoreElements() ) {
- String name = (String) enumeration.nextElement();
- names.add(name);
- }
- Collections.sort(names);
-
- StringBuffer sb;
-
- for (Iterator nIt=names.iterator(); nIt.hasNext(); ) {
- String name = (String) nIt.next();
-
- String value = props.getProperty(name);
-
- sb = new StringBuffer();
-
- sb.append(name);
- sb.append("="); //$NON-NLS-1$
- sb.append(value);
-
- writer.println(sb.toString());
- }
- writer.flush();
- } finally {
- try {
- if (writer != null) {
- writer.close();
- }
- } catch (Exception e){
-
- }
- try {
- if (stream != null) {
- stream.close();
- }
- } catch (Exception e){
-
- }
- }
-
-
- }
-
- public static void print( java.io.PrintStream stream, Properties props ) {
- if (props != null) {
- Collection sorted = sortPropertiesForPrinting(props);
- for (Iterator it=sorted.iterator(); it.hasNext(); ) {
- String value = (String) it.next();
- stream.println(value);
- }
- }
- }
-
- private static final String NEWLINE = "\n"; //$NON-NLS-1$
- public static String prettyPrint( Properties props ) {
- if (props != null) {
- Collection sorted = sortPropertiesForPrinting(props);
-
- StringBuffer outBuf = new StringBuffer();
-
- for (Iterator it=sorted.iterator(); it.hasNext(); ) {
- String value = (String) it.next();
- outBuf.append(value);
- outBuf.append(NEWLINE);
- }
-
- return outBuf.toString();
- }
- return ""; //$NON-NLS-1$
- }
-
- /**
- * Sorts the properties and returns a collection of entries
- * where each entry can be printed. Each entry will print in the
- * format of: Property: <code>name</code> = <code>value</code>
- */
-
- private static final String APREFIX = "Property '"; //$NON-NLS-1$
- private static final String AEQUAL = "'='"; //$NON-NLS-1$
- private static final String ASUFFIX = "'"; //$NON-NLS-1$
- private static final String TAB = "\t"; //$NON-NLS-1$
-
- public static Collection sortPropertiesForPrinting(Properties props) {
-
- Collection sortedProps = new ArrayList(props.size());
-
- List names = new ArrayList();
- Enumeration enumeration = props.propertyNames();
- while ( enumeration.hasMoreElements() ) {
- String name = (String) enumeration.nextElement();
- names.add(name);
- }
- Collections.sort(names);
-
- StringBuffer sb;
-
- for (Iterator nIt=names.iterator(); nIt.hasNext(); ) {
- String name = (String) nIt.next();
-
- String value = null;
- if (PasswordMaskUtil.doesNameEndWithPasswordSuffix(name)){
- value = PasswordMaskUtil.MASK_STRING;
- } else {
- value = props.getProperty(name);
- value= saveConvert(value, false);
- }
-
- name = saveConvert(name, true);
-
- sb = new StringBuffer(APREFIX);
-
- sb.append(name);
- sb.append(TAB);
- sb.append(AEQUAL);
- sb.append(value);
- sb.append(ASUFFIX);
-
-// sortedProps.add(APREFIX + name + TAB + AEQUAL + value + ASUFFIX);
- sortedProps.add(sb.toString());
- }
-
- return sortedProps;
-
- }
-
-// private static final String keyValueSeparators = "=: \t\r\n\f";
-
-// private static final String strictKeyValueSeparators = "=:";
-
- private static final String specialSaveChars = "=: \t\r\n\f#!"; //$NON-NLS-1$
-
-// private static final String whiteSpaceChars = " \t\r\n\f";
-
-
- /*
- * Converts unicodes to encoded \uxxxx
- * and writes out any of the characters in specialSaveChars
- * with a preceding slash
- */
- public static String saveConvert(String theString, boolean escapeSpace) {
- if ( theString == null ) {
- return ""; //$NON-NLS-1$
- }
- int len = theString.length();
- StringBuffer outBuffer = new StringBuffer(len*2);
-
- for(int x=0; x<len; x++) {
- char aChar = theString.charAt(x);
- switch(aChar) {
- case ' ':
- if (x == 0 || escapeSpace)
- outBuffer.append('\\');
-
- outBuffer.append(' ');
- break;
- case '\\':outBuffer.append('\\'); outBuffer.append('\\');
- break;
- case '\t':outBuffer.append('\\'); outBuffer.append('t');
- break;
- case '\n':outBuffer.append('\\'); outBuffer.append('n');
- break;
- case '\r':outBuffer.append('\\'); outBuffer.append('r');
- break;
- case '\f':outBuffer.append('\\'); outBuffer.append('f');
- break;
- default:
- if ((aChar < 0x0020) || (aChar > 0x007e)) {
- outBuffer.append('\\');
- outBuffer.append('u');
- outBuffer.append(toHex((aChar >> 12) & 0xF));
- outBuffer.append(toHex((aChar >> 8) & 0xF));
- outBuffer.append(toHex((aChar >> 4) & 0xF));
- outBuffer.append(toHex( aChar & 0xF));
- } else {
- if (specialSaveChars.indexOf(aChar) != -1)
- outBuffer.append('\\');
- outBuffer.append(aChar);
- }
- }
- }
- return outBuffer.toString();
- }
-
- /**
- * Convert a nibble to a hex character
- * @param nibble the nibble to convert.
- */
- private static char toHex(int nibble) {
- return hexDigit[(nibble & 0xF)];
- }
-
- /** A table of hex digits */
- private static final char[] hexDigit = {
- '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
- };
-
-
- public static final void copyProperty(Properties srcProperties, String srcPropName, Properties tgtProperties, String tgtPropName) {
- if(srcProperties == null || srcPropName == null || tgtProperties == null || tgtPropName == null) {
- return;
- }
-
- String value = srcProperties.getProperty(srcPropName);
- if(value != null) {
- tgtProperties.setProperty(tgtPropName, value);
- }
- }
-
- /**
- * The specialty of nested properties is, in a given property file
- * there can be values with pattern like "${...}"
- * <code>
- * key1=value1
- * key2=${key1}/value2
- * </code>
- * where the value of the <code>key2</code> should resolve to <code>value1/value2</code>
- * also if the property in the pattern <code>${..}</code> is not found in the loaded
- * properties, an exception is thrown. Multiple nesting is OK, however recursive nested is not supported.
- * @param original - Original properties to be resolved
- * @return resolved properties object.
- * @since 4.4
- */
- public static Properties resolveNestedProperties(Properties original) {
-
- for(Enumeration e = original.propertyNames(); e.hasMoreElements();) {
- String key = (String)e.nextElement();
- String value = original.getProperty(key);
-
- // this will take care of the if there are any non-string properties,
- // no nesting allowed on these.
- if (value == null) {
- continue;
- }
-
- boolean matched = true;
- boolean modified = false;
-
- while(matched) {
- // now match the pattern, then extract and find the value
- int start = value.indexOf("${"); //$NON-NLS-1$
- int end = start;
- if (start != -1) {
- end = value.indexOf('}', start);
- }
- matched = ((start != -1) && (end != -1));
- if (matched) {
- String nestedkey = value.substring(start+2, end);
- String nestedvalue = original.getProperty(nestedkey);
-
- // in cases where the key and the nestedkey are the same, this has to be bypassed
- // because it will cause an infinite loop, and because there will be no value
- // for the nestedkey that doesnt contain ${..} in the value
- if (key.equals(nestedkey)) {
- matched = false;
-
- } else {
-
-
- // this will handle case where we did not resolve, mark it blank
- if (nestedvalue == null) {
- throw new TeiidRuntimeException(CorePlugin.Util.getString("PropertiesUtils.failed_to_resolve_property", nestedkey)); //$NON-NLS-1$
- }
- value = value.substring(0,start)+nestedvalue+value.substring(end+1);
- modified = true;
- }
- }
- }
- if(modified) {
- original.setProperty(key, value);
- }
- }
- return original;
- }
-
- // ======================================================
- /**
- * Returns a boolean indicating whether the string matched the given pattern.
- * A '*' may be
- * given to match the pattern exactly up to the '*', then anything after.
- * We will also support a leading star, and match on anything that ends with
- * the string specified after the star.
- * Note: Should also implement matching with '?' which means match any single
- * char.
- * @param pattern The property name to match which may include a '*'.
- * @param props The properties to search.
- * @return The boolean - passed or failed
- * but never null.
- */
- public static boolean filterTest( String pattern, String sCandidate ) {
-
- // Vars for match strategy
- char chStar = '*';
-
- // Match rule booleans. Please note that 'bLeading'
- // and 'bTrailing' refer to the string we are searching for.
- // For example, if the strategy is bLeading, and the Match frag
- // is "wet", and the candidate string is "wetrust", it will pass.
- // Likewise if the strategy is bTrailing and the Match frag is
- // "rust" and the candidate string is "wetrust", it will pass.
- boolean bLeading = false;
- boolean bTrailing = false;
- boolean bFullMatch = false;
- boolean bAnywhere = false;
- boolean bAllMatch = false;
-
- boolean bPass = false;
-
- String sMatchFrag = ""; //$NON-NLS-1$
-// List propNames = new ArrayList();
-
-
- // 1. Analyze pattern to resolve match strategy
-
- // First ensure the pattern is safe to work with.
- // If the pattern is an empty string, set it to '*',
- // which means anything passes.
- pattern = pattern.trim();
- if ( pattern.length() == 0 )
- pattern = "*"; //$NON-NLS-1$
-
- int iFirstStar = pattern.indexOf( chStar );
- int iLastStar = pattern.lastIndexOf( chStar );
-
- // If there are any stars:
- if( (iFirstStar > -1) && ( iLastStar > -1 ) )
- {
- // and their positions are the same (same star, silly)
- if( iFirstStar == iLastStar )
- {
- // and this star is at the front:
- if( iFirstStar == 0 )
- {
- // and the pattern is only one byte long:
- if( pattern.length() == 1 )
- {
- // Then the pattern is a single '*',
- // and all will pass the match:
- bAllMatch = true;
- }
- else
- {
- // Or the pattern is a leading star followed
- // by a string:
- bTrailing = true;
- sMatchFrag = pattern.substring( 1 );
- }
- }
- else
- {
- // OR the star is NOT at the front, so the
- // pattern is a trailing star preceded by a string:
- bLeading = true;
- sMatchFrag = pattern.substring( 0, iLastStar );
-
- }
- }
- else
- {
- // They are not equal
- //sMatchStrategy = ANYWHERE;
- bAnywhere = true;
- sMatchFrag = pattern.substring( iFirstStar + 1, iLastStar );
- }
- }
- else
- {
- // there are no stars at all
- //sMatchStrategy = FULL_MATCH;
- bFullMatch = true;
- sMatchFrag = pattern;
- }
-
- // Now test the string
- String name = sCandidate;
- bPass = false;
-
- // force the match fragment and the test string to UPPER case
- String sMatchFragUpper = sMatchFrag.toUpperCase();
- String sNameUpper = name.toUpperCase();
-
- // Test all of the booleans. Only one should be true.
- if( bAllMatch ) {
- bPass = true;
- }
- else
- if( bAnywhere ) {
- if( sNameUpper.indexOf( sMatchFragUpper ) > -1 )
- bPass = true;
- }
- else
- if( bFullMatch ) {
- if( sNameUpper.equals( sMatchFragUpper ) )
- bPass = true;
- }
- else
- if( bLeading ) {
- if( sNameUpper.startsWith( sMatchFragUpper ) )
- bPass = true;
- }
- else
- if( bTrailing ) {
- if( sNameUpper.endsWith( sMatchFragUpper ) )
- bPass = true;
- }
-
- return bPass;
- }
-
- public static void setBeanProperties(Object bean, Properties props, String prefix) {
- // Move all prop names to lower case so we can use reflection to get
- // method names and look them up in the connection props.
- final Properties connProps = lowerCaseAllPropNames(props);
- final Method[] methods = bean.getClass().getMethods();
- for (int i = 0; i < methods.length; i++) {
- final Method method = methods[i];
- final String methodName = method.getName();
- // If setter ...
- if ( methodName.startsWith("set") && method.getParameterTypes().length == 1 ) { //$NON-NLS-1$
- // Get the property name
- final String propertyName = methodName.substring(3); // remove the "set"
- String shortName = propertyName.toLowerCase();
- String propertyValue = null;
- if (prefix != null) {
- propertyValue = connProps.getProperty(prefix + "." + shortName); //$NON-NLS-1$
- } else {
- propertyValue = connProps.getProperty(shortName);
- }
- if (propertyValue == null) {
- continue;
- }
- final Class<?> argType = method.getParameterTypes()[0];
- try {
- final Object[] params = new Object[] {StringUtil.valueOf(propertyValue, argType)};
- method.invoke(bean, params);
- } catch (Throwable e) {
- throw new InvalidPropertyException(propertyName, propertyValue, argType, e);
- }
- }
- }
- }
-
- public static void setBeanProperty(Object bean, String name, Object value) {
- if (value == null) {
- return;
- }
- name = name.toLowerCase();
- final Method[] methods = bean.getClass().getMethods();
- for (int i = 0; i < methods.length; i++) {
- final Method method = methods[i];
- final String methodName = method.getName();
- // If setter ...
- if ( methodName.startsWith("set") && method.getParameterTypes().length == 1 ) { //$NON-NLS-1$
- // Get the property name
- final String propertyName = methodName.substring(3); // remove the "set"
- String shortName = propertyName.toLowerCase();
- if (!shortName.equals(name)) {
- continue;
- }
- final Class<?> argType = method.getParameterTypes()[0];
- try {
- Object[] params = new Object[] {value};
- if (!argType.isAssignableFrom(value.getClass())) {
- params = new Object[] {StringUtil.valueOf(value.toString(), argType)};
- }
- method.invoke(bean, params);
- } catch (Throwable e) {
- throw new InvalidPropertyException(propertyName, value.toString(), argType, e);
- }
- }
- }
- }
-
- private static Properties lowerCaseAllPropNames(final Properties connectionProps) {
- final Properties lcProps = new Properties();
- final Enumeration<?> itr = connectionProps.propertyNames();
- while ( itr.hasMoreElements() ) {
- final String name = (String) itr.nextElement();
- String propValue = connectionProps.getProperty(name);
- if (propValue != null) {
- lcProps.setProperty(name.toLowerCase(), propValue);
- }
- }
- return lcProps;
- }
-
-}
Copied: tags/teiid-parent-7.5.0.Alpha1/common-core/src/main/java/org/teiid/core/util/PropertiesUtils.java (from rev 3218, trunk/common-core/src/main/java/org/teiid/core/util/PropertiesUtils.java)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/common-core/src/main/java/org/teiid/core/util/PropertiesUtils.java (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/common-core/src/main/java/org/teiid/core/util/PropertiesUtils.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,1017 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License 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.core.util;
+
+import java.io.BufferedReader;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintStream;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.teiid.core.CorePlugin;
+import org.teiid.core.TeiidRuntimeException;
+
+
+
+/**
+ * Static utility methods for common tasks having to do with
+ * java.util.Properties.
+ */
+public final class PropertiesUtils {
+
+ public static class InvalidPropertyException extends TeiidRuntimeException {
+
+ public InvalidPropertyException(String propertyName, String value, Class<?> expectedType, Throwable cause) {
+ super(cause, CorePlugin.Util.getString("InvalidPropertyException.message", propertyName, value, expectedType.getSimpleName())); //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * Returns a list of property names matching the given pattern. A '*' may be
+ * given to match the pattern exactly up to the '*', then anything after.
+ * Note: Should also implement matching with '?' which means match any single
+ * char.
+ * @param pattern The property name to match which may include a '*'.
+ * @param props The properties to search.
+ * @return The List of property names matching given pattern - may be empty
+ * but never null.
+ */
+ public static List filter( String pattern, Properties props ) {
+ boolean addAll = false;
+ String searchStr = null;
+ List propNames = new ArrayList();
+ int globIndex = pattern.indexOf('*');
+ if ( globIndex == -1 ) {
+ searchStr = pattern;
+ } else if ( globIndex == 0 ) {
+ addAll = true;
+ } else {
+ searchStr = pattern.substring(0, globIndex);
+ }
+
+ Enumeration propNameEnum = props.propertyNames();
+ while ( propNameEnum.hasMoreElements() ) {
+ String name = (String) propNameEnum.nextElement();
+ if ( name.startsWith(searchStr) || addAll ) {
+ propNames.add(name);
+ }
+ }
+
+ return propNames;
+ }
+
+
+ /**
+ * Obtains from this source the list of all properties that match the pattern specified by the filter.
+ * <p>
+ * The filter is a string that may contain the '*' character as a wildcard one or more times
+ * in the string. For example, the following filter:
+ * <p>
+ * <pre> *metamatrix.*</pre>
+ * <p>
+ * finds all properties that contain somewhere in the property name the string "metamatrix.".
+ * @param filterPattern the string filter pattern that will be used to narrow the set of properties returned.
+ * @param props The properties to search.
+ * @return the enumeration of all of the property names of the primary source;
+ * the enumeration may be empty if there is an error connecting to the property sources.
+ */
+ public static Properties getProperties(String filterPattern, Properties props) {
+ Properties results = new Properties();
+
+ boolean addAll = false;
+ String searchStr = null;
+ int globIndex = filterPattern.indexOf('*');
+ if ( globIndex == -1 ) {
+ searchStr = filterPattern;
+ } else if ( globIndex == 0 ) {
+ addAll = true;
+ } else {
+ searchStr = filterPattern.substring(0, globIndex);
+ }
+
+ Enumeration propNameEnum = props.propertyNames();
+ while ( propNameEnum.hasMoreElements() ) {
+ String name = (String) propNameEnum.nextElement();
+ if ( name.startsWith(searchStr)) {
+ Object value = props.get(name);
+ if (value != null) {
+ results.put(name.substring(searchStr.length()), value);
+ }
+ }
+ else if (addAll) {
+ results.put(name, props.get(name));
+ }
+ }
+
+ return results;
+ }
+
+
+ /**
+ * Performs a correct deep clone of the properties object by capturing
+ * all properties in the default(s) and placing them directly into the
+ * new Properties object. If the input is an instance of
+ * <code>UnmodifiableProperties</code>, this method returns an
+ * <code>UnmodifiableProperties</code> instance around a new (flattened)
+ * copy of the underlying Properties object.
+ */
+ public static Properties clone( Properties props ) {
+ return clone(props, null, false);
+ }
+
+ /**
+ * Performs a correct deep clone of the properties object by capturing
+ * all properties in the default(s) and placing them directly into the
+ * new Properties object. If the input is an instance of
+ * <code>UnmodifiableProperties</code>, this method returns an
+ * <code>UnmodifiableProperties</code> instance around a new (flattened)
+ * copy of the underlying Properties object.
+ */
+ public static Properties clone( Properties props, Properties defaults, boolean deepClone ) {
+ Properties result = null;
+ if ( defaults != null ) {
+ if ( deepClone ) {
+ defaults = clone(defaults);
+ }
+ result = new Properties(defaults);
+ } else {
+ result = new Properties();
+ }
+
+ putAll(result, props);
+
+ return result;
+ }
+
+ /**
+ * This method implements a 'compareTo' logic for two Properties objects,
+ * equivalent to calling <code>p1.compareTo(p2)</code> if the
+ * {@link java.util.Properties Properties} class implemented
+ * {@link java.lang.Comparable Comparable} (which it does not).
+ * @param p1 the first Properties instance to compare; may be null
+ * @param p2 the second Properties instance to compare; may be null
+ * @return a negative integer, zero, or a positive integer as <code>p1</code>
+ * is less than, equal to, or greater than <code>p2</code>, respectively.
+ */
+ public static int compare( Properties p1, Properties p2 ) {
+ if ( p1 != null ) {
+ if ( p2 == null ) {
+ return 1;
+ }
+ } else {
+ if ( p2 != null ) {
+ return -1;
+ }
+ return 0;
+ }
+
+
+ // Compare the number of property values ...
+ int diff = p1.size() - p2.size();
+ if ( diff != 0 ) {
+ return diff;
+ }
+
+ // Iterate through the properties and compare values ...
+ Map.Entry entry = null;
+ Object p1Value = null;
+ Object p2Value = null;
+ Iterator iter = p1.entrySet().iterator();
+ while ( iter.hasNext() ) {
+ entry = (Map.Entry) iter.next();
+ p1Value = entry.getValue();
+ p2Value = p2.get(entry.getKey());
+ if ( p1Value != null ) {
+ if ( p2Value == null ) {
+ return 1;
+ }
+ if ( p1Value instanceof Comparable ) {
+ diff = ((Comparable)p1Value).compareTo(p2Value);
+ } else {
+ diff = p1Value.toString().compareTo(p2Value.toString());
+ }
+ if ( diff != 0 ) {
+ return diff;
+ }
+ } else {
+ if ( p2Value != null ) {
+ return -1;
+ }
+ }
+ }
+ return 0;
+ }
+
+ /**
+ * <p>This method is intended to replace the use of the <code>putAll</code>
+ * method of <code>Properties</code> inherited from <code>java.util.Hashtable</code>.
+ * The problem with that method is that, since it is inherited from
+ * <code>Hashtable</code>, <i>default</i> properties are lost.
+ * </p>
+ * <p>For example, the following code
+ * <pre><code>
+ * Properties a;
+ * Properties b;
+ * //initialize ...
+ * a.putAll(b);
+ * </code></pre>
+ * will fail <i>if</i> <code>b</code> had been constructed with a default
+ * <code>Properties</code> object. Those defaults would be lost and
+ * not added to <code>a</code>.</p>
+ *
+ * <p>The above code could be correctly performed with this method,
+ * like this:
+ * <pre><code>
+ * Properties a;
+ * Properties b;
+ * //initialize ...
+ * PropertiesUtils.putAll(a,b);
+ * </code></pre>
+ * In the above example, <code>a</code> is modified - properties are added to
+ * it (note that if <code>a</code> has defaults they will remain unaffected.)
+ * The properties from <code>b</code>, <i>including defaults</i>, will be
+ * added to <code>a</code> using its <code>setProperty</code> method -
+ * these new properties will overwrite any pre-existing ones of the same
+ * name.
+ * </p>
+ *
+ * @param addToThis This Properties object is modified; the properties
+ * of the other parameter are added to this. The added property values
+ * will replace any current property values of the same names.
+ * @param withThese The properties (including defaults) of this
+ * object are added to the "addToThis" parameter.
+ */
+ public static void putAll(Properties addToThis,
+ Properties withThese) {
+ if ( withThese != null && addToThis != null ) {
+ Enumeration enumeration = withThese.propertyNames();
+ while ( enumeration.hasMoreElements() ) {
+ String propName = (String) enumeration.nextElement();
+ Object propValue = withThese.get(propName);
+ if ( propValue == null ) {
+ //defaults can only be retrieved as strings
+ propValue = withThese.getProperty(propName);
+ }
+ if ( propValue != null ) {
+ addToThis.put(propName, propValue);
+ }
+ }
+ }
+ }
+
+ public static void setOverrideProperies(Properties base, Properties override) {
+ Enumeration overrideEnum = override.propertyNames();
+ while (overrideEnum.hasMoreElements()) {
+ String key = (String)overrideEnum.nextElement();
+ String value = base.getProperty(key);
+ String overRideValue = override.getProperty(key);
+ if (value != null && !value.equals(overRideValue)) {
+ base.setProperty(key, overRideValue);
+ }
+ }
+ }
+
+ public static int getIntProperty(Properties props, String propName, int defaultValue) throws InvalidPropertyException {
+ String stringVal = props.getProperty(propName);
+ if(stringVal == null) {
+ return defaultValue;
+ }
+ stringVal = stringVal.trim();
+ if (stringVal.length() == 0) {
+ return defaultValue;
+ }
+ try {
+ return Integer.parseInt(stringVal);
+ } catch(NumberFormatException e) {
+ throw new InvalidPropertyException(propName, stringVal, Integer.class, e);
+ }
+ }
+
+ public static long getLongProperty(Properties props, String propName, long defaultValue) {
+ String stringVal = props.getProperty(propName);
+ if(stringVal == null) {
+ return defaultValue;
+ }
+ stringVal = stringVal.trim();
+ if (stringVal.length() == 0) {
+ return defaultValue;
+ }
+ try {
+ return Long.parseLong(stringVal);
+ } catch(NumberFormatException e) {
+ throw new InvalidPropertyException(propName, stringVal, Long.class, e);
+ }
+ }
+
+ public static float getFloatProperty(Properties props, String propName, float defaultValue) {
+ String stringVal = props.getProperty(propName);
+ if(stringVal == null) {
+ return defaultValue;
+ }
+ stringVal = stringVal.trim();
+ if (stringVal.length() == 0) {
+ return defaultValue;
+ }
+ try {
+ return Float.parseFloat(stringVal);
+ } catch(NumberFormatException e) {
+ throw new InvalidPropertyException(propName, stringVal, Float.class, e);
+ }
+ }
+
+ public static double getDoubleProperty(Properties props, String propName, double defaultValue) {
+ String stringVal = props.getProperty(propName);
+ if(stringVal == null) {
+ return defaultValue;
+ }
+ stringVal = stringVal.trim();
+ if (stringVal.length() == 0) {
+ return defaultValue;
+ }
+ try {
+ return Double.parseDouble(stringVal);
+ } catch(NumberFormatException e) {
+ throw new InvalidPropertyException(propName, stringVal, Double.class, e);
+ }
+ }
+
+ public static boolean getBooleanProperty(Properties props, String propName, boolean defaultValue) {
+ String stringVal = props.getProperty(propName);
+ if(stringVal == null) {
+ return defaultValue;
+ }
+ stringVal = stringVal.trim();
+ if (stringVal.length() == 0) {
+ return defaultValue;
+ }
+ try {
+ return Boolean.valueOf(stringVal);
+ } catch(NumberFormatException e) {
+ throw new InvalidPropertyException(propName, stringVal, Float.class, e);
+ }
+ }
+
+ /**
+ * Read the header part of a properties file into a String.
+ * @param fileName
+ * @return
+ * @throws IOException
+ * @since 4.3
+ */
+ public static String loadHeader(String fileName) throws IOException {
+ FileReader fr = null;
+ BufferedReader br = null;
+ try {
+ fr = new FileReader(fileName);
+ br = new BufferedReader(fr);
+ String header = br.readLine();
+ if (header != null && header.indexOf('#') == 0) {
+ header = header.substring(1);
+ }
+ return header;
+ } finally {
+ if (br != null) {
+ br.close();
+ }
+ if (fr != null) {
+ fr.close();
+ }
+ }
+ }
+
+ public static Properties load(String fileName) throws IOException {
+ InputStream is = null;
+ try {
+ Properties props = new Properties();
+ is = new FileInputStream(fileName);
+ props.load(is);
+ return props;
+ } finally {
+ if (is != null) {
+ is.close();
+ }
+ }
+ }
+
+ public static Properties loadFromURL(URL url) throws MalformedURLException, IOException {
+ Properties result = new Properties();
+ InputStream is = null;
+ try {
+ is = url.openStream();
+ result.load(is);
+ } finally {
+ if (is != null) {
+ is.close();
+ }
+ }
+ return result;
+ }
+
+ public static Properties loadAsResource(Class clazz, String resourceName) throws IOException {
+ InputStream is = null;
+ Properties configProps = new Properties();
+ try {
+ is = clazz.getResourceAsStream(resourceName);
+ ArgCheck.isNotNull(is);
+ if (is != null) {
+ configProps.load(is);
+ }
+ } finally {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (Exception ce) {
+
+ }
+ }
+ }
+ return configProps;
+ }
+
+ public static Properties sort(Properties props) {
+
+ List names = new ArrayList();
+ Enumeration enumeration = props.propertyNames();
+ while ( enumeration.hasMoreElements() ) {
+ String name = (String) enumeration.nextElement();
+ names.add(name);
+ }
+ Collections.sort(names);
+
+ Properties newProps = new Properties();
+ Iterator iter = names.iterator();
+ while ( iter.hasNext() ) {
+ String name = (String) iter.next();
+ String propValue = props.getProperty(name);
+ if ( propValue != null ) {
+ newProps.setProperty(name, propValue);
+ }
+ }
+ return newProps;
+ }
+
+
+ /**
+ * Write the specified properties to the specified file,
+ * with the specified header.
+ * Results may not be sorted.
+ * @param fileName
+ * @param props
+ * @param header
+ * @throws IOException
+ * @since 4.3
+ */
+ public static void print(String fileName, Properties props, String header) throws IOException {
+ FileOutputStream stream = null;
+ try {
+ stream = new FileOutputStream(fileName);
+ props.store(stream, header);
+ stream.flush();
+ } finally {
+ try {
+ if (stream != null) {
+ stream.close();
+ }
+ } catch (Exception e) {
+ }
+ }
+ }
+
+
+
+ /**
+ * Write the specified properties to the specified file,
+ * with the specified header.
+ * Results are sorted by property name.
+ */
+ public static void print( String fileName, Properties props ) throws IOException {
+
+ FileOutputStream stream = null;
+ PrintStream writer = null;
+
+ try {
+
+ stream = new FileOutputStream(fileName);
+ writer = new PrintStream(stream);
+
+ List names = new ArrayList();
+ Enumeration enumeration = props.propertyNames();
+ while ( enumeration.hasMoreElements() ) {
+ String name = (String) enumeration.nextElement();
+ names.add(name);
+ }
+ Collections.sort(names);
+
+ StringBuffer sb;
+
+ for (Iterator nIt=names.iterator(); nIt.hasNext(); ) {
+ String name = (String) nIt.next();
+
+ String value = props.getProperty(name);
+
+ sb = new StringBuffer();
+
+ sb.append(name);
+ sb.append("="); //$NON-NLS-1$
+ sb.append(value);
+
+ writer.println(sb.toString());
+ }
+ writer.flush();
+ } finally {
+ try {
+ if (writer != null) {
+ writer.close();
+ }
+ } catch (Exception e){
+
+ }
+ try {
+ if (stream != null) {
+ stream.close();
+ }
+ } catch (Exception e){
+
+ }
+ }
+
+
+ }
+
+ public static void print( java.io.PrintStream stream, Properties props ) {
+ if (props != null) {
+ Collection sorted = sortPropertiesForPrinting(props);
+ for (Iterator it=sorted.iterator(); it.hasNext(); ) {
+ String value = (String) it.next();
+ stream.println(value);
+ }
+ }
+ }
+
+ private static final String NEWLINE = "\n"; //$NON-NLS-1$
+ public static String prettyPrint( Properties props ) {
+ if (props != null) {
+ Collection sorted = sortPropertiesForPrinting(props);
+
+ StringBuffer outBuf = new StringBuffer();
+
+ for (Iterator it=sorted.iterator(); it.hasNext(); ) {
+ String value = (String) it.next();
+ outBuf.append(value);
+ outBuf.append(NEWLINE);
+ }
+
+ return outBuf.toString();
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ /**
+ * Sorts the properties and returns a collection of entries
+ * where each entry can be printed. Each entry will print in the
+ * format of: Property: <code>name</code> = <code>value</code>
+ */
+
+ private static final String APREFIX = "Property '"; //$NON-NLS-1$
+ private static final String AEQUAL = "'='"; //$NON-NLS-1$
+ private static final String ASUFFIX = "'"; //$NON-NLS-1$
+ private static final String TAB = "\t"; //$NON-NLS-1$
+
+ public static Collection sortPropertiesForPrinting(Properties props) {
+
+ Collection sortedProps = new ArrayList(props.size());
+
+ List names = new ArrayList();
+ Enumeration enumeration = props.propertyNames();
+ while ( enumeration.hasMoreElements() ) {
+ String name = (String) enumeration.nextElement();
+ names.add(name);
+ }
+ Collections.sort(names);
+
+ StringBuffer sb;
+
+ for (Iterator nIt=names.iterator(); nIt.hasNext(); ) {
+ String name = (String) nIt.next();
+
+ String value = null;
+ if (PasswordMaskUtil.doesNameEndWithPasswordSuffix(name)){
+ value = PasswordMaskUtil.MASK_STRING;
+ } else {
+ value = props.getProperty(name);
+ value= saveConvert(value, false);
+ }
+
+ name = saveConvert(name, true);
+
+ sb = new StringBuffer(APREFIX);
+
+ sb.append(name);
+ sb.append(TAB);
+ sb.append(AEQUAL);
+ sb.append(value);
+ sb.append(ASUFFIX);
+
+// sortedProps.add(APREFIX + name + TAB + AEQUAL + value + ASUFFIX);
+ sortedProps.add(sb.toString());
+ }
+
+ return sortedProps;
+
+ }
+
+// private static final String keyValueSeparators = "=: \t\r\n\f";
+
+// private static final String strictKeyValueSeparators = "=:";
+
+ private static final String specialSaveChars = "=: \t\r\n\f#!"; //$NON-NLS-1$
+
+// private static final String whiteSpaceChars = " \t\r\n\f";
+
+
+ /*
+ * Converts unicodes to encoded \uxxxx
+ * and writes out any of the characters in specialSaveChars
+ * with a preceding slash
+ */
+ public static String saveConvert(String theString, boolean escapeSpace) {
+ if ( theString == null ) {
+ return ""; //$NON-NLS-1$
+ }
+ int len = theString.length();
+ StringBuffer outBuffer = new StringBuffer(len*2);
+
+ for(int x=0; x<len; x++) {
+ char aChar = theString.charAt(x);
+ switch(aChar) {
+ case ' ':
+ if (x == 0 || escapeSpace)
+ outBuffer.append('\\');
+
+ outBuffer.append(' ');
+ break;
+ case '\\':outBuffer.append('\\'); outBuffer.append('\\');
+ break;
+ case '\t':outBuffer.append('\\'); outBuffer.append('t');
+ break;
+ case '\n':outBuffer.append('\\'); outBuffer.append('n');
+ break;
+ case '\r':outBuffer.append('\\'); outBuffer.append('r');
+ break;
+ case '\f':outBuffer.append('\\'); outBuffer.append('f');
+ break;
+ default:
+ if ((aChar < 0x0020) || (aChar > 0x007e)) {
+ outBuffer.append('\\');
+ outBuffer.append('u');
+ outBuffer.append(toHex((aChar >> 12) & 0xF));
+ outBuffer.append(toHex((aChar >> 8) & 0xF));
+ outBuffer.append(toHex((aChar >> 4) & 0xF));
+ outBuffer.append(toHex( aChar & 0xF));
+ } else {
+ if (specialSaveChars.indexOf(aChar) != -1)
+ outBuffer.append('\\');
+ outBuffer.append(aChar);
+ }
+ }
+ }
+ return outBuffer.toString();
+ }
+
+ /**
+ * Convert a nibble to a hex character
+ * @param nibble the nibble to convert.
+ */
+ public static char toHex(int nibble) {
+ return hexDigit[(nibble & 0xF)];
+ }
+
+ /** A table of hex digits */
+ private static final char[] hexDigit = {
+ '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
+ };
+
+
+ public static final void copyProperty(Properties srcProperties, String srcPropName, Properties tgtProperties, String tgtPropName) {
+ if(srcProperties == null || srcPropName == null || tgtProperties == null || tgtPropName == null) {
+ return;
+ }
+
+ String value = srcProperties.getProperty(srcPropName);
+ if(value != null) {
+ tgtProperties.setProperty(tgtPropName, value);
+ }
+ }
+
+ /**
+ * The specialty of nested properties is, in a given property file
+ * there can be values with pattern like "${...}"
+ * <code>
+ * key1=value1
+ * key2=${key1}/value2
+ * </code>
+ * where the value of the <code>key2</code> should resolve to <code>value1/value2</code>
+ * also if the property in the pattern <code>${..}</code> is not found in the loaded
+ * properties, an exception is thrown. Multiple nesting is OK, however recursive nested is not supported.
+ * @param original - Original properties to be resolved
+ * @return resolved properties object.
+ * @since 4.4
+ */
+ public static Properties resolveNestedProperties(Properties original) {
+
+ for(Enumeration e = original.propertyNames(); e.hasMoreElements();) {
+ String key = (String)e.nextElement();
+ String value = original.getProperty(key);
+
+ // this will take care of the if there are any non-string properties,
+ // no nesting allowed on these.
+ if (value == null) {
+ continue;
+ }
+
+ boolean matched = true;
+ boolean modified = false;
+
+ while(matched) {
+ // now match the pattern, then extract and find the value
+ int start = value.indexOf("${"); //$NON-NLS-1$
+ int end = start;
+ if (start != -1) {
+ end = value.indexOf('}', start);
+ }
+ matched = ((start != -1) && (end != -1));
+ if (matched) {
+ String nestedkey = value.substring(start+2, end);
+ String nestedvalue = original.getProperty(nestedkey);
+
+ // in cases where the key and the nestedkey are the same, this has to be bypassed
+ // because it will cause an infinite loop, and because there will be no value
+ // for the nestedkey that doesnt contain ${..} in the value
+ if (key.equals(nestedkey)) {
+ matched = false;
+
+ } else {
+
+
+ // this will handle case where we did not resolve, mark it blank
+ if (nestedvalue == null) {
+ throw new TeiidRuntimeException(CorePlugin.Util.getString("PropertiesUtils.failed_to_resolve_property", nestedkey)); //$NON-NLS-1$
+ }
+ value = value.substring(0,start)+nestedvalue+value.substring(end+1);
+ modified = true;
+ }
+ }
+ }
+ if(modified) {
+ original.setProperty(key, value);
+ }
+ }
+ return original;
+ }
+
+ // ======================================================
+ /**
+ * Returns a boolean indicating whether the string matched the given pattern.
+ * A '*' may be
+ * given to match the pattern exactly up to the '*', then anything after.
+ * We will also support a leading star, and match on anything that ends with
+ * the string specified after the star.
+ * Note: Should also implement matching with '?' which means match any single
+ * char.
+ * @param pattern The property name to match which may include a '*'.
+ * @param props The properties to search.
+ * @return The boolean - passed or failed
+ * but never null.
+ */
+ public static boolean filterTest( String pattern, String sCandidate ) {
+
+ // Vars for match strategy
+ char chStar = '*';
+
+ // Match rule booleans. Please note that 'bLeading'
+ // and 'bTrailing' refer to the string we are searching for.
+ // For example, if the strategy is bLeading, and the Match frag
+ // is "wet", and the candidate string is "wetrust", it will pass.
+ // Likewise if the strategy is bTrailing and the Match frag is
+ // "rust" and the candidate string is "wetrust", it will pass.
+ boolean bLeading = false;
+ boolean bTrailing = false;
+ boolean bFullMatch = false;
+ boolean bAnywhere = false;
+ boolean bAllMatch = false;
+
+ boolean bPass = false;
+
+ String sMatchFrag = ""; //$NON-NLS-1$
+// List propNames = new ArrayList();
+
+
+ // 1. Analyze pattern to resolve match strategy
+
+ // First ensure the pattern is safe to work with.
+ // If the pattern is an empty string, set it to '*',
+ // which means anything passes.
+ pattern = pattern.trim();
+ if ( pattern.length() == 0 )
+ pattern = "*"; //$NON-NLS-1$
+
+ int iFirstStar = pattern.indexOf( chStar );
+ int iLastStar = pattern.lastIndexOf( chStar );
+
+ // If there are any stars:
+ if( (iFirstStar > -1) && ( iLastStar > -1 ) )
+ {
+ // and their positions are the same (same star, silly)
+ if( iFirstStar == iLastStar )
+ {
+ // and this star is at the front:
+ if( iFirstStar == 0 )
+ {
+ // and the pattern is only one byte long:
+ if( pattern.length() == 1 )
+ {
+ // Then the pattern is a single '*',
+ // and all will pass the match:
+ bAllMatch = true;
+ }
+ else
+ {
+ // Or the pattern is a leading star followed
+ // by a string:
+ bTrailing = true;
+ sMatchFrag = pattern.substring( 1 );
+ }
+ }
+ else
+ {
+ // OR the star is NOT at the front, so the
+ // pattern is a trailing star preceded by a string:
+ bLeading = true;
+ sMatchFrag = pattern.substring( 0, iLastStar );
+
+ }
+ }
+ else
+ {
+ // They are not equal
+ //sMatchStrategy = ANYWHERE;
+ bAnywhere = true;
+ sMatchFrag = pattern.substring( iFirstStar + 1, iLastStar );
+ }
+ }
+ else
+ {
+ // there are no stars at all
+ //sMatchStrategy = FULL_MATCH;
+ bFullMatch = true;
+ sMatchFrag = pattern;
+ }
+
+ // Now test the string
+ String name = sCandidate;
+ bPass = false;
+
+ // force the match fragment and the test string to UPPER case
+ String sMatchFragUpper = sMatchFrag.toUpperCase();
+ String sNameUpper = name.toUpperCase();
+
+ // Test all of the booleans. Only one should be true.
+ if( bAllMatch ) {
+ bPass = true;
+ }
+ else
+ if( bAnywhere ) {
+ if( sNameUpper.indexOf( sMatchFragUpper ) > -1 )
+ bPass = true;
+ }
+ else
+ if( bFullMatch ) {
+ if( sNameUpper.equals( sMatchFragUpper ) )
+ bPass = true;
+ }
+ else
+ if( bLeading ) {
+ if( sNameUpper.startsWith( sMatchFragUpper ) )
+ bPass = true;
+ }
+ else
+ if( bTrailing ) {
+ if( sNameUpper.endsWith( sMatchFragUpper ) )
+ bPass = true;
+ }
+
+ return bPass;
+ }
+
+ public static void setBeanProperties(Object bean, Properties props, String prefix) {
+ // Move all prop names to lower case so we can use reflection to get
+ // method names and look them up in the connection props.
+ final Properties connProps = lowerCaseAllPropNames(props);
+ final Method[] methods = bean.getClass().getMethods();
+ for (int i = 0; i < methods.length; i++) {
+ final Method method = methods[i];
+ final String methodName = method.getName();
+ // If setter ...
+ if ( methodName.startsWith("set") && method.getParameterTypes().length == 1 ) { //$NON-NLS-1$
+ // Get the property name
+ final String propertyName = methodName.substring(3); // remove the "set"
+ String shortName = propertyName.toLowerCase();
+ String propertyValue = null;
+ if (prefix != null) {
+ propertyValue = connProps.getProperty(prefix + "." + shortName); //$NON-NLS-1$
+ } else {
+ propertyValue = connProps.getProperty(shortName);
+ }
+ if (propertyValue == null) {
+ continue;
+ }
+ final Class<?> argType = method.getParameterTypes()[0];
+ try {
+ final Object[] params = new Object[] {StringUtil.valueOf(propertyValue, argType)};
+ method.invoke(bean, params);
+ } catch (Throwable e) {
+ throw new InvalidPropertyException(propertyName, propertyValue, argType, e);
+ }
+ }
+ }
+ }
+
+ public static void setBeanProperty(Object bean, String name, Object value) {
+ if (value == null) {
+ return;
+ }
+ name = name.toLowerCase();
+ final Method[] methods = bean.getClass().getMethods();
+ for (int i = 0; i < methods.length; i++) {
+ final Method method = methods[i];
+ final String methodName = method.getName();
+ // If setter ...
+ if ( methodName.startsWith("set") && method.getParameterTypes().length == 1 ) { //$NON-NLS-1$
+ // Get the property name
+ final String propertyName = methodName.substring(3); // remove the "set"
+ String shortName = propertyName.toLowerCase();
+ if (!shortName.equals(name)) {
+ continue;
+ }
+ final Class<?> argType = method.getParameterTypes()[0];
+ try {
+ Object[] params = new Object[] {value};
+ if (!argType.isAssignableFrom(value.getClass())) {
+ params = new Object[] {StringUtil.valueOf(value.toString(), argType)};
+ }
+ method.invoke(bean, params);
+ } catch (Throwable e) {
+ throw new InvalidPropertyException(propertyName, value.toString(), argType, e);
+ }
+ }
+ }
+ }
+
+ private static Properties lowerCaseAllPropNames(final Properties connectionProps) {
+ final Properties lcProps = new Properties();
+ final Enumeration<?> itr = connectionProps.propertyNames();
+ while ( itr.hasMoreElements() ) {
+ final String name = (String) itr.nextElement();
+ String propValue = connectionProps.getProperty(name);
+ if (propValue != null) {
+ lcProps.setProperty(name.toLowerCase(), propValue);
+ }
+ }
+ return lcProps;
+ }
+
+}
Deleted: tags/teiid-parent-7.5.0.Alpha1/connectors/connector-file/pom.xml
===================================================================
--- trunk/connectors/connector-file/pom.xml 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/connectors/connector-file/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>connectors</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha1-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>connector-file</artifactId>
- <groupId>org.jboss.teiid.connectors</groupId>
- <name>File Connector</name>
- <packaging>rar</packaging>
- <description>This connector reads data from files.</description>
-
- <dependencies>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.resource</groupId>
- <artifactId>connector-api</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <id>build_jar</id>
- <phase>process-classes</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- <execution>
- <id>deploy_jar</id>
- <phase>package</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- <configuration>
- <classifier>lib</classifier>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.5.0.Alpha1/connectors/connector-file/pom.xml (from rev 3220, trunk/connectors/connector-file/pom.xml)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/connectors/connector-file/pom.xml (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/connectors/connector-file/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>connectors</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.5.0.Alpha1</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>connector-file</artifactId>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <name>File Connector</name>
+ <packaging>rar</packaging>
+ <description>This connector reads data from files.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build_jar</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>deploy_jar</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ <configuration>
+ <classifier>lib</classifier>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.5.0.Alpha1/connectors/connector-ldap/pom.xml
===================================================================
--- trunk/connectors/connector-ldap/pom.xml 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/connectors/connector-ldap/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,57 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>connectors</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha1-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>connector-ldap</artifactId>
- <groupId>org.jboss.teiid.connectors</groupId>
- <name>LDAP Connector</name>
- <description>LDAP Connector</description>
- <packaging>rar</packaging>
-
- <dependencies>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.resource</groupId>
- <artifactId>connector-api</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <id>build_jar</id>
- <phase>process-classes</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- <execution>
- <id>deploy_jar</id>
- <phase>package</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- <configuration>
- <classifier>lib</classifier>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.5.0.Alpha1/connectors/connector-ldap/pom.xml (from rev 3220, trunk/connectors/connector-ldap/pom.xml)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/connectors/connector-ldap/pom.xml (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/connectors/connector-ldap/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,57 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>connectors</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.5.0.Alpha1</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>connector-ldap</artifactId>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <name>LDAP Connector</name>
+ <description>LDAP Connector</description>
+ <packaging>rar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build_jar</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>deploy_jar</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ <configuration>
+ <classifier>lib</classifier>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.5.0.Alpha1/connectors/connector-salesforce/pom.xml
===================================================================
--- trunk/connectors/connector-salesforce/pom.xml 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/connectors/connector-salesforce/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,94 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>connectors</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha1-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>connector-salesforce</artifactId>
- <groupId>org.jboss.teiid.connectors</groupId>
- <name>Salesforce Connector</name>
- <packaging>rar</packaging>
- <description>Integrates the query engine with Salesforce.com.</description>
- <dependencies>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid.connectors</groupId>
- <artifactId>salesforce-api</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid.connectors</groupId>
- <artifactId>translator-salesforce</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.resource</groupId>
- <artifactId>connector-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-frontend-jaxws</artifactId>
- <version>2.2.2</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-transports-http</artifactId>
- <version>2.2.2</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-ws-security</artifactId>
- <version>2.2.2</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-ws-policy</artifactId>
- <version>2.2.2</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <id>build_jar</id>
- <phase>process-classes</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- <execution>
- <id>deploy_jar</id>
- <phase>package</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- <configuration>
- <classifier>lib</classifier>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.5.0.Alpha1/connectors/connector-salesforce/pom.xml (from rev 3220, trunk/connectors/connector-salesforce/pom.xml)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/connectors/connector-salesforce/pom.xml (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/connectors/connector-salesforce/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>connectors</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.5.0.Alpha1</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>connector-salesforce</artifactId>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <name>Salesforce Connector</name>
+ <packaging>rar</packaging>
+ <description>Integrates the query engine with Salesforce.com.</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <artifactId>salesforce-api</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <artifactId>translator-salesforce</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxws</artifactId>
+ <version>2.2.2</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-transports-http</artifactId>
+ <version>2.2.2</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-ws-security</artifactId>
+ <version>2.2.2</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-ws-policy</artifactId>
+ <version>2.2.2</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build_jar</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>deploy_jar</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ <configuration>
+ <classifier>lib</classifier>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.5.0.Alpha1/connectors/connector-ws/pom.xml
===================================================================
--- trunk/connectors/connector-ws/pom.xml 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/connectors/connector-ws/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,82 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>connectors</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha1-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>connector-ws</artifactId>
- <groupId>org.jboss.teiid.connectors</groupId>
- <name>Web Service Connector</name>
- <packaging>rar</packaging>
- <description>This connector reads data from Web Services</description>
-
- <dependencies>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.resource</groupId>
- <artifactId>connector-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-frontend-jaxws</artifactId>
- <version>2.2.2</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-transports-http</artifactId>
- <version>2.2.2</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-ws-security</artifactId>
- <version>2.2.2</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-ws-policy</artifactId>
- <version>2.2.2</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <id>build_jar</id>
- <phase>process-classes</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- <execution>
- <id>deploy_jar</id>
- <phase>package</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- <configuration>
- <classifier>lib</classifier>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
Copied: tags/teiid-parent-7.5.0.Alpha1/connectors/connector-ws/pom.xml (from rev 3220, trunk/connectors/connector-ws/pom.xml)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/connectors/connector-ws/pom.xml (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/connectors/connector-ws/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>connectors</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.5.0.Alpha1</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>connector-ws</artifactId>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <name>Web Service Connector</name>
+ <packaging>rar</packaging>
+ <description>This connector reads data from Web Services</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxws</artifactId>
+ <version>2.2.2</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-transports-http</artifactId>
+ <version>2.2.2</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-ws-security</artifactId>
+ <version>2.2.2</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-ws-policy</artifactId>
+ <version>2.2.2</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build_jar</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>deploy_jar</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ <configuration>
+ <classifier>lib</classifier>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Deleted: tags/teiid-parent-7.5.0.Alpha1/connectors/pom.xml
===================================================================
--- trunk/connectors/pom.xml 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/connectors/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,91 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>teiid-parent</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha1-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>connectors</artifactId>
- <packaging>pom</packaging>
- <name>Connectors</name>
- <description>This project is aggregator for all the supported connectors.</description>
- <dependencies>
-
- <!-- Internal Test Dependencies -->
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-api</artifactId>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-engine</artifactId>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-client</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-engine</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-metadata</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-metadata</artifactId>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
-
- <!-- External dependencies -->
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-vfs</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.man</groupId>
- <artifactId>jboss-managed</artifactId>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
- <modules>
- <module>translator-jdbc</module>
- <module>translator-ldap</module>
- <module>translator-loopback</module>
- <module>translator-file</module>
- <module>translator-salesforce</module>
- <module>connector-file</module>
- <module>connector-salesforce</module>
- <module>connector-ldap</module>
- <module>salesforce-api</module>
- <module>connector-ws</module>
- <module>sandbox</module>
- <module>translator-ws</module>
- <module>translator-olap</module>
- </modules>
-</project>
Copied: tags/teiid-parent-7.5.0.Alpha1/connectors/pom.xml (from rev 3220, trunk/connectors/pom.xml)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/connectors/pom.xml (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/connectors/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>teiid-parent</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.5.0.Alpha1</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>connectors</artifactId>
+ <packaging>pom</packaging>
+ <name>Connectors</name>
+ <description>This project is aggregator for all the supported connectors.</description>
+ <dependencies>
+
+ <!-- Internal Test Dependencies -->
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-api</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-engine</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-client</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-metadata</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-metadata</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- External dependencies -->
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-vfs</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.man</groupId>
+ <artifactId>jboss-managed</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <modules>
+ <module>translator-jdbc</module>
+ <module>translator-ldap</module>
+ <module>translator-loopback</module>
+ <module>translator-file</module>
+ <module>translator-salesforce</module>
+ <module>connector-file</module>
+ <module>connector-salesforce</module>
+ <module>connector-ldap</module>
+ <module>salesforce-api</module>
+ <module>connector-ws</module>
+ <module>sandbox</module>
+ <module>translator-ws</module>
+ <module>translator-olap</module>
+ </modules>
+</project>
Deleted: tags/teiid-parent-7.5.0.Alpha1/connectors/salesforce-api/pom.xml
===================================================================
--- trunk/connectors/salesforce-api/pom.xml 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/connectors/salesforce-api/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,14 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>connectors</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha1-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>salesforce-api</artifactId>
- <groupId>org.jboss.teiid.connectors</groupId>
- <name>Salesforce API</name>
- <description>The java API for the Salesforce.com partner web service API</description>
- <dependencies>
- </dependencies>
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.5.0.Alpha1/connectors/salesforce-api/pom.xml (from rev 3220, trunk/connectors/salesforce-api/pom.xml)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/connectors/salesforce-api/pom.xml (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/connectors/salesforce-api/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,14 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>connectors</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.5.0.Alpha1</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>salesforce-api</artifactId>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <name>Salesforce API</name>
+ <description>The java API for the Salesforce.com partner web service API</description>
+ <dependencies>
+ </dependencies>
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.5.0.Alpha1/connectors/sandbox/pom.xml
===================================================================
--- trunk/connectors/sandbox/pom.xml 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/connectors/sandbox/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>connectors</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha1-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.teiid.connectors</groupId>
- <artifactId>sandbox</artifactId>
- <packaging>pom</packaging>
- <name>Sandbox</name>
- <description>Experimental connectors in progress</description>
- <modules>
- <module>translator-yahoo</module>
- </modules>
-</project>
Copied: tags/teiid-parent-7.5.0.Alpha1/connectors/sandbox/pom.xml (from rev 3220, trunk/connectors/sandbox/pom.xml)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/connectors/sandbox/pom.xml (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/connectors/sandbox/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>connectors</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.5.0.Alpha1</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <artifactId>sandbox</artifactId>
+ <packaging>pom</packaging>
+ <name>Sandbox</name>
+ <description>Experimental connectors in progress</description>
+ <modules>
+ <module>translator-yahoo</module>
+ </modules>
+</project>
Deleted: tags/teiid-parent-7.5.0.Alpha1/connectors/sandbox/translator-yahoo/pom.xml
===================================================================
--- trunk/connectors/sandbox/translator-yahoo/pom.xml 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/connectors/sandbox/translator-yahoo/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>sandbox</artifactId>
- <groupId>org.jboss.teiid.connectors</groupId>
- <version>7.5.0.Alpha1-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>translator-yahoo</artifactId>
- <groupId>org.jboss.teiid.connectors.sandbox</groupId>
- <name>Yahoo Translator</name>
- <description>Test translator used to query ticker symbols from Yahoo website</description>
- <dependencies>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.resource</groupId>
- <artifactId>connector-api</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
- <build>
- <outputDirectory>target/classes</outputDirectory>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>true</filtering>
- <includes>
- <include>**/*.xml</include>
- <include>**/*.properties</include>
- </includes>
- </resource>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>false</filtering>
- <excludes>
- <exclude>**/*.xml</exclude>
- <exclude>**/*.properties</exclude>
- </excludes>
- </resource>
- </resources>
- </build>
-</project>
Copied: tags/teiid-parent-7.5.0.Alpha1/connectors/sandbox/translator-yahoo/pom.xml (from rev 3220, trunk/connectors/sandbox/translator-yahoo/pom.xml)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/connectors/sandbox/translator-yahoo/pom.xml (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/connectors/sandbox/translator-yahoo/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>sandbox</artifactId>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <version>7.5.0.Alpha1</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>translator-yahoo</artifactId>
+ <groupId>org.jboss.teiid.connectors.sandbox</groupId>
+ <name>Yahoo Translator</name>
+ <description>Test translator used to query ticker symbols from Yahoo website</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <outputDirectory>target/classes</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*.xml</include>
+ <include>**/*.properties</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>false</filtering>
+ <excludes>
+ <exclude>**/*.xml</exclude>
+ <exclude>**/*.properties</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ </build>
+</project>
Deleted: tags/teiid-parent-7.5.0.Alpha1/connectors/translator-file/pom.xml
===================================================================
--- trunk/connectors/translator-file/pom.xml 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/connectors/translator-file/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>connectors</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha1-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>translator-file</artifactId>
- <groupId>org.jboss.teiid.connectors</groupId>
- <name>File Translator</name>
- <description>This translator provides access to the file system.</description>
-
- <dependencies>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.resource</groupId>
- <artifactId>connector-api</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
- <build>
- <outputDirectory>target/classes</outputDirectory>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>true</filtering>
- <includes>
- <include>**/*.xml</include>
- <include>**/*.properties</include>
- </includes>
- </resource>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>false</filtering>
- <excludes>
- <exclude>**/*.xml</exclude>
- <exclude>**/*.properties</exclude>
- </excludes>
- </resource>
- </resources>
- </build>
-</project>
Copied: tags/teiid-parent-7.5.0.Alpha1/connectors/translator-file/pom.xml (from rev 3220, trunk/connectors/translator-file/pom.xml)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/connectors/translator-file/pom.xml (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/connectors/translator-file/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>connectors</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.5.0.Alpha1</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>translator-file</artifactId>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <name>File Translator</name>
+ <description>This translator provides access to the file system.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <outputDirectory>target/classes</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*.xml</include>
+ <include>**/*.properties</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>false</filtering>
+ <excludes>
+ <exclude>**/*.xml</exclude>
+ <exclude>**/*.properties</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ </build>
+</project>
Deleted: tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/pom.xml
===================================================================
--- trunk/connectors/translator-jdbc/pom.xml 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>connectors</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.5.0.Alpha1-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>translator-jdbc</artifactId>
- <groupId>org.jboss.teiid.connectors</groupId>
- <name>JDBC Translator</name>
-
- <description>This project contains translators for a JDBC source. Currently this is an aggregator for all the JDBC translators relational databases.</description>
- <dependencies>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.resource</groupId>
- <artifactId>connector-api</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
- <build>
- <outputDirectory>target/classes</outputDirectory>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>true</filtering>
- <includes>
- <include>**/*.xml</include>
- <include>**/*.properties</include>
- </includes>
- </resource>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>false</filtering>
- <excludes>
- <exclude>**/*.xml</exclude>
- <exclude>**/*.properties</exclude>
- </excludes>
- </resource>
- </resources>
- </build>
-
-</project>
Copied: tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/pom.xml (from rev 3220, trunk/connectors/translator-jdbc/pom.xml)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/pom.xml (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/pom.xml 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>connectors</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.5.0.Alpha1</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>translator-jdbc</artifactId>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <name>JDBC Translator</name>
+
+ <description>This project contains translators for a JDBC source. Currently this is an aggregator for all the JDBC translators relational databases.</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <outputDirectory>target/classes</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*.xml</include>
+ <include>**/*.properties</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>false</filtering>
+ <excludes>
+ <exclude>**/*.xml</exclude>
+ <exclude>**/*.properties</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ </build>
+
+</project>
Deleted: tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,1141 +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.translator.jdbc;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.sql.CallableStatement;
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.text.MessageFormat;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.TimeZone;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import javax.sql.DataSource;
-
-import org.teiid.core.util.PropertiesUtils;
-import org.teiid.language.Argument;
-import org.teiid.language.Call;
-import org.teiid.language.ColumnReference;
-import org.teiid.language.Command;
-import org.teiid.language.Expression;
-import org.teiid.language.Function;
-import org.teiid.language.LanguageObject;
-import org.teiid.language.Limit;
-import org.teiid.language.Literal;
-import org.teiid.language.QueryExpression;
-import org.teiid.language.SetQuery;
-import org.teiid.language.Argument.Direction;
-import org.teiid.language.SetQuery.Operation;
-import org.teiid.logging.LogConstants;
-import org.teiid.logging.LogManager;
-import org.teiid.metadata.MetadataFactory;
-import org.teiid.metadata.RuntimeMetadata;
-import org.teiid.translator.ExecutionContext;
-import org.teiid.translator.ExecutionFactory;
-import org.teiid.translator.ProcedureExecution;
-import org.teiid.translator.ResultSetExecution;
-import org.teiid.translator.SourceSystemFunctions;
-import org.teiid.translator.Translator;
-import org.teiid.translator.TranslatorException;
-import org.teiid.translator.TranslatorProperty;
-import org.teiid.translator.TypeFacility;
-import org.teiid.translator.UpdateExecution;
-
-
-/**
- * JDBC implementation of Connector interface.
- */
-@Translator(name="jdbc-ansi", description="JDBC ANSI translator, can used with any ANSI compatible JDBC Driver")
-public class JDBCExecutionFactory extends ExecutionFactory<DataSource, Connection> {
-
- public static final int DEFAULT_MAX_IN_CRITERIA = 1000;
- public static final int DEFAULT_MAX_DEPENDENT_PREDICATES = 50;
-
- // Because the retrieveValue() method will be hit for every value of
- // every JDBC result set returned, we do lots of weird special stuff here
- // to improve the performance (most importantly to remove big if/else checks
- // of every possible type.
-
- private static final Map<Class<?>, Integer> TYPE_CODE_MAP = new HashMap<Class<?>, Integer>();
-
- private static final int INTEGER_CODE = 0;
- private static final int LONG_CODE = 1;
- private static final int DOUBLE_CODE = 2;
- private static final int BIGDECIMAL_CODE = 3;
- private static final int SHORT_CODE = 4;
- private static final int FLOAT_CODE = 5;
- private static final int TIME_CODE = 6;
- private static final int DATE_CODE = 7;
- private static final int TIMESTAMP_CODE = 8;
- private static final int BLOB_CODE = 9;
- private static final int CLOB_CODE = 10;
- private static final int BOOLEAN_CODE = 11;
-
- static {
- TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.INTEGER, new Integer(INTEGER_CODE));
- TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.LONG, new Integer(LONG_CODE));
- TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.DOUBLE, new Integer(DOUBLE_CODE));
- TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.BIG_DECIMAL, new Integer(BIGDECIMAL_CODE));
- TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.SHORT, new Integer(SHORT_CODE));
- TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.FLOAT, new Integer(FLOAT_CODE));
- TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.TIME, new Integer(TIME_CODE));
- TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.DATE, new Integer(DATE_CODE));
- TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.TIMESTAMP, new Integer(TIMESTAMP_CODE));
- TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.BLOB, new Integer(BLOB_CODE));
- TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.CLOB, new Integer(CLOB_CODE));
- TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.BOOLEAN, new Integer(BOOLEAN_CODE));
- TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.BYTE, new Integer(SHORT_CODE));
- }
-
- private static final ThreadLocal<MessageFormat> COMMENT = new ThreadLocal<MessageFormat>() {
- protected MessageFormat initialValue() {
- return new MessageFormat("/*teiid sessionid:{0}, requestid:{1}.{2}*/ "); //$NON-NLS-1$
- }
- };
- public final static TimeZone DEFAULT_TIME_ZONE = TimeZone.getDefault();
-
- static class DatbaseCalender extends ThreadLocal<Calendar> {
- private String timeZone;
- public DatbaseCalender(String tz) {
- this.timeZone = tz;
- }
- @Override
- protected Calendar initialValue() {
- if(this.timeZone != null && this.timeZone.trim().length() > 0) {
- TimeZone tz = TimeZone.getTimeZone(this.timeZone);
- if(!DEFAULT_TIME_ZONE.hasSameRules(tz)) {
- return Calendar.getInstance(tz);
- }
- }
- return Calendar.getInstance();
- }
- };
-
- private Map<String, FunctionModifier> functionModifiers = new HashMap<String, FunctionModifier>();
-
- private boolean useBindVariables = true;
- private String databaseTimeZone;
- private boolean trimStrings;
- private boolean useCommentsInSourceQuery;
- private String version;
- private int maxInsertBatchSize = 2048;
- private DatbaseCalender databaseCalender;
-
- private AtomicBoolean initialConnection = new AtomicBoolean(true);
-
- public JDBCExecutionFactory() {
- setSupportsFullOuterJoins(true);
- setSupportsOrderBy(true);
- setSupportsOuterJoins(true);
- setSupportsSelectDistinct(true);
- setSupportsInnerJoins(true);
- setMaxInCriteriaSize(DEFAULT_MAX_IN_CRITERIA);
- setMaxDependentInPredicates(DEFAULT_MAX_DEPENDENT_PREDICATES);
- }
-
- @Override
- public void start() throws TranslatorException {
- super.start();
- this.databaseCalender = new DatbaseCalender(this.databaseTimeZone);
- }
-
- @TranslatorProperty(display="Database Version", description= "Database Version")
- public String getDatabaseVersion() {
- return this.version;
- }
-
- public void setDatabaseVersion(String version) {
- this.version = version;
- }
-
- @TranslatorProperty(display="Use Bind Variables", description="Use prepared statements and bind variables",advanced=true)
- public boolean useBindVariables() {
- return this.useBindVariables;
- }
-
- public void setUseBindVariables(boolean useBindVariables) {
- this.useBindVariables = useBindVariables;
- }
-
- @TranslatorProperty(display="Database time zone", description="Time zone of the database, if different than Integration Server", advanced=true)
- public String getDatabaseTimeZone() {
- return this.databaseTimeZone;
- }
-
- public void setDatabaseTimeZone(String databaseTimeZone) {
- this.databaseTimeZone = databaseTimeZone;
- }
-
- @TranslatorProperty(display="Trim string flag", description="Right Trim fixed character types returned as Strings - note that the native type must be char or nchar and the source must support the rtrim function.",advanced=true)
- public boolean isTrimStrings() {
- return this.trimStrings;
- }
-
- public void setTrimStrings(boolean trimStrings) {
- this.trimStrings = trimStrings;
- }
-
- @TranslatorProperty(display="Use informational comments in Source Queries", description="This will embed a /*comment*/ leading comment with session/request id in source SQL query for informational purposes", advanced=true)
- public boolean useCommentsInSourceQuery() {
- return this.useCommentsInSourceQuery;
- }
-
- public void setUseCommentsInSourceQuery(boolean useCommentsInSourceQuery) {
- this.useCommentsInSourceQuery = useCommentsInSourceQuery;
- }
-
- @Override
- public boolean isSourceRequired() {
- return true;
- }
-
- @Override
- public ResultSetExecution createResultSetExecution(QueryExpression command, ExecutionContext executionContext, RuntimeMetadata metadata, Connection conn)
- throws TranslatorException {
- //TODO: This is not correct; this should be only called once for connection creation
- obtainedConnection(conn);
- return new JDBCQueryExecution(command, conn, executionContext, this);
- }
-
- @Override
- public ProcedureExecution createProcedureExecution(Call command, ExecutionContext executionContext, RuntimeMetadata metadata, Connection conn)
- throws TranslatorException {
- //TODO: This is not correct; this should be only called once for connection creation
- obtainedConnection(conn);
- return new JDBCProcedureExecution(command, conn, executionContext, this);
- }
-
- @Override
- public UpdateExecution createUpdateExecution(Command command, ExecutionContext executionContext, RuntimeMetadata metadata, Connection conn)
- throws TranslatorException {
- //TODO: This is not correct; this should be only called once for connection creation
- obtainedConnection(conn);
- return new JDBCUpdateExecution(command, conn, executionContext, this);
- }
-
- @Override
- public Connection getConnection(DataSource ds)
- throws TranslatorException {
- try {
- return ds.getConnection();
- } catch (SQLException e) {
- throw new TranslatorException(e);
- }
- }
-
- @Override
- public void closeConnection(Connection connection, DataSource factory) {
- if (connection == null) {
- return;
- }
- try {
- connection.close();
- } catch (SQLException e) {
- LogManager.logDetail(LogConstants.CTX_CONNECTOR, e, "Error closing"); //$NON-NLS-1$
- }
- }
-
- @Override
- public void getMetadata(MetadataFactory metadataFactory, Connection conn) throws TranslatorException {
- try {
- JDBCMetdataProcessor metadataProcessor = new JDBCMetdataProcessor();
- PropertiesUtils.setBeanProperties(metadataProcessor, metadataFactory.getImportProperties(), "importer"); //$NON-NLS-1$
- metadataProcessor.getConnectorMetadata(conn, metadataFactory);
- } catch (SQLException e) {
- throw new TranslatorException(e);
- }
- }
-
- @Override
- public List<String> getSupportedFunctions() {
- return getDefaultSupportedFunctions();
- }
-
- public List<String> getDefaultSupportedFunctions(){
- return Arrays.asList(new String[] { "+", "-", "*", "/" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
-
- @Override
- public boolean supportsGroupBy() {
- return true;
- }
-
- @Override
- public boolean supportsAggregatesAvg() {
- return true;
- }
-
- @Override
- public boolean supportsAggregatesCount() {
- return true;
- }
-
- @Override
- public boolean supportsAggregatesCountStar() {
- return true;
- }
-
- @Override
- public boolean supportsAggregatesDistinct() {
- return true;
- }
-
- @Override
- public boolean supportsAggregatesMax() {
- return true;
- }
-
- @Override
- public boolean supportsAggregatesMin() {
- return true;
- }
-
- @Override
- public boolean supportsAggregatesSum() {
- return true;
- }
-
- @Override
- public boolean supportsAliasedTable() {
- return true;
- }
-
- @Override
- public boolean supportsBetweenCriteria() {
- return true;
- }
-
- @Override
- public boolean supportsCaseExpressions() {
- return true;
- }
-
- @Override
- public boolean supportsCompareCriteriaEquals() {
- return true;
- }
-
- @Override
- public boolean supportsCorrelatedSubqueries() {
- return true;
- }
-
- @Override
- public boolean supportsExistsCriteria() {
- return true;
- }
-
- @Override
- public boolean supportsInCriteria() {
- return true;
- }
-
- @Override
- public boolean supportsInCriteriaSubquery() {
- return true;
- }
-
- @Override
- public boolean supportsIsNullCriteria() {
- return true;
- }
-
- @Override
- public boolean supportsLikeCriteria() {
- return true;
- }
-
- @Override
- public boolean supportsLikeCriteriaEscapeCharacter() {
- return true;
- }
-
- @Override
- public boolean supportsNotCriteria() {
- return true;
- }
-
- @Override
- public boolean supportsOrCriteria() {
- return true;
- }
-
- @Override
- public boolean supportsOrderByUnrelated() {
- return true;
- }
-
- @Override
- public boolean supportsQuantifiedCompareCriteriaAll() {
- return true;
- }
-
- @Override
- public boolean supportsScalarSubqueries() {
- return true;
- }
-
- @Override
- public boolean supportsSearchedCaseExpressions() {
- return true;
- }
-
- @Override
- public boolean supportsSelfJoins() {
- return true;
- }
-
- @Override
- public boolean supportsInlineViews() {
- return false;
- }
-
- @Override
- public boolean supportsQuantifiedCompareCriteriaSome() {
- return true;
- }
-
- @Override
- public boolean supportsSetQueryOrderBy() {
- return true;
- }
-
- @Override
- public boolean supportsUnions() {
- return true;
- }
-
- @Override
- public boolean supportsBulkUpdate() {
- return true;
- }
-
- @Override
- public boolean supportsInsertWithIterator() {
- return super.supportsBulkUpdate();
- }
-
- @Override
- public boolean supportsBatchedUpdates() {
- return true;
- }
-
- @Override
- public boolean supportsCompareCriteriaOrdered() {
- return true;
- }
-
- @Override
- public boolean supportsHaving() {
- return true;
- }
-
- @Override
- public boolean supportsSelectExpression() {
- return true;
- }
-
- @Override
- public boolean supportsInsertWithQueryExpression() {
- return true;
- }
-
- /**
- * Get the max number of inserts to perform in one batch.
- * @return
- */
- @TranslatorProperty(display="Max Prepared Insert Batch Size", description="The max size of a prepared insert batch. Default 2048.", advanced=true)
- public int getMaxPreparedInsertBatchSize() {
- return maxInsertBatchSize;
- }
-
- public void setMaxPreparedInsertBatchSize(int maxInsertBatchSize) {
- if (maxInsertBatchSize < 1) {
- throw new AssertionError("Max prepared batch insert size must be greater than 0"); //$NON-NLS-1$
- }
- this.maxInsertBatchSize = maxInsertBatchSize;
- }
-
- /**
- * Gets the database calendar. This will be set to the time zone
- * specified by the property {@link JDBCPropertyNames#DATABASE_TIME_ZONE}, or
- * the local time zone if none is specified.
- * @return the database calendar
- */
- public Calendar getDatabaseCalendar() {
- return this.databaseCalender.get();
- }
-
- /**
- * Return a List of translated parts ({@link LanguageObject}s and Objects), or null
- * if to rely on the default translation. Override with care.
- * @param command
- * @param context
- * @return list of translated parts
- */
- public List<?> translate(LanguageObject obj, ExecutionContext context) {
- List<?> parts = null;
- if (obj instanceof Function) {
- Function function = (Function)obj;
- if (functionModifiers != null) {
- FunctionModifier modifier = functionModifiers.get(function.getName().toLowerCase());
- if (modifier != null) {
- parts = modifier.translate(function);
- }
- }
- } else if (obj instanceof Command) {
- parts = translateCommand((Command)obj, context);
- } else if (obj instanceof Limit) {
- parts = translateLimit((Limit)obj, context);
- } else if (obj instanceof ColumnReference) {
- ColumnReference elem = (ColumnReference)obj;
- if (isTrimStrings() && elem.getType() == TypeFacility.RUNTIME_TYPES.STRING && elem.getMetadataObject() != null
- && ("char".equalsIgnoreCase(elem.getMetadataObject().getNativeType()) || "nchar".equalsIgnoreCase(elem.getMetadataObject().getNativeType()))) { //$NON-NLS-1$ //$NON-NLS-2$
- return Arrays.asList(getLanguageFactory().createFunction(SourceSystemFunctions.RTRIM, new Expression[] {elem}, TypeFacility.RUNTIME_TYPES.STRING));
- }
- }
- return parts;
- }
-
- /**
- * Return a List of translated parts ({@link LanguageObject}s and Objects), or null
- * if to rely on the default translation.
- * @param command
- * @param context
- * @return a list of translated parts
- */
- public List<?> translateCommand(Command command, ExecutionContext context) {
- return null;
- }
-
- /**
- * Return a List of translated parts ({@link LanguageObject}s and Objects), or null
- * if to rely on the default translation.
- * @param limit
- * @param context
- * @return a list of translated parts
- */
- public List<?> translateLimit(Limit limit, ExecutionContext context) {
- return null;
- }
-
- /**
- * Return a map of function name in lower case to FunctionModifier.
- * @return Map of function name to FunctionModifier.
- */
- public Map<String, FunctionModifier> getFunctionModifiers() {
- return functionModifiers;
- }
-
- /**
- * Add the {@link FunctionModifier} to the set of known modifiers.
- * @param name
- * @param modifier
- */
- public void registerFunctionModifier(String name, FunctionModifier modifier) {
- this.functionModifiers.put(name.toLowerCase(), modifier);
- }
-
- /**
- * Subclasses should override this method to provide a different sql translation
- * of the literal boolean value. By default, a boolean literal is represented as:
- * <code>'0'</code> or <code>'1'</code>.
- * @param booleanValue Boolean value, never null
- * @return Translated string
- */
- public String translateLiteralBoolean(Boolean booleanValue) {
- if(booleanValue.booleanValue()) {
- return "1"; //$NON-NLS-1$
- }
- return "0"; //$NON-NLS-1$
- }
-
- /**
- * Subclasses should override this method to provide a different sql translation
- * of the literal date value. By default, a date literal is represented as:
- * <code>{d '2002-12-31'}</code>
- * @param dateValue Date value, never null
- * @return Translated string
- */
- public String translateLiteralDate(java.sql.Date dateValue) {
- return "{d '" + formatDateValue(dateValue) + "'}"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Subclasses should override this method to provide a different sql translation
- * of the literal time value. By default, a time literal is represented as:
- * <code>{t '23:59:59'}</code>
- *
- * See {@link JDBCExecutionFactory#hasTimeType()} to represent literal times as timestamps.
- *
- * @param timeValue Time value, never null
- * @return Translated string
- */
- public String translateLiteralTime(Time timeValue) {
- if (!hasTimeType()) {
- return translateLiteralTimestamp(new Timestamp(timeValue.getTime()));
- }
- return "{t '" + formatDateValue(timeValue) + "'}"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Subclasses should override this method to provide a different sql translation
- * of the literal timestamp value. By default, a timestamp literal is
- * represented as: <code>{ts '2002-12-31 23:59:59'}</code>.
- *
- * See {@link JDBCExecutionFactory#getTimestampNanoPrecision()} to control the literal
- * precision.
- *
- * @param timestampValue Timestamp value, never null
- * @return Translated string
- */
- public String translateLiteralTimestamp(Timestamp timestampValue) {
- return "{ts '" + formatDateValue(timestampValue) + "'}"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Format the dateObject (of type date, time, or timestamp) into a string
- * using the DatabaseTimeZone format.
- * @param dateObject
- * @return Formatted string
- */
- public String formatDateValue(java.util.Date dateObject) {
- if (dateObject instanceof Timestamp && getTimestampNanoPrecision() < 9) {
- Timestamp ts = (Timestamp)dateObject;
- Timestamp newTs = new Timestamp(ts.getTime());
- if (getTimestampNanoPrecision() > 0) {
- int mask = (int)Math.pow(10, 9-getTimestampNanoPrecision());
- newTs.setNanos(ts.getNanos()/mask*mask);
- } else {
- newTs.setNanos(0);
- }
- dateObject = newTs;
- }
- return getTypeFacility().convertDate(dateObject, DEFAULT_TIME_ZONE, getDatabaseCalendar(), dateObject.getClass()).toString();
- }
-
- /**
- * Returns true to indicate that SQL should include a comment
- * indicating the session and request ids.
- */
- public boolean addSourceComment() {
- return useCommentsInSourceQuery();
- }
-
- /**
- * Indicates whether group alias should be of the form
- * "...FROM groupA AS X" or "...FROM groupA X". Certain
- * data sources (such as Oracle) may not support the first
- * form.
- * @return boolean
- */
- public boolean useAsInGroupAlias(){
- return true;
- }
-
- /**
- * Use PreparedStatements (or CallableStatements) as
- * appropriate for all commands. Bind values will be
- * determined by the {@link BindValueVisitor}. {@link Literal#setBindValue(boolean)}
- * can be used to force a literal to be a bind value.
- */
- public boolean usePreparedStatements() {
- return useBindVariables();
- }
-
- /**
- * Set to true to indicate that every branch of a set query
- * should have parenthesis, i.e. (query) union (query)
- * @return true if parenthesis should be used for each set branch
- */
- public boolean useParensForSetQueries() {
- return false;
- }
-
- /**
- * Return false to indicate that time support should be emulated
- * with timestamps.
- * @return true if database has a time type
- */
- public boolean hasTimeType() {
- return true;
- }
-
- /**
- * Returns the name for a given {@link Operation}
- * @param operation
- * @return the name for the set operation
- */
- public String getSetOperationString(SetQuery.Operation operation) {
- return operation.toString();
- }
-
- /**
- * Returns the source comment for the given command
- * @param context
- * @param command
- * @return the comment
- */
- public String getSourceComment(ExecutionContext context, Command command) {
- if (addSourceComment() && context != null) {
- return COMMENT.get().format(new Object[] {context.getConnectionIdentifier(), context.getRequestIdentifier(), context.getPartIdentifier()});
- }
- return ""; //$NON-NLS-1$
- }
-
- /**
- * Override to return a name other than the default [group.]element
- * @param group
- * @param element
- * @return thre replacement name
- */
- public String replaceElementName(String group, String element) {
- return null;
- }
-
- /**
- * Return the precision of timestamp literals. Defaults to 9.
- * @return digits of timestamp nano precision.
- */
- public int getTimestampNanoPrecision() {
- return 9;
- }
-
- /**
- * This is a generic implementation. Because different databases handle
- * stored procedures differently, subclasses should override this method
- * if necessary.
- */
- public ResultSet executeStoredProcedure(CallableStatement statement, TranslatedCommand command, Class<?> returnType) throws SQLException {
- List params = command.getPreparedValues();
- int index = 1;
-
- if(returnType != null){
- registerSpecificTypeOfOutParameter(statement, returnType, index++);
- }
-
- Iterator iter = params.iterator();
- while(iter.hasNext()){
- Argument param = (Argument)iter.next();
-
- if(param.getDirection() == Direction.INOUT){
- registerSpecificTypeOfOutParameter(statement,param.getType(), index);
- }else if(param.getDirection() == Direction.OUT){
- registerSpecificTypeOfOutParameter(statement,param.getType(), index++);
- }
-
- if(param.getDirection() == Direction.IN || param.getDirection() == Direction.INOUT){
- bindValue(statement, param.getArgumentValue().getValue(), param.getType(), index++);
- }
- }
- boolean resultSetNext = statement.execute();
-
- while (!resultSetNext) {
- int update_count = statement.getUpdateCount();
- if (update_count == -1) {
- break;
- }
- resultSetNext = statement.getMoreResults();
- }
- return statement.getResultSet();
- }
-
- /**
- * For registering specific output parameter types we need to translate these into the appropriate
- * java.sql.Types output parameters
- * We will need to match these up with the appropriate standard sql types
- * @param cstmt
- * @param parameter
- * @throws SQLException
- */
- protected void registerSpecificTypeOfOutParameter(CallableStatement statement, Class<?> runtimeType, int index) throws SQLException {
- int typeToSet = TypeFacility.getSQLTypeFromRuntimeType(runtimeType);
-
- statement.registerOutParameter(index,typeToSet);
- }
-
- /**
- * Sets prepared statement parameter i with param.
- *
- * Performs special handling to translate dates using the database time zone and to
- * translate biginteger, float, and char to JDBC safe objects.
- *
- * @param stmt
- * @param param
- * @param paramType
- * @param i
- * @param cal
- * @throws SQLException
- */
- public void bindValue(PreparedStatement stmt, Object param, Class<?> paramType, int i) throws SQLException {
- int type = TypeFacility.getSQLTypeFromRuntimeType(paramType);
-
- if (param == null) {
- stmt.setNull(i, type);
- return;
- }
- //if this is a Date object, then use the database calendar
- if (paramType.equals(TypeFacility.RUNTIME_TYPES.DATE)) {
- stmt.setDate(i,(java.sql.Date)param, getDatabaseCalendar());
- return;
- }
- if (paramType.equals(TypeFacility.RUNTIME_TYPES.TIME)) {
- stmt.setTime(i,(java.sql.Time)param, getDatabaseCalendar());
- return;
- }
- if (paramType.equals(TypeFacility.RUNTIME_TYPES.TIMESTAMP)) {
- stmt.setTimestamp(i,(java.sql.Timestamp)param, getDatabaseCalendar());
- return;
- }
- //not all drivers handle the setObject call with BigDecimal correctly (namely jConnect 6.05)
- if (TypeFacility.RUNTIME_TYPES.BIG_DECIMAL.equals(paramType)) {
- stmt.setBigDecimal(i, (BigDecimal)param);
- return;
- }
- //convert these the following to jdbc safe values
- if (TypeFacility.RUNTIME_TYPES.BIG_INTEGER.equals(paramType)) {
- param = new BigDecimal((BigInteger)param);
- } else if (TypeFacility.RUNTIME_TYPES.FLOAT.equals(paramType)) {
- param = new Double(((Float)param).doubleValue());
- } else if (TypeFacility.RUNTIME_TYPES.CHAR.equals(paramType)) {
- param = ((Character)param).toString();
- }
-
- stmt.setObject(i, param, type);
- }
-
- /**
- * Retrieve the value on the current resultset row for the given column index.
- * @param results
- * @param columnIndex
- * @param expectedType
- * @return the value
- * @throws SQLException
- */
- public Object retrieveValue(ResultSet results, int columnIndex, Class<?> expectedType) throws SQLException {
- Integer code = TYPE_CODE_MAP.get(expectedType);
- if(code != null) {
- // Calling the specific methods here is more likely to get uniform (and fast) results from different
- // data sources as the driver likely knows the best and fastest way to convert from the underlying
- // raw form of the data to the expected type. We use a switch with codes in order without gaps
- // as there is a special bytecode instruction that treats this case as a map such that not every value
- // needs to be tested, which means it is very fast.
- switch(code.intValue()) {
- case INTEGER_CODE: {
- int value = results.getInt(columnIndex);
- if(results.wasNull()) {
- return null;
- }
- return Integer.valueOf(value);
- }
- case LONG_CODE: {
- long value = results.getLong(columnIndex);
- if(results.wasNull()) {
- return null;
- }
- return Long.valueOf(value);
- }
- case DOUBLE_CODE: {
- double value = results.getDouble(columnIndex);
- if(results.wasNull()) {
- return null;
- }
- return Double.valueOf(value);
- }
- case BIGDECIMAL_CODE: {
- return results.getBigDecimal(columnIndex);
- }
- case SHORT_CODE: {
- short value = results.getShort(columnIndex);
- if(results.wasNull()) {
- return null;
- }
- return Short.valueOf(value);
- }
- case FLOAT_CODE: {
- float value = results.getFloat(columnIndex);
- if(results.wasNull()) {
- return null;
- }
- return Float.valueOf(value);
- }
- case TIME_CODE: {
- return results.getTime(columnIndex, getDatabaseCalendar());
- }
- case DATE_CODE: {
- return results.getDate(columnIndex, getDatabaseCalendar());
- }
- case TIMESTAMP_CODE: {
- return results.getTimestamp(columnIndex, getDatabaseCalendar());
- }
- case BLOB_CODE: {
- try {
- return results.getBlob(columnIndex);
- } catch (SQLException e) {
- // ignore
- }
- try {
- return results.getBytes(columnIndex);
- } catch (SQLException e) {
- // ignore
- }
- break;
- }
- case CLOB_CODE: {
- try {
- return results.getClob(columnIndex);
- } catch (SQLException e) {
- // ignore
- }
- break;
- }
- case BOOLEAN_CODE: {
- return results.getBoolean(columnIndex);
- }
- }
- }
-
- return results.getObject(columnIndex);
- }
-
- /**
- * Retrieve the value for the given parameter index
- * @param results
- * @param parameterIndex
- * @param expectedType
- * @return the value
- * @throws SQLException
- */
- public Object retrieveValue(CallableStatement results, int parameterIndex, Class<?> expectedType) throws SQLException{
- Integer code = TYPE_CODE_MAP.get(expectedType);
- if(code != null) {
- switch(code.intValue()) {
- case INTEGER_CODE: {
- int value = results.getInt(parameterIndex);
- if(results.wasNull()) {
- return null;
- }
- return Integer.valueOf(value);
- }
- case LONG_CODE: {
- long value = results.getLong(parameterIndex);
- if(results.wasNull()) {
- return null;
- }
- return Long.valueOf(value);
- }
- case DOUBLE_CODE: {
- double value = results.getDouble(parameterIndex);
- if(results.wasNull()) {
- return null;
- }
- return new Double(value);
- }
- case BIGDECIMAL_CODE: {
- return results.getBigDecimal(parameterIndex);
- }
- case SHORT_CODE: {
- short value = results.getShort(parameterIndex);
- if(results.wasNull()) {
- return null;
- }
- return Short.valueOf(value);
- }
- case FLOAT_CODE: {
- float value = results.getFloat(parameterIndex);
- if(results.wasNull()) {
- return null;
- }
- return new Float(value);
- }
- case TIME_CODE: {
- return results.getTime(parameterIndex, getDatabaseCalendar());
- }
- case DATE_CODE: {
- return results.getDate(parameterIndex, getDatabaseCalendar());
- }
- case TIMESTAMP_CODE: {
- return results.getTimestamp(parameterIndex, getDatabaseCalendar());
- }
- case BLOB_CODE: {
- try {
- return results.getBlob(parameterIndex);
- } catch (SQLException e) {
- // ignore
- }
- try {
- return results.getBytes(parameterIndex);
- } catch (SQLException e) {
- // ignore
- }
- }
- case CLOB_CODE: {
- try {
- return results.getClob(parameterIndex);
- } catch (SQLException e) {
- // ignore
- }
- }
- case BOOLEAN_CODE: {
- return results.getBoolean(parameterIndex);
- }
- }
- }
-
- // otherwise fall through and call getObject() and rely on the normal
- // translation routines
- return results.getObject(parameterIndex);
- }
-
- /**
- * Called exactly once for this source.
- * @param connection
- */
- protected void afterInitialConnectionObtained(Connection connection) {
- // now dig some details about this driver/database for log.
- try {
- StringBuffer sb = new StringBuffer(getClass().getSimpleName());
- DatabaseMetaData dbmd = connection.getMetaData();
- sb.append(" Commit=").append(connection.getAutoCommit()); //$NON-NLS-1$
- sb.append(";DatabaseProductName=").append(dbmd.getDatabaseProductName()); //$NON-NLS-1$
- sb.append(";DatabaseProductVersion=").append(dbmd.getDatabaseProductVersion()); //$NON-NLS-1$
- sb.append(";DriverMajorVersion=").append(dbmd.getDriverMajorVersion()); //$NON-NLS-1$
- sb.append(";DriverMajorVersion=").append(dbmd.getDriverMinorVersion()); //$NON-NLS-1$
- sb.append(";DriverName=").append(dbmd.getDriverName()); //$NON-NLS-1$
- sb.append(";DriverVersion=").append(dbmd.getDriverVersion()); //$NON-NLS-1$
- sb.append(";IsolationLevel=").append(dbmd.getDefaultTransactionIsolation()); //$NON-NLS-1$
-
- LogManager.logInfo(LogConstants.CTX_CONNECTOR, sb.toString());
- } catch (SQLException e) {
- String errorStr = JDBCPlugin.Util.getString("ConnectionListener.failed_to_report_jdbc_connection_details"); //$NON-NLS-1$
- LogManager.logInfo(LogConstants.CTX_CONNECTOR, errorStr);
- }
- }
-
- /**
- * Provides a hook to call source specific logic when
- * a connection is obtained.
- *
- * defect request 13979 & 13978
- */
- public void obtainedConnection(Connection connection) {
- if (initialConnection.compareAndSet(true, false)) {
- afterInitialConnectionObtained(connection);
- }
- }
-
-
-
- /**
- * Create the {@link SQLConversionVisitor} that will perform translation. Typical custom
- * JDBC connectors will not need to create custom conversion visitors, rather implementors
- * should override existing {@link JDBCExecutionFactory} methods.
- * @return the {@link SQLConversionVisitor}
- */
- public SQLConversionVisitor getSQLConversionVisitor() {
- return new SQLConversionVisitor(this);
- }
-
- /**
- * Set to true to indicate that every branch of a join
- * should have parenthesis.
- * @return true if every branch of a join should use parenthesis
- */
- public boolean useParensForJoins() {
- return false;
- }
-
- @Override
- public NullOrder getDefaultNullOrder() {
- return NullOrder.LOW;
- }
-
- /**
- * Returns whether the limit clause is applied to the select clause.
- * @return true if the limit clause is part of the select
- */
- public boolean useSelectLimit() {
- return false;
- }
-
- public static List<String> parseName(String tableName, char escape, char delim) {
- boolean quoted = false;
- boolean escaped = false;
- List<String> nameParts = new LinkedList<String>();
- StringBuilder current = new StringBuilder();
- for (int i = 0; i < tableName.length(); i++) {
- char c = tableName.charAt(i);
- if (quoted) {
- if (c == escape) {
- if (escaped) {
- current.append(c);
- }
- escaped = !escaped;
- } else if (c == delim) {
- if (escaped) {
- escaped = false;
- quoted = false;
- nameParts.add(current.toString());
- current = new StringBuilder();
- } else {
- current.append(c);
- }
- } else {
- current.append(c);
- }
- } else {
- if (c == escape) {
- if (current.length() == 0) {
- quoted = true;
- } else {
- current.append(c);
- }
- } else if (c == delim) {
- quoted = false;
- nameParts.add(current.toString());
- current = new StringBuilder();
- } else {
- current.append(c);
- }
- }
- }
- if (current.length() > 0) {
- nameParts.add(current.toString());
- }
- return nameParts;
- }
-
-}
Copied: tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java (from rev 3218, trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java)
===================================================================
--- tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java (rev 0)
+++ tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -0,0 +1,1151 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License 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.translator.jdbc;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.sql.CallableStatement;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.text.MessageFormat;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.TimeZone;
+import java.util.TreeMap;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import javax.sql.DataSource;
+
+import org.teiid.core.util.PropertiesUtils;
+import org.teiid.language.Argument;
+import org.teiid.language.Call;
+import org.teiid.language.ColumnReference;
+import org.teiid.language.Command;
+import org.teiid.language.Expression;
+import org.teiid.language.Function;
+import org.teiid.language.LanguageObject;
+import org.teiid.language.Limit;
+import org.teiid.language.Literal;
+import org.teiid.language.QueryExpression;
+import org.teiid.language.SetQuery;
+import org.teiid.language.Argument.Direction;
+import org.teiid.language.SetQuery.Operation;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.metadata.MetadataFactory;
+import org.teiid.metadata.RuntimeMetadata;
+import org.teiid.translator.ExecutionContext;
+import org.teiid.translator.ExecutionFactory;
+import org.teiid.translator.ProcedureExecution;
+import org.teiid.translator.ResultSetExecution;
+import org.teiid.translator.SourceSystemFunctions;
+import org.teiid.translator.Translator;
+import org.teiid.translator.TranslatorException;
+import org.teiid.translator.TranslatorProperty;
+import org.teiid.translator.TypeFacility;
+import org.teiid.translator.UpdateExecution;
+
+
+/**
+ * JDBC implementation of Connector interface.
+ */
+@Translator(name="jdbc-ansi", description="JDBC ANSI translator, can used with any ANSI compatible JDBC Driver")
+public class JDBCExecutionFactory extends ExecutionFactory<DataSource, Connection> {
+
+ public static final int DEFAULT_MAX_IN_CRITERIA = 1000;
+ public static final int DEFAULT_MAX_DEPENDENT_PREDICATES = 50;
+
+ // Because the retrieveValue() method will be hit for every value of
+ // every JDBC result set returned, we do lots of weird special stuff here
+ // to improve the performance (most importantly to remove big if/else checks
+ // of every possible type.
+
+ private static final Map<Class<?>, Integer> TYPE_CODE_MAP = new HashMap<Class<?>, Integer>();
+
+ private static final int INTEGER_CODE = 0;
+ private static final int LONG_CODE = 1;
+ private static final int DOUBLE_CODE = 2;
+ private static final int BIGDECIMAL_CODE = 3;
+ private static final int SHORT_CODE = 4;
+ private static final int FLOAT_CODE = 5;
+ private static final int TIME_CODE = 6;
+ private static final int DATE_CODE = 7;
+ private static final int TIMESTAMP_CODE = 8;
+ private static final int BLOB_CODE = 9;
+ private static final int CLOB_CODE = 10;
+ private static final int BOOLEAN_CODE = 11;
+
+ static {
+ TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.INTEGER, new Integer(INTEGER_CODE));
+ TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.LONG, new Integer(LONG_CODE));
+ TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.DOUBLE, new Integer(DOUBLE_CODE));
+ TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.BIG_DECIMAL, new Integer(BIGDECIMAL_CODE));
+ TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.SHORT, new Integer(SHORT_CODE));
+ TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.FLOAT, new Integer(FLOAT_CODE));
+ TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.TIME, new Integer(TIME_CODE));
+ TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.DATE, new Integer(DATE_CODE));
+ TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.TIMESTAMP, new Integer(TIMESTAMP_CODE));
+ TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.BLOB, new Integer(BLOB_CODE));
+ TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.CLOB, new Integer(CLOB_CODE));
+ TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.BOOLEAN, new Integer(BOOLEAN_CODE));
+ TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.BYTE, new Integer(SHORT_CODE));
+ }
+
+ private static final ThreadLocal<MessageFormat> COMMENT = new ThreadLocal<MessageFormat>() {
+ protected MessageFormat initialValue() {
+ return new MessageFormat("/*teiid sessionid:{0}, requestid:{1}.{2}*/ "); //$NON-NLS-1$
+ }
+ };
+ public final static TimeZone DEFAULT_TIME_ZONE = TimeZone.getDefault();
+
+ static class DatbaseCalender extends ThreadLocal<Calendar> {
+ private String timeZone;
+ public DatbaseCalender(String tz) {
+ this.timeZone = tz;
+ }
+ @Override
+ protected Calendar initialValue() {
+ if(this.timeZone != null && this.timeZone.trim().length() > 0) {
+ TimeZone tz = TimeZone.getTimeZone(this.timeZone);
+ if(!DEFAULT_TIME_ZONE.hasSameRules(tz)) {
+ return Calendar.getInstance(tz);
+ }
+ }
+ return Calendar.getInstance();
+ }
+ };
+
+ private Map<String, FunctionModifier> functionModifiers = new TreeMap<String, FunctionModifier>(String.CASE_INSENSITIVE_ORDER);
+
+ private boolean useBindVariables = true;
+ private String databaseTimeZone;
+ private boolean trimStrings;
+ private boolean useCommentsInSourceQuery;
+ private String version;
+ private int maxInsertBatchSize = 2048;
+ private DatbaseCalender databaseCalender;
+
+ private AtomicBoolean initialConnection = new AtomicBoolean(true);
+
+ public JDBCExecutionFactory() {
+ setSupportsFullOuterJoins(true);
+ setSupportsOrderBy(true);
+ setSupportsOuterJoins(true);
+ setSupportsSelectDistinct(true);
+ setSupportsInnerJoins(true);
+ setMaxInCriteriaSize(DEFAULT_MAX_IN_CRITERIA);
+ setMaxDependentInPredicates(DEFAULT_MAX_DEPENDENT_PREDICATES);
+ }
+
+ @Override
+ public void start() throws TranslatorException {
+ super.start();
+ this.databaseCalender = new DatbaseCalender(this.databaseTimeZone);
+ }
+
+ @TranslatorProperty(display="Database Version", description= "Database Version")
+ public String getDatabaseVersion() {
+ return this.version;
+ }
+
+ public void setDatabaseVersion(String version) {
+ this.version = version;
+ }
+
+ @TranslatorProperty(display="Use Bind Variables", description="Use prepared statements and bind variables",advanced=true)
+ public boolean useBindVariables() {
+ return this.useBindVariables;
+ }
+
+ public void setUseBindVariables(boolean useBindVariables) {
+ this.useBindVariables = useBindVariables;
+ }
+
+ @TranslatorProperty(display="Database time zone", description="Time zone of the database, if different than Integration Server", advanced=true)
+ public String getDatabaseTimeZone() {
+ return this.databaseTimeZone;
+ }
+
+ public void setDatabaseTimeZone(String databaseTimeZone) {
+ this.databaseTimeZone = databaseTimeZone;
+ }
+
+ @TranslatorProperty(display="Trim string flag", description="Right Trim fixed character types returned as Strings - note that the native type must be char or nchar and the source must support the rtrim function.",advanced=true)
+ public boolean isTrimStrings() {
+ return this.trimStrings;
+ }
+
+ public void setTrimStrings(boolean trimStrings) {
+ this.trimStrings = trimStrings;
+ }
+
+ @TranslatorProperty(display="Use informational comments in Source Queries", description="This will embed a /*comment*/ leading comment with session/request id in source SQL query for informational purposes", advanced=true)
+ public boolean useCommentsInSourceQuery() {
+ return this.useCommentsInSourceQuery;
+ }
+
+ public void setUseCommentsInSourceQuery(boolean useCommentsInSourceQuery) {
+ this.useCommentsInSourceQuery = useCommentsInSourceQuery;
+ }
+
+ @Override
+ public boolean isSourceRequired() {
+ return true;
+ }
+
+ @Override
+ public ResultSetExecution createResultSetExecution(QueryExpression command, ExecutionContext executionContext, RuntimeMetadata metadata, Connection conn)
+ throws TranslatorException {
+ //TODO: This is not correct; this should be only called once for connection creation
+ obtainedConnection(conn);
+ return new JDBCQueryExecution(command, conn, executionContext, this);
+ }
+
+ @Override
+ public ProcedureExecution createProcedureExecution(Call command, ExecutionContext executionContext, RuntimeMetadata metadata, Connection conn)
+ throws TranslatorException {
+ //TODO: This is not correct; this should be only called once for connection creation
+ obtainedConnection(conn);
+ return new JDBCProcedureExecution(command, conn, executionContext, this);
+ }
+
+ @Override
+ public UpdateExecution createUpdateExecution(Command command, ExecutionContext executionContext, RuntimeMetadata metadata, Connection conn)
+ throws TranslatorException {
+ //TODO: This is not correct; this should be only called once for connection creation
+ obtainedConnection(conn);
+ return new JDBCUpdateExecution(command, conn, executionContext, this);
+ }
+
+ @Override
+ public Connection getConnection(DataSource ds)
+ throws TranslatorException {
+ try {
+ return ds.getConnection();
+ } catch (SQLException e) {
+ throw new TranslatorException(e);
+ }
+ }
+
+ @Override
+ public void closeConnection(Connection connection, DataSource factory) {
+ if (connection == null) {
+ return;
+ }
+ try {
+ connection.close();
+ } catch (SQLException e) {
+ LogManager.logDetail(LogConstants.CTX_CONNECTOR, e, "Error closing"); //$NON-NLS-1$
+ }
+ }
+
+ @Override
+ public void getMetadata(MetadataFactory metadataFactory, Connection conn) throws TranslatorException {
+ try {
+ JDBCMetdataProcessor metadataProcessor = new JDBCMetdataProcessor();
+ PropertiesUtils.setBeanProperties(metadataProcessor, metadataFactory.getImportProperties(), "importer"); //$NON-NLS-1$
+ metadataProcessor.getConnectorMetadata(conn, metadataFactory);
+ } catch (SQLException e) {
+ throw new TranslatorException(e);
+ }
+ }
+
+ @Override
+ public List<String> getSupportedFunctions() {
+ return getDefaultSupportedFunctions();
+ }
+
+ public List<String> getDefaultSupportedFunctions(){
+ return Arrays.asList(new String[] { "+", "-", "*", "/" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ }
+
+ @Override
+ public boolean supportsGroupBy() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsAggregatesAvg() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsAggregatesCount() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsAggregatesCountStar() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsAggregatesDistinct() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsAggregatesMax() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsAggregatesMin() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsAggregatesSum() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsAliasedTable() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsBetweenCriteria() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsCaseExpressions() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsCompareCriteriaEquals() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsCorrelatedSubqueries() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsExistsCriteria() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsInCriteria() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsInCriteriaSubquery() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsIsNullCriteria() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsLikeCriteria() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsLikeCriteriaEscapeCharacter() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsNotCriteria() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsOrCriteria() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsOrderByUnrelated() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsQuantifiedCompareCriteriaAll() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsScalarSubqueries() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsSearchedCaseExpressions() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsSelfJoins() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsInlineViews() {
+ return false;
+ }
+
+ @Override
+ public boolean supportsQuantifiedCompareCriteriaSome() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsSetQueryOrderBy() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsUnions() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsBulkUpdate() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsInsertWithIterator() {
+ return super.supportsBulkUpdate();
+ }
+
+ @Override
+ public boolean supportsBatchedUpdates() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsCompareCriteriaOrdered() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsHaving() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsSelectExpression() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsInsertWithQueryExpression() {
+ return true;
+ }
+
+ /**
+ * Get the max number of inserts to perform in one batch.
+ * @return
+ */
+ @TranslatorProperty(display="Max Prepared Insert Batch Size", description="The max size of a prepared insert batch. Default 2048.", advanced=true)
+ public int getMaxPreparedInsertBatchSize() {
+ return maxInsertBatchSize;
+ }
+
+ public void setMaxPreparedInsertBatchSize(int maxInsertBatchSize) {
+ if (maxInsertBatchSize < 1) {
+ throw new AssertionError("Max prepared batch insert size must be greater than 0"); //$NON-NLS-1$
+ }
+ this.maxInsertBatchSize = maxInsertBatchSize;
+ }
+
+ /**
+ * Gets the database calendar. This will be set to the time zone
+ * specified by the property {@link JDBCPropertyNames#DATABASE_TIME_ZONE}, or
+ * the local time zone if none is specified.
+ * @return the database calendar
+ */
+ public Calendar getDatabaseCalendar() {
+ return this.databaseCalender.get();
+ }
+
+ /**
+ * Return a List of translated parts ({@link LanguageObject}s and Objects), or null
+ * if to rely on the default translation. Override with care.
+ * @param command
+ * @param context
+ * @return list of translated parts
+ */
+ public List<?> translate(LanguageObject obj, ExecutionContext context) {
+ List<?> parts = null;
+ if (obj instanceof Function) {
+ Function function = (Function)obj;
+ if (functionModifiers != null) {
+ String name = function.getName();
+ while (true) {
+ FunctionModifier modifier = functionModifiers.get(name);
+ if (modifier != null) {
+ parts = modifier.translate(function);
+ break;
+ }
+ int index = name.indexOf('.');
+ if (index < 0 || index == name.length() - 1) {
+ break;
+ }
+ name = name.substring(index + 1);
+ }
+ }
+ } else if (obj instanceof Command) {
+ parts = translateCommand((Command)obj, context);
+ } else if (obj instanceof Limit) {
+ parts = translateLimit((Limit)obj, context);
+ } else if (obj instanceof ColumnReference) {
+ ColumnReference elem = (ColumnReference)obj;
+ if (isTrimStrings() && elem.getType() == TypeFacility.RUNTIME_TYPES.STRING && elem.getMetadataObject() != null
+ && ("char".equalsIgnoreCase(elem.getMetadataObject().getNativeType()) || "nchar".equalsIgnoreCase(elem.getMetadataObject().getNativeType()))) { //$NON-NLS-1$ //$NON-NLS-2$
+ return Arrays.asList(getLanguageFactory().createFunction(SourceSystemFunctions.RTRIM, new Expression[] {elem}, TypeFacility.RUNTIME_TYPES.STRING));
+ }
+ }
+ return parts;
+ }
+
+ /**
+ * Return a List of translated parts ({@link LanguageObject}s and Objects), or null
+ * if to rely on the default translation.
+ * @param command
+ * @param context
+ * @return a list of translated parts
+ */
+ public List<?> translateCommand(Command command, ExecutionContext context) {
+ return null;
+ }
+
+ /**
+ * Return a List of translated parts ({@link LanguageObject}s and Objects), or null
+ * if to rely on the default translation.
+ * @param limit
+ * @param context
+ * @return a list of translated parts
+ */
+ public List<?> translateLimit(Limit limit, ExecutionContext context) {
+ return null;
+ }
+
+ /**
+ * Return a map of function name to FunctionModifier.
+ * @return Map of function name to FunctionModifier.
+ */
+ public Map<String, FunctionModifier> getFunctionModifiers() {
+ return functionModifiers;
+ }
+
+ /**
+ * Add the {@link FunctionModifier} to the set of known modifiers.
+ * @param name
+ * @param modifier
+ */
+ public void registerFunctionModifier(String name, FunctionModifier modifier) {
+ this.functionModifiers.put(name, modifier);
+ }
+
+ /**
+ * Subclasses should override this method to provide a different sql translation
+ * of the literal boolean value. By default, a boolean literal is represented as:
+ * <code>'0'</code> or <code>'1'</code>.
+ * @param booleanValue Boolean value, never null
+ * @return Translated string
+ */
+ public String translateLiteralBoolean(Boolean booleanValue) {
+ if(booleanValue.booleanValue()) {
+ return "1"; //$NON-NLS-1$
+ }
+ return "0"; //$NON-NLS-1$
+ }
+
+ /**
+ * Subclasses should override this method to provide a different sql translation
+ * of the literal date value. By default, a date literal is represented as:
+ * <code>{d '2002-12-31'}</code>
+ * @param dateValue Date value, never null
+ * @return Translated string
+ */
+ public String translateLiteralDate(java.sql.Date dateValue) {
+ return "{d '" + formatDateValue(dateValue) + "'}"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * Subclasses should override this method to provide a different sql translation
+ * of the literal time value. By default, a time literal is represented as:
+ * <code>{t '23:59:59'}</code>
+ *
+ * See {@link JDBCExecutionFactory#hasTimeType()} to represent literal times as timestamps.
+ *
+ * @param timeValue Time value, never null
+ * @return Translated string
+ */
+ public String translateLiteralTime(Time timeValue) {
+ if (!hasTimeType()) {
+ return translateLiteralTimestamp(new Timestamp(timeValue.getTime()));
+ }
+ return "{t '" + formatDateValue(timeValue) + "'}"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * Subclasses should override this method to provide a different sql translation
+ * of the literal timestamp value. By default, a timestamp literal is
+ * represented as: <code>{ts '2002-12-31 23:59:59'}</code>.
+ *
+ * See {@link JDBCExecutionFactory#getTimestampNanoPrecision()} to control the literal
+ * precision.
+ *
+ * @param timestampValue Timestamp value, never null
+ * @return Translated string
+ */
+ public String translateLiteralTimestamp(Timestamp timestampValue) {
+ return "{ts '" + formatDateValue(timestampValue) + "'}"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * Format the dateObject (of type date, time, or timestamp) into a string
+ * using the DatabaseTimeZone format.
+ * @param dateObject
+ * @return Formatted string
+ */
+ public String formatDateValue(java.util.Date dateObject) {
+ if (dateObject instanceof Timestamp && getTimestampNanoPrecision() < 9) {
+ Timestamp ts = (Timestamp)dateObject;
+ Timestamp newTs = new Timestamp(ts.getTime());
+ if (getTimestampNanoPrecision() > 0) {
+ int mask = (int)Math.pow(10, 9-getTimestampNanoPrecision());
+ newTs.setNanos(ts.getNanos()/mask*mask);
+ } else {
+ newTs.setNanos(0);
+ }
+ dateObject = newTs;
+ }
+ return getTypeFacility().convertDate(dateObject, DEFAULT_TIME_ZONE, getDatabaseCalendar(), dateObject.getClass()).toString();
+ }
+
+ /**
+ * Returns true to indicate that SQL should include a comment
+ * indicating the session and request ids.
+ */
+ public boolean addSourceComment() {
+ return useCommentsInSourceQuery();
+ }
+
+ /**
+ * Indicates whether group alias should be of the form
+ * "...FROM groupA AS X" or "...FROM groupA X". Certain
+ * data sources (such as Oracle) may not support the first
+ * form.
+ * @return boolean
+ */
+ public boolean useAsInGroupAlias(){
+ return true;
+ }
+
+ /**
+ * Use PreparedStatements (or CallableStatements) as
+ * appropriate for all commands. Bind values will be
+ * determined by the {@link BindValueVisitor}. {@link Literal#setBindValue(boolean)}
+ * can be used to force a literal to be a bind value.
+ */
+ public boolean usePreparedStatements() {
+ return useBindVariables();
+ }
+
+ /**
+ * Set to true to indicate that every branch of a set query
+ * should have parenthesis, i.e. (query) union (query)
+ * @return true if parenthesis should be used for each set branch
+ */
+ public boolean useParensForSetQueries() {
+ return false;
+ }
+
+ /**
+ * Return false to indicate that time support should be emulated
+ * with timestamps.
+ * @return true if database has a time type
+ */
+ public boolean hasTimeType() {
+ return true;
+ }
+
+ /**
+ * Returns the name for a given {@link Operation}
+ * @param operation
+ * @return the name for the set operation
+ */
+ public String getSetOperationString(SetQuery.Operation operation) {
+ return operation.toString();
+ }
+
+ /**
+ * Returns the source comment for the given command
+ * @param context
+ * @param command
+ * @return the comment
+ */
+ public String getSourceComment(ExecutionContext context, Command command) {
+ if (addSourceComment() && context != null) {
+ return COMMENT.get().format(new Object[] {context.getConnectionIdentifier(), context.getRequestIdentifier(), context.getPartIdentifier()});
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ /**
+ * Override to return a name other than the default [group.]element
+ * @param group
+ * @param element
+ * @return thre replacement name
+ */
+ public String replaceElementName(String group, String element) {
+ return null;
+ }
+
+ /**
+ * Return the precision of timestamp literals. Defaults to 9.
+ * @return digits of timestamp nano precision.
+ */
+ public int getTimestampNanoPrecision() {
+ return 9;
+ }
+
+ /**
+ * This is a generic implementation. Because different databases handle
+ * stored procedures differently, subclasses should override this method
+ * if necessary.
+ */
+ public ResultSet executeStoredProcedure(CallableStatement statement, TranslatedCommand command, Class<?> returnType) throws SQLException {
+ List params = command.getPreparedValues();
+ int index = 1;
+
+ if(returnType != null){
+ registerSpecificTypeOfOutParameter(statement, returnType, index++);
+ }
+
+ Iterator iter = params.iterator();
+ while(iter.hasNext()){
+ Argument param = (Argument)iter.next();
+
+ if(param.getDirection() == Direction.INOUT){
+ registerSpecificTypeOfOutParameter(statement,param.getType(), index);
+ }else if(param.getDirection() == Direction.OUT){
+ registerSpecificTypeOfOutParameter(statement,param.getType(), index++);
+ }
+
+ if(param.getDirection() == Direction.IN || param.getDirection() == Direction.INOUT){
+ bindValue(statement, param.getArgumentValue().getValue(), param.getType(), index++);
+ }
+ }
+ boolean resultSetNext = statement.execute();
+
+ while (!resultSetNext) {
+ int update_count = statement.getUpdateCount();
+ if (update_count == -1) {
+ break;
+ }
+ resultSetNext = statement.getMoreResults();
+ }
+ return statement.getResultSet();
+ }
+
+ /**
+ * For registering specific output parameter types we need to translate these into the appropriate
+ * java.sql.Types output parameters
+ * We will need to match these up with the appropriate standard sql types
+ * @param cstmt
+ * @param parameter
+ * @throws SQLException
+ */
+ protected void registerSpecificTypeOfOutParameter(CallableStatement statement, Class<?> runtimeType, int index) throws SQLException {
+ int typeToSet = TypeFacility.getSQLTypeFromRuntimeType(runtimeType);
+
+ statement.registerOutParameter(index,typeToSet);
+ }
+
+ /**
+ * Sets prepared statement parameter i with param.
+ *
+ * Performs special handling to translate dates using the database time zone and to
+ * translate biginteger, float, and char to JDBC safe objects.
+ *
+ * @param stmt
+ * @param param
+ * @param paramType
+ * @param i
+ * @param cal
+ * @throws SQLException
+ */
+ public void bindValue(PreparedStatement stmt, Object param, Class<?> paramType, int i) throws SQLException {
+ int type = TypeFacility.getSQLTypeFromRuntimeType(paramType);
+
+ if (param == null) {
+ stmt.setNull(i, type);
+ return;
+ }
+ //if this is a Date object, then use the database calendar
+ if (paramType.equals(TypeFacility.RUNTIME_TYPES.DATE)) {
+ stmt.setDate(i,(java.sql.Date)param, getDatabaseCalendar());
+ return;
+ }
+ if (paramType.equals(TypeFacility.RUNTIME_TYPES.TIME)) {
+ stmt.setTime(i,(java.sql.Time)param, getDatabaseCalendar());
+ return;
+ }
+ if (paramType.equals(TypeFacility.RUNTIME_TYPES.TIMESTAMP)) {
+ stmt.setTimestamp(i,(java.sql.Timestamp)param, getDatabaseCalendar());
+ return;
+ }
+ //not all drivers handle the setObject call with BigDecimal correctly (namely jConnect 6.05)
+ if (TypeFacility.RUNTIME_TYPES.BIG_DECIMAL.equals(paramType)) {
+ stmt.setBigDecimal(i, (BigDecimal)param);
+ return;
+ }
+ //convert these the following to jdbc safe values
+ if (TypeFacility.RUNTIME_TYPES.BIG_INTEGER.equals(paramType)) {
+ param = new BigDecimal((BigInteger)param);
+ } else if (TypeFacility.RUNTIME_TYPES.FLOAT.equals(paramType)) {
+ param = new Double(((Float)param).doubleValue());
+ } else if (TypeFacility.RUNTIME_TYPES.CHAR.equals(paramType)) {
+ param = ((Character)param).toString();
+ }
+
+ stmt.setObject(i, param, type);
+ }
+
+ /**
+ * Retrieve the value on the current resultset row for the given column index.
+ * @param results
+ * @param columnIndex
+ * @param expectedType
+ * @return the value
+ * @throws SQLException
+ */
+ public Object retrieveValue(ResultSet results, int columnIndex, Class<?> expectedType) throws SQLException {
+ Integer code = TYPE_CODE_MAP.get(expectedType);
+ if(code != null) {
+ // Calling the specific methods here is more likely to get uniform (and fast) results from different
+ // data sources as the driver likely knows the best and fastest way to convert from the underlying
+ // raw form of the data to the expected type. We use a switch with codes in order without gaps
+ // as there is a special bytecode instruction that treats this case as a map such that not every value
+ // needs to be tested, which means it is very fast.
+ switch(code.intValue()) {
+ case INTEGER_CODE: {
+ int value = results.getInt(columnIndex);
+ if(results.wasNull()) {
+ return null;
+ }
+ return Integer.valueOf(value);
+ }
+ case LONG_CODE: {
+ long value = results.getLong(columnIndex);
+ if(results.wasNull()) {
+ return null;
+ }
+ return Long.valueOf(value);
+ }
+ case DOUBLE_CODE: {
+ double value = results.getDouble(columnIndex);
+ if(results.wasNull()) {
+ return null;
+ }
+ return Double.valueOf(value);
+ }
+ case BIGDECIMAL_CODE: {
+ return results.getBigDecimal(columnIndex);
+ }
+ case SHORT_CODE: {
+ short value = results.getShort(columnIndex);
+ if(results.wasNull()) {
+ return null;
+ }
+ return Short.valueOf(value);
+ }
+ case FLOAT_CODE: {
+ float value = results.getFloat(columnIndex);
+ if(results.wasNull()) {
+ return null;
+ }
+ return Float.valueOf(value);
+ }
+ case TIME_CODE: {
+ return results.getTime(columnIndex, getDatabaseCalendar());
+ }
+ case DATE_CODE: {
+ return results.getDate(columnIndex, getDatabaseCalendar());
+ }
+ case TIMESTAMP_CODE: {
+ return results.getTimestamp(columnIndex, getDatabaseCalendar());
+ }
+ case BLOB_CODE: {
+ try {
+ return results.getBlob(columnIndex);
+ } catch (SQLException e) {
+ // ignore
+ }
+ try {
+ return results.getBytes(columnIndex);
+ } catch (SQLException e) {
+ // ignore
+ }
+ break;
+ }
+ case CLOB_CODE: {
+ try {
+ return results.getClob(columnIndex);
+ } catch (SQLException e) {
+ // ignore
+ }
+ break;
+ }
+ case BOOLEAN_CODE: {
+ return results.getBoolean(columnIndex);
+ }
+ }
+ }
+
+ return results.getObject(columnIndex);
+ }
+
+ /**
+ * Retrieve the value for the given parameter index
+ * @param results
+ * @param parameterIndex
+ * @param expectedType
+ * @return the value
+ * @throws SQLException
+ */
+ public Object retrieveValue(CallableStatement results, int parameterIndex, Class<?> expectedType) throws SQLException{
+ Integer code = TYPE_CODE_MAP.get(expectedType);
+ if(code != null) {
+ switch(code.intValue()) {
+ case INTEGER_CODE: {
+ int value = results.getInt(parameterIndex);
+ if(results.wasNull()) {
+ return null;
+ }
+ return Integer.valueOf(value);
+ }
+ case LONG_CODE: {
+ long value = results.getLong(parameterIndex);
+ if(results.wasNull()) {
+ return null;
+ }
+ return Long.valueOf(value);
+ }
+ case DOUBLE_CODE: {
+ double value = results.getDouble(parameterIndex);
+ if(results.wasNull()) {
+ return null;
+ }
+ return new Double(value);
+ }
+ case BIGDECIMAL_CODE: {
+ return results.getBigDecimal(parameterIndex);
+ }
+ case SHORT_CODE: {
+ short value = results.getShort(parameterIndex);
+ if(results.wasNull()) {
+ return null;
+ }
+ return Short.valueOf(value);
+ }
+ case FLOAT_CODE: {
+ float value = results.getFloat(parameterIndex);
+ if(results.wasNull()) {
+ return null;
+ }
+ return new Float(value);
+ }
+ case TIME_CODE: {
+ return results.getTime(parameterIndex, getDatabaseCalendar());
+ }
+ case DATE_CODE: {
+ return results.getDate(parameterIndex, getDatabaseCalendar());
+ }
+ case TIMESTAMP_CODE: {
+ return results.getTimestamp(parameterIndex, getDatabaseCalendar());
+ }
+ case BLOB_CODE: {
+ try {
+ return results.getBlob(parameterIndex);
+ } catch (SQLException e) {
+ // ignore
+ }
+ try {
+ return results.getBytes(parameterIndex);
+ } catch (SQLException e) {
+ // ignore
+ }
+ }
+ case CLOB_CODE: {
+ try {
+ return results.getClob(parameterIndex);
+ } catch (SQLException e) {
+ // ignore
+ }
+ }
+ case BOOLEAN_CODE: {
+ return results.getBoolean(parameterIndex);
+ }
+ }
+ }
+
+ // otherwise fall through and call getObject() and rely on the normal
+ // translation routines
+ return results.getObject(parameterIndex);
+ }
+
+ /**
+ * Called exactly once for this source.
+ * @param connection
+ */
+ protected void afterInitialConnectionObtained(Connection connection) {
+ // now dig some details about this driver/database for log.
+ try {
+ StringBuffer sb = new StringBuffer(getClass().getSimpleName());
+ DatabaseMetaData dbmd = connection.getMetaData();
+ sb.append(" Commit=").append(connection.getAutoCommit()); //$NON-NLS-1$
+ sb.append(";DatabaseProductName=").append(dbmd.getDatabaseProductName()); //$NON-NLS-1$
+ sb.append(";DatabaseProductVersion=").append(dbmd.getDatabaseProductVersion()); //$NON-NLS-1$
+ sb.append(";DriverMajorVersion=").append(dbmd.getDriverMajorVersion()); //$NON-NLS-1$
+ sb.append(";DriverMajorVersion=").append(dbmd.getDriverMinorVersion()); //$NON-NLS-1$
+ sb.append(";DriverName=").append(dbmd.getDriverName()); //$NON-NLS-1$
+ sb.append(";DriverVersion=").append(dbmd.getDriverVersion()); //$NON-NLS-1$
+ sb.append(";IsolationLevel=").append(dbmd.getDefaultTransactionIsolation()); //$NON-NLS-1$
+
+ LogManager.logInfo(LogConstants.CTX_CONNECTOR, sb.toString());
+ } catch (SQLException e) {
+ String errorStr = JDBCPlugin.Util.getString("ConnectionListener.failed_to_report_jdbc_connection_details"); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_CONNECTOR, errorStr);
+ }
+ }
+
+ /**
+ * Provides a hook to call source specific logic when
+ * a connection is obtained.
+ *
+ * defect request 13979 & 13978
+ */
+ public void obtainedConnection(Connection connection) {
+ if (initialConnection.compareAndSet(true, false)) {
+ afterInitialConnectionObtained(connection);
+ }
+ }
+
+
+
+ /**
+ * Create the {@link SQLConversionVisitor} that will perform translation. Typical custom
+ * JDBC connectors will not need to create custom conversion visitors, rather implementors
+ * should override existing {@link JDBCExecutionFactory} methods.
+ * @return the {@link SQLConversionVisitor}
+ */
+ public SQLConversionVisitor getSQLConversionVisitor() {
+ return new SQLConversionVisitor(this);
+ }
+
+ /**
+ * Set to true to indicate that every branch of a join
+ * should have parenthesis.
+ * @return true if every branch of a join should use parenthesis
+ */
+ public boolean useParensForJoins() {
+ return false;
+ }
+
+ @Override
+ public NullOrder getDefaultNullOrder() {
+ return NullOrder.LOW;
+ }
+
+ /**
+ * Returns whether the limit clause is applied to the select clause.
+ * @return true if the limit clause is part of the select
+ */
+ public boolean useSelectLimit() {
+ return false;
+ }
+
+ public static List<String> parseName(String tableName, char escape, char delim) {
+ boolean quoted = false;
+ boolean escaped = false;
+ List<String> nameParts = new LinkedList<String>();
+ StringBuilder current = new StringBuilder();
+ for (int i = 0; i < tableName.length(); i++) {
+ char c = tableName.charAt(i);
+ if (quoted) {
+ if (c == escape) {
+ if (escaped) {
+ current.append(c);
+ }
+ escaped = !escaped;
+ } else if (c == delim) {
+ if (escaped) {
+ escaped = false;
+ quoted = false;
+ nameParts.add(current.toString());
+ current = new StringBuilder();
+ } else {
+ current.append(c);
+ }
+ } else {
+ current.append(c);
+ }
+ } else {
+ if (c == escape) {
+ if (current.length() == 0) {
+ quoted = true;
+ } else {
+ current.append(c);
+ }
+ } else if (c == delim) {
+ quoted = false;
+ nameParts.add(current.toString());
+ current = new StringBuilder();
+ } else {
+ current.append(c);
+ }
+ }
+ }
+ if (current.length() > 0) {
+ nameParts.add(current.toString());
+ }
+ return nameParts;
+ }
+
+}
Deleted: tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/ingres/IngresExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/ingres/IngresExecutionFactory.java 2011-06-02 18:23:22 UTC (rev 3213)
+++ tags/teiid-parent-7.5.0.Alpha1/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/ingres/IngresExecutionFactory.java 2011-06-05 18:45:10 UTC (rev 3221)
@@ -1,277 +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.translator.jdbc.ingres;
-
-import java.sql.Date;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.teiid.core.types.DataTypeManager;
-import org.teiid.language.Limit;
-import org.teiid.metadata.FunctionMethod;
-import org.teiid.metadata.FunctionParameter;
-import org.teiid.translator.ExecutionContext;
-import org.teiid.translator.SourceSystemFunctions;
-import org.teiid.translator.Translator;
-import org.teiid.translator.TranslatorException;
-import org.teiid.translator.jdbc.AliasModifier;
-import org.teiid.translator.jdbc.ConvertModifier;
-import org.teiid.translator.jdbc.FunctionModifier;
-import org.teiid.translator.jdbc.JDBCExecutionFactory;
-
-@Translator(name="ingres", description="A translator for Ingres Databases")
-public class IngresExecutionFactory extends JDBCExecutionFactory {
-
- private static final String INGRES = "ingres"; //$NON-NLS-1$
- protected ConvertModifier convert = new ConvertModifier();
-
- @Override
- public void start() throws TranslatorException {
- super.start();
- convert.addTypeMapping("tinyint", FunctionModifier.BOOLEAN, FunctionModifier.BYTE); //$NON-NLS-1$
- convert.addTypeMapping("smallint", FunctionModifier.SHORT); //$NON-NLS-1$
- convert.addTypeMapping("integer", FunctionModifier.INTEGER); //$NON-NLS-1$
- convert.addTypeMapping("bigint", FunctionModifier.LONG); //$NON-NLS-1$
- convert.addTypeMapping("real", FunctionModifier.FLOAT); //$NON-NLS-1$
- convert.addTypeMapping("float", FunctionModifier.DOUBLE); //$NON-NLS-1$
- convert.addTypeMapping("decimal(38,19)", FunctionModifier.BIGDECIMAL); //$NON-NLS-1$
- convert.addTypeMapping("decimal(15,0)", FunctionModifier.BIGINTEGER); //$NON-NLS-1$
- convert.addTypeMapping("date", FunctionModifier.DATE); //$NON-NLS-1$
- convert.addTypeMapping("time with time zone", FunctionModifier.TIME); //$NON-NLS-1$
- convert.addTypeMapping("timestamp with time zone", FunctionModifier.TIMESTAMP); //$NON-NLS-1$
- convert.addTypeMapping("char(1)", FunctionModifier.CHAR); //$NON-NLS-1$
- convert.addTypeMapping("varchar(4000)", FunctionModifier.STRING); //$NON-NLS-1$
- convert.addTypeMapping("blob", FunctionModifier.BLOB); //$NON-NLS-1$
- convert.addTypeMapping("clob", FunctionModifier.CLOB); //$NON-NLS-1$
- convert.addNumericBooleanConversions();
- registerFunctionModifier(SourceSystemFunctions.CONVERT, convert);
-
- registerFunctionModifier(SourceSystemFunctions.BITAND, new AliasModifier("bit_and")); //$NON-NLS-1$
- registerFunctionModifier(SourceSystemFunctions.BITNOT, new AliasModifier("bit_not")); //$NON-NLS-1$
- registerFunctionModifier(SourceSystemFunctions.BITOR, new AliasModifier("bit_or")); //$NON-NLS-1$
- registerFunctionModifier(SourceSystemFunctions.BITXOR, new AliasModifier("bit_xor")); //$NON-NLS-1$
- registerFunctionModifier(SourceSystemFunctions.CURTIME, new AliasModifier("current_time")); //$NON-NLS-1$
- registerFunctionModifier(SourceSystemFunctions.CURDATE, new AliasModifier("current_date")); //$NON-NLS-1$
- registerFunctionModifier(SourceSystemFunctions.LCASE, new AliasModifier("lowercase")); //$NON-NLS-1$
- registerFunctionModifier(SourceSystemFunctions.RAND, new AliasModifier("random")); //$NON-NLS-1$
- registerFunctionModifier(SourceSystemFunctions.UCASE, new AliasModifier("uppercase")); //$NON-NLS-1$
- registerFunctionModifier(SourceSystemFunctions.DAYOFMONTH, new AliasModifier("day")); //$NON-NLS-1$
- registerFunctionModifier(SourceSystemFunctions.LOCATE, new LocateFunctionModifier(getLanguageFactory()));
- }
-
- @Override
- public List<String> getSupportedFunctions() {
- List<String> supportedFunctions = new ArrayList<String>();
- supportedFunctions.addAll(sup