teiid SVN: r2709 - in tags: teiid-parent-7.2.0.Final and 61 other directories.
by teiid-commitsï¼ lists.jboss.org
Author: shawkins
Date: 2010-11-04 23:19:55 -0400 (Thu, 04 Nov 2010)
New Revision: 2709
Added:
tags/teiid-parent-7.2.0.Final/
tags/teiid-parent-7.2.0.Final/adminshell/pom.xml
tags/teiid-parent-7.2.0.Final/api/pom.xml
tags/teiid-parent-7.2.0.Final/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
tags/teiid-parent-7.2.0.Final/build/kits/jboss-container/teiid-releasenotes.html
tags/teiid-parent-7.2.0.Final/build/pom.xml
tags/teiid-parent-7.2.0.Final/cache-jbosscache/pom.xml
tags/teiid-parent-7.2.0.Final/client/pom.xml
tags/teiid-parent-7.2.0.Final/common-core/pom.xml
tags/teiid-parent-7.2.0.Final/connectors/connector-file/pom.xml
tags/teiid-parent-7.2.0.Final/connectors/connector-ldap/pom.xml
tags/teiid-parent-7.2.0.Final/connectors/connector-salesforce/pom.xml
tags/teiid-parent-7.2.0.Final/connectors/connector-ws/pom.xml
tags/teiid-parent-7.2.0.Final/connectors/pom.xml
tags/teiid-parent-7.2.0.Final/connectors/salesforce-api/pom.xml
tags/teiid-parent-7.2.0.Final/connectors/sandbox/pom.xml
tags/teiid-parent-7.2.0.Final/connectors/sandbox/translator-yahoo/pom.xml
tags/teiid-parent-7.2.0.Final/connectors/translator-file/pom.xml
tags/teiid-parent-7.2.0.Final/connectors/translator-jdbc/pom.xml
tags/teiid-parent-7.2.0.Final/connectors/translator-ldap/pom.xml
tags/teiid-parent-7.2.0.Final/connectors/translator-loopback/pom.xml
tags/teiid-parent-7.2.0.Final/connectors/translator-salesforce/pom.xml
tags/teiid-parent-7.2.0.Final/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/execution/QueryExecutionImpl.java
tags/teiid-parent-7.2.0.Final/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/TestQueryExecutionImpl.java
tags/teiid-parent-7.2.0.Final/connectors/translator-ws/pom.xml
tags/teiid-parent-7.2.0.Final/console/pom.xml
tags/teiid-parent-7.2.0.Final/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
tags/teiid-parent-7.2.0.Final/console/src/main/java/org/teiid/rhq/plugin/Facet.java
tags/teiid-parent-7.2.0.Final/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java
tags/teiid-parent-7.2.0.Final/console/src/main/java/org/teiid/rhq/plugin/util/ProfileServiceUtil.java
tags/teiid-parent-7.2.0.Final/console/src/main/resources/META-INF/rhq-plugin.xml
tags/teiid-parent-7.2.0.Final/documentation/admin-guide/pom.xml
tags/teiid-parent-7.2.0.Final/documentation/admin-guide/src/main/docbook/en-US/content/appendix-a.xml
tags/teiid-parent-7.2.0.Final/documentation/caching-guide/pom.xml
tags/teiid-parent-7.2.0.Final/documentation/client-developers-guide/pom.xml
tags/teiid-parent-7.2.0.Final/documentation/developer-guide/pom.xml
tags/teiid-parent-7.2.0.Final/documentation/pom.xml
tags/teiid-parent-7.2.0.Final/documentation/quick-start-example/pom.xml
tags/teiid-parent-7.2.0.Final/documentation/reference/pom.xml
tags/teiid-parent-7.2.0.Final/engine/pom.xml
tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/cache/CacheConfiguration.java
tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java
tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java
tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java
tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/query/optimizer/relational/rules/JoinRegion.java
tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/query/optimizer/relational/rules/NewCalculateCostUtil.java
tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRaiseAccess.java
tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/query/parser/QueryParser.java
tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java
tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/query/sql/visitor/CriteriaTranslatorVisitor.java
tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
tags/teiid-parent-7.2.0.Final/engine/src/main/resources/org/teiid/query/i18n.properties
tags/teiid-parent-7.2.0.Final/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPWorkContext.java
tags/teiid-parent-7.2.0.Final/engine/src/test/java/org/teiid/query/optimizer/TestDependentJoins.java
tags/teiid-parent-7.2.0.Final/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java
tags/teiid-parent-7.2.0.Final/engine/src/test/java/org/teiid/query/rewriter/TestQueryRewriter.java
tags/teiid-parent-7.2.0.Final/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java
tags/teiid-parent-7.2.0.Final/hibernate-dialect/pom.xml
tags/teiid-parent-7.2.0.Final/jboss-integration/pom.xml
tags/teiid-parent-7.2.0.Final/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
tags/teiid-parent-7.2.0.Final/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
tags/teiid-parent-7.2.0.Final/metadata/pom.xml
tags/teiid-parent-7.2.0.Final/pom.xml
tags/teiid-parent-7.2.0.Final/runtime/pom.xml
tags/teiid-parent-7.2.0.Final/runtime/src/main/java/org/teiid/transport/SocketConfiguration.java
tags/teiid-parent-7.2.0.Final/test-integration/common/pom.xml
tags/teiid-parent-7.2.0.Final/test-integration/db/pom.xml
tags/teiid-parent-7.2.0.Final/test-integration/pom.xml
Removed:
tags/teiid-parent-7.2.0.Final/adminshell/pom.xml
tags/teiid-parent-7.2.0.Final/api/pom.xml
tags/teiid-parent-7.2.0.Final/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
tags/teiid-parent-7.2.0.Final/build/kits/jboss-container/teiid-releasenotes.html
tags/teiid-parent-7.2.0.Final/build/pom.xml
tags/teiid-parent-7.2.0.Final/cache-jbosscache/pom.xml
tags/teiid-parent-7.2.0.Final/client/pom.xml
tags/teiid-parent-7.2.0.Final/common-core/pom.xml
tags/teiid-parent-7.2.0.Final/connectors/connector-file/pom.xml
tags/teiid-parent-7.2.0.Final/connectors/connector-ldap/pom.xml
tags/teiid-parent-7.2.0.Final/connectors/connector-salesforce/pom.xml
tags/teiid-parent-7.2.0.Final/connectors/connector-ws/pom.xml
tags/teiid-parent-7.2.0.Final/connectors/pom.xml
tags/teiid-parent-7.2.0.Final/connectors/salesforce-api/pom.xml
tags/teiid-parent-7.2.0.Final/connectors/sandbox/pom.xml
tags/teiid-parent-7.2.0.Final/connectors/sandbox/translator-yahoo/pom.xml
tags/teiid-parent-7.2.0.Final/connectors/translator-file/pom.xml
tags/teiid-parent-7.2.0.Final/connectors/translator-jdbc/pom.xml
tags/teiid-parent-7.2.0.Final/connectors/translator-ldap/pom.xml
tags/teiid-parent-7.2.0.Final/connectors/translator-loopback/pom.xml
tags/teiid-parent-7.2.0.Final/connectors/translator-salesforce/pom.xml
tags/teiid-parent-7.2.0.Final/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/execution/QueryExecutionImpl.java
tags/teiid-parent-7.2.0.Final/connectors/translator-ws/pom.xml
tags/teiid-parent-7.2.0.Final/console/pom.xml
tags/teiid-parent-7.2.0.Final/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
tags/teiid-parent-7.2.0.Final/console/src/main/java/org/teiid/rhq/plugin/Facet.java
tags/teiid-parent-7.2.0.Final/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java
tags/teiid-parent-7.2.0.Final/console/src/main/java/org/teiid/rhq/plugin/util/ProfileServiceUtil.java
tags/teiid-parent-7.2.0.Final/console/src/main/resources/META-INF/rhq-plugin.xml
tags/teiid-parent-7.2.0.Final/documentation/admin-guide/pom.xml
tags/teiid-parent-7.2.0.Final/documentation/admin-guide/src/main/docbook/en-US/content/appendix-a.xml
tags/teiid-parent-7.2.0.Final/documentation/caching-guide/pom.xml
tags/teiid-parent-7.2.0.Final/documentation/client-developers-guide/pom.xml
tags/teiid-parent-7.2.0.Final/documentation/developer-guide/pom.xml
tags/teiid-parent-7.2.0.Final/documentation/pom.xml
tags/teiid-parent-7.2.0.Final/documentation/quick-start-example/pom.xml
tags/teiid-parent-7.2.0.Final/documentation/reference/pom.xml
tags/teiid-parent-7.2.0.Final/engine/pom.xml
tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/cache/CacheConfiguration.java
tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java
tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java
tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java
tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/query/optimizer/relational/rules/JoinRegion.java
tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/query/optimizer/relational/rules/NewCalculateCostUtil.java
tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRaiseAccess.java
tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/query/parser/QueryParser.java
tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java
tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/query/sql/visitor/CriteriaTranslatorVisitor.java
tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
tags/teiid-parent-7.2.0.Final/engine/src/main/resources/org/teiid/query/i18n.properties
tags/teiid-parent-7.2.0.Final/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPWorkContext.java
tags/teiid-parent-7.2.0.Final/engine/src/test/java/org/teiid/query/optimizer/TestDependentJoins.java
tags/teiid-parent-7.2.0.Final/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java
tags/teiid-parent-7.2.0.Final/engine/src/test/java/org/teiid/query/rewriter/TestQueryRewriter.java
tags/teiid-parent-7.2.0.Final/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java
tags/teiid-parent-7.2.0.Final/hibernate-dialect/pom.xml
tags/teiid-parent-7.2.0.Final/jboss-integration/pom.xml
tags/teiid-parent-7.2.0.Final/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
tags/teiid-parent-7.2.0.Final/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
tags/teiid-parent-7.2.0.Final/metadata/pom.xml
tags/teiid-parent-7.2.0.Final/pom.xml
tags/teiid-parent-7.2.0.Final/runtime/pom.xml
tags/teiid-parent-7.2.0.Final/runtime/src/main/java/org/teiid/transport/SocketConfiguration.java
tags/teiid-parent-7.2.0.Final/test-integration/common/pom.xml
tags/teiid-parent-7.2.0.Final/test-integration/db/pom.xml
tags/teiid-parent-7.2.0.Final/test-integration/pom.xml
Log:
[maven-release-plugin] copy for tag teiid-parent-7.2.0.Final
Copied: tags/teiid-parent-7.2.0.Final (from rev 2706, branches/7.2.x)
Deleted: tags/teiid-parent-7.2.0.Final/adminshell/pom.xml
===================================================================
--- branches/7.2.x/adminshell/pom.xml 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/adminshell/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -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.2.0.Final-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.2.0.Final/adminshell/pom.xml (from rev 2708, branches/7.2.x/adminshell/pom.xml)
===================================================================
--- tags/teiid-parent-7.2.0.Final/adminshell/pom.xml (rev 0)
+++ tags/teiid-parent-7.2.0.Final/adminshell/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -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.2.0.Final</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.2.0.Final/api/pom.xml
===================================================================
--- branches/7.2.x/api/pom.xml 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/api/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -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.2.0.Final-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.2.0.Final/api/pom.xml (from rev 2708, branches/7.2.x/api/pom.xml)
===================================================================
--- tags/teiid-parent-7.2.0.Final/api/pom.xml (rev 0)
+++ tags/teiid-parent-7.2.0.Final/api/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -0,0 +1,34 @@
+<?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.2.0.Final</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>
Deleted: tags/teiid-parent-7.2.0.Final/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml
===================================================================
--- branches/7.2.x/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -1,221 +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 memory (default 16384).
- This value should be set lower or higher depending on the available memory to Teiid in the VM.
- 16384 is considered a good default for a dedicated 32-bit VM running Teiid with a 1 gig heap.
- -->
- <property name="maxReserveBatchColumns">16384</property>
- <!--
- The number of batch columns guaranteed to a processing operation. Set this value lower if the workload typically
- processes larger numbers of concurrent queries with large intermediate results from operations such as sorting,
- grouping, etc. (default 128)
- -->
- <property name="maxProcessingBatchesColumns">128</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="enabled">true</property>
- <!-- Max Entries allowed for ResultSet Cache (default 1024) -->
- <property name="maxEntries">1024</property>
- <!-- Max age in seconds (default 7200 - 2 hours) -->
- <property name="maxAgeInSeconds">7200</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>
- </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="cacheFactory"><inject bean="CacheFactory"/></property>
- <property name="resultsetCacheConfig"><inject bean="ResultsetCacheConfig"/></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>
- <!-- 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>
- <!-- The maximum number of query plans that are cached.
- This includes both user plans and internal prepared plans.
- Note: this is a memory based cache. (default 512) -->
- <property name="preparedPlanCacheMaxCount">512</property>
- <!-- Turn on role checking of resources based on the roles defined in VDB (default true) -->
- <property name="useDataRoles" class="java.lang.Boolean">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. -->
- <property name="exceptionOnMaxSourceRows">true</property>
- </bean>
-
- <!-- JDBC Socket connection properties (SSL see below) -->
- <bean name="JdbcSocketConfiguration" class="org.teiid.transport.SocketConfiguration">
- <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 (default 15) -->
- <property name="maxSocketThreads">15</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="enabled">true</property>
- <property name="bindAddress">${jboss.bind.address}</property>
- <property name="portNumber">31443</property>
- <!-- Max number of threads dedicated to Admin and initial request processing (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="enabled">true</property>
- <property name="bindAddress">${jboss.bind.address}</property>
- <property name="portNumber">35432</property>
- <!-- Max number of threads dedicated to initial request processing (default 15) -->
- <property name="maxSocketThreads">15</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.2.0.Final/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml (from rev 2707, branches/7.2.x/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml)
===================================================================
--- tags/teiid-parent-7.2.0.Final/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml (rev 0)
+++ tags/teiid-parent-7.2.0.Final/build/kits/jboss-container/deploy/teiid/teiid-jboss-beans.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -0,0 +1,225 @@
+<?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 memory (default 16384).
+ This value should be set lower or higher depending on the available memory to Teiid in the VM.
+ 16384 is considered a good default for a dedicated 32-bit VM running Teiid with a 1 gig heap.
+ -->
+ <property name="maxReserveBatchColumns">16384</property>
+ <!--
+ The number of batch columns guaranteed to a processing operation. Set this value lower if the workload typically
+ processes larger numbers of concurrent queries with large intermediate results from operations such as sorting,
+ grouping, etc. (default 128)
+ -->
+ <property name="maxProcessingBatchesColumns">128</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 for ResultSet Cache (default 1024) -->
+ <property name="maxEntries">1024</property>
+ <!-- Max age in seconds (default 7200 - 2 hours) -->
+ <property name="maxAgeInSeconds">7200</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>
+ </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="cacheFactory"><inject bean="CacheFactory"/></property>
+ <property name="resultsetCacheConfig"><inject bean="ResultsetCacheConfig"/></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>
+ <!-- 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>
+ <!-- The maximum number of query plans that are cached.
+ This includes both user plans and internal prepared plans.
+ Note: this is a memory based cache. (default 512) -->
+ <property name="preparedPlanCacheMaxCount">512</property>
+ <!-- Turn on role checking of resources based on the roles defined in VDB (default true) -->
+ <property name="useDataRoles">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. -->
+ <property name="exceptionOnMaxSourceRows">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 (default 15) -->
+ <property name="maxSocketThreads">15</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 and initial request processing (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 initial request processing (default 15) -->
+ <property name="maxSocketThreads">15</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>
Deleted: tags/teiid-parent-7.2.0.Final/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- branches/7.2.x/build/kits/jboss-container/teiid-releasenotes.html 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/build/kits/jboss-container/teiid-releasenotes.html 2010-11-05 03:19:55 UTC (rev 2709)
@@ -1,209 +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 and integration 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>SQL Support</B>
- <UL>
- <LI><B>Non-Recursive Common Table Expressions</B> - The WITH clause (and associated pushdown) for non-recursive queries is now supported.
- <LI><B>Explicit Table Syntax</B> - TABLE x can now be used as a shortcut for SELECT * FROM x
- </UL>
- <LI><B>JSON Support</B> - JSON, which could be obtained through the ws-translator using http calls or other methods, can be converted to XML using the system function jsonToXml. XMLTABLE and other integration logic can then be used on the JSON results.
- <LI><B>Transaction Statements</B> - JDBC/ODBC now accepts START TRANSACTION, COMMIT, and ROLLBACK statements to control local transactions.
- <LI><B>Procedure Result Caching</B> - virtual procedure definitions may use a cache hint to cache results in the result set cache.
- <LI><B>Improved Plan Caching</B> - plans used by internal materialization and stored procedure plans will be automatically cached in the prepared plan cache. Improvements were also made to reduce the memory footprint of the plans.
- <LI><B>Refined Load Balancing and Fail Over</B> - clients can use use the statement "SET NEWINSTANCE TRUE" to allow their connection to select a new server instance. See the Client Developer's Guide for more information.
- <LI><B>Simplified Role Usage</B> - a role can now be assigned to any authenticated user via the any-authenticated attribute on the data-role element.
- <LI><B>Materialized View Performance</B> - materialized view tables will now automatically create and use non-unique secondary indexes for unique constraints and indexes defined on the view.
- <LI><B>Binary Web Service Calls</B> - the ws translator now provides an invokeHttp procedure to return the blob contents and string content type of an http/https call.
- <LI><B>Improved clustering support</B> - see the Admin Guide chapter on clustering.
- <LI><B>IPv6 support</B> - Teiid can started using IPv6 bind address and can be used with JDBC connection.
- <LI><B>SESSION_ID</B> - A new system function "SESSION_ID" is added to the system function library.
- <LI><B>Assignment Syntax Improvements<B> - Teiid's procedure syntax for assignments was clarified so that the assignment value must be a proper expression. INSERT/UPDATE/DELETE update counts must be obtained from VARIABLES.ROWCOUNT, scalar values must be obtained via a scalar subquery. The parser will continue to accept the old syntax and convert the query into the proper form.
- <LI><B>TEXTAGG</B> - SQL support for Text aggregation. Using this function expression values can be aggregated into a CSV BLOB with configurable delimiter, header, and encoding. The result can be optionally saved to a text file.
-</UL>
-
-<h2><a name="Compatibility">Compatibility Issues</a></h2>
-<ul>
- <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.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.
-</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.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>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.
-</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 teiid-docs/licenses
-directory of the distribution. <a href="teiid-docs/licenses">Browse
-Licenses</a>
-
-</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.2.0.Final/build/kits/jboss-container/teiid-releasenotes.html (from rev 2707, branches/7.2.x/build/kits/jboss-container/teiid-releasenotes.html)
===================================================================
--- tags/teiid-parent-7.2.0.Final/build/kits/jboss-container/teiid-releasenotes.html (rev 0)
+++ tags/teiid-parent-7.2.0.Final/build/kits/jboss-container/teiid-releasenotes.html 2010-11-05 03:19:55 UTC (rev 2709)
@@ -0,0 +1,210 @@
+<!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 and integration 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>SQL Support</B>
+ <UL>
+ <LI><B>Non-Recursive Common Table Expressions</B> - The WITH clause (and associated pushdown) for non-recursive queries is now supported.
+ <LI><B>Explicit Table Syntax</B> - TABLE x can now be used as a shortcut for SELECT * FROM x
+ </UL>
+ <LI><B>JSON Support</B> - JSON, which could be obtained through the ws-translator using http calls or other methods, can be converted to XML using the system function jsonToXml. XMLTABLE and other integration logic can then be used on the JSON results.
+ <LI><B>Transaction Statements</B> - JDBC/ODBC now accepts START TRANSACTION, COMMIT, and ROLLBACK statements to control local transactions.
+ <LI><B>Procedure Result Caching</B> - virtual procedure definitions may use a cache hint to cache results in the result set cache.
+ <LI><B>Improved Plan Caching</B> - plans used by internal materialization and stored procedure plans will be automatically cached in the prepared plan cache. Improvements were also made to reduce the memory footprint of the plans.
+ <LI><B>Refined Load Balancing and Fail Over</B> - clients can use use the statement "SET NEWINSTANCE TRUE" to allow their connection to select a new server instance. See the Client Developer's Guide for more information.
+ <LI><B>Simplified Role Usage</B> - a role can now be assigned to any authenticated user via the any-authenticated attribute on the data-role element.
+ <LI><B>Materialized View Performance</B> - materialized view tables will now automatically create and use non-unique secondary indexes for unique constraints and indexes defined on the view.
+ <LI><B>Binary Web Service Calls</B> - the ws translator now provides an invokeHttp procedure to return the blob contents and string content type of an http/https call.
+ <LI><B>Improved clustering support</B> - see the Admin Guide chapter on clustering.
+ <LI><B>IPv6 support</B> - Teiid can started using IPv6 bind address and can be used with JDBC connection.
+ <LI><B>SESSION_ID</B> - A new system function "SESSION_ID" is added to the system function library.
+ <LI><B>Assignment Syntax Improvements</B> - Teiid's procedure syntax for assignments was clarified so that the assignment value must be a proper expression. INSERT/UPDATE/DELETE update counts must be obtained from VARIABLES.ROWCOUNT, scalar values must be obtained via a scalar subquery. The parser will continue to accept the old syntax and convert the query into the proper form.
+ <LI><B>TEXTAGG</B> - SQL support for Text aggregation. Using this function expression values can be aggregated into a CSV BLOB with configurable delimiter, header, and encoding. The result can be optionally saved to a text file.
+</UL>
+
+<h2><a name="Compatibility">Compatibility Issues</a></h2>
+<ul>
+ <li>TRANSLATE 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.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.
+</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.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>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.
+</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 teiid-docs/licenses
+directory of the distribution. <a href="teiid-docs/licenses">Browse
+Licenses</a>
+
+</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.2.0.Final/build/pom.xml
===================================================================
--- branches/7.2.x/build/pom.xml 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/build/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -1,93 +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.2.0.Final-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>teiid</artifactId>
- <name>Build</name>
- <description>Teiid Build</description>
- <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>
- </plugins>
- </build>
- </profile>
- </profiles>
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.2.0.Final/build/pom.xml (from rev 2708, branches/7.2.x/build/pom.xml)
===================================================================
--- tags/teiid-parent-7.2.0.Final/build/pom.xml (rev 0)
+++ tags/teiid-parent-7.2.0.Final/build/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -0,0 +1,93 @@
+<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.2.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>teiid</artifactId>
+ <name>Build</name>
+ <description>Teiid Build</description>
+ <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>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.2.0.Final/cache-jbosscache/pom.xml
===================================================================
--- branches/7.2.x/cache-jbosscache/pom.xml 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/cache-jbosscache/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -1,29 +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.2.0.Final-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-engine</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.cache</groupId>
- <artifactId>jbosscache-core</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.2.0.Final/cache-jbosscache/pom.xml (from rev 2708, branches/7.2.x/cache-jbosscache/pom.xml)
===================================================================
--- tags/teiid-parent-7.2.0.Final/cache-jbosscache/pom.xml (rev 0)
+++ tags/teiid-parent-7.2.0.Final/cache-jbosscache/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -0,0 +1,34 @@
+<?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.2.0.Final</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-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.2.0.Final/client/pom.xml
===================================================================
--- branches/7.2.x/client/pom.xml 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/client/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -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.2.0.Final-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.2.0.Final/client/pom.xml (from rev 2708, branches/7.2.x/client/pom.xml)
===================================================================
--- tags/teiid-parent-7.2.0.Final/client/pom.xml (rev 0)
+++ tags/teiid-parent-7.2.0.Final/client/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -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.2.0.Final</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.2.0.Final/common-core/pom.xml
===================================================================
--- branches/7.2.x/common-core/pom.xml 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/common-core/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -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.2.0.Final-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.2.0.Final/common-core/pom.xml (from rev 2708, branches/7.2.x/common-core/pom.xml)
===================================================================
--- tags/teiid-parent-7.2.0.Final/common-core/pom.xml (rev 0)
+++ tags/teiid-parent-7.2.0.Final/common-core/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -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.2.0.Final</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.2.0.Final/connectors/connector-file/pom.xml
===================================================================
--- branches/7.2.x/connectors/connector-file/pom.xml 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/connectors/connector-file/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -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.2.0.Final-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.2.0.Final/connectors/connector-file/pom.xml (from rev 2708, branches/7.2.x/connectors/connector-file/pom.xml)
===================================================================
--- tags/teiid-parent-7.2.0.Final/connectors/connector-file/pom.xml (rev 0)
+++ tags/teiid-parent-7.2.0.Final/connectors/connector-file/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -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.2.0.Final</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.2.0.Final/connectors/connector-ldap/pom.xml
===================================================================
--- branches/7.2.x/connectors/connector-ldap/pom.xml 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/connectors/connector-ldap/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -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.2.0.Final-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.2.0.Final/connectors/connector-ldap/pom.xml (from rev 2708, branches/7.2.x/connectors/connector-ldap/pom.xml)
===================================================================
--- tags/teiid-parent-7.2.0.Final/connectors/connector-ldap/pom.xml (rev 0)
+++ tags/teiid-parent-7.2.0.Final/connectors/connector-ldap/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -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.2.0.Final</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.2.0.Final/connectors/connector-salesforce/pom.xml
===================================================================
--- branches/7.2.x/connectors/connector-salesforce/pom.xml 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/connectors/connector-salesforce/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -1,70 +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.2.0.Final-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>
- </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.2.0.Final/connectors/connector-salesforce/pom.xml (from rev 2708, branches/7.2.x/connectors/connector-salesforce/pom.xml)
===================================================================
--- tags/teiid-parent-7.2.0.Final/connectors/connector-salesforce/pom.xml (rev 0)
+++ tags/teiid-parent-7.2.0.Final/connectors/connector-salesforce/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -0,0 +1,70 @@
+<?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.2.0.Final</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>
+ </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.2.0.Final/connectors/connector-ws/pom.xml
===================================================================
--- branches/7.2.x/connectors/connector-ws/pom.xml 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/connectors/connector-ws/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -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.2.0.Final-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.2.0.Final/connectors/connector-ws/pom.xml (from rev 2708, branches/7.2.x/connectors/connector-ws/pom.xml)
===================================================================
--- tags/teiid-parent-7.2.0.Final/connectors/connector-ws/pom.xml (rev 0)
+++ tags/teiid-parent-7.2.0.Final/connectors/connector-ws/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -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.2.0.Final</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.2.0.Final/connectors/pom.xml
===================================================================
--- branches/7.2.x/connectors/pom.xml 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/connectors/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -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>teiid-parent</artifactId>
- <groupId>org.jboss.teiid</groupId>
- <version>7.2.0.Final-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>
- </modules>
-</project>
Copied: tags/teiid-parent-7.2.0.Final/connectors/pom.xml (from rev 2708, branches/7.2.x/connectors/pom.xml)
===================================================================
--- tags/teiid-parent-7.2.0.Final/connectors/pom.xml (rev 0)
+++ tags/teiid-parent-7.2.0.Final/connectors/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -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>teiid-parent</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>7.2.0.Final</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>
+ </modules>
+</project>
Deleted: tags/teiid-parent-7.2.0.Final/connectors/salesforce-api/pom.xml
===================================================================
--- branches/7.2.x/connectors/salesforce-api/pom.xml 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/connectors/salesforce-api/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -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.2.0.Final-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.2.0.Final/connectors/salesforce-api/pom.xml (from rev 2708, branches/7.2.x/connectors/salesforce-api/pom.xml)
===================================================================
--- tags/teiid-parent-7.2.0.Final/connectors/salesforce-api/pom.xml (rev 0)
+++ tags/teiid-parent-7.2.0.Final/connectors/salesforce-api/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -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.2.0.Final</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.2.0.Final/connectors/sandbox/pom.xml
===================================================================
--- branches/7.2.x/connectors/sandbox/pom.xml 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/connectors/sandbox/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -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.2.0.Final-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.2.0.Final/connectors/sandbox/pom.xml (from rev 2708, branches/7.2.x/connectors/sandbox/pom.xml)
===================================================================
--- tags/teiid-parent-7.2.0.Final/connectors/sandbox/pom.xml (rev 0)
+++ tags/teiid-parent-7.2.0.Final/connectors/sandbox/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -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.2.0.Final</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.2.0.Final/connectors/sandbox/translator-yahoo/pom.xml
===================================================================
--- branches/7.2.x/connectors/sandbox/translator-yahoo/pom.xml 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/connectors/sandbox/translator-yahoo/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -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.2.0.Final-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.2.0.Final/connectors/sandbox/translator-yahoo/pom.xml (from rev 2708, branches/7.2.x/connectors/sandbox/translator-yahoo/pom.xml)
===================================================================
--- tags/teiid-parent-7.2.0.Final/connectors/sandbox/translator-yahoo/pom.xml (rev 0)
+++ tags/teiid-parent-7.2.0.Final/connectors/sandbox/translator-yahoo/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -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.2.0.Final</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.2.0.Final/connectors/translator-file/pom.xml
===================================================================
--- branches/7.2.x/connectors/translator-file/pom.xml 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/connectors/translator-file/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -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.2.0.Final-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.2.0.Final/connectors/translator-file/pom.xml (from rev 2708, branches/7.2.x/connectors/translator-file/pom.xml)
===================================================================
--- tags/teiid-parent-7.2.0.Final/connectors/translator-file/pom.xml (rev 0)
+++ tags/teiid-parent-7.2.0.Final/connectors/translator-file/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -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.2.0.Final</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.2.0.Final/connectors/translator-jdbc/pom.xml
===================================================================
--- branches/7.2.x/connectors/translator-jdbc/pom.xml 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/connectors/translator-jdbc/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -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.2.0.Final-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.2.0.Final/connectors/translator-jdbc/pom.xml (from rev 2708, branches/7.2.x/connectors/translator-jdbc/pom.xml)
===================================================================
--- tags/teiid-parent-7.2.0.Final/connectors/translator-jdbc/pom.xml (rev 0)
+++ tags/teiid-parent-7.2.0.Final/connectors/translator-jdbc/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -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.2.0.Final</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.2.0.Final/connectors/translator-ldap/pom.xml
===================================================================
--- branches/7.2.x/connectors/translator-ldap/pom.xml 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/connectors/translator-ldap/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -1,52 +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.2.0.Final-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>translator-ldap</artifactId>
- <groupId>org.jboss.teiid.connectors</groupId>
- <name>LDAP Translator</name>
- <description>LDAP Translator</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.2.0.Final/connectors/translator-ldap/pom.xml (from rev 2708, branches/7.2.x/connectors/translator-ldap/pom.xml)
===================================================================
--- tags/teiid-parent-7.2.0.Final/connectors/translator-ldap/pom.xml (rev 0)
+++ tags/teiid-parent-7.2.0.Final/connectors/translator-ldap/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -0,0 +1,52 @@
+<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.2.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>translator-ldap</artifactId>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <name>LDAP Translator</name>
+ <description>LDAP Translator</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.2.0.Final/connectors/translator-loopback/pom.xml
===================================================================
--- branches/7.2.x/connectors/translator-loopback/pom.xml 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/connectors/translator-loopback/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -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.2.0.Final-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>translator-loopback</artifactId>
- <groupId>org.jboss.teiid.connectors</groupId>
- <name>Loopback Translator</name>
- <description>Loopback Translator</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.2.0.Final/connectors/translator-loopback/pom.xml (from rev 2708, branches/7.2.x/connectors/translator-loopback/pom.xml)
===================================================================
--- tags/teiid-parent-7.2.0.Final/connectors/translator-loopback/pom.xml (rev 0)
+++ tags/teiid-parent-7.2.0.Final/connectors/translator-loopback/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -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.2.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>translator-loopback</artifactId>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <name>Loopback Translator</name>
+ <description>Loopback Translator</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.2.0.Final/connectors/translator-salesforce/pom.xml
===================================================================
--- branches/7.2.x/connectors/translator-salesforce/pom.xml 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/connectors/translator-salesforce/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -1,57 +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.2.0.Final-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>translator-salesforce</artifactId>
- <groupId>org.jboss.teiid.connectors</groupId>
- <name>Salesforce Translator</name>
- <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>
- </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.2.0.Final/connectors/translator-salesforce/pom.xml (from rev 2708, branches/7.2.x/connectors/translator-salesforce/pom.xml)
===================================================================
--- tags/teiid-parent-7.2.0.Final/connectors/translator-salesforce/pom.xml (rev 0)
+++ tags/teiid-parent-7.2.0.Final/connectors/translator-salesforce/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -0,0 +1,57 @@
+<?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.2.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>translator-salesforce</artifactId>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <name>Salesforce Translator</name>
+ <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>
+ </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.2.0.Final/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/execution/QueryExecutionImpl.java
===================================================================
--- branches/7.2.x/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/execution/QueryExecutionImpl.java 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/execution/QueryExecutionImpl.java 2010-11-05 03:19:55 UTC (rev 2709)
@@ -1,369 +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.salesforce.execution;
-
-import java.sql.Timestamp;
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.resource.ResourceException;
-import javax.xml.namespace.QName;
-
-import org.teiid.language.AggregateFunction;
-import org.teiid.language.Join;
-import org.teiid.language.QueryExpression;
-import org.teiid.language.Select;
-import org.teiid.language.TableReference;
-import org.teiid.logging.LogConstants;
-import org.teiid.logging.LogManager;
-import org.teiid.metadata.AbstractMetadataRecord;
-import org.teiid.metadata.Column;
-import org.teiid.metadata.RuntimeMetadata;
-import org.teiid.metadata.Table;
-import org.teiid.translator.DataNotAvailableException;
-import org.teiid.translator.ExecutionContext;
-import org.teiid.translator.ResultSetExecution;
-import org.teiid.translator.TranslatorException;
-import org.teiid.translator.salesforce.SalesForcePlugin;
-import org.teiid.translator.salesforce.SalesforceConnection;
-import org.teiid.translator.salesforce.Util;
-import org.teiid.translator.salesforce.execution.visitors.JoinQueryVisitor;
-import org.teiid.translator.salesforce.execution.visitors.SelectVisitor;
-import org.w3c.dom.Element;
-
-import com.sforce.soap.partner.QueryResult;
-import com.sforce.soap.partner.sobject.SObject;
-
-public class QueryExecutionImpl implements ResultSetExecution {
-
- private SalesforceConnection connection;
-
- private RuntimeMetadata metadata;
-
- private ExecutionContext context;
-
-
- private SelectVisitor visitor;
-
- private QueryResult results;
-
- private List<List<Object>> resultBatch;
-
- // Identifying values
- private String connectionIdentifier;
-
- private String connectorIdentifier;
-
- private String requestIdentifier;
-
- private String partIdentifier;
-
- private String logPreamble;
-
- private QueryExpression query;
-
- Map<String, Map<String,Integer>> sObjectToResponseField = new HashMap<String, Map<String,Integer>>();
-
- private int topResultIndex = 0;
-
- public QueryExecutionImpl(QueryExpression command, SalesforceConnection connection, RuntimeMetadata metadata, ExecutionContext context) {
- this.connection = connection;
- this.metadata = metadata;
- this.context = context;
- this.query = command;
-
- connectionIdentifier = context.getConnectionIdentifier();
- connectorIdentifier = context.getConnectorIdentifier();
- requestIdentifier = context.getRequestIdentifier();
- partIdentifier = context.getPartIdentifier();
- }
-
- public void cancel() throws TranslatorException {
- LogManager.logDetail(LogConstants.CTX_CONNECTOR, SalesForcePlugin.Util.getString("SalesforceQueryExecutionImpl.cancel"));//$NON-NLS-1$
- }
-
- public void close() {
- LogManager.logDetail(LogConstants.CTX_CONNECTOR, SalesForcePlugin.Util.getString("SalesforceQueryExecutionImpl.close")); //$NON-NLS-1$
- }
-
- @Override
- public void execute() throws TranslatorException {
- try {
- LogManager.logDetail(LogConstants.CTX_CONNECTOR, getLogPreamble(), "Incoming Query:", query); //$NON-NLS-1$
- List<TableReference> from = ((Select)query).getFrom();
- String finalQuery;
- if(from.get(0) instanceof Join) {
- visitor = new JoinQueryVisitor(metadata);
- visitor.visitNode(query);
- finalQuery = visitor.getQuery().trim();
- LogManager.logDetail(LogConstants.CTX_CONNECTOR, getLogPreamble(), "Executing Query:", finalQuery); //$NON-NLS-1$
-
- results = connection.query(finalQuery, this.context.getBatchSize(), visitor.getQueryAll());
- } else {
- visitor = new SelectVisitor(metadata);
- visitor.visitNode(query);
- if(visitor.canRetrieve()) {
- results = connection.retrieve(visitor.getRetrieveFieldList(),
- visitor.getTableName(), visitor.getIdInCriteria());
- } else {
- finalQuery = visitor.getQuery().trim();
- LogManager.logDetail(LogConstants.CTX_CONNECTOR, getLogPreamble(), "Executing Query:", finalQuery); //$NON-NLS-1$
- results = connection.query(finalQuery, this.context.getBatchSize(), visitor.getQueryAll());
- }
- }
- } catch (ResourceException e) {
- throw new TranslatorException(e);
- }
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public List next() throws TranslatorException, DataNotAvailableException {
- List<?> result;
- if (query.getProjectedQuery().getDerivedColumns().get(0)
- .getExpression() instanceof AggregateFunction) {
- if (results == null) {
- return null;
- }
- result = Arrays.asList(results.getSize());
- results = null;
-
- } else {
- result = getRow(results);
- }
- return result;
- }
-
- private List<Object> getRow(QueryResult result) throws TranslatorException {
- List<Object> row;
- if(null == resultBatch) {
- loadBatch();
- }
- if(resultBatch.size() == topResultIndex) {
- row = null;
- } else {
- row = resultBatch.get(topResultIndex);
- topResultIndex++;
- if(resultBatch.size() == topResultIndex) {
- if(!result.isDone()) {
- loadBatch();
- }
- }
-
- }
- return row;
- }
-
- private void loadBatch() throws TranslatorException {
- try {
- if(null != resultBatch) { // if we have an old batch, then we have to get new results
- results = connection.queryMore(results.getQueryLocator(), context.getBatchSize());
- }
- resultBatch = new ArrayList<List<Object>>();
-
- for(SObject sObject : results.getRecords()) {
- List<Object[]> result = getObjectData(sObject);
- for(Iterator<Object[]> i = result.iterator(); i.hasNext(); ) {
- resultBatch.add(Arrays.asList(i.next()));
- }
- }
- } catch (ResourceException e) {
- throw new TranslatorException(e);
- }
- }
-
- private List<Object[]> getObjectData(SObject sObject) throws TranslatorException {
- List<Object> topFields = sObject.getAny();
- logAndMapFields(sObject.getType(), topFields);
- List<Object[]> result = new ArrayList<Object[]>();
- for(int i = 0; i < topFields.size(); i++) {
- Element element = (Element) topFields.get(i);
- QName qName = new QName(element.getNamespaceURI(), element.getLocalName());
- if(null != qName) {
- String type = qName.getLocalPart();
- if(type.equals("sObject")) { //$NON-NLS-1$
- //SObject parent = (SObject)element.;
- //result.addAll(getObjectData(parent));
- } else if(type.equals("QueryResult")) { //$NON-NLS-1$
- //QueryResult subResult = (QueryResult)element.getValue();
- //for(int resultIndex = 0; resultIndex < subResult.getSize(); resultIndex++) {
- // SObject subObject = subResult.getRecords().get(resultIndex);
- // result.addAll(getObjectData(subObject));
- //}
- }
- }
- }
- return extractDataFromFields(sObject, topFields, result);
-
- }
-
- private List<Object[]> extractDataFromFields(SObject sObject,
- List<Object> fields, List<Object[]> result) throws TranslatorException {
- Map<String,Integer> fieldToIndexMap = sObjectToResponseField.get(sObject.getType());
- for (int j = 0; j < visitor.getSelectSymbolCount(); j++) {
- Column element = visitor.getSelectSymbolMetadata(j);
- AbstractMetadataRecord parent = element.getParent();
- Table table;
- if(parent instanceof Table) {
- table = (Table)parent;
- } else {
- parent = parent.getParent();
- if(parent instanceof Table) {
- table = (Table)parent;
- } else {
- throw new TranslatorException("Could not resolve Table for column " + element.getName()); //$NON-NLS-1$
- }
- }
- if(table.getNameInSource().equals(sObject.getType())) {
- Integer index = fieldToIndexMap.get(element.getNameInSource());
- // id gets dropped from the result if it is not the
- // first field in the querystring. Add it back in.
- if (null == index) {
- if (element.getNameInSource().equalsIgnoreCase("id")) { //$NON-NLS-1$
- setValueInColumn(j, sObject.getId(), result);
- } else {
- throw new TranslatorException(SalesForcePlugin.Util.getString("SalesforceQueryExecutionImpl.missing.field")+ element.getNameInSource()); //$NON-NLS-1$
- }
- } else {
- Object cell;
- cell = getCellDatum(element, (Element)fields.get(index));
- setValueInColumn(j, cell, result);
- }
- }
- }
- return result;
- }
-
- private void setValueInColumn(int columnIndex, Object value, List<Object[]> result) {
- if(result.isEmpty()) {
- Object[] row = new Object[visitor.getSelectSymbolCount()];
- result.add(row);
- }
- Iterator<Object[]> iter = result.iterator();
- while (iter.hasNext()) {
- Object[] row = iter.next();
- row[columnIndex] = value;
- }
- }
-
- /**
- * Load the map of response field names to index.
- * @param fields
- * @throws TranslatorException
- */
- private void logAndMapFields(String sObjectName,
- List<Object> fields) throws TranslatorException {
- if (!sObjectToResponseField.containsKey(sObjectName)) {
- logFields(sObjectName, fields);
- Map<String, Integer> responseFieldToIndexMap;
- responseFieldToIndexMap = new HashMap<String, Integer>();
- for (int x = 0; x < fields.size(); x++) {
- Element element = (Element) fields.get(x);
- responseFieldToIndexMap.put(element.getLocalName(), x);
- }
- sObjectToResponseField.put(sObjectName, responseFieldToIndexMap);
- }
- }
-
- private void logFields(String sObjectName, List<Object> fields) throws TranslatorException {
- LogManager.logDetail(LogConstants.CTX_CONNECTOR, "SalesForce Object Name = " + sObjectName); //$NON-NLS-1$
- LogManager.logDetail(LogConstants.CTX_CONNECTOR, "FieldCount = " + fields.size()); //$NON-NLS-1$
- for(int i = 0; i < fields.size(); i++) {
- Element element;
- element = (Element) fields.get(i);
- LogManager.logDetail(LogConstants.CTX_CONNECTOR, "Field # " + i + " is " + element.getLocalName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- }
-
- @SuppressWarnings("unchecked")
- private Object getCellDatum(Column element, Element elem) throws TranslatorException {
- if(!element.getNameInSource().equals(elem.getLocalName())) {
- throw new TranslatorException(SalesForcePlugin.Util.getString("SalesforceQueryExecutionImpl.column.mismatch1") + element.getNameInSource() + SalesForcePlugin.Util.getString("SalesforceQueryExecutionImpl.column.mismatch2") + elem.getLocalName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
- String value = elem.getTextContent();
- Object result = null;
- Class type = element.getJavaType();
-
- if(type.equals(String.class)) {
- result = value;
- }
- else if (type.equals(Boolean.class)) {
- result = Boolean.valueOf(value);
- } else if (type.equals(Double.class)) {
- if (null != value) {
- if(!value.isEmpty()) {
- result = Double.valueOf(value);
- }
- }
- } else if (type.equals(Integer.class)) {
- if (null != value) {
- if(!value.isEmpty()) {
- result = Integer.valueOf(value);
- }
- }
- } else if (type.equals(java.sql.Date.class)) {
- if (null != value) {
- if(!value.isEmpty()) {
- result = java.sql.Date.valueOf(value);
- }
- }
- } else if (type.equals(java.sql.Timestamp.class)) {
- if (null != value) {
- if(!value.isEmpty()) {
- try {
- Date date = Util.getSalesforceDateTimeFormat().parse(value);
- result = new Timestamp(date.getTime());
- } catch (ParseException e) {
- throw new TranslatorException(e, SalesForcePlugin.Util.getString("SalesforceQueryExecutionImpl.datatime.parse") + value); //$NON-NLS-1$
- }
- }
- }
- } else {
- result = value;
- }
- return result;
- }
-
-
- private String getLogPreamble() {
- if (null == logPreamble) {
- StringBuffer preamble = new StringBuffer();
- preamble.append(connectorIdentifier);
- preamble.append('.');
- preamble.append(connectionIdentifier);
- preamble.append('.');
- preamble.append(requestIdentifier);
- preamble.append('.');
- preamble.append(partIdentifier);
- preamble.append(": "); //$NON-NLS-1$
- logPreamble = preamble.toString();
- }
- return logPreamble;
- }
-}
Copied: tags/teiid-parent-7.2.0.Final/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/execution/QueryExecutionImpl.java (from rev 2707, branches/7.2.x/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/execution/QueryExecutionImpl.java)
===================================================================
--- tags/teiid-parent-7.2.0.Final/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/execution/QueryExecutionImpl.java (rev 0)
+++ tags/teiid-parent-7.2.0.Final/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/execution/QueryExecutionImpl.java 2010-11-05 03:19:55 UTC (rev 2709)
@@ -0,0 +1,373 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with 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.salesforce.execution;
+
+import java.sql.Timestamp;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.resource.ResourceException;
+import javax.xml.namespace.QName;
+
+import org.teiid.language.AggregateFunction;
+import org.teiid.language.Join;
+import org.teiid.language.QueryExpression;
+import org.teiid.language.Select;
+import org.teiid.language.TableReference;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.logging.MessageLevel;
+import org.teiid.metadata.AbstractMetadataRecord;
+import org.teiid.metadata.Column;
+import org.teiid.metadata.RuntimeMetadata;
+import org.teiid.metadata.Table;
+import org.teiid.translator.DataNotAvailableException;
+import org.teiid.translator.ExecutionContext;
+import org.teiid.translator.ResultSetExecution;
+import org.teiid.translator.TranslatorException;
+import org.teiid.translator.salesforce.SalesForcePlugin;
+import org.teiid.translator.salesforce.SalesforceConnection;
+import org.teiid.translator.salesforce.Util;
+import org.teiid.translator.salesforce.execution.visitors.JoinQueryVisitor;
+import org.teiid.translator.salesforce.execution.visitors.SelectVisitor;
+import org.w3c.dom.Element;
+
+import com.sforce.soap.partner.QueryResult;
+import com.sforce.soap.partner.sobject.SObject;
+
+public class QueryExecutionImpl implements ResultSetExecution {
+
+ private SalesforceConnection connection;
+
+ private RuntimeMetadata metadata;
+
+ private ExecutionContext context;
+
+
+ private SelectVisitor visitor;
+
+ private QueryResult results;
+
+ private List<List<Object>> resultBatch;
+
+ // Identifying values
+ private String connectionIdentifier;
+
+ private String connectorIdentifier;
+
+ private String requestIdentifier;
+
+ private String partIdentifier;
+
+ private String logPreamble;
+
+ private QueryExpression query;
+
+ Map<String, Map<String,Integer>> sObjectToResponseField = new HashMap<String, Map<String,Integer>>();
+
+ private int topResultIndex = 0;
+
+ public QueryExecutionImpl(QueryExpression command, SalesforceConnection connection, RuntimeMetadata metadata, ExecutionContext context) {
+ this.connection = connection;
+ this.metadata = metadata;
+ this.context = context;
+ this.query = command;
+
+ connectionIdentifier = context.getConnectionIdentifier();
+ connectorIdentifier = context.getConnectorIdentifier();
+ requestIdentifier = context.getRequestIdentifier();
+ partIdentifier = context.getPartIdentifier();
+ }
+
+ public void cancel() throws TranslatorException {
+ LogManager.logDetail(LogConstants.CTX_CONNECTOR, SalesForcePlugin.Util.getString("SalesforceQueryExecutionImpl.cancel"));//$NON-NLS-1$
+ }
+
+ public void close() {
+ LogManager.logDetail(LogConstants.CTX_CONNECTOR, SalesForcePlugin.Util.getString("SalesforceQueryExecutionImpl.close")); //$NON-NLS-1$
+ }
+
+ @Override
+ public void execute() throws TranslatorException {
+ try {
+ LogManager.logDetail(LogConstants.CTX_CONNECTOR, getLogPreamble(), "Incoming Query:", query); //$NON-NLS-1$
+ List<TableReference> from = ((Select)query).getFrom();
+ String finalQuery;
+ if(from.get(0) instanceof Join) {
+ visitor = new JoinQueryVisitor(metadata);
+ visitor.visitNode(query);
+ finalQuery = visitor.getQuery().trim();
+ LogManager.logDetail(LogConstants.CTX_CONNECTOR, getLogPreamble(), "Executing Query:", finalQuery); //$NON-NLS-1$
+
+ results = connection.query(finalQuery, this.context.getBatchSize(), visitor.getQueryAll());
+ } else {
+ visitor = new SelectVisitor(metadata);
+ visitor.visitNode(query);
+ if(visitor.canRetrieve()) {
+ results = connection.retrieve(visitor.getRetrieveFieldList(),
+ visitor.getTableName(), visitor.getIdInCriteria());
+ } else {
+ finalQuery = visitor.getQuery().trim();
+ LogManager.logDetail(LogConstants.CTX_CONNECTOR, getLogPreamble(), "Executing Query:", finalQuery); //$NON-NLS-1$
+ results = connection.query(finalQuery, this.context.getBatchSize(), visitor.getQueryAll());
+ }
+ }
+ } catch (ResourceException e) {
+ throw new TranslatorException(e);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List next() throws TranslatorException, DataNotAvailableException {
+ List<?> result;
+ if (query.getProjectedQuery().getDerivedColumns().get(0)
+ .getExpression() instanceof AggregateFunction) {
+ if (results == null) {
+ return null;
+ }
+ result = Arrays.asList(results.getSize());
+ results = null;
+
+ } else {
+ result = getRow(results);
+ }
+ return result;
+ }
+
+ private List<Object> getRow(QueryResult result) throws TranslatorException {
+ List<Object> row;
+ if(null == resultBatch) {
+ loadBatch();
+ }
+ if(resultBatch.size() == topResultIndex) {
+ row = null;
+ } else {
+ row = resultBatch.get(topResultIndex);
+ topResultIndex++;
+ if(resultBatch.size() == topResultIndex) {
+ if(!result.isDone()) {
+ loadBatch();
+ }
+ }
+
+ }
+ return row;
+ }
+
+ private void loadBatch() throws TranslatorException {
+ try {
+ if(null != resultBatch) { // if we have an old batch, then we have to get new results
+ results = connection.queryMore(results.getQueryLocator(), context.getBatchSize());
+ }
+ resultBatch = new ArrayList<List<Object>>();
+ topResultIndex = 0;
+ for(SObject sObject : results.getRecords()) {
+ List<Object[]> result = getObjectData(sObject);
+ for(Iterator<Object[]> i = result.iterator(); i.hasNext(); ) {
+ resultBatch.add(Arrays.asList(i.next()));
+ }
+ }
+ } catch (ResourceException e) {
+ throw new TranslatorException(e);
+ }
+ }
+
+ private List<Object[]> getObjectData(SObject sObject) throws TranslatorException {
+ List<Object> topFields = sObject.getAny();
+ logAndMapFields(sObject.getType(), topFields);
+ List<Object[]> result = new ArrayList<Object[]>();
+ for(int i = 0; i < topFields.size(); i++) {
+ Element element = (Element) topFields.get(i);
+ QName qName = new QName(element.getNamespaceURI(), element.getLocalName());
+ if(null != qName) {
+ String type = qName.getLocalPart();
+ if(type.equals("sObject")) { //$NON-NLS-1$
+ //SObject parent = (SObject)element.;
+ //result.addAll(getObjectData(parent));
+ } else if(type.equals("QueryResult")) { //$NON-NLS-1$
+ //QueryResult subResult = (QueryResult)element.getValue();
+ //for(int resultIndex = 0; resultIndex < subResult.getSize(); resultIndex++) {
+ // SObject subObject = subResult.getRecords().get(resultIndex);
+ // result.addAll(getObjectData(subObject));
+ //}
+ }
+ }
+ }
+ return extractDataFromFields(sObject, topFields, result);
+
+ }
+
+ private List<Object[]> extractDataFromFields(SObject sObject,
+ List<Object> fields, List<Object[]> result) throws TranslatorException {
+ Map<String,Integer> fieldToIndexMap = sObjectToResponseField.get(sObject.getType());
+ for (int j = 0; j < visitor.getSelectSymbolCount(); j++) {
+ Column element = visitor.getSelectSymbolMetadata(j);
+ AbstractMetadataRecord parent = element.getParent();
+ Table table;
+ if(parent instanceof Table) {
+ table = (Table)parent;
+ } else {
+ parent = parent.getParent();
+ if(parent instanceof Table) {
+ table = (Table)parent;
+ } else {
+ throw new TranslatorException("Could not resolve Table for column " + element.getName()); //$NON-NLS-1$
+ }
+ }
+ if(table.getNameInSource().equals(sObject.getType())) {
+ Integer index = fieldToIndexMap.get(element.getNameInSource());
+ // id gets dropped from the result if it is not the
+ // first field in the querystring. Add it back in.
+ if (null == index) {
+ if (element.getNameInSource().equalsIgnoreCase("id")) { //$NON-NLS-1$
+ setValueInColumn(j, sObject.getId(), result);
+ } else {
+ throw new TranslatorException(SalesForcePlugin.Util.getString("SalesforceQueryExecutionImpl.missing.field")+ element.getNameInSource()); //$NON-NLS-1$
+ }
+ } else {
+ Object cell;
+ cell = getCellDatum(element, (Element)fields.get(index));
+ setValueInColumn(j, cell, result);
+ }
+ }
+ }
+ return result;
+ }
+
+ private void setValueInColumn(int columnIndex, Object value, List<Object[]> result) {
+ if(result.isEmpty()) {
+ Object[] row = new Object[visitor.getSelectSymbolCount()];
+ result.add(row);
+ }
+ Iterator<Object[]> iter = result.iterator();
+ while (iter.hasNext()) {
+ Object[] row = iter.next();
+ row[columnIndex] = value;
+ }
+ }
+
+ /**
+ * Load the map of response field names to index.
+ * @param fields
+ * @throws TranslatorException
+ */
+ private void logAndMapFields(String sObjectName,
+ List<Object> fields) throws TranslatorException {
+ if (!sObjectToResponseField.containsKey(sObjectName)) {
+ logFields(sObjectName, fields);
+ Map<String, Integer> responseFieldToIndexMap;
+ responseFieldToIndexMap = new HashMap<String, Integer>();
+ for (int x = 0; x < fields.size(); x++) {
+ Element element = (Element) fields.get(x);
+ responseFieldToIndexMap.put(element.getLocalName(), x);
+ }
+ sObjectToResponseField.put(sObjectName, responseFieldToIndexMap);
+ }
+ }
+
+ private void logFields(String sObjectName, List<Object> fields) throws TranslatorException {
+ if (!LogManager.isMessageToBeRecorded(LogConstants.CTX_CONNECTOR, MessageLevel.DETAIL)) {
+ return;
+ }
+ LogManager.logDetail(LogConstants.CTX_CONNECTOR, "SalesForce Object Name = " + sObjectName); //$NON-NLS-1$
+ LogManager.logDetail(LogConstants.CTX_CONNECTOR, "FieldCount = " + fields.size()); //$NON-NLS-1$
+ for(int i = 0; i < fields.size(); i++) {
+ Element element;
+ element = (Element) fields.get(i);
+ LogManager.logDetail(LogConstants.CTX_CONNECTOR, "Field # " + i + " is " + element.getLocalName()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ }
+
+ @SuppressWarnings("unchecked")
+ private Object getCellDatum(Column element, Element elem) throws TranslatorException {
+ if(!element.getNameInSource().equals(elem.getLocalName())) {
+ throw new TranslatorException(SalesForcePlugin.Util.getString("SalesforceQueryExecutionImpl.column.mismatch1") + element.getNameInSource() + SalesForcePlugin.Util.getString("SalesforceQueryExecutionImpl.column.mismatch2") + elem.getLocalName()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ String value = elem.getTextContent();
+ Object result = null;
+ Class type = element.getJavaType();
+
+ if(type.equals(String.class)) {
+ result = value;
+ }
+ else if (type.equals(Boolean.class)) {
+ result = Boolean.valueOf(value);
+ } else if (type.equals(Double.class)) {
+ if (null != value) {
+ if(!value.isEmpty()) {
+ result = Double.valueOf(value);
+ }
+ }
+ } else if (type.equals(Integer.class)) {
+ if (null != value) {
+ if(!value.isEmpty()) {
+ result = Integer.valueOf(value);
+ }
+ }
+ } else if (type.equals(java.sql.Date.class)) {
+ if (null != value) {
+ if(!value.isEmpty()) {
+ result = java.sql.Date.valueOf(value);
+ }
+ }
+ } else if (type.equals(java.sql.Timestamp.class)) {
+ if (null != value) {
+ if(!value.isEmpty()) {
+ try {
+ Date date = Util.getSalesforceDateTimeFormat().parse(value);
+ result = new Timestamp(date.getTime());
+ } catch (ParseException e) {
+ throw new TranslatorException(e, SalesForcePlugin.Util.getString("SalesforceQueryExecutionImpl.datatime.parse") + value); //$NON-NLS-1$
+ }
+ }
+ }
+ } else {
+ result = value;
+ }
+ return result;
+ }
+
+
+ private String getLogPreamble() {
+ if (null == logPreamble) {
+ StringBuffer preamble = new StringBuffer();
+ preamble.append(connectorIdentifier);
+ preamble.append('.');
+ preamble.append(connectionIdentifier);
+ preamble.append('.');
+ preamble.append(requestIdentifier);
+ preamble.append('.');
+ preamble.append(partIdentifier);
+ preamble.append(": "); //$NON-NLS-1$
+ logPreamble = preamble.toString();
+ }
+ return logPreamble;
+ }
+}
Copied: tags/teiid-parent-7.2.0.Final/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/TestQueryExecutionImpl.java (from rev 2707, branches/7.2.x/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/TestQueryExecutionImpl.java)
===================================================================
--- tags/teiid-parent-7.2.0.Final/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/TestQueryExecutionImpl.java (rev 0)
+++ tags/teiid-parent-7.2.0.Final/connectors/translator-salesforce/src/test/java/org/teiid/translator/salesforce/execution/TestQueryExecutionImpl.java 2010-11-05 03:19:55 UTC (rev 2709)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with 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.salesforce.execution;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.teiid.cdk.api.TranslationUtility;
+import org.teiid.language.Select;
+import org.teiid.metadata.RuntimeMetadata;
+import org.teiid.translator.ExecutionContext;
+import org.teiid.translator.salesforce.SalesforceConnection;
+import org.teiid.translator.salesforce.execution.visitors.TestVisitors;
+import org.w3c.dom.Element;
+
+import com.sforce.soap.partner.QueryResult;
+import com.sforce.soap.partner.sobject.SObject;
+
+@SuppressWarnings("nls")
+public class TestQueryExecutionImpl {
+
+ private static TranslationUtility translationUtility = new TranslationUtility(TestVisitors.exampleSalesforce());
+
+ @Test public void testBatching() throws Exception {
+ Select command = (Select)translationUtility.parseCommand("select Name from Account"); //$NON-NLS-1$
+ SalesforceConnection sfc = Mockito.mock(SalesforceConnection.class);
+ QueryResult qr = new QueryResult();
+ SObject so = new SObject();
+ so.setType("Account");
+ Element elem = Mockito.mock(Element.class);
+ Mockito.stub(elem.getLocalName()).toReturn("AccountName");
+ so.getAny().add(elem);
+ qr.getRecords().add(so);
+ qr.setDone(false);
+ QueryResult finalQr = new QueryResult();
+ so.getAny().add(elem);
+ finalQr.getRecords().add(so);
+ finalQr.setDone(true);
+ Mockito.stub(sfc.query("SELECT Account.AccountName FROM Account", 0, false)).toReturn(qr);
+ Mockito.stub(sfc.queryMore(null, 0)).toReturn(finalQr);
+ QueryExecutionImpl qei = new QueryExecutionImpl(command, sfc, Mockito.mock(RuntimeMetadata.class), Mockito.mock(ExecutionContext.class));
+ qei.execute();
+ assertNotNull(qei.next());
+ assertNotNull(qei.next());
+ assertNull(qei.next());
+ }
+
+}
Deleted: tags/teiid-parent-7.2.0.Final/connectors/translator-ws/pom.xml
===================================================================
--- branches/7.2.x/connectors/translator-ws/pom.xml 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/connectors/translator-ws/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -1,63 +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.2.0.Final-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>translator-ws</artifactId>
- <groupId>org.jboss.teiid.connectors</groupId>
- <name>Web service Translator</name>
- <description>This translator provides access to 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>log4j</groupId>
- <artifactId>log4j</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</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.2.0.Final/connectors/translator-ws/pom.xml (from rev 2708, branches/7.2.x/connectors/translator-ws/pom.xml)
===================================================================
--- tags/teiid-parent-7.2.0.Final/connectors/translator-ws/pom.xml (rev 0)
+++ tags/teiid-parent-7.2.0.Final/connectors/translator-ws/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -0,0 +1,63 @@
+<?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.2.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>translator-ws</artifactId>
+ <groupId>org.jboss.teiid.connectors</groupId>
+ <name>Web service Translator</name>
+ <description>This translator provides access to 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>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</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.2.0.Final/console/pom.xml
===================================================================
--- branches/7.2.x/console/pom.xml 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/console/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -1,181 +0,0 @@
-<?xml version="1.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.2.0.Final-SNAPSHOT</version>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>teiid-console</artifactId>
- <name>Console</name>
- <description>This project is for the RHQ plugin that supports the TEIID Console </description>
-
- <properties>
- <!--
- <org.jboss.jopr.as4.version>1.2.0.GA</org.jboss.jopr.as4.version>
- -->
- <org.jboss.jopr.as5.version>1.2.0.GA</org.jboss.jopr.as5.version>
- <jopr.jboss.as5.plugin.version>1.4.0.B01</jopr.jboss.as5.plugin.version>
- <org.rhq.version>1.3.0.GA</org.rhq.version>
- <apache.ant.version>1.7.0</apache.ant.version>
-
-
- </properties>
-
- <dependencies>
- <!--
- Below are the core modules that are required dependencies of all
- plugins
- -->
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-core-domain</artifactId>
- <version>${org.rhq.version}</version>
- <scope>provided</scope>
- <!--
- provided by the agent/plugin-container
- -->
- </dependency>
-
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-core-plugin-api</artifactId>
- <version>${org.rhq.version}</version>
- <scope>provided</scope> <!-- provided by the agent/plugin-container -->
- </dependency>
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-core-native-system</artifactId>
- <version>${org.rhq.version}</version>
- <scope>provided</scope> <!-- provided by the agent/plugin-container -->
- </dependency>
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-jmx-plugin</artifactId>
- <version>${org.rhq.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-core-util</artifactId>
- <version>${org.rhq.version}</version>
- </dependency>
-
- <dependency>
- <groupId>mc4j</groupId>
- <artifactId>org-mc4j-ems</artifactId>
- <version>1.2.6</version>
- </dependency>
-
- <!--
- TODO: This is a fix for the Javac bug requiring annotations to be
- available when compiling dependent classes. It is fixed in JDK 6.
- -->
- <dependency>
- <groupId>javax.persistence</groupId>
- <artifactId>persistence-api</artifactId>
- <version>1.0</version>
- <scope>provided</scope> <!-- provided by the agent/plugin-container -->
- </dependency>
-
-
- <!--
- TODO: This is a fix for the Javac bug requiring annotations to be
- available when compiling dependent classes; it is fixed in JDK 6.
- -->
- <dependency>
- <groupId>jboss.jboss-embeddable-ejb3</groupId>
- <artifactId>hibernate-all</artifactId>
- <version>1.0.0.Alpha9</version>
- <scope>provided</scope> <!-- provided by the agent/plugin-container -->
- </dependency>
-
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1</version>
- <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-client</artifactId>
- <type>test-jar</type>
- </dependency>
-
- <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.jopr</groupId>
- <artifactId>jopr-embedded-jbas5</artifactId>
- <type>war</type>
- <version>${org.jboss.jopr.as5.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.integration</groupId>
- <artifactId>jboss-profileservice-spi</artifactId>
- <version>5.1.0.CR2</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.on</groupId>
- <artifactId>jopr-jboss-as-5-plugin</artifactId>
- <version>${jopr.jboss.as5.plugin.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-io</artifactId>
- <version>1.3.2</version>
- </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>
\ No newline at end of file
Copied: tags/teiid-parent-7.2.0.Final/console/pom.xml (from rev 2708, branches/7.2.x/console/pom.xml)
===================================================================
--- tags/teiid-parent-7.2.0.Final/console/pom.xml (rev 0)
+++ tags/teiid-parent-7.2.0.Final/console/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -0,0 +1,181 @@
+<?xml version="1.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.2.0.Final</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>teiid-console</artifactId>
+ <name>Console</name>
+ <description>This project is for the RHQ plugin that supports the TEIID Console </description>
+
+ <properties>
+ <!--
+ <org.jboss.jopr.as4.version>1.2.0.GA</org.jboss.jopr.as4.version>
+ -->
+ <org.jboss.jopr.as5.version>1.2.0.GA</org.jboss.jopr.as5.version>
+ <jopr.jboss.as5.plugin.version>1.4.0.B01</jopr.jboss.as5.plugin.version>
+ <org.rhq.version>1.3.0.GA</org.rhq.version>
+ <apache.ant.version>1.7.0</apache.ant.version>
+
+
+ </properties>
+
+ <dependencies>
+ <!--
+ Below are the core modules that are required dependencies of all
+ plugins
+ -->
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-domain</artifactId>
+ <version>${org.rhq.version}</version>
+ <scope>provided</scope>
+ <!--
+ provided by the agent/plugin-container
+ -->
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-plugin-api</artifactId>
+ <version>${org.rhq.version}</version>
+ <scope>provided</scope> <!-- provided by the agent/plugin-container -->
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-native-system</artifactId>
+ <version>${org.rhq.version}</version>
+ <scope>provided</scope> <!-- provided by the agent/plugin-container -->
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-jmx-plugin</artifactId>
+ <version>${org.rhq.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-util</artifactId>
+ <version>${org.rhq.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>mc4j</groupId>
+ <artifactId>org-mc4j-ems</artifactId>
+ <version>1.2.6</version>
+ </dependency>
+
+ <!--
+ TODO: This is a fix for the Javac bug requiring annotations to be
+ available when compiling dependent classes. It is fixed in JDK 6.
+ -->
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope> <!-- provided by the agent/plugin-container -->
+ </dependency>
+
+
+ <!--
+ TODO: This is a fix for the Javac bug requiring annotations to be
+ available when compiling dependent classes; it is fixed in JDK 6.
+ -->
+ <dependency>
+ <groupId>jboss.jboss-embeddable-ejb3</groupId>
+ <artifactId>hibernate-all</artifactId>
+ <version>1.0.0.Alpha9</version>
+ <scope>provided</scope> <!-- provided by the agent/plugin-container -->
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ <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-client</artifactId>
+ <type>test-jar</type>
+ </dependency>
+
+ <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.jopr</groupId>
+ <artifactId>jopr-embedded-jbas5</artifactId>
+ <type>war</type>
+ <version>${org.jboss.jopr.as5.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.integration</groupId>
+ <artifactId>jboss-profileservice-spi</artifactId>
+ <version>5.1.0.CR2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.on</groupId>
+ <artifactId>jopr-jboss-as-5-plugin</artifactId>
+ <version>${jopr.jboss.as5.plugin.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.3.2</version>
+ </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>
\ No newline at end of file
Deleted: tags/teiid-parent-7.2.0.Final/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
===================================================================
--- branches/7.2.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java 2010-11-05 03:19:55 UTC (rev 2709)
@@ -1,887 +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.rhq.admin;
-
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.naming.NamingException;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.managed.api.ManagedComponent;
-import org.jboss.managed.api.ManagedOperation;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.plugins.ManagedObjectImpl;
-import org.jboss.metatype.api.types.MetaType;
-import org.jboss.metatype.api.values.CollectionValueSupport;
-import org.jboss.metatype.api.values.CompositeValueSupport;
-import org.jboss.metatype.api.values.GenericValueSupport;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.metatype.api.values.MetaValueFactory;
-import org.jboss.metatype.api.values.SimpleValue;
-import org.jboss.metatype.api.values.SimpleValueSupport;
-import org.rhq.plugins.jbossas5.connection.ProfileServiceConnection;
-import org.teiid.adminapi.Admin;
-import org.teiid.adminapi.Request;
-import org.teiid.adminapi.Session;
-import org.teiid.adminapi.Transaction;
-import org.teiid.adminapi.VDB.Status;
-import org.teiid.adminapi.impl.RequestMetadata;
-import org.teiid.adminapi.impl.RequestMetadataMapper;
-import org.teiid.rhq.plugin.objects.ExecutedResult;
-import org.teiid.rhq.plugin.util.DeploymentUtils;
-import org.teiid.rhq.plugin.util.PluginConstants;
-import org.teiid.rhq.plugin.util.ProfileServiceUtil;
-import org.teiid.rhq.plugin.util.PluginConstants.ComponentType.Platform;
-import org.teiid.rhq.plugin.util.PluginConstants.ComponentType.VDB;
-
-public class DQPManagementView implements PluginConstants {
-
- private static ManagedComponent mc = null;
- private static final Log LOG = LogFactory
- .getLog(PluginConstants.DEFAULT_LOGGER_CATEGORY);
- private static final MetaValueFactory metaValueFactory = MetaValueFactory
- .getInstance();
-
- private static final String VDB_EXT = ".vdb"; //$NON-NLS-1$
-
- public DQPManagementView() {
- }
-
- /*
- * Metric methods
- */
- public Object getMetric(ProfileServiceConnection connection,
- String componentType, String identifier, String metric,
- Map<String, Object> valueMap) {
- Object resultObject = new Object();
-
- if (componentType.equals(PluginConstants.ComponentType.Platform.NAME)) {
- resultObject = getPlatformMetric(connection, componentType, metric,
- valueMap);
- } else if (componentType.equals(PluginConstants.ComponentType.VDB.NAME)) {
- resultObject = getVdbMetric(connection, componentType, identifier,
- metric, valueMap);
- }
-
- return resultObject;
- }
-
- private Object getPlatformMetric(ProfileServiceConnection connection,
- String componentType, String metric, Map<String, Object> valueMap) {
-
- Object resultObject = new Object();
-
- if (metric
- .equals(PluginConstants.ComponentType.Platform.Metrics.QUERY_COUNT)) {
- resultObject = new Double(getQueryCount(connection).doubleValue());
- } else if (metric
- .equals(PluginConstants.ComponentType.Platform.Metrics.SESSION_COUNT)) {
- resultObject = new Double(getSessionCount(connection).doubleValue());
- } else if (metric
- .equals(PluginConstants.ComponentType.Platform.Metrics.LONG_RUNNING_QUERIES)) {
- Collection<Request> longRunningQueries = new ArrayList<Request>();
- getRequestCollectionValue(getLongRunningQueries(connection),
- longRunningQueries);
- resultObject = new Double(longRunningQueries.size());
- } else if (metric
- .equals(PluginConstants.ComponentType.Platform.Metrics.BUFFER_USAGE)) {
- try {
- resultObject = ProfileServiceUtil
- .doubleValue(getUsedBufferSpace(connection));
- } catch (Exception e) {
- final String msg = "Exception executing operation: " + Platform.Operations.GET_BUFFER_USAGE; //$NON-NLS-1$
- LOG.error(msg, e);
- }
- } else if (metric.startsWith(Admin.Cache.PREPARED_PLAN_CACHE.toString()
- + ".") //$NON-NLS-1$
- || metric.startsWith(Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE
- .toString()
- + ".")) { //$NON-NLS-1$
- return getCacheProperty(connection, metric);
- }
- return resultObject;
- }
-
- private Object getCacheProperty(ProfileServiceConnection connection,
- String metric) {
- int dotIndex = metric.indexOf('.');
- String cacheType = metric.substring(0, dotIndex);
- String property = metric.substring(dotIndex + 1);
- CompositeValueSupport mv = (CompositeValueSupport) getCacheStats(
- connection, cacheType);
- MetaValue v = mv.get(property);
- return ((SimpleValue) v).getValue();
- }
-
- private Object getVdbMetric(ProfileServiceConnection connection,
- String componentType, String identifier, String metric,
- Map<String, Object> valueMap) {
-
- Object resultObject = new Object();
-
- if (metric
- .equals(PluginConstants.ComponentType.VDB.Metrics.ERROR_COUNT)) {
- // TODO remove version parameter after AdminAPI is changed
- resultObject = getErrorCount(connection, (String) valueMap
- .get(VDB.NAME));
- } else if (metric
- .equals(PluginConstants.ComponentType.VDB.Metrics.STATUS)) {
- // TODO remove version parameter after AdminAPI is changed
- resultObject = getVDBStatus(connection, (String) valueMap
- .get(VDB.NAME));
- } else if (metric
- .equals(PluginConstants.ComponentType.VDB.Metrics.QUERY_COUNT)) {
- resultObject = new Double(getQueryCount(connection).doubleValue());
- } else if (metric
- .equals(PluginConstants.ComponentType.VDB.Metrics.SESSION_COUNT)) {
- resultObject = new Double(getSessionCount(connection).doubleValue());
- } else if (metric
- .equals(PluginConstants.ComponentType.VDB.Metrics.LONG_RUNNING_QUERIES)) {
- Collection<Request> longRunningQueries = new ArrayList<Request>();
- getRequestCollectionValue(getLongRunningQueries(connection),
- longRunningQueries);
- resultObject = new Double(longRunningQueries.size());
- }
- return resultObject;
- }
-
- /*
- * Operation methods
- */
-
- public void executeOperation(ProfileServiceConnection connection,
- ExecutedResult operationResult, final Map<String, Object> valueMap) {
-
- if (operationResult.getComponentType().equals(
- PluginConstants.ComponentType.Platform.NAME)) {
- executePlatformOperation(connection, operationResult,
- operationResult.getOperationName(), valueMap);
- } else if (operationResult.getComponentType().equals(
- PluginConstants.ComponentType.VDB.NAME)) {
- executeVdbOperation(connection, operationResult, operationResult
- .getOperationName(), valueMap);
- }
- }
-
- private void executePlatformOperation(ProfileServiceConnection connection,
- ExecutedResult operationResult, final String operationName,
- final Map<String, Object> valueMap) {
- Collection<Request> resultObject = new ArrayList<Request>();
- Collection<Session> activeSessionsCollection = new ArrayList<Session>();
- Collection<Transaction> transactionsCollection = new ArrayList<Transaction>();
-
- if (operationName.equals(Platform.Operations.GET_LONGRUNNINGQUERIES)) {
- List<String> fieldNameList = operationResult.getFieldNameList();
- getRequestCollectionValue(getLongRunningQueries(connection),
- resultObject);
- operationResult.setContent(createReportResultList(fieldNameList,
- resultObject.iterator()));
- } else if (operationName.equals(Platform.Operations.GET_SESSIONS)) {
- List<String> fieldNameList = operationResult.getFieldNameList();
- MetaValue sessionMetaValue = getSessions(connection);
- getSessionCollectionValue(sessionMetaValue,
- activeSessionsCollection);
- operationResult.setContent(createReportResultList(fieldNameList,
- activeSessionsCollection.iterator()));
- } else if (operationName.equals(Platform.Operations.GET_REQUESTS)) {
- List<String> fieldNameList = operationResult.getFieldNameList();
- MetaValue requestMetaValue = getRequests(connection);
- getRequestCollectionValue(requestMetaValue, resultObject);
- operationResult.setContent(createReportResultList(fieldNameList,
- resultObject.iterator()));
- } else if (operationName.equals(Platform.Operations.GET_TRANSACTIONS)) {
- List<String> fieldNameList = operationResult.getFieldNameList();
- MetaValue transactionMetaValue = getTransactions(connection);
- getTransactionCollectionValue(transactionMetaValue,
- transactionsCollection);
- operationResult.setContent(createReportResultList(fieldNameList,
- resultObject.iterator()));
- } else if (operationName.equals(Platform.Operations.KILL_TRANSACTION)) {
- Long sessionID = (Long) valueMap
- .get(Operation.Value.TRANSACTION_ID);
- MetaValue[] args = new MetaValue[] { metaValueFactory
- .create(sessionID) };
- try {
- executeManagedOperation(connection, getRuntimeEngineDeployer(
- connection, mc), Platform.Operations.KILL_TRANSACTION,
- args);
- } catch (Exception e) {
- final String msg = "Exception executing operation: " + Platform.Operations.KILL_TRANSACTION; //$NON-NLS-1$
- LOG.error(msg, e);
- }
- } else if (operationName.equals(Platform.Operations.KILL_SESSION)) {
- Long sessionID = (Long) valueMap.get(Operation.Value.SESSION_ID);
- MetaValue[] args = new MetaValue[] { metaValueFactory
- .create(sessionID) };
- try {
- executeManagedOperation(connection, getRuntimeEngineDeployer(
- connection, mc), Platform.Operations.KILL_SESSION, args);
- } catch (Exception e) {
- final String msg = "Exception executing operation: " + Platform.Operations.KILL_SESSION; //$NON-NLS-1$
- LOG.error(msg, e);
- }
- } else if (operationName.equals(Platform.Operations.KILL_REQUEST)) {
- Long requestID = (Long) valueMap.get(Operation.Value.REQUEST_ID);
- Long sessionID = (Long) valueMap.get(Operation.Value.SESSION_ID);
- MetaValue[] args = new MetaValue[] {
- metaValueFactory.create(requestID),
- metaValueFactory.create(sessionID) };
- try {
- executeManagedOperation(connection, getRuntimeEngineDeployer(
- connection, mc), Platform.Operations.KILL_REQUEST, args);
- } catch (Exception e) {
- final String msg = "Exception executing operation: " + Platform.Operations.KILL_REQUEST; //$NON-NLS-1$
- LOG.error(msg, e);
- }
- } else if (operationName.equals(Platform.Operations.DEPLOY_VDB_BY_URL)) {
- String vdbUrl = (String) valueMap.get(Operation.Value.VDB_URL);
- String deployName = (String) valueMap
- .get(Operation.Value.VDB_DEPLOY_NAME);
- Object vdbVersion = valueMap.get(Operation.Value.VDB_VERSION);
- // strip off vdb extension if user added it
- if (deployName.endsWith(VDB_EXT)) {
- deployName = deployName.substring(0, deployName
- .lastIndexOf(VDB_EXT));
- }
- if (vdbVersion != null) {
- deployName = deployName
- + "." + ((Integer) vdbVersion).toString() + VDB_EXT; //$NON-NLS-1$
- }
- // add vdb extension if there was no version
- if (!deployName.endsWith(VDB_EXT)) {
- deployName = deployName + VDB_EXT;
- }
-
- try {
- URL url = new URL(vdbUrl);
- DeploymentUtils.deployArchive(deployName, connection
- .getDeploymentManager(), url, false);
- } catch (Exception e) {
- final String msg = "Exception executing operation: " + Platform.Operations.DEPLOY_VDB_BY_URL; //$NON-NLS-1$
- LOG.error(msg, e);
- throw new RuntimeException(e);
- }
- }
- }
-
- private void executeVdbOperation(ProfileServiceConnection connection,
- ExecutedResult operationResult, final String operationName,
- final Map<String, Object> valueMap) {
- Collection<ArrayList<String>> sqlResultsObject = new ArrayList<ArrayList<String>>();
- Collection<Request> resultObject = new ArrayList<Request>();
- Collection<Session> activeSessionsCollection = new ArrayList<Session>();
- String vdbName = (String) valueMap
- .get(PluginConstants.ComponentType.VDB.NAME);
- String vdbVersion = (String) valueMap
- .get(PluginConstants.ComponentType.VDB.VERSION);
-
- if (operationName.equals(VDB.Operations.GET_PROPERTIES)) {
- List<String> fieldNameList = operationResult.getFieldNameList();
- getProperties(connection, PluginConstants.ComponentType.VDB.NAME);
- operationResult.setContent(createReportResultList(fieldNameList,
- resultObject.iterator()));
- } else if (operationName.equals(VDB.Operations.GET_SESSIONS)) {
- List<String> fieldNameList = operationResult.getFieldNameList();
- MetaValue sessionMetaValue = getSessions(connection);
- getSessionCollectionValueForVDB(sessionMetaValue,
- activeSessionsCollection, vdbName);
- operationResult.setContent(createReportResultList(fieldNameList,
- activeSessionsCollection.iterator()));
- } else if (operationName.equals(VDB.Operations.GET_REQUESTS)) {
- List<String> fieldNameList = operationResult.getFieldNameList();
- MetaValue requestMetaValue = getRequestsForVDB(connection, vdbName,
- Integer.parseInt(vdbVersion));
- getRequestCollectionValue(requestMetaValue, resultObject);
- operationResult.setContent(createReportResultList(fieldNameList,
- resultObject.iterator()));
- } else if (operationName.equals(VDB.Operations.GET_MATVIEWS)) {
- List<String> fieldNameList = operationResult.getFieldNameList();
- MetaValue resultsMetaValue = executeMaterializedViewQuery(
- connection, formatVdbName(vdbName), Integer
- .parseInt(vdbVersion));
- getResultsCollectionValue(resultsMetaValue, sqlResultsObject);
- operationResult.setContent(createReportResultListForMatViewQuery(
- fieldNameList, sqlResultsObject.iterator()));
- } else if (operationName.equals(VDB.Operations.RELOAD_MATVIEW)) {
- MetaValue resultsMetaValue = reloadMaterializedView(connection,
- formatVdbName(vdbName), Integer.parseInt(vdbVersion),
- (String) valueMap.get(Operation.Value.MATVIEW_SCHEMA),
- (String) valueMap.get(Operation.Value.MATVIEW_TABLE),
- (Boolean) valueMap.get(Operation.Value.INVALIDATE_MATVIEW));
- if (resultsMetaValue==null) {
- operationResult.setContent("failure - see log for details"); //$NON-NLS-1$
- } else {
- operationResult.setContent("data successfully refreshed!"); //$NON-NLS-1$
- }
- }
-
- }
-
- /*
- * Helper methods
- */
-
- private String formatVdbName(String vdbName) {
-
- return vdbName.substring(0, vdbName.indexOf(".")); //$NON-NLS-1$
- }
-
- public MetaValue getProperties(ProfileServiceConnection connection,
- final String component) {
-
- MetaValue propertyValue = null;
- MetaValue args = null;
-
- try {
- propertyValue = executeManagedOperation(connection,
- getRuntimeEngineDeployer(connection, mc),
- PluginConstants.Operation.GET_PROPERTIES, args);
- } catch (Exception e) {
- final String msg = "Exception executing operation: " + Platform.Operations.GET_PROPERTIES; //$NON-NLS-1$
- LOG.error(msg, e);
- }
-
- return propertyValue;
-
- }
-
- protected MetaValue getRequests(ProfileServiceConnection connection) {
-
- MetaValue requestsCollection = null;
- MetaValue args = null;
-
- try {
- requestsCollection = executeManagedOperation(connection,
- getRuntimeEngineDeployer(connection, mc),
-
- PluginConstants.Operation.GET_REQUESTS, args);
- } catch (Exception e) {
- final String msg = "Exception executing operation: " + Platform.Operations.GET_REQUESTS; //$NON-NLS-1$
- LOG.error(msg, e);
- }
-
- return requestsCollection;
-
- }
-
- protected MetaValue executeMaterializedViewQuery(
- ProfileServiceConnection connection, String vdbName, int vdbVersion) {
-
- MetaValue resultsCollection = null;
- MetaValue[] args = new MetaValue[] {
- MetaValueFactory.getInstance().create(vdbName),
- MetaValueFactory.getInstance().create(vdbVersion),
- MetaValueFactory.getInstance().create(
- Operation.Value.MAT_VIEW_QUERY),
- MetaValueFactory.getInstance()
- .create(Long.parseLong("9999999")) }; //$NON-NLS-1$
-
- try {
- resultsCollection = executeManagedOperation(connection,
- getRuntimeEngineDeployer(connection, mc),
- VDB.Operations.EXECUTE_QUERIES, args);
- } catch (Exception e) {
- final String msg = "Exception executing operation: " + VDB.Operations.EXECUTE_QUERIES; //$NON-NLS-1$
- LOG.error(msg, e);
- }
-
- return resultsCollection;
-
- }
-
- protected MetaValue reloadMaterializedView(
- ProfileServiceConnection connection, String vdbName,
- int vdbVersion, String schema, String table, Boolean invalidate) {
-
- MetaValue result = null;
- String matView = schema + "." + table; //$NON-NLS-1$
- String query = PluginConstants.Operation.Value.MAT_VIEW_REFRESH;
- query = query.replace("param1", matView); //$NON-NLS-1$
- query = query.replace("param2", invalidate.toString()); //$NON-NLS-1$
- MetaValue[] args = new MetaValue[] {
- MetaValueFactory.getInstance().create(vdbName),
- MetaValueFactory.getInstance().create(vdbVersion),
- MetaValueFactory.getInstance().create(query),
- MetaValueFactory.getInstance()
- .create(Long.parseLong("9999999")) }; //$NON-NLS-1$
-
- try {
- result = executeManagedOperation(connection,
- getRuntimeEngineDeployer(connection, mc),
- VDB.Operations.EXECUTE_QUERIES, args);
- } catch (Exception e) {
- final String msg = "Exception executing operation: " + VDB.Operations.RELOAD_MATVIEW; //$NON-NLS-1$
- LOG.error(msg, e);
-
- }
-
- return result;
-
- }
-
- protected MetaValue getRequestsForVDB(ProfileServiceConnection connection,
- String vdbName, int vdbVersion) {
-
- MetaValue requestsCollection = null;
- MetaValue[] args = new MetaValue[] {
- MetaValueFactory.getInstance().create(vdbName),
- MetaValueFactory.getInstance().create(vdbVersion) };
-
- try {
- requestsCollection = executeManagedOperation(connection,
- getRuntimeEngineDeployer(connection, mc),
- PluginConstants.ComponentType.VDB.Operations.GET_REQUESTS,
- args);
- } catch (Exception e) {
- final String msg = "Exception executing operation: " + Platform.Operations.GET_REQUESTS; //$NON-NLS-1$
- LOG.error(msg, e);
- }
-
- return requestsCollection;
-
- }
-
- protected MetaValue getTransactions(ProfileServiceConnection connection) {
-
- MetaValue transactionsCollection = null;
- MetaValue args = null;
-
- try {
- transactionsCollection = executeManagedOperation(connection,
- getRuntimeEngineDeployer(connection, mc),
- Platform.Operations.GET_TRANSACTIONS, args);
- } catch (Exception e) {
- final String msg = "Exception executing operation: " + Platform.Operations.GET_TRANSACTIONS; //$NON-NLS-1$
- LOG.error(msg, e);
- }
-
- return transactionsCollection;
-
- }
-
- public MetaValue getSessions(ProfileServiceConnection connection) {
-
- MetaValue sessionCollection = null;
- MetaValue args = null;
-
- try {
- sessionCollection = executeManagedOperation(connection,
- getRuntimeEngineDeployer(connection, mc),
- PluginConstants.Operation.GET_SESSIONS, args);
- } catch (Exception e) {
- final String msg = "Exception executing operation: " + Platform.Operations.GET_SESSIONS; //$NON-NLS-1$
- LOG.error(msg, e);
- }
- return sessionCollection;
-
- }
-
- public static String getVDBStatus(ProfileServiceConnection connection,
- String vdbName) {
-
- ManagedComponent mcVdb = null;
- try {
- mcVdb = ProfileServiceUtil
- .getManagedComponent(connection,
- new org.jboss.managed.api.ComponentType(
- PluginConstants.ComponentType.VDB.TYPE,
- PluginConstants.ComponentType.VDB.SUBTYPE),
- vdbName);
- } catch (NamingException e) {
- final String msg = "NamingException in getVDBStatus(): " + e.getExplanation(); //$NON-NLS-1$
- LOG.error(msg, e);
- } catch (Exception e) {
- final String msg = "Exception in getVDBStatus(): " + e.getMessage(); //$NON-NLS-1$
- LOG.error(msg, e);
- }
-
- if (mcVdb == null) {
- return Status.INACTIVE.toString();
- }
-
- return ProfileServiceUtil.getSimpleValue(mcVdb, "status", String.class); //$NON-NLS-1$
- }
-
- public static MetaValue executeManagedOperation(
- ProfileServiceConnection connection, ManagedComponent mc,
- String operation, MetaValue... args) throws Exception {
-
- for (ManagedOperation mo : mc.getOperations()) {
- String opName = mo.getName();
- if (opName.equals(operation)) {
- try {
- if (args.length == 1 && args[0] == null) {
- return mo.invoke();
- } else {
- return mo.invoke(args);
- }
- } catch (Exception e) {
- final String msg = "Exception getting the AdminApi in " + operation; //$NON-NLS-1$
- LOG.error(msg, e);
- throw new RuntimeException(e);
- }
- }
- }
- throw new Exception("No operation found with given name = " + operation); //$NON-NLS-1$
-
- }
-
- /**
- * @param mc
- * @return
- */
- private static ManagedComponent getRuntimeEngineDeployer(
- ProfileServiceConnection connection, ManagedComponent mc) {
- try {
- mc = ProfileServiceUtil.getRuntimeEngineDeployer(connection);
- } catch (NamingException e) {
- final String msg = "NamingException getting the DQPManagementView"; //$NON-NLS-1$
- LOG.error(msg, e);
- } catch (Exception e1) {
- final String msg = "Exception getting the DQPManagementView"; //$NON-NLS-1$
- LOG.error(msg, e1);
- }
- return mc;
- }
-
- /**
- * @param mc
- * @return
- */
- private static ManagedComponent getBufferService(
- ProfileServiceConnection connection, ManagedComponent mc) {
- try {
- mc = ProfileServiceUtil.getBufferService(connection);
- } catch (NamingException e) {
- final String msg = "NamingException getting the SessionService"; //$NON-NLS-1$
- LOG.error(msg, e);
- } catch (Exception e1) {
- final String msg = "Exception getting the SessionService"; //$NON-NLS-1$
- LOG.error(msg, e1);
- }
- return mc;
- }
-
- public static MetaValue getManagedProperty(
- ProfileServiceConnection connection, ManagedComponent mc,
- String property) throws Exception {
-
- ManagedProperty managedProperty = null;
- try {
- managedProperty = mc.getProperty(property);
- } catch (Exception e) {
- final String msg = "Exception getting the AdminApi in " + property; //$NON-NLS-1$
- LOG.error(msg, e);
- }
-
- if (managedProperty != null) {
- return managedProperty.getValue();
- }
-
- throw new Exception("No property found with given name =" + property); //$NON-NLS-1$
- }
-
- private Integer getQueryCount(ProfileServiceConnection connection) {
-
- Integer count = new Integer(0);
-
- MetaValue requests = null;
- Collection<Request> requestsCollection = new ArrayList<Request>();
-
- requests = getRequests(connection);
-
- getRequestCollectionValue(requests, requestsCollection);
-
- if (requestsCollection != null && !requestsCollection.isEmpty()) {
- count = requestsCollection.size();
- }
-
- return count;
- }
-
- private Integer getSessionCount(ProfileServiceConnection connection) {
-
- Collection<Session> activeSessionsCollection = new ArrayList<Session>();
- MetaValue sessionMetaValue = getSessions(connection);
- getSessionCollectionValue(sessionMetaValue, activeSessionsCollection);
- return activeSessionsCollection.size();
- }
-
- /**
- * @param mcVdb
- * @return count
- * @throws Exception
- */
- private int getErrorCount(ProfileServiceConnection connection,
- String vdbName) {
-
- ManagedComponent mcVdb = null;
- try {
- mcVdb = ProfileServiceUtil
- .getManagedComponent(connection,
- new org.jboss.managed.api.ComponentType(
- PluginConstants.ComponentType.VDB.TYPE,
- PluginConstants.ComponentType.VDB.SUBTYPE),
- vdbName);
- } catch (NamingException e) {
- final String msg = "NamingException in getVDBStatus(): " + e.getExplanation(); //$NON-NLS-1$
- LOG.error(msg, e);
- } catch (Exception e) {
- final String msg = "Exception in getVDBStatus(): " + e.getMessage(); //$NON-NLS-1$
- LOG.error(msg, e);
- }
-
- // Get models from VDB
- int count = 0;
- ManagedProperty property = mcVdb.getProperty("models"); //$NON-NLS-1$
- CollectionValueSupport valueSupport = (CollectionValueSupport) property
- .getValue();
- MetaValue[] metaValues = valueSupport.getElements();
-
- for (MetaValue value : metaValues) {
- GenericValueSupport genValueSupport = (GenericValueSupport) value;
- ManagedObjectImpl managedObject = (ManagedObjectImpl) genValueSupport
- .getValue();
-
- // Get any model errors/warnings
- MetaValue errors = managedObject.getProperty("errors").getValue(); //$NON-NLS-1$
- if (errors != null) {
- CollectionValueSupport errorValueSupport = (CollectionValueSupport) errors;
- MetaValue[] errorArray = errorValueSupport.getElements();
- count += errorArray.length;
- }
- }
- return count;
- }
-
- protected MetaValue getCacheStats(ProfileServiceConnection connection,
- String type) {
- try {
- return executeManagedOperation(connection,
- getRuntimeEngineDeployer(connection, mc),
- Platform.Operations.GET_CACHE_STATS, SimpleValueSupport
- .wrap(type));
- } catch (Exception e) {
- LOG
- .error(
- "Exception executing operation: " + Platform.Operations.GET_CACHE_STATS, e); //$NON-NLS-1$
- }
- return null;
- }
-
- protected MetaValue getLongRunningQueries(
- ProfileServiceConnection connection) {
-
- MetaValue requestsCollection = null;
- MetaValue args = null;
-
- try {
- requestsCollection = executeManagedOperation(connection,
- getRuntimeEngineDeployer(connection, mc),
- Platform.Operations.GET_LONGRUNNINGQUERIES, args);
- } catch (Exception e) {
- final String msg = "Exception executing operation: " + Platform.Operations.GET_LONGRUNNINGQUERIES; //$NON-NLS-1$
- LOG.error(msg, e);
- }
-
- return requestsCollection;
- }
-
- protected MetaValue getUsedBufferSpace(ProfileServiceConnection connection) {
-
- MetaValue usedBufferSpace = null;
-
- try {
- usedBufferSpace = getManagedProperty(connection, getBufferService(
- connection, mc), Platform.Operations.GET_BUFFER_USAGE);
- } catch (Exception e) {
- final String msg = "Exception executing operation: " + Platform.Operations.GET_BUFFER_USAGE; //$NON-NLS-1$
- LOG.error(msg, e);
- }
-
- return usedBufferSpace;
- }
-
- private void getRequestCollectionValue(MetaValue pValue,
- Collection<Request> list) {
- MetaType metaType = pValue.getMetaType();
- if (metaType.isCollection()) {
- for (MetaValue value : ((CollectionValueSupport) pValue)
- .getElements()) {
- if (value.getMetaType().isComposite()) {
- RequestMetadataMapper rmm = new RequestMetadataMapper();
- RequestMetadata request = rmm.unwrapMetaValue(value);
- list.add(request);
- } else {
- throw new IllegalStateException(pValue
- + " is not a Composite type"); //$NON-NLS-1$
- }
- }
- }
- }
-
- private void getResultsCollectionValue(MetaValue pValue,
- Collection<ArrayList<String>> list) {
- MetaType metaType = pValue.getMetaType();
- if (metaType.isCollection()) {
- for (MetaValue value : ((CollectionValueSupport) pValue)
- .getElements()) {
- if (value.getMetaType().isCollection()) {
- ArrayList<String> row = (ArrayList<String>) MetaValueFactory
- .getInstance().unwrap(value);
- list.add(row);
- }
- }
- }
- }
-
- private void getResultsCollectionValueForMatViewRefresh(MetaValue pValue,
- Collection<ArrayList<String>> list) {
- MetaType metaType = pValue.getMetaType();
- for (MetaValue value : ((CollectionValueSupport) pValue).getElements()) {
- if (value.getMetaType().isCollection()) {
- ArrayList<String> row = (ArrayList<String>) MetaValueFactory
- .getInstance().unwrap(value);
- list.add(row);
- }
- }
-
- }
-
- public static <T> void getTransactionCollectionValue(MetaValue pValue,
- Collection<Transaction> list) {
- MetaType metaType = pValue.getMetaType();
- if (metaType.isCollection()) {
- for (MetaValue value : ((CollectionValueSupport) pValue)
- .getElements()) {
- if (value.getMetaType().isComposite()) {
- Transaction transaction = (Transaction) MetaValueFactory
- .getInstance().unwrap(value);
- list.add(transaction);
- } else {
- throw new IllegalStateException(pValue
- + " is not a Composite type"); //$NON-NLS-1$
- }
- }
- }
- }
-
- public static <T> void getSessionCollectionValue(MetaValue pValue,
- Collection<Session> list) {
- MetaType metaType = pValue.getMetaType();
- if (metaType.isCollection()) {
- for (MetaValue value : ((CollectionValueSupport) pValue)
- .getElements()) {
- if (value.getMetaType().isComposite()) {
- Session Session = (Session) MetaValueFactory.getInstance()
- .unwrap(value);
- list.add(Session);
- } else {
- throw new IllegalStateException(pValue
- + " is not a Composite type"); //$NON-NLS-1$
- }
- }
- }
- }
-
- public static <T> void getSessionCollectionValueForVDB(MetaValue pValue,
- Collection<Session> list, String vdbName) {
- MetaType metaType = pValue.getMetaType();
- if (metaType.isCollection()) {
- for (MetaValue value : ((CollectionValueSupport) pValue)
- .getElements()) {
- if (value.getMetaType().isComposite()) {
- Session session = (Session) MetaValueFactory.getInstance()
- .unwrap(value);
- if (session.getVDBName().equals(vdbName)) {
- list.add(session);
- }
- } else {
- throw new IllegalStateException(pValue
- + " is not a Composite type"); //$NON-NLS-1$
- }
- }
- }
- }
-
- private Collection createReportResultList(List fieldNameList,
- Iterator objectIter) {
- Collection reportResultList = new ArrayList();
-
- while (objectIter.hasNext()) {
- Object object = objectIter.next();
-
- Class cls = null;
- try {
- cls = object.getClass();
- Iterator methodIter = fieldNameList.iterator();
- Map reportValueMap = new HashMap<String, String>();
- while (methodIter.hasNext()) {
- String fieldName = (String) methodIter.next();
- String methodName = fieldName;
- Method meth = cls.getMethod(methodName, (Class[]) null);
- Object retObj = meth.invoke(object, (Object[]) null);
- reportValueMap.put(fieldName, retObj);
- }
- reportResultList.add(reportValueMap);
- } catch (Throwable e) {
- System.err.println(e);
- }
- }
- return reportResultList;
- }
-
- private Collection createReportResultListForMatViewQuery(
- List fieldNameList, Iterator objectIter) {
- Collection reportResultList = new ArrayList();
-
- // Iterate through rows
- while (objectIter.hasNext()) {
- ArrayList<Object> columnValues = (ArrayList<Object>) objectIter
- .next();
-
- Class cls = null;
- try {
- Iterator fieldIter = fieldNameList.iterator();
- Map reportValueMap = new HashMap<String, Object>();
- // Iterate through columns with a row
- for (Object columnValue : columnValues) {
- String fieldName = (String) fieldIter.next();
- reportValueMap.put(fieldName, columnValue);
- }
- reportResultList.add(reportValueMap);
- } catch (Throwable e) {
- System.err.println(e);
- }
- }
- return reportResultList;
- }
-
-}
Copied: tags/teiid-parent-7.2.0.Final/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java (from rev 2707, branches/7.2.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java)
===================================================================
--- tags/teiid-parent-7.2.0.Final/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java (rev 0)
+++ tags/teiid-parent-7.2.0.Final/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java 2010-11-05 03:19:55 UTC (rev 2709)
@@ -0,0 +1,781 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.rhq.admin;
+
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.naming.NamingException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.ManagedOperation;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.plugins.ManagedObjectImpl;
+import org.jboss.metatype.api.types.MetaType;
+import org.jboss.metatype.api.values.CollectionValueSupport;
+import org.jboss.metatype.api.values.CompositeValueSupport;
+import org.jboss.metatype.api.values.GenericValueSupport;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.MetaValueFactory;
+import org.jboss.metatype.api.values.SimpleValue;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.rhq.plugins.jbossas5.connection.ProfileServiceConnection;
+import org.teiid.adminapi.Admin;
+import org.teiid.adminapi.Request;
+import org.teiid.adminapi.Session;
+import org.teiid.adminapi.Transaction;
+import org.teiid.adminapi.VDB.Status;
+import org.teiid.adminapi.impl.RequestMetadata;
+import org.teiid.adminapi.impl.RequestMetadataMapper;
+import org.teiid.rhq.plugin.objects.ExecutedResult;
+import org.teiid.rhq.plugin.util.DeploymentUtils;
+import org.teiid.rhq.plugin.util.PluginConstants;
+import org.teiid.rhq.plugin.util.ProfileServiceUtil;
+import org.teiid.rhq.plugin.util.PluginConstants.ComponentType.Platform;
+import org.teiid.rhq.plugin.util.PluginConstants.ComponentType.VDB;
+
+public class DQPManagementView implements PluginConstants {
+
+ private static ManagedComponent mc = null;
+ private static final Log LOG = LogFactory.getLog(PluginConstants.DEFAULT_LOGGER_CATEGORY);
+ private static final MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
+
+ private static final String VDB_EXT = ".vdb"; //$NON-NLS-1$
+
+ public DQPManagementView() {
+ }
+
+ /*
+ * Metric methods
+ */
+ public Object getMetric(ProfileServiceConnection connection,
+ String componentType, String identifier, String metric,
+ Map<String, Object> valueMap) {
+ Object resultObject = new Object();
+
+ if (componentType.equals(PluginConstants.ComponentType.Platform.NAME)) {
+ resultObject = getPlatformMetric(connection, componentType, metric, valueMap);
+ } else if (componentType.equals(PluginConstants.ComponentType.VDB.NAME)) {
+ resultObject = getVdbMetric(connection, componentType, identifier,metric, valueMap);
+ }
+ return resultObject;
+ }
+
+ private Object getPlatformMetric(ProfileServiceConnection connection,
+ String componentType, String metric, Map<String, Object> valueMap) {
+
+ Object resultObject = new Object();
+
+ if (metric.equals(PluginConstants.ComponentType.Platform.Metrics.QUERY_COUNT)) {
+ resultObject = new Double(getQueryCount(connection).doubleValue());
+ } else if (metric.equals(PluginConstants.ComponentType.Platform.Metrics.SESSION_COUNT)) {
+ resultObject = new Double(getSessionCount(connection).doubleValue());
+ } else if (metric.equals(PluginConstants.ComponentType.Platform.Metrics.LONG_RUNNING_QUERIES)) {
+ Collection<Request> longRunningQueries = new ArrayList<Request>();
+ getRequestCollectionValue(getLongRunningQueries(connection), longRunningQueries);
+ resultObject = new Double(longRunningQueries.size());
+ } else if (metric.equals(PluginConstants.ComponentType.Platform.Metrics.BUFFER_USAGE)) {
+ try {
+ resultObject = ProfileServiceUtil.doubleValue(getUsedBufferSpace(connection));
+ } catch (Exception e) {
+ final String msg = "Exception executing operation: " + Platform.Operations.GET_BUFFER_USAGE; //$NON-NLS-1$
+ LOG.error(msg, e);
+ }
+ } else if (metric.startsWith(Admin.Cache.PREPARED_PLAN_CACHE.toString() + ".") //$NON-NLS-1$
+ || metric.startsWith(Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE .toString()+ ".")) { //$NON-NLS-1$
+ return getCacheProperty(connection, metric);
+ }
+ return resultObject;
+ }
+
+ private Object getCacheProperty(ProfileServiceConnection connection,String metric) {
+ int dotIndex = metric.indexOf('.');
+ String cacheType = metric.substring(0, dotIndex);
+ String property = metric.substring(dotIndex + 1);
+ CompositeValueSupport mv = (CompositeValueSupport) getCacheStats(connection, cacheType);
+ MetaValue v = mv.get(property);
+ return ((SimpleValue) v).getValue();
+ }
+
+ private Object getVdbMetric(ProfileServiceConnection connection,
+ String componentType, String identifier, String metric,
+ Map<String, Object> valueMap) {
+
+ Object resultObject = new Object();
+
+ if (metric.equals(PluginConstants.ComponentType.VDB.Metrics.ERROR_COUNT)) {
+ // TODO remove version parameter after AdminAPI is changed
+ resultObject = getErrorCount(connection, (String) valueMap.get(VDB.NAME));
+ } else if (metric.equals(PluginConstants.ComponentType.VDB.Metrics.STATUS)) {
+ // TODO remove version parameter after AdminAPI is changed
+ resultObject = getVDBStatus(connection, (String) valueMap.get(VDB.NAME));
+ } else if (metric.equals(PluginConstants.ComponentType.VDB.Metrics.QUERY_COUNT)) {
+ resultObject = new Double(getQueryCount(connection).doubleValue());
+ } else if (metric.equals(PluginConstants.ComponentType.VDB.Metrics.SESSION_COUNT)) {
+ resultObject = new Double(getSessionCount(connection).doubleValue());
+ } else if (metric.equals(PluginConstants.ComponentType.VDB.Metrics.LONG_RUNNING_QUERIES)) {
+ Collection<Request> longRunningQueries = new ArrayList<Request>();
+ getRequestCollectionValue(getLongRunningQueries(connection), longRunningQueries);
+ resultObject = new Double(longRunningQueries.size());
+ }
+ return resultObject;
+ }
+
+ /*
+ * Operation methods
+ */
+
+ public void executeOperation(ProfileServiceConnection connection,
+ ExecutedResult operationResult, final Map<String, Object> valueMap) {
+
+ if (operationResult.getComponentType().equals(PluginConstants.ComponentType.Platform.NAME)) {
+ executePlatformOperation(connection, operationResult, operationResult.getOperationName(), valueMap);
+ } else if (operationResult.getComponentType().equals( PluginConstants.ComponentType.VDB.NAME)) {
+ executeVdbOperation(connection, operationResult, operationResult .getOperationName(), valueMap);
+ }
+ }
+
+ private void executePlatformOperation(ProfileServiceConnection connection,
+ ExecutedResult operationResult, final String operationName,
+ final Map<String, Object> valueMap) {
+ Collection<Request> resultObject = new ArrayList<Request>();
+ Collection<Session> activeSessionsCollection = new ArrayList<Session>();
+ Collection<Transaction> transactionsCollection = new ArrayList<Transaction>();
+
+ if (operationName.equals(Platform.Operations.GET_LONGRUNNINGQUERIES)) {
+ List<String> fieldNameList = operationResult.getFieldNameList();
+ getRequestCollectionValue(getLongRunningQueries(connection), resultObject);
+ operationResult.setContent(createReportResultList(fieldNameList, resultObject.iterator()));
+ } else if (operationName.equals(Platform.Operations.GET_SESSIONS)) {
+ List<String> fieldNameList = operationResult.getFieldNameList();
+ MetaValue sessionMetaValue = getSessions(connection);
+ getSessionCollectionValue(sessionMetaValue,activeSessionsCollection);
+ operationResult.setContent(createReportResultList(fieldNameList, activeSessionsCollection.iterator()));
+ } else if (operationName.equals(Platform.Operations.GET_REQUESTS)) {
+ List<String> fieldNameList = operationResult.getFieldNameList();
+ MetaValue requestMetaValue = getRequests(connection);
+ getRequestCollectionValue(requestMetaValue, resultObject);
+ operationResult.setContent(createReportResultList(fieldNameList, resultObject.iterator()));
+ } else if (operationName.equals(Platform.Operations.GET_TRANSACTIONS)) {
+ List<String> fieldNameList = operationResult.getFieldNameList();
+ MetaValue transactionMetaValue = getTransactions(connection);
+ getTransactionCollectionValue(transactionMetaValue,transactionsCollection);
+ operationResult.setContent(createReportResultList(fieldNameList, resultObject.iterator()));
+ } else if (operationName.equals(Platform.Operations.KILL_TRANSACTION)) {
+ Long sessionID = (Long) valueMap.get(Operation.Value.TRANSACTION_ID);
+ MetaValue[] args = new MetaValue[] { metaValueFactory .create(sessionID) };
+ try {
+ executeManagedOperation(connection, getRuntimeEngineDeployer(connection, mc), Platform.Operations.KILL_TRANSACTION, args);
+ } catch (Exception e) {
+ final String msg = "Exception executing operation: " + Platform.Operations.KILL_TRANSACTION; //$NON-NLS-1$
+ LOG.error(msg, e);
+ }
+ } else if (operationName.equals(Platform.Operations.KILL_SESSION)) {
+ Long sessionID = (Long) valueMap.get(Operation.Value.SESSION_ID);
+ MetaValue[] args = new MetaValue[] { metaValueFactory .create(sessionID) };
+ try {
+ executeManagedOperation(connection, getRuntimeEngineDeployer(connection, mc), Platform.Operations.KILL_SESSION, args);
+ } catch (Exception e) {
+ final String msg = "Exception executing operation: " + Platform.Operations.KILL_SESSION; //$NON-NLS-1$
+ LOG.error(msg, e);
+ }
+ } else if (operationName.equals(Platform.Operations.KILL_REQUEST)) {
+ Long requestID = (Long) valueMap.get(Operation.Value.REQUEST_ID);
+ Long sessionID = (Long) valueMap.get(Operation.Value.SESSION_ID);
+ MetaValue[] args = new MetaValue[] {
+ metaValueFactory.create(requestID),
+ metaValueFactory.create(sessionID) };
+ try {
+ executeManagedOperation(connection, getRuntimeEngineDeployer(connection, mc), Platform.Operations.KILL_REQUEST, args);
+ } catch (Exception e) {
+ final String msg = "Exception executing operation: " + Platform.Operations.KILL_REQUEST; //$NON-NLS-1$
+ LOG.error(msg, e);
+ }
+ } else if (operationName.equals(Platform.Operations.DEPLOY_VDB_BY_URL)) {
+ String vdbUrl = (String) valueMap.get(Operation.Value.VDB_URL);
+ String deployName = (String) valueMap.get(Operation.Value.VDB_DEPLOY_NAME);
+ Object vdbVersion = valueMap.get(Operation.Value.VDB_VERSION);
+ // strip off vdb extension if user added it
+ if (deployName.endsWith(VDB_EXT)) {
+ deployName = deployName.substring(0, deployName.lastIndexOf(VDB_EXT));
+ }
+ if (vdbVersion != null) {
+ deployName = deployName + "." + ((Integer) vdbVersion).toString() + VDB_EXT; //$NON-NLS-1$
+ }
+ // add vdb extension if there was no version
+ if (!deployName.endsWith(VDB_EXT)) {
+ deployName = deployName + VDB_EXT;
+ }
+
+ try {
+ URL url = new URL(vdbUrl);
+ DeploymentUtils.deployArchive(deployName, connection.getDeploymentManager(), url, false);
+ } catch (Exception e) {
+ final String msg = "Exception executing operation: " + Platform.Operations.DEPLOY_VDB_BY_URL; //$NON-NLS-1$
+ LOG.error(msg, e);
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ private void executeVdbOperation(ProfileServiceConnection connection,
+ ExecutedResult operationResult, final String operationName,
+ final Map<String, Object> valueMap) {
+ Collection<ArrayList<String>> sqlResultsObject = new ArrayList<ArrayList<String>>();
+ Collection<Request> resultObject = new ArrayList<Request>();
+ Collection<Session> activeSessionsCollection = new ArrayList<Session>();
+ String vdbName = (String) valueMap.get(PluginConstants.ComponentType.VDB.NAME);
+ String vdbVersion = (String) valueMap.get(PluginConstants.ComponentType.VDB.VERSION);
+
+ if (operationName.equals(VDB.Operations.GET_PROPERTIES)) {
+ List<String> fieldNameList = operationResult.getFieldNameList();
+ getProperties(connection, PluginConstants.ComponentType.VDB.NAME);
+ operationResult.setContent(createReportResultList(fieldNameList, resultObject.iterator()));
+ } else if (operationName.equals(VDB.Operations.GET_SESSIONS)) {
+ List<String> fieldNameList = operationResult.getFieldNameList();
+ MetaValue sessionMetaValue = getSessions(connection);
+ getSessionCollectionValueForVDB(sessionMetaValue, activeSessionsCollection, vdbName);
+ operationResult.setContent(createReportResultList(fieldNameList, activeSessionsCollection.iterator()));
+ } else if (operationName.equals(VDB.Operations.GET_REQUESTS)) {
+ List<String> fieldNameList = operationResult.getFieldNameList();
+ MetaValue requestMetaValue = getRequestsForVDB(connection, vdbName, Integer.parseInt(vdbVersion));
+ getRequestCollectionValue(requestMetaValue, resultObject);
+ operationResult.setContent(createReportResultList(fieldNameList, resultObject.iterator()));
+ } else if (operationName.equals(VDB.Operations.GET_MATVIEWS)) {
+ List<String> fieldNameList = operationResult.getFieldNameList();
+ MetaValue resultsMetaValue = executeMaterializedViewQuery( connection, formatVdbName(vdbName), Integer.parseInt(vdbVersion));
+ getResultsCollectionValue(resultsMetaValue, sqlResultsObject);
+ operationResult.setContent(createReportResultListForMatViewQuery(fieldNameList, sqlResultsObject.iterator()));
+ } else if (operationName.equals(VDB.Operations.RELOAD_MATVIEW)) {
+ MetaValue resultsMetaValue = reloadMaterializedView(connection, formatVdbName(vdbName), Integer.parseInt(vdbVersion),
+ (String) valueMap.get(Operation.Value.MATVIEW_SCHEMA),
+ (String) valueMap.get(Operation.Value.MATVIEW_TABLE),
+ (Boolean) valueMap.get(Operation.Value.INVALIDATE_MATVIEW));
+ if (resultsMetaValue==null) {
+ operationResult.setContent("failure - see log for details"); //$NON-NLS-1$
+ } else {
+ operationResult.setContent("data successfully refreshed!"); //$NON-NLS-1$
+ }
+ }
+
+ }
+
+ /*
+ * Helper methods
+ */
+
+ private String formatVdbName(String vdbName) {
+
+ return vdbName.substring(0, vdbName.indexOf(".")); //$NON-NLS-1$
+ }
+
+ public MetaValue getProperties(ProfileServiceConnection connection, final String component) {
+
+ MetaValue propertyValue = null;
+ MetaValue args = null;
+
+ try {
+ propertyValue = executeManagedOperation(connection, getRuntimeEngineDeployer(connection, mc),
+ PluginConstants.Operation.GET_PROPERTIES, args);
+ } catch (Exception e) {
+ final String msg = "Exception executing operation: " + Platform.Operations.GET_PROPERTIES; //$NON-NLS-1$
+ LOG.error(msg, e);
+ }
+
+ return propertyValue;
+
+ }
+
+ protected MetaValue getRequests(ProfileServiceConnection connection) {
+
+ MetaValue requestsCollection = null;
+ MetaValue args = null;
+
+ try {
+ requestsCollection = executeManagedOperation(connection, getRuntimeEngineDeployer(connection, mc), PluginConstants.Operation.GET_REQUESTS, args);
+ } catch (Exception e) {
+ final String msg = "Exception executing operation: " + Platform.Operations.GET_REQUESTS; //$NON-NLS-1$
+ LOG.error(msg, e);
+ }
+
+ return requestsCollection;
+
+ }
+
+ protected MetaValue executeMaterializedViewQuery(
+ ProfileServiceConnection connection, String vdbName, int vdbVersion) {
+
+ MetaValue resultsCollection = null;
+ MetaValue[] args = new MetaValue[] {
+ MetaValueFactory.getInstance().create(vdbName),
+ MetaValueFactory.getInstance().create(vdbVersion),
+ MetaValueFactory.getInstance().create(Operation.Value.MAT_VIEW_QUERY),
+ MetaValueFactory.getInstance().create(Long.parseLong("9999999")) }; //$NON-NLS-1$
+
+ try {
+ resultsCollection = executeManagedOperation(connection, getRuntimeEngineDeployer(connection, mc), VDB.Operations.EXECUTE_QUERIES, args);
+ } catch (Exception e) {
+ final String msg = "Exception executing operation: " + VDB.Operations.EXECUTE_QUERIES; //$NON-NLS-1$
+ LOG.error(msg, e);
+ }
+
+ return resultsCollection;
+
+ }
+
+ protected MetaValue reloadMaterializedView(
+ ProfileServiceConnection connection, String vdbName,
+ int vdbVersion, String schema, String table, Boolean invalidate) {
+
+ MetaValue result = null;
+ String matView = schema + "." + table; //$NON-NLS-1$
+ String query = PluginConstants.Operation.Value.MAT_VIEW_REFRESH;
+ query = query.replace("param1", matView); //$NON-NLS-1$
+ query = query.replace("param2", invalidate.toString()); //$NON-NLS-1$
+ MetaValue[] args = new MetaValue[] {
+ MetaValueFactory.getInstance().create(vdbName),
+ MetaValueFactory.getInstance().create(vdbVersion),
+ MetaValueFactory.getInstance().create(query),
+ MetaValueFactory.getInstance().create(Long.parseLong("9999999")) }; //$NON-NLS-1$
+
+ try {
+ result = executeManagedOperation(connection, getRuntimeEngineDeployer(connection, mc),
+ VDB.Operations.EXECUTE_QUERIES, args);
+ } catch (Exception e) {
+ final String msg = "Exception executing operation: " + VDB.Operations.RELOAD_MATVIEW; //$NON-NLS-1$
+ LOG.error(msg, e);
+
+ }
+
+ return result;
+
+ }
+
+ protected MetaValue getRequestsForVDB(ProfileServiceConnection connection,
+ String vdbName, int vdbVersion) {
+
+ MetaValue requestsCollection = null;
+ MetaValue[] args = new MetaValue[] {
+ MetaValueFactory.getInstance().create(vdbName),
+ MetaValueFactory.getInstance().create(vdbVersion) };
+
+ try {
+ requestsCollection = executeManagedOperation(connection,
+ getRuntimeEngineDeployer(connection, mc),
+ PluginConstants.ComponentType.VDB.Operations.GET_REQUESTS,
+ args);
+ } catch (Exception e) {
+ final String msg = "Exception executing operation: " + Platform.Operations.GET_REQUESTS; //$NON-NLS-1$
+ LOG.error(msg, e);
+ }
+
+ return requestsCollection;
+
+ }
+
+ protected MetaValue getTransactions(ProfileServiceConnection connection) {
+
+ MetaValue transactionsCollection = null;
+ MetaValue args = null;
+
+ try {
+ transactionsCollection = executeManagedOperation(connection,
+ getRuntimeEngineDeployer(connection, mc),
+ Platform.Operations.GET_TRANSACTIONS, args);
+ } catch (Exception e) {
+ final String msg = "Exception executing operation: " + Platform.Operations.GET_TRANSACTIONS; //$NON-NLS-1$
+ LOG.error(msg, e);
+ }
+
+ return transactionsCollection;
+
+ }
+
+ public MetaValue getSessions(ProfileServiceConnection connection) {
+
+ MetaValue sessionCollection = null;
+ MetaValue args = null;
+
+ try {
+ sessionCollection = executeManagedOperation(connection,
+ getRuntimeEngineDeployer(connection, mc),
+ PluginConstants.Operation.GET_SESSIONS, args);
+ } catch (Exception e) {
+ final String msg = "Exception executing operation: " + Platform.Operations.GET_SESSIONS; //$NON-NLS-1$
+ LOG.error(msg, e);
+ }
+ return sessionCollection;
+
+ }
+
+ public static String getVDBStatus(ProfileServiceConnection connection,
+ String vdbName) {
+
+ ManagedComponent mcVdb = null;
+ try {
+ mcVdb = ProfileServiceUtil.getManagedComponent(connection,
+ new org.jboss.managed.api.ComponentType(
+ PluginConstants.ComponentType.VDB.TYPE,
+ PluginConstants.ComponentType.VDB.SUBTYPE), vdbName);
+ } catch (NamingException e) {
+ final String msg = "NamingException in getVDBStatus(): " + e.getExplanation(); //$NON-NLS-1$
+ LOG.error(msg, e);
+ } catch (Exception e) {
+ final String msg = "Exception in getVDBStatus(): " + e.getMessage(); //$NON-NLS-1$
+ LOG.error(msg, e);
+ }
+
+ if (mcVdb == null) {
+ return Status.INACTIVE.toString();
+ }
+
+ return ProfileServiceUtil.getSimpleValue(mcVdb, "status", String.class); //$NON-NLS-1$
+ }
+
+ public static MetaValue executeManagedOperation(
+ ProfileServiceConnection connection, ManagedComponent mc,
+ String operation, MetaValue... args) throws Exception {
+
+ for (ManagedOperation mo : mc.getOperations()) {
+ String opName = mo.getName();
+ if (opName.equals(operation)) {
+ try {
+ if (args.length == 1 && args[0] == null) {
+ return mo.invoke();
+ }
+ return mo.invoke(args);
+ } catch (Exception e) {
+ final String msg = "Exception getting the AdminApi in " + operation; //$NON-NLS-1$
+ LOG.error(msg, e);
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ throw new Exception("No operation found with given name = " + operation); //$NON-NLS-1$
+
+ }
+
+ /**
+ * @param mc
+ * @return
+ */
+ private static ManagedComponent getRuntimeEngineDeployer(
+ ProfileServiceConnection connection, ManagedComponent mc) {
+ try {
+ mc = ProfileServiceUtil.getRuntimeEngineDeployer(connection);
+ } catch (NamingException e) {
+ final String msg = "NamingException getting the DQPManagementView"; //$NON-NLS-1$
+ LOG.error(msg, e);
+ } catch (Exception e1) {
+ final String msg = "Exception getting the DQPManagementView"; //$NON-NLS-1$
+ LOG.error(msg, e1);
+ }
+ return mc;
+ }
+
+ /**
+ * @param mc
+ * @return
+ */
+ private static ManagedComponent getBufferService(ProfileServiceConnection connection, ManagedComponent mc) {
+ try {
+ mc = ProfileServiceUtil.getBufferService(connection);
+ } catch (NamingException e) {
+ final String msg = "NamingException getting the SessionService"; //$NON-NLS-1$
+ LOG.error(msg, e);
+ } catch (Exception e1) {
+ final String msg = "Exception getting the SessionService"; //$NON-NLS-1$
+ LOG.error(msg, e1);
+ }
+ return mc;
+ }
+
+ public static MetaValue getManagedProperty(ProfileServiceConnection connection, ManagedComponent mc, String property) throws Exception {
+
+ ManagedProperty managedProperty = null;
+ try {
+ managedProperty = mc.getProperty(property);
+ } catch (Exception e) {
+ final String msg = "Exception getting the AdminApi in " + property; //$NON-NLS-1$
+ LOG.error(msg, e);
+ }
+
+ if (managedProperty != null) {
+ return managedProperty.getValue();
+ }
+
+ throw new Exception("No property found with given name =" + property); //$NON-NLS-1$
+ }
+
+ private Integer getQueryCount(ProfileServiceConnection connection) {
+
+ Integer count = new Integer(0);
+
+ MetaValue requests = null;
+ Collection<Request> requestsCollection = new ArrayList<Request>();
+
+ requests = getRequests(connection);
+
+ getRequestCollectionValue(requests, requestsCollection);
+
+ if (!requestsCollection.isEmpty()) {
+ count = requestsCollection.size();
+ }
+
+ return count;
+ }
+
+ private Integer getSessionCount(ProfileServiceConnection connection) {
+
+ Collection<Session> activeSessionsCollection = new ArrayList<Session>();
+ MetaValue sessionMetaValue = getSessions(connection);
+ getSessionCollectionValue(sessionMetaValue, activeSessionsCollection);
+ return activeSessionsCollection.size();
+ }
+
+ /**
+ * @param mcVdb
+ * @return count
+ * @throws Exception
+ */
+ private int getErrorCount(ProfileServiceConnection connection,String vdbName) {
+
+ ManagedComponent mcVdb = null;
+ try {
+ mcVdb = ProfileServiceUtil.getManagedComponent(connection,
+ new org.jboss.managed.api.ComponentType(
+ PluginConstants.ComponentType.VDB.TYPE,
+ PluginConstants.ComponentType.VDB.SUBTYPE),vdbName);
+ } catch (NamingException e) {
+ final String msg = "NamingException in getVDBStatus(): " + e.getExplanation(); //$NON-NLS-1$
+ LOG.error(msg, e);
+ } catch (Exception e) {
+ final String msg = "Exception in getVDBStatus(): " + e.getMessage(); //$NON-NLS-1$
+ LOG.error(msg, e);
+ }
+
+ // Get models from VDB
+ int count = 0;
+ ManagedProperty property = mcVdb.getProperty("models"); //$NON-NLS-1$
+ CollectionValueSupport valueSupport = (CollectionValueSupport) property.getValue();
+ MetaValue[] metaValues = valueSupport.getElements();
+
+ for (MetaValue value : metaValues) {
+ GenericValueSupport genValueSupport = (GenericValueSupport) value;
+ ManagedObjectImpl managedObject = (ManagedObjectImpl) genValueSupport.getValue();
+
+ // Get any model errors/warnings
+ MetaValue errors = managedObject.getProperty("errors").getValue(); //$NON-NLS-1$
+ if (errors != null) {
+ CollectionValueSupport errorValueSupport = (CollectionValueSupport) errors;
+ MetaValue[] errorArray = errorValueSupport.getElements();
+ count += errorArray.length;
+ }
+ }
+ return count;
+ }
+
+ protected MetaValue getCacheStats(ProfileServiceConnection connection,
+ String type) {
+ try {
+ return executeManagedOperation(connection,getRuntimeEngineDeployer(connection, mc),
+ Platform.Operations.GET_CACHE_STATS, SimpleValueSupport.wrap(type));
+ } catch (Exception e) {
+ LOG.error("Exception executing operation: " + Platform.Operations.GET_CACHE_STATS, e); //$NON-NLS-1$
+ }
+ return null;
+ }
+
+ protected MetaValue getLongRunningQueries(
+ ProfileServiceConnection connection) {
+
+ MetaValue requestsCollection = null;
+ MetaValue args = null;
+
+ try {
+ requestsCollection = executeManagedOperation(connection,
+ getRuntimeEngineDeployer(connection, mc),
+ Platform.Operations.GET_LONGRUNNINGQUERIES, args);
+ } catch (Exception e) {
+ final String msg = "Exception executing operation: " + Platform.Operations.GET_LONGRUNNINGQUERIES; //$NON-NLS-1$
+ LOG.error(msg, e);
+ }
+
+ return requestsCollection;
+ }
+
+ protected MetaValue getUsedBufferSpace(ProfileServiceConnection connection) {
+
+ MetaValue usedBufferSpace = null;
+
+ try {
+ usedBufferSpace = getManagedProperty(connection, getBufferService(
+ connection, mc), Platform.Operations.GET_BUFFER_USAGE);
+ } catch (Exception e) {
+ final String msg = "Exception executing operation: " + Platform.Operations.GET_BUFFER_USAGE; //$NON-NLS-1$
+ LOG.error(msg, e);
+ }
+
+ return usedBufferSpace;
+ }
+
+ private void getRequestCollectionValue(MetaValue pValue, Collection<Request> list) {
+ MetaType metaType = pValue.getMetaType();
+ if (metaType.isCollection()) {
+ for (MetaValue value : ((CollectionValueSupport) pValue).getElements()) {
+ if (value.getMetaType().isComposite()) {
+ RequestMetadataMapper rmm = new RequestMetadataMapper();
+ RequestMetadata request = rmm.unwrapMetaValue(value);
+ list.add(request);
+ } else {
+ throw new IllegalStateException(pValue + " is not a Composite type"); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+
+ private void getResultsCollectionValue(MetaValue pValue, Collection<ArrayList<String>> list) {
+ MetaType metaType = pValue.getMetaType();
+ if (metaType.isCollection()) {
+ for (MetaValue value : ((CollectionValueSupport) pValue).getElements()) {
+ if (value.getMetaType().isCollection()) {
+ ArrayList<String> row = (ArrayList<String>) MetaValueFactory.getInstance().unwrap(value);
+ list.add(row);
+ }
+ }
+ }
+ }
+
+ private void getResultsCollectionValueForMatViewRefresh(MetaValue pValue, Collection<ArrayList<String>> list) {
+ MetaType metaType = pValue.getMetaType();
+ for (MetaValue value : ((CollectionValueSupport) pValue).getElements()) {
+ if (value.getMetaType().isCollection()) {
+ ArrayList<String> row = (ArrayList<String>) MetaValueFactory.getInstance().unwrap(value);
+ list.add(row);
+ }
+ }
+ }
+
+ public static <T> void getTransactionCollectionValue(MetaValue pValue, Collection<Transaction> list) {
+ MetaType metaType = pValue.getMetaType();
+ if (metaType.isCollection()) {
+ for (MetaValue value : ((CollectionValueSupport) pValue).getElements()) {
+ if (value.getMetaType().isComposite()) {
+ Transaction transaction = (Transaction) MetaValueFactory.getInstance().unwrap(value);
+ list.add(transaction);
+ } else {
+ throw new IllegalStateException(pValue
+ + " is not a Composite type"); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+
+ public static <T> void getSessionCollectionValue(MetaValue pValue,Collection<Session> list) {
+ MetaType metaType = pValue.getMetaType();
+ if (metaType.isCollection()) {
+ for (MetaValue value : ((CollectionValueSupport) pValue).getElements()) {
+ if (value.getMetaType().isComposite()) {
+ Session Session = (Session) MetaValueFactory.getInstance().unwrap(value);
+ list.add(Session);
+ } else {
+ throw new IllegalStateException(pValue
+ + " is not a Composite type"); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+
+ public static <T> void getSessionCollectionValueForVDB(MetaValue pValue,Collection<Session> list, String vdbName) {
+ MetaType metaType = pValue.getMetaType();
+ if (metaType.isCollection()) {
+ for (MetaValue value : ((CollectionValueSupport) pValue).getElements()) {
+ if (value.getMetaType().isComposite()) {
+ Session session = (Session) MetaValueFactory.getInstance().unwrap(value);
+ if (session.getVDBName().equals(vdbName)) {
+ list.add(session);
+ }
+ } else {
+ throw new IllegalStateException(pValue+ " is not a Composite type"); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+
+ private Collection createReportResultList(List fieldNameList, Iterator objectIter) {
+ Collection reportResultList = new ArrayList();
+
+ while (objectIter.hasNext()) {
+ Object object = objectIter.next();
+
+ Class cls = null;
+ try {
+ cls = object.getClass();
+ Iterator methodIter = fieldNameList.iterator();
+ Map reportValueMap = new HashMap<String, String>();
+ while (methodIter.hasNext()) {
+ String fieldName = (String) methodIter.next();
+ String methodName = fieldName;
+ Method meth = cls.getMethod(methodName, (Class[]) null);
+ Object retObj = meth.invoke(object, (Object[]) null);
+ reportValueMap.put(fieldName, retObj);
+ }
+ reportResultList.add(reportValueMap);
+ } catch (Throwable e) {
+ System.err.println(e);
+ }
+ }
+ return reportResultList;
+ }
+
+ private Collection createReportResultListForMatViewQuery(List fieldNameList, Iterator objectIter) {
+ Collection reportResultList = new ArrayList();
+
+ // Iterate through rows
+ while (objectIter.hasNext()) {
+ ArrayList<Object> columnValues = (ArrayList<Object>) objectIter.next();
+
+ try {
+ Iterator fieldIter = fieldNameList.iterator();
+ Map reportValueMap = new HashMap<String, Object>();
+ // Iterate through columns with a row
+ for (Object columnValue : columnValues) {
+ String fieldName = (String) fieldIter.next();
+ reportValueMap.put(fieldName, columnValue);
+ }
+ reportResultList.add(reportValueMap);
+ } catch (Throwable e) {
+ System.err.println(e);
+ }
+ }
+ return reportResultList;
+ }
+
+}
Deleted: tags/teiid-parent-7.2.0.Final/console/src/main/java/org/teiid/rhq/plugin/Facet.java
===================================================================
--- branches/7.2.x/console/src/main/java/org/teiid/rhq/plugin/Facet.java 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/console/src/main/java/org/teiid/rhq/plugin/Facet.java 2010-11-05 03:19:55 UTC (rev 2709)
@@ -1,884 +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.rhq.plugin;
-
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.deployers.spi.management.ManagementView;
-import org.jboss.deployers.spi.management.deploy.DeploymentManager;
-import org.jboss.deployers.spi.management.deploy.DeploymentProgress;
-import org.jboss.deployers.spi.management.deploy.DeploymentStatus;
-import org.jboss.managed.api.ComponentType;
-import org.jboss.managed.api.DeploymentTemplateInfo;
-import org.jboss.managed.api.ManagedComponent;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.profileservice.spi.NoSuchDeploymentException;
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
-import org.rhq.core.domain.configuration.PropertySimple;
-import org.rhq.core.domain.configuration.definition.ConfigurationTemplate;
-import org.rhq.core.domain.content.PackageDetailsKey;
-import org.rhq.core.domain.content.PackageType;
-import org.rhq.core.domain.content.transfer.ContentResponseResult;
-import org.rhq.core.domain.content.transfer.DeployIndividualPackageResponse;
-import org.rhq.core.domain.content.transfer.DeployPackageStep;
-import org.rhq.core.domain.content.transfer.DeployPackagesResponse;
-import org.rhq.core.domain.content.transfer.RemovePackagesResponse;
-import org.rhq.core.domain.content.transfer.ResourcePackageDetails;
-import org.rhq.core.domain.measurement.AvailabilityType;
-import org.rhq.core.domain.measurement.MeasurementReport;
-import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
-import org.rhq.core.domain.resource.CreateResourceStatus;
-import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
-import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
-import org.rhq.core.pluginapi.content.ContentFacet;
-import org.rhq.core.pluginapi.content.ContentServices;
-import org.rhq.core.pluginapi.content.version.PackageVersions;
-import org.rhq.core.pluginapi.inventory.CreateChildResourceFacet;
-import org.rhq.core.pluginapi.inventory.CreateResourceReport;
-import org.rhq.core.pluginapi.inventory.DeleteResourceFacet;
-import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
-import org.rhq.core.pluginapi.inventory.ResourceComponent;
-import org.rhq.core.pluginapi.inventory.ResourceContext;
-import org.rhq.core.pluginapi.measurement.MeasurementFacet;
-import org.rhq.core.pluginapi.operation.OperationFacet;
-import org.rhq.core.pluginapi.operation.OperationResult;
-import org.rhq.core.util.exception.ThrowableUtil;
-import org.rhq.plugins.jbossas5.ProfileServiceComponent;
-import org.rhq.plugins.jbossas5.connection.ProfileServiceConnection;
-import org.teiid.rhq.admin.DQPManagementView;
-import org.teiid.rhq.plugin.objects.ExecutedOperationResultImpl;
-import org.teiid.rhq.plugin.objects.ExecutedResult;
-import org.teiid.rhq.plugin.util.DeploymentUtils;
-import org.teiid.rhq.plugin.util.PluginConstants;
-import org.teiid.rhq.plugin.util.ProfileServiceUtil;
-
-/**
- * This class implements required RHQ interfaces and provides common logic used
- * by all MetaMatrix components.
- */
-public abstract class Facet implements
- ProfileServiceComponent<ResourceComponent>, MeasurementFacet,
- OperationFacet, ConfigurationFacet, ContentFacet, DeleteResourceFacet,
- CreateChildResourceFacet {
-
- protected final Log LOG = LogFactory
- .getLog(PluginConstants.DEFAULT_LOGGER_CATEGORY);
-
- /**
- * Represents the resource configuration of the custom product being
- * managed.
- */
- protected Configuration resourceConfiguration;
-
- /**
- * All AMPS plugins are stateful - this context contains information that
- * your resource component can use when performing its processing.
- */
- protected ResourceContext<?> resourceContext;
-
- protected String name;
-
- private String identifier;
-
- protected String componentType;
-
- protected boolean isAvailable = false;
-
- private final Log log = LogFactory.getLog(this.getClass());
-
- private File deploymentFile;
- private static final String BACKUP_FILE_EXTENSION = ".rej"; //$NON-NLS-1$
-
- /**
- * The name of the ManagedDeployment (e.g.:
- * C:/opt/jboss-5.0.0.GA/server/default/deploy/foo.vdb).
- */
- protected String deploymentName;
- protected String deploymentUrl;
-
- private PackageVersions versions = null;
-
- /**
- * Name of the backing package type that will be used when discovering
- * packages. This corresponds to the name of the package type defined in the
- * plugin descriptor. For simplicity, the package type for VDBs is called
- * "vdb". This is still unique within the context of the parent resource
- * type and lets this class use the same package type name in both cases.
- */
- private static final String PKG_TYPE_VDB = "vdb"; //$NON-NLS-1$
-
- /**
- * Architecture string used in describing discovered packages.
- */
- private static final String ARCHITECTURE = "noarch"; //$NON-NLS-1$
-
- abstract String getComponentType();
-
- /**
- * This is called when your component has been started with the given
- * context. You normally initialize some internal state of your component as
- * well as attempt to make a stateful connection to your managed resource.
- *
- * @see ResourceComponent#start(ResourceContext)
- */
- public void start(ResourceContext context) {
- resourceContext = context;
- deploymentName = context.getResourceKey();
- }
-
- /**
- * This is called when the component is being stopped, usually due to the
- * plugin container shutting down. You can perform some cleanup here; though
- * normally not much needs to be done here.
- *
- * @see ResourceComponent#stop()
- */
- public void stop() {
- this.isAvailable = false;
- }
-
- /**
- * @return the resourceConfiguration
- */
- public Configuration getResourceConfiguration() {
- return resourceConfiguration;
- }
-
- /**
- * @param resourceConfiguration
- * the resourceConfiguration to set
- */
- public void setResourceConfiguration(Configuration resourceConfiguration) {
- this.resourceConfiguration = resourceConfiguration;
- }
-
- public String componentType() {
- return name;
- }
-
- protected void setComponentName(String componentName) {
- this.name = componentName;
- }
-
- public String getComponentIdentifier() {
- return identifier;
- }
-
- protected void setComponentIdentifier(String identifier) {
- this.identifier = identifier;
- }
-
- protected void setOperationArguments(String name,
- Configuration configuration, Map<String, Object> argumentMap) {
- // moved this logic up to the associated implemented class
- throw new InvalidPluginConfigurationException(
- "Not implemented on component type " + this.getComponentType() //$NON-NLS-1$
- + " named " + this.name); //$NON-NLS-1$
-
- }
-
- protected void setMetricArguments(String name, Configuration configuration,
- Map<String, Object> argumentMap) {
- // moved this logic up to the associated implemented class
- throw new InvalidPluginConfigurationException(
- "Not implemented on component type " + this.getComponentType() //$NON-NLS-1$
- + " named " + this.name); //$NON-NLS-1$
-
- }
-
- protected void execute(final ProfileServiceConnection connection,
- final ExecutedResult result, final Map<String, Object> valueMap) {
- DQPManagementView dqp = new DQPManagementView();
-
- dqp.executeOperation(connection, result, valueMap);
-
- }
-
- /*
- * (non-Javadoc) This method is called by JON to check the availability of
- * the inventoried component on a time scheduled basis
- *
- * @see org.rhq.core.pluginapi.inventory.ResourceComponent#getAvailability()
- */
- public AvailabilityType getAvailability() {
-
- LOG.debug("Checking availability of " + identifier); //$NON-NLS-1$
-
- return AvailabilityType.UP;
- }
-
- /**
- * Helper method that indicates the latest status based on the last
- * getAvailabilit() call.
- *
- * @return true if the resource is available
- */
- protected boolean isAvailable() {
- return true;
- }
-
- /**
- * The plugin container will call this method when your resource component
- * has been scheduled to collect some measurements now. It is within this
- * method that you actually talk to the managed resource and collect the
- * measurement data that is has emitted.
- *
- * @see MeasurementFacet#getValues(MeasurementReport, Set)
- */
- public abstract void getValues(MeasurementReport arg0,
- Set<MeasurementScheduleRequest> arg1) throws Exception;
-
- /**
- * The plugin container will call this method when it wants to invoke an
- * operation on your managed resource. Your plugin will connect to the
- * managed resource and invoke the analogous operation in your own custom
- * way.
- *
- * @see OperationFacet#invokeOperation(String, Configuration)
- */
- public OperationResult invokeOperation(String name,
- Configuration configuration) {
- Map<String, Object> valueMap = new HashMap<String, Object>();
-
- Set operationDefinitionSet = this.resourceContext.getResourceType()
- .getOperationDefinitions();
-
- ExecutedResult result = new ExecutedOperationResultImpl(this
- .getComponentType(), name, operationDefinitionSet);
-
- setOperationArguments(name, configuration, valueMap);
-
- execute(getConnection(), result, valueMap);
-
- return ((ExecutedOperationResultImpl) result).getOperationResult();
-
- }
-
- /**
- * The plugin container will call this method and it needs to obtain the
- * current configuration of the managed resource. Your plugin will obtain
- * the managed resource's configuration in your own custom way and populate
- * the returned Configuration object with the managed resource's
- * configuration property values.
- *
- * @see ConfigurationFacet#loadResourceConfiguration()
- */
- public Configuration loadResourceConfiguration() {
- // here we simulate the loading of the managed resource's configuration
-
- if (resourceConfiguration == null) {
- // for this example, we will create a simple dummy configuration to
- // start with.
- // note that it is empty, so we're assuming there are no required
- // configs in the plugin descriptor.
- resourceConfiguration = this.resourceContext
- .getPluginConfiguration();
- }
-
- Configuration config = resourceConfiguration;
-
- return config;
- }
-
- /**
- * The plugin container will call this method when it has a new
- * configuration for your managed resource. Your plugin will re-configure
- * the managed resource in your own custom way, setting its configuration
- * based on the new values of the given configuration.
- *
- * @see ConfigurationFacet#updateResourceConfiguration(ConfigurationUpdateReport)
- */
- public void updateResourceConfiguration(ConfigurationUpdateReport report) {
-
- resourceConfiguration = report.getConfiguration().deepCopy();
-
- Configuration resourceConfig = report.getConfiguration();
-
- ManagementView managementView = null;
- ComponentType componentType = null;
- if (this.getComponentType().equals(
- PluginConstants.ComponentType.VDB.NAME)) {
- componentType = new ComponentType(
- PluginConstants.ComponentType.VDB.TYPE,
- PluginConstants.ComponentType.VDB.SUBTYPE);
- } else {
- report.setStatus(ConfigurationUpdateStatus.FAILURE);
- report
- .setErrorMessage("Update not implemented for the component type."); //$NON-NLS-1$
- }
-
- ManagedComponent managedComponent = null;
- report.setStatus(ConfigurationUpdateStatus.SUCCESS);
- try {
-
- managementView = getConnection().getManagementView();
- managedComponent = managementView.getComponent(this.name,
- componentType);
- Map<String, ManagedProperty> managedProperties = managedComponent
- .getProperties();
-
- ProfileServiceUtil.convertConfigurationToManagedProperties(
- managedProperties, resourceConfig, resourceContext
- .getResourceType());
-
- try {
- managementView.updateComponent(managedComponent);
- } catch (Exception e) {
- LOG.error("Unable to update component [" //$NON-NLS-1$
- + managedComponent.getName() + "] of type " //$NON-NLS-1$
- + componentType + ".", e); //$NON-NLS-1$
- report.setStatus(ConfigurationUpdateStatus.FAILURE);
- report.setErrorMessageFromThrowable(e);
- }
- } catch (Exception e) {
- LOG.error("Unable to process update request", e); //$NON-NLS-1$
- report.setStatus(ConfigurationUpdateStatus.FAILURE);
- report.setErrorMessageFromThrowable(e);
- }
- }
-
- /**
- * @return
- * @throws Exception
- */
- protected Map<String, ManagedProperty> getManagedProperties()
- throws Exception {
- return null;
- }
-
- /**
- * @param managedComponent
- * @throws Exception
- */
- protected void updateComponent(ManagedComponent managedComponent)
- throws Exception {
- log.trace("Updating " + this.name + " with component " //$NON-NLS-1$ //$NON-NLS-2$
- + managedComponent.toString() + "..."); //$NON-NLS-1$
- ManagementView managementView = getConnection().getManagementView();
- managementView.updateComponent(managedComponent);
-
- }
-
- @Override
- public void deleteResource() throws Exception {
-
- DeploymentManager deploymentManager = getConnection()
- .getDeploymentManager();
-
- log.debug("Stopping deployment [" + this.deploymentName + "]..."); //$NON-NLS-1$ //$NON-NLS-2$
- DeploymentProgress progress = deploymentManager
- .stop(this.deploymentName);
- DeploymentStatus stopStatus = DeploymentUtils.run(progress);
- if (stopStatus.isFailed()) {
- log.error("Failed to stop deployment '" + this.deploymentName //$NON-NLS-1$
- + "'.", stopStatus.getFailure()); //$NON-NLS-1$
- throw new Exception("Failed to stop deployment '" //$NON-NLS-1$
- + this.deploymentName + "' - cause: " //$NON-NLS-1$
- + stopStatus.getFailure());
- }
- log.debug("Removing deployment [" + this.deploymentName + "]..."); //$NON-NLS-1$ //$NON-NLS-2$
- progress = deploymentManager.remove(this.deploymentName);
- DeploymentStatus removeStatus = DeploymentUtils.run(progress);
- if (removeStatus.isFailed()) {
- log.error("Failed to remove deployment '" + this.deploymentName //$NON-NLS-1$
- + "'.", removeStatus.getFailure()); //$NON-NLS-1$
- throw new Exception("Failed to remove deployment '" //$NON-NLS-1$
- + this.deploymentName + "' - cause: " //$NON-NLS-1$
- + removeStatus.getFailure());
- }
-
- }
-
- @Override
- public DeployPackagesResponse deployPackages(
- Set<ResourcePackageDetails> packages,
- ContentServices contentServices) {
- // You can only update the one application file referenced by this
- // resource, so punch out if multiple are
- // specified.
- if (packages.size() != 1) {
- log
- .warn("Request to update a VDB file contained multiple packages: " //$NON-NLS-1$
- + packages);
- DeployPackagesResponse response = new DeployPackagesResponse(
- ContentResponseResult.FAILURE);
- response
- .setOverallRequestErrorMessage("When updating a VDB, only one VDB can be updated at a time."); //$NON-NLS-1$
- return response;
- }
-
- ResourcePackageDetails packageDetails = packages.iterator().next();
-
- log.debug("Updating VDB file '" + this.deploymentFile + "' using [" //$NON-NLS-1$ //$NON-NLS-2$
- + packageDetails + "]..."); //$NON-NLS-1$
-
- log.debug("Writing new VDB bits to temporary file..."); //$NON-NLS-1$
- File tempFile;
- try {
- tempFile = writeNewAppBitsToTempFile(contentServices,
- packageDetails);
- } catch (Exception e) {
- return failApplicationDeployment(
- "Error writing new application bits to temporary file - cause: " //$NON-NLS-1$
- + e, packageDetails);
- }
- log.debug("Wrote new VDB bits to temporary file '" + tempFile //$NON-NLS-1$
- + "'."); //$NON-NLS-1$
-
- boolean deployExploded = this.deploymentFile.isDirectory();
-
- // Backup the original app file/dir to <filename>.rej.
- File backupOfOriginalFile = new File(this.deploymentFile.getPath()
- + BACKUP_FILE_EXTENSION);
- log.debug("Backing up existing VDB '" + this.deploymentFile //$NON-NLS-1$
- + "' to '" + backupOfOriginalFile + "'..."); //$NON-NLS-1$ //$NON-NLS-2$
- try {
- if (backupOfOriginalFile.exists())
- FileUtils.forceDelete(backupOfOriginalFile);
- if (this.deploymentFile.isDirectory())
- FileUtils.copyDirectory(this.deploymentFile,
- backupOfOriginalFile, true);
- else
- FileUtils.copyFile(this.deploymentFile, backupOfOriginalFile,
- true);
- } catch (Exception e) {
- throw new RuntimeException("Failed to backup existing EAR/WAR '" //$NON-NLS-1$
- + this.deploymentFile + "' to '" + backupOfOriginalFile //$NON-NLS-1$
- + "'."); //$NON-NLS-1$
- }
-
- // Now stop the original app.
- try {
- DeploymentManager deploymentManager = getConnection()
- .getDeploymentManager();
- DeploymentProgress progress = deploymentManager
- .stop(this.deploymentUrl);
- DeploymentUtils.run(progress);
- } catch (Exception e) {
- throw new RuntimeException("Failed to stop deployment [" //$NON-NLS-1$
- + this.deploymentUrl + "].", e); //$NON-NLS-1$
- }
-
- // And then remove it (this will delete the physical file/dir from the
- // deploy dir).
- try {
- DeploymentManager deploymentManager = getConnection()
- .getDeploymentManager();
- DeploymentProgress progress = deploymentManager
- .remove(this.deploymentUrl);
- DeploymentUtils.run(progress);
- } catch (Exception e) {
- throw new RuntimeException("Failed to remove deployment [" //$NON-NLS-1$
- + this.deploymentUrl + "].", e); //$NON-NLS-1$
- }
-
- // Deploy away!
- log.debug("Deploying '" + tempFile + "'..."); //$NON-NLS-1$ //$NON-NLS-2$
- DeploymentManager deploymentManager = getConnection()
- .getDeploymentManager();
- try {
- DeploymentUtils.deployArchive(deploymentManager, tempFile,
- deployExploded);
- } catch (Exception e) {
- // Deploy failed - rollback to the original app file...
- log.debug("Redeploy failed - rolling back to original archive...", //$NON-NLS-1$
- e);
- String errorMessage = ThrowableUtil.getAllMessages(e);
- try {
- // Delete the new app, which failed to deploy.
- FileUtils.forceDelete(this.deploymentFile);
- // Need to re-deploy the original file - this generally should
- // succeed.
- DeploymentUtils.deployArchive(deploymentManager,
- backupOfOriginalFile, deployExploded);
- errorMessage += " ***** ROLLED BACK TO ORIGINAL APPLICATION FILE. *****"; //$NON-NLS-1$
- } catch (Exception e1) {
- log.debug("Rollback failed!", e1); //$NON-NLS-1$
- errorMessage += " ***** FAILED TO ROLLBACK TO ORIGINAL APPLICATION FILE. *****: " //$NON-NLS-1$
- + ThrowableUtil.getAllMessages(e1);
- }
- log.info("Failed to update VDB file '" + this.deploymentFile //$NON-NLS-1$
- + "' using [" + packageDetails + "]."); //$NON-NLS-1$ //$NON-NLS-2$
- return failApplicationDeployment(errorMessage, packageDetails);
- }
-
- // Deploy was successful!
-
- deleteBackupOfOriginalFile(backupOfOriginalFile);
- persistApplicationVersion(packageDetails, this.deploymentFile);
-
- DeployPackagesResponse response = new DeployPackagesResponse(
- ContentResponseResult.SUCCESS);
- DeployIndividualPackageResponse packageResponse = new DeployIndividualPackageResponse(
- packageDetails.getKey(), ContentResponseResult.SUCCESS);
- response.addPackageResponse(packageResponse);
-
- log.debug("Updated VDB file '" + this.deploymentFile //$NON-NLS-1$
- + "' successfully - returning response [" + response + "]..."); //$NON-NLS-1$ //$NON-NLS-2$
-
- return response;
- }
-
- private void deleteBackupOfOriginalFile(File backupOfOriginalFile) {
- log.debug("Deleting backup of original file '" + backupOfOriginalFile //$NON-NLS-1$
- + "'..."); //$NON-NLS-1$
- try {
- FileUtils.forceDelete(backupOfOriginalFile);
- } catch (Exception e) {
- // not critical.
- log.warn("Failed to delete backup of original file: " //$NON-NLS-1$
- + backupOfOriginalFile);
- }
- }
-
- private void persistApplicationVersion(ResourcePackageDetails packageDetails, File appFile)
- {
- String packageName = appFile.getName();
- log.debug("Persisting application version '" + packageDetails.getVersion() + "' for package '" + packageName //$NON-NLS-1$ //$NON-NLS-2$
- + "'"); //$NON-NLS-1$
- PackageVersions versions = loadPackageVersions();
- versions.putVersion(packageName, packageDetails.getVersion());
- }
-
- private File writeNewAppBitsToTempFile(ContentServices contentServices,
- ResourcePackageDetails packageDetails) throws Exception {
- File tempDir = this.resourceContext.getTemporaryDirectory();
- File tempFile = new File(tempDir, this.deploymentFile.getName());
-
- OutputStream tempOutputStream = null;
- try {
- tempOutputStream = new BufferedOutputStream(new FileOutputStream(
- tempFile));
- long bytesWritten = contentServices.downloadPackageBits(
- this.resourceContext.getContentContext(), packageDetails
- .getKey(), tempOutputStream, true);
- log
- .debug("Wrote " + bytesWritten + " bytes to '" + tempFile //$NON-NLS-1$ //$NON-NLS-2$
- + "'."); //$NON-NLS-1$
- } catch (IOException e) {
- log.error(
- "Error writing updated application bits to temporary location: " //$NON-NLS-1$
- + tempFile, e);
- throw e;
- } finally {
- if (tempOutputStream != null) {
- try {
- tempOutputStream.close();
- } catch (IOException e) {
- log.error("Error closing temporary output stream", e); //$NON-NLS-1$
- }
- }
- }
- if (!tempFile.exists()) {
- log.error("Temporary file for application update not written to: " //$NON-NLS-1$
- + tempFile);
- throw new Exception();
- }
- return tempFile;
- }
-
- /**
- * Creates the necessary transfer objects to report a failed application
- * deployment (update).
- *
- * @param errorMessage
- * reason the deploy failed
- * @param packageDetails
- * describes the update being made
- * @return response populated to reflect a failure
- */
- private DeployPackagesResponse failApplicationDeployment(
- String errorMessage, ResourcePackageDetails packageDetails) {
- DeployPackagesResponse response = new DeployPackagesResponse(
- ContentResponseResult.FAILURE);
-
- DeployIndividualPackageResponse packageResponse = new DeployIndividualPackageResponse(
- packageDetails.getKey(), ContentResponseResult.FAILURE);
- packageResponse.setErrorMessage(errorMessage);
-
- response.addPackageResponse(packageResponse);
-
- return response;
- }
-
- @Override
- public Set<ResourcePackageDetails> discoverDeployedPackages(PackageType arg0) {
-
- // PLEASE DO NOT REMOVE THIS METHOD. IT IS REQUIRED FOR THE CONTENT TAB.
-
- Configuration pluginConfig = this.resourceContext
- .getPluginConfiguration();
- this.deploymentUrl = pluginConfig.getSimple("url").getStringValue(); //$NON-NLS-1$
-
- if (this.deploymentUrl != null) {
- this.deploymentFile = new File(this.deploymentUrl
- .substring(deploymentUrl.indexOf(":/") + 1)); //$NON-NLS-1$
- }
-
- if (!deploymentFile.exists())
- throw new IllegalStateException("Deployment file '" //$NON-NLS-1$
- + this.deploymentFile + "' for " + this.getComponentType() //$NON-NLS-1$
- + " does not exist."); //$NON-NLS-1$
-
- String fileName = deploymentFile.getName();
- org.rhq.core.pluginapi.content.version.PackageVersions packageVersions = loadPackageVersions();
- String version = packageVersions.getVersion(fileName);
- if (version == null) {
- // This is either the first time we've discovered this VDB, or
- // someone purged the PC's data dir.
- version = "1.0"; //$NON-NLS-1$
- packageVersions.putVersion(fileName, version);
- packageVersions.saveToDisk();
- }
-
- // Package name is the deployment's file name (e.g. foo.ear).
- PackageDetailsKey key = new PackageDetailsKey(fileName, version,
- PKG_TYPE_VDB, ARCHITECTURE);
- ResourcePackageDetails packageDetails = new ResourcePackageDetails(key);
- packageDetails.setFileName(fileName);
- packageDetails.setLocation(deploymentFile.getPath());
- if (!deploymentFile.isDirectory())
- packageDetails.setFileSize(deploymentFile.length());
- packageDetails.setFileCreatedDate(null);
- Set<ResourcePackageDetails> packages = new HashSet<ResourcePackageDetails>();
- packages.add(packageDetails);
-
- return packages;
- }
-
- @Override
- public List<DeployPackageStep> generateInstallationSteps(
- ResourcePackageDetails arg0) {
- return null;
- }
-
- @Override
- public RemovePackagesResponse removePackages(
- Set<ResourcePackageDetails> arg0) {
- return null;
- }
-
- @Override
- public InputStream retrievePackageBits(ResourcePackageDetails packageDetails) {
- return null;
- }
-
- protected static Configuration getDefaultPluginConfiguration(
- ResourceType resourceType) {
- ConfigurationTemplate pluginConfigDefaultTemplate = resourceType
- .getPluginConfigurationDefinition().getDefaultTemplate();
- return (pluginConfigDefaultTemplate != null) ? pluginConfigDefaultTemplate
- .createConfiguration()
- : new Configuration();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.rhq.core.pluginapi.inventory.CreateChildResourceFacet#createResource
- * (org.rhq.core.pluginapi.inventory.CreateResourceReport)
- */
- @Override
- public CreateResourceReport createResource(CreateResourceReport report) {
- ResourceType resourceType = report.getResourceType();
- // if (resourceType.getName().equals("Translators")) {
- // createConfigurationBasedResource(report);
- // } else {
- createContentBasedResource(report);
- // }
-
- return report;
- }
-
- private CreateResourceReport createConfigurationBasedResource(
- CreateResourceReport createResourceReport) {
- ResourceType resourceType = createResourceReport.getResourceType();
- Configuration defaultPluginConfig = getDefaultPluginConfiguration(resourceType);
- Configuration resourceConfig = createResourceReport
- .getResourceConfiguration();
- String resourceName = getResourceName(defaultPluginConfig,
- resourceConfig);
- ComponentType componentType = ProfileServiceUtil
- .getComponentType(resourceType);
- ManagementView managementView = null;
- ;
- managementView = getConnection().getManagementView();
-
- if (ProfileServiceUtil.isManagedComponent(getConnection(),
- resourceName, componentType)) {
- createResourceReport.setStatus(CreateResourceStatus.FAILURE);
- createResourceReport.setErrorMessage("A " + resourceType.getName() //$NON-NLS-1$
- + " named '" + resourceName + "' already exists."); //$NON-NLS-1$ //$NON-NLS-2$
- return createResourceReport;
- }
-
- createResourceReport.setResourceName(resourceName);
- String resourceKey = getResourceKey(resourceType, resourceName);
- createResourceReport.setResourceKey(resourceKey);
-
- PropertySimple templateNameProperty = resourceConfig
- .getSimple(TranslatorComponent.Config.TEMPLATE_NAME);
- String templateName = templateNameProperty.getStringValue();
-
- DeploymentTemplateInfo template;
- try {
- template = managementView.getTemplate(templateName);
- Map<String, ManagedProperty> managedProperties = template
- .getProperties();
-
- ProfileServiceUtil.convertConfigurationToManagedProperties(
- managedProperties, resourceConfig, resourceType);
-
- LOG.debug("Applying template [" + templateName //$NON-NLS-1$
- + "] to create ManagedComponent of type [" + componentType //$NON-NLS-1$
- + "]..."); //$NON-NLS-1$
- try {
- managementView.applyTemplate(resourceName, template);
- managementView.process();
- createResourceReport.setStatus(CreateResourceStatus.SUCCESS);
- } catch (Exception e) {
- LOG.error("Unable to apply template [" + templateName //$NON-NLS-1$
- + "] to create ManagedComponent of type " //$NON-NLS-1$
- + componentType + ".", e); //$NON-NLS-1$
- createResourceReport.setStatus(CreateResourceStatus.FAILURE);
- createResourceReport.setException(e);
- }
- } catch (NoSuchDeploymentException e) {
- LOG.error("Unable to find template [" + templateName + "].", e); //$NON-NLS-1$ //$NON-NLS-2$
- createResourceReport.setStatus(CreateResourceStatus.FAILURE);
- createResourceReport.setException(e);
- } catch (Exception e) {
- LOG.error("Unable to process create request", e); //$NON-NLS-1$
- createResourceReport.setStatus(CreateResourceStatus.FAILURE);
- createResourceReport.setException(e);
- }
- return createResourceReport;
- }
-
- protected void createContentBasedResource(
- CreateResourceReport createResourceReport) {
-
- ResourcePackageDetails details = createResourceReport
- .getPackageDetails();
- PackageDetailsKey key = details.getKey();
- // This is the full path to a temporary file which was written by the UI
- // layer.
- String archivePath = key.getName();
-
- try {
- File archiveFile = new File(archivePath);
-
- if (!DeploymentUtils.hasCorrectExtension(archiveFile.getName(),
- resourceContext.getResourceType())) {
- createResourceReport.setStatus(CreateResourceStatus.FAILURE);
- createResourceReport
- .setErrorMessage("Incorrect extension specified on filename [" //$NON-NLS-1$
- + archivePath + "]"); //$NON-NLS-1$
-
- }
-
- DeploymentManager deploymentManager = getConnection()
- .getDeploymentManager();
- DeploymentUtils
- .deployArchive(deploymentManager, archiveFile, false);
-
- deploymentName = archivePath;
- createResourceReport.setResourceName(archivePath);
- createResourceReport.setResourceKey(archivePath);
- createResourceReport.setStatus(CreateResourceStatus.SUCCESS);
-
- } catch (Throwable t) {
- log.error("Error deploying application for report: " //$NON-NLS-1$
- + createResourceReport, t);
- createResourceReport.setStatus(CreateResourceStatus.FAILURE);
- createResourceReport.setException(t);
- }
-
- }
-
- private static String getResourceName(Configuration pluginConfig,
- Configuration resourceConfig) {
- PropertySimple resourceNameProp = pluginConfig
- .getSimple(TranslatorComponent.Config.RESOURCE_NAME);
- if (resourceNameProp == null
- || resourceNameProp.getStringValue() == null)
- throw new IllegalStateException("Property [" //$NON-NLS-1$
- + TranslatorComponent.Config.RESOURCE_NAME
- + "] is not defined in the default plugin configuration."); //$NON-NLS-1$
- String resourceNamePropName = resourceNameProp.getStringValue();
- PropertySimple propToUseAsResourceName = resourceConfig
- .getSimple(resourceNamePropName);
- if (propToUseAsResourceName == null)
- throw new IllegalStateException("Property [" + resourceNamePropName //$NON-NLS-1$
- + "] is not defined in initial Resource configuration."); //$NON-NLS-1$
- return propToUseAsResourceName.getStringValue();
- }
-
- private String getResourceKey(ResourceType resourceType, String resourceName) {
- ComponentType componentType = ProfileServiceUtil
- .getComponentType(resourceType);
- if (componentType == null)
- throw new IllegalStateException("Unable to map " + resourceType //$NON-NLS-1$
- + " to a ComponentType."); //$NON-NLS-1$
- return componentType.getType() + ":" + componentType.getSubtype() + ":" //$NON-NLS-1$ //$NON-NLS-2$
- + resourceName;
- }
-
- /**
- * Returns an instantiated and loaded versions store access point.
- *
- * @return will not be <code>null</code>
- */
- private org.rhq.core.pluginapi.content.version.PackageVersions loadPackageVersions() {
- if (this.versions == null) {
- ResourceType resourceType = resourceContext.getResourceType();
- String pluginName = resourceType.getPlugin();
- File dataDirectoryFile = resourceContext.getDataDirectory();
- dataDirectoryFile.mkdirs();
- String dataDirectory = dataDirectoryFile.getAbsolutePath();
- log.trace("Creating application versions store with plugin name [" //$NON-NLS-1$
- + pluginName + "] and data directory [" + dataDirectory //$NON-NLS-1$
- + "]"); //$NON-NLS-1$
- this.versions = new PackageVersions(pluginName, dataDirectory);
- this.versions.loadFromDisk();
- }
-
- return this.versions;
- }
-
-}
Copied: tags/teiid-parent-7.2.0.Final/console/src/main/java/org/teiid/rhq/plugin/Facet.java (from rev 2707, branches/7.2.x/console/src/main/java/org/teiid/rhq/plugin/Facet.java)
===================================================================
--- tags/teiid-parent-7.2.0.Final/console/src/main/java/org/teiid/rhq/plugin/Facet.java (rev 0)
+++ tags/teiid-parent-7.2.0.Final/console/src/main/java/org/teiid/rhq/plugin/Facet.java 2010-11-05 03:19:55 UTC (rev 2709)
@@ -0,0 +1,880 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.rhq.plugin;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.deployers.spi.management.deploy.DeploymentManager;
+import org.jboss.deployers.spi.management.deploy.DeploymentProgress;
+import org.jboss.deployers.spi.management.deploy.DeploymentStatus;
+import org.jboss.managed.api.ComponentType;
+import org.jboss.managed.api.DeploymentTemplateInfo;
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.profileservice.spi.NoSuchDeploymentException;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.configuration.definition.ConfigurationTemplate;
+import org.rhq.core.domain.content.PackageDetailsKey;
+import org.rhq.core.domain.content.PackageType;
+import org.rhq.core.domain.content.transfer.ContentResponseResult;
+import org.rhq.core.domain.content.transfer.DeployIndividualPackageResponse;
+import org.rhq.core.domain.content.transfer.DeployPackageStep;
+import org.rhq.core.domain.content.transfer.DeployPackagesResponse;
+import org.rhq.core.domain.content.transfer.RemovePackagesResponse;
+import org.rhq.core.domain.content.transfer.ResourcePackageDetails;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.measurement.MeasurementReport;
+import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
+import org.rhq.core.domain.resource.CreateResourceStatus;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
+import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
+import org.rhq.core.pluginapi.content.ContentFacet;
+import org.rhq.core.pluginapi.content.ContentServices;
+import org.rhq.core.pluginapi.content.version.PackageVersions;
+import org.rhq.core.pluginapi.inventory.CreateChildResourceFacet;
+import org.rhq.core.pluginapi.inventory.CreateResourceReport;
+import org.rhq.core.pluginapi.inventory.DeleteResourceFacet;
+import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.core.pluginapi.measurement.MeasurementFacet;
+import org.rhq.core.pluginapi.operation.OperationFacet;
+import org.rhq.core.pluginapi.operation.OperationResult;
+import org.rhq.core.util.exception.ThrowableUtil;
+import org.rhq.plugins.jbossas5.ProfileServiceComponent;
+import org.rhq.plugins.jbossas5.connection.ProfileServiceConnection;
+import org.teiid.rhq.admin.DQPManagementView;
+import org.teiid.rhq.plugin.objects.ExecutedOperationResultImpl;
+import org.teiid.rhq.plugin.objects.ExecutedResult;
+import org.teiid.rhq.plugin.util.DeploymentUtils;
+import org.teiid.rhq.plugin.util.PluginConstants;
+import org.teiid.rhq.plugin.util.ProfileServiceUtil;
+
+/**
+ * This class implements required RHQ interfaces and provides common logic used
+ * by all MetaMatrix components.
+ */
+public abstract class Facet implements
+ ProfileServiceComponent<ResourceComponent>, MeasurementFacet,
+ OperationFacet, ConfigurationFacet, ContentFacet, DeleteResourceFacet,
+ CreateChildResourceFacet {
+
+ protected final Log LOG = LogFactory
+ .getLog(PluginConstants.DEFAULT_LOGGER_CATEGORY);
+
+ /**
+ * Represents the resource configuration of the custom product being
+ * managed.
+ */
+ protected Configuration resourceConfiguration;
+
+ /**
+ * All AMPS plugins are stateful - this context contains information that
+ * your resource component can use when performing its processing.
+ */
+ protected ResourceContext<?> resourceContext;
+
+ protected String name;
+
+ private String identifier;
+
+ protected String componentType;
+
+ protected boolean isAvailable = false;
+
+ private final Log log = LogFactory.getLog(this.getClass());
+
+ private File deploymentFile;
+ private static final String BACKUP_FILE_EXTENSION = ".rej"; //$NON-NLS-1$
+
+ /**
+ * The name of the ManagedDeployment (e.g.:
+ * C:/opt/jboss-5.0.0.GA/server/default/deploy/foo.vdb).
+ */
+ protected String deploymentName;
+ protected String deploymentUrl;
+
+ private PackageVersions versions = null;
+
+ /**
+ * Name of the backing package type that will be used when discovering
+ * packages. This corresponds to the name of the package type defined in the
+ * plugin descriptor. For simplicity, the package type for VDBs is called
+ * "vdb". This is still unique within the context of the parent resource
+ * type and lets this class use the same package type name in both cases.
+ */
+ private static final String PKG_TYPE_VDB = "vdb"; //$NON-NLS-1$
+
+ /**
+ * Architecture string used in describing discovered packages.
+ */
+ private static final String ARCHITECTURE = "noarch"; //$NON-NLS-1$
+
+ abstract String getComponentType();
+
+ /**
+ * This is called when your component has been started with the given
+ * context. You normally initialize some internal state of your component as
+ * well as attempt to make a stateful connection to your managed resource.
+ *
+ * @see ResourceComponent#start(ResourceContext)
+ */
+ public void start(ResourceContext context) {
+ resourceContext = context;
+ deploymentName = context.getResourceKey();
+ }
+
+ /**
+ * This is called when the component is being stopped, usually due to the
+ * plugin container shutting down. You can perform some cleanup here; though
+ * normally not much needs to be done here.
+ *
+ * @see ResourceComponent#stop()
+ */
+ public void stop() {
+ this.isAvailable = false;
+ }
+
+ /**
+ * @return the resourceConfiguration
+ */
+ public Configuration getResourceConfiguration() {
+ return resourceConfiguration;
+ }
+
+ /**
+ * @param resourceConfiguration
+ * the resourceConfiguration to set
+ */
+ public void setResourceConfiguration(Configuration resourceConfiguration) {
+ this.resourceConfiguration = resourceConfiguration;
+ }
+
+ public String componentType() {
+ return name;
+ }
+
+ protected void setComponentName(String componentName) {
+ this.name = componentName;
+ }
+
+ public String getComponentIdentifier() {
+ return identifier;
+ }
+
+ protected void setComponentIdentifier(String identifier) {
+ this.identifier = identifier;
+ }
+
+ protected void setOperationArguments(String name,
+ Configuration configuration, Map<String, Object> argumentMap) {
+ // moved this logic up to the associated implemented class
+ throw new InvalidPluginConfigurationException(
+ "Not implemented on component type " + this.getComponentType() //$NON-NLS-1$
+ + " named " + this.name); //$NON-NLS-1$
+
+ }
+
+ protected void setMetricArguments(String name, Configuration configuration,
+ Map<String, Object> argumentMap) {
+ // moved this logic up to the associated implemented class
+ throw new InvalidPluginConfigurationException(
+ "Not implemented on component type " + this.getComponentType() //$NON-NLS-1$
+ + " named " + this.name); //$NON-NLS-1$
+
+ }
+
+ protected void execute(final ProfileServiceConnection connection,
+ final ExecutedResult result, final Map<String, Object> valueMap) {
+ DQPManagementView dqp = new DQPManagementView();
+
+ dqp.executeOperation(connection, result, valueMap);
+
+ }
+
+ /*
+ * (non-Javadoc) This method is called by JON to check the availability of
+ * the inventoried component on a time scheduled basis
+ *
+ * @see org.rhq.core.pluginapi.inventory.ResourceComponent#getAvailability()
+ */
+ public AvailabilityType getAvailability() {
+
+ LOG.debug("Checking availability of " + identifier); //$NON-NLS-1$
+
+ return AvailabilityType.UP;
+ }
+
+ /**
+ * Helper method that indicates the latest status based on the last
+ * getAvailabilit() call.
+ *
+ * @return true if the resource is available
+ */
+ protected boolean isAvailable() {
+ return true;
+ }
+
+ /**
+ * The plugin container will call this method when your resource component
+ * has been scheduled to collect some measurements now. It is within this
+ * method that you actually talk to the managed resource and collect the
+ * measurement data that is has emitted.
+ *
+ * @see MeasurementFacet#getValues(MeasurementReport, Set)
+ */
+ public abstract void getValues(MeasurementReport arg0,
+ Set<MeasurementScheduleRequest> arg1) throws Exception;
+
+ /**
+ * The plugin container will call this method when it wants to invoke an
+ * operation on your managed resource. Your plugin will connect to the
+ * managed resource and invoke the analogous operation in your own custom
+ * way.
+ *
+ * @see OperationFacet#invokeOperation(String, Configuration)
+ */
+ public OperationResult invokeOperation(String name,
+ Configuration configuration) {
+ Map<String, Object> valueMap = new HashMap<String, Object>();
+
+ Set operationDefinitionSet = this.resourceContext.getResourceType()
+ .getOperationDefinitions();
+
+ ExecutedResult result = new ExecutedOperationResultImpl(this
+ .getComponentType(), name, operationDefinitionSet);
+
+ setOperationArguments(name, configuration, valueMap);
+
+ execute(getConnection(), result, valueMap);
+
+ return ((ExecutedOperationResultImpl) result).getOperationResult();
+
+ }
+
+ /**
+ * The plugin container will call this method and it needs to obtain the
+ * current configuration of the managed resource. Your plugin will obtain
+ * the managed resource's configuration in your own custom way and populate
+ * the returned Configuration object with the managed resource's
+ * configuration property values.
+ *
+ * @see ConfigurationFacet#loadResourceConfiguration()
+ */
+ public Configuration loadResourceConfiguration() {
+ // here we simulate the loading of the managed resource's configuration
+
+ if (resourceConfiguration == null) {
+ // for this example, we will create a simple dummy configuration to
+ // start with.
+ // note that it is empty, so we're assuming there are no required
+ // configs in the plugin descriptor.
+ resourceConfiguration = this.resourceContext
+ .getPluginConfiguration();
+ }
+
+ Configuration config = resourceConfiguration;
+
+ return config;
+ }
+
+ /**
+ * The plugin container will call this method when it has a new
+ * configuration for your managed resource. Your plugin will re-configure
+ * the managed resource in your own custom way, setting its configuration
+ * based on the new values of the given configuration.
+ *
+ * @see ConfigurationFacet#updateResourceConfiguration(ConfigurationUpdateReport)
+ */
+ public void updateResourceConfiguration(ConfigurationUpdateReport report) {
+
+ resourceConfiguration = report.getConfiguration().deepCopy();
+
+ Configuration resourceConfig = report.getConfiguration();
+
+ ManagementView managementView = null;
+ ComponentType componentType = null;
+ if (this.getComponentType().equals(
+ PluginConstants.ComponentType.VDB.NAME)) {
+ componentType = new ComponentType(
+ PluginConstants.ComponentType.VDB.TYPE,
+ PluginConstants.ComponentType.VDB.SUBTYPE);
+ } else {
+ report.setStatus(ConfigurationUpdateStatus.FAILURE);
+ report
+ .setErrorMessage("Update not implemented for the component type."); //$NON-NLS-1$
+ }
+
+ ManagedComponent managedComponent = null;
+ report.setStatus(ConfigurationUpdateStatus.SUCCESS);
+ try {
+
+ managementView = getConnection().getManagementView();
+ managedComponent = managementView.getComponent(this.name,
+ componentType);
+ Map<String, ManagedProperty> managedProperties = managedComponent
+ .getProperties();
+
+ ProfileServiceUtil.convertConfigurationToManagedProperties(managedProperties, resourceConfig, resourceContext.getResourceType(), null);
+
+ try {
+ managementView.updateComponent(managedComponent);
+ } catch (Exception e) {
+ LOG.error("Unable to update component [" //$NON-NLS-1$
+ + managedComponent.getName() + "] of type " //$NON-NLS-1$
+ + componentType + ".", e); //$NON-NLS-1$
+ report.setStatus(ConfigurationUpdateStatus.FAILURE);
+ report.setErrorMessageFromThrowable(e);
+ }
+ } catch (Exception e) {
+ LOG.error("Unable to process update request", e); //$NON-NLS-1$
+ report.setStatus(ConfigurationUpdateStatus.FAILURE);
+ report.setErrorMessageFromThrowable(e);
+ }
+ }
+
+ /**
+ * @return
+ * @throws Exception
+ */
+ protected Map<String, ManagedProperty> getManagedProperties()
+ throws Exception {
+ return null;
+ }
+
+ /**
+ * @param managedComponent
+ * @throws Exception
+ */
+ protected void updateComponent(ManagedComponent managedComponent)
+ throws Exception {
+ log.trace("Updating " + this.name + " with component " //$NON-NLS-1$ //$NON-NLS-2$
+ + managedComponent.toString() + "..."); //$NON-NLS-1$
+ ManagementView managementView = getConnection().getManagementView();
+ managementView.updateComponent(managedComponent);
+
+ }
+
+ @Override
+ public void deleteResource() throws Exception {
+
+ DeploymentManager deploymentManager = getConnection()
+ .getDeploymentManager();
+
+ log.debug("Stopping deployment [" + this.deploymentUrl + "]..."); //$NON-NLS-1$ //$NON-NLS-2$
+ DeploymentProgress progress = deploymentManager
+ .stop(this.deploymentUrl);
+ DeploymentStatus stopStatus = DeploymentUtils.run(progress);
+ if (stopStatus.isFailed()) {
+ log.error("Failed to stop deployment '" + this.deploymentUrl //$NON-NLS-1$
+ + "'.", stopStatus.getFailure()); //$NON-NLS-1$
+ throw new Exception("Failed to stop deployment '" //$NON-NLS-1$
+ + this.deploymentName + "' - cause: " //$NON-NLS-1$
+ + stopStatus.getFailure());
+ }
+ log.debug("Removing deployment [" + this.deploymentUrl + "]..."); //$NON-NLS-1$ //$NON-NLS-2$
+ progress = deploymentManager.remove(this.deploymentUrl);
+ DeploymentStatus removeStatus = DeploymentUtils.run(progress);
+ if (removeStatus.isFailed()) {
+ log.error("Failed to remove deployment '" + this.deploymentUrl //$NON-NLS-1$
+ + "'.", removeStatus.getFailure()); //$NON-NLS-1$
+ throw new Exception("Failed to remove deployment '" //$NON-NLS-1$
+ + this.deploymentName + "' - cause: " //$NON-NLS-1$
+ + removeStatus.getFailure());
+ }
+
+ }
+
+ @Override
+ public DeployPackagesResponse deployPackages(
+ Set<ResourcePackageDetails> packages,
+ ContentServices contentServices) {
+ // You can only update the one application file referenced by this
+ // resource, so punch out if multiple are
+ // specified.
+ if (packages.size() != 1) {
+ log
+ .warn("Request to update a VDB file contained multiple packages: " //$NON-NLS-1$
+ + packages);
+ DeployPackagesResponse response = new DeployPackagesResponse(
+ ContentResponseResult.FAILURE);
+ response
+ .setOverallRequestErrorMessage("When updating a VDB, only one VDB can be updated at a time."); //$NON-NLS-1$
+ return response;
+ }
+
+ ResourcePackageDetails packageDetails = packages.iterator().next();
+
+ log.debug("Updating VDB file '" + this.deploymentFile + "' using [" //$NON-NLS-1$ //$NON-NLS-2$
+ + packageDetails + "]..."); //$NON-NLS-1$
+
+ log.debug("Writing new VDB bits to temporary file..."); //$NON-NLS-1$
+ File tempFile;
+ try {
+ tempFile = writeNewAppBitsToTempFile(contentServices,
+ packageDetails);
+ } catch (Exception e) {
+ return failApplicationDeployment(
+ "Error writing new application bits to temporary file - cause: " //$NON-NLS-1$
+ + e, packageDetails);
+ }
+ log.debug("Wrote new VDB bits to temporary file '" + tempFile //$NON-NLS-1$
+ + "'."); //$NON-NLS-1$
+
+ boolean deployExploded = this.deploymentFile.isDirectory();
+
+ // Backup the original app file/dir to <filename>.rej.
+ File backupOfOriginalFile = new File(this.deploymentFile.getPath()
+ + BACKUP_FILE_EXTENSION);
+ log.debug("Backing up existing VDB '" + this.deploymentFile //$NON-NLS-1$
+ + "' to '" + backupOfOriginalFile + "'..."); //$NON-NLS-1$ //$NON-NLS-2$
+ try {
+ if (backupOfOriginalFile.exists())
+ FileUtils.forceDelete(backupOfOriginalFile);
+ if (this.deploymentFile.isDirectory())
+ FileUtils.copyDirectory(this.deploymentFile,
+ backupOfOriginalFile, true);
+ else
+ FileUtils.copyFile(this.deploymentFile, backupOfOriginalFile,
+ true);
+ } catch (Exception e) {
+ throw new RuntimeException("Failed to backup existing EAR/WAR '" //$NON-NLS-1$
+ + this.deploymentFile + "' to '" + backupOfOriginalFile //$NON-NLS-1$
+ + "'."); //$NON-NLS-1$
+ }
+
+ // Now stop the original app.
+ try {
+ DeploymentManager deploymentManager = getConnection()
+ .getDeploymentManager();
+ DeploymentProgress progress = deploymentManager
+ .stop(this.deploymentUrl);
+ DeploymentUtils.run(progress);
+ } catch (Exception e) {
+ throw new RuntimeException("Failed to stop deployment [" //$NON-NLS-1$
+ + this.deploymentUrl + "].", e); //$NON-NLS-1$
+ }
+
+ // And then remove it (this will delete the physical file/dir from the
+ // deploy dir).
+ try {
+ DeploymentManager deploymentManager = getConnection()
+ .getDeploymentManager();
+ DeploymentProgress progress = deploymentManager
+ .remove(this.deploymentUrl);
+ DeploymentUtils.run(progress);
+ } catch (Exception e) {
+ throw new RuntimeException("Failed to remove deployment [" //$NON-NLS-1$
+ + this.deploymentUrl + "].", e); //$NON-NLS-1$
+ }
+
+ // Deploy away!
+ log.debug("Deploying '" + tempFile + "'..."); //$NON-NLS-1$ //$NON-NLS-2$
+ DeploymentManager deploymentManager = getConnection()
+ .getDeploymentManager();
+ try {
+ DeploymentUtils.deployArchive(deploymentManager, tempFile,
+ deployExploded);
+ } catch (Exception e) {
+ // Deploy failed - rollback to the original app file...
+ log.debug("Redeploy failed - rolling back to original archive...", //$NON-NLS-1$
+ e);
+ String errorMessage = ThrowableUtil.getAllMessages(e);
+ try {
+ // Delete the new app, which failed to deploy.
+ FileUtils.forceDelete(this.deploymentFile);
+ // Need to re-deploy the original file - this generally should
+ // succeed.
+ DeploymentUtils.deployArchive(deploymentManager,
+ backupOfOriginalFile, deployExploded);
+ errorMessage += " ***** ROLLED BACK TO ORIGINAL APPLICATION FILE. *****"; //$NON-NLS-1$
+ } catch (Exception e1) {
+ log.debug("Rollback failed!", e1); //$NON-NLS-1$
+ errorMessage += " ***** FAILED TO ROLLBACK TO ORIGINAL APPLICATION FILE. *****: " //$NON-NLS-1$
+ + ThrowableUtil.getAllMessages(e1);
+ }
+ log.info("Failed to update VDB file '" + this.deploymentFile //$NON-NLS-1$
+ + "' using [" + packageDetails + "]."); //$NON-NLS-1$ //$NON-NLS-2$
+ return failApplicationDeployment(errorMessage, packageDetails);
+ }
+
+ // Deploy was successful!
+
+ deleteBackupOfOriginalFile(backupOfOriginalFile);
+ persistApplicationVersion(packageDetails, this.deploymentFile);
+
+ DeployPackagesResponse response = new DeployPackagesResponse(
+ ContentResponseResult.SUCCESS);
+ DeployIndividualPackageResponse packageResponse = new DeployIndividualPackageResponse(
+ packageDetails.getKey(), ContentResponseResult.SUCCESS);
+ response.addPackageResponse(packageResponse);
+
+ log.debug("Updated VDB file '" + this.deploymentFile //$NON-NLS-1$
+ + "' successfully - returning response [" + response + "]..."); //$NON-NLS-1$ //$NON-NLS-2$
+
+ return response;
+ }
+
+ private void deleteBackupOfOriginalFile(File backupOfOriginalFile) {
+ log.debug("Deleting backup of original file '" + backupOfOriginalFile //$NON-NLS-1$
+ + "'..."); //$NON-NLS-1$
+ try {
+ FileUtils.forceDelete(backupOfOriginalFile);
+ } catch (Exception e) {
+ // not critical.
+ log.warn("Failed to delete backup of original file: " //$NON-NLS-1$
+ + backupOfOriginalFile);
+ }
+ }
+
+ private void persistApplicationVersion(ResourcePackageDetails packageDetails, File appFile)
+ {
+ String packageName = appFile.getName();
+ log.debug("Persisting application version '" + packageDetails.getVersion() + "' for package '" + packageName //$NON-NLS-1$ //$NON-NLS-2$
+ + "'"); //$NON-NLS-1$
+ PackageVersions versions = loadPackageVersions();
+ versions.putVersion(packageName, packageDetails.getVersion());
+ }
+
+ private File writeNewAppBitsToTempFile(ContentServices contentServices,
+ ResourcePackageDetails packageDetails) throws Exception {
+ File tempDir = this.resourceContext.getTemporaryDirectory();
+ File tempFile = new File(tempDir, this.deploymentFile.getName());
+
+ OutputStream tempOutputStream = null;
+ try {
+ tempOutputStream = new BufferedOutputStream(new FileOutputStream(
+ tempFile));
+ long bytesWritten = contentServices.downloadPackageBits(
+ this.resourceContext.getContentContext(), packageDetails
+ .getKey(), tempOutputStream, true);
+ log
+ .debug("Wrote " + bytesWritten + " bytes to '" + tempFile //$NON-NLS-1$ //$NON-NLS-2$
+ + "'."); //$NON-NLS-1$
+ } catch (IOException e) {
+ log.error(
+ "Error writing updated application bits to temporary location: " //$NON-NLS-1$
+ + tempFile, e);
+ throw e;
+ } finally {
+ if (tempOutputStream != null) {
+ try {
+ tempOutputStream.close();
+ } catch (IOException e) {
+ log.error("Error closing temporary output stream", e); //$NON-NLS-1$
+ }
+ }
+ }
+ if (!tempFile.exists()) {
+ log.error("Temporary file for application update not written to: " //$NON-NLS-1$
+ + tempFile);
+ throw new Exception();
+ }
+ return tempFile;
+ }
+
+ /**
+ * Creates the necessary transfer objects to report a failed application
+ * deployment (update).
+ *
+ * @param errorMessage
+ * reason the deploy failed
+ * @param packageDetails
+ * describes the update being made
+ * @return response populated to reflect a failure
+ */
+ private DeployPackagesResponse failApplicationDeployment(
+ String errorMessage, ResourcePackageDetails packageDetails) {
+ DeployPackagesResponse response = new DeployPackagesResponse(
+ ContentResponseResult.FAILURE);
+
+ DeployIndividualPackageResponse packageResponse = new DeployIndividualPackageResponse(
+ packageDetails.getKey(), ContentResponseResult.FAILURE);
+ packageResponse.setErrorMessage(errorMessage);
+
+ response.addPackageResponse(packageResponse);
+
+ return response;
+ }
+
+ @Override
+ public Set<ResourcePackageDetails> discoverDeployedPackages(PackageType arg0) {
+
+ // PLEASE DO NOT REMOVE THIS METHOD. IT IS REQUIRED FOR THE CONTENT TAB.
+
+ Configuration pluginConfig = this.resourceContext
+ .getPluginConfiguration();
+ this.deploymentUrl = pluginConfig.getSimple("url").getStringValue(); //$NON-NLS-1$
+
+ if (this.deploymentUrl != null) {
+ this.deploymentFile = new File(this.deploymentUrl
+ .substring(deploymentUrl.indexOf(":/") + 1)); //$NON-NLS-1$
+ }
+
+ if (!deploymentFile.exists())
+ throw new IllegalStateException("Deployment file '" //$NON-NLS-1$
+ + this.deploymentFile + "' for " + this.getComponentType() //$NON-NLS-1$
+ + " does not exist."); //$NON-NLS-1$
+
+ String fileName = deploymentFile.getName();
+ org.rhq.core.pluginapi.content.version.PackageVersions packageVersions = loadPackageVersions();
+ String version = packageVersions.getVersion(fileName);
+ if (version == null) {
+ // This is either the first time we've discovered this VDB, or
+ // someone purged the PC's data dir.
+ version = "1.0"; //$NON-NLS-1$
+ packageVersions.putVersion(fileName, version);
+ packageVersions.saveToDisk();
+ }
+
+ // Package name is the deployment's file name (e.g. foo.ear).
+ PackageDetailsKey key = new PackageDetailsKey(fileName, version,
+ PKG_TYPE_VDB, ARCHITECTURE);
+ ResourcePackageDetails packageDetails = new ResourcePackageDetails(key);
+ packageDetails.setFileName(fileName);
+ packageDetails.setLocation(deploymentFile.getPath());
+ if (!deploymentFile.isDirectory())
+ packageDetails.setFileSize(deploymentFile.length());
+ packageDetails.setFileCreatedDate(null);
+ Set<ResourcePackageDetails> packages = new HashSet<ResourcePackageDetails>();
+ packages.add(packageDetails);
+
+ return packages;
+ }
+
+ @Override
+ public List<DeployPackageStep> generateInstallationSteps(
+ ResourcePackageDetails arg0) {
+ return null;
+ }
+
+ @Override
+ public RemovePackagesResponse removePackages(
+ Set<ResourcePackageDetails> arg0) {
+ return null;
+ }
+
+ @Override
+ public InputStream retrievePackageBits(ResourcePackageDetails packageDetails) {
+ return null;
+ }
+
+ protected static Configuration getDefaultPluginConfiguration(
+ ResourceType resourceType) {
+ ConfigurationTemplate pluginConfigDefaultTemplate = resourceType
+ .getPluginConfigurationDefinition().getDefaultTemplate();
+ return (pluginConfigDefaultTemplate != null) ? pluginConfigDefaultTemplate
+ .createConfiguration()
+ : new Configuration();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.rhq.core.pluginapi.inventory.CreateChildResourceFacet#createResource
+ * (org.rhq.core.pluginapi.inventory.CreateResourceReport)
+ */
+ @Override
+ public CreateResourceReport createResource(CreateResourceReport report) {
+ ResourceType resourceType = report.getResourceType();
+ // if (resourceType.getName().equals("Translators")) {
+ // createConfigurationBasedResource(report);
+ // } else {
+ createContentBasedResource(report);
+ // }
+
+ return report;
+ }
+
+ private CreateResourceReport createConfigurationBasedResource(
+ CreateResourceReport createResourceReport) {
+ ResourceType resourceType = createResourceReport.getResourceType();
+ Configuration defaultPluginConfig = getDefaultPluginConfiguration(resourceType);
+ Configuration resourceConfig = createResourceReport
+ .getResourceConfiguration();
+ String resourceName = getResourceName(defaultPluginConfig,
+ resourceConfig);
+ ComponentType componentType = ProfileServiceUtil
+ .getComponentType(resourceType);
+ ManagementView managementView = null;
+ ;
+ managementView = getConnection().getManagementView();
+
+ if (ProfileServiceUtil.isManagedComponent(getConnection(),
+ resourceName, componentType)) {
+ createResourceReport.setStatus(CreateResourceStatus.FAILURE);
+ createResourceReport.setErrorMessage("A " + resourceType.getName() //$NON-NLS-1$
+ + " named '" + resourceName + "' already exists."); //$NON-NLS-1$ //$NON-NLS-2$
+ return createResourceReport;
+ }
+
+ createResourceReport.setResourceName(resourceName);
+ String resourceKey = getResourceKey(resourceType, resourceName);
+ createResourceReport.setResourceKey(resourceKey);
+
+ PropertySimple templateNameProperty = resourceConfig
+ .getSimple(TranslatorComponent.Config.TEMPLATE_NAME);
+ String templateName = templateNameProperty.getStringValue();
+
+ DeploymentTemplateInfo template;
+ try {
+ template = managementView.getTemplate(templateName);
+ Map<String, ManagedProperty> managedProperties = template.getProperties();
+
+ ProfileServiceUtil.convertConfigurationToManagedProperties(managedProperties, resourceConfig, resourceType, null);
+
+ LOG.debug("Applying template [" + templateName //$NON-NLS-1$
+ + "] to create ManagedComponent of type [" + componentType //$NON-NLS-1$
+ + "]..."); //$NON-NLS-1$
+ try {
+ managementView.applyTemplate(resourceName, template);
+ managementView.process();
+ createResourceReport.setStatus(CreateResourceStatus.SUCCESS);
+ } catch (Exception e) {
+ LOG.error("Unable to apply template [" + templateName //$NON-NLS-1$
+ + "] to create ManagedComponent of type " //$NON-NLS-1$
+ + componentType + ".", e); //$NON-NLS-1$
+ createResourceReport.setStatus(CreateResourceStatus.FAILURE);
+ createResourceReport.setException(e);
+ }
+ } catch (NoSuchDeploymentException e) {
+ LOG.error("Unable to find template [" + templateName + "].", e); //$NON-NLS-1$ //$NON-NLS-2$
+ createResourceReport.setStatus(CreateResourceStatus.FAILURE);
+ createResourceReport.setException(e);
+ } catch (Exception e) {
+ LOG.error("Unable to process create request", e); //$NON-NLS-1$
+ createResourceReport.setStatus(CreateResourceStatus.FAILURE);
+ createResourceReport.setException(e);
+ }
+ return createResourceReport;
+ }
+
+ protected void createContentBasedResource(
+ CreateResourceReport createResourceReport) {
+
+ ResourcePackageDetails details = createResourceReport
+ .getPackageDetails();
+ PackageDetailsKey key = details.getKey();
+ // This is the full path to a temporary file which was written by the UI
+ // layer.
+ String archivePath = key.getName();
+
+ try {
+ File archiveFile = new File(archivePath);
+
+ if (!DeploymentUtils.hasCorrectExtension(archiveFile.getName(),
+ resourceContext.getResourceType())) {
+ createResourceReport.setStatus(CreateResourceStatus.FAILURE);
+ createResourceReport
+ .setErrorMessage("Incorrect extension specified on filename [" //$NON-NLS-1$
+ + archivePath + "]"); //$NON-NLS-1$
+
+ }
+
+ DeploymentManager deploymentManager = getConnection()
+ .getDeploymentManager();
+ DeploymentUtils
+ .deployArchive(deploymentManager, archiveFile, false);
+
+ deploymentName = archivePath;
+ createResourceReport.setResourceName(archivePath);
+ createResourceReport.setResourceKey(archivePath);
+ createResourceReport.setStatus(CreateResourceStatus.SUCCESS);
+
+ } catch (Throwable t) {
+ log.error("Error deploying application for report: " //$NON-NLS-1$
+ + createResourceReport, t);
+ createResourceReport.setStatus(CreateResourceStatus.FAILURE);
+ createResourceReport.setException(t);
+ }
+
+ }
+
+ private static String getResourceName(Configuration pluginConfig,
+ Configuration resourceConfig) {
+ PropertySimple resourceNameProp = pluginConfig
+ .getSimple(TranslatorComponent.Config.RESOURCE_NAME);
+ if (resourceNameProp == null
+ || resourceNameProp.getStringValue() == null)
+ throw new IllegalStateException("Property [" //$NON-NLS-1$
+ + TranslatorComponent.Config.RESOURCE_NAME
+ + "] is not defined in the default plugin configuration."); //$NON-NLS-1$
+ String resourceNamePropName = resourceNameProp.getStringValue();
+ PropertySimple propToUseAsResourceName = resourceConfig
+ .getSimple(resourceNamePropName);
+ if (propToUseAsResourceName == null)
+ throw new IllegalStateException("Property [" + resourceNamePropName //$NON-NLS-1$
+ + "] is not defined in initial Resource configuration."); //$NON-NLS-1$
+ return propToUseAsResourceName.getStringValue();
+ }
+
+ private String getResourceKey(ResourceType resourceType, String resourceName) {
+ ComponentType componentType = ProfileServiceUtil
+ .getComponentType(resourceType);
+ if (componentType == null)
+ throw new IllegalStateException("Unable to map " + resourceType //$NON-NLS-1$
+ + " to a ComponentType."); //$NON-NLS-1$
+ return componentType.getType() + ":" + componentType.getSubtype() + ":" //$NON-NLS-1$ //$NON-NLS-2$
+ + resourceName;
+ }
+
+ /**
+ * Returns an instantiated and loaded versions store access point.
+ *
+ * @return will not be <code>null</code>
+ */
+ private org.rhq.core.pluginapi.content.version.PackageVersions loadPackageVersions() {
+ if (this.versions == null) {
+ ResourceType resourceType = resourceContext.getResourceType();
+ String pluginName = resourceType.getPlugin();
+ File dataDirectoryFile = resourceContext.getDataDirectory();
+ dataDirectoryFile.mkdirs();
+ String dataDirectory = dataDirectoryFile.getAbsolutePath();
+ log.trace("Creating application versions store with plugin name [" //$NON-NLS-1$
+ + pluginName + "] and data directory [" + dataDirectory //$NON-NLS-1$
+ + "]"); //$NON-NLS-1$
+ this.versions = new PackageVersions(pluginName, dataDirectory);
+ this.versions.loadFromDisk();
+ }
+
+ return this.versions;
+ }
+
+}
Deleted: tags/teiid-parent-7.2.0.Final/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java
===================================================================
--- branches/7.2.x/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java 2010-11-05 03:19:55 UTC (rev 2709)
@@ -1,271 +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.rhq.plugin;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import javax.naming.NamingException;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.deployers.spi.management.ManagementView;
-import org.jboss.managed.api.ComponentType;
-import org.jboss.managed.api.ManagedComponent;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.api.RunState;
-import org.mc4j.ems.connection.EmsConnection;
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
-import org.rhq.core.domain.configuration.PropertySimple;
-import org.rhq.core.domain.measurement.AvailabilityType;
-import org.rhq.core.domain.measurement.MeasurementDataNumeric;
-import org.rhq.core.domain.measurement.MeasurementReport;
-import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
-import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
-import org.rhq.core.pluginapi.inventory.ResourceContext;
-import org.rhq.plugins.jbossas5.ApplicationServerComponent;
-import org.rhq.plugins.jbossas5.connection.ProfileServiceConnection;
-import org.teiid.rhq.admin.DQPManagementView;
-import org.teiid.rhq.plugin.util.PluginConstants;
-import org.teiid.rhq.plugin.util.ProfileServiceUtil;
-import org.teiid.rhq.plugin.util.PluginConstants.Operation;
-import org.teiid.rhq.plugin.util.PluginConstants.ComponentType.Platform;
-
-/**
- *
- */
-public class PlatformComponent extends Facet {
- private final Log LOG = LogFactory.getLog(PluginConstants.DEFAULT_LOGGER_CATEGORY);
-
- String[] PLATFORM_SERVICES_NAMES = { "RuntimeEngineDeployer", //$NON-NLS-1$
- "BufferService", "SessionService", "JdbcSocketConfiguration" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- @Override
- public void start(ResourceContext context) {
- this.setComponentName(context.getPluginConfiguration().getSimpleValue( "name", null)); //$NON-NLS-1$
- this.resourceConfiguration = context.getPluginConfiguration();
- super.start(context);
- }
-
- /**
- * @see org.teiid.rhq.plugin.Facet#getComponentType()
- * @since 7.0
- */
- @Override
- String getComponentType() {
- return PluginConstants.ComponentType.Platform.NAME;
- }
-
- @Override
- public AvailabilityType getAvailability() {
-
- RunState runState;
- try {
- runState = ProfileServiceUtil.getRuntimeEngineDeployer(getConnection()).getRunState();
- } catch (NamingException e) {
- LOG .debug("Naming exception getting: " + PluginConstants.ComponentType.Platform.TEIID_RUNTIME_ENGINE); //$NON-NLS-1$
- return AvailabilityType.DOWN;
- } catch (Exception e) {
- LOG .debug("Exception getting: " + PluginConstants.ComponentType.Platform.TEIID_RUNTIME_ENGINE); //$NON-NLS-1$
- return AvailabilityType.DOWN;
- }
- return (runState == RunState.RUNNING) ? AvailabilityType.UP: AvailabilityType.DOWN;
- }
-
- @Override
- protected void setOperationArguments(String name,
- Configuration configuration, Map<String, Object> valueMap) {
- // Parameter logic for System Operations
- if (name.equals(Platform.Operations.KILL_REQUEST)) {
- valueMap.put(Operation.Value.REQUEST_ID, configuration.getSimple(Operation.Value.REQUEST_ID).getLongValue());
- valueMap.put(Operation.Value.SESSION_ID, configuration.getSimple(Operation.Value.SESSION_ID).getLongValue());
- } else if (name.equals(Platform.Operations.KILL_REQUEST)) {
- valueMap.put(Operation.Value.TRANSACTION_ID, configuration.getSimple(Operation.Value.TRANSACTION_ID).getLongValue());
- } else if (name.equals(Platform.Operations.KILL_SESSION)) {
- valueMap.put(Operation.Value.SESSION_ID, configuration.getSimple(Operation.Value.SESSION_ID).getLongValue());
- } else if (name.equals(Platform.Operations.DEPLOY_VDB_BY_URL)) {
- valueMap.put(Operation.Value.VDB_URL, configuration.getSimple(Operation.Value.VDB_URL).getStringValue());
- valueMap.put(Operation.Value.VDB_DEPLOY_NAME, configuration.getSimple(Operation.Value.VDB_DEPLOY_NAME).getStringValue());
- valueMap.put(Operation.Value.VDB_VERSION, configuration.getSimple(Operation.Value.VDB_VERSION).getIntegerValue());
- }
- }
-
- @Override
- public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> requests) throws Exception {
-
- DQPManagementView view = new DQPManagementView();
-
- Map<String, Object> valueMap = new HashMap<String, Object>();
-
- try {
- for (MeasurementScheduleRequest request : requests) {
- String name = request.getName();
- LOG.debug("Measurement name = " + name); //$NON-NLS-1$
-
- // Initialize any parameters to be used in the retrieval of
- // metric values
-
- Object metric = view.getMetric(getConnection(),
- getComponentType(), this.getComponentIdentifier(),
- name, valueMap);
-
- if (metric instanceof Double) {
- report.addData(new MeasurementDataNumeric(request, (Double) metric));
- }
- else if (metric instanceof Integer ){
- report.addData(new MeasurementDataNumeric(request, new Double(((Integer)metric).doubleValue())));
- }
- else if (metric instanceof Long){
- report.addData(new MeasurementDataNumeric(request, new Double(((Long)metric).longValue())));
- }
- else {
- LOG.error("Metric value must be a numeric value"); //$NON-NLS-1$
- }
- }
- } catch (Exception e) {
- LOG.error("Failed to obtain measurement [" + name + "]. Cause: " + e); //$NON-NLS-1$ //$NON-NLS-2$
- throw (e);
- }
- }
-
- @Override
- public void stop() {
- // TODO Auto-generated method stub
- super.stop();
- }
-
- @Override
- public void updateResourceConfiguration(ConfigurationUpdateReport report) {
-
- resourceConfiguration = report.getConfiguration().deepCopy();
-
- Configuration resourceConfig = report.getConfiguration();
-
- ManagementView managementView = null;
- ComponentType componentType = new ComponentType(
- PluginConstants.ComponentType.Platform.TEIID_TYPE,
- PluginConstants.ComponentType.Platform.TEIID_SUB_TYPE);
-
- ManagedComponent managedComponent = null;
- report.setStatus(ConfigurationUpdateStatus.SUCCESS);
- try {
-
- managementView = getConnection().getManagementView();
-
- for (String serviceName : PLATFORM_SERVICES_NAMES) {
-
- managedComponent = managementView.getComponent(serviceName, componentType);
- Map<String, ManagedProperty> managedProperties = managedComponent.getProperties();
-
- ProfileServiceUtil.convertConfigurationToManagedProperties(managedProperties, resourceConfig, resourceContext.getResourceType());
-
- try {
- managementView.updateComponent(managedComponent);
- } catch (Exception e) {
- LOG.error("Unable to update component [" //$NON-NLS-1$
- + managedComponent.getName() + "] of type " //$NON-NLS-1$
- + componentType + ".", e); //$NON-NLS-1$
- report.setStatus(ConfigurationUpdateStatus.FAILURE);
- report.setErrorMessageFromThrowable(e);
- }
- }
- } catch (Exception e) {
- LOG.error("Unable to process update request", e); //$NON-NLS-1$
- report.setStatus(ConfigurationUpdateStatus.FAILURE);
- report.setErrorMessageFromThrowable(e);
- }
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.teiid.rhq.plugin.Facet#loadResourceConfiguration()
- */
- @Override
- public Configuration loadResourceConfiguration() {
-
- // Get plugin config
- Configuration c = resourceContext.getPluginConfiguration();
-
- getProperties(c);
-
- return c;
-
- }
-
- /**
- * @param mc
- * @param configuration
- * @throws Exception
- */
- private void getProperties(Configuration configuration) {
-
- // Get all ManagedComponents of type Teiid and subtype dqp
- Set<ManagedComponent> mcSet = null;
- try {
- mcSet = ProfileServiceUtil.getManagedComponents(getConnection(),
- new org.jboss.managed.api.ComponentType(
- PluginConstants.ComponentType.Platform.TEIID_TYPE,
- PluginConstants.ComponentType.Platform.TEIID_SUB_TYPE));
- } catch (NamingException e) {
- LOG.error("NamingException getting components in Platform loadConfiguration(): " + e.getMessage()); //$NON-NLS-1$
- } catch (Exception e) {
- LOG.error("Exception getting components in Platform loadConfiguration(): " + e.getMessage()); //$NON-NLS-1$
- }
-
- for (ManagedComponent mc : mcSet) {
- Map<String, ManagedProperty> mcMap = mc.getProperties();
- setProperties(mcMap, configuration);
- }
- }
-
- /**
- * @param mcMap
- * @param configuration
- */
- private void setProperties(Map<String, ManagedProperty> mcMap,
- Configuration configuration) {
- for (ManagedProperty mProp : mcMap.values()) {
- try {
- String value = ProfileServiceUtil.stringValue(mProp.getValue());
- PropertySimple prop = new PropertySimple(mProp.getName(), value);
- configuration.put(prop);
- } catch (Exception e) {
- LOG.error("Exception setting properties in Platform loadConfiguration(): " + e.getMessage()); //$NON-NLS-1$
- }
- }
- }
-
- @Override
- public ProfileServiceConnection getConnection() {
- return ((ApplicationServerComponent) this.resourceContext.getParentResourceComponent()).getConnection();
- }
-
- @Override
- public EmsConnection getEmsConnection() {
- return null;
- }
-
-}
\ No newline at end of file
Copied: tags/teiid-parent-7.2.0.Final/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java (from rev 2707, branches/7.2.x/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java)
===================================================================
--- tags/teiid-parent-7.2.0.Final/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java (rev 0)
+++ tags/teiid-parent-7.2.0.Final/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java 2010-11-05 03:19:55 UTC (rev 2709)
@@ -0,0 +1,268 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.rhq.plugin;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import javax.naming.NamingException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.managed.api.ComponentType;
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.api.RunState;
+import org.mc4j.ems.connection.EmsConnection;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.measurement.MeasurementDataNumeric;
+import org.rhq.core.domain.measurement.MeasurementReport;
+import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
+import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.plugins.jbossas5.ApplicationServerComponent;
+import org.rhq.plugins.jbossas5.connection.ProfileServiceConnection;
+import org.teiid.rhq.admin.DQPManagementView;
+import org.teiid.rhq.plugin.util.PluginConstants;
+import org.teiid.rhq.plugin.util.ProfileServiceUtil;
+import org.teiid.rhq.plugin.util.PluginConstants.Operation;
+import org.teiid.rhq.plugin.util.PluginConstants.ComponentType.Platform;
+
+/**
+ *
+ */
+public class PlatformComponent extends Facet {
+ private final Log LOG = LogFactory.getLog(PluginConstants.DEFAULT_LOGGER_CATEGORY);
+
+ @Override
+ public void start(ResourceContext context) {
+ this.setComponentName(context.getPluginConfiguration().getSimpleValue( "name", null)); //$NON-NLS-1$
+ this.resourceConfiguration = context.getPluginConfiguration();
+ super.start(context);
+ }
+
+ /**
+ * @see org.teiid.rhq.plugin.Facet#getComponentType()
+ * @since 7.0
+ */
+ @Override
+ String getComponentType() {
+ return PluginConstants.ComponentType.Platform.NAME;
+ }
+
+ @Override
+ public AvailabilityType getAvailability() {
+
+ RunState runState;
+ try {
+ runState = ProfileServiceUtil.getRuntimeEngineDeployer(getConnection()).getRunState();
+ } catch (NamingException e) {
+ LOG .debug("Naming exception getting: " + PluginConstants.ComponentType.Platform.TEIID_RUNTIME_ENGINE); //$NON-NLS-1$
+ return AvailabilityType.DOWN;
+ } catch (Exception e) {
+ LOG .debug("Exception getting: " + PluginConstants.ComponentType.Platform.TEIID_RUNTIME_ENGINE); //$NON-NLS-1$
+ return AvailabilityType.DOWN;
+ }
+ return (runState == RunState.RUNNING) ? AvailabilityType.UP: AvailabilityType.DOWN;
+ }
+
+ @Override
+ protected void setOperationArguments(String name,
+ Configuration configuration, Map<String, Object> valueMap) {
+ // Parameter logic for System Operations
+ if (name.equals(Platform.Operations.KILL_REQUEST)) {
+ valueMap.put(Operation.Value.REQUEST_ID, configuration.getSimple(Operation.Value.REQUEST_ID).getLongValue());
+ valueMap.put(Operation.Value.SESSION_ID, configuration.getSimple(Operation.Value.SESSION_ID).getLongValue());
+ } else if (name.equals(Platform.Operations.KILL_REQUEST)) {
+ valueMap.put(Operation.Value.TRANSACTION_ID, configuration.getSimple(Operation.Value.TRANSACTION_ID).getLongValue());
+ } else if (name.equals(Platform.Operations.KILL_SESSION)) {
+ valueMap.put(Operation.Value.SESSION_ID, configuration.getSimple(Operation.Value.SESSION_ID).getLongValue());
+ } else if (name.equals(Platform.Operations.DEPLOY_VDB_BY_URL)) {
+ valueMap.put(Operation.Value.VDB_URL, configuration.getSimple(Operation.Value.VDB_URL).getStringValue());
+ valueMap.put(Operation.Value.VDB_DEPLOY_NAME, configuration.getSimple(Operation.Value.VDB_DEPLOY_NAME).getStringValue());
+ valueMap.put(Operation.Value.VDB_VERSION, configuration.getSimple(Operation.Value.VDB_VERSION).getIntegerValue());
+ }
+ }
+
+ @Override
+ public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> requests) throws Exception {
+
+ DQPManagementView view = new DQPManagementView();
+
+ Map<String, Object> valueMap = new HashMap<String, Object>();
+
+ try {
+ for (MeasurementScheduleRequest request : requests) {
+ String name = request.getName();
+ LOG.debug("Measurement name = " + name); //$NON-NLS-1$
+
+ // Initialize any parameters to be used in the retrieval of
+ // metric values
+
+ Object metric = view.getMetric(getConnection(),
+ getComponentType(), this.getComponentIdentifier(),
+ name, valueMap);
+
+ if (metric instanceof Double) {
+ report.addData(new MeasurementDataNumeric(request, (Double) metric));
+ }
+ else if (metric instanceof Integer ){
+ report.addData(new MeasurementDataNumeric(request, new Double(((Integer)metric).doubleValue())));
+ }
+ else if (metric instanceof Long){
+ report.addData(new MeasurementDataNumeric(request, new Double(((Long)metric).longValue())));
+ }
+ else {
+ LOG.error("Metric value must be a numeric value"); //$NON-NLS-1$
+ }
+ }
+ } catch (Exception e) {
+ LOG.error("Failed to obtain measurement [" + name + "]. Cause: " + e); //$NON-NLS-1$ //$NON-NLS-2$
+ throw (e);
+ }
+ }
+
+ @Override
+ public void stop() {
+ // TODO Auto-generated method stub
+ super.stop();
+ }
+
+ @Override
+ public void updateResourceConfiguration(ConfigurationUpdateReport report) {
+
+ resourceConfiguration = report.getConfiguration().deepCopy();
+
+ Configuration resourceConfig = report.getConfiguration();
+
+ ManagementView managementView = null;
+ ComponentType componentType = new ComponentType(
+ PluginConstants.ComponentType.Platform.TEIID_TYPE,
+ PluginConstants.ComponentType.Platform.TEIID_SUB_TYPE);
+
+ report.setStatus(ConfigurationUpdateStatus.SUCCESS);
+ try {
+
+ managementView = getConnection().getManagementView();
+ Set<ManagedComponent> allComponents = managementView.getComponentsForType(componentType);
+
+ for (ManagedComponent managedComponent : allComponents) {
+
+ Map<String, ManagedProperty> managedProperties = managedComponent.getProperties();
+
+
+ ProfileServiceUtil.convertConfigurationToManagedProperties(managedProperties, resourceConfig, resourceContext.getResourceType(), managedComponent.getName());
+
+ try {
+ managementView.updateComponent(managedComponent);
+ } catch (Exception e) {
+ LOG.error("Unable to update component [" //$NON-NLS-1$
+ + managedComponent.getName() + "] of type " //$NON-NLS-1$
+ + componentType + ".", e); //$NON-NLS-1$
+ report.setStatus(ConfigurationUpdateStatus.FAILURE);
+ report.setErrorMessageFromThrowable(e);
+ }
+ }
+ } catch (Exception e) {
+ LOG.error("Unable to process update request", e); //$NON-NLS-1$
+ report.setStatus(ConfigurationUpdateStatus.FAILURE);
+ report.setErrorMessageFromThrowable(e);
+ }
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.teiid.rhq.plugin.Facet#loadResourceConfiguration()
+ */
+ @Override
+ public Configuration loadResourceConfiguration() {
+
+ // Get plugin config
+ Configuration c = resourceContext.getPluginConfiguration();
+
+ getProperties(c);
+
+ return c;
+
+ }
+
+ /**
+ * @param mc
+ * @param configuration
+ * @throws Exception
+ */
+ private void getProperties(Configuration configuration) {
+
+ // Get all ManagedComponents of type Teiid and subtype dqp
+ Set<ManagedComponent> mcSet = null;
+ try {
+ mcSet = ProfileServiceUtil.getManagedComponents(getConnection(),
+ new org.jboss.managed.api.ComponentType(
+ PluginConstants.ComponentType.Platform.TEIID_TYPE,
+ PluginConstants.ComponentType.Platform.TEIID_SUB_TYPE));
+ } catch (NamingException e) {
+ LOG.error("NamingException getting components in Platform loadConfiguration(): " + e.getMessage()); //$NON-NLS-1$
+ } catch (Exception e) {
+ LOG.error("Exception getting components in Platform loadConfiguration(): " + e.getMessage()); //$NON-NLS-1$
+ }
+
+ for (ManagedComponent mc : mcSet) {
+ Map<String, ManagedProperty> mcMap = mc.getProperties();
+ String name = mc.getName();
+ setProperties(name, mcMap, configuration);
+ }
+ }
+
+ /**
+ * @param mcMap
+ * @param configuration
+ */
+ private void setProperties(String compName, Map<String, ManagedProperty> mcMap, Configuration configuration) {
+ for (ManagedProperty mProp : mcMap.values()) {
+ try {
+ String value = ProfileServiceUtil.stringValue(mProp.getValue());
+ PropertySimple prop = new PropertySimple(compName+"."+mProp.getName(), value); //$NON-NLS-1$
+ configuration.put(prop);
+ } catch (Exception e) {
+ LOG.error("Exception setting properties in Platform loadConfiguration(): " + e.getMessage()); //$NON-NLS-1$
+ }
+ }
+ }
+
+ @Override
+ public ProfileServiceConnection getConnection() {
+ return ((ApplicationServerComponent) this.resourceContext.getParentResourceComponent()).getConnection();
+ }
+
+ @Override
+ public EmsConnection getEmsConnection() {
+ return null;
+ }
+
+}
\ No newline at end of file
Deleted: tags/teiid-parent-7.2.0.Final/console/src/main/java/org/teiid/rhq/plugin/util/ProfileServiceUtil.java
===================================================================
--- branches/7.2.x/console/src/main/java/org/teiid/rhq/plugin/util/ProfileServiceUtil.java 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/console/src/main/java/org/teiid/rhq/plugin/util/ProfileServiceUtil.java 2010-11-05 03:19:55 UTC (rev 2709)
@@ -1,620 +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.rhq.plugin.util;
-
-import java.io.File;
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Set;
-
-import javax.naming.NamingException;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.deployers.spi.management.KnownDeploymentTypes;
-import org.jboss.deployers.spi.management.ManagementView;
-import org.jboss.deployers.spi.management.deploy.DeploymentManager;
-import org.jboss.managed.api.ComponentType;
-import org.jboss.managed.api.ManagedCommon;
-import org.jboss.managed.api.ManagedComponent;
-import org.jboss.managed.api.ManagedDeployment;
-import org.jboss.managed.api.ManagedProperty;
-import org.jboss.managed.api.annotation.ViewUse;
-import org.jboss.metatype.api.types.MapCompositeMetaType;
-import org.jboss.metatype.api.types.MetaType;
-import org.jboss.metatype.api.types.SimpleMetaType;
-import org.jboss.metatype.api.values.EnumValue;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.metatype.api.values.SimpleValue;
-import org.jboss.metatype.api.values.SimpleValueSupport;
-import org.jboss.profileservice.spi.ProfileService;
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.Property;
-import org.rhq.core.domain.configuration.PropertyMap;
-import org.rhq.core.domain.configuration.PropertySimple;
-import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
-import org.rhq.core.domain.configuration.definition.ConfigurationTemplate;
-import org.rhq.core.domain.configuration.definition.PropertyDefinition;
-import org.rhq.core.domain.configuration.definition.PropertyDefinitionList;
-import org.rhq.core.domain.configuration.definition.PropertyDefinitionMap;
-import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
-import org.rhq.core.domain.configuration.definition.PropertySimpleType;
-import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.plugins.jbossas5.connection.ProfileServiceConnection;
-import org.teiid.rhq.plugin.TranslatorComponent;
-import org.teiid.rhq.plugin.adapter.api.PropertyAdapter;
-import org.teiid.rhq.plugin.adapter.api.PropertyAdapterFactory;
-
-import com.sun.istack.NotNull;
-
-public class ProfileServiceUtil {
-
- protected final static Log LOG = LogFactory
- .getLog(PluginConstants.DEFAULT_LOGGER_CATEGORY);
- private static ComponentType DQPTYPE = new ComponentType("teiid", "dqp"); //$NON-NLS-1$ //$NON-NLS-2$
- private static String DQPNAME = "RuntimeEngineDeployer"; //$NON-NLS-1$
- private static String BUFFERSERVICE = "BufferService"; //$NON-NLS-1$
- private static final Map<String, ComponentType> COMPONENT_TYPE_CACHE = new HashMap<String, ComponentType>();
-
- protected static final String PLUGIN = "ProfileService"; //$NON-NLS-1$
-
- public static ComponentType getComponentType(
- @NotNull ResourceType resourceType) {
- String resourceTypeName = resourceType.getName();
- if (COMPONENT_TYPE_CACHE.containsKey(resourceTypeName))
- return COMPONENT_TYPE_CACHE.get(resourceTypeName);
- Configuration defaultPluginConfig = getDefaultPluginConfiguration(resourceType);
- String type = defaultPluginConfig.getSimpleValue(
- TranslatorComponent.Config.COMPONENT_TYPE, null);
- if (type == null || type.equals("")) //$NON-NLS-1$
- throw new IllegalStateException(
- "Required plugin configuration property '" //$NON-NLS-1$
- + TranslatorComponent.Config.COMPONENT_TYPE
- + "' is not defined in default template."); //$NON-NLS-1$
- String subtype = defaultPluginConfig.getSimpleValue(
- TranslatorComponent.Config.COMPONENT_SUBTYPE, null);
- if (subtype == null || subtype.equals("")) //$NON-NLS-1$
- throw new IllegalStateException(
- "Required plugin configuration property '" //$NON-NLS-1$
- + TranslatorComponent.Config.COMPONENT_SUBTYPE
- + "' is not defined in default template."); //$NON-NLS-1$
- ComponentType componentType = new ComponentType(type, subtype);
- COMPONENT_TYPE_CACHE.put(resourceTypeName, componentType);
- return componentType;
- }
-
- private static Configuration getDefaultPluginConfiguration(
- ResourceType resourceType) {
- ConfigurationTemplate pluginConfigDefaultTemplate = resourceType
- .getPluginConfigurationDefinition().getDefaultTemplate();
- return (pluginConfigDefaultTemplate != null) ? pluginConfigDefaultTemplate
- .createConfiguration()
- : new Configuration();
- }
-
- /**
- * @param name
- * @param componentType
- * @return
- */
- public static boolean isManagedComponent(
- ProfileServiceConnection connection, String name,
- ComponentType componentType) {
- boolean isDeployed = false;
- if (name != null) {
- try {
- ManagedComponent component = getManagedComponent(connection,
- componentType, name);
- if (component != null)
- isDeployed = true;
- } catch (Exception e) {
- // Setting it to true to be safe than sorry, since there might
- // be a component
- // already deployed in the AS.
- isDeployed = true;
- }
- }
- return isDeployed;
- }
-
- /**
- * Get the passed in {@link ManagedComponent}
- *
- * @return {@link ManagedComponent}
- * @throws NamingException
- * @throws Exception
- */
- public static ManagedComponent getManagedComponent(
- ProfileServiceConnection connection, ComponentType componentType,
- String componentName) throws NamingException, Exception {
- ManagedComponent mc = connection.getManagementView().getComponent(
- componentName, componentType);
-
- return mc;
- }
-
- /**
- * Get the {@link ManagedComponent} for the {@link ComponentType} and sub
- * type.
- *
- * @return Set of {@link ManagedComponent}s
- * @throws NamingException
- * , Exception
- * @throws Exception
- */
- public static Set<ManagedComponent> getManagedComponents(ProfileServiceConnection connection,
- ComponentType componentType) throws NamingException, Exception {
-
- Set<ManagedComponent> mcSet = connection.getManagementView().getComponentsForType(componentType);
-
- return mcSet;
- }
-
- /**
- * @param {@link ManagementView}
- * @return
- */
- public static ManagementView getManagementView(ProfileService ps,
- boolean load) {
- ManagementView mv = ps.getViewManager();
- if (load) {
- mv.load();
- }
- return mv;
- }
-
- /**
- * Get the {@link DeploymentManager} from the ProfileService
- *
- * @return DeploymentManager
- * @throws NamingException
- * @throws Exception
- */
- public static DeploymentManager getDeploymentManager(ProfileServiceConnection connection)
- throws NamingException, Exception {
-
- return connection.getDeploymentManager();
- }
-
- /**
- * @return {@link File}
- * @throws NamingException
- * , Exception
- */
- public static File getDeployDirectory(ProfileServiceConnection connection) throws NamingException, Exception {
- Set<ManagedDeployment> warDeployments;
- try {
- warDeployments = connection.getManagementView()
- .getDeploymentsForType(KnownDeploymentTypes.JavaEEWebApplication
- .getType());
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- ManagedDeployment standaloneWarDeployment = null;
- for (ManagedDeployment warDeployment : warDeployments) {
- if (warDeployment.getParent() == null) {
- standaloneWarDeployment = warDeployment;
- break;
- }
- }
- if (standaloneWarDeployment == null)
- // This could happen if no standalone WARs, including the admin
- // console WAR, have been fully deployed yet.
- return null;
- URL warUrl;
- try {
- warUrl = new URL(standaloneWarDeployment.getName());
- } catch (MalformedURLException e) {
- throw new IllegalStateException(e);
- }
- File warFile = new File(warUrl.getPath());
- File deployDir = warFile.getParentFile();
- return deployDir;
- }
-
- public static ManagedComponent getRuntimeEngineDeployer(
- ProfileServiceConnection connection) throws NamingException,
- Exception {
-
- return getManagedComponent(connection, DQPTYPE, DQPNAME);
- }
-
- public static ManagedComponent getBufferService(
- ProfileServiceConnection connection) throws NamingException,
- Exception {
-
- return getManagedComponent(connection, DQPTYPE, BUFFERSERVICE);
- }
-
- public static String stringValue(MetaValue v1) throws Exception {
- if (v1 != null) {
- MetaType type = v1.getMetaType();
- if (type instanceof SimpleMetaType) {
- SimpleValue simple = (SimpleValue) v1;
- return simple.getValue().toString();
- }
- throw new Exception("Failed to convert value to string value"); //$NON-NLS-1$
- }
- return null;
- }
-
- public static Boolean booleanValue(MetaValue v1) throws Exception {
- if (v1 != null) {
- MetaType type = v1.getMetaType();
- if (type instanceof SimpleMetaType) {
- SimpleValue simple = (SimpleValue) v1;
- return Boolean.valueOf(simple.getValue().toString());
- }
- throw new Exception("Failed to convert value to boolean value"); //$NON-NLS-1$
- }
- return null;
- }
-
- public static Double doubleValue(MetaValue v1) throws Exception {
- if (v1 != null) {
- MetaType type = v1.getMetaType();
- if (type instanceof SimpleMetaType) {
- SimpleValue simple = (SimpleValue) v1;
- return Double.valueOf(simple.getValue().toString());
- }
- throw new Exception("Failed to convert value to boolean value"); //$NON-NLS-1$
- }
- return null;
- }
-
- public static <T> T getSimpleValue(ManagedComponent mc, String prop,
- Class<T> expectedType) {
- ManagedProperty mp = mc.getProperty(prop);
- if (mp != null) {
- MetaType metaType = mp.getMetaType();
- if (metaType.isSimple()) {
- SimpleValue simpleValue = (SimpleValue) mp.getValue();
- return expectedType.cast((simpleValue != null) ? simpleValue
- .getValue() : null);
- } else if (metaType.isEnum()) {
- EnumValue enumValue = (EnumValue) mp.getValue();
- return expectedType.cast((enumValue != null) ? enumValue
- .getValue() : null);
- }
- throw new IllegalStateException(prop + " is not a simple type"); //$NON-NLS-1$
- }
- return null;
- }
-
- public static <T> T getSimpleValue(ManagedCommon mc, String prop,
- Class<T> expectedType) {
- ManagedProperty mp = mc.getProperty(prop);
- if (mp != null) {
- MetaType metaType = mp.getMetaType();
- if (metaType.isSimple()) {
- SimpleValue simpleValue = (SimpleValue) mp.getValue();
- return expectedType.cast((simpleValue != null) ? simpleValue
- .getValue() : null);
- } else if (metaType.isEnum()) {
- EnumValue enumValue = (EnumValue) mp.getValue();
- return expectedType.cast((enumValue != null) ? enumValue
- .getValue() : null);
- }
- throw new IllegalArgumentException(prop + " is not a simple type"); //$NON-NLS-1$
- }
- return null;
- }
-
- public static Map<String, PropertySimple> getCustomProperties(
- Configuration pluginConfig) {
- Map<String, PropertySimple> customProperties = new LinkedHashMap<String, PropertySimple>();
- if (pluginConfig == null)
- return customProperties;
- PropertyMap customPropsMap = pluginConfig.getMap("custom-properties"); //$NON-NLS-1$
- if (customPropsMap != null) {
- Collection<Property> customProps = customPropsMap.getMap().values();
- for (Property customProp : customProps) {
- if (!(customProp instanceof PropertySimple)) {
- LOG
- .error("Custom property definitions in plugin configuration must be simple properties - property " //$NON-NLS-1$
- + customProp + " is not - ignoring..."); //$NON-NLS-1$
- continue;
- }
- customProperties.put(customProp.getName(),
- (PropertySimple) customProp);
- }
- }
- return customProperties;
- }
-
- public static Configuration convertManagedObjectToConfiguration(
- Map<String, ManagedProperty> managedProperties,
- Map<String, PropertySimple> customProps, ResourceType resourceType) {
- Configuration config = new Configuration();
- ConfigurationDefinition configDef = resourceType
- .getResourceConfigurationDefinition();
- Map<String, PropertyDefinition> propDefs = configDef
- .getPropertyDefinitions();
- Set<String> propNames = managedProperties.keySet();
- for (String propName : propNames) {
- PropertyDefinition propertyDefinition = propDefs.get(propName);
- ManagedProperty managedProperty = managedProperties.get(propName);
- if (propertyDefinition == null) {
- if (!managedProperty.hasViewUse(ViewUse.STATISTIC))
- LOG
- .debug(resourceType
- + " does not define a property corresponding to ManagedProperty '" //$NON-NLS-1$
- + propName + "'."); //$NON-NLS-1$
- continue;
- }
- if (managedProperty == null) {
- // This should never happen, but don't let it blow us up.
- LOG.error("ManagedProperty '" + propName //$NON-NLS-1$
- + "' has a null value in the ManagedProperties Map."); //$NON-NLS-1$
- continue;
- }
- MetaValue metaValue = managedProperty.getValue();
- if (managedProperty.isRemoved() || metaValue == null) {
- // Don't even add a Property to the Configuration if the
- // ManagedProperty is flagged as removed or has a
- // null value.
- continue;
- }
- PropertySimple customProp = customProps.get(propName);
- PropertyAdapter<Property, PropertyDefinition> propertyAdapter = PropertyAdapterFactory
- .getCustomPropertyAdapter(customProp);
- if (propertyAdapter == null)
- propertyAdapter = PropertyAdapterFactory
- .getPropertyAdapter(metaValue);
- if (propertyAdapter == null) {
- LOG
- .error("Unable to find a PropertyAdapter for ManagedProperty '" //$NON-NLS-1$
- + propName
- + "' with MetaType [" //$NON-NLS-1$
- + metaValue.getMetaType()
- + "] for ResourceType '" //$NON-NLS-1$
- + resourceType.getName() + "'."); //$NON-NLS-1$
- continue;
- }
- Property property = propertyAdapter.convertToProperty(metaValue,
- propertyDefinition);
- config.put(property);
- }
- return config;
- }
-
- public static void convertConfigurationToManagedProperties(
- Map<String, ManagedProperty> managedProperties,
- Configuration configuration, ResourceType resourceType) {
- ConfigurationDefinition configDefinition = resourceType
- .getResourceConfigurationDefinition();
- for (ManagedProperty managedProperty : managedProperties.values()) {
- String propertyName = managedProperty.getName();
- PropertyDefinition propertyDefinition = configDefinition
- .get(propertyName);
- if (propertyDefinition == null) {
- // The managed property is not defined in the configuration
- continue;
- }
- populateManagedPropertyFromProperty(managedProperty,
- propertyDefinition, configuration);
- }
- return;
- }
-
- public static void populateManagedPropertyFromProperty(
- ManagedProperty managedProperty,
- PropertyDefinition propertyDefinition, Configuration configuration) {
- // If the ManagedProperty defines a default value, assume it's more
- // definitive than any default value that may
- // have been defined in the plugin descriptor, and update the
- // PropertyDefinition to use that as its default
- // value.
- MetaValue defaultValue = managedProperty.getDefaultValue();
- if (defaultValue != null)
- updateDefaultValueOnPropertyDefinition(propertyDefinition,
- defaultValue);
- MetaValue metaValue = managedProperty.getValue();
- PropertyAdapter propertyAdapter = null;
- if (metaValue != null) {
- LOG.trace("Populating existing MetaValue of type " //$NON-NLS-1$
- + metaValue.getMetaType() + " from Teiid property " //$NON-NLS-1$
- + propertyDefinition.getName() + " with definition " //$NON-NLS-1$
- + propertyDefinition + "..."); //$NON-NLS-1$
- propertyAdapter = PropertyAdapterFactory
- .getPropertyAdapter(metaValue);
-
- propertyAdapter.populateMetaValueFromProperty(configuration
- .getSimple(propertyDefinition.getName()), metaValue,
- propertyDefinition);
- managedProperty.setValue(metaValue);
- } else {
- MetaType metaType = managedProperty.getMetaType();
- if (propertyAdapter == null)
- propertyAdapter = PropertyAdapterFactory
- .getPropertyAdapter(metaType);
- LOG.trace("Converting property " + propertyDefinition.getName() //$NON-NLS-1$
- + " with definition " + propertyDefinition //$NON-NLS-1$
- + " to MetaValue of type " + metaType + "..."); //$NON-NLS-1$ //$NON-NLS-2$
- metaValue = propertyAdapter.convertToMetaValue(configuration
- .getSimple(propertyDefinition.getName()),
- propertyDefinition, metaType);
- managedProperty.setValue(metaValue);
- }
-
- }
-
- private static void updateDefaultValueOnPropertyDefinition(
- PropertyDefinition propertyDefinition,
- @NotNull MetaValue defaultValue) {
- if (!(propertyDefinition instanceof PropertyDefinitionSimple)) {
- LOG
- .debug("Cannot update default value on non-simple property definition " //$NON-NLS-1$
- + propertyDefinition
- + "(default value is " //$NON-NLS-1$
- + defaultValue + ")."); //$NON-NLS-1$
- return;
- }
- MetaType metaType = defaultValue.getMetaType();
- if (!metaType.isSimple() && !metaType.isEnum()) {
- LOG.debug("Cannot update default value on " + propertyDefinition //$NON-NLS-1$
- + ", because default value's type (" + metaType //$NON-NLS-1$
- + ") is not simple or enum."); //$NON-NLS-1$
- return;
- }
- PropertyDefinitionSimple propertyDefinitionSimple = (PropertyDefinitionSimple) propertyDefinition;
- if (metaType.isSimple()) {
- SimpleValue defaultSimpleValue = (SimpleValue) defaultValue;
- Serializable value = defaultSimpleValue.getValue();
- propertyDefinitionSimple.setDefaultValue((value != null) ? value
- .toString() : null);
- } else { // defaultValueMetaType.isEnum()
- EnumValue defaultEnumValue = (EnumValue) defaultValue;
- Serializable value = defaultEnumValue.getValue();
- propertyDefinitionSimple.setDefaultValue((value != null) ? value
- .toString() : null);
- }
- }
-
- public static MetaType convertPropertyDefinitionToMetaType(
- PropertyDefinition propDef) {
- MetaType memberMetaType;
- if (propDef instanceof PropertyDefinitionSimple) {
- PropertySimpleType propSimpleType = ((PropertyDefinitionSimple) propDef)
- .getType();
- memberMetaType = convertPropertySimpleTypeToSimpleMetaType(propSimpleType);
- } else if (propDef instanceof PropertyDefinitionList) {
- // TODO (very low priority, since lists of lists are not going to be
- // at all common)
- memberMetaType = null;
- } else if (propDef instanceof PropertyDefinitionMap) {
- Map<String, PropertyDefinition> memberPropDefs = ((PropertyDefinitionMap) propDef)
- .getPropertyDefinitions();
- if (memberPropDefs.isEmpty())
- throw new IllegalStateException(
- "PropertyDefinitionMap doesn't contain any member PropertyDefinitions."); //$NON-NLS-1$
- // NOTE: We assume member prop defs are all of the same type, since
- // for MapCompositeMetaTypes, they have to be.
- PropertyDefinition mapMemberPropDef = memberPropDefs.values()
- .iterator().next();
- MetaType mapMemberMetaType = convertPropertyDefinitionToMetaType(mapMemberPropDef);
- memberMetaType = new MapCompositeMetaType(mapMemberMetaType);
- } else {
- throw new IllegalStateException(
- "List member PropertyDefinition has unknown type: " //$NON-NLS-1$
- + propDef.getClass().getName());
- }
- return memberMetaType;
- }
-
- private static MetaType convertPropertySimpleTypeToSimpleMetaType(
- PropertySimpleType memberSimpleType) {
- MetaType memberMetaType;
- Class memberClass;
- switch (memberSimpleType) {
- case BOOLEAN:
- memberClass = Boolean.class;
- break;
- case INTEGER:
- memberClass = Integer.class;
- break;
- case LONG:
- memberClass = Long.class;
- break;
- case FLOAT:
- memberClass = Float.class;
- break;
- case DOUBLE:
- memberClass = Double.class;
- break;
- default:
- memberClass = String.class;
- break;
- }
- memberMetaType = SimpleMetaType.resolve(memberClass.getName());
- return memberMetaType;
- }
-
- public static SimpleValue wrap(MetaType type, String value)
- throws Exception {
- if (type instanceof SimpleMetaType) {
- SimpleMetaType st = (SimpleMetaType) type;
-
- if (SimpleMetaType.BIGDECIMAL.equals(st)) {
- return new SimpleValueSupport(st, new BigDecimal(value));
- } else if (SimpleMetaType.BIGINTEGER.equals(st)) {
- return new SimpleValueSupport(st, new BigInteger(value));
- } else if (SimpleMetaType.BOOLEAN.equals(st)) {
- return new SimpleValueSupport(st, Boolean.valueOf(value));
- } else if (SimpleMetaType.BOOLEAN_PRIMITIVE.equals(st)) {
- return new SimpleValueSupport(st, Boolean.valueOf(value)
- .booleanValue());
- } else if (SimpleMetaType.BYTE.equals(st)) {
- return new SimpleValueSupport(st, new Byte(value.getBytes()[0]));
- } else if (SimpleMetaType.BYTE_PRIMITIVE.equals(st)) {
- return new SimpleValueSupport(st, value.getBytes()[0]);
- } else if (SimpleMetaType.CHARACTER.equals(st)) {
- return new SimpleValueSupport(st,
- new Character(value.charAt(0)));
- } else if (SimpleMetaType.CHARACTER_PRIMITIVE.equals(st)) {
- return new SimpleValueSupport(st, value.charAt(0));
- } else if (SimpleMetaType.DATE.equals(st)) {
- try {
- return new SimpleValueSupport(st, SimpleDateFormat
- .getInstance().parse(value));
- } catch (ParseException e) {
- throw new Exception(
- "Failed to convert value to SimpleValue", e); //$NON-NLS-1$
- }
- } else if (SimpleMetaType.DOUBLE.equals(st)) {
- return new SimpleValueSupport(st, Double.valueOf(value));
- } else if (SimpleMetaType.DOUBLE_PRIMITIVE.equals(st)) {
- return new SimpleValueSupport(st, Double.parseDouble(value));
- } else if (SimpleMetaType.FLOAT.equals(st)) {
- return new SimpleValueSupport(st, Float.parseFloat(value));
- } else if (SimpleMetaType.FLOAT_PRIMITIVE.equals(st)) {
- return new SimpleValueSupport(st, Float.valueOf(value));
- } else if (SimpleMetaType.INTEGER.equals(st)) {
- return new SimpleValueSupport(st, Integer.valueOf(value));
- } else if (SimpleMetaType.INTEGER_PRIMITIVE.equals(st)) {
- return new SimpleValueSupport(st, Integer.parseInt(value));
- } else if (SimpleMetaType.LONG.equals(st)) {
- return new SimpleValueSupport(st, Long.valueOf(value));
- } else if (SimpleMetaType.LONG_PRIMITIVE.equals(st)) {
- return new SimpleValueSupport(st, Long.parseLong(value));
- } else if (SimpleMetaType.SHORT.equals(st)) {
- return new SimpleValueSupport(st, Short.valueOf(value));
- } else if (SimpleMetaType.SHORT_PRIMITIVE.equals(st)) {
- return new SimpleValueSupport(st, Short.parseShort(value));
- } else if (SimpleMetaType.STRING.equals(st)) {
- return new SimpleValueSupport(st, value);
- }
- }
- throw new Exception("Failed to convert value to SimpleValue"); //$NON-NLS-1$
- }
-
-}
Copied: tags/teiid-parent-7.2.0.Final/console/src/main/java/org/teiid/rhq/plugin/util/ProfileServiceUtil.java (from rev 2707, branches/7.2.x/console/src/main/java/org/teiid/rhq/plugin/util/ProfileServiceUtil.java)
===================================================================
--- tags/teiid-parent-7.2.0.Final/console/src/main/java/org/teiid/rhq/plugin/util/ProfileServiceUtil.java (rev 0)
+++ tags/teiid-parent-7.2.0.Final/console/src/main/java/org/teiid/rhq/plugin/util/ProfileServiceUtil.java 2010-11-05 03:19:55 UTC (rev 2709)
@@ -0,0 +1,603 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.rhq.plugin.util;
+
+import java.io.File;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Set;
+
+import javax.naming.NamingException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.deployers.spi.management.KnownDeploymentTypes;
+import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.deployers.spi.management.deploy.DeploymentManager;
+import org.jboss.managed.api.ComponentType;
+import org.jboss.managed.api.ManagedCommon;
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.ManagedDeployment;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.api.annotation.ViewUse;
+import org.jboss.metatype.api.types.MapCompositeMetaType;
+import org.jboss.metatype.api.types.MetaType;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.EnumValue;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.SimpleValue;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.profileservice.spi.ProfileService;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.Property;
+import org.rhq.core.domain.configuration.PropertyMap;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.configuration.definition.ConfigurationTemplate;
+import org.rhq.core.domain.configuration.definition.PropertyDefinition;
+import org.rhq.core.domain.configuration.definition.PropertyDefinitionList;
+import org.rhq.core.domain.configuration.definition.PropertyDefinitionMap;
+import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
+import org.rhq.core.domain.configuration.definition.PropertySimpleType;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.plugins.jbossas5.connection.ProfileServiceConnection;
+import org.teiid.rhq.plugin.TranslatorComponent;
+import org.teiid.rhq.plugin.adapter.api.PropertyAdapter;
+import org.teiid.rhq.plugin.adapter.api.PropertyAdapterFactory;
+
+import com.sun.istack.NotNull;
+
+public class ProfileServiceUtil {
+
+ protected final static Log LOG = LogFactory
+ .getLog(PluginConstants.DEFAULT_LOGGER_CATEGORY);
+ private static ComponentType DQPTYPE = new ComponentType("teiid", "dqp"); //$NON-NLS-1$ //$NON-NLS-2$
+ private static String DQPNAME = "RuntimeEngineDeployer"; //$NON-NLS-1$
+ private static String BUFFERSERVICE = "BufferService"; //$NON-NLS-1$
+ private static final Map<String, ComponentType> COMPONENT_TYPE_CACHE = new HashMap<String, ComponentType>();
+
+ protected static final String PLUGIN = "ProfileService"; //$NON-NLS-1$
+
+ public static ComponentType getComponentType(
+ @NotNull ResourceType resourceType) {
+ String resourceTypeName = resourceType.getName();
+ if (COMPONENT_TYPE_CACHE.containsKey(resourceTypeName))
+ return COMPONENT_TYPE_CACHE.get(resourceTypeName);
+ Configuration defaultPluginConfig = getDefaultPluginConfiguration(resourceType);
+ String type = defaultPluginConfig.getSimpleValue(
+ TranslatorComponent.Config.COMPONENT_TYPE, null);
+ if (type == null || type.equals("")) //$NON-NLS-1$
+ throw new IllegalStateException(
+ "Required plugin configuration property '" //$NON-NLS-1$
+ + TranslatorComponent.Config.COMPONENT_TYPE
+ + "' is not defined in default template."); //$NON-NLS-1$
+ String subtype = defaultPluginConfig.getSimpleValue(
+ TranslatorComponent.Config.COMPONENT_SUBTYPE, null);
+ if (subtype == null || subtype.equals("")) //$NON-NLS-1$
+ throw new IllegalStateException(
+ "Required plugin configuration property '" //$NON-NLS-1$
+ + TranslatorComponent.Config.COMPONENT_SUBTYPE
+ + "' is not defined in default template."); //$NON-NLS-1$
+ ComponentType componentType = new ComponentType(type, subtype);
+ COMPONENT_TYPE_CACHE.put(resourceTypeName, componentType);
+ return componentType;
+ }
+
+ private static Configuration getDefaultPluginConfiguration(
+ ResourceType resourceType) {
+ ConfigurationTemplate pluginConfigDefaultTemplate = resourceType
+ .getPluginConfigurationDefinition().getDefaultTemplate();
+ return (pluginConfigDefaultTemplate != null) ? pluginConfigDefaultTemplate
+ .createConfiguration()
+ : new Configuration();
+ }
+
+ /**
+ * @param name
+ * @param componentType
+ * @return
+ */
+ public static boolean isManagedComponent(
+ ProfileServiceConnection connection, String name,
+ ComponentType componentType) {
+ boolean isDeployed = false;
+ if (name != null) {
+ try {
+ ManagedComponent component = getManagedComponent(connection,
+ componentType, name);
+ if (component != null)
+ isDeployed = true;
+ } catch (Exception e) {
+ // Setting it to true to be safe than sorry, since there might
+ // be a component
+ // already deployed in the AS.
+ isDeployed = true;
+ }
+ }
+ return isDeployed;
+ }
+
+ /**
+ * Get the passed in {@link ManagedComponent}
+ *
+ * @return {@link ManagedComponent}
+ * @throws NamingException
+ * @throws Exception
+ */
+ public static ManagedComponent getManagedComponent(
+ ProfileServiceConnection connection, ComponentType componentType,
+ String componentName) throws NamingException, Exception {
+ ManagedComponent mc = connection.getManagementView().getComponent(
+ componentName, componentType);
+
+ return mc;
+ }
+
+ /**
+ * Get the {@link ManagedComponent} for the {@link ComponentType} and sub
+ * type.
+ *
+ * @return Set of {@link ManagedComponent}s
+ * @throws NamingException
+ * , Exception
+ * @throws Exception
+ */
+ public static Set<ManagedComponent> getManagedComponents(ProfileServiceConnection connection,
+ ComponentType componentType) throws NamingException, Exception {
+
+ Set<ManagedComponent> mcSet = connection.getManagementView().getComponentsForType(componentType);
+
+ return mcSet;
+ }
+
+ /**
+ * @param {@link ManagementView}
+ * @return
+ */
+ public static ManagementView getManagementView(ProfileService ps,
+ boolean load) {
+ ManagementView mv = ps.getViewManager();
+ if (load) {
+ mv.load();
+ }
+ return mv;
+ }
+
+ /**
+ * Get the {@link DeploymentManager} from the ProfileService
+ *
+ * @return DeploymentManager
+ * @throws NamingException
+ * @throws Exception
+ */
+ public static DeploymentManager getDeploymentManager(ProfileServiceConnection connection)
+ throws NamingException, Exception {
+
+ return connection.getDeploymentManager();
+ }
+
+ /**
+ * @return {@link File}
+ * @throws NamingException
+ * , Exception
+ */
+ public static File getDeployDirectory(ProfileServiceConnection connection) throws NamingException, Exception {
+ Set<ManagedDeployment> warDeployments;
+ try {
+ warDeployments = connection.getManagementView()
+ .getDeploymentsForType(KnownDeploymentTypes.JavaEEWebApplication
+ .getType());
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ ManagedDeployment standaloneWarDeployment = null;
+ for (ManagedDeployment warDeployment : warDeployments) {
+ if (warDeployment.getParent() == null) {
+ standaloneWarDeployment = warDeployment;
+ break;
+ }
+ }
+ if (standaloneWarDeployment == null)
+ // This could happen if no standalone WARs, including the admin
+ // console WAR, have been fully deployed yet.
+ return null;
+ URL warUrl;
+ try {
+ warUrl = new URL(standaloneWarDeployment.getName());
+ } catch (MalformedURLException e) {
+ throw new IllegalStateException(e);
+ }
+ File warFile = new File(warUrl.getPath());
+ File deployDir = warFile.getParentFile();
+ return deployDir;
+ }
+
+ public static ManagedComponent getRuntimeEngineDeployer(
+ ProfileServiceConnection connection) throws NamingException,
+ Exception {
+
+ return getManagedComponent(connection, DQPTYPE, DQPNAME);
+ }
+
+ public static ManagedComponent getBufferService(
+ ProfileServiceConnection connection) throws NamingException,
+ Exception {
+
+ return getManagedComponent(connection, DQPTYPE, BUFFERSERVICE);
+ }
+
+ public static String stringValue(MetaValue v1) throws Exception {
+ if (v1 != null) {
+ MetaType type = v1.getMetaType();
+ if (type instanceof SimpleMetaType) {
+ SimpleValue simple = (SimpleValue) v1;
+ return simple.getValue().toString();
+ }
+ throw new Exception("Failed to convert value to string value"); //$NON-NLS-1$
+ }
+ return null;
+ }
+
+ public static Boolean booleanValue(MetaValue v1) throws Exception {
+ if (v1 != null) {
+ MetaType type = v1.getMetaType();
+ if (type instanceof SimpleMetaType) {
+ SimpleValue simple = (SimpleValue) v1;
+ return Boolean.valueOf(simple.getValue().toString());
+ }
+ throw new Exception("Failed to convert value to boolean value"); //$NON-NLS-1$
+ }
+ return null;
+ }
+
+ public static Double doubleValue(MetaValue v1) throws Exception {
+ if (v1 != null) {
+ MetaType type = v1.getMetaType();
+ if (type instanceof SimpleMetaType) {
+ SimpleValue simple = (SimpleValue) v1;
+ return Double.valueOf(simple.getValue().toString());
+ }
+ throw new Exception("Failed to convert value to boolean value"); //$NON-NLS-1$
+ }
+ return null;
+ }
+
+ public static <T> T getSimpleValue(ManagedComponent mc, String prop,
+ Class<T> expectedType) {
+ ManagedProperty mp = mc.getProperty(prop);
+ if (mp != null) {
+ MetaType metaType = mp.getMetaType();
+ if (metaType.isSimple()) {
+ SimpleValue simpleValue = (SimpleValue) mp.getValue();
+ return expectedType.cast((simpleValue != null) ? simpleValue
+ .getValue() : null);
+ } else if (metaType.isEnum()) {
+ EnumValue enumValue = (EnumValue) mp.getValue();
+ return expectedType.cast((enumValue != null) ? enumValue
+ .getValue() : null);
+ }
+ throw new IllegalStateException(prop + " is not a simple type"); //$NON-NLS-1$
+ }
+ return null;
+ }
+
+ public static <T> T getSimpleValue(ManagedCommon mc, String prop,
+ Class<T> expectedType) {
+ ManagedProperty mp = mc.getProperty(prop);
+ if (mp != null) {
+ MetaType metaType = mp.getMetaType();
+ if (metaType.isSimple()) {
+ SimpleValue simpleValue = (SimpleValue) mp.getValue();
+ return expectedType.cast((simpleValue != null) ? simpleValue
+ .getValue() : null);
+ } else if (metaType.isEnum()) {
+ EnumValue enumValue = (EnumValue) mp.getValue();
+ return expectedType.cast((enumValue != null) ? enumValue
+ .getValue() : null);
+ }
+ throw new IllegalArgumentException(prop + " is not a simple type"); //$NON-NLS-1$
+ }
+ return null;
+ }
+
+ public static Map<String, PropertySimple> getCustomProperties(
+ Configuration pluginConfig) {
+ Map<String, PropertySimple> customProperties = new LinkedHashMap<String, PropertySimple>();
+ if (pluginConfig == null)
+ return customProperties;
+ PropertyMap customPropsMap = pluginConfig.getMap("custom-properties"); //$NON-NLS-1$
+ if (customPropsMap != null) {
+ Collection<Property> customProps = customPropsMap.getMap().values();
+ for (Property customProp : customProps) {
+ if (!(customProp instanceof PropertySimple)) {
+ LOG
+ .error("Custom property definitions in plugin configuration must be simple properties - property " //$NON-NLS-1$
+ + customProp + " is not - ignoring..."); //$NON-NLS-1$
+ continue;
+ }
+ customProperties.put(customProp.getName(),
+ (PropertySimple) customProp);
+ }
+ }
+ return customProperties;
+ }
+
+ public static Configuration convertManagedObjectToConfiguration(
+ Map<String, ManagedProperty> managedProperties,
+ Map<String, PropertySimple> customProps, ResourceType resourceType) {
+ Configuration config = new Configuration();
+ ConfigurationDefinition configDef = resourceType
+ .getResourceConfigurationDefinition();
+ Map<String, PropertyDefinition> propDefs = configDef
+ .getPropertyDefinitions();
+ Set<String> propNames = managedProperties.keySet();
+ for (String propName : propNames) {
+ PropertyDefinition propertyDefinition = propDefs.get(propName);
+ ManagedProperty managedProperty = managedProperties.get(propName);
+ if (propertyDefinition == null) {
+ if (!managedProperty.hasViewUse(ViewUse.STATISTIC))
+ LOG
+ .debug(resourceType
+ + " does not define a property corresponding to ManagedProperty '" //$NON-NLS-1$
+ + propName + "'."); //$NON-NLS-1$
+ continue;
+ }
+ if (managedProperty == null) {
+ // This should never happen, but don't let it blow us up.
+ LOG.error("ManagedProperty '" + propName //$NON-NLS-1$
+ + "' has a null value in the ManagedProperties Map."); //$NON-NLS-1$
+ continue;
+ }
+ MetaValue metaValue = managedProperty.getValue();
+ if (managedProperty.isRemoved() || metaValue == null) {
+ // Don't even add a Property to the Configuration if the
+ // ManagedProperty is flagged as removed or has a
+ // null value.
+ continue;
+ }
+ PropertySimple customProp = customProps.get(propName);
+ PropertyAdapter<Property, PropertyDefinition> propertyAdapter = PropertyAdapterFactory
+ .getCustomPropertyAdapter(customProp);
+ if (propertyAdapter == null)
+ propertyAdapter = PropertyAdapterFactory
+ .getPropertyAdapter(metaValue);
+ if (propertyAdapter == null) {
+ LOG
+ .error("Unable to find a PropertyAdapter for ManagedProperty '" //$NON-NLS-1$
+ + propName
+ + "' with MetaType [" //$NON-NLS-1$
+ + metaValue.getMetaType()
+ + "] for ResourceType '" //$NON-NLS-1$
+ + resourceType.getName() + "'."); //$NON-NLS-1$
+ continue;
+ }
+ Property property = propertyAdapter.convertToProperty(metaValue,
+ propertyDefinition);
+ config.put(property);
+ }
+ return config;
+ }
+
+ public static void convertConfigurationToManagedProperties(Map<String, ManagedProperty> managedProperties, Configuration configuration, ResourceType resourceType, String prefix) {
+ ConfigurationDefinition configDefinition = resourceType.getResourceConfigurationDefinition();
+ for (ManagedProperty managedProperty : managedProperties.values()) {
+ String propertyName = managedProperty.getName();
+ if (prefix != null) {
+ propertyName = prefix + "." + propertyName; //$NON-NLS-1$
+ }
+ PropertyDefinition propertyDefinition = configDefinition.get(propertyName);
+ if (propertyDefinition == null) {
+ // The managed property is not defined in the configuration
+ continue;
+ }
+ populateManagedPropertyFromProperty(managedProperty,propertyDefinition, configuration);
+ }
+ return;
+ }
+
+ public static void populateManagedPropertyFromProperty(ManagedProperty managedProperty, PropertyDefinition propertyDefinition, Configuration configuration) {
+ // If the ManagedProperty defines a default value, assume it's more
+ // definitive than any default value that may
+ // have been defined in the plugin descriptor, and update the
+ // PropertyDefinition to use that as its default
+ // value.
+ MetaValue defaultValue = managedProperty.getDefaultValue();
+ if (defaultValue != null) {
+ updateDefaultValueOnPropertyDefinition(propertyDefinition,defaultValue);
+ }
+ MetaValue metaValue = managedProperty.getValue();
+ PropertyAdapter propertyAdapter = null;
+ if (metaValue != null) {
+ LOG.trace("Populating existing MetaValue of type " //$NON-NLS-1$
+ + metaValue.getMetaType() + " from Teiid property " //$NON-NLS-1$
+ + propertyDefinition.getName() + " with definition " //$NON-NLS-1$
+ + propertyDefinition + "..."); //$NON-NLS-1$
+ propertyAdapter = PropertyAdapterFactory.getPropertyAdapter(metaValue);
+
+ propertyAdapter.populateMetaValueFromProperty(configuration.getSimple(propertyDefinition.getName()), metaValue, propertyDefinition);
+ managedProperty.setValue(metaValue);
+ } else {
+ MetaType metaType = managedProperty.getMetaType();
+ propertyAdapter = PropertyAdapterFactory.getPropertyAdapter(metaType);
+ LOG.trace("Converting property " + propertyDefinition.getName() + " with definition " + propertyDefinition + " to MetaValue of type " + metaType + "..."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ metaValue = propertyAdapter.convertToMetaValue(configuration.getSimple(propertyDefinition.getName()),propertyDefinition, metaType);
+ managedProperty.setValue(metaValue);
+ }
+
+ }
+
+ private static void updateDefaultValueOnPropertyDefinition(
+ PropertyDefinition propertyDefinition,
+ @NotNull MetaValue defaultValue) {
+ if (!(propertyDefinition instanceof PropertyDefinitionSimple)) {
+ LOG.debug("Cannot update default value on non-simple property definition " //$NON-NLS-1$
+ + propertyDefinition + "(default value is " //$NON-NLS-1$
+ + defaultValue + ")."); //$NON-NLS-1$
+ return;
+ }
+ MetaType metaType = defaultValue.getMetaType();
+ if (!metaType.isSimple() && !metaType.isEnum()) {
+ LOG.debug("Cannot update default value on " + propertyDefinition //$NON-NLS-1$
+ + ", because default value's type (" + metaType //$NON-NLS-1$
+ + ") is not simple or enum."); //$NON-NLS-1$
+ return;
+ }
+ PropertyDefinitionSimple propertyDefinitionSimple = (PropertyDefinitionSimple) propertyDefinition;
+ if (metaType.isSimple()) {
+ SimpleValue defaultSimpleValue = (SimpleValue) defaultValue;
+ Serializable value = defaultSimpleValue.getValue();
+ propertyDefinitionSimple.setDefaultValue((value != null) ? value.toString() : null);
+ } else { // defaultValueMetaType.isEnum()
+ EnumValue defaultEnumValue = (EnumValue) defaultValue;
+ Serializable value = defaultEnumValue.getValue();
+ propertyDefinitionSimple.setDefaultValue((value != null) ? value.toString() : null);
+ }
+ }
+
+ public static MetaType convertPropertyDefinitionToMetaType(
+ PropertyDefinition propDef) {
+ MetaType memberMetaType;
+ if (propDef instanceof PropertyDefinitionSimple) {
+ PropertySimpleType propSimpleType = ((PropertyDefinitionSimple) propDef)
+ .getType();
+ memberMetaType = convertPropertySimpleTypeToSimpleMetaType(propSimpleType);
+ } else if (propDef instanceof PropertyDefinitionList) {
+ // TODO (very low priority, since lists of lists are not going to be
+ // at all common)
+ memberMetaType = null;
+ } else if (propDef instanceof PropertyDefinitionMap) {
+ Map<String, PropertyDefinition> memberPropDefs = ((PropertyDefinitionMap) propDef)
+ .getPropertyDefinitions();
+ if (memberPropDefs.isEmpty())
+ throw new IllegalStateException(
+ "PropertyDefinitionMap doesn't contain any member PropertyDefinitions."); //$NON-NLS-1$
+ // NOTE: We assume member prop defs are all of the same type, since
+ // for MapCompositeMetaTypes, they have to be.
+ PropertyDefinition mapMemberPropDef = memberPropDefs.values()
+ .iterator().next();
+ MetaType mapMemberMetaType = convertPropertyDefinitionToMetaType(mapMemberPropDef);
+ memberMetaType = new MapCompositeMetaType(mapMemberMetaType);
+ } else {
+ throw new IllegalStateException(
+ "List member PropertyDefinition has unknown type: " //$NON-NLS-1$
+ + propDef.getClass().getName());
+ }
+ return memberMetaType;
+ }
+
+ private static MetaType convertPropertySimpleTypeToSimpleMetaType(
+ PropertySimpleType memberSimpleType) {
+ MetaType memberMetaType;
+ Class memberClass;
+ switch (memberSimpleType) {
+ case BOOLEAN:
+ memberClass = Boolean.class;
+ break;
+ case INTEGER:
+ memberClass = Integer.class;
+ break;
+ case LONG:
+ memberClass = Long.class;
+ break;
+ case FLOAT:
+ memberClass = Float.class;
+ break;
+ case DOUBLE:
+ memberClass = Double.class;
+ break;
+ default:
+ memberClass = String.class;
+ break;
+ }
+ memberMetaType = SimpleMetaType.resolve(memberClass.getName());
+ return memberMetaType;
+ }
+
+ public static SimpleValue wrap(MetaType type, String value)
+ throws Exception {
+ if (type instanceof SimpleMetaType) {
+ SimpleMetaType st = (SimpleMetaType) type;
+
+ if (SimpleMetaType.BIGDECIMAL.equals(st)) {
+ return new SimpleValueSupport(st, new BigDecimal(value));
+ } else if (SimpleMetaType.BIGINTEGER.equals(st)) {
+ return new SimpleValueSupport(st, new BigInteger(value));
+ } else if (SimpleMetaType.BOOLEAN.equals(st)) {
+ return new SimpleValueSupport(st, Boolean.valueOf(value));
+ } else if (SimpleMetaType.BOOLEAN_PRIMITIVE.equals(st)) {
+ return new SimpleValueSupport(st, Boolean.valueOf(value)
+ .booleanValue());
+ } else if (SimpleMetaType.BYTE.equals(st)) {
+ return new SimpleValueSupport(st, new Byte(value.getBytes()[0]));
+ } else if (SimpleMetaType.BYTE_PRIMITIVE.equals(st)) {
+ return new SimpleValueSupport(st, value.getBytes()[0]);
+ } else if (SimpleMetaType.CHARACTER.equals(st)) {
+ return new SimpleValueSupport(st,
+ new Character(value.charAt(0)));
+ } else if (SimpleMetaType.CHARACTER_PRIMITIVE.equals(st)) {
+ return new SimpleValueSupport(st, value.charAt(0));
+ } else if (SimpleMetaType.DATE.equals(st)) {
+ try {
+ return new SimpleValueSupport(st, SimpleDateFormat
+ .getInstance().parse(value));
+ } catch (ParseException e) {
+ throw new Exception(
+ "Failed to convert value to SimpleValue", e); //$NON-NLS-1$
+ }
+ } else if (SimpleMetaType.DOUBLE.equals(st)) {
+ return new SimpleValueSupport(st, Double.valueOf(value));
+ } else if (SimpleMetaType.DOUBLE_PRIMITIVE.equals(st)) {
+ return new SimpleValueSupport(st, Double.parseDouble(value));
+ } else if (SimpleMetaType.FLOAT.equals(st)) {
+ return new SimpleValueSupport(st, Float.parseFloat(value));
+ } else if (SimpleMetaType.FLOAT_PRIMITIVE.equals(st)) {
+ return new SimpleValueSupport(st, Float.valueOf(value));
+ } else if (SimpleMetaType.INTEGER.equals(st)) {
+ return new SimpleValueSupport(st, Integer.valueOf(value));
+ } else if (SimpleMetaType.INTEGER_PRIMITIVE.equals(st)) {
+ return new SimpleValueSupport(st, Integer.parseInt(value));
+ } else if (SimpleMetaType.LONG.equals(st)) {
+ return new SimpleValueSupport(st, Long.valueOf(value));
+ } else if (SimpleMetaType.LONG_PRIMITIVE.equals(st)) {
+ return new SimpleValueSupport(st, Long.parseLong(value));
+ } else if (SimpleMetaType.SHORT.equals(st)) {
+ return new SimpleValueSupport(st, Short.valueOf(value));
+ } else if (SimpleMetaType.SHORT_PRIMITIVE.equals(st)) {
+ return new SimpleValueSupport(st, Short.parseShort(value));
+ } else if (SimpleMetaType.STRING.equals(st)) {
+ return new SimpleValueSupport(st, value);
+ }
+ }
+ throw new Exception("Failed to convert value to SimpleValue"); //$NON-NLS-1$
+ }
+
+}
Deleted: tags/teiid-parent-7.2.0.Final/console/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- branches/7.2.x/console/src/main/resources/META-INF/rhq-plugin.xml 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/console/src/main/resources/META-INF/rhq-plugin.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -1,706 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
- <!--
- * JBoss, Home of Professional Open Source. * See the COPYRIGHT.txt
- file distributed with this work for information * regarding copyright
- ownership. Some portions may be licensed * to Red Hat, Inc. under one
- or more contributor license agreements. * * This library is free of
- the GNU Lesser General Public * License as published by the Free
- Software Foundation; either * version 2.1 of the License, or (at your
- option) any later version. * * This library is distributed in the hope
- that it will be useful, * but WITHOUT ANY WARRANTY; without even the
- implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the GNU * Lesser General Public License for more details.
- * * You should have received a copy of the GNU Lesser General Public *
- License along with this library; if not, write to the Free Software *
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
- 02110-1301 USA. */
- -->
-
- <!DOCTYPE plugin [
-
-<!ENTITY managedObjectMetrics '
- <metric property="runState" displayType="summary"
- defaultOn="true" defaultInterval="30000" dataType="trait" category="performance"/>
-'>
-
-<!ENTITY translatorConfiguration '
-
- <c:list-property name="translatorList" description="Properties for this translator"
- readOnly="true">
- <c:simple-property name="name" displayName="Name"
- description="Name of the translator" />
- <c:simple-property name="execution-factory-class" displayName="execution-factory-class"
- description="Connector Class" />
- <c:list-property name="translatorList" description="Properties for this translator" readOnly="true">
- <c:map-property name="translator-properties" >
- <c:simple-property name="name" displayName="Name"
- description="Name of this property" readOnly="true" />
- <c:simple-property name="value" displayName="Value"
- description="Value of this property" />
- <c:simple-property name="description" displayName="Description"
- description="Description of this property" />
- </c:map-property>
- </c:list-property>
-
-'>
-
-<!ENTITY accessTranslatorConfiguration '
- <resource-configuration>
- <c:list-property name="translatorList" description="Properties for this translator"
- readOnly="true">
- <c:map-property name="translatorMap">
- <c:simple-property name="name" displayName="Name"
- description="Name of this property" readOnly="true" />
- <c:simple-property name="value" displayName="Value"
- description="Value of this property" readOnly="true" />
- <c:simple-property name="description" displayName="Description"
- description="Description of this property" readOnly="true" />
- </c:map-property>
- </c:list-property>
- </resource-configuration>
-
-'>
-
-
-]>
-
- <!--
- ############################################# END OF XML ENTITIES
- ###############################################
- -->
-
-
-
-<plugin name="TeiidPlugin" displayName="Teiid Plugin" package="org.teiid.rhq.plugin"
- version="2.0.0" description="Supports management and monitoring of JBoss Teiid"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"
- xmlns:c="urn:xmlns:rhq-configuration">
-
- <depends plugin="JBossAS5" useClasses="true" />
-
- <server name="Data Services" description="Teiid Data Services"
- class="PlatformComponent" discovery="PlatformDiscoveryComponent"
- singleton="true">
-
- <runs-inside>
- <parent-resource-type name="JBossAS Server"
- plugin="JBossAS5" />
- </runs-inside>
-
- <operation name="getLongRunningRequests" displayName="View current long running queries"
- description="List current queries executing against the Teiid System that have surpassed the long running query threshhold">
- <results>
- <c:list-property name="list">
- <c:map-property name="map">
- <c:simple-property displayName="Session ID"
- name="getSessionId" type="string"
- description="The name of the resource whose availability is being reported" />
- <c:simple-property displayName="Request ID"
- name="getRequestId" type="string" description="The id for the request" />
- <c:simple-property displayName="SQL String"
- name="getCommand" type="string" description="The SQL string for this query" />
- <c:simple-property displayName="Source Request"
- name="sourceRequest" type="string"
- description="If false,this is the top level query. If true, this a physical source query." />
- <c:simple-property displayName="Execution ID"
- name="getExecutionId" type="string"
- description="The execution id for this request (if this is a physical source query)" />
- <c:simple-property displayName="Start Time"
- name="getCreatedTime" type="string" description="The time this query began" />
- <c:simple-property displayName="Start Time"
- name="getProcessingTime" type="string" description="Processing time for this request" />
- <c:simple-property displayName="Transaction ID"
- name="getTransactionId" type="string"
- description="The transaction XID if there is a transaction involved" />
- <c:simple-property displayName="Node ID" name="getNodeId"
- type="string" description="The node ID of this query" />
- </c:map-property>
- </c:list-property>
- </results>
- </operation>
-
- <operation name="getSessions" displayName="View current sessions"
- description="Get current sessions connected to the Teiid instance">
- <results>
-
- <c:list-property name="list" displayName="Current Sessions"
- description="Sessions currently connected to the Teiid system"
- required="false">
- <c:map-property name="map">
- <c:simple-property displayName="Session ID"
- name="getSessionId" type="string" description="The identifier for this session" />
- <c:simple-property displayName="Application Name"
- name="getApplicationName" type="string"
- description="The application associated with Session" />
- <c:simple-property displayName="Created Time"
- name="getCreatedTime" type="string" description="When the session was created" />
- <c:simple-property displayName="Client Host"
- name="getClientHostName" type="string"
- description="Host name from where the session created" />
- <c:simple-property displayName="IP Address"
- name="getIPAddress" type="string"
- description="IP address from where this session was created" />
- <c:simple-property displayName="Last ping time"
- name="getLastPingTime" type="string" description="Last ping time" />
- <c:simple-property displayName="User Name" name="getUserName"
- type="string" description="User associated with this session" />
- <c:simple-property displayName="VDB Name" name="getVDBName"
- type="string" description="VDB associated with this session" />
- <c:simple-property displayName="Security Domain"
- name="getSecurityDomain" type="string"
- description="Security Domain that session logged into" />
- </c:map-property>
- </c:list-property>
- </results>
- </operation>
-
- <operation name="deployVdbByUrl" displayName="Deploy a VDB via URL"
- description="Deploy a VDB using a URL">
- <parameters>
- <c:simple-property displayName="VDB URL" name="vdbUrl"
- type="file" required="true" description="The URL of the VDB to deploy" />
- <c:simple-property displayName="VDB Deploy File Name"
- name="vdbDeployName" type="string" required="true"
- description="The deployment file name to use. Must match the VDB Name you are deploying." />
- <c:simple-property displayName="VDB Version" name="vdbVersion"
- type="integer" required="false"
- description="The version to use for the deployed VDB (leave blank for overwrite of version one)" />
- </parameters>
- </operation>
-
-
- <operation name="terminateSession" displayName="Terminate Session"
- description="Terminate a specified session">
- <parameters>
- <c:simple-property displayName="SessionID" name="sessionID"
- type="long" required="true" description="The ID of the session to terminate" />
- </parameters>
- </operation>
-
-
- <operation name="getRequests" displayName="View current requests"
- description="Get current requests executing against this Teiid instance">
- <results>
-
- <c:list-property name="list" displayName="Current Request"
- description="Requests currently executing against the Teiid system"
- required="false">
- <c:map-property name="map">
- <c:simple-property displayName="Request ID"
- name="getRequestId" type="string" description="The request identifier" />
- <c:simple-property displayName="Session ID"
- name="getSessionId" type="string" description="Session identifier" />
- <c:simple-property displayName="Execution ID"
- name="getExecutionId" type="string" description="Unique Identifier for Request" />
- <c:simple-property displayName="Created Time"
- name="getCreatedTime" type="string" description="Time when request submitted" />
- <c:simple-property displayName="Processing Time"
- name="getProcessingTime" type="string" description="Processing time for the request" />
- <c:simple-property displayName="Last ping time"
- name="getCommand" type="string" description="SQL Command" />
- <c:simple-property displayName="Connector level request?"
- name="sourceRequest" type="string"
- description="True if this is a connector level request" />
- <c:simple-property displayName="Node ID" name="getNodeId"
- type="string" description="The node identifier" />
- <c:simple-property displayName="Tansaction identifier"
- name="getTransactionId" type="string"
- description="Transaction XID if a transaction is involved" />
- </c:map-property>
- </c:list-property>
- </results>
- </operation>
-
- <operation name="cancelRequest" displayName="Terminate request"
- description="Terminate the processing of a query and its source queries">
- <parameters>
- <c:simple-property displayName="Session ID" name="sessionID"
- type="long" required="true"
- description="The ID of the session that the request to cancel is associated with" />
- <c:simple-property displayName="Request ID" name="requestID"
- type="long" required="true" description="The ID of the request to cancel" />
- </parameters>
- </operation>
-
- <operation name="getTransactions" displayName="View current transactions"
- description="Get current transactions executing against this VDB">
- <results>
- <c:list-property name="list" displayName="Current Transactions"
- description="Transactions currently executing against the Teiid system"
- required="false">
- <c:map-property name="map">
- <c:simple-property displayName="Transaction ID"
- name="getId" type="string"
- description="The Xid string for GLOBAL transactions or the Transaction id string LOCAL/REQUEST." />
- <c:simple-property displayName="Session ID"
- name="getAssociatedSession" type="string"
- description="Get the session associated with the this transaction. May be null for an unassociated Global transaction." />
- <c:simple-property displayName="Scope" name="getScope"
- type="string"
- description="Get the scope for the transaction. Will be one of GLOBAL, LOCAL, or REQUEST" />
- <c:simple-property displayName="Created Time"
- name="getCreatedTime" type="string" description="The local creation time." />
- </c:map-property>
- </c:list-property>
- </results>
- </operation>
-
- <operation name="terminateTransaction" displayName="Terminate Transaction"
- description="Terminate a specified transaction">
- <parameters>
- <c:simple-property displayName="Transaction ID"
- name="transactionID" type="long" required="true"
- description="The ID of the transaction to terminate" />
- </parameters>
- </operation>
-
- <metric displayName="Query Count" defaultOn="true" displayType="detail"
- category="throughput" property="queryCount"
- description="The number of queries currently active." />
-
- <metric displayName="Long Running Queries" defaultOn="true"
- displayType="detail" category="performance" property="longRunningQueries"
- description="The number of queries that have been running longer than the limit set for queries." />
-
- <metric displayName="Session Count" defaultOn="true"
- displayType="detail" category="throughput" property="sessionCount"
- description="The number of user connections currently active." />
-
- <metric displayName="Used Buffer Space" defaultOn="true"
- displayType="detail" category="throughput" property="userBufferSpace"
- description="The currently used file buffer space in MB." />
-
- <metric displayName="Prepared Plan Cache Hit Ratio %"
- defaultOn="true" displayType="detail" category="performance"
- property="PREPARED_PLAN_CACHE.hitRatio" description="Percentage of positive cache hits" />
-
- <metric displayName="Prepared Plan Cache Size" defaultOn="true"
- displayType="detail" category="performance" property="PREPARED_PLAN_CACHE.totalEntries"
- description="Current number of entries in cache" />
-
- <metric displayName="Prepared Plan Cache # of Requests"
- defaultOn="true" displayType="detail" category="performance"
- property="PREPARED_PLAN_CACHE.requestCount" description="Total number of requests made against cache" />
-
- <metric displayName="ResultSet Cache Hit Ratio %" defaultOn="true"
- displayType="detail" category="performance"
- property="QUERY_SERVICE_RESULT_SET_CACHE.hitRatio" description="Percentage of positive cache hits" />
-
- <metric displayName="ResultSet Cache Size" defaultOn="true"
- displayType="detail" category="performance"
- property="QUERY_SERVICE_RESULT_SET_CACHE.totalEntries" description="Current number of entries in cache" />
-
- <metric displayName="ResultSet Cache # of Requests" defaultOn="true"
- displayType="detail" category="performance"
- property="QUERY_SERVICE_RESULT_SET_CACHE.requestCount" description="Total number of requests made against cache" />
-
- <resource-configuration>
- <c:group name="teiidProperties" displayName="Runtime Engine Properties"
- hiddenByDefault="false">
- <c:simple-property name="maxRowsFetchSize"
- displayName="Max Rows Fetch Size"
- description="The maximum number of result set cache entries. 0 indicates no limit. (default 1024)"
- required="false" readOnly="false" />
- <c:simple-property name="processName" displayName="Process Name"
- description="Name that uniquely identifies this process" required="false"
- readOnly="false" />
- <c:simple-property name="maxThreads" displayName="Max Threads"
- description="Process pool maximum thread count. (default 64)"
- required="false" readOnly="false" />
- <c:simple-property name="timeSliceInMilli"
- displayName="Time Slice In Milliseconds"
- description="Query processor time slice, in milliseconds. (default 2000)"
- required="false" readOnly="false" />
- <c:simple-property name="lobChunkSizeInKB"
- displayName="Lob Chunk Size In KB"
- description="The max lob chunk size in KB transferred to the client for xml, blobs, clobs (default 100KB)"
- required="false" readOnly="false" />
- <c:simple-property name="resultSetCacheEnabled"
- displayName="Result Set Cache Enabled"
- description="Denotes whether or not result set caching is enabled. (default true)"
- required="false" readOnly="false" type="boolean" />
- <c:simple-property name="resultSetCacheMaxEntries"
- displayName="Result Set Cache Max Entries"
- description="The maximum number of result set cache entries. -1 indicates no limit. (default 1024)"
- required="false" readOnly="false" />
- <c:simple-property name="resultSetCacheMaxEntryAge"
- displayName="Result Set Cache Max Entry Age"
- description="The maximum age of a result set cache entry in seconds. -1 indicates no max. (default 7200)"
- required="false" readOnly="false" />
- <c:simple-property name="preparedPlanCacheMaxCount"
- displayName="Prepared Plan Cache Max Count"
- description="The maximum number of query plans that are cached. Note: this is a memory based cache. (default 250)"
- required="false" readOnly="false" />
- <c:simple-property name="activeSessionsCount"
- displayName="Active Session Count" description="Count of active sessions"
- required="false" readOnly="false" />
- <c:simple-property name="queryThresholdInSecs"
- displayName="Long Running Query Threshold"
- description="Length of time in seconds before a query is considered long running"
- required="false" readOnly="false" />
- </c:group>
- <c:group name="bufferServiceProperties" displayName="Buffer Service Properties"
- hiddenByDefault="false">
- <c:simple-property name="maxBufferSpace"
- displayName="Max Buffer Space"
- description="Max file storage space, in MB, to be used for buffer files (default 50G)"
- required="false" readOnly="false" />
- <c:simple-property name="processorBatchSize"
- displayName="Processor Batch Size"
- description="The max row count of a batch sent internally within the query processor. Should be <= the connectorBatchSize. (default 512)"
- required="false" readOnly="false" />
- <c:simple-property name="connectorBatchSize"
- displayName="Connector Batch Size"
- description="The max row count of a batch from a connector. Should be even multiple of processorBatchSize. (default 1024)"
- required="false" readOnly="false" />
- <c:simple-property name="maxProcessingBatchesColumns"
- displayName="Max Processing Batches Columns"
- description="The number of batch columns guarenteed to a processing operation. Set this value lower if the workload typically processes larger numbers of concurrent queries with large intermediate results from operations such as sorting, grouping, etc. (default 128)"
- required="false" readOnly="false" />
- <c:simple-property name="maxFileSize" displayName="Max File Size"
- description="Max file size for buffer files (default 2GB)"
- required="false" readOnly="false" />
- <c:simple-property name="maxReserveBatchColumns"
- displayName="Max Reserve Batch Columns"
- description="The number of batch columns to allow in memory (default 16384). This value should be set lower or higher depending on the available memory to Teiid in the VM. 16384 is considered a good default for a dedicated 32-bit VM running Teiid with a 1 gig heap."
- required="false" readOnly="false" />
- </c:group>
- <c:group name="jdbcSocketConfigurationProperties"
- displayName="Jdbc Socket Configuration Properties" hiddenByDefault="false">
- <c:simple-property name="portNumber" displayName="Port Number"
- description="Port Number" required="false" readOnly="false" />
- <c:simple-property name="sslEnabled" displayName="SSL Enabled"
- description="SSL enabled" required="false" readOnly="false" type="boolean"
- default="true" />
- <c:simple-property name="hostName" displayName="Host Name"
- description="Host Name" required="false" readOnly="false" />
- <c:simple-property name="maxSocketThreads"
- displayName="Max Socket Threads" description="Max NIO threads"
- required="false" readOnly="false" />
- <c:simple-property name="inputBufferSize"
- displayName="Input Buffer Size"
- description="SO_RCVBUF size, 0 indicates that system default should be used (default 0)"
- required="false" readOnly="false" />
- <c:simple-property name="outputBufferSize"
- displayName="Output Buffer Size"
- description="SO_SNDBUF size, 0 indicates that system default should be used (default 0)"
- required="false" readOnly="false" />
- </c:group>
- <c:group name="sessionServiceProperties" displayName="Session Service Properties"
- hiddenByDefault="false">
- <c:simple-property name="sessionExpirationTimeLimit"
- displayName="Session Expiration Time Limit"
- description="Max allowed time before the session is terminated by the system, 0 indicates unlimited (default 0)"
- required="false" readOnly="false" />
- <c:simple-property name="sessionMaxLimit"
- displayName="Session Max Limit"
- description="Maximum number of sessions allowed by the system (default 5000)"
- required="false" readOnly="false" />
- </c:group>
- </resource-configuration>
-
- <service name="Virtual Database (VDB)s" description="Teiid Data Services Virtual Databases"
- class="VDBComponent" discovery="VDBDiscoveryComponent"
- createDeletePolicy="both" creationDataType="content">
-
- <operation name="getSessions" displayName="View VDB Sessions"
- description="Get current sessions currently connected to this VDB">
- <results>
-
- <c:list-property name="list" displayName="Current VDB Sessions"
- description="Sessions currently connected to this VDB" required="false">
- <c:map-property name="map">
- <c:simple-property displayName="Session ID"
- name="getSessionId" type="string" description="The identifier for this session" />
- <c:simple-property displayName="Application Name"
- name="getApplicationName" type="string"
- description="The application associated with Session" />
- <c:simple-property displayName="Created Time"
- name="getCreatedTime" type="string" description="When the session was created" />
- <c:simple-property displayName="Client Host"
- name="getClientHostName" type="string"
- description="Host name from where the session created" />
- <c:simple-property displayName="IP Address"
- name="getIPAddress" type="string"
- description="IP address from where this session was created" />
- <c:simple-property displayName="Last ping time"
- name="getLastPingTime" type="string" description="Last ping time" />
- <c:simple-property displayName="User Name"
- name="getUserName" type="string" description="User associated with this session" />
- <c:simple-property displayName="Security Domain"
- name="getSecurityDomain" type="string"
- description="Security Domain that session logged into" />
- </c:map-property>
- </c:list-property>
- </results>
- </operation>
-
- <operation name="getRequestsUsingVDB" displayName="View VDB requests"
- description="Get current requests executing against this VDB">
- <results>
-
- <c:list-property name="list" displayName="Current Request"
- description="Requests currently executing against the Teiid system"
- required="false">
- <c:map-property name="map">
- <c:simple-property displayName="Request ID"
- name="getRequestId" type="string" description="The request identifier" />
- <c:simple-property displayName="Session ID"
- name="getSessionId" type="string" description="Session identifier" />
- <c:simple-property displayName="Execution ID"
- name="getExecutionId" type="string" description="Unique Identifier for Request" />
- <c:simple-property displayName="Created Time"
- name="getCreatedTime" type="string" description="Time when request submitted" />
- <c:simple-property displayName="Processing Time"
- name="getProcessingTime" type="string" description="Processing time for the request" />
- <c:simple-property displayName="Last ping time"
- name="getCommand" type="string" description="SQL Command" />
- <c:simple-property displayName="Connector level request?"
- name="sourceRequest" type="string"
- description="True if this is a connector level request" />
- <c:simple-property displayName="Node ID" name="getNodeId"
- type="string" description="The node identifier" />
- <c:simple-property displayName="Tansaction identifier"
- name="getTransactionId" type="string"
- description="Transaction XID if a transaction is involved" />
- </c:map-property>
- </c:list-property>
- </results>
- </operation>
-
- <operation name="getMaterializedViews" displayName="List Materialized View Info"
- description="List any Materialized Views for this VDB">
-
- <results>
-
- <c:list-property name="list" displayName="Materialized Views"
- description="List information related to Materialized Views, if any, for this VDB"
- required="false">
- <c:map-property name="map">
- <c:simple-property displayName="Schema Name"
- name="schemaName" type="string" description="Name of the schema that is materialized" />
- <c:simple-property displayName="Name" name="name"
- type="string" description="Name of the materialized table" />
- <c:simple-property displayName="Target Schema Name"
- name="targetSchemaName" type="string" description="Name of the materialized schema" />
- <c:simple-property displayName="Target Name"
- name="targetName" type="string" description="Name of target table" />
- <c:simple-property displayName="Valid"
- name="valid" type="string" description="Indicates if data in table is valid for use" />
- <c:simple-property displayName="Current State"
- name="loadState" type="string" description="Processing time for the request" />
- <c:simple-property displayName="Last Updated"
- name="updated" type="integer" description="Last time of data refresh" />
- <c:simple-property displayName="Cardinality"
- name="cardinality" type="integer" description="Row count" />
- </c:map-property>
- </c:list-property>
- </results>
- </operation>
-
- <operation name="reloadMaterializedView" displayName="Refresh a Materialized View"
- description="Refresh a given any Materialized View for this VDB">
- <parameters>
- <c:simple-property displayName="Materialized View Schema"
- name="schema" type="string" required="true"
- description="The schema name of the Materialized View to refresh" />
- <c:simple-property displayName="Materialized View Name"
- name="table" type="string" required="true"
- description="The name of the Materialized View to refresh" />
- <c:simple-property displayName="Invalidate Current Materialized View Table"
- name="invalidate" type="boolean" required="true" default="false"
- description="If yes, will block all queries against the current Materialized View table until data is refreshed." />
- </parameters>
-
- <results>
- <c:simple-property displayName="Result" name="operationResult"
- type="string" description="Result of refresh" />
- </results>
- </operation>
-
- <metric displayName="Status" defaultOn="true" dataType="trait"
- displayType="summary" category="availability" property="status"
- description="The status of this VDB" />
-
- <metric displayName="Errors" defaultOn="true" dataType="trait"
- displayType="summary" category="availability" property="errorCount"
- description="Whether or not errors exist for this VDB" />
-
- <content name="vdb" displayName="VDB Archive" category="deployable"
- isCreationType="true">
- </content>
-
- <resource-configuration>
- <c:group name="general" displayName="General"
- hiddenByDefault="false">
- <c:simple-property name="name" type="string"
- description="The Virtual Database Name" required="false" readOnly="true" />
- <c:simple-property name="version" type="string"
- description="The Virtual Database Version" required="false"
- readOnly="true" />
- <c:simple-property name="description" type="string"
- description="The Virtual Database Description" required="false"
- readOnly="true" />
- <c:simple-property name="status" type="string"
- description="The Virtual Database Status" required="false"
- summary="true" readOnly="true">
- <c:property-options>
- <c:option value="ACTIVE" name="UP" />
- <c:option value="INACTIVE" name="DOWN" default="true" />
- </c:property-options>
- </c:simple-property>
- <c:simple-property name="connectionType" type="string"
- description="Allowable Connections: 1) NONE - disallow new connections 2) BY VERSION - allow connections only if the version is specified or if this is the earliest 'BY VERSION' vdb and there are no vdbs marked as 'ANY'
-3) ANY - allow connections with or without a version specified. If multiple versions of same VDB are deployed, connect to one specified with ANY, or if there are multiple VDBs with ANY then connect to the latest version with ANY "
- required="false">
- <c:property-options>
- <c:option value="NONE" name="NONE" />
- <c:option value="BY_VERSION" name="BY VERSION" default="true" />
- <c:option value="ANY" name="ANY" />
- </c:property-options>
- </c:simple-property>
- <c:simple-property name="url" type="string"
- description="The Virtual Database URL" required="false" readOnly="true" />
- </c:group>
- <c:group name="Translators" displayName="Translators"
- hiddenByDefault="false">
- <c:list-property name="translators" displayName="Overrides"
- readOnly="true" description="The translator overrides for this VDB">
- <c:map-property name="map"
- description="Translator Overrides for this VDB">
- <c:simple-property name="name" displayName="Name"
- description="Name of this translator instance" required="false"
- readOnly="true" />
- <c:simple-property name="type" displayName="Translator type"
- description="Translator type" required="false" readOnly="true" />
- <c:simple-property name="propertyName"
- displayName="Property Name" description="Property Name"
- required="false" readOnly="true" />
- <c:simple-property name="propertyValue"
- displayName="Property Value" description="Property Value"
- required="false" readOnly="true" />
- </c:map-property>
- </c:list-property>
- </c:group>
- <c:group name="Models" displayName="Models" hiddenByDefault="false">
- <c:list-property name="singleSourceModels"
- readOnly="true" description="The source models for this VDB">
- <c:map-property name="map" description="Properties for this model">
- <c:simple-property name="name" displayName="Name"
- description="Name of the model" required="true" readOnly="true" />
- <c:simple-property name="sourceName"
- displayName="Source Name" description="Source name for this model"
- required="false" readOnly="true" />
- <c:simple-property name="translatorName"
- displayName="Translator Name" description="Name of the translator"
- required="false" readOnly="true" />
- <c:simple-property name="jndiName" displayName="Connection JNDI Name"
- description="JNDI name for this connection" required="false" />
- <c:simple-property name="visibility"
- displayName="Visible" description="Visibility of the model"
- required="true" type="boolean" readOnly="true">
- </c:simple-property>
- <c:simple-property name="supportsMultiSource"
- displayName="Supports Multi-source?"
- description="Determines if this model supports multi-source bindings"
- required="true" default="true" type="boolean" readOnly="true" />
- </c:map-property>
- </c:list-property>
-
- <c:list-property name="multiSourceModels"
- description="The multi-source model sources for this VDB">
- <c:map-property name="map" readOnly="false">
- <c:simple-property name="name" displayName="Name"
- description="Name of the model" required="true" readOnly="true" />
- <c:simple-property name="sourceName"
- displayName="Source Name" description="Source name for this model"
- readOnly="true" />
- <c:simple-property name="translatorName"
- displayName="Translator Name" description="Name of the translator"
- required="true" />
- <c:simple-property name="jndiName" displayName="Connection JNDI Name"
- description="JNDI name for this connection" required="false" />
- </c:map-property>
- </c:list-property>
-
- <c:list-property name="logicalModels" readOnly="true"
- description="The logical models for this VDB">
- <c:map-property name="map">
- <c:simple-property name="name" displayName="Name"
- description="Name of the model" required="true" readOnly="true" />
- <c:simple-property name="type" displayName="Type"
- description="type of logical model" required="true" readOnly="true" />
- <c:simple-property name="visibility"
- displayName="Visible" description="Visbility of the model"
- required="true" default="true" readOnly="true" />
- </c:map-property>
- </c:list-property>
- </c:group>
- <c:group name="errors" displayName="Errors" hiddenByDefault="false">
- <c:list-property name="errorList" description="VDB Errors"
- summary="true" readOnly="true">
- <c:map-property name="errorMap" summary="true">
- <c:simple-property name="severity" displayName="Severity"
- description="Severity" readOnly="true" summary="true" />
- <c:simple-property name="message" displayName="Message"
- description="Error message" readOnly="true" summary="true" />
- </c:map-property>
- </c:list-property>
- </c:group>
- </resource-configuration>
-
- <service name="Data Roles" description="Data Roles for this VDB"
- class="DataRoleComponent" discovery="DataRoleDiscoveryComponent">
-
- <resource-configuration>
- <c:simple-property name="name" displayName="Name"
- description="Name of the data role" readOnly="true" required="false" />
- <c:simple-property name="anyAuthenticated"
- displayName="Any Authenticated" type="boolean"
- description="Indicates if the role is mapped to any authenticated user"
- readOnly="false" required="false" />
- <c:simple-property name="description"
- displayName="Description" type="string" description="Description of this data role"
- readOnly="true" required="false" />
- <c:list-property name="mappedRoleNameList"
- readOnly="false" required="false" displayName="Mapped Role Names"
- description="Mapped role names for this data role">
- <c:map-property name="map" readOnly="false">
- <c:simple-property name="name" displayName="Name"
- description="Name of this mapped role" readOnly="true" />
- </c:map-property>
- </c:list-property>
- </resource-configuration>
-
- </service>
-
- </service>
-
- <service name="Translators" description="Teiid Translators"
- class="TranslatorComponent" discovery="TranslatorDiscoveryComponent"
- createDeletePolicy="both" creationDataType="configuration">
-
- <resource-configuration>
- <c:simple-property name="name" displayName="Name"
- description="Name of the translator" readOnly="true" required="false" />
- <c:simple-property name="description" displayName="Description"
- description="Description the translator" readOnly="true" required="false" />
-
- <c:list-property name="translatorList" readOnly="true"
- required="false" displayName="Properties" description="Translator properties">
- <c:map-property name="properties" readOnly="true">
- <c:simple-property name="name" displayName="Name"
- description="Name of this property" readOnly="true" />
- <c:simple-property name="value" displayName="Value"
- description="Value of this property" readOnly="true" />
- </c:map-property>
- </c:list-property>
-
- </resource-configuration>
-
- </service>
-
- </server>
-
-</plugin>
\ No newline at end of file
Copied: tags/teiid-parent-7.2.0.Final/console/src/main/resources/META-INF/rhq-plugin.xml (from rev 2707, branches/7.2.x/console/src/main/resources/META-INF/rhq-plugin.xml)
===================================================================
--- tags/teiid-parent-7.2.0.Final/console/src/main/resources/META-INF/rhq-plugin.xml (rev 0)
+++ tags/teiid-parent-7.2.0.Final/console/src/main/resources/META-INF/rhq-plugin.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -0,0 +1,714 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+ <!--
+ * JBoss, Home of Professional Open Source. * See the COPYRIGHT.txt
+ file distributed with this work for information * regarding copyright
+ ownership. Some portions may be licensed * to Red Hat, Inc. under one
+ or more contributor license agreements. * * This library is free of
+ the GNU Lesser General Public * License as published by the Free
+ Software Foundation; either * version 2.1 of the License, or (at your
+ option) any later version. * * This library is distributed in the hope
+ that it will be useful, * but WITHOUT ANY WARRANTY; without even the
+ implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the GNU * Lesser General Public License for more details.
+ * * You should have received a copy of the GNU Lesser General Public *
+ License along with this library; if not, write to the Free Software *
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ 02110-1301 USA. */
+ -->
+
+ <!DOCTYPE plugin [
+
+<!ENTITY managedObjectMetrics '
+ <metric property="runState" displayType="summary"
+ defaultOn="true" defaultInterval="30000" dataType="trait" category="performance"/>
+'>
+
+<!ENTITY translatorConfiguration '
+
+ <c:list-property name="translatorList" description="Properties for this translator"
+ readOnly="true">
+ <c:simple-property name="name" displayName="Name"
+ description="Name of the translator" />
+ <c:simple-property name="execution-factory-class" displayName="execution-factory-class"
+ description="Connector Class" />
+ <c:list-property name="translatorList" description="Properties for this translator" readOnly="true">
+ <c:map-property name="translator-properties" >
+ <c:simple-property name="name" displayName="Name"
+ description="Name of this property" readOnly="true" />
+ <c:simple-property name="value" displayName="Value"
+ description="Value of this property" />
+ <c:simple-property name="description" displayName="Description"
+ description="Description of this property" />
+ </c:map-property>
+ </c:list-property>
+
+'>
+
+<!ENTITY accessTranslatorConfiguration '
+ <resource-configuration>
+ <c:list-property name="translatorList" description="Properties for this translator"
+ readOnly="true">
+ <c:map-property name="translatorMap">
+ <c:simple-property name="name" displayName="Name"
+ description="Name of this property" readOnly="true" />
+ <c:simple-property name="value" displayName="Value"
+ description="Value of this property" readOnly="true" />
+ <c:simple-property name="description" displayName="Description"
+ description="Description of this property" readOnly="true" />
+ </c:map-property>
+ </c:list-property>
+ </resource-configuration>
+
+'>
+
+
+]>
+
+ <!--
+ ############################################# END OF XML ENTITIES
+ ###############################################
+ -->
+
+
+
+<plugin name="TeiidPlugin" displayName="Teiid Plugin" package="org.teiid.rhq.plugin"
+ version="2.0.0" description="Supports management and monitoring of JBoss Teiid"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xmlns:rhq-plugin"
+ xmlns:c="urn:xmlns:rhq-configuration">
+
+ <depends plugin="JBossAS5" useClasses="true" />
+
+ <server name="Data Services" description="Teiid Data Services"
+ class="PlatformComponent" discovery="PlatformDiscoveryComponent"
+ singleton="true">
+
+ <runs-inside>
+ <parent-resource-type name="JBossAS Server"
+ plugin="JBossAS5" />
+ </runs-inside>
+
+ <operation name="getLongRunningRequests" displayName="View current long running queries"
+ description="List current queries executing against the Teiid System that have surpassed the long running query threshhold">
+ <results>
+ <c:list-property name="list">
+ <c:map-property name="map">
+ <c:simple-property displayName="Session ID"
+ name="getSessionId" type="string"
+ description="The name of the resource whose availability is being reported" />
+ <c:simple-property displayName="Request ID"
+ name="getRequestId" type="string" description="The id for the request" />
+ <c:simple-property displayName="SQL String"
+ name="getCommand" type="string" description="The SQL string for this query" />
+ <c:simple-property displayName="Source Request"
+ name="sourceRequest" type="string"
+ description="If false,this is the top level query. If true, this a physical source query." />
+ <c:simple-property displayName="Execution ID"
+ name="getExecutionId" type="string"
+ description="The execution id for this request (if this is a physical source query)" />
+ <c:simple-property displayName="Start Time"
+ name="getCreatedTime" type="string" description="The time this query began" />
+ <c:simple-property displayName="Start Time"
+ name="getProcessingTime" type="string" description="Processing time for this request" />
+ <c:simple-property displayName="Transaction ID"
+ name="getTransactionId" type="string"
+ description="The transaction XID if there is a transaction involved" />
+ <c:simple-property displayName="Node ID" name="getNodeId"
+ type="string" description="The node ID of this query" />
+ </c:map-property>
+ </c:list-property>
+ </results>
+ </operation>
+
+ <operation name="getSessions" displayName="View current sessions"
+ description="Get current sessions connected to the Teiid instance">
+ <results>
+
+ <c:list-property name="list" displayName="Current Sessions"
+ description="Sessions currently connected to the Teiid system"
+ required="false">
+ <c:map-property name="map">
+ <c:simple-property displayName="Session ID"
+ name="getSessionId" type="string" description="The identifier for this session" />
+ <c:simple-property displayName="Application Name"
+ name="getApplicationName" type="string"
+ description="The application associated with Session" />
+ <c:simple-property displayName="Created Time"
+ name="getCreatedTime" type="string" description="When the session was created" />
+ <c:simple-property displayName="Client Host"
+ name="getClientHostName" type="string"
+ description="Host name from where the session created" />
+ <c:simple-property displayName="IP Address"
+ name="getIPAddress" type="string"
+ description="IP address from where this session was created" />
+ <c:simple-property displayName="Last ping time"
+ name="getLastPingTime" type="string" description="Last ping time" />
+ <c:simple-property displayName="User Name" name="getUserName"
+ type="string" description="User associated with this session" />
+ <c:simple-property displayName="VDB Name" name="getVDBName"
+ type="string" description="VDB associated with this session" />
+ <c:simple-property displayName="Security Domain"
+ name="getSecurityDomain" type="string"
+ description="Security Domain that session logged into" />
+ </c:map-property>
+ </c:list-property>
+ </results>
+ </operation>
+
+ <operation name="deployVdbByUrl" displayName="Deploy a VDB via URL"
+ description="Deploy a VDB using a URL">
+ <parameters>
+ <c:simple-property displayName="VDB URL" name="vdbUrl"
+ type="file" required="true" description="The URL of the VDB to deploy" />
+ <c:simple-property displayName="VDB Deploy File Name"
+ name="vdbDeployName" type="string" required="true"
+ description="The deployment file name to use. Must match the VDB Name you are deploying." />
+ <c:simple-property displayName="VDB Version" name="vdbVersion"
+ type="integer" required="false"
+ description="The version to use for the deployed VDB (leave blank for overwrite of version one)" />
+ </parameters>
+ </operation>
+
+
+ <operation name="terminateSession" displayName="Terminate Session"
+ description="Terminate a specified session">
+ <parameters>
+ <c:simple-property displayName="SessionID" name="sessionID"
+ type="long" required="true" description="The ID of the session to terminate" />
+ </parameters>
+ </operation>
+
+
+ <operation name="getRequests" displayName="View current requests"
+ description="Get current requests executing against this Teiid instance">
+ <results>
+
+ <c:list-property name="list" displayName="Current Request"
+ description="Requests currently executing against the Teiid system"
+ required="false">
+ <c:map-property name="map">
+ <c:simple-property displayName="Request ID"
+ name="getRequestId" type="string" description="The request identifier" />
+ <c:simple-property displayName="Session ID"
+ name="getSessionId" type="string" description="Session identifier" />
+ <c:simple-property displayName="Execution ID"
+ name="getExecutionId" type="string" description="Unique Identifier for Request" />
+ <c:simple-property displayName="Created Time"
+ name="getCreatedTime" type="string" description="Time when request submitted" />
+ <c:simple-property displayName="Processing Time"
+ name="getProcessingTime" type="string" description="Processing time for the request" />
+ <c:simple-property displayName="Last ping time"
+ name="getCommand" type="string" description="SQL Command" />
+ <c:simple-property displayName="Connector level request?"
+ name="sourceRequest" type="string"
+ description="True if this is a connector level request" />
+ <c:simple-property displayName="Node ID" name="getNodeId"
+ type="string" description="The node identifier" />
+ <c:simple-property displayName="Tansaction identifier"
+ name="getTransactionId" type="string"
+ description="Transaction XID if a transaction is involved" />
+ </c:map-property>
+ </c:list-property>
+ </results>
+ </operation>
+
+ <operation name="cancelRequest" displayName="Terminate request"
+ description="Terminate the processing of a query and its source queries">
+ <parameters>
+ <c:simple-property displayName="Session ID" name="sessionID"
+ type="long" required="true"
+ description="The ID of the session that the request to cancel is associated with" />
+ <c:simple-property displayName="Request ID" name="requestID"
+ type="long" required="true" description="The ID of the request to cancel" />
+ </parameters>
+ </operation>
+
+ <operation name="getTransactions" displayName="View current transactions"
+ description="Get current transactions executing against this VDB">
+ <results>
+ <c:list-property name="list" displayName="Current Transactions"
+ description="Transactions currently executing against the Teiid system"
+ required="false">
+ <c:map-property name="map">
+ <c:simple-property displayName="Transaction ID"
+ name="getId" type="string"
+ description="The Xid string for GLOBAL transactions or the Transaction id string LOCAL/REQUEST." />
+ <c:simple-property displayName="Session ID"
+ name="getAssociatedSession" type="string"
+ description="Get the session associated with the this transaction. May be null for an unassociated Global transaction." />
+ <c:simple-property displayName="Scope" name="getScope"
+ type="string"
+ description="Get the scope for the transaction. Will be one of GLOBAL, LOCAL, or REQUEST" />
+ <c:simple-property displayName="Created Time"
+ name="getCreatedTime" type="string" description="The local creation time." />
+ </c:map-property>
+ </c:list-property>
+ </results>
+ </operation>
+
+ <operation name="terminateTransaction" displayName="Terminate Transaction"
+ description="Terminate a specified transaction">
+ <parameters>
+ <c:simple-property displayName="Transaction ID"
+ name="transactionID" type="long" required="true"
+ description="The ID of the transaction to terminate" />
+ </parameters>
+ </operation>
+
+ <metric displayName="Query Count" defaultOn="true" displayType="detail"
+ category="throughput" property="queryCount"
+ description="The number of queries currently active." />
+
+ <metric displayName="Long Running Queries" defaultOn="true"
+ displayType="detail" category="performance" property="longRunningQueries"
+ description="The number of queries that have been running longer than the limit set for queries." />
+
+ <metric displayName="Session Count" defaultOn="true"
+ displayType="detail" category="throughput" property="sessionCount"
+ description="The number of user connections currently active." />
+
+ <metric displayName="Used Buffer Space" defaultOn="true"
+ displayType="detail" category="throughput" property="userBufferSpace"
+ description="The currently used file buffer space in MB." />
+
+ <metric displayName="Prepared Plan Cache Hit Ratio %"
+ defaultOn="true" displayType="detail" category="performance"
+ property="PREPARED_PLAN_CACHE.hitRatio" description="Percentage of positive cache hits" />
+
+ <metric displayName="Prepared Plan Cache Size" defaultOn="true"
+ displayType="detail" category="performance" property="PREPARED_PLAN_CACHE.totalEntries"
+ description="Current number of entries in cache" />
+
+ <metric displayName="Prepared Plan Cache # of Requests"
+ defaultOn="true" displayType="detail" category="performance"
+ property="PREPARED_PLAN_CACHE.requestCount" description="Total number of requests made against cache" />
+
+ <metric displayName="ResultSet Cache Hit Ratio %" defaultOn="true"
+ displayType="detail" category="performance"
+ property="QUERY_SERVICE_RESULT_SET_CACHE.hitRatio" description="Percentage of positive cache hits" />
+
+ <metric displayName="ResultSet Cache Size" defaultOn="true"
+ displayType="detail" category="performance"
+ property="QUERY_SERVICE_RESULT_SET_CACHE.totalEntries" description="Current number of entries in cache" />
+
+ <metric displayName="ResultSet Cache # of Requests" defaultOn="true"
+ displayType="detail" category="performance"
+ property="QUERY_SERVICE_RESULT_SET_CACHE.requestCount" description="Total number of requests made against cache" />
+
+ <resource-configuration>
+ <c:group name="RuntimeEngineDeployer" displayName="Runtime Engine Properties (restart required before modifications take effect)"
+ hiddenByDefault="false">
+ <c:simple-property name="RuntimeEngineDeployer.maxRowsFetchSize"
+ displayName="Max Rows Fetch Size"
+ description="The maximum number of result set cache entries. 0 indicates no limit. (default 1024)"
+ required="false" readOnly="false" />
+ <c:simple-property name="RuntimeEngineDeployer.maxThreads" displayName="Max Threads"
+ description="Process pool maximum thread count. (default 64)"
+ required="false" readOnly="false" />
+ <c:simple-property name="RuntimeEngineDeployer.maxActivePlans"
+ displayName="Maximum Concurrent Active plans"
+ description="Increase this value on highly concurrent systems - but ensure that the underlying pools can handle the increased load without timeouts.(default 20)"
+ required="false" readOnly="false" />
+ <c:simple-property name="RuntimeEngineDeployer.timeSliceInMilli"
+ displayName="Time Slice In Milliseconds"
+ description="Query processor time slice, in milliseconds. (default 2000)"
+ required="false" readOnly="false" />
+ <c:simple-property name="RuntimeEngineDeployer.lobChunkSizeInKB"
+ displayName="Lob Chunk Size In KB"
+ description="The max lob chunk size in KB transferred to the client for xml, blobs, clobs (default 100KB)"
+ required="false" readOnly="false" />
+ <c:simple-property name="RuntimeEngineDeployer.preparedPlanCacheMaxCount"
+ displayName="Prepared Plan Cache Max Count"
+ description="The maximum number of query plans that are cached. Note: this is a memory based cache. (default 250)"
+ required="false" readOnly="false" />
+ <c:simple-property name="RuntimeEngineDeployer.queryThresholdInSecs"
+ displayName="Long Running Query Threshold"
+ description="Length of time in seconds before a query is considered long running"
+ required="false" readOnly="false" />
+ <c:simple-property name="RuntimeEngineDeployer.useDataRoles"
+ displayName="Data Roles Enabled"
+ description="Turn on role checking of resources based on the roles defined in VDB (default true)"
+ required="false" readOnly="false" />
+ </c:group>
+
+ <c:group name="ResultSetCacheConfig" displayName="ResultSet Cache Properties" hiddenByDefault="false">
+ <!-- the below property on RuntimeEngineDeployer -->
+ <c:simple-property name="RuntimeEngineDeployer.resultSetCacheEnabled"
+ displayName="Enabled"
+ description="Denotes whether or not result set caching is enabled. (default true)"
+ required="false" readOnly="false" type="boolean" />
+ <c:simple-property name="ResultSetCacheConfig.maxEntries"
+ displayName="Max Entries"
+ description="The maximum number of result set cache entries. -1 indicates no limit. (default 1024)"
+ required="false" readOnly="false" />
+ <c:simple-property name="ResultSetCacheConfig.maxAgeInSeconds"
+ displayName="Max Entry Age"
+ description="The maximum age of a result set cache entry in seconds. -1 indicates no max. (default 7200)"
+ required="false" readOnly="false" />
+ </c:group>
+
+ <c:group name="BufferService" displayName="Buffer Service Properties"
+ hiddenByDefault="false">
+ <c:simple-property name="BufferService.maxBufferSpace"
+ displayName="Max Buffer Space"
+ description="Max file storage space, in MB, to be used for buffer files (default 50G)"
+ required="false" readOnly="false" />
+ <c:simple-property name="BufferService.processorBatchSize"
+ displayName="Processor Batch Size"
+ description="The max row count of a batch sent internally within the query processor. Should be <= the connectorBatchSize. (default 512)"
+ required="false" readOnly="false" />
+ <c:simple-property name="BufferService.connectorBatchSize"
+ displayName="Connector Batch Size"
+ description="The max row count of a batch from a connector. Should be even multiple of processorBatchSize. (default 1024)"
+ required="false" readOnly="false" />
+ <c:simple-property name="BufferService.maxProcessingBatchesColumns"
+ displayName="Max Processing Batches Columns"
+ description="The number of batch columns guarenteed to a processing operation. Set this value lower if the workload typically processes larger numbers of concurrent queries with large intermediate results from operations such as sorting, grouping, etc. (default 128)"
+ required="false" readOnly="false" />
+ <c:simple-property name="BufferService.maxFileSize" displayName="Max File Size"
+ description="Max file size for buffer files (default 2GB)"
+ required="false" readOnly="false" />
+ <c:simple-property name="BufferService.maxReserveBatchColumns"
+ displayName="Max Reserve Batch Columns"
+ description="The number of batch columns to allow in memory (default 16384). This value should be set lower or higher depending on the available memory to Teiid in the VM. 16384 is considered a good default for a dedicated 32-bit VM running Teiid with a 1 gig heap."
+ required="false" readOnly="false" />
+ </c:group>
+ <c:group name="JdbcSocketConfiguration" displayName="Jdbc Socket Configuration Properties" hiddenByDefault="false">
+ <c:simple-property name="JdbcSocketConfiguration.enabled" displayName="Enable"
+ description="Enable Socket based JDBC access" required="false" readOnly="false" />
+ <c:simple-property name="JdbcSocketConfiguration.hostName" displayName="Host Name"
+ description="Host Name" required="false" readOnly="false" />
+ <c:simple-property name="JdbcSocketConfiguration.portNumber" displayName="Port Number"
+ description="Port Number" required="false" readOnly="false" />
+ <c:simple-property name="JdbcSocketConfiguration.sslEnabled" displayName="SSL Enabled"
+ description="SSL enabled" required="false" readOnly="true" type="boolean"
+ default="true" />
+ <c:simple-property name="JdbcSocketConfiguration.maxSocketThreads"
+ displayName="Max Socket Threads" description="Max NIO threads"
+ required="false" readOnly="false" />
+ <c:simple-property name="JdbcSocketConfiguration.inputBufferSize"
+ displayName="Input Buffer Size"
+ description="SO_RCVBUF size, 0 indicates that system default should be used (default 0)"
+ required="false" readOnly="false" />
+ <c:simple-property name="JdbcSocketConfiguration.outputBufferSize"
+ displayName="Output Buffer Size"
+ description="SO_SNDBUF size, 0 indicates that system default should be used (default 0)"
+ required="false" readOnly="false" />
+ </c:group>
+ <c:group name="SessionService" displayName="Session Service Properties"
+ hiddenByDefault="false">
+ <c:simple-property name="SessionService.sessionExpirationTimeLimit"
+ displayName="Session Expiration Time Limit"
+ description="Max allowed time before the session is terminated by the system, 0 indicates unlimited (default 0)"
+ required="false" readOnly="false" />
+ <c:simple-property name="SessionService.sessionMaxLimit"
+ displayName="Session Max Limit"
+ description="Maximum number of sessions allowed by the system (default 5000)"
+ required="false" readOnly="false" />
+ </c:group>
+ </resource-configuration>
+
+ <service name="Virtual Database (VDB)s" description="Teiid Data Services Virtual Databases"
+ class="VDBComponent" discovery="VDBDiscoveryComponent"
+ createDeletePolicy="both" creationDataType="content">
+
+ <operation name="getSessions" displayName="View VDB Sessions"
+ description="Get current sessions currently connected to this VDB">
+ <results>
+
+ <c:list-property name="list" displayName="Current VDB Sessions"
+ description="Sessions currently connected to this VDB" required="false">
+ <c:map-property name="map">
+ <c:simple-property displayName="Session ID"
+ name="getSessionId" type="string" description="The identifier for this session" />
+ <c:simple-property displayName="Application Name"
+ name="getApplicationName" type="string"
+ description="The application associated with Session" />
+ <c:simple-property displayName="Created Time"
+ name="getCreatedTime" type="string" description="When the session was created" />
+ <c:simple-property displayName="Client Host"
+ name="getClientHostName" type="string"
+ description="Host name from where the session created" />
+ <c:simple-property displayName="IP Address"
+ name="getIPAddress" type="string"
+ description="IP address from where this session was created" />
+ <c:simple-property displayName="Last ping time"
+ name="getLastPingTime" type="string" description="Last ping time" />
+ <c:simple-property displayName="User Name"
+ name="getUserName" type="string" description="User associated with this session" />
+ <c:simple-property displayName="Security Domain"
+ name="getSecurityDomain" type="string"
+ description="Security Domain that session logged into" />
+ </c:map-property>
+ </c:list-property>
+ </results>
+ </operation>
+
+ <operation name="getRequestsUsingVDB" displayName="View VDB requests"
+ description="Get current requests executing against this VDB">
+ <results>
+
+ <c:list-property name="list" displayName="Current Request"
+ description="Requests currently executing against the Teiid system"
+ required="false">
+ <c:map-property name="map">
+ <c:simple-property displayName="Request ID"
+ name="getRequestId" type="string" description="The request identifier" />
+ <c:simple-property displayName="Session ID"
+ name="getSessionId" type="string" description="Session identifier" />
+ <c:simple-property displayName="Execution ID"
+ name="getExecutionId" type="string" description="Unique Identifier for Request" />
+ <c:simple-property displayName="Created Time"
+ name="getCreatedTime" type="string" description="Time when request submitted" />
+ <c:simple-property displayName="Processing Time"
+ name="getProcessingTime" type="string" description="Processing time for the request" />
+ <c:simple-property displayName="Last ping time"
+ name="getCommand" type="string" description="SQL Command" />
+ <c:simple-property displayName="Connector level request?"
+ name="sourceRequest" type="string"
+ description="True if this is a connector level request" />
+ <c:simple-property displayName="Node ID" name="getNodeId"
+ type="string" description="The node identifier" />
+ <c:simple-property displayName="Tansaction identifier"
+ name="getTransactionId" type="string"
+ description="Transaction XID if a transaction is involved" />
+ </c:map-property>
+ </c:list-property>
+ </results>
+ </operation>
+
+ <operation name="getMaterializedViews" displayName="List Materialized View Info"
+ description="List any Materialized Views for this VDB">
+
+ <results>
+
+ <c:list-property name="list" displayName="Materialized Views"
+ description="List information related to Materialized Views, if any, for this VDB"
+ required="false">
+ <c:map-property name="map">
+ <c:simple-property displayName="Schema Name"
+ name="schemaName" type="string" description="Name of the schema that is materialized" />
+ <c:simple-property displayName="Name" name="name"
+ type="string" description="Name of the materialized table" />
+ <c:simple-property displayName="Target Schema Name"
+ name="targetSchemaName" type="string" description="Name of the materialized schema" />
+ <c:simple-property displayName="Target Name"
+ name="targetName" type="string" description="Name of target table" />
+ <c:simple-property displayName="Valid"
+ name="valid" type="string" description="Indicates if data in table is valid for use" />
+ <c:simple-property displayName="Current State"
+ name="loadState" type="string" description="Processing time for the request" />
+ <c:simple-property displayName="Last Updated"
+ name="updated" type="integer" description="Last time of data refresh" />
+ <c:simple-property displayName="Cardinality"
+ name="cardinality" type="integer" description="Row count" />
+ </c:map-property>
+ </c:list-property>
+ </results>
+ </operation>
+
+ <operation name="reloadMaterializedView" displayName="Refresh a Materialized View"
+ description="Refresh a given any Materialized View for this VDB">
+ <parameters>
+ <c:simple-property displayName="Materialized View Schema"
+ name="schema" type="string" required="true"
+ description="The schema name of the Materialized View to refresh" />
+ <c:simple-property displayName="Materialized View Name"
+ name="table" type="string" required="true"
+ description="The name of the Materialized View to refresh" />
+ <c:simple-property displayName="Invalidate Current Materialized View Table"
+ name="invalidate" type="boolean" required="true" default="false"
+ description="If yes, will block all queries against the current Materialized View table until data is refreshed." />
+ </parameters>
+
+ <results>
+ <c:simple-property displayName="Result" name="operationResult"
+ type="string" description="Result of refresh" />
+ </results>
+ </operation>
+
+ <metric displayName="Status" defaultOn="true" dataType="trait"
+ displayType="summary" category="availability" property="status"
+ description="The status of this VDB" />
+
+ <metric displayName="Errors" defaultOn="true" dataType="trait"
+ displayType="summary" category="availability" property="errorCount"
+ description="Whether or not errors exist for this VDB" />
+
+ <content name="vdb" displayName="VDB Archive" category="deployable"
+ isCreationType="true">
+ </content>
+
+ <resource-configuration>
+ <c:group name="general" displayName="General"
+ hiddenByDefault="false">
+ <c:simple-property name="name" type="string"
+ description="The Virtual Database Name" required="false" readOnly="true" />
+ <c:simple-property name="version" type="string"
+ description="The Virtual Database Version" required="false"
+ readOnly="true" />
+ <c:simple-property name="description" type="string"
+ description="The Virtual Database Description" required="false"
+ readOnly="true" />
+ <c:simple-property name="status" type="string"
+ description="The Virtual Database Status" required="false"
+ summary="true" readOnly="true">
+ <c:property-options>
+ <c:option value="ACTIVE" name="UP" />
+ <c:option value="INACTIVE" name="DOWN" default="true" />
+ </c:property-options>
+ </c:simple-property>
+ <c:simple-property name="connectionType" type="string"
+ description="Allowable Connections: 1) NONE - disallow new connections 2) BY VERSION - allow connections only if the version is specified or if this is the earliest 'BY VERSION' vdb and there are no vdbs marked as 'ANY'
+3) ANY - allow connections with or without a version specified. If multiple versions of same VDB are deployed, connect to one specified with ANY, or if there are multiple VDBs with ANY then connect to the latest version with ANY "
+ required="false">
+ <c:property-options>
+ <c:option value="NONE" name="NONE" />
+ <c:option value="BY_VERSION" name="BY VERSION" default="true" />
+ <c:option value="ANY" name="ANY" />
+ </c:property-options>
+ </c:simple-property>
+ <c:simple-property name="url" type="string"
+ description="The Virtual Database URL" required="false" readOnly="true" />
+ </c:group>
+ <c:group name="Translators" displayName="Translators"
+ hiddenByDefault="false">
+ <c:list-property name="translators" displayName="Overrides"
+ readOnly="true" description="The translator overrides for this VDB">
+ <c:map-property name="map"
+ description="Translator Overrides for this VDB">
+ <c:simple-property name="name" displayName="Name"
+ description="Name of this translator instance" required="false"
+ readOnly="true" />
+ <c:simple-property name="type" displayName="Translator type"
+ description="Translator type" required="false" readOnly="true" />
+ <c:simple-property name="propertyName"
+ displayName="Property Name" description="Property Name"
+ required="false" readOnly="true" />
+ <c:simple-property name="propertyValue"
+ displayName="Property Value" description="Property Value"
+ required="false" readOnly="true" />
+ </c:map-property>
+ </c:list-property>
+ </c:group>
+ <c:group name="Models" displayName="Models" hiddenByDefault="false">
+ <c:list-property name="singleSourceModels"
+ readOnly="true" description="The source models for this VDB">
+ <c:map-property name="map" description="Properties for this model">
+ <c:simple-property name="name" displayName="Name"
+ description="Name of the model" required="true" readOnly="true" />
+ <c:simple-property name="sourceName"
+ displayName="Source Name" description="Source name for this model"
+ required="false" readOnly="true" />
+ <c:simple-property name="translatorName"
+ displayName="Translator Name" description="Name of the translator"
+ required="false" readOnly="true" />
+ <c:simple-property name="jndiName" displayName="Connection JNDI Name"
+ description="JNDI name for this connection" required="false" />
+ <c:simple-property name="visibility"
+ displayName="Visible" description="Visibility of the model"
+ required="true" type="boolean" readOnly="true">
+ </c:simple-property>
+ <c:simple-property name="supportsMultiSource"
+ displayName="Supports Multi-source?"
+ description="Determines if this model supports multi-source bindings"
+ required="true" default="true" type="boolean" readOnly="true" />
+ </c:map-property>
+ </c:list-property>
+
+ <c:list-property name="multiSourceModels"
+ description="The multi-source model sources for this VDB">
+ <c:map-property name="map" readOnly="false">
+ <c:simple-property name="name" displayName="Name"
+ description="Name of the model" required="true" readOnly="true" />
+ <c:simple-property name="sourceName"
+ displayName="Source Name" description="Source name for this model"
+ readOnly="true" />
+ <c:simple-property name="translatorName"
+ displayName="Translator Name" description="Name of the translator"
+ required="true" />
+ <c:simple-property name="jndiName" displayName="Connection JNDI Name"
+ description="JNDI name for this connection" required="false" />
+ </c:map-property>
+ </c:list-property>
+
+ <c:list-property name="logicalModels" readOnly="true"
+ description="The logical models for this VDB">
+ <c:map-property name="map">
+ <c:simple-property name="name" displayName="Name"
+ description="Name of the model" required="true" readOnly="true" />
+ <c:simple-property name="type" displayName="Type"
+ description="type of logical model" required="true" readOnly="true" />
+ <c:simple-property name="visibility"
+ displayName="Visible" description="Visbility of the model"
+ required="true" default="true" readOnly="true" />
+ </c:map-property>
+ </c:list-property>
+ </c:group>
+ <c:group name="errors" displayName="Errors" hiddenByDefault="false">
+ <c:list-property name="errorList" description="VDB Errors"
+ summary="true" readOnly="true">
+ <c:map-property name="errorMap" summary="true">
+ <c:simple-property name="severity" displayName="Severity"
+ description="Severity" readOnly="true" summary="true" />
+ <c:simple-property name="message" displayName="Message"
+ description="Error message" readOnly="true" summary="true" />
+ </c:map-property>
+ </c:list-property>
+ </c:group>
+ </resource-configuration>
+
+ <service name="Data Roles" description="Data Roles for this VDB"
+ class="DataRoleComponent" discovery="DataRoleDiscoveryComponent">
+
+ <resource-configuration>
+ <c:simple-property name="name" displayName="Name"
+ description="Name of the data role" readOnly="true" required="false" />
+ <c:simple-property name="anyAuthenticated"
+ displayName="Any Authenticated" type="boolean"
+ description="Indicates if the role is mapped to any authenticated user"
+ readOnly="false" required="false" />
+ <c:simple-property name="description"
+ displayName="Description" type="string" description="Description of this data role"
+ readOnly="true" required="false" />
+ <c:list-property name="mappedRoleNameList"
+ readOnly="false" required="false" displayName="Mapped Role Names"
+ description="Mapped role names for this data role">
+ <c:map-property name="map" readOnly="false">
+ <c:simple-property name="name" displayName="Name"
+ description="Name of this mapped role" readOnly="true" />
+ </c:map-property>
+ </c:list-property>
+ </resource-configuration>
+
+ </service>
+
+ </service>
+
+ <service name="Translators" description="Teiid Translators"
+ class="TranslatorComponent" discovery="TranslatorDiscoveryComponent"
+ createDeletePolicy="both" creationDataType="configuration">
+
+ <resource-configuration>
+ <c:simple-property name="name" displayName="Name"
+ description="Name of the translator" readOnly="true" required="false" />
+ <c:simple-property name="description" displayName="Description"
+ description="Description the translator" readOnly="true" required="false" />
+
+ <c:list-property name="translatorList" readOnly="true"
+ required="false" displayName="Properties" description="Translator properties">
+ <c:map-property name="properties" readOnly="true">
+ <c:simple-property name="name" displayName="Name"
+ description="Name of this property" readOnly="true" />
+ <c:simple-property name="value" displayName="Value"
+ description="Value of this property" readOnly="true" />
+ </c:map-property>
+ </c:list-property>
+
+ </resource-configuration>
+
+ </service>
+
+ </server>
+
+</plugin>
\ No newline at end of file
Deleted: tags/teiid-parent-7.2.0.Final/documentation/admin-guide/pom.xml
===================================================================
--- branches/7.2.x/documentation/admin-guide/pom.xml 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/documentation/admin-guide/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -1,77 +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/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>documentation</artifactId>
- <version>7.2.0.Final-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>admin-guide</artifactId>
- <groupId>org.jboss.teiid.documentation</groupId>
- <packaging>jdocbook</packaging>
- <name>Admin Guide</name>
- <description>The Teiid Admin manual</description>
- <build>
- <plugins>
- <plugin>
- <groupId>org.jboss.maven.plugins</groupId>
- <artifactId>maven-jdocbook-plugin</artifactId>
- <version>2.1.2</version>
- <extensions>true</extensions>
- <dependencies>
- <dependency>
- <groupId>net.sf.docbook</groupId>
- <artifactId>docbook</artifactId>
- <version>1.74.0</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossorg-docbook-xslt</artifactId>
- <version>1.1.0</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossorg-jdocbook-style</artifactId>
- <version>1.1.0</version>
- <type>jdocbook-style</type>
- </dependency>
- </dependencies>
- <configuration>
- <sourceDocumentName>admin_guide.xml</sourceDocumentName>
- <imageResource>
- <directory>${basedir}/src/main/docbook/en-US</directory>
- <excludes>
- <exclude>*.xml</exclude>
- <exclude>**/*.xml</exclude>
- <exclude>*.zargo</exclude>
- <exclude>**/*.zargo</exclude>
- </excludes>
- </imageResource>
- <formats>
- <format>
- <formatName>pdf</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
- <finalName>teiid_admin_guide.pdf</finalName>
- </format>
- <format>
- <formatName>html_single</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- <format>
- <formatName>html</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- </formats>
- <options>
- <xincludeSupported>true</xincludeSupported>
- <xmlTransformerType>saxon</xmlTransformerType>
- <docbookVersion>1.72.0</docbookVersion>
- <localeSeparator>-</localeSeparator>
- <useRelativeImageUris>false</useRelativeImageUris>
- </options>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
Copied: tags/teiid-parent-7.2.0.Final/documentation/admin-guide/pom.xml (from rev 2708, branches/7.2.x/documentation/admin-guide/pom.xml)
===================================================================
--- tags/teiid-parent-7.2.0.Final/documentation/admin-guide/pom.xml (rev 0)
+++ tags/teiid-parent-7.2.0.Final/documentation/admin-guide/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -0,0 +1,77 @@
+<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/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>documentation</artifactId>
+ <version>7.2.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>admin-guide</artifactId>
+ <groupId>org.jboss.teiid.documentation</groupId>
+ <packaging>jdocbook</packaging>
+ <name>Admin Guide</name>
+ <description>The Teiid Admin manual</description>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ <version>2.1.2</version>
+ <extensions>true</extensions>
+ <dependencies>
+ <dependency>
+ <groupId>net.sf.docbook</groupId>
+ <artifactId>docbook</artifactId>
+ <version>1.74.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-docbook-xslt</artifactId>
+ <version>1.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-jdocbook-style</artifactId>
+ <version>1.1.0</version>
+ <type>jdocbook-style</type>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <sourceDocumentName>admin_guide.xml</sourceDocumentName>
+ <imageResource>
+ <directory>${basedir}/src/main/docbook/en-US</directory>
+ <excludes>
+ <exclude>*.xml</exclude>
+ <exclude>**/*.xml</exclude>
+ <exclude>*.zargo</exclude>
+ <exclude>**/*.zargo</exclude>
+ </excludes>
+ </imageResource>
+ <formats>
+ <format>
+ <formatName>pdf</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
+ <finalName>teiid_admin_guide.pdf</finalName>
+ </format>
+ <format>
+ <formatName>html_single</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>html</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ </formats>
+ <options>
+ <xincludeSupported>true</xincludeSupported>
+ <xmlTransformerType>saxon</xmlTransformerType>
+ <docbookVersion>1.72.0</docbookVersion>
+ <localeSeparator>-</localeSeparator>
+ <useRelativeImageUris>false</useRelativeImageUris>
+ </options>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Deleted: tags/teiid-parent-7.2.0.Final/documentation/admin-guide/src/main/docbook/en-US/content/appendix-a.xml
===================================================================
--- branches/7.2.x/documentation/admin-guide/src/main/docbook/en-US/content/appendix-a.xml 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/documentation/admin-guide/src/main/docbook/en-US/content/appendix-a.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -1,60 +0,0 @@
-<appendix id="faq">
- <title>AdminShell Frequently Asked Questions</title>
- <qandaset>
-
- <qandaentry>
- <question>
- <para>Why won't the adminhelp command work in the Console tool?</para>
- </question>
- <answer>
- <para>The Console environment does not understand Shell commands (load, help, adminhelp, etc.), since they are not directly supported by Groovy. In the Console you should use the equivalent functional form / Groovy, e.g. instead of adminhelp, adminHelp()</para>
- </answer>
- </qandaentry>
-
- <qandaentry>
- <question>
- <para>Are there any pre-built scripts available?</para>
- </question>
- <answer>
- <para>Currently no, but we will provide samples in subsequent releases.</para>
- </answer>
- </qandaentry>
-
- <qandaentry>
- <question>
- <para>I have written a very useful script to do XYZ, I would like this to be part of the distribution?</para>
- </question>
- <answer>
- <para>Yes, we would love to hear from users. Please submit the script through the <ulink url="https://jira.jboss.org/jira/browse/TEIID">Teiid JIRA</ulink>, and if this script popular, we will include the script in the scripts library in the following releases.</para>
- </answer>
- </qandaentry>
-
- <qandaentry>
- <question>
- <para>What is different between "connectAsAdmin()" and "connect()"?</para>
- </question>
- <answer>
- <para>The connectAsAdmin methods create a contextual connection to the AdminAPI of the Teiid Server. The connect methods return an extension of the Groovy Sql object to be used for Sql calls to the Teiid Server.</para>
- </answer>
- </qandaentry>
-
- <qandaentry>
- <question>
- <para>Is IDE support available for writing the scripts?</para>
- </question>
- <answer>
- <para>The Admin Console tool is a light-weight IDE. Full IDE support is available for Groovy, but requires manual manipulation of the class path and script imports. See <link linkend="other_environments">using AdminShell methods in other environments</link>.</para>
- </answer>
- </qandaentry>
-
- <qandaentry>
- <question>
- <para>Is debugging support available?</para>
- </question>
- <answer>
- <para>The interactive shell and console do have built-in support for inspection of the current state. Performing line based debugging is beyond the scope of this document.</para>
- </answer>
- </qandaentry>
-
- </qandaset>
-</appendix>
\ No newline at end of file
Copied: tags/teiid-parent-7.2.0.Final/documentation/admin-guide/src/main/docbook/en-US/content/appendix-a.xml (from rev 2707, branches/7.2.x/documentation/admin-guide/src/main/docbook/en-US/content/appendix-a.xml)
===================================================================
--- tags/teiid-parent-7.2.0.Final/documentation/admin-guide/src/main/docbook/en-US/content/appendix-a.xml (rev 0)
+++ tags/teiid-parent-7.2.0.Final/documentation/admin-guide/src/main/docbook/en-US/content/appendix-a.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -0,0 +1,71 @@
+<appendix id="faq">
+ <title>AdminShell Frequently Asked Questions</title>
+ <qandaset>
+
+ <qandaentry>
+ <question>
+ <para>Why won't the adminhelp command work in the Console tool?</para>
+ </question>
+ <answer>
+ <para>The Console environment does not understand Shell commands (load, help, adminhelp, etc.), since they are not directly supported by Groovy. In the Console you should use the equivalent functional form / Groovy, e.g. instead of adminhelp, adminHelp()</para>
+ </answer>
+ </qandaentry>
+
+ <qandaentry>
+ <question>
+ <para>Are there any pre-built scripts available?</para>
+ </question>
+ <answer>
+ <para>Currently no, but we will provide samples in subsequent releases.</para>
+ </answer>
+ </qandaentry>
+
+ <qandaentry>
+ <question>
+ <para>I have written a very useful script to do XYZ, I would like this to be part of the distribution?</para>
+ </question>
+ <answer>
+ <para>Yes, we would love to hear from users. Please submit the script through the <ulink url="https://jira.jboss.org/jira/browse/TEIID">Teiid JIRA</ulink>, and if this script popular, we will include the script in the scripts library in the following releases.</para>
+ </answer>
+ </qandaentry>
+
+ <qandaentry>
+ <question>
+ <para>What is different between "connectAsAdmin()" and "connect()"?</para>
+ </question>
+ <answer>
+ <para>The connectAsAdmin methods create a contextual connection to the AdminAPI of the Teiid Server. The connect methods return an extension of the Groovy Sql object to be used for Sql calls to the Teiid Server.</para>
+ </answer>
+ </qandaentry>
+
+ <qandaentry>
+ <question>
+ <para>What does "getAdmin()" call do? Why do I need it?</para>
+ </question>
+ <answer>
+ <para>"getAdmin()" returns this contextual connection object created when you executed "connectAsAdmin()" method.
+ This object implements the interface "org.teiid.adminapi.Admin" and AdminShell commands provided are
+ wrappers around this API. Advanced users can use this API directly if the provided wrapper commands do not meet their needs.</para>
+ </answer>
+ </qandaentry>
+
+ <qandaentry>
+ <question>
+ <para>Is IDE support available for writing the scripts?</para>
+ </question>
+ <answer>
+ <para>The Admin Console tool is a light-weight IDE. Full IDE support is available for Groovy, but requires manual manipulation of the class path and script imports. See <link linkend="other_environments">using AdminShell methods in other environments</link>.</para>
+ </answer>
+ </qandaentry>
+
+ <qandaentry>
+ <question>
+ <para>Is debugging support available?</para>
+ </question>
+ <answer>
+ <para>The interactive shell and console do have built-in support for inspection of the current state. Performing line based debugging is beyond the scope of this document.</para>
+ </answer>
+ </qandaentry>
+
+ </qandaset>
+</appendix>
\ No newline at end of file
Deleted: tags/teiid-parent-7.2.0.Final/documentation/caching-guide/pom.xml
===================================================================
--- branches/7.2.x/documentation/caching-guide/pom.xml 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/documentation/caching-guide/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -1,77 +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/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>documentation</artifactId>
- <version>7.2.0.Final-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>caching-guide</artifactId>
- <groupId>org.jboss.teiid.documentation</groupId>
- <packaging>jdocbook</packaging>
- <name>Teiid Caching Guide</name>
- <description>The Teiid Caching Guide</description>
- <build>
- <plugins>
- <plugin>
- <groupId>org.jboss.maven.plugins</groupId>
- <artifactId>maven-jdocbook-plugin</artifactId>
- <version>2.1.2</version>
- <extensions>true</extensions>
- <dependencies>
- <dependency>
- <groupId>net.sf.docbook</groupId>
- <artifactId>docbook</artifactId>
- <version>1.74.0</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossorg-docbook-xslt</artifactId>
- <version>1.1.0</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossorg-jdocbook-style</artifactId>
- <version>1.1.0</version>
- <type>jdocbook-style</type>
- </dependency>
- </dependencies>
- <configuration>
- <sourceDocumentName>main.xml</sourceDocumentName>
- <imageResource>
- <directory>${basedir}/src/main/docbook/en-US</directory>
- <excludes>
- <exclude>*.xml</exclude>
- <exclude>**/*.xml</exclude>
- <exclude>*.zargo</exclude>
- <exclude>**/*.zargo</exclude>
- </excludes>
- </imageResource>
- <formats>
- <format>
- <formatName>pdf</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
- <finalName>teiid_caching_guide.pdf</finalName>
- </format>
- <format>
- <formatName>html_single</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- <format>
- <formatName>html</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- </formats>
- <options>
- <xincludeSupported>true</xincludeSupported>
- <xmlTransformerType>saxon</xmlTransformerType>
- <docbookVersion>1.72.0</docbookVersion>
- <localeSeparator>-</localeSeparator>
- <useRelativeImageUris>false</useRelativeImageUris>
- </options>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.2.0.Final/documentation/caching-guide/pom.xml (from rev 2708, branches/7.2.x/documentation/caching-guide/pom.xml)
===================================================================
--- tags/teiid-parent-7.2.0.Final/documentation/caching-guide/pom.xml (rev 0)
+++ tags/teiid-parent-7.2.0.Final/documentation/caching-guide/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -0,0 +1,77 @@
+<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/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>documentation</artifactId>
+ <version>7.2.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>caching-guide</artifactId>
+ <groupId>org.jboss.teiid.documentation</groupId>
+ <packaging>jdocbook</packaging>
+ <name>Teiid Caching Guide</name>
+ <description>The Teiid Caching Guide</description>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ <version>2.1.2</version>
+ <extensions>true</extensions>
+ <dependencies>
+ <dependency>
+ <groupId>net.sf.docbook</groupId>
+ <artifactId>docbook</artifactId>
+ <version>1.74.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-docbook-xslt</artifactId>
+ <version>1.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-jdocbook-style</artifactId>
+ <version>1.1.0</version>
+ <type>jdocbook-style</type>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <sourceDocumentName>main.xml</sourceDocumentName>
+ <imageResource>
+ <directory>${basedir}/src/main/docbook/en-US</directory>
+ <excludes>
+ <exclude>*.xml</exclude>
+ <exclude>**/*.xml</exclude>
+ <exclude>*.zargo</exclude>
+ <exclude>**/*.zargo</exclude>
+ </excludes>
+ </imageResource>
+ <formats>
+ <format>
+ <formatName>pdf</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
+ <finalName>teiid_caching_guide.pdf</finalName>
+ </format>
+ <format>
+ <formatName>html_single</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>html</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ </formats>
+ <options>
+ <xincludeSupported>true</xincludeSupported>
+ <xmlTransformerType>saxon</xmlTransformerType>
+ <docbookVersion>1.72.0</docbookVersion>
+ <localeSeparator>-</localeSeparator>
+ <useRelativeImageUris>false</useRelativeImageUris>
+ </options>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.2.0.Final/documentation/client-developers-guide/pom.xml
===================================================================
--- branches/7.2.x/documentation/client-developers-guide/pom.xml 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/documentation/client-developers-guide/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -1,77 +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/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>documentation</artifactId>
- <version>7.2.0.Final-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>client-developers-guide</artifactId>
- <groupId>org.jboss.teiid.documentation</groupId>
- <packaging>jdocbook</packaging>
- <name>Teiid Client Developers Guide</name>
- <description>The Client Developers Guide</description>
- <build>
- <plugins>
- <plugin>
- <groupId>org.jboss.maven.plugins</groupId>
- <artifactId>maven-jdocbook-plugin</artifactId>
- <version>2.1.2</version>
- <extensions>true</extensions>
- <dependencies>
- <dependency>
- <groupId>net.sf.docbook</groupId>
- <artifactId>docbook</artifactId>
- <version>1.74.0</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossorg-docbook-xslt</artifactId>
- <version>1.1.0</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossorg-jdocbook-style</artifactId>
- <version>1.1.0</version>
- <type>jdocbook-style</type>
- </dependency>
- </dependencies>
- <configuration>
- <sourceDocumentName>main.xml</sourceDocumentName>
- <imageResource>
- <directory>${basedir}/src/main/docbook/en-US</directory>
- <excludes>
- <exclude>*.xml</exclude>
- <exclude>**/*.xml</exclude>
- <exclude>*.zargo</exclude>
- <exclude>**/*.zargo</exclude>
- </excludes>
- </imageResource>
- <formats>
- <format>
- <formatName>pdf</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
- <finalName>teiid_client_developers_guide.pdf</finalName>
- </format>
- <format>
- <formatName>html_single</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- <format>
- <formatName>html</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- </formats>
- <options>
- <xincludeSupported>true</xincludeSupported>
- <xmlTransformerType>saxon</xmlTransformerType>
- <docbookVersion>1.72.0</docbookVersion>
- <localeSeparator>-</localeSeparator>
- <useRelativeImageUris>false</useRelativeImageUris>
- </options>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.2.0.Final/documentation/client-developers-guide/pom.xml (from rev 2708, branches/7.2.x/documentation/client-developers-guide/pom.xml)
===================================================================
--- tags/teiid-parent-7.2.0.Final/documentation/client-developers-guide/pom.xml (rev 0)
+++ tags/teiid-parent-7.2.0.Final/documentation/client-developers-guide/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -0,0 +1,77 @@
+<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/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>documentation</artifactId>
+ <version>7.2.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>client-developers-guide</artifactId>
+ <groupId>org.jboss.teiid.documentation</groupId>
+ <packaging>jdocbook</packaging>
+ <name>Teiid Client Developers Guide</name>
+ <description>The Client Developers Guide</description>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ <version>2.1.2</version>
+ <extensions>true</extensions>
+ <dependencies>
+ <dependency>
+ <groupId>net.sf.docbook</groupId>
+ <artifactId>docbook</artifactId>
+ <version>1.74.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-docbook-xslt</artifactId>
+ <version>1.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-jdocbook-style</artifactId>
+ <version>1.1.0</version>
+ <type>jdocbook-style</type>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <sourceDocumentName>main.xml</sourceDocumentName>
+ <imageResource>
+ <directory>${basedir}/src/main/docbook/en-US</directory>
+ <excludes>
+ <exclude>*.xml</exclude>
+ <exclude>**/*.xml</exclude>
+ <exclude>*.zargo</exclude>
+ <exclude>**/*.zargo</exclude>
+ </excludes>
+ </imageResource>
+ <formats>
+ <format>
+ <formatName>pdf</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
+ <finalName>teiid_client_developers_guide.pdf</finalName>
+ </format>
+ <format>
+ <formatName>html_single</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>html</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ </formats>
+ <options>
+ <xincludeSupported>true</xincludeSupported>
+ <xmlTransformerType>saxon</xmlTransformerType>
+ <docbookVersion>1.72.0</docbookVersion>
+ <localeSeparator>-</localeSeparator>
+ <useRelativeImageUris>false</useRelativeImageUris>
+ </options>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.2.0.Final/documentation/developer-guide/pom.xml
===================================================================
--- branches/7.2.x/documentation/developer-guide/pom.xml 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/documentation/developer-guide/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -1,77 +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/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>documentation</artifactId>
- <version>7.2.0.Final-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>developer-guide</artifactId>
- <groupId>org.jboss.teiid.documentation</groupId>
- <packaging>jdocbook</packaging>
- <name>Developer's Guide</name>
- <description>The Teiid Developer's Guide</description>
- <build>
- <plugins>
- <plugin>
- <groupId>org.jboss.maven.plugins</groupId>
- <artifactId>maven-jdocbook-plugin</artifactId>
- <version>2.1.2</version>
- <extensions>true</extensions>
- <dependencies>
- <dependency>
- <groupId>net.sf.docbook</groupId>
- <artifactId>docbook</artifactId>
- <version>1.74.0</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossorg-docbook-xslt</artifactId>
- <version>1.1.0</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossorg-jdocbook-style</artifactId>
- <version>1.1.0</version>
- <type>jdocbook-style</type>
- </dependency>
- </dependencies>
- <configuration>
- <sourceDocumentName>Developer_Guide.xml</sourceDocumentName>
- <imageResource>
- <directory>${basedir}/src/main/docbook/en-US</directory>
- <excludes>
- <exclude>*.xml</exclude>
- <exclude>**/*.xml</exclude>
- <exclude>*.zargo</exclude>
- <exclude>**/*.zargo</exclude>
- </excludes>
- </imageResource>
- <formats>
- <format>
- <formatName>pdf</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
- <finalName>teiid_developer_guide.pdf</finalName>
- </format>
- <format>
- <formatName>html_single</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- <format>
- <formatName>html</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- </formats>
- <options>
- <xincludeSupported>true</xincludeSupported>
- <xmlTransformerType>saxon</xmlTransformerType>
- <docbookVersion>1.72.0</docbookVersion>
- <localeSeparator>-</localeSeparator>
- <useRelativeImageUris>false</useRelativeImageUris>
- </options>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
Copied: tags/teiid-parent-7.2.0.Final/documentation/developer-guide/pom.xml (from rev 2708, branches/7.2.x/documentation/developer-guide/pom.xml)
===================================================================
--- tags/teiid-parent-7.2.0.Final/documentation/developer-guide/pom.xml (rev 0)
+++ tags/teiid-parent-7.2.0.Final/documentation/developer-guide/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -0,0 +1,77 @@
+<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/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>documentation</artifactId>
+ <version>7.2.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>developer-guide</artifactId>
+ <groupId>org.jboss.teiid.documentation</groupId>
+ <packaging>jdocbook</packaging>
+ <name>Developer's Guide</name>
+ <description>The Teiid Developer's Guide</description>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ <version>2.1.2</version>
+ <extensions>true</extensions>
+ <dependencies>
+ <dependency>
+ <groupId>net.sf.docbook</groupId>
+ <artifactId>docbook</artifactId>
+ <version>1.74.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-docbook-xslt</artifactId>
+ <version>1.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-jdocbook-style</artifactId>
+ <version>1.1.0</version>
+ <type>jdocbook-style</type>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <sourceDocumentName>Developer_Guide.xml</sourceDocumentName>
+ <imageResource>
+ <directory>${basedir}/src/main/docbook/en-US</directory>
+ <excludes>
+ <exclude>*.xml</exclude>
+ <exclude>**/*.xml</exclude>
+ <exclude>*.zargo</exclude>
+ <exclude>**/*.zargo</exclude>
+ </excludes>
+ </imageResource>
+ <formats>
+ <format>
+ <formatName>pdf</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
+ <finalName>teiid_developer_guide.pdf</finalName>
+ </format>
+ <format>
+ <formatName>html_single</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>html</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ </formats>
+ <options>
+ <xincludeSupported>true</xincludeSupported>
+ <xmlTransformerType>saxon</xmlTransformerType>
+ <docbookVersion>1.72.0</docbookVersion>
+ <localeSeparator>-</localeSeparator>
+ <useRelativeImageUris>false</useRelativeImageUris>
+ </options>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Deleted: tags/teiid-parent-7.2.0.Final/documentation/pom.xml
===================================================================
--- branches/7.2.x/documentation/pom.xml 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/documentation/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -1,21 +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.2.0.Final-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>documentation</artifactId>
- <packaging>pom</packaging>
- <name>Documents</name>
- <description>Teiid Documentation Aggregator</description>
- <modules>
- <module>admin-guide</module>
- <module>reference</module>
- <module>developer-guide</module>
- <module>quick-start-example</module>
- <module>client-developers-guide</module>
- <module>caching-guide</module>
- </modules>
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.2.0.Final/documentation/pom.xml (from rev 2708, branches/7.2.x/documentation/pom.xml)
===================================================================
--- tags/teiid-parent-7.2.0.Final/documentation/pom.xml (rev 0)
+++ tags/teiid-parent-7.2.0.Final/documentation/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -0,0 +1,21 @@
+<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.2.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>documentation</artifactId>
+ <packaging>pom</packaging>
+ <name>Documents</name>
+ <description>Teiid Documentation Aggregator</description>
+ <modules>
+ <module>admin-guide</module>
+ <module>reference</module>
+ <module>developer-guide</module>
+ <module>quick-start-example</module>
+ <module>client-developers-guide</module>
+ <module>caching-guide</module>
+ </modules>
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.2.0.Final/documentation/quick-start-example/pom.xml
===================================================================
--- branches/7.2.x/documentation/quick-start-example/pom.xml 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/documentation/quick-start-example/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -1,77 +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/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>documentation</artifactId>
- <version>7.2.0.Final-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>quick-start-example</artifactId>
- <groupId>org.jboss.teiid.documentation</groupId>
- <packaging>jdocbook</packaging>
- <name>Quick Start Guide</name>
- <description>The Teiid Quick Start guide</description>
- <build>
- <plugins>
- <plugin>
- <groupId>org.jboss.maven.plugins</groupId>
- <artifactId>maven-jdocbook-plugin</artifactId>
- <version>2.1.2</version>
- <extensions>true</extensions>
- <dependencies>
- <dependency>
- <groupId>net.sf.docbook</groupId>
- <artifactId>docbook</artifactId>
- <version>1.74.0</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossorg-docbook-xslt</artifactId>
- <version>1.1.0</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossorg-jdocbook-style</artifactId>
- <version>1.1.0</version>
- <type>jdocbook-style</type>
- </dependency>
- </dependencies>
- <configuration>
- <sourceDocumentName>quick_start_example.xml</sourceDocumentName>
- <imageResource>
- <directory>${basedir}/src/main/docbook/en-US</directory>
- <excludes>
- <exclude>*.xml</exclude>
- <exclude>**/*.xml</exclude>
- <exclude>*.zargo</exclude>
- <exclude>**/*.zargo</exclude>
- </excludes>
- </imageResource>
- <formats>
- <format>
- <formatName>pdf</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
- <finalName>teiid_quick_start_example.pdf</finalName>
- </format>
- <format>
- <formatName>html_single</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- <format>
- <formatName>html</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- </formats>
- <options>
- <xincludeSupported>true</xincludeSupported>
- <xmlTransformerType>saxon</xmlTransformerType>
- <docbookVersion>1.72.0</docbookVersion>
- <localeSeparator>-</localeSeparator>
- <useRelativeImageUris>false</useRelativeImageUris>
- </options>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
Copied: tags/teiid-parent-7.2.0.Final/documentation/quick-start-example/pom.xml (from rev 2708, branches/7.2.x/documentation/quick-start-example/pom.xml)
===================================================================
--- tags/teiid-parent-7.2.0.Final/documentation/quick-start-example/pom.xml (rev 0)
+++ tags/teiid-parent-7.2.0.Final/documentation/quick-start-example/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -0,0 +1,77 @@
+<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/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>documentation</artifactId>
+ <version>7.2.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>quick-start-example</artifactId>
+ <groupId>org.jboss.teiid.documentation</groupId>
+ <packaging>jdocbook</packaging>
+ <name>Quick Start Guide</name>
+ <description>The Teiid Quick Start guide</description>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ <version>2.1.2</version>
+ <extensions>true</extensions>
+ <dependencies>
+ <dependency>
+ <groupId>net.sf.docbook</groupId>
+ <artifactId>docbook</artifactId>
+ <version>1.74.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-docbook-xslt</artifactId>
+ <version>1.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-jdocbook-style</artifactId>
+ <version>1.1.0</version>
+ <type>jdocbook-style</type>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <sourceDocumentName>quick_start_example.xml</sourceDocumentName>
+ <imageResource>
+ <directory>${basedir}/src/main/docbook/en-US</directory>
+ <excludes>
+ <exclude>*.xml</exclude>
+ <exclude>**/*.xml</exclude>
+ <exclude>*.zargo</exclude>
+ <exclude>**/*.zargo</exclude>
+ </excludes>
+ </imageResource>
+ <formats>
+ <format>
+ <formatName>pdf</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
+ <finalName>teiid_quick_start_example.pdf</finalName>
+ </format>
+ <format>
+ <formatName>html_single</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>html</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ </formats>
+ <options>
+ <xincludeSupported>true</xincludeSupported>
+ <xmlTransformerType>saxon</xmlTransformerType>
+ <docbookVersion>1.72.0</docbookVersion>
+ <localeSeparator>-</localeSeparator>
+ <useRelativeImageUris>false</useRelativeImageUris>
+ </options>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Deleted: tags/teiid-parent-7.2.0.Final/documentation/reference/pom.xml
===================================================================
--- branches/7.2.x/documentation/reference/pom.xml 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/documentation/reference/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -1,77 +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/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>documentation</artifactId>
- <version>7.2.0.Final-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>reference</artifactId>
- <groupId>org.jboss.teiid.documentation</groupId>
- <packaging>jdocbook</packaging>
- <name>Teiid Reference</name>
- <description>The Teiid reference manual</description>
- <build>
- <plugins>
- <plugin>
- <groupId>org.jboss.maven.plugins</groupId>
- <artifactId>maven-jdocbook-plugin</artifactId>
- <version>2.1.2</version>
- <extensions>true</extensions>
- <dependencies>
- <dependency>
- <groupId>net.sf.docbook</groupId>
- <artifactId>docbook</artifactId>
- <version>1.74.0</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossorg-docbook-xslt</artifactId>
- <version>1.1.0</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jbossorg-jdocbook-style</artifactId>
- <version>1.1.0</version>
- <type>jdocbook-style</type>
- </dependency>
- </dependencies>
- <configuration>
- <sourceDocumentName>Reference.xml</sourceDocumentName>
- <imageResource>
- <directory>${basedir}/src/main/docbook/en-US</directory>
- <excludes>
- <exclude>*.xml</exclude>
- <exclude>**/*.xml</exclude>
- <exclude>*.zargo</exclude>
- <exclude>**/*.zargo</exclude>
- </excludes>
- </imageResource>
- <formats>
- <format>
- <formatName>pdf</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
- <finalName>teiid_reference.pdf</finalName>
- </format>
- <format>
- <formatName>html_single</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- <format>
- <formatName>html</formatName>
- <stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
- <finalName>index.html</finalName>
- </format>
- </formats>
- <options>
- <xmlTransformerType>saxon</xmlTransformerType>
- <docbookVersion>1.72.0</docbookVersion>
- <xincludeSupported>true</xincludeSupported>
- <localeSeparator>-</localeSeparator>
- <useRelativeImageUris>false</useRelativeImageUris>
- </options>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.2.0.Final/documentation/reference/pom.xml (from rev 2708, branches/7.2.x/documentation/reference/pom.xml)
===================================================================
--- tags/teiid-parent-7.2.0.Final/documentation/reference/pom.xml (rev 0)
+++ tags/teiid-parent-7.2.0.Final/documentation/reference/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -0,0 +1,77 @@
+<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/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>documentation</artifactId>
+ <version>7.2.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>reference</artifactId>
+ <groupId>org.jboss.teiid.documentation</groupId>
+ <packaging>jdocbook</packaging>
+ <name>Teiid Reference</name>
+ <description>The Teiid reference manual</description>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ <version>2.1.2</version>
+ <extensions>true</extensions>
+ <dependencies>
+ <dependency>
+ <groupId>net.sf.docbook</groupId>
+ <artifactId>docbook</artifactId>
+ <version>1.74.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-docbook-xslt</artifactId>
+ <version>1.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-jdocbook-style</artifactId>
+ <version>1.1.0</version>
+ <type>jdocbook-style</type>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <sourceDocumentName>Reference.xml</sourceDocumentName>
+ <imageResource>
+ <directory>${basedir}/src/main/docbook/en-US</directory>
+ <excludes>
+ <exclude>*.xml</exclude>
+ <exclude>**/*.xml</exclude>
+ <exclude>*.zargo</exclude>
+ <exclude>**/*.zargo</exclude>
+ </excludes>
+ </imageResource>
+ <formats>
+ <format>
+ <formatName>pdf</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
+ <finalName>teiid_reference.pdf</finalName>
+ </format>
+ <format>
+ <formatName>html_single</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>html</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ </formats>
+ <options>
+ <xmlTransformerType>saxon</xmlTransformerType>
+ <docbookVersion>1.72.0</docbookVersion>
+ <xincludeSupported>true</xincludeSupported>
+ <localeSeparator>-</localeSeparator>
+ <useRelativeImageUris>false</useRelativeImageUris>
+ </options>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.2.0.Final/engine/pom.xml
===================================================================
--- branches/7.2.x/engine/pom.xml 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/engine/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -1,97 +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.2.0.Final-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>teiid-engine</artifactId>
- <name>Engine</name>
- <description>Relational, procedural, and xml core engine.</description>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>javacc-maven-plugin</artifactId>
- <version>2.4</version>
- <executions>
- <execution>
- <id>javacc</id>
- <goals>
- <goal>javacc</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
-
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <type>test-jar</type>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-api</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-client</artifactId>
- <type>test-jar</type>
- </dependency>
-
- <dependency>
- <groupId>javax.resource</groupId>
- <artifactId>connector-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>javax.transaction</groupId>
- <artifactId>jta</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-vfs-spi</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-vfs</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>net.sourceforge.saxon</groupId>
- <artifactId>saxon</artifactId>
- </dependency>
-
- <dependency>
- <groupId>net.sourceforge.saxon</groupId>
- <classifier>dom</classifier>
- <artifactId>saxon</artifactId>
- </dependency>
-
- <dependency>
- <groupId>com.googlecode.json-simple</groupId>
- <artifactId>json-simple</artifactId>
- </dependency>
-
- </dependencies>
-
-</project>
\ No newline at end of file
Copied: tags/teiid-parent-7.2.0.Final/engine/pom.xml (from rev 2708, branches/7.2.x/engine/pom.xml)
===================================================================
--- tags/teiid-parent-7.2.0.Final/engine/pom.xml (rev 0)
+++ tags/teiid-parent-7.2.0.Final/engine/pom.xml 2010-11-05 03:19:55 UTC (rev 2709)
@@ -0,0 +1,97 @@
+<?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.2.0.Final</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>teiid-engine</artifactId>
+ <name>Engine</name>
+ <description>Relational, procedural, and xml core engine.</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>javacc-maven-plugin</artifactId>
+ <version>2.4</version>
+ <executions>
+ <execution>
+ <id>javacc</id>
+ <goals>
+ <goal>javacc</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <type>test-jar</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-api</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-client</artifactId>
+ <type>test-jar</type>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs-spi</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>net.sourceforge.saxon</groupId>
+ <artifactId>saxon</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>net.sourceforge.saxon</groupId>
+ <classifier>dom</classifier>
+ <artifactId>saxon</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.googlecode.json-simple</groupId>
+ <artifactId>json-simple</artifactId>
+ </dependency>
+
+ </dependencies>
+
+</project>
\ No newline at end of file
Deleted: tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/cache/CacheConfiguration.java
===================================================================
--- branches/7.2.x/engine/src/main/java/org/teiid/cache/CacheConfiguration.java 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/cache/CacheConfiguration.java 2010-11-05 03:19:55 UTC (rev 2709)
@@ -1,110 +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.cache;
-
-public class CacheConfiguration {
-
- public static CacheConfiguration DEFAULT = new CacheConfiguration(Policy.LRU, 60*60, 100); // 1 hours with 100 nodes.
-
- public enum Policy {
- LRU, // Least Recently Used
- EXPIRATION
- }
-
- private Policy policy;
- private int maxage;
- private int maxEntries;
- private boolean enabled = true;
-
- public CacheConfiguration() {
- }
-
- public CacheConfiguration(Policy policy, int maxAgeInSeconds, int maxNodes) {
- this.policy = policy;
- this.maxage = maxAgeInSeconds;
- this.maxEntries = maxNodes;
- }
-
- public Policy getPolicy() {
- return this.policy;
- }
-
- public int getMaxAgeInSeconds(){
- return maxage;
- }
-
- public void setMaxAgeInSeconds(int maxage){
- this.maxage = maxage;
- }
-
- public int getMaxEntries() {
- return this.maxEntries;
- }
-
- public void setMaxEntries(int entries) {
- this.maxEntries = entries;
- }
-
- public void setType (String type) {
- this.policy = Policy.valueOf(type);
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + maxage;
- result = prime * result + maxEntries;
- result = prime * result + ((policy == null) ? 0 : policy.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- CacheConfiguration other = (CacheConfiguration) obj;
- if (maxage != other.maxage)
- return false;
- if (maxEntries != other.maxEntries)
- return false;
- if (policy == null) {
- if (other.policy != null)
- return false;
- } else if (!policy.equals(other.policy))
- return false;
- return true;
- }
-
- public boolean isEnabled() {
- return enabled;
- }
-
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- }
-}
Copied: tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/cache/CacheConfiguration.java (from rev 2707, branches/7.2.x/engine/src/main/java/org/teiid/cache/CacheConfiguration.java)
===================================================================
--- tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/cache/CacheConfiguration.java (rev 0)
+++ tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/cache/CacheConfiguration.java 2010-11-05 03:19:55 UTC (rev 2709)
@@ -0,0 +1,130 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.cache;
+
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementProperties;
+import org.jboss.managed.api.annotation.ManagementProperty;
+
+@ManagementObject(componentType=@ManagementComponent(type="teiid",subtype="dqp"), properties=ManagementProperties.EXPLICIT)
+public class CacheConfiguration {
+
+ public static CacheConfiguration DEFAULT = new CacheConfiguration(Policy.LRU, 60*60, 100); // 1 hours with 100 nodes.
+
+ public enum Policy {
+ LRU, // Least Recently Used
+ EXPIRATION
+ }
+
+ private Policy policy;
+ private int maxage;
+ private int maxEntries;
+ private boolean enabled = true;
+ private String name;
+
+ public CacheConfiguration() {
+ }
+
+ public CacheConfiguration(Policy policy, int maxAgeInSeconds, int maxNodes) {
+ this.policy = policy;
+ this.maxage = maxAgeInSeconds;
+ this.maxEntries = maxNodes;
+ }
+
+ public Policy getPolicy() {
+ return this.policy;
+ }
+
+ @ManagementProperty(description="The maximum age of a result set cache entry in seconds. -1 indicates no max. (default 7200)")
+ public int getMaxAgeInSeconds(){
+ return maxage;
+ }
+
+ public void setMaxAgeInSeconds(int maxage){
+ this.maxage = maxage;
+ }
+
+ @ManagementProperty(description="The maximum number of result set cache entries. -1 indicates no limit. (default 1024)")
+ public int getMaxEntries() {
+ return this.maxEntries;
+ }
+
+ public void setMaxEntries(int entries) {
+ this.maxEntries = entries;
+ }
+
+ public void setType (String type) {
+ this.policy = Policy.valueOf(type);
+ }
+
+ @ManagementProperty(description="Name of the configuration", readOnly=true)
+ @ManagementObjectID(type="cache")
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + maxage;
+ result = prime * result + maxEntries;
+ result = prime * result + ((policy == null) ? 0 : policy.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ CacheConfiguration other = (CacheConfiguration) obj;
+ if (maxage != other.maxage)
+ return false;
+ if (maxEntries != other.maxEntries)
+ return false;
+ if (policy == null) {
+ if (other.policy != null)
+ return false;
+ } else if (!policy.equals(other.policy))
+ return false;
+ return true;
+ }
+
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ }
+}
Deleted: tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java
===================================================================
--- branches/7.2.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java 2010-11-05 03:19:55 UTC (rev 2709)
@@ -1,187 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.dqp.internal.process;
-
-import org.jboss.managed.api.annotation.ManagementProperty;
-import org.teiid.cache.CacheConfiguration;
-import org.teiid.client.RequestMessage;
-import org.teiid.core.util.ApplicationInfo;
-
-
-public class DQPConfiguration{
-
- //Constants
- static final int DEFAULT_FETCH_SIZE = RequestMessage.DEFAULT_FETCH_SIZE * 10;
- static final int DEFAULT_PROCESSOR_TIMESLICE = 2000;
- static final int DEFAULT_MAX_RESULTSET_CACHE_ENTRIES = 1024;
- static final int DEFAULT_QUERY_THRESHOLD = 600;
- static final String PROCESS_PLAN_QUEUE_NAME = "QueryProcessorQueue"; //$NON-NLS-1$
- public static final int DEFAULT_MAX_PROCESS_WORKERS = 64;
- public static final int DEFAULT_MAX_SOURCE_ROWS = -1;
- public static final int DEFAULT_MAX_ACTIVE_PLANS = 20;
-
- private int maxThreads = DEFAULT_MAX_PROCESS_WORKERS;
- private int timeSliceInMilli = DEFAULT_PROCESSOR_TIMESLICE;
- private int maxRowsFetchSize = DEFAULT_FETCH_SIZE;
- private int lobChunkSizeInKB = 100;
- private int preparedPlanCacheMaxCount = SessionAwareCache.DEFAULT_MAX_SIZE_TOTAL;
- private boolean useDataRoles = false;
- private int queryThresholdInSecs = DEFAULT_QUERY_THRESHOLD;
- private boolean exceptionOnMaxSourceRows = true;
- private int maxSourceRows = -1;
- private int maxActivePlans = DEFAULT_MAX_ACTIVE_PLANS;
- private CacheConfiguration resultsetCacheConfig;
-
- @ManagementProperty(description="Max active plans (default 20). Increase this value, and max threads, on highly concurrent systems - but ensure that the underlying pools can handle the increased load without timeouts.")
- public int getMaxActivePlans() {
- return maxActivePlans;
- }
-
- public void setMaxActivePlans(int maxActivePlans) {
- this.maxActivePlans = maxActivePlans;
- }
-
- @ManagementProperty(description="Process pool maximum thread count. (default 64)")
- public int getMaxThreads() {
- return maxThreads;
- }
-
- public void setMaxThreads(int maxThreads) {
- this.maxThreads = maxThreads;
- }
-
- @ManagementProperty(description="Query processor time slice, in milliseconds. (default 2000)")
- public int getTimeSliceInMilli() {
- return timeSliceInMilli;
- }
-
- public void setTimeSliceInMilli(int timeSliceInMilli) {
- this.timeSliceInMilli = timeSliceInMilli;
- }
-
- @ManagementProperty(description="Maximum allowed fetch size, set via JDBC. User requested value ignored above this value. (default 20480)")
- public int getMaxRowsFetchSize() {
- return maxRowsFetchSize;
- }
-
- public void setMaxRowsFetchSize(int maxRowsFetchSize) {
- this.maxRowsFetchSize = maxRowsFetchSize;
- }
-
- @ManagementProperty(description="The max lob chunk size in KB transferred to the client for xml, blobs, clobs (default 100KB)")
- public int getLobChunkSizeInKB() {
- return this.lobChunkSizeInKB;
- }
-
- public void setLobChunkSizeInKB(int lobChunkSizeInKB) {
- this.lobChunkSizeInKB = lobChunkSizeInKB;
- }
-
- @ManagementProperty(description="The maximum number of query plans that are cached. Note: this is a memory based cache. (default 250)")
- public int getPreparedPlanCacheMaxCount() {
- return this.preparedPlanCacheMaxCount;
- }
-
- public void setPreparedPlanCacheMaxCount(int preparedPlanCacheMaxCount) {
- this.preparedPlanCacheMaxCount = preparedPlanCacheMaxCount;
- }
-
- @ManagementProperty(description="The maximum number of result set cache entries. -1 indicates no limit. (default 1024)")
- public int getResultSetCacheMaxEntries() {
- return this.resultsetCacheConfig.getMaxEntries();
- }
-
- public CacheConfiguration getResultsetCacheConfig() {
- return this.resultsetCacheConfig;
- }
-
- public void setResultsetCacheConfig(CacheConfiguration config) {
- this.resultsetCacheConfig = config;
- }
-
- @ManagementProperty(description="Denotes whether or not result set caching is enabled. (default true)")
- public boolean isResultSetCacheEnabled() {
- return this.resultsetCacheConfig.isEnabled();
- }
-
- @ManagementProperty(description="The maximum age of a result set cache entry in seconds. -1 indicates no max. (default 7200)")
- public int getResultSetCacheMaxEntryAge() {
- return this.resultsetCacheConfig.getMaxAgeInSeconds();
- }
-
- public void setResultSetCacheMaxEntryAge(int maxAge) {
- this.resultsetCacheConfig.setMaxAgeInSeconds(maxAge);
- }
-
- /**
- * Determine whether role checking is enabled on the server.
- * @return <code>true</code> if server-side role checking is enabled.
- */
- @ManagementProperty(description="Turn on role checking on resources based on the roles defined in VDB")
- public boolean useDataRoles() {
- return useDataRoles;
- }
-
- public void setUseDataRoles(Boolean useEntitlements) {
- this.useDataRoles = useEntitlements.booleanValue();
- }
-
- @ManagementProperty(description="Long running query threshold, after which a alert can be generated by tooling if configured")
- public int getQueryThresholdInSecs() {
- return queryThresholdInSecs;
- }
-
- public void setQueryThresholdInSecs(int queryThresholdInSecs) {
- this.queryThresholdInSecs = queryThresholdInSecs;
- }
-
- @ManagementProperty(description="Teiid runtime version", readOnly=true)
- public String getRuntimeVersion() {
- return ApplicationInfo.getInstance().getBuildNumber();
- }
-
- /**
- * Throw exception if there are more rows in the result set than specified in the MaxSourceRows setting.
- * @return
- */
- @ManagementProperty(description="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.")
- public boolean isExceptionOnMaxSourceRows() {
- return exceptionOnMaxSourceRows;
- }
-
- public void setExceptionOnMaxSourceRows(boolean exceptionOnMaxSourceRows) {
- this.exceptionOnMaxSourceRows = exceptionOnMaxSourceRows;
- }
-
- /**
- * Maximum source set rows to fetch
- * @return
- */
- @ManagementProperty(description="Maximum rows allowed from a source query. -1 indicates no limit. (default -1)")
- public int getMaxSourceRows() {
- return maxSourceRows;
- }
-
- public void setMaxSourceRows(int maxSourceRows) {
- this.maxSourceRows = maxSourceRows;
- }
-}
Copied: tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java (from rev 2707, branches/7.2.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java)
===================================================================
--- tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java (rev 0)
+++ tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/DQPConfiguration.java 2010-11-05 03:19:55 UTC (rev 2709)
@@ -0,0 +1,173 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.dqp.internal.process;
+
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.teiid.cache.CacheConfiguration;
+import org.teiid.client.RequestMessage;
+import org.teiid.core.util.ApplicationInfo;
+
+
+public class DQPConfiguration{
+
+ //Constants
+ static final int DEFAULT_FETCH_SIZE = RequestMessage.DEFAULT_FETCH_SIZE * 10;
+ static final int DEFAULT_PROCESSOR_TIMESLICE = 2000;
+ static final int DEFAULT_MAX_RESULTSET_CACHE_ENTRIES = 1024;
+ static final int DEFAULT_QUERY_THRESHOLD = 600;
+ static final String PROCESS_PLAN_QUEUE_NAME = "QueryProcessorQueue"; //$NON-NLS-1$
+ public static final int DEFAULT_MAX_PROCESS_WORKERS = 64;
+ public static final int DEFAULT_MAX_SOURCE_ROWS = -1;
+ public static final int DEFAULT_MAX_ACTIVE_PLANS = 20;
+
+ private int maxThreads = DEFAULT_MAX_PROCESS_WORKERS;
+ private int timeSliceInMilli = DEFAULT_PROCESSOR_TIMESLICE;
+ private int maxRowsFetchSize = DEFAULT_FETCH_SIZE;
+ private int lobChunkSizeInKB = 100;
+ private int preparedPlanCacheMaxCount = SessionAwareCache.DEFAULT_MAX_SIZE_TOTAL;
+ private boolean useDataRoles = false;
+ private int queryThresholdInSecs = DEFAULT_QUERY_THRESHOLD;
+ private boolean exceptionOnMaxSourceRows = true;
+ private int maxSourceRows = -1;
+ private int maxActivePlans = DEFAULT_MAX_ACTIVE_PLANS;
+ private CacheConfiguration resultsetCacheConfig;
+
+ @ManagementProperty(description="Max active plans (default 20). Increase this value, and max threads, on highly concurrent systems - but ensure that the underlying pools can handle the increased load without timeouts.")
+ public int getMaxActivePlans() {
+ return maxActivePlans;
+ }
+
+ public void setMaxActivePlans(int maxActivePlans) {
+ this.maxActivePlans = maxActivePlans;
+ }
+
+ @ManagementProperty(description="Process pool maximum thread count. (default 64)")
+ public int getMaxThreads() {
+ return maxThreads;
+ }
+
+ public void setMaxThreads(int maxThreads) {
+ this.maxThreads = maxThreads;
+ }
+
+ @ManagementProperty(description="Query processor time slice, in milliseconds. (default 2000)")
+ public int getTimeSliceInMilli() {
+ return timeSliceInMilli;
+ }
+
+ public void setTimeSliceInMilli(int timeSliceInMilli) {
+ this.timeSliceInMilli = timeSliceInMilli;
+ }
+
+ @ManagementProperty(description="Maximum allowed fetch size, set via JDBC. User requested value ignored above this value. (default 20480)")
+ public int getMaxRowsFetchSize() {
+ return maxRowsFetchSize;
+ }
+
+ public void setMaxRowsFetchSize(int maxRowsFetchSize) {
+ this.maxRowsFetchSize = maxRowsFetchSize;
+ }
+
+ @ManagementProperty(description="The max lob chunk size in KB transferred to the client for xml, blobs, clobs (default 100KB)")
+ public int getLobChunkSizeInKB() {
+ return this.lobChunkSizeInKB;
+ }
+
+ public void setLobChunkSizeInKB(int lobChunkSizeInKB) {
+ this.lobChunkSizeInKB = lobChunkSizeInKB;
+ }
+
+ @ManagementProperty(description="The maximum number of query plans that are cached. Note: this is a memory based cache. (default 250)")
+ public int getPreparedPlanCacheMaxCount() {
+ return this.preparedPlanCacheMaxCount;
+ }
+
+ public void setPreparedPlanCacheMaxCount(int preparedPlanCacheMaxCount) {
+ this.preparedPlanCacheMaxCount = preparedPlanCacheMaxCount;
+ }
+
+ public CacheConfiguration getResultsetCacheConfig() {
+ return this.resultsetCacheConfig;
+ }
+
+ public void setResultsetCacheConfig(CacheConfiguration config) {
+ this.resultsetCacheConfig = config;
+ }
+
+ @ManagementProperty(description="Denotes whether or not result set caching is enabled. (default true)")
+ public boolean isResultSetCacheEnabled() {
+ return this.resultsetCacheConfig != null && this.resultsetCacheConfig.isEnabled();
+ }
+
+ /**
+ * Determine whether role checking is enabled on the server.
+ * @return <code>true</code> if server-side role checking is enabled.
+ */
+ @ManagementProperty(description="Turn on role checking on resources based on the roles defined in VDB")
+ public boolean getUseDataRoles() {
+ return useDataRoles;
+ }
+
+ public void setUseDataRoles(boolean useEntitlements) {
+ this.useDataRoles = useEntitlements;
+ }
+
+ @ManagementProperty(description="Long running query threshold, after which a alert can be generated by tooling if configured")
+ public int getQueryThresholdInSecs() {
+ return queryThresholdInSecs;
+ }
+
+ public void setQueryThresholdInSecs(int queryThresholdInSecs) {
+ this.queryThresholdInSecs = queryThresholdInSecs;
+ }
+
+ @ManagementProperty(description="Teiid runtime version", readOnly=true)
+ public String getRuntimeVersion() {
+ return ApplicationInfo.getInstance().getBuildNumber();
+ }
+
+ /**
+ * Throw exception if there are more rows in the result set than specified in the MaxSourceRows setting.
+ * @return
+ */
+ @ManagementProperty(description="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.")
+ public boolean isExceptionOnMaxSourceRows() {
+ return exceptionOnMaxSourceRows;
+ }
+
+ public void setExceptionOnMaxSourceRows(boolean exceptionOnMaxSourceRows) {
+ this.exceptionOnMaxSourceRows = exceptionOnMaxSourceRows;
+ }
+
+ /**
+ * Maximum source set rows to fetch
+ * @return
+ */
+ @ManagementProperty(description="Maximum rows allowed from a source query. -1 indicates no limit. (default -1)")
+ public int getMaxSourceRows() {
+ return maxSourceRows;
+ }
+
+ public void setMaxSourceRows(int maxSourceRows) {
+ this.maxSourceRows = maxSourceRows;
+ }
+}
Deleted: tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- branches/7.2.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-11-05 03:19:55 UTC (rev 2709)
@@ -1,867 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.dqp.internal.process;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.TimeUnit;
-
-import javax.resource.spi.work.Work;
-import javax.resource.spi.work.WorkEvent;
-import javax.resource.spi.work.WorkListener;
-import javax.transaction.xa.Xid;
-
-import org.teiid.adminapi.Admin;
-import org.teiid.adminapi.AdminException;
-import org.teiid.adminapi.Request.ProcessingState;
-import org.teiid.adminapi.Request.ThreadState;
-import org.teiid.adminapi.impl.CacheStatisticsMetadata;
-import org.teiid.adminapi.impl.RequestMetadata;
-import org.teiid.adminapi.impl.WorkerPoolStatisticsMetadata;
-import org.teiid.cache.Cache;
-import org.teiid.cache.CacheConfiguration;
-import org.teiid.cache.CacheFactory;
-import org.teiid.cache.CacheConfiguration.Policy;
-import org.teiid.client.DQP;
-import org.teiid.client.RequestMessage;
-import org.teiid.client.ResultsMessage;
-import org.teiid.client.lob.LobChunk;
-import org.teiid.client.metadata.MetadataResult;
-import org.teiid.client.util.ResultsFuture;
-import org.teiid.client.util.ResultsReceiver;
-import org.teiid.client.xa.XATransactionException;
-import org.teiid.client.xa.XidImpl;
-import org.teiid.common.buffer.BufferManager;
-import org.teiid.core.TeiidComponentException;
-import org.teiid.core.TeiidProcessingException;
-import org.teiid.core.types.Streamable;
-import org.teiid.dqp.internal.process.ThreadReuseExecutor.PrioritizedRunnable;
-import org.teiid.dqp.message.AtomicRequestMessage;
-import org.teiid.dqp.message.RequestID;
-import org.teiid.dqp.service.BufferService;
-import org.teiid.dqp.service.TransactionContext;
-import org.teiid.dqp.service.TransactionService;
-import org.teiid.dqp.service.TransactionContext.Scope;
-import org.teiid.logging.CommandLogMessage;
-import org.teiid.logging.LogConstants;
-import org.teiid.logging.LogManager;
-import org.teiid.logging.MessageLevel;
-import org.teiid.logging.CommandLogMessage.Event;
-import org.teiid.query.QueryPlugin;
-import org.teiid.query.processor.ProcessorDataManager;
-import org.teiid.query.tempdata.TempTableDataManager;
-import org.teiid.query.tempdata.TempTableStore;
-
-
-/**
- * Implements the core DQP processing.
- */
-public class DQPCore implements DQP {
-
- //TODO: replace with FutureTask
- public final static class FutureWork<T> implements Work, WorkListener, PrioritizedRunnable {
- private final Callable<T> toCall;
- private ResultsFuture<T> result = new ResultsFuture<T>();
- private ResultsReceiver<T> receiver = result.getResultsReceiver();
- private int priority;
- private long creationTime = System.currentTimeMillis();
- private DQPWorkContext workContext = DQPWorkContext.getWorkContext();
-
- public FutureWork(Callable<T> processor, int priority) {
- this.toCall = processor;
- this.priority = priority;
- }
-
- public ResultsFuture<T> getResult() {
- return result;
- }
-
- @Override
- public void run() {
- try {
- receiver.receiveResults(toCall.call());
- } catch (Throwable t) {
- receiver.exceptionOccurred(t);
- }
- }
-
- @Override
- public void release() {
-
- }
-
- @Override
- public void workAccepted(WorkEvent arg0) {
-
- }
-
- @Override
- public void workCompleted(WorkEvent arg0) {
-
- }
-
- @Override
- public void workRejected(WorkEvent arg0) {
- receiver.exceptionOccurred(arg0.getException());
- }
-
- @Override
- public void workStarted(WorkEvent arg0) {
-
- }
-
- @Override
- public int getPriority() {
- return priority;
- }
-
- @Override
- public long getCreationTime() {
- return creationTime;
- }
-
- @Override
- public DQPWorkContext getDqpWorkContext() {
- return workContext;
- }
- }
-
- static class ClientState {
- List<RequestID> requests;
- TempTableStore sessionTables;
-
- public ClientState(TempTableStore tableStoreImpl) {
- this.sessionTables = tableStoreImpl;
- }
-
- public synchronized void addRequest(RequestID requestID) {
- if (requests == null) {
- requests = new LinkedList<RequestID>();
- }
- requests.add(requestID);
- }
-
- public synchronized List<RequestID> getRequests() {
- if (requests == null) {
- return Collections.emptyList();
- }
- return new ArrayList<RequestID>(requests);
- }
-
- public synchronized void removeRequest(RequestID requestID) {
- if (requests != null) {
- requests.remove(requestID);
- }
- }
-
- }
-
- private ThreadReuseExecutor processWorkerPool;
-
- private int maxFetchSize = DQPConfiguration.DEFAULT_FETCH_SIZE;
- private int queryThreshold = DQPConfiguration.DEFAULT_QUERY_THRESHOLD;
-
- // Resources
- private BufferManager bufferManager;
- private ProcessorDataManager dataTierMgr;
- private SessionAwareCache<PreparedPlan> prepPlanCache;
- private SessionAwareCache<CachedResults> rsCache;
- private TransactionService transactionService;
- private BufferService bufferService;
-
- // Query worker pool for processing plans
- private int processorTimeslice = DQPConfiguration.DEFAULT_PROCESSOR_TIMESLICE;
-
- private int maxSourceRows = DQPConfiguration.DEFAULT_MAX_SOURCE_ROWS;
- private boolean exceptionOnMaxSourceRows = true;
-
- private int chunkSize = Streamable.STREAMING_BATCH_SIZE_IN_BYTES;
-
- private Map<RequestID, RequestWorkItem> requests = new ConcurrentHashMap<RequestID, RequestWorkItem>();
- private Map<String, ClientState> clientState = new ConcurrentHashMap<String, ClientState>();
- private boolean useEntitlements = false;
-
- private int maxActivePlans = DQPConfiguration.DEFAULT_MAX_ACTIVE_PLANS;
- private int currentlyActivePlans;
- private LinkedList<RequestWorkItem> waitingPlans = new LinkedList<RequestWorkItem>();
- private CacheFactory cacheFactory;
-
- private SessionAwareCache<CachedResults> matTables;
-
- /**
- * perform a full shutdown and wait for 10 seconds for all threads to finish
- */
- public void stop() {
- processWorkerPool.shutdownNow();
- try {
- processWorkerPool.awaitTermination(10, TimeUnit.SECONDS);
- } catch (InterruptedException e) {
- }
- // TODO: Should we be doing more cleanup here??
- LogManager.logDetail(LogConstants.CTX_DQP, "Stopping the DQP"); //$NON-NLS-1$
- }
-
- /**
- * Return a list of {@link RequestMetadata} for the given session
- */
- public List<RequestMetadata> getRequestsForSession(String sessionId) {
- ClientState state = getClientState(sessionId, false);
- if (state == null) {
- return Collections.emptyList();
- }
- return buildRequestInfos(state.getRequests(), -1);
- }
-
- public ClientState getClientState(String key, boolean create) {
- if (key == null) {
- return null;
- }
- ClientState state = clientState.get(key);
- if (state == null && create) {
- state = new ClientState(new TempTableStore(key));
- clientState.put(key, state);
- }
- return state;
- }
-
- /**
- * Return a list of all {@link RequestMetadata}
- */
- public List<RequestMetadata> getRequests() {
- return buildRequestInfos(requests.keySet(), -1);
- }
-
- public List<RequestMetadata> getLongRunningRequests(){
- return buildRequestInfos(requests.keySet(), this.queryThreshold);
- }
-
- private List<RequestMetadata> buildRequestInfos(Collection<RequestID> ids, int longRunningQueryThreshold) {
- List<RequestMetadata> results = new ArrayList<RequestMetadata>();
-
- for (RequestID requestID : ids) {
- RequestWorkItem holder = requests.get(requestID);
-
- if(holder != null && !holder.isCanceled()) {
- RequestMetadata req = new RequestMetadata();
-
- req.setExecutionId(holder.requestID.getExecutionID());
- req.setSessionId(holder.requestID.getConnectionID());
- req.setCommand(holder.requestMsg.getCommandString());
- req.setStartTime(holder.getProcessingTimestamp());
- req.setState(holder.isCanceled()?ProcessingState.CANCELED:holder.isDoneProcessing()?ProcessingState.DONE:ProcessingState.PROCESSING);
- switch (holder.getThreadState()) {
- case DONE:
- case IDLE:
- req.setThreadState(ThreadState.IDLE);
- break;
- default:
- if (holder.isProcessing()) {
- req.setThreadState(ThreadState.RUNNING);
- } else {
- req.setThreadState(ThreadState.QUEUED);
- }
- }
- if (holder.getTransactionContext() != null && holder.getTransactionContext().getTransactionType() != Scope.NONE) {
- req.setTransactionId(holder.getTransactionContext().getTransactionId());
- }
-
- for (DataTierTupleSource conInfo : holder.getConnectorRequests()) {
- String connectorName = conInfo.getConnectorName();
-
- if (connectorName == null) {
- continue;
- }
- // If the request has not yet completed processing, then
- // add all the subrequest messages
- AtomicRequestMessage arm = conInfo.getAtomicRequestMessage();
- RequestMetadata info = new RequestMetadata();
- if (conInfo.isQueued()) {
- info.setThreadState(ThreadState.QUEUED);
- } else if (conInfo.isRunning()) {
- info.setThreadState(ThreadState.RUNNING);
- } else {
- info.setThreadState(ThreadState.IDLE);
- }
- info.setExecutionId(arm.getRequestID().getExecutionID());
- info.setSessionId(holder.requestID.getConnectionID());
- info.setCommand(arm.getCommand().toString());
- info.setStartTime(arm.getProcessingTimestamp());
- info.setSourceRequest(true);
- info.setNodeId(arm.getAtomicRequestID().getNodeID());
- info.setState(conInfo.isCanceled()?ProcessingState.CANCELED:conInfo.isDone()?ProcessingState.DONE:ProcessingState.PROCESSING);
- results.add(info);
- }
-
- // check if only need long running queries.
- long elapsedTime = System.currentTimeMillis() - req.getStartTime();
- if (longRunningQueryThreshold == -1 || elapsedTime > longRunningQueryThreshold) {
- results.add(req);
- }
- }
- }
- return results;
- }
-
- public ResultsFuture<ResultsMessage> executeRequest(long reqID,RequestMessage requestMsg) {
- DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- RequestID requestID = workContext.getRequestID(reqID);
- requestMsg.setFetchSize(Math.min(requestMsg.getFetchSize(), maxFetchSize));
- Request request = null;
- if ( requestMsg.isPreparedStatement() || requestMsg.isCallableStatement()) {
- request = new PreparedStatementRequest(prepPlanCache);
- } else {
- request = new Request();
- }
- ClientState state = this.getClientState(workContext.getSessionId(), true);
- request.initialize(requestMsg, bufferManager,
- dataTierMgr, transactionService, state.sessionTables,
- workContext, this.useEntitlements, this.prepPlanCache);
- request.setResultSetCacheEnabled(this.rsCache != null);
- ResultsFuture<ResultsMessage> resultsFuture = new ResultsFuture<ResultsMessage>();
- RequestWorkItem workItem = new RequestWorkItem(this, requestMsg, request, resultsFuture.getResultsReceiver(), requestID, workContext);
- logMMCommand(workItem, Event.NEW, null);
- addRequest(requestID, workItem, state);
- synchronized (waitingPlans) {
- if (currentlyActivePlans < maxActivePlans) {
- startActivePlan(workItem);
- } else {
- if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
- LogManager.logDetail(LogConstants.CTX_DQP, "Queuing plan, since max plans has been reached."); //$NON-NLS-1$
- }
- waitingPlans.add(workItem);
- }
- }
- return resultsFuture;
- }
-
- public ResultsFuture<ResultsMessage> processCursorRequest(long reqID,
- int batchFirst, int fetchSize) throws TeiidProcessingException {
- if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
- LogManager.logDetail(LogConstants.CTX_DQP, "DQP process cursor request from " + batchFirst); //$NON-NLS-1$
- }
- DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- ResultsFuture<ResultsMessage> resultsFuture = new ResultsFuture<ResultsMessage>();
- RequestWorkItem workItem = getRequestWorkItem(workContext.getRequestID(reqID));
- workItem.requestMore(batchFirst, batchFirst + Math.min(fetchSize, maxFetchSize) - 1, resultsFuture.getResultsReceiver());
- return resultsFuture;
- }
-
- void addRequest(RequestID requestID, RequestWorkItem workItem, ClientState state) {
- this.requests.put(requestID, workItem);
- state.addRequest(requestID);
- }
-
- private void startActivePlan(RequestWorkItem workItem) {
- workItem.active = true;
- this.addWork(workItem);
- this.currentlyActivePlans++;
- }
-
- void finishProcessing(final RequestWorkItem workItem) {
- synchronized (waitingPlans) {
- if (!workItem.active) {
- return;
- }
- workItem.active = false;
- currentlyActivePlans--;
- if (!waitingPlans.isEmpty()) {
- startActivePlan(waitingPlans.remove());
- }
- }
- }
-
- void removeRequest(final RequestWorkItem workItem) {
- finishProcessing(workItem);
- this.requests.remove(workItem.requestID);
- ClientState state = getClientState(workItem.getDqpWorkContext().getSessionId(), false);
- if (state != null) {
- state.removeRequest(workItem.requestID);
- }
- }
-
- void addWork(Runnable work) {
- this.processWorkerPool.execute(work);
- }
-
- void scheduleWork(final Runnable r, int priority, long delay) {
- this.processWorkerPool.schedule(new FutureWork<Void>(new Callable<Void>() {
- @Override
- public Void call() throws Exception {
- r.run();
- return null;
- }
- }, priority), delay, TimeUnit.MILLISECONDS);
- }
-
- public ResultsFuture<?> closeLobChunkStream(int lobRequestId,
- long requestId, String streamId)
- throws TeiidProcessingException {
- if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
- LogManager.logDetail(LogConstants.CTX_DQP, "Request to close the Lob stream with Stream id="+streamId+" instance id="+lobRequestId); //$NON-NLS-1$//$NON-NLS-2$
- }
- DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- RequestWorkItem workItem = safeGetWorkItem(workContext.getRequestID(requestId));
- if (workItem != null) {
- workItem.removeLobStream(lobRequestId);
- }
- return ResultsFuture.NULL_FUTURE;
- }
-
- public ResultsFuture<LobChunk> requestNextLobChunk(int lobRequestId,
- long requestId, String streamId)
- throws TeiidProcessingException {
- if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
- LogManager.logDetail(LogConstants.CTX_DQP, "Request for next Lob chunk with Stream id="+streamId+" instance id="+lobRequestId); //$NON-NLS-1$//$NON-NLS-2$
- }
- RequestWorkItem workItem = getRequestWorkItem(DQPWorkContext.getWorkContext().getRequestID(requestId));
- ResultsFuture<LobChunk> resultsFuture = new ResultsFuture<LobChunk>();
- workItem.processLobChunkRequest(streamId, lobRequestId, resultsFuture.getResultsReceiver());
- return resultsFuture;
- }
-
-// /**
-// * Cancels a node in the request. (This request is called by the
-// * client directly using the admin API), so if this does not support
-// * partial results then remove the original request.
-// * @throws MetaMatrixComponentException
-// */
-// public void cancelAtomicRequest(AtomicRequestID requestID) throws MetaMatrixComponentException {
-// RequestWorkItem workItem = safeGetWorkItem(requestID.getRequestID());
-// if (workItem == null) {
-// LogManager.logDetail(LogConstants.CTX_DQP, "Could not cancel", requestID, "parent request does not exist"); //$NON-NLS-1$ //$NON-NLS-2$
-// return;
-// }
-// workItem.requestAtomicRequestCancel(requestID);
-// }
-
- RequestWorkItem getRequestWorkItem(RequestID reqID) throws TeiidProcessingException {
- RequestWorkItem result = this.requests.get(reqID);
- if (result == null) {
- throw new TeiidProcessingException(QueryPlugin.Util.getString("DQPCore.The_request_has_been_closed.", reqID));//$NON-NLS-1$
- }
- return result;
- }
-
- RequestWorkItem safeGetWorkItem(Object processorID) {
- return this.requests.get(processorID);
- }
-
- public WorkerPoolStatisticsMetadata getWorkerPoolStatistics() {
- return this.processWorkerPool.getStats();
- }
-
- public void terminateSession(String sessionId) {
- // sometimes there will not be any atomic requests pending, in that
- // situation we still need to clear the master request from our map
- ClientState state = getClientState(sessionId, false);
- if (state != null) {
- for (RequestID reqId : state.getRequests()) {
- try {
- cancelRequest(reqId);
- } catch (TeiidComponentException err) {
- LogManager.logWarning(LogConstants.CTX_DQP, err, "Failed to cancel " + reqId); //$NON-NLS-1$
- }
- }
- }
-
- try {
- transactionService.cancelTransactions(sessionId, false);
- } catch (XATransactionException err) {
- LogManager.logWarning(LogConstants.CTX_DQP, "rollback failed for requestID=" + sessionId); //$NON-NLS-1$
- }
- }
-
- public boolean cancelRequest(String sessionId, long executionId) throws TeiidComponentException {
- RequestID requestID = new RequestID(sessionId, executionId);
- return cancelRequest(requestID);
- }
-
- private boolean cancelRequest(RequestID requestID) throws TeiidComponentException {
- if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
- LogManager.logDetail(LogConstants.CTX_DQP, "cancelQuery for requestID=" + requestID); //$NON-NLS-1$
- }
-
- boolean markCancelled = false;
-
- RequestWorkItem workItem = safeGetWorkItem(requestID);
- if (workItem != null) {
- markCancelled = workItem.requestCancel();
- }
- if (markCancelled) {
- logMMCommand(workItem, Event.CANCEL, null);
- } else {
- LogManager.logDetail(LogConstants.CTX_DQP, QueryPlugin.Util.getString("DQPCore.failed_to_cancel")); //$NON-NLS-1$
- }
- return markCancelled;
- }
-
- public ResultsFuture<?> closeRequest(long requestId) throws TeiidProcessingException, TeiidComponentException {
- DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- closeRequest(workContext.getRequestID(requestId));
- return ResultsFuture.NULL_FUTURE;
- }
-
- /**
- * Close the request with given ID
- * @param requestID
- * @throws TeiidComponentException
- */
- void closeRequest(RequestID requestID) throws TeiidComponentException {
- if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
- LogManager.logDetail(LogConstants.CTX_DQP, "closeQuery for requestID=" + requestID); //$NON-NLS-1$
- }
-
- RequestWorkItem workItem = safeGetWorkItem(requestID);
- if (workItem != null) {
- workItem.requestClose();
- } else {
- LogManager.logDetail(LogConstants.CTX_DQP, requestID + " close call ignored as the request has already been removed."); //$NON-NLS-1$
- }
- }
-
- private void clearPlanCache(){
- LogManager.logInfo(LogConstants.CTX_DQP, QueryPlugin.Util.getString("DQPCore.Clearing_prepared_plan_cache")); //$NON-NLS-1$
- this.prepPlanCache.clearAll();
- }
-
- private void clearResultSetCache() {
- //clear cache in server
- if(rsCache != null){
- rsCache.clearAll();
- }
- }
-
- private void clearPlanCache(String vdbName, int version){
- LogManager.logInfo(LogConstants.CTX_DQP, QueryPlugin.Util.getString("DQPCore.Clearing_prepared_plan_cache")); //$NON-NLS-1$
- this.prepPlanCache.clearForVDB(vdbName, version);
- }
-
- private void clearResultSetCache(String vdbName, int version) {
- //clear cache in server
- if(rsCache != null){
- rsCache.clearForVDB(vdbName, version);
- }
- }
-
- public CacheStatisticsMetadata getCacheStatistics(String cacheType) {
- if (cacheType.equalsIgnoreCase(Admin.Cache.PREPARED_PLAN_CACHE.toString())) {
- return buildCacheStats(Admin.Cache.PREPARED_PLAN_CACHE.toString(), this.prepPlanCache);
- }
- else if (cacheType.equalsIgnoreCase(Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE.toString())) {
- return buildCacheStats(Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE.toString(), this.rsCache);
- }
- return null;
- }
-
- private CacheStatisticsMetadata buildCacheStats(String name, SessionAwareCache cache) {
- CacheStatisticsMetadata stats = new CacheStatisticsMetadata();
- stats.setName(name);
- stats.setHitRatio(cache.getRequestCount() == 0?0:((double)cache.getCacheHitCount()/cache.getRequestCount())*100);
- stats.setTotalEntries(cache.getTotalCacheEntries());
- stats.setRequestCount(cache.getRequestCount());
- return stats;
- }
-
- public Collection<String> getCacheTypes(){
- ArrayList<String> caches = new ArrayList<String>();
- caches.add(Admin.Cache.PREPARED_PLAN_CACHE.toString());
- caches.add(Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE.toString());
- return caches;
- }
-
- public void clearCache(String cacheType) {
- Admin.Cache cache = Admin.Cache.valueOf(cacheType);
- switch (cache) {
- case PREPARED_PLAN_CACHE:
- clearPlanCache();
- break;
- case QUERY_SERVICE_RESULT_SET_CACHE:
- clearResultSetCache();
- break;
- }
- }
-
- public void clearCache(String cacheType, String vdbName, int version) {
- Admin.Cache cache = Admin.Cache.valueOf(cacheType);
- switch (cache) {
- case PREPARED_PLAN_CACHE:
- clearPlanCache(vdbName, version);
- break;
- case QUERY_SERVICE_RESULT_SET_CACHE:
- clearResultSetCache(vdbName, version);
- break;
- }
- if (this.matTables != null) {
- this.matTables.clearForVDB(vdbName, version);
- }
- }
-
- public Collection<org.teiid.adminapi.Transaction> getTransactions() {
- return this.transactionService.getTransactions();
- }
-
- public void terminateTransaction(String xid) throws AdminException {
- this.transactionService.terminateTransaction(xid);
- }
-
- void logMMCommand(RequestWorkItem workItem, Event status, Integer rowCount) {
- if (!LogManager.isMessageToBeRecorded(LogConstants.CTX_COMMANDLOGGING, MessageLevel.DETAIL)) {
- return;
- }
-
- RequestMessage msg = workItem.requestMsg;
- DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- RequestID rID = new RequestID(workContext.getSessionId(), msg.getExecutionId());
- String txnID = null;
- TransactionContext tc = workItem.getTransactionContext();
- if (tc != null && tc.getTransactionType() != Scope.NONE) {
- txnID = tc.getTransactionId();
- }
- String appName = workContext.getAppName();
- // Log to request log
- CommandLogMessage message = null;
- if (status == Event.NEW) {
- message = new CommandLogMessage(System.currentTimeMillis(), rID.toString(), txnID, workContext.getSessionId(), appName, workContext.getUserName(), workContext.getVdbName(), workContext.getVdbVersion(), msg.getCommandString());
- } else {
- message = new CommandLogMessage(System.currentTimeMillis(), rID.toString(), txnID, workContext.getSessionId(), workContext.getUserName(), workContext.getVdbName(), workContext.getVdbVersion(), rowCount, status);
- }
- LogManager.log(MessageLevel.DETAIL, LogConstants.CTX_COMMANDLOGGING, message);
- }
-
- ProcessorDataManager getDataTierManager() {
- return this.dataTierMgr;
- }
-
- public BufferManager getBufferManager() {
- return bufferManager;
- }
-
- public TransactionService getTransactionService() {
- return transactionService;
- }
-
- SessionAwareCache<CachedResults> getRsCache() {
- return rsCache;
- }
-
- int getProcessorTimeSlice() {
- return this.processorTimeslice;
- }
-
- int getChunkSize() {
- return chunkSize;
- }
-
- public void start(DQPConfiguration config) {
- this.processorTimeslice = config.getTimeSliceInMilli();
- this.maxFetchSize = config.getMaxRowsFetchSize();
- this.useEntitlements = config.useDataRoles();
- this.queryThreshold = config.getQueryThresholdInSecs();
- this.maxSourceRows = config.getMaxSourceRows();
- this.exceptionOnMaxSourceRows = config.isExceptionOnMaxSourceRows();
-
- this.chunkSize = config.getLobChunkSizeInKB() * 1024;
-
- //get buffer manager
- this.bufferManager = bufferService.getBufferManager();
-
- //result set cache
- CacheConfiguration rsCacheConfig = config.getResultsetCacheConfig();
- if (rsCacheConfig != null && rsCacheConfig.isEnabled()) {
- this.rsCache = new SessionAwareCache<CachedResults>(this.cacheFactory, Cache.Type.RESULTSET, rsCacheConfig);
- this.rsCache.setBufferManager(this.bufferManager);
- }
-
- //prepared plan cache
- prepPlanCache = new SessionAwareCache<PreparedPlan>(this.cacheFactory, Cache.Type.PREPAREDPLAN, new CacheConfiguration(Policy.LRU, 60*60*8, config.getPreparedPlanCacheMaxCount()));
- prepPlanCache.setBufferManager(this.bufferManager);
-
-
- this.processWorkerPool = new ThreadReuseExecutor(DQPConfiguration.PROCESS_PLAN_QUEUE_NAME, config.getMaxThreads());
-
- if (cacheFactory.isReplicated()) {
- matTables = new SessionAwareCache<CachedResults>();
- }
-
- dataTierMgr = new TempTableDataManager(new DataTierManagerImpl(this,
- this.bufferService), this.bufferManager, this.processWorkerPool, this.rsCache, matTables, this.cacheFactory);
- }
-
- public void setBufferService(BufferService service) {
- this.bufferService = service;
- }
-
- public void setTransactionService(TransactionService service) {
- this.transactionService = service;
- }
-
- @Override
- public boolean cancelRequest(long requestID)
- throws TeiidProcessingException, TeiidComponentException {
- DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- return this.cancelRequest(workContext.getRequestID(requestID));
- }
-
- // local txn
- public ResultsFuture<?> begin() throws XATransactionException {
- String threadId = DQPWorkContext.getWorkContext().getSessionId();
- this.getTransactionService().begin(threadId);
- return ResultsFuture.NULL_FUTURE;
- }
-
- // local txn
- public ResultsFuture<?> commit() throws XATransactionException {
- final String threadId = DQPWorkContext.getWorkContext().getSessionId();
- Callable<Void> processor = new Callable<Void>() {
- @Override
- public Void call() throws Exception {
- getTransactionService().commit(threadId);
- return null;
- }
- };
- return addWork(processor, 0);
- }
-
- // local txn
- public ResultsFuture<?> rollback() throws XATransactionException {
- final String threadId = DQPWorkContext.getWorkContext().getSessionId();
- Callable<Void> processor = new Callable<Void>() {
- @Override
- public Void call() throws Exception {
- getTransactionService().rollback(threadId);
- return null;
- }
- };
- return addWork(processor, 0);
- }
-
- // global txn
- public ResultsFuture<?> commit(final XidImpl xid, final boolean onePhase) throws XATransactionException {
- Callable<Void> processor = new Callable<Void>() {
- @Override
- public Void call() throws Exception {
- DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- getTransactionService().commit(workContext.getSessionId(), xid, onePhase, workContext.getSession().isEmbedded());
- return null;
- }
- };
- return addWork(processor, 0);
- }
- // global txn
- public ResultsFuture<?> end(XidImpl xid, int flags) throws XATransactionException {
- DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- this.getTransactionService().end(workContext.getSessionId(), xid, flags, workContext.getSession().isEmbedded());
- return ResultsFuture.NULL_FUTURE;
- }
- // global txn
- public ResultsFuture<?> forget(XidImpl xid) throws XATransactionException {
- DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- this.getTransactionService().forget(workContext.getSessionId(), xid, workContext.getSession().isEmbedded());
- return ResultsFuture.NULL_FUTURE;
- }
-
- // global txn
- public ResultsFuture<Integer> prepare(final XidImpl xid) throws XATransactionException {
- Callable<Integer> processor = new Callable<Integer>() {
- @Override
- public Integer call() throws Exception {
- DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- return getTransactionService().prepare(workContext.getSessionId(),xid, workContext.getSession().isEmbedded());
- }
- };
- return addWork(processor, 10);
- }
-
- <T> ResultsFuture<T> addWork(Callable<T> processor, int priority) {
- FutureWork<T> work = new FutureWork<T>(processor, priority);
- this.addWork(work);
- return work.getResult();
- }
-
- // global txn
- public ResultsFuture<Xid[]> recover(int flag) throws XATransactionException {
- ResultsFuture<Xid[]> result = new ResultsFuture<Xid[]>();
- DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- result.getResultsReceiver().receiveResults(this.getTransactionService().recover(flag, workContext.getSession().isEmbedded()));
- return result;
- }
- // global txn
- public ResultsFuture<?> rollback(final XidImpl xid) throws XATransactionException {
- Callable<Void> processor = new Callable<Void>() {
- @Override
- public Void call() throws Exception {
- DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- getTransactionService().rollback(workContext.getSessionId(),xid, workContext.getSession().isEmbedded());
- return null;
- }
- };
- return addWork(processor, 0);
- }
- // global txn
- public ResultsFuture<?> start(final XidImpl xid, final int flags, final int timeout)
- throws XATransactionException {
- Callable<Void> processor = new Callable<Void>() {
- @Override
- public Void call() throws Exception {
- DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- getTransactionService().start(workContext.getSessionId(), xid, flags, timeout, workContext.getSession().isEmbedded());
- return null;
- }
- };
- return addWork(processor, 100);
- }
-
- public MetadataResult getMetadata(long requestID)
- throws TeiidComponentException, TeiidProcessingException {
- DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- MetaDataProcessor processor = new MetaDataProcessor(this, this.prepPlanCache, workContext.getVdbName(), workContext.getVdbVersion());
- return processor.processMessage(workContext.getRequestID(requestID), workContext, null, true);
- }
-
- public MetadataResult getMetadata(long requestID, String preparedSql,
- boolean allowDoubleQuotedVariable)
- throws TeiidComponentException, TeiidProcessingException {
- DQPWorkContext workContext = DQPWorkContext.getWorkContext();
- MetaDataProcessor processor = new MetaDataProcessor(this, this.prepPlanCache, workContext.getVdbName(), workContext.getVdbVersion());
- return processor.processMessage(workContext.getRequestID(requestID), workContext, preparedSql, allowDoubleQuotedVariable);
- }
-
- public boolean isExceptionOnMaxSourceRows() {
- return exceptionOnMaxSourceRows;
- }
-
- public int getMaxSourceRows() {
- return maxSourceRows;
- }
-
- public void setCacheFactory(CacheFactory factory) {
- this.cacheFactory = factory;
- }
-
-}
\ No newline at end of file
Copied: tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java (from rev 2707, branches/7.2.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java)
===================================================================
--- tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java (rev 0)
+++ tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-11-05 03:19:55 UTC (rev 2709)
@@ -0,0 +1,867 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.dqp.internal.process;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.TimeUnit;
+
+import javax.resource.spi.work.Work;
+import javax.resource.spi.work.WorkEvent;
+import javax.resource.spi.work.WorkListener;
+import javax.transaction.xa.Xid;
+
+import org.teiid.adminapi.Admin;
+import org.teiid.adminapi.AdminException;
+import org.teiid.adminapi.Request.ProcessingState;
+import org.teiid.adminapi.Request.ThreadState;
+import org.teiid.adminapi.impl.CacheStatisticsMetadata;
+import org.teiid.adminapi.impl.RequestMetadata;
+import org.teiid.adminapi.impl.WorkerPoolStatisticsMetadata;
+import org.teiid.cache.Cache;
+import org.teiid.cache.CacheConfiguration;
+import org.teiid.cache.CacheFactory;
+import org.teiid.cache.CacheConfiguration.Policy;
+import org.teiid.client.DQP;
+import org.teiid.client.RequestMessage;
+import org.teiid.client.ResultsMessage;
+import org.teiid.client.lob.LobChunk;
+import org.teiid.client.metadata.MetadataResult;
+import org.teiid.client.util.ResultsFuture;
+import org.teiid.client.util.ResultsReceiver;
+import org.teiid.client.xa.XATransactionException;
+import org.teiid.client.xa.XidImpl;
+import org.teiid.common.buffer.BufferManager;
+import org.teiid.core.TeiidComponentException;
+import org.teiid.core.TeiidProcessingException;
+import org.teiid.core.types.Streamable;
+import org.teiid.dqp.internal.process.ThreadReuseExecutor.PrioritizedRunnable;
+import org.teiid.dqp.message.AtomicRequestMessage;
+import org.teiid.dqp.message.RequestID;
+import org.teiid.dqp.service.BufferService;
+import org.teiid.dqp.service.TransactionContext;
+import org.teiid.dqp.service.TransactionService;
+import org.teiid.dqp.service.TransactionContext.Scope;
+import org.teiid.logging.CommandLogMessage;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.logging.MessageLevel;
+import org.teiid.logging.CommandLogMessage.Event;
+import org.teiid.query.QueryPlugin;
+import org.teiid.query.processor.ProcessorDataManager;
+import org.teiid.query.tempdata.TempTableDataManager;
+import org.teiid.query.tempdata.TempTableStore;
+
+
+/**
+ * Implements the core DQP processing.
+ */
+public class DQPCore implements DQP {
+
+ //TODO: replace with FutureTask
+ public final static class FutureWork<T> implements Work, WorkListener, PrioritizedRunnable {
+ private final Callable<T> toCall;
+ private ResultsFuture<T> result = new ResultsFuture<T>();
+ private ResultsReceiver<T> receiver = result.getResultsReceiver();
+ private int priority;
+ private long creationTime = System.currentTimeMillis();
+ private DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+
+ public FutureWork(Callable<T> processor, int priority) {
+ this.toCall = processor;
+ this.priority = priority;
+ }
+
+ public ResultsFuture<T> getResult() {
+ return result;
+ }
+
+ @Override
+ public void run() {
+ try {
+ receiver.receiveResults(toCall.call());
+ } catch (Throwable t) {
+ receiver.exceptionOccurred(t);
+ }
+ }
+
+ @Override
+ public void release() {
+
+ }
+
+ @Override
+ public void workAccepted(WorkEvent arg0) {
+
+ }
+
+ @Override
+ public void workCompleted(WorkEvent arg0) {
+
+ }
+
+ @Override
+ public void workRejected(WorkEvent arg0) {
+ receiver.exceptionOccurred(arg0.getException());
+ }
+
+ @Override
+ public void workStarted(WorkEvent arg0) {
+
+ }
+
+ @Override
+ public int getPriority() {
+ return priority;
+ }
+
+ @Override
+ public long getCreationTime() {
+ return creationTime;
+ }
+
+ @Override
+ public DQPWorkContext getDqpWorkContext() {
+ return workContext;
+ }
+ }
+
+ static class ClientState {
+ List<RequestID> requests;
+ TempTableStore sessionTables;
+
+ public ClientState(TempTableStore tableStoreImpl) {
+ this.sessionTables = tableStoreImpl;
+ }
+
+ public synchronized void addRequest(RequestID requestID) {
+ if (requests == null) {
+ requests = new LinkedList<RequestID>();
+ }
+ requests.add(requestID);
+ }
+
+ public synchronized List<RequestID> getRequests() {
+ if (requests == null) {
+ return Collections.emptyList();
+ }
+ return new ArrayList<RequestID>(requests);
+ }
+
+ public synchronized void removeRequest(RequestID requestID) {
+ if (requests != null) {
+ requests.remove(requestID);
+ }
+ }
+
+ }
+
+ private ThreadReuseExecutor processWorkerPool;
+
+ private int maxFetchSize = DQPConfiguration.DEFAULT_FETCH_SIZE;
+ private int queryThreshold = DQPConfiguration.DEFAULT_QUERY_THRESHOLD;
+
+ // Resources
+ private BufferManager bufferManager;
+ private ProcessorDataManager dataTierMgr;
+ private SessionAwareCache<PreparedPlan> prepPlanCache;
+ private SessionAwareCache<CachedResults> rsCache;
+ private TransactionService transactionService;
+ private BufferService bufferService;
+
+ // Query worker pool for processing plans
+ private int processorTimeslice = DQPConfiguration.DEFAULT_PROCESSOR_TIMESLICE;
+
+ private int maxSourceRows = DQPConfiguration.DEFAULT_MAX_SOURCE_ROWS;
+ private boolean exceptionOnMaxSourceRows = true;
+
+ private int chunkSize = Streamable.STREAMING_BATCH_SIZE_IN_BYTES;
+
+ private Map<RequestID, RequestWorkItem> requests = new ConcurrentHashMap<RequestID, RequestWorkItem>();
+ private Map<String, ClientState> clientState = new ConcurrentHashMap<String, ClientState>();
+ private boolean useEntitlements = false;
+
+ private int maxActivePlans = DQPConfiguration.DEFAULT_MAX_ACTIVE_PLANS;
+ private int currentlyActivePlans;
+ private LinkedList<RequestWorkItem> waitingPlans = new LinkedList<RequestWorkItem>();
+ private CacheFactory cacheFactory;
+
+ private SessionAwareCache<CachedResults> matTables;
+
+ /**
+ * perform a full shutdown and wait for 10 seconds for all threads to finish
+ */
+ public void stop() {
+ processWorkerPool.shutdownNow();
+ try {
+ processWorkerPool.awaitTermination(10, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {
+ }
+ // TODO: Should we be doing more cleanup here??
+ LogManager.logDetail(LogConstants.CTX_DQP, "Stopping the DQP"); //$NON-NLS-1$
+ }
+
+ /**
+ * Return a list of {@link RequestMetadata} for the given session
+ */
+ public List<RequestMetadata> getRequestsForSession(String sessionId) {
+ ClientState state = getClientState(sessionId, false);
+ if (state == null) {
+ return Collections.emptyList();
+ }
+ return buildRequestInfos(state.getRequests(), -1);
+ }
+
+ public ClientState getClientState(String key, boolean create) {
+ if (key == null) {
+ return null;
+ }
+ ClientState state = clientState.get(key);
+ if (state == null && create) {
+ state = new ClientState(new TempTableStore(key));
+ clientState.put(key, state);
+ }
+ return state;
+ }
+
+ /**
+ * Return a list of all {@link RequestMetadata}
+ */
+ public List<RequestMetadata> getRequests() {
+ return buildRequestInfos(requests.keySet(), -1);
+ }
+
+ public List<RequestMetadata> getLongRunningRequests(){
+ return buildRequestInfos(requests.keySet(), this.queryThreshold);
+ }
+
+ private List<RequestMetadata> buildRequestInfos(Collection<RequestID> ids, int longRunningQueryThreshold) {
+ List<RequestMetadata> results = new ArrayList<RequestMetadata>();
+
+ for (RequestID requestID : ids) {
+ RequestWorkItem holder = requests.get(requestID);
+
+ if(holder != null && !holder.isCanceled()) {
+ RequestMetadata req = new RequestMetadata();
+
+ req.setExecutionId(holder.requestID.getExecutionID());
+ req.setSessionId(holder.requestID.getConnectionID());
+ req.setCommand(holder.requestMsg.getCommandString());
+ req.setStartTime(holder.getProcessingTimestamp());
+ req.setState(holder.isCanceled()?ProcessingState.CANCELED:holder.isDoneProcessing()?ProcessingState.DONE:ProcessingState.PROCESSING);
+ switch (holder.getThreadState()) {
+ case DONE:
+ case IDLE:
+ req.setThreadState(ThreadState.IDLE);
+ break;
+ default:
+ if (holder.isProcessing()) {
+ req.setThreadState(ThreadState.RUNNING);
+ } else {
+ req.setThreadState(ThreadState.QUEUED);
+ }
+ }
+ if (holder.getTransactionContext() != null && holder.getTransactionContext().getTransactionType() != Scope.NONE) {
+ req.setTransactionId(holder.getTransactionContext().getTransactionId());
+ }
+
+ for (DataTierTupleSource conInfo : holder.getConnectorRequests()) {
+ String connectorName = conInfo.getConnectorName();
+
+ if (connectorName == null) {
+ continue;
+ }
+ // If the request has not yet completed processing, then
+ // add all the subrequest messages
+ AtomicRequestMessage arm = conInfo.getAtomicRequestMessage();
+ RequestMetadata info = new RequestMetadata();
+ if (conInfo.isQueued()) {
+ info.setThreadState(ThreadState.QUEUED);
+ } else if (conInfo.isRunning()) {
+ info.setThreadState(ThreadState.RUNNING);
+ } else {
+ info.setThreadState(ThreadState.IDLE);
+ }
+ info.setExecutionId(arm.getRequestID().getExecutionID());
+ info.setSessionId(holder.requestID.getConnectionID());
+ info.setCommand(arm.getCommand().toString());
+ info.setStartTime(arm.getProcessingTimestamp());
+ info.setSourceRequest(true);
+ info.setNodeId(arm.getAtomicRequestID().getNodeID());
+ info.setState(conInfo.isCanceled()?ProcessingState.CANCELED:conInfo.isDone()?ProcessingState.DONE:ProcessingState.PROCESSING);
+ results.add(info);
+ }
+
+ // check if only need long running queries.
+ long elapsedTime = System.currentTimeMillis() - req.getStartTime();
+ if (longRunningQueryThreshold == -1 || elapsedTime > longRunningQueryThreshold) {
+ results.add(req);
+ }
+ }
+ }
+ return results;
+ }
+
+ public ResultsFuture<ResultsMessage> executeRequest(long reqID,RequestMessage requestMsg) {
+ DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ RequestID requestID = workContext.getRequestID(reqID);
+ requestMsg.setFetchSize(Math.min(requestMsg.getFetchSize(), maxFetchSize));
+ Request request = null;
+ if ( requestMsg.isPreparedStatement() || requestMsg.isCallableStatement()) {
+ request = new PreparedStatementRequest(prepPlanCache);
+ } else {
+ request = new Request();
+ }
+ ClientState state = this.getClientState(workContext.getSessionId(), true);
+ request.initialize(requestMsg, bufferManager,
+ dataTierMgr, transactionService, state.sessionTables,
+ workContext, this.useEntitlements, this.prepPlanCache);
+ request.setResultSetCacheEnabled(this.rsCache != null);
+ ResultsFuture<ResultsMessage> resultsFuture = new ResultsFuture<ResultsMessage>();
+ RequestWorkItem workItem = new RequestWorkItem(this, requestMsg, request, resultsFuture.getResultsReceiver(), requestID, workContext);
+ logMMCommand(workItem, Event.NEW, null);
+ addRequest(requestID, workItem, state);
+ synchronized (waitingPlans) {
+ if (currentlyActivePlans < maxActivePlans) {
+ startActivePlan(workItem);
+ } else {
+ if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
+ LogManager.logDetail(LogConstants.CTX_DQP, "Queuing plan, since max plans has been reached."); //$NON-NLS-1$
+ }
+ waitingPlans.add(workItem);
+ }
+ }
+ return resultsFuture;
+ }
+
+ public ResultsFuture<ResultsMessage> processCursorRequest(long reqID,
+ int batchFirst, int fetchSize) throws TeiidProcessingException {
+ if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
+ LogManager.logDetail(LogConstants.CTX_DQP, "DQP process cursor request from " + batchFirst); //$NON-NLS-1$
+ }
+ DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ ResultsFuture<ResultsMessage> resultsFuture = new ResultsFuture<ResultsMessage>();
+ RequestWorkItem workItem = getRequestWorkItem(workContext.getRequestID(reqID));
+ workItem.requestMore(batchFirst, batchFirst + Math.min(fetchSize, maxFetchSize) - 1, resultsFuture.getResultsReceiver());
+ return resultsFuture;
+ }
+
+ void addRequest(RequestID requestID, RequestWorkItem workItem, ClientState state) {
+ this.requests.put(requestID, workItem);
+ state.addRequest(requestID);
+ }
+
+ private void startActivePlan(RequestWorkItem workItem) {
+ workItem.active = true;
+ this.addWork(workItem);
+ this.currentlyActivePlans++;
+ }
+
+ void finishProcessing(final RequestWorkItem workItem) {
+ synchronized (waitingPlans) {
+ if (!workItem.active) {
+ return;
+ }
+ workItem.active = false;
+ currentlyActivePlans--;
+ if (!waitingPlans.isEmpty()) {
+ startActivePlan(waitingPlans.remove());
+ }
+ }
+ }
+
+ void removeRequest(final RequestWorkItem workItem) {
+ finishProcessing(workItem);
+ this.requests.remove(workItem.requestID);
+ ClientState state = getClientState(workItem.getDqpWorkContext().getSessionId(), false);
+ if (state != null) {
+ state.removeRequest(workItem.requestID);
+ }
+ }
+
+ void addWork(Runnable work) {
+ this.processWorkerPool.execute(work);
+ }
+
+ void scheduleWork(final Runnable r, int priority, long delay) {
+ this.processWorkerPool.schedule(new FutureWork<Void>(new Callable<Void>() {
+ @Override
+ public Void call() throws Exception {
+ r.run();
+ return null;
+ }
+ }, priority), delay, TimeUnit.MILLISECONDS);
+ }
+
+ public ResultsFuture<?> closeLobChunkStream(int lobRequestId,
+ long requestId, String streamId)
+ throws TeiidProcessingException {
+ if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
+ LogManager.logDetail(LogConstants.CTX_DQP, "Request to close the Lob stream with Stream id="+streamId+" instance id="+lobRequestId); //$NON-NLS-1$//$NON-NLS-2$
+ }
+ DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ RequestWorkItem workItem = safeGetWorkItem(workContext.getRequestID(requestId));
+ if (workItem != null) {
+ workItem.removeLobStream(lobRequestId);
+ }
+ return ResultsFuture.NULL_FUTURE;
+ }
+
+ public ResultsFuture<LobChunk> requestNextLobChunk(int lobRequestId,
+ long requestId, String streamId)
+ throws TeiidProcessingException {
+ if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
+ LogManager.logDetail(LogConstants.CTX_DQP, "Request for next Lob chunk with Stream id="+streamId+" instance id="+lobRequestId); //$NON-NLS-1$//$NON-NLS-2$
+ }
+ RequestWorkItem workItem = getRequestWorkItem(DQPWorkContext.getWorkContext().getRequestID(requestId));
+ ResultsFuture<LobChunk> resultsFuture = new ResultsFuture<LobChunk>();
+ workItem.processLobChunkRequest(streamId, lobRequestId, resultsFuture.getResultsReceiver());
+ return resultsFuture;
+ }
+
+// /**
+// * Cancels a node in the request. (This request is called by the
+// * client directly using the admin API), so if this does not support
+// * partial results then remove the original request.
+// * @throws MetaMatrixComponentException
+// */
+// public void cancelAtomicRequest(AtomicRequestID requestID) throws MetaMatrixComponentException {
+// RequestWorkItem workItem = safeGetWorkItem(requestID.getRequestID());
+// if (workItem == null) {
+// LogManager.logDetail(LogConstants.CTX_DQP, "Could not cancel", requestID, "parent request does not exist"); //$NON-NLS-1$ //$NON-NLS-2$
+// return;
+// }
+// workItem.requestAtomicRequestCancel(requestID);
+// }
+
+ RequestWorkItem getRequestWorkItem(RequestID reqID) throws TeiidProcessingException {
+ RequestWorkItem result = this.requests.get(reqID);
+ if (result == null) {
+ throw new TeiidProcessingException(QueryPlugin.Util.getString("DQPCore.The_request_has_been_closed.", reqID));//$NON-NLS-1$
+ }
+ return result;
+ }
+
+ RequestWorkItem safeGetWorkItem(Object processorID) {
+ return this.requests.get(processorID);
+ }
+
+ public WorkerPoolStatisticsMetadata getWorkerPoolStatistics() {
+ return this.processWorkerPool.getStats();
+ }
+
+ public void terminateSession(String sessionId) {
+ // sometimes there will not be any atomic requests pending, in that
+ // situation we still need to clear the master request from our map
+ ClientState state = getClientState(sessionId, false);
+ if (state != null) {
+ for (RequestID reqId : state.getRequests()) {
+ try {
+ cancelRequest(reqId);
+ } catch (TeiidComponentException err) {
+ LogManager.logWarning(LogConstants.CTX_DQP, err, "Failed to cancel " + reqId); //$NON-NLS-1$
+ }
+ }
+ }
+
+ try {
+ transactionService.cancelTransactions(sessionId, false);
+ } catch (XATransactionException err) {
+ LogManager.logWarning(LogConstants.CTX_DQP, "rollback failed for requestID=" + sessionId); //$NON-NLS-1$
+ }
+ }
+
+ public boolean cancelRequest(String sessionId, long executionId) throws TeiidComponentException {
+ RequestID requestID = new RequestID(sessionId, executionId);
+ return cancelRequest(requestID);
+ }
+
+ private boolean cancelRequest(RequestID requestID) throws TeiidComponentException {
+ if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
+ LogManager.logDetail(LogConstants.CTX_DQP, "cancelQuery for requestID=" + requestID); //$NON-NLS-1$
+ }
+
+ boolean markCancelled = false;
+
+ RequestWorkItem workItem = safeGetWorkItem(requestID);
+ if (workItem != null) {
+ markCancelled = workItem.requestCancel();
+ }
+ if (markCancelled) {
+ logMMCommand(workItem, Event.CANCEL, null);
+ } else {
+ LogManager.logDetail(LogConstants.CTX_DQP, QueryPlugin.Util.getString("DQPCore.failed_to_cancel")); //$NON-NLS-1$
+ }
+ return markCancelled;
+ }
+
+ public ResultsFuture<?> closeRequest(long requestId) throws TeiidProcessingException, TeiidComponentException {
+ DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ closeRequest(workContext.getRequestID(requestId));
+ return ResultsFuture.NULL_FUTURE;
+ }
+
+ /**
+ * Close the request with given ID
+ * @param requestID
+ * @throws TeiidComponentException
+ */
+ void closeRequest(RequestID requestID) throws TeiidComponentException {
+ if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
+ LogManager.logDetail(LogConstants.CTX_DQP, "closeQuery for requestID=" + requestID); //$NON-NLS-1$
+ }
+
+ RequestWorkItem workItem = safeGetWorkItem(requestID);
+ if (workItem != null) {
+ workItem.requestClose();
+ } else {
+ LogManager.logDetail(LogConstants.CTX_DQP, requestID + " close call ignored as the request has already been removed."); //$NON-NLS-1$
+ }
+ }
+
+ private void clearPlanCache(){
+ LogManager.logInfo(LogConstants.CTX_DQP, QueryPlugin.Util.getString("DQPCore.Clearing_prepared_plan_cache")); //$NON-NLS-1$
+ this.prepPlanCache.clearAll();
+ }
+
+ private void clearResultSetCache() {
+ //clear cache in server
+ if(rsCache != null){
+ rsCache.clearAll();
+ }
+ }
+
+ private void clearPlanCache(String vdbName, int version){
+ LogManager.logInfo(LogConstants.CTX_DQP, QueryPlugin.Util.getString("DQPCore.Clearing_prepared_plan_cache")); //$NON-NLS-1$
+ this.prepPlanCache.clearForVDB(vdbName, version);
+ }
+
+ private void clearResultSetCache(String vdbName, int version) {
+ //clear cache in server
+ if(rsCache != null){
+ rsCache.clearForVDB(vdbName, version);
+ }
+ }
+
+ public CacheStatisticsMetadata getCacheStatistics(String cacheType) {
+ if (cacheType.equalsIgnoreCase(Admin.Cache.PREPARED_PLAN_CACHE.toString())) {
+ return buildCacheStats(Admin.Cache.PREPARED_PLAN_CACHE.toString(), this.prepPlanCache);
+ }
+ else if (cacheType.equalsIgnoreCase(Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE.toString())) {
+ return buildCacheStats(Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE.toString(), this.rsCache);
+ }
+ return null;
+ }
+
+ private CacheStatisticsMetadata buildCacheStats(String name, SessionAwareCache cache) {
+ CacheStatisticsMetadata stats = new CacheStatisticsMetadata();
+ stats.setName(name);
+ stats.setHitRatio(cache.getRequestCount() == 0?0:((double)cache.getCacheHitCount()/cache.getRequestCount())*100);
+ stats.setTotalEntries(cache.getTotalCacheEntries());
+ stats.setRequestCount(cache.getRequestCount());
+ return stats;
+ }
+
+ public Collection<String> getCacheTypes(){
+ ArrayList<String> caches = new ArrayList<String>();
+ caches.add(Admin.Cache.PREPARED_PLAN_CACHE.toString());
+ caches.add(Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE.toString());
+ return caches;
+ }
+
+ public void clearCache(String cacheType) {
+ Admin.Cache cache = Admin.Cache.valueOf(cacheType);
+ switch (cache) {
+ case PREPARED_PLAN_CACHE:
+ clearPlanCache();
+ break;
+ case QUERY_SERVICE_RESULT_SET_CACHE:
+ clearResultSetCache();
+ break;
+ }
+ }
+
+ public void clearCache(String cacheType, String vdbName, int version) {
+ Admin.Cache cache = Admin.Cache.valueOf(cacheType);
+ switch (cache) {
+ case PREPARED_PLAN_CACHE:
+ clearPlanCache(vdbName, version);
+ break;
+ case QUERY_SERVICE_RESULT_SET_CACHE:
+ clearResultSetCache(vdbName, version);
+ break;
+ }
+ if (this.matTables != null) {
+ this.matTables.clearForVDB(vdbName, version);
+ }
+ }
+
+ public Collection<org.teiid.adminapi.Transaction> getTransactions() {
+ return this.transactionService.getTransactions();
+ }
+
+ public void terminateTransaction(String xid) throws AdminException {
+ this.transactionService.terminateTransaction(xid);
+ }
+
+ void logMMCommand(RequestWorkItem workItem, Event status, Integer rowCount) {
+ if (!LogManager.isMessageToBeRecorded(LogConstants.CTX_COMMANDLOGGING, MessageLevel.DETAIL)) {
+ return;
+ }
+
+ RequestMessage msg = workItem.requestMsg;
+ DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ RequestID rID = new RequestID(workContext.getSessionId(), msg.getExecutionId());
+ String txnID = null;
+ TransactionContext tc = workItem.getTransactionContext();
+ if (tc != null && tc.getTransactionType() != Scope.NONE) {
+ txnID = tc.getTransactionId();
+ }
+ String appName = workContext.getAppName();
+ // Log to request log
+ CommandLogMessage message = null;
+ if (status == Event.NEW) {
+ message = new CommandLogMessage(System.currentTimeMillis(), rID.toString(), txnID, workContext.getSessionId(), appName, workContext.getUserName(), workContext.getVdbName(), workContext.getVdbVersion(), msg.getCommandString());
+ } else {
+ message = new CommandLogMessage(System.currentTimeMillis(), rID.toString(), txnID, workContext.getSessionId(), workContext.getUserName(), workContext.getVdbName(), workContext.getVdbVersion(), rowCount, status);
+ }
+ LogManager.log(MessageLevel.DETAIL, LogConstants.CTX_COMMANDLOGGING, message);
+ }
+
+ ProcessorDataManager getDataTierManager() {
+ return this.dataTierMgr;
+ }
+
+ public BufferManager getBufferManager() {
+ return bufferManager;
+ }
+
+ public TransactionService getTransactionService() {
+ return transactionService;
+ }
+
+ SessionAwareCache<CachedResults> getRsCache() {
+ return rsCache;
+ }
+
+ int getProcessorTimeSlice() {
+ return this.processorTimeslice;
+ }
+
+ int getChunkSize() {
+ return chunkSize;
+ }
+
+ public void start(DQPConfiguration config) {
+ this.processorTimeslice = config.getTimeSliceInMilli();
+ this.maxFetchSize = config.getMaxRowsFetchSize();
+ this.useEntitlements = config.getUseDataRoles();
+ this.queryThreshold = config.getQueryThresholdInSecs();
+ this.maxSourceRows = config.getMaxSourceRows();
+ this.exceptionOnMaxSourceRows = config.isExceptionOnMaxSourceRows();
+
+ this.chunkSize = config.getLobChunkSizeInKB() * 1024;
+
+ //get buffer manager
+ this.bufferManager = bufferService.getBufferManager();
+
+ //result set cache
+ CacheConfiguration rsCacheConfig = config.getResultsetCacheConfig();
+ if (rsCacheConfig != null && rsCacheConfig.isEnabled()) {
+ this.rsCache = new SessionAwareCache<CachedResults>(this.cacheFactory, Cache.Type.RESULTSET, rsCacheConfig);
+ this.rsCache.setBufferManager(this.bufferManager);
+ }
+
+ //prepared plan cache
+ prepPlanCache = new SessionAwareCache<PreparedPlan>(this.cacheFactory, Cache.Type.PREPAREDPLAN, new CacheConfiguration(Policy.LRU, 60*60*8, config.getPreparedPlanCacheMaxCount()));
+ prepPlanCache.setBufferManager(this.bufferManager);
+
+
+ this.processWorkerPool = new ThreadReuseExecutor(DQPConfiguration.PROCESS_PLAN_QUEUE_NAME, config.getMaxThreads());
+
+ if (cacheFactory.isReplicated()) {
+ matTables = new SessionAwareCache<CachedResults>();
+ }
+
+ dataTierMgr = new TempTableDataManager(new DataTierManagerImpl(this,
+ this.bufferService), this.bufferManager, this.processWorkerPool, this.rsCache, matTables, this.cacheFactory);
+ }
+
+ public void setBufferService(BufferService service) {
+ this.bufferService = service;
+ }
+
+ public void setTransactionService(TransactionService service) {
+ this.transactionService = service;
+ }
+
+ @Override
+ public boolean cancelRequest(long requestID)
+ throws TeiidProcessingException, TeiidComponentException {
+ DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ return this.cancelRequest(workContext.getRequestID(requestID));
+ }
+
+ // local txn
+ public ResultsFuture<?> begin() throws XATransactionException {
+ String threadId = DQPWorkContext.getWorkContext().getSessionId();
+ this.getTransactionService().begin(threadId);
+ return ResultsFuture.NULL_FUTURE;
+ }
+
+ // local txn
+ public ResultsFuture<?> commit() throws XATransactionException {
+ final String threadId = DQPWorkContext.getWorkContext().getSessionId();
+ Callable<Void> processor = new Callable<Void>() {
+ @Override
+ public Void call() throws Exception {
+ getTransactionService().commit(threadId);
+ return null;
+ }
+ };
+ return addWork(processor, 0);
+ }
+
+ // local txn
+ public ResultsFuture<?> rollback() throws XATransactionException {
+ final String threadId = DQPWorkContext.getWorkContext().getSessionId();
+ Callable<Void> processor = new Callable<Void>() {
+ @Override
+ public Void call() throws Exception {
+ getTransactionService().rollback(threadId);
+ return null;
+ }
+ };
+ return addWork(processor, 0);
+ }
+
+ // global txn
+ public ResultsFuture<?> commit(final XidImpl xid, final boolean onePhase) throws XATransactionException {
+ Callable<Void> processor = new Callable<Void>() {
+ @Override
+ public Void call() throws Exception {
+ DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ getTransactionService().commit(workContext.getSessionId(), xid, onePhase, workContext.getSession().isEmbedded());
+ return null;
+ }
+ };
+ return addWork(processor, 0);
+ }
+ // global txn
+ public ResultsFuture<?> end(XidImpl xid, int flags) throws XATransactionException {
+ DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ this.getTransactionService().end(workContext.getSessionId(), xid, flags, workContext.getSession().isEmbedded());
+ return ResultsFuture.NULL_FUTURE;
+ }
+ // global txn
+ public ResultsFuture<?> forget(XidImpl xid) throws XATransactionException {
+ DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ this.getTransactionService().forget(workContext.getSessionId(), xid, workContext.getSession().isEmbedded());
+ return ResultsFuture.NULL_FUTURE;
+ }
+
+ // global txn
+ public ResultsFuture<Integer> prepare(final XidImpl xid) throws XATransactionException {
+ Callable<Integer> processor = new Callable<Integer>() {
+ @Override
+ public Integer call() throws Exception {
+ DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ return getTransactionService().prepare(workContext.getSessionId(),xid, workContext.getSession().isEmbedded());
+ }
+ };
+ return addWork(processor, 10);
+ }
+
+ <T> ResultsFuture<T> addWork(Callable<T> processor, int priority) {
+ FutureWork<T> work = new FutureWork<T>(processor, priority);
+ this.addWork(work);
+ return work.getResult();
+ }
+
+ // global txn
+ public ResultsFuture<Xid[]> recover(int flag) throws XATransactionException {
+ ResultsFuture<Xid[]> result = new ResultsFuture<Xid[]>();
+ DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ result.getResultsReceiver().receiveResults(this.getTransactionService().recover(flag, workContext.getSession().isEmbedded()));
+ return result;
+ }
+ // global txn
+ public ResultsFuture<?> rollback(final XidImpl xid) throws XATransactionException {
+ Callable<Void> processor = new Callable<Void>() {
+ @Override
+ public Void call() throws Exception {
+ DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ getTransactionService().rollback(workContext.getSessionId(),xid, workContext.getSession().isEmbedded());
+ return null;
+ }
+ };
+ return addWork(processor, 0);
+ }
+ // global txn
+ public ResultsFuture<?> start(final XidImpl xid, final int flags, final int timeout)
+ throws XATransactionException {
+ Callable<Void> processor = new Callable<Void>() {
+ @Override
+ public Void call() throws Exception {
+ DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ getTransactionService().start(workContext.getSessionId(), xid, flags, timeout, workContext.getSession().isEmbedded());
+ return null;
+ }
+ };
+ return addWork(processor, 100);
+ }
+
+ public MetadataResult getMetadata(long requestID)
+ throws TeiidComponentException, TeiidProcessingException {
+ DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ MetaDataProcessor processor = new MetaDataProcessor(this, this.prepPlanCache, workContext.getVdbName(), workContext.getVdbVersion());
+ return processor.processMessage(workContext.getRequestID(requestID), workContext, null, true);
+ }
+
+ public MetadataResult getMetadata(long requestID, String preparedSql,
+ boolean allowDoubleQuotedVariable)
+ throws TeiidComponentException, TeiidProcessingException {
+ DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ MetaDataProcessor processor = new MetaDataProcessor(this, this.prepPlanCache, workContext.getVdbName(), workContext.getVdbVersion());
+ return processor.processMessage(workContext.getRequestID(requestID), workContext, preparedSql, allowDoubleQuotedVariable);
+ }
+
+ public boolean isExceptionOnMaxSourceRows() {
+ return exceptionOnMaxSourceRows;
+ }
+
+ public int getMaxSourceRows() {
+ return maxSourceRows;
+ }
+
+ public void setCacheFactory(CacheFactory factory) {
+ this.cacheFactory = factory;
+ }
+
+}
\ No newline at end of file
Deleted: tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java
===================================================================
--- branches/7.2.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java 2010-11-05 03:19:55 UTC (rev 2709)
@@ -1,249 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.dqp.internal.process;
-
-import java.io.Serializable;
-import java.security.Principal;
-import java.security.acl.Group;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.FutureTask;
-
-import javax.security.auth.Subject;
-
-import org.teiid.adminapi.DataPolicy;
-import org.teiid.adminapi.impl.SessionMetadata;
-import org.teiid.adminapi.impl.VDBMetaData;
-import org.teiid.client.security.SessionToken;
-import org.teiid.dqp.message.RequestID;
-import org.teiid.security.SecurityHelper;
-
-
-public class DQPWorkContext implements Serializable {
-
- private static final long serialVersionUID = -6389893410233192977L;
-
- private static ThreadLocal<DQPWorkContext> CONTEXTS = new ThreadLocal<DQPWorkContext>() {
- protected DQPWorkContext initialValue() {
- return new DQPWorkContext();
- }
- };
-
- public static DQPWorkContext getWorkContext() {
- return CONTEXTS.get();
- }
-
- public static void setWorkContext(DQPWorkContext context) {
- CONTEXTS.set(context);
- }
-
- public static void releaseWorkContext() {
- CONTEXTS.set(null);
- }
-
- private SessionMetadata session = new SessionMetadata();
- private String clientAddress;
- private String clientHostname;
- private SecurityHelper securityHelper;
- private HashMap<String, DataPolicy> policies;
-
- public DQPWorkContext() {
- }
-
- public SessionMetadata getSession() {
- return session;
- }
-
- public void setSession(SessionMetadata session) {
- this.session = session;
- this.policies = null;
- }
-
- public void setSecurityHelper(SecurityHelper securityHelper) {
- this.securityHelper = securityHelper;
- }
-
- /**
- * @return
- */
- public String getUserName() {
- return session.getUserName();
- }
-
- public Subject getSubject() {
- if (session.getLoginContext() != null) {
- return session.getLoginContext().getSubject();
- }
- return null;
- }
-
- /**
- * @return
- */
- public String getVdbName() {
- return session.getVDBName();
- }
-
- /**
- * @return
- */
- public int getVdbVersion() {
- return session.getVDBVersion();
- }
-
- public String getSessionId() {
- return this.session.getSessionId();
- }
-
- public String getAppName() {
- return session.getApplicationName();
- }
-
- public RequestID getRequestID(long exeuctionId) {
- return new RequestID(this.getSessionId(), exeuctionId);
- }
-
- public SessionToken getSessionToken() {
- return session.getSessionToken();
- }
-
- public void setClientAddress(String clientAddress) {
- this.clientAddress = clientAddress;
- }
-
- /**
- * Get the client address from the socket transport - not as reported from the client
- * @return
- */
- public String getClientAddress() {
- return clientAddress;
- }
-
- public void setClientHostname(String clientHostname) {
- this.clientHostname = clientHostname;
- }
-
- /**
- * Get the client hostname from the socket transport - not as reported from the client
- * @return
- */
- public String getClientHostname() {
- return clientHostname;
- }
-
- public String getSecurityDomain() {
- return this.session.getSecurityDomain();
- }
-
- public Object getSecurityContext() {
- return session.getSecurityContext();
- }
-
- public VDBMetaData getVDB() {
- return session.getVdb();
- }
-
- public <V> V runInContext(Callable<V> callable) throws Throwable {
- FutureTask<V> task = new FutureTask<V>(callable);
- runInContext(task);
- try {
- return task.get();
- } catch (ExecutionException e) {
- throw e.getCause();
- }
- }
-
- public void runInContext(final Runnable runnable) {
- DQPWorkContext.setWorkContext(this);
- boolean associated = false;
- if (securityHelper != null && this.getSubject() != null) {
- associated = securityHelper.assosiateSecurityContext(this.getSecurityDomain(), this.getSecurityContext());
- }
- try {
- runnable.run();
- } finally {
- if (associated) {
- securityHelper.clearSecurityContext(this.getSecurityDomain());
- }
- DQPWorkContext.releaseWorkContext();
- }
- }
-
- public HashMap<String, DataPolicy> getAllowedDataPolicies() {
- if (this.policies == null) {
- this.policies = new HashMap<String, DataPolicy>();
- Set<String> userRoles = getUserRoles();
- if (userRoles.isEmpty()) {
- return this.policies;
- }
-
- // get data roles from the VDB
- for (DataPolicy policy : getVDB().getDataPolicies()) {
- if (matchesPrincipal(userRoles, policy)) {
- this.policies.put(policy.getName(), policy);
- }
- }
- }
- return this.policies;
- }
-
- private boolean matchesPrincipal(Set<String> userRoles, DataPolicy policy) {
- if (policy.isAnyAuthenticated()) {
- return true;
- }
- List<String> roles = policy.getMappedRoleNames();
- for (String role:roles) {
- if (userRoles.contains(role)) {
- return true;
- }
- }
- return false;
- }
-
- private Set<String> getUserRoles() {
- Set<String> roles = new HashSet<String>();
-
- if (getSubject() == null) {
- return Collections.emptySet();
- }
-
- Set<Principal> principals = getSubject().getPrincipals();
- for(Principal p: principals) {
- // this JBoss specific, but no code level dependencies
- if ((p instanceof Group) && p.getName().equals("Roles")){ //$NON-NLS-1$
- Group g = (Group)p;
- Enumeration<? extends Principal> rolesPrinciples = g.members();
- while(rolesPrinciples.hasMoreElements()) {
- roles.add(rolesPrinciples.nextElement().getName());
- }
- }
- }
- return roles;
- }
-}
Copied: tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java (from rev 2707, branches/7.2.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java)
===================================================================
--- tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java (rev 0)
+++ tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/DQPWorkContext.java 2010-11-05 03:19:55 UTC (rev 2709)
@@ -0,0 +1,239 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.dqp.internal.process;
+
+import java.io.Serializable;
+import java.security.Principal;
+import java.security.acl.Group;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.FutureTask;
+
+import javax.security.auth.Subject;
+
+import org.teiid.adminapi.DataPolicy;
+import org.teiid.adminapi.impl.SessionMetadata;
+import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.client.security.SessionToken;
+import org.teiid.dqp.message.RequestID;
+import org.teiid.security.SecurityHelper;
+
+
+public class DQPWorkContext implements Serializable {
+
+ private static final long serialVersionUID = -6389893410233192977L;
+
+ private static ThreadLocal<DQPWorkContext> CONTEXTS = new ThreadLocal<DQPWorkContext>() {
+ protected DQPWorkContext initialValue() {
+ return new DQPWorkContext();
+ }
+ };
+
+ public static DQPWorkContext getWorkContext() {
+ return CONTEXTS.get();
+ }
+
+ public static void setWorkContext(DQPWorkContext context) {
+ CONTEXTS.set(context);
+ }
+
+ public static void releaseWorkContext() {
+ CONTEXTS.set(null);
+ }
+
+ private SessionMetadata session = new SessionMetadata();
+ private String clientAddress;
+ private String clientHostname;
+ private SecurityHelper securityHelper;
+ private HashMap<String, DataPolicy> policies;
+
+ public DQPWorkContext() {
+ }
+
+ public SessionMetadata getSession() {
+ return session;
+ }
+
+ public void setSession(SessionMetadata session) {
+ this.session = session;
+ this.policies = null;
+ }
+
+ public void setSecurityHelper(SecurityHelper securityHelper) {
+ this.securityHelper = securityHelper;
+ }
+
+ /**
+ * @return
+ */
+ public String getUserName() {
+ return session.getUserName();
+ }
+
+ public Subject getSubject() {
+ if (session.getLoginContext() != null) {
+ return session.getLoginContext().getSubject();
+ }
+ return null;
+ }
+
+ /**
+ * @return
+ */
+ public String getVdbName() {
+ return session.getVDBName();
+ }
+
+ /**
+ * @return
+ */
+ public int getVdbVersion() {
+ return session.getVDBVersion();
+ }
+
+ public String getSessionId() {
+ return this.session.getSessionId();
+ }
+
+ public String getAppName() {
+ return session.getApplicationName();
+ }
+
+ public RequestID getRequestID(long exeuctionId) {
+ return new RequestID(this.getSessionId(), exeuctionId);
+ }
+
+ public SessionToken getSessionToken() {
+ return session.getSessionToken();
+ }
+
+ public void setClientAddress(String clientAddress) {
+ this.clientAddress = clientAddress;
+ }
+
+ /**
+ * Get the client address from the socket transport - not as reported from the client
+ * @return
+ */
+ public String getClientAddress() {
+ return clientAddress;
+ }
+
+ public void setClientHostname(String clientHostname) {
+ this.clientHostname = clientHostname;
+ }
+
+ /**
+ * Get the client hostname from the socket transport - not as reported from the client
+ * @return
+ */
+ public String getClientHostname() {
+ return clientHostname;
+ }
+
+ public String getSecurityDomain() {
+ return this.session.getSecurityDomain();
+ }
+
+ public Object getSecurityContext() {
+ return session.getSecurityContext();
+ }
+
+ public VDBMetaData getVDB() {
+ return session.getVdb();
+ }
+
+ public <V> V runInContext(Callable<V> callable) throws Throwable {
+ FutureTask<V> task = new FutureTask<V>(callable);
+ runInContext(task);
+ try {
+ return task.get();
+ } catch (ExecutionException e) {
+ throw e.getCause();
+ }
+ }
+
+ public void runInContext(final Runnable runnable) {
+ DQPWorkContext.setWorkContext(this);
+ boolean associated = false;
+ if (securityHelper != null && this.getSubject() != null) {
+ associated = securityHelper.assosiateSecurityContext(this.getSecurityDomain(), this.getSecurityContext());
+ }
+ try {
+ runnable.run();
+ } finally {
+ if (associated) {
+ securityHelper.clearSecurityContext(this.getSecurityDomain());
+ }
+ DQPWorkContext.releaseWorkContext();
+ }
+ }
+
+ public HashMap<String, DataPolicy> getAllowedDataPolicies() {
+ if (this.policies == null) {
+ this.policies = new HashMap<String, DataPolicy>();
+ Set<String> userRoles = getUserRoles();
+
+ // get data roles from the VDB
+ for (DataPolicy policy : getVDB().getDataPolicies()) {
+ if (matchesPrincipal(userRoles, policy)) {
+ this.policies.put(policy.getName(), policy);
+ }
+ }
+ }
+ return this.policies;
+ }
+
+ private boolean matchesPrincipal(Set<String> userRoles, DataPolicy policy) {
+ if (policy.isAnyAuthenticated()) {
+ return true;
+ }
+ return !Collections.disjoint(policy.getMappedRoleNames(), userRoles);
+ }
+
+ private Set<String> getUserRoles() {
+ Set<String> roles = new HashSet<String>();
+
+ if (getSubject() == null) {
+ return Collections.emptySet();
+ }
+
+ Set<Principal> principals = getSubject().getPrincipals();
+ for(Principal p: principals) {
+ // this JBoss specific, but no code level dependencies
+ if ((p instanceof Group) && p.getName().equals("Roles")){ //$NON-NLS-1$
+ Group g = (Group)p;
+ Enumeration<? extends Principal> rolesPrinciples = g.members();
+ while(rolesPrinciples.hasMoreElements()) {
+ roles.add(rolesPrinciples.nextElement().getName());
+ }
+ }
+ }
+ return roles;
+ }
+}
Deleted: tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
===================================================================
--- branches/7.2.x/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2010-11-05 03:19:55 UTC (rev 2709)
@@ -1,723 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.dqp.internal.process;
-
-import java.sql.ResultSet;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.teiid.client.RequestMessage;
-import org.teiid.client.ResultsMessage;
-import org.teiid.client.SourceWarning;
-import org.teiid.client.RequestMessage.ShowPlan;
-import org.teiid.client.lob.LobChunk;
-import org.teiid.client.metadata.ParameterInfo;
-import org.teiid.client.util.ResultsReceiver;
-import org.teiid.client.xa.XATransactionException;
-import org.teiid.common.buffer.BlockedException;
-import org.teiid.common.buffer.TupleBatch;
-import org.teiid.common.buffer.TupleBuffer;
-import org.teiid.core.TeiidComponentException;
-import org.teiid.core.TeiidException;
-import org.teiid.core.TeiidProcessingException;
-import org.teiid.core.types.DataTypeManager;
-import org.teiid.dqp.internal.process.SessionAwareCache.CacheID;
-import org.teiid.dqp.internal.process.ThreadReuseExecutor.PrioritizedRunnable;
-import org.teiid.dqp.message.AtomicRequestID;
-import org.teiid.dqp.message.RequestID;
-import org.teiid.dqp.service.TransactionContext;
-import org.teiid.dqp.service.TransactionService;
-import org.teiid.dqp.service.TransactionContext.Scope;
-import org.teiid.logging.LogConstants;
-import org.teiid.logging.LogManager;
-import org.teiid.logging.MessageLevel;
-import org.teiid.logging.CommandLogMessage.Event;
-import org.teiid.query.QueryPlugin;
-import org.teiid.query.analysis.AnalysisRecord;
-import org.teiid.query.function.metadata.FunctionMethod;
-import org.teiid.query.parser.ParseInfo;
-import org.teiid.query.processor.BatchCollector;
-import org.teiid.query.processor.QueryProcessor;
-import org.teiid.query.sql.lang.Command;
-import org.teiid.query.sql.lang.SPParameter;
-import org.teiid.query.sql.lang.StoredProcedure;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
-
-public class RequestWorkItem extends AbstractWorkItem implements PrioritizedRunnable {
-
- private enum ProcessingState {NEW, PROCESSING, CLOSE}
- private ProcessingState state = ProcessingState.NEW;
-
- private enum TransactionState {NONE, ACTIVE, DONE}
- private TransactionState transactionState = TransactionState.NONE;
-
- /*
- * Obtained at construction time
- */
- protected final DQPCore dqpCore;
- final RequestMessage requestMsg;
- final RequestID requestID;
- private Request request; //provides the processing plan, held on a temporary basis
- private final int processorTimeslice;
- private CacheID cid;
- private final TransactionService transactionService;
- private final DQPWorkContext dqpWorkContext;
- boolean active;
-
- /*
- * obtained during new
- */
- private volatile QueryProcessor processor;
- private BatchCollector collector;
- private Command originalCommand;
- private AnalysisRecord analysisRecord;
- private TransactionContext transactionContext;
- TupleBuffer resultsBuffer;
- private boolean returnsUpdateCount;
-
- /*
- * maintained during processing
- */
- private Throwable processingException;
- private Map<AtomicRequestID, DataTierTupleSource> connectorInfo = new ConcurrentHashMap<AtomicRequestID, DataTierTupleSource>(4);
- // This exception contains details of all the atomic requests that failed when query is run in partial results mode.
- private List<TeiidException> warnings = new LinkedList<TeiidException>();
- private volatile boolean doneProducingBatches;
- private volatile boolean isClosed;
- private volatile boolean isCanceled;
- private volatile boolean closeRequested;
-
- //results request
- private ResultsReceiver<ResultsMessage> resultsReceiver;
- private int begin;
- private int end;
- private TupleBatch savedBatch;
- private Map<Integer, LobWorkItem> lobStreams = new ConcurrentHashMap<Integer, LobWorkItem>(4);
-
- /**The time when command begins processing on the server.*/
- private long processingTimestamp = System.currentTimeMillis();
-
- public RequestWorkItem(DQPCore dqpCore, RequestMessage requestMsg, Request request, ResultsReceiver<ResultsMessage> receiver, RequestID requestID, DQPWorkContext workContext) {
- this.requestMsg = requestMsg;
- this.requestID = requestID;
- this.processorTimeslice = dqpCore.getProcessorTimeSlice();
- this.transactionService = dqpCore.getTransactionService();
- this.dqpCore = dqpCore;
- this.request = request;
- this.dqpWorkContext = workContext;
- this.requestResults(1, requestMsg.getFetchSize(), receiver);
- }
-
- private boolean isForwardOnly() {
- return this.cid == null && requestMsg.getCursorType() == ResultSet.TYPE_FORWARD_ONLY;
- }
-
- /**
- * Ask for results.
- * @param beginRow
- * @param endRow
- */
- synchronized void requestResults(int beginRow, int endRow, ResultsReceiver<ResultsMessage> receiver) {
- if (this.resultsReceiver != null) {
- throw new IllegalStateException("Results already requested"); //$NON-NLS-1$\
- }
- this.resultsReceiver = receiver;
- this.begin = beginRow;
- this.end = endRow;
- }
-
- @Override
- protected boolean isDoneProcessing() {
- return isClosed;
- }
-
- @Override
- protected void resumeProcessing() {
- if (doneProducingBatches && !closeRequested && !isCanceled) {
- this.run(); // just run in the IO thread
- } else {
- dqpCore.addWork(this);
- }
- }
-
- @Override
- protected void process() {
- LogManager.logDetail(LogConstants.CTX_DQP, "Request Thread", requestID, "with state", state); //$NON-NLS-1$ //$NON-NLS-2$
- try {
- if (this.state == ProcessingState.NEW) {
- state = ProcessingState.PROCESSING;
- processNew();
- if (isCanceled) {
- this.processingException = new TeiidProcessingException(QueryPlugin.Util.getString("QueryProcessor.request_cancelled", this.requestID)); //$NON-NLS-1$
- state = ProcessingState.CLOSE;
- }
- }
-
- resume();
-
- if (this.state == ProcessingState.PROCESSING) {
- processMore();
- if (this.closeRequested) {
- this.state = ProcessingState.CLOSE;
- }
- }
- } catch (BlockedException e) {
- LogManager.logDetail(LogConstants.CTX_DQP, "Request Thread", requestID, "- processor blocked"); //$NON-NLS-1$ //$NON-NLS-2$
- } catch (QueryProcessor.ExpiredTimeSliceException e) {
- LogManager.logDetail(LogConstants.CTX_DQP, "Request Thread", requestID, "- time slice expired"); //$NON-NLS-1$ //$NON-NLS-2$
- this.moreWork();
- } catch (Throwable e) {
- LogManager.logDetail(LogConstants.CTX_DQP, e, "Request Thread", requestID, "- error occurred"); //$NON-NLS-1$ //$NON-NLS-2$
-
- if (!isCanceled()) {
- dqpCore.logMMCommand(this, Event.ERROR, null);
- //Case 5558: Differentiate between system level errors and
- //processing errors. Only log system level errors as errors,
- //log the processing errors as warnings only
- if(e instanceof TeiidProcessingException) {
- Throwable cause = e;
- while (cause.getCause() != null && cause.getCause() != cause) {
- cause = cause.getCause();
- }
- StackTraceElement elem = cause.getStackTrace()[0];
- LogManager.logWarning(LogConstants.CTX_DQP, QueryPlugin.Util.getString("ProcessWorker.processing_error", e.getMessage(), requestID, e.getClass().getName(), elem)); //$NON-NLS-1$
- }else {
- LogManager.logError(LogConstants.CTX_DQP, e, QueryPlugin.Util.getString("ProcessWorker.error", requestID)); //$NON-NLS-1$
- }
- }
-
- this.processingException = e;
- this.state = ProcessingState.CLOSE;
- } finally {
- if (this.state == ProcessingState.CLOSE && !isClosed) {
- attemptClose();
- } else if (isClosed) {
- /*
- * since there may be a client waiting notify them of a problem
- */
- if (this.processingException == null) {
- this.processingException = new IllegalStateException("Request is already closed"); //$NON-NLS-1$
- }
- sendError();
- }
- suspend();
- }
- }
-
- private void resume() throws XATransactionException {
- if (this.transactionState == TransactionState.ACTIVE && this.transactionContext.getTransaction() != null) {
- this.transactionService.resume(this.transactionContext);
- }
- }
-
- private void suspend() {
- try {
- this.transactionService.suspend(this.transactionContext);
- } catch (XATransactionException e) {
- LogManager.logDetail(LogConstants.CTX_DQP, e, "Error suspending active transaction"); //$NON-NLS-1$
- }
- }
-
- protected void processMore() throws BlockedException, TeiidException {
- if (!doneProducingBatches) {
- this.processor.getContext().setTimeSliceEnd(System.currentTimeMillis() + this.processorTimeslice);
- sendResultsIfNeeded(null);
- collector.collectTuples();
- }
- if (doneProducingBatches) {
- if (this.transactionState == TransactionState.ACTIVE) {
- /*
- * TEIID-14 if we are done producing batches, then proactively close transactional
- * executions even ones that were intentionally kept alive. this may
- * break the read of a lob from a transactional source under a transaction
- * if the source does not support holding the clob open after commit
- */
- for (DataTierTupleSource connectorRequest : this.connectorInfo.values()) {
- if (connectorRequest.isTransactional()) {
- connectorRequest.fullyCloseSource();
- }
- }
- this.transactionState = TransactionState.DONE;
- if (transactionContext.getTransactionType() == TransactionContext.Scope.REQUEST) {
- this.transactionService.commit(transactionContext);
- } else {
- suspend();
- }
- }
- sendResultsIfNeeded(null);
- } else {
- moreWork(false); // If the timeslice expired, then the processor can probably produce more batches.
- if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
- LogManager.logDetail(LogConstants.CTX_DQP, "############# PW EXITING on " + requestID + " - reenqueueing for more processing ###########"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- }
-
- /**
- * Client close is currently implemented as asynch.
- * Any errors that occur will not make it to the client, instead we just log them here.
- */
- protected void attemptClose() {
- int rowcount = -1;
- if (this.resultsBuffer != null) {
- if (this.processor != null) {
- this.processor.closeProcessing();
-
- if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
- LogManager.logDetail(LogConstants.CTX_DQP, "Removing tuplesource for the request " + requestID); //$NON-NLS-1$
- }
- rowcount = resultsBuffer.getRowCount();
- if (this.cid == null || !this.doneProducingBatches) {
- resultsBuffer.remove();
- }
-
- for (DataTierTupleSource connectorRequest : this.connectorInfo.values()) {
- connectorRequest.fullyCloseSource();
- }
- }
-
- this.resultsBuffer = null;
-
- for (LobWorkItem lobWorkItem : this.lobStreams.values()) {
- lobWorkItem.close();
- }
- }
-
- if (this.transactionState == TransactionState.ACTIVE) {
- this.transactionState = TransactionState.DONE;
- if (transactionContext.getTransactionType() == TransactionContext.Scope.REQUEST) {
- try {
- this.transactionService.rollback(transactionContext);
- } catch (XATransactionException e1) {
- LogManager.logWarning(LogConstants.CTX_DQP, e1, QueryPlugin.Util.getString("ProcessWorker.failed_rollback")); //$NON-NLS-1$
- }
- } else {
- suspend();
- }
- }
-
- isClosed = true;
-
- dqpCore.removeRequest(this);
-
- if (this.processingException != null) {
- sendError();
- } else {
- dqpCore.logMMCommand(this, Event.END, rowcount);
- }
- }
-
- protected void processNew() throws TeiidProcessingException, TeiidComponentException {
- SessionAwareCache<CachedResults> rsCache = dqpCore.getRsCache();
- ParseInfo pi = Request.createParseInfo(requestMsg);
- CacheID cacheId = new CacheID(this.dqpWorkContext, pi, requestMsg.getCommandString());
- boolean cachable = cacheId.setParameters(requestMsg.getParameterValues());
- if (rsCache != null && cachable) {
- CachedResults cr = rsCache.get(cacheId);
- if (cr != null && (requestMsg.useResultSetCache() || cr.getHint() != null)) {
- this.resultsBuffer = cr.getResults();
- this.analysisRecord = cr.getAnalysisRecord();
- request.initMetadata();
- this.originalCommand = cr.getCommand(requestMsg.getCommandString(), request.metadata, pi);
- request.validateAccess(this.originalCommand);
- this.doneProducingBatches();
- return;
- }
- }
- request.processRequest();
- originalCommand = request.userCommand;
- if (cachable && (requestMsg.useResultSetCache() || originalCommand.getCacheHint() != null) && rsCache != null && originalCommand.areResultsCachable()) {
- this.cid = cacheId;
- }
- processor = request.processor;
- resultsBuffer = processor.createTupleBuffer();
- if (this.cid != null && originalCommand.getCacheHint() != null) {
- resultsBuffer.setPrefersMemory(originalCommand.getCacheHint().getPrefersMemory());
- }
- collector = new BatchCollector(processor, resultsBuffer) {
- protected void flushBatchDirect(TupleBatch batch, boolean add) throws TeiidComponentException,TeiidProcessingException {
- boolean added = false;
- if (cid != null || resultsBuffer.isLobs()) {
- super.flushBatchDirect(batch, add);
- added = true;
- }
- if (batch.getTerminationFlag()) {
- doneProducingBatches();
- }
- if (doneProducingBatches && cid != null) {
- int determinismLevel = processor.getContext().getDeterminismLevel();
- CachedResults cr = new CachedResults();
- cr.setCommand(originalCommand);
- cr.setAnalysisRecord(analysisRecord);
- cr.setResults(resultsBuffer);
- if (determinismLevel > FunctionMethod.SESSION_DETERMINISTIC) {
- LogManager.logInfo(LogConstants.CTX_DQP, QueryPlugin.Util.getString("RequestWorkItem.cache_nondeterministic", originalCommand)); //$NON-NLS-1$
- }
- dqpCore.getRsCache().put(cid, determinismLevel, cr, originalCommand.getCacheHint() != null?originalCommand.getCacheHint().getTtl():null);
- }
- add = sendResultsIfNeeded(batch);
- if (!added) {
- super.flushBatchDirect(batch, add);
- }
- }
- };
- resultsBuffer = collector.getTupleBuffer();
- resultsBuffer.setForwardOnly(isForwardOnly());
- analysisRecord = request.analysisRecord;
- analysisRecord.setQueryPlan(processor.getProcessorPlan().getDescriptionProperties());
- transactionContext = request.transactionContext;
- if (this.transactionContext != null && this.transactionContext.getTransactionType() != Scope.NONE) {
- this.transactionState = TransactionState.ACTIVE;
- }
- if (requestMsg.isNoExec()) {
- doneProducingBatches();
- resultsBuffer.close();
- this.cid = null;
- }
- this.returnsUpdateCount = request.returnsUpdateCount;
- request = null;
- }
-
- /**
- * Send results if they have been requested. This should only be called from the processing thread.
- */
- protected boolean sendResultsIfNeeded(TupleBatch batch) throws TeiidComponentException {
- ResultsMessage response = null;
- ResultsReceiver<ResultsMessage> receiver = null;
- boolean result = true;
- synchronized (this) {
- if (this.resultsReceiver == null
- || (this.begin > (batch != null?batch.getEndRow():this.resultsBuffer.getRowCount()) && !doneProducingBatches)
- || (this.transactionState == TransactionState.ACTIVE)) {
- return result;
- }
-
- if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
- LogManager.logDetail(LogConstants.CTX_DQP, "[RequestWorkItem.sendResultsIfNeeded] requestID:", requestID, "resultsID:", this.resultsBuffer, "done:", doneProducingBatches ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- //TODO: support fetching more than 1 batch
- boolean fromBuffer = false;
- if (batch == null || !(batch.containsRow(this.begin) || (batch.getTerminationFlag() && batch.getEndRow() <= this.begin))) {
- if (savedBatch != null && savedBatch.containsRow(this.begin)) {
- batch = savedBatch;
- } else {
- batch = resultsBuffer.getBatch(begin);
- }
- savedBatch = null;
- fromBuffer = true;
- }
- int count = this.end - this.begin + 1;
- if (batch.getRowCount() > count) {
- int beginRow = Math.min(this.begin, batch.getEndRow() - count + 1);
- int endRow = Math.min(beginRow + count - 1, batch.getEndRow());
- boolean last = false;
- if (endRow == batch.getEndRow()) {
- last = batch.getTerminationFlag();
- } else if (fromBuffer && isForwardOnly()) {
- savedBatch = batch;
- }
- List<List<?>> memoryRows = batch.getTuples();
- batch = new TupleBatch(beginRow, memoryRows.subList(beginRow - batch.getBeginRow(), endRow - batch.getBeginRow() + 1));
- batch.setTerminationFlag(last);
- } else if (!fromBuffer){
- result = !isForwardOnly();
- }
- int finalRowCount = this.resultsBuffer.isFinal()?this.resultsBuffer.getRowCount():(batch.getTerminationFlag()?batch.getEndRow():-1);
-
- response = createResultsMessage(batch.getAllTuples(), this.originalCommand.getProjectedSymbols());
- response.setFirstRow(batch.getBeginRow());
- response.setLastRow(batch.getEndRow());
- response.setUpdateResult(this.returnsUpdateCount);
- // set final row
- response.setFinalRow(finalRowCount);
-
- // send any warnings with the response object
- List<Throwable> responseWarnings = new ArrayList<Throwable>();
- if (this.processor != null) {
- List<Exception> currentWarnings = processor.getAndClearWarnings();
- if (currentWarnings != null) {
- responseWarnings.addAll(currentWarnings);
- }
- }
- synchronized (warnings) {
- responseWarnings.addAll(this.warnings);
- this.warnings.clear();
- }
- response.setWarnings(responseWarnings);
-
- // If it is stored procedure, set parameters
- if (originalCommand instanceof StoredProcedure) {
- StoredProcedure proc = (StoredProcedure)originalCommand;
- if (proc.returnParameters()) {
- response.setParameters(getParameterInfo(proc));
- }
- }
- /*
- * mark the results sent at this point.
- * communication exceptions will be treated as non-recoverable
- */
- receiver = this.resultsReceiver;
- this.resultsReceiver = null;
- }
- receiver.receiveResults(response);
- return result;
- }
-
- public ResultsMessage createResultsMessage(List[] batch, List columnSymbols) {
- String[] columnNames = new String[columnSymbols.size()];
- String[] dataTypes = new String[columnSymbols.size()];
-
- for(int i=0; i<columnSymbols.size(); i++) {
- SingleElementSymbol symbol = (SingleElementSymbol) columnSymbols.get(i);
- columnNames[i] = SingleElementSymbol.getShortName(symbol.getOutputName());
- dataTypes[i] = DataTypeManager.getDataTypeName(symbol.getType());
- }
- ResultsMessage result = new ResultsMessage(requestMsg, batch, columnNames, dataTypes);
- setAnalysisRecords(result);
- return result;
- }
-
- private void setAnalysisRecords(ResultsMessage response) {
- if(analysisRecord != null) {
- if (requestMsg.getShowPlan() != ShowPlan.OFF) {
- if (processor != null) {
- analysisRecord.setQueryPlan(processor.getProcessorPlan().getDescriptionProperties());
- }
- response.setPlanDescription(analysisRecord.getQueryPlan());
- response.setAnnotations(analysisRecord.getAnnotations());
- }
- if (requestMsg.getShowPlan() == ShowPlan.DEBUG) {
- response.setDebugLog(analysisRecord.getDebugLog());
- }
- }
- }
-
- private void sendError() {
- synchronized (this) {
- if (this.resultsReceiver == null) {
- LogManager.logDetail(LogConstants.CTX_DQP, processingException, "Unable to send error to client as results were already sent.", requestID); //$NON-NLS-1$
- return;
- }
- }
- LogManager.logDetail(LogConstants.CTX_DQP, processingException, "Sending error to client", requestID); //$NON-NLS-1$
- ResultsMessage response = new ResultsMessage(requestMsg);
- response.setException(processingException);
- setAnalysisRecords(response);
- resultsReceiver.receiveResults(response);
- }
-
- private static List<ParameterInfo> getParameterInfo(StoredProcedure procedure) {
- List<ParameterInfo> paramInfos = new ArrayList<ParameterInfo>();
-
- for (SPParameter param : procedure.getParameters()) {
- ParameterInfo info = new ParameterInfo(param.getParameterType(), param.getResultSetColumns().size());
- paramInfos.add(info);
- }
-
- return paramInfos;
- }
-
- public void processLobChunkRequest(String id, int streamRequestId, ResultsReceiver<LobChunk> chunckReceiver) {
- LobWorkItem workItem = null;
- synchronized (lobStreams) {
- workItem = this.lobStreams.get(new Integer(streamRequestId));
- if (workItem == null) {
- workItem = new LobWorkItem(this, dqpCore, id, streamRequestId);
- lobStreams.put(new Integer(streamRequestId), workItem);
- }
- }
- workItem.setResultsReceiver(chunckReceiver);
- dqpCore.addWork(workItem);
- }
-
- public void removeLobStream(int streamRequestId) {
- this.lobStreams.remove(new Integer(streamRequestId));
- }
-
- public boolean requestCancel() throws TeiidComponentException {
- synchronized (this) {
- if (this.isCanceled || this.closeRequested) {
- return false;
- }
- this.isCanceled = true;
- }
- if (this.processor != null) {
- this.processor.requestCanceled();
- }
-
- // Cancel Connector atomic requests
- try {
- for (DataTierTupleSource connectorRequest : this.connectorInfo.values()) {
- connectorRequest.cancelRequest();
- }
- } finally {
- try {
- if (transactionService != null) {
- try {
- transactionService.cancelTransactions(requestID.getConnectionID(), true);
- } catch (XATransactionException err) {
- throw new TeiidComponentException(err);
- }
- }
- } finally {
- this.moreWork();
- }
- }
- return true;
- }
-
- public boolean requestAtomicRequestCancel(AtomicRequestID ari) throws TeiidComponentException {
- // in the case that this does not support partial results; cancel
- // the original processor request.
- if(!requestMsg.supportsPartialResults()) {
- return requestCancel();
- }
-
- DataTierTupleSource connectorRequest = this.connectorInfo.get(ari);
- if (connectorRequest != null) {
- connectorRequest.cancelRequest();
- return true;
- }
-
- LogManager.logDetail(LogConstants.CTX_DQP, "Connector request not found. AtomicRequestID=", ari); //$NON-NLS-1$
- return false;
- }
-
- public void requestClose() throws TeiidComponentException {
- synchronized (this) {
- if (this.state == ProcessingState.CLOSE || this.closeRequested) {
- if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
- LogManager.logDetail(LogConstants.CTX_DQP, "Request already closing" + requestID); //$NON-NLS-1$
- }
- return;
- }
- }
- this.closeRequested = true;
- if (!this.doneProducingBatches) {
- this.requestCancel(); //pending work should be canceled for fastest clean up
- }
- this.moreWork();
- }
-
- public void requestMore(int batchFirst, int batchLast, ResultsReceiver<ResultsMessage> receiver) {
- this.requestResults(batchFirst, batchLast, receiver);
- this.moreWork();
- }
-
- public void closeAtomicRequest(AtomicRequestID atomicRequestId) {
- connectorInfo.remove(atomicRequestId);
- LogManager.logTrace(LogConstants.CTX_DQP, new Object[] {"closed atomic-request:", atomicRequestId}); //$NON-NLS-1$
- }
-
- public void addConnectorRequest(AtomicRequestID atomicRequestId, DataTierTupleSource connInfo) {
- connectorInfo.put(atomicRequestId, connInfo);
- }
-
- /**
- * <p>This method add information to the warning on the work item for the given
- * <code>RequestID</code>. This method is called from <code>DataTierManager</code></p>
- */
- public void addSourceFailureDetails(SourceWarning details) {
- synchronized (warnings) {
- this.warnings.add(details);
- }
- }
-
- boolean isCanceled() {
- return isCanceled;
- }
-
- Command getOriginalCommand() throws TeiidProcessingException {
- if (this.originalCommand == null) {
- if (this.processingException != null) {
- throw new TeiidProcessingException(this.processingException);
- }
- throw new IllegalStateException("Original command is not available"); //$NON-NLS-1$
- }
- return this.originalCommand;
- }
-
- void setOriginalCommand(Command originalCommand) {
- this.originalCommand = originalCommand;
- }
-
- TransactionContext getTransactionContext() {
- return transactionContext;
- }
-
-
- Collection<DataTierTupleSource> getConnectorRequests() {
- return new LinkedList<DataTierTupleSource>(this.connectorInfo.values());
- }
-
- DataTierTupleSource getConnectorRequest(AtomicRequestID id) {
- return this.connectorInfo.get(id);
- }
-
- public List<TeiidException> getWarnings() {
- return warnings;
- }
-
- @Override
- public String toString() {
- return this.requestID.toString();
- }
-
- public DQPWorkContext getDqpWorkContext() {
- return dqpWorkContext;
- }
-
- public long getProcessingTimestamp() {
- return processingTimestamp;
- }
-
- @Override
- public void release() {
- try {
- requestCancel();
- } catch (TeiidComponentException e) {
- LogManager.logWarning(LogConstants.CTX_DQP, e, "Failed to cancel " + requestID); //$NON-NLS-1$
- }
- }
-
- private void doneProducingBatches() {
- this.doneProducingBatches = true;
- dqpCore.finishProcessing(this);
- }
-
- @Override
- public int getPriority() {
- return (closeRequested || isCanceled) ? 0 : 1000;
- }
-
- @Override
- public long getCreationTime() {
- return processingTimestamp;
- }
-
-}
\ No newline at end of file
Copied: tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java (from rev 2707, branches/7.2.x/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java)
===================================================================
--- tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java (rev 0)
+++ tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2010-11-05 03:19:55 UTC (rev 2709)
@@ -0,0 +1,739 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.dqp.internal.process;
+
+import java.sql.ResultSet;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.teiid.client.RequestMessage;
+import org.teiid.client.ResultsMessage;
+import org.teiid.client.SourceWarning;
+import org.teiid.client.RequestMessage.ShowPlan;
+import org.teiid.client.lob.LobChunk;
+import org.teiid.client.metadata.ParameterInfo;
+import org.teiid.client.util.ResultsReceiver;
+import org.teiid.client.xa.XATransactionException;
+import org.teiid.common.buffer.BlockedException;
+import org.teiid.common.buffer.TupleBatch;
+import org.teiid.common.buffer.TupleBuffer;
+import org.teiid.core.TeiidComponentException;
+import org.teiid.core.TeiidException;
+import org.teiid.core.TeiidProcessingException;
+import org.teiid.core.types.DataTypeManager;
+import org.teiid.dqp.internal.process.SessionAwareCache.CacheID;
+import org.teiid.dqp.internal.process.ThreadReuseExecutor.PrioritizedRunnable;
+import org.teiid.dqp.message.AtomicRequestID;
+import org.teiid.dqp.message.RequestID;
+import org.teiid.dqp.service.TransactionContext;
+import org.teiid.dqp.service.TransactionService;
+import org.teiid.dqp.service.TransactionContext.Scope;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.logging.MessageLevel;
+import org.teiid.logging.CommandLogMessage.Event;
+import org.teiid.query.QueryPlugin;
+import org.teiid.query.analysis.AnalysisRecord;
+import org.teiid.query.function.metadata.FunctionMethod;
+import org.teiid.query.parser.ParseInfo;
+import org.teiid.query.parser.QueryParser;
+import org.teiid.query.processor.BatchCollector;
+import org.teiid.query.processor.QueryProcessor;
+import org.teiid.query.sql.lang.Command;
+import org.teiid.query.sql.lang.SPParameter;
+import org.teiid.query.sql.lang.StoredProcedure;
+import org.teiid.query.sql.symbol.SingleElementSymbol;
+
+public class RequestWorkItem extends AbstractWorkItem implements PrioritizedRunnable {
+
+ private enum ProcessingState {NEW, PROCESSING, CLOSE}
+ private ProcessingState state = ProcessingState.NEW;
+
+ private enum TransactionState {NONE, ACTIVE, DONE}
+ private TransactionState transactionState = TransactionState.NONE;
+
+ /*
+ * Obtained at construction time
+ */
+ protected final DQPCore dqpCore;
+ final RequestMessage requestMsg;
+ final RequestID requestID;
+ private Request request; //provides the processing plan, held on a temporary basis
+ private final int processorTimeslice;
+ private CacheID cid;
+ private final TransactionService transactionService;
+ private final DQPWorkContext dqpWorkContext;
+ boolean active;
+
+ /*
+ * obtained during new
+ */
+ private volatile QueryProcessor processor;
+ private BatchCollector collector;
+ private Command originalCommand;
+ private AnalysisRecord analysisRecord;
+ private TransactionContext transactionContext;
+ TupleBuffer resultsBuffer;
+ private boolean returnsUpdateCount;
+
+ /*
+ * maintained during processing
+ */
+ private Throwable processingException;
+ private Map<AtomicRequestID, DataTierTupleSource> connectorInfo = new ConcurrentHashMap<AtomicRequestID, DataTierTupleSource>(4);
+ // This exception contains details of all the atomic requests that failed when query is run in partial results mode.
+ private List<TeiidException> warnings = new LinkedList<TeiidException>();
+ private volatile boolean doneProducingBatches;
+ private volatile boolean isClosed;
+ private volatile boolean isCanceled;
+ private volatile boolean closeRequested;
+
+ //results request
+ private ResultsReceiver<ResultsMessage> resultsReceiver;
+ private int begin;
+ private int end;
+ private TupleBatch savedBatch;
+ private Map<Integer, LobWorkItem> lobStreams = new ConcurrentHashMap<Integer, LobWorkItem>(4);
+
+ /**The time when command begins processing on the server.*/
+ private long processingTimestamp = System.currentTimeMillis();
+
+ public RequestWorkItem(DQPCore dqpCore, RequestMessage requestMsg, Request request, ResultsReceiver<ResultsMessage> receiver, RequestID requestID, DQPWorkContext workContext) {
+ this.requestMsg = requestMsg;
+ this.requestID = requestID;
+ this.processorTimeslice = dqpCore.getProcessorTimeSlice();
+ this.transactionService = dqpCore.getTransactionService();
+ this.dqpCore = dqpCore;
+ this.request = request;
+ this.dqpWorkContext = workContext;
+ this.requestResults(1, requestMsg.getFetchSize(), receiver);
+ }
+
+ private boolean isForwardOnly() {
+ return this.cid == null && requestMsg.getCursorType() == ResultSet.TYPE_FORWARD_ONLY;
+ }
+
+ /**
+ * Ask for results.
+ * @param beginRow
+ * @param endRow
+ */
+ synchronized void requestResults(int beginRow, int endRow, ResultsReceiver<ResultsMessage> receiver) {
+ if (this.resultsReceiver != null) {
+ throw new IllegalStateException("Results already requested"); //$NON-NLS-1$\
+ }
+ this.resultsReceiver = receiver;
+ this.begin = beginRow;
+ this.end = endRow;
+ }
+
+ @Override
+ protected boolean isDoneProcessing() {
+ return isClosed;
+ }
+
+ @Override
+ protected void resumeProcessing() {
+ if (doneProducingBatches && !closeRequested && !isCanceled) {
+ this.run(); // just run in the IO thread
+ } else {
+ dqpCore.addWork(this);
+ }
+ }
+
+ @Override
+ protected void process() {
+ LogManager.logDetail(LogConstants.CTX_DQP, "Request Thread", requestID, "with state", state); //$NON-NLS-1$ //$NON-NLS-2$
+ try {
+ if (this.state == ProcessingState.NEW) {
+ state = ProcessingState.PROCESSING;
+ processNew();
+ if (isCanceled) {
+ this.processingException = new TeiidProcessingException(QueryPlugin.Util.getString("QueryProcessor.request_cancelled", this.requestID)); //$NON-NLS-1$
+ state = ProcessingState.CLOSE;
+ }
+ }
+
+ resume();
+
+ if (this.state == ProcessingState.PROCESSING) {
+ processMore();
+ if (this.closeRequested) {
+ this.state = ProcessingState.CLOSE;
+ }
+ }
+ } catch (BlockedException e) {
+ LogManager.logDetail(LogConstants.CTX_DQP, "Request Thread", requestID, "- processor blocked"); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch (QueryProcessor.ExpiredTimeSliceException e) {
+ LogManager.logDetail(LogConstants.CTX_DQP, "Request Thread", requestID, "- time slice expired"); //$NON-NLS-1$ //$NON-NLS-2$
+ this.moreWork();
+ } catch (Throwable e) {
+ LogManager.logDetail(LogConstants.CTX_DQP, e, "Request Thread", requestID, "- error occurred"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ if (!isCanceled()) {
+ dqpCore.logMMCommand(this, Event.ERROR, null);
+ //Case 5558: Differentiate between system level errors and
+ //processing errors. Only log system level errors as errors,
+ //log the processing errors as warnings only
+ if(e instanceof TeiidProcessingException) {
+ Throwable cause = e;
+ while (cause.getCause() != null && cause.getCause() != cause) {
+ cause = cause.getCause();
+ }
+ StackTraceElement elem = cause.getStackTrace()[0];
+ LogManager.logWarning(LogConstants.CTX_DQP, QueryPlugin.Util.getString("ProcessWorker.processing_error", e.getMessage(), requestID, e.getClass().getName(), elem)); //$NON-NLS-1$
+ }else {
+ LogManager.logError(LogConstants.CTX_DQP, e, QueryPlugin.Util.getString("ProcessWorker.error", requestID)); //$NON-NLS-1$
+ }
+ }
+
+ this.processingException = e;
+ this.state = ProcessingState.CLOSE;
+ } finally {
+ if (this.state == ProcessingState.CLOSE && !isClosed) {
+ attemptClose();
+ } else if (isClosed) {
+ /*
+ * since there may be a client waiting notify them of a problem
+ */
+ if (this.processingException == null) {
+ this.processingException = new IllegalStateException("Request is already closed"); //$NON-NLS-1$
+ }
+ sendError();
+ }
+ suspend();
+ }
+ }
+
+ private void resume() throws XATransactionException {
+ if (this.transactionState == TransactionState.ACTIVE && this.transactionContext.getTransaction() != null) {
+ this.transactionService.resume(this.transactionContext);
+ }
+ }
+
+ private void suspend() {
+ try {
+ this.transactionService.suspend(this.transactionContext);
+ } catch (XATransactionException e) {
+ LogManager.logDetail(LogConstants.CTX_DQP, e, "Error suspending active transaction"); //$NON-NLS-1$
+ }
+ }
+
+ protected void processMore() throws BlockedException, TeiidException {
+ if (!doneProducingBatches) {
+ this.processor.getContext().setTimeSliceEnd(System.currentTimeMillis() + this.processorTimeslice);
+ sendResultsIfNeeded(null);
+ collector.collectTuples();
+ }
+ if (doneProducingBatches) {
+ if (this.transactionState == TransactionState.ACTIVE) {
+ /*
+ * TEIID-14 if we are done producing batches, then proactively close transactional
+ * executions even ones that were intentionally kept alive. this may
+ * break the read of a lob from a transactional source under a transaction
+ * if the source does not support holding the clob open after commit
+ */
+ for (DataTierTupleSource connectorRequest : this.connectorInfo.values()) {
+ if (connectorRequest.isTransactional()) {
+ connectorRequest.fullyCloseSource();
+ }
+ }
+ this.transactionState = TransactionState.DONE;
+ if (transactionContext.getTransactionType() == TransactionContext.Scope.REQUEST) {
+ this.transactionService.commit(transactionContext);
+ } else {
+ suspend();
+ }
+ }
+ sendResultsIfNeeded(null);
+ } else {
+ moreWork(false); // If the timeslice expired, then the processor can probably produce more batches.
+ if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
+ LogManager.logDetail(LogConstants.CTX_DQP, "############# PW EXITING on " + requestID + " - reenqueueing for more processing ###########"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ }
+
+ /**
+ * Client close is currently implemented as asynch.
+ * Any errors that occur will not make it to the client, instead we just log them here.
+ */
+ protected void attemptClose() {
+ int rowcount = -1;
+ if (this.resultsBuffer != null) {
+ if (this.processor != null) {
+ this.processor.closeProcessing();
+
+ if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
+ LogManager.logDetail(LogConstants.CTX_DQP, "Removing tuplesource for the request " + requestID); //$NON-NLS-1$
+ }
+ rowcount = resultsBuffer.getRowCount();
+ if (this.cid == null || !this.doneProducingBatches) {
+ resultsBuffer.remove();
+ }
+
+ for (DataTierTupleSource connectorRequest : this.connectorInfo.values()) {
+ connectorRequest.fullyCloseSource();
+ }
+ }
+
+ this.resultsBuffer = null;
+
+ for (LobWorkItem lobWorkItem : this.lobStreams.values()) {
+ lobWorkItem.close();
+ }
+ }
+
+ if (this.transactionState == TransactionState.ACTIVE) {
+ this.transactionState = TransactionState.DONE;
+ if (transactionContext.getTransactionType() == TransactionContext.Scope.REQUEST) {
+ try {
+ this.transactionService.rollback(transactionContext);
+ } catch (XATransactionException e1) {
+ LogManager.logWarning(LogConstants.CTX_DQP, e1, QueryPlugin.Util.getString("ProcessWorker.failed_rollback")); //$NON-NLS-1$
+ }
+ } else {
+ suspend();
+ }
+ }
+
+ isClosed = true;
+
+ dqpCore.removeRequest(this);
+
+ if (this.processingException != null) {
+ sendError();
+ } else {
+ dqpCore.logMMCommand(this, Event.END, rowcount);
+ }
+ }
+
+ protected void processNew() throws TeiidProcessingException, TeiidComponentException {
+ SessionAwareCache<CachedResults> rsCache = dqpCore.getRsCache();
+
+ boolean cachable = false;
+ CacheID cacheId = null;
+ boolean canUseCached = (requestMsg.useResultSetCache() ||
+ QueryParser.getQueryParser().parseCacheHint(requestMsg.getCommandString()) != null);
+
+ if (rsCache != null) {
+ if (!canUseCached) {
+ LogManager.logDetail(LogConstants.CTX_DQP, requestID, "No cache directive"); //$NON-NLS-1$
+ } else {
+ ParseInfo pi = Request.createParseInfo(requestMsg);
+ cacheId = new CacheID(this.dqpWorkContext, pi, requestMsg.getCommandString());
+ cachable = cacheId.setParameters(requestMsg.getParameterValues());
+ if (cachable) {
+ CachedResults cr = rsCache.get(cacheId);
+ if (cr != null) {
+ this.resultsBuffer = cr.getResults();
+ this.analysisRecord = cr.getAnalysisRecord();
+ request.initMetadata();
+ this.originalCommand = cr.getCommand(requestMsg.getCommandString(), request.metadata, pi);
+ request.validateAccess(this.originalCommand);
+ this.doneProducingBatches();
+ return;
+ }
+ } else {
+ LogManager.logDetail(LogConstants.CTX_DQP, requestID, "Parameters are not serializable - cache cannot be used for", cacheId); //$NON-NLS-1$
+ }
+ }
+ }
+ request.processRequest();
+ originalCommand = request.userCommand;
+ if (cachable && (requestMsg.useResultSetCache() || originalCommand.getCacheHint() != null) && rsCache != null && originalCommand.areResultsCachable()) {
+ this.cid = cacheId;
+ }
+ processor = request.processor;
+ resultsBuffer = processor.createTupleBuffer();
+ if (this.cid != null && originalCommand.getCacheHint() != null) {
+ LogManager.logDetail(LogConstants.CTX_DQP, requestID, "Using cache hint", originalCommand.getCacheHint()); //$NON-NLS-1$
+ resultsBuffer.setPrefersMemory(originalCommand.getCacheHint().getPrefersMemory());
+ }
+ collector = new BatchCollector(processor, resultsBuffer) {
+ protected void flushBatchDirect(TupleBatch batch, boolean add) throws TeiidComponentException,TeiidProcessingException {
+ boolean added = false;
+ if (cid != null || resultsBuffer.isLobs()) {
+ super.flushBatchDirect(batch, add);
+ added = true;
+ }
+ if (batch.getTerminationFlag()) {
+ doneProducingBatches();
+ }
+ if (doneProducingBatches && cid != null) {
+ int determinismLevel = processor.getContext().getDeterminismLevel();
+ CachedResults cr = new CachedResults();
+ cr.setCommand(originalCommand);
+ cr.setAnalysisRecord(analysisRecord);
+ cr.setResults(resultsBuffer);
+ if (determinismLevel > FunctionMethod.SESSION_DETERMINISTIC) {
+ LogManager.logInfo(LogConstants.CTX_DQP, QueryPlugin.Util.getString("RequestWorkItem.cache_nondeterministic", originalCommand)); //$NON-NLS-1$
+ }
+ dqpCore.getRsCache().put(cid, determinismLevel, cr, originalCommand.getCacheHint() != null?originalCommand.getCacheHint().getTtl():null);
+ }
+ add = sendResultsIfNeeded(batch);
+ if (!added) {
+ super.flushBatchDirect(batch, add);
+ }
+ }
+ };
+ resultsBuffer = collector.getTupleBuffer();
+ resultsBuffer.setForwardOnly(isForwardOnly());
+ analysisRecord = request.analysisRecord;
+ analysisRecord.setQueryPlan(processor.getProcessorPlan().getDescriptionProperties());
+ transactionContext = request.transactionContext;
+ if (this.transactionContext != null && this.transactionContext.getTransactionType() != Scope.NONE) {
+ this.transactionState = TransactionState.ACTIVE;
+ }
+ if (requestMsg.isNoExec()) {
+ doneProducingBatches();
+ resultsBuffer.close();
+ this.cid = null;
+ }
+ this.returnsUpdateCount = request.returnsUpdateCount;
+ request = null;
+ }
+
+ /**
+ * Send results if they have been requested. This should only be called from the processing thread.
+ */
+ protected boolean sendResultsIfNeeded(TupleBatch batch) throws TeiidComponentException {
+ ResultsMessage response = null;
+ ResultsReceiver<ResultsMessage> receiver = null;
+ boolean result = true;
+ synchronized (this) {
+ if (this.resultsReceiver == null
+ || (this.begin > (batch != null?batch.getEndRow():this.resultsBuffer.getRowCount()) && !doneProducingBatches)
+ || (this.transactionState == TransactionState.ACTIVE)) {
+ return result;
+ }
+
+ if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
+ LogManager.logDetail(LogConstants.CTX_DQP, "[RequestWorkItem.sendResultsIfNeeded] requestID:", requestID, "resultsID:", this.resultsBuffer, "done:", doneProducingBatches ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ //TODO: support fetching more than 1 batch
+ boolean fromBuffer = false;
+ if (batch == null || !(batch.containsRow(this.begin) || (batch.getTerminationFlag() && batch.getEndRow() <= this.begin))) {
+ if (savedBatch != null && savedBatch.containsRow(this.begin)) {
+ batch = savedBatch;
+ } else {
+ batch = resultsBuffer.getBatch(begin);
+ }
+ savedBatch = null;
+ fromBuffer = true;
+ }
+ int count = this.end - this.begin + 1;
+ if (batch.getRowCount() > count) {
+ int beginRow = Math.min(this.begin, batch.getEndRow() - count + 1);
+ int endRow = Math.min(beginRow + count - 1, batch.getEndRow());
+ boolean last = false;
+ if (endRow == batch.getEndRow()) {
+ last = batch.getTerminationFlag();
+ } else if (fromBuffer && isForwardOnly()) {
+ savedBatch = batch;
+ }
+ List<List<?>> memoryRows = batch.getTuples();
+ batch = new TupleBatch(beginRow, memoryRows.subList(beginRow - batch.getBeginRow(), endRow - batch.getBeginRow() + 1));
+ batch.setTerminationFlag(last);
+ } else if (!fromBuffer){
+ result = !isForwardOnly();
+ }
+ int finalRowCount = this.resultsBuffer.isFinal()?this.resultsBuffer.getRowCount():(batch.getTerminationFlag()?batch.getEndRow():-1);
+
+ response = createResultsMessage(batch.getAllTuples(), this.originalCommand.getProjectedSymbols());
+ response.setFirstRow(batch.getBeginRow());
+ response.setLastRow(batch.getEndRow());
+ response.setUpdateResult(this.returnsUpdateCount);
+ // set final row
+ response.setFinalRow(finalRowCount);
+
+ // send any warnings with the response object
+ List<Throwable> responseWarnings = new ArrayList<Throwable>();
+ if (this.processor != null) {
+ List<Exception> currentWarnings = processor.getAndClearWarnings();
+ if (currentWarnings != null) {
+ responseWarnings.addAll(currentWarnings);
+ }
+ }
+ synchronized (warnings) {
+ responseWarnings.addAll(this.warnings);
+ this.warnings.clear();
+ }
+ response.setWarnings(responseWarnings);
+
+ // If it is stored procedure, set parameters
+ if (originalCommand instanceof StoredProcedure) {
+ StoredProcedure proc = (StoredProcedure)originalCommand;
+ if (proc.returnParameters()) {
+ response.setParameters(getParameterInfo(proc));
+ }
+ }
+ /*
+ * mark the results sent at this point.
+ * communication exceptions will be treated as non-recoverable
+ */
+ receiver = this.resultsReceiver;
+ this.resultsReceiver = null;
+ }
+ receiver.receiveResults(response);
+ return result;
+ }
+
+ public ResultsMessage createResultsMessage(List[] batch, List columnSymbols) {
+ String[] columnNames = new String[columnSymbols.size()];
+ String[] dataTypes = new String[columnSymbols.size()];
+
+ for(int i=0; i<columnSymbols.size(); i++) {
+ SingleElementSymbol symbol = (SingleElementSymbol) columnSymbols.get(i);
+ columnNames[i] = SingleElementSymbol.getShortName(symbol.getOutputName());
+ dataTypes[i] = DataTypeManager.getDataTypeName(symbol.getType());
+ }
+ ResultsMessage result = new ResultsMessage(requestMsg, batch, columnNames, dataTypes);
+ setAnalysisRecords(result);
+ return result;
+ }
+
+ private void setAnalysisRecords(ResultsMessage response) {
+ if(analysisRecord != null) {
+ if (requestMsg.getShowPlan() != ShowPlan.OFF) {
+ if (processor != null) {
+ analysisRecord.setQueryPlan(processor.getProcessorPlan().getDescriptionProperties());
+ }
+ response.setPlanDescription(analysisRecord.getQueryPlan());
+ response.setAnnotations(analysisRecord.getAnnotations());
+ }
+ if (requestMsg.getShowPlan() == ShowPlan.DEBUG) {
+ response.setDebugLog(analysisRecord.getDebugLog());
+ }
+ }
+ }
+
+ private void sendError() {
+ synchronized (this) {
+ if (this.resultsReceiver == null) {
+ LogManager.logDetail(LogConstants.CTX_DQP, processingException, "Unable to send error to client as results were already sent.", requestID); //$NON-NLS-1$
+ return;
+ }
+ }
+ LogManager.logDetail(LogConstants.CTX_DQP, processingException, "Sending error to client", requestID); //$NON-NLS-1$
+ ResultsMessage response = new ResultsMessage(requestMsg);
+ response.setException(processingException);
+ setAnalysisRecords(response);
+ resultsReceiver.receiveResults(response);
+ }
+
+ private static List<ParameterInfo> getParameterInfo(StoredProcedure procedure) {
+ List<ParameterInfo> paramInfos = new ArrayList<ParameterInfo>();
+
+ for (SPParameter param : procedure.getParameters()) {
+ ParameterInfo info = new ParameterInfo(param.getParameterType(), param.getResultSetColumns().size());
+ paramInfos.add(info);
+ }
+
+ return paramInfos;
+ }
+
+ public void processLobChunkRequest(String id, int streamRequestId, ResultsReceiver<LobChunk> chunckReceiver) {
+ LobWorkItem workItem = null;
+ synchronized (lobStreams) {
+ workItem = this.lobStreams.get(new Integer(streamRequestId));
+ if (workItem == null) {
+ workItem = new LobWorkItem(this, dqpCore, id, streamRequestId);
+ lobStreams.put(new Integer(streamRequestId), workItem);
+ }
+ }
+ workItem.setResultsReceiver(chunckReceiver);
+ dqpCore.addWork(workItem);
+ }
+
+ public void removeLobStream(int streamRequestId) {
+ this.lobStreams.remove(new Integer(streamRequestId));
+ }
+
+ public boolean requestCancel() throws TeiidComponentException {
+ synchronized (this) {
+ if (this.isCanceled || this.closeRequested) {
+ return false;
+ }
+ this.isCanceled = true;
+ }
+ if (this.processor != null) {
+ this.processor.requestCanceled();
+ }
+
+ // Cancel Connector atomic requests
+ try {
+ for (DataTierTupleSource connectorRequest : this.connectorInfo.values()) {
+ connectorRequest.cancelRequest();
+ }
+ } finally {
+ try {
+ if (transactionService != null) {
+ try {
+ transactionService.cancelTransactions(requestID.getConnectionID(), true);
+ } catch (XATransactionException err) {
+ throw new TeiidComponentException(err);
+ }
+ }
+ } finally {
+ this.moreWork();
+ }
+ }
+ return true;
+ }
+
+ public boolean requestAtomicRequestCancel(AtomicRequestID ari) throws TeiidComponentException {
+ // in the case that this does not support partial results; cancel
+ // the original processor request.
+ if(!requestMsg.supportsPartialResults()) {
+ return requestCancel();
+ }
+
+ DataTierTupleSource connectorRequest = this.connectorInfo.get(ari);
+ if (connectorRequest != null) {
+ connectorRequest.cancelRequest();
+ return true;
+ }
+
+ LogManager.logDetail(LogConstants.CTX_DQP, "Connector request not found. AtomicRequestID=", ari); //$NON-NLS-1$
+ return false;
+ }
+
+ public void requestClose() throws TeiidComponentException {
+ synchronized (this) {
+ if (this.state == ProcessingState.CLOSE || this.closeRequested) {
+ if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
+ LogManager.logDetail(LogConstants.CTX_DQP, "Request already closing" + requestID); //$NON-NLS-1$
+ }
+ return;
+ }
+ }
+ this.closeRequested = true;
+ if (!this.doneProducingBatches) {
+ this.requestCancel(); //pending work should be canceled for fastest clean up
+ }
+ this.moreWork();
+ }
+
+ public void requestMore(int batchFirst, int batchLast, ResultsReceiver<ResultsMessage> receiver) {
+ this.requestResults(batchFirst, batchLast, receiver);
+ this.moreWork();
+ }
+
+ public void closeAtomicRequest(AtomicRequestID atomicRequestId) {
+ connectorInfo.remove(atomicRequestId);
+ LogManager.logTrace(LogConstants.CTX_DQP, new Object[] {"closed atomic-request:", atomicRequestId}); //$NON-NLS-1$
+ }
+
+ public void addConnectorRequest(AtomicRequestID atomicRequestId, DataTierTupleSource connInfo) {
+ connectorInfo.put(atomicRequestId, connInfo);
+ }
+
+ /**
+ * <p>This method add information to the warning on the work item for the given
+ * <code>RequestID</code>. This method is called from <code>DataTierManager</code></p>
+ */
+ public void addSourceFailureDetails(SourceWarning details) {
+ synchronized (warnings) {
+ this.warnings.add(details);
+ }
+ }
+
+ boolean isCanceled() {
+ return isCanceled;
+ }
+
+ Command getOriginalCommand() throws TeiidProcessingException {
+ if (this.originalCommand == null) {
+ if (this.processingException != null) {
+ throw new TeiidProcessingException(this.processingException);
+ }
+ throw new IllegalStateException("Original command is not available"); //$NON-NLS-1$
+ }
+ return this.originalCommand;
+ }
+
+ void setOriginalCommand(Command originalCommand) {
+ this.originalCommand = originalCommand;
+ }
+
+ TransactionContext getTransactionContext() {
+ return transactionContext;
+ }
+
+
+ Collection<DataTierTupleSource> getConnectorRequests() {
+ return new LinkedList<DataTierTupleSource>(this.connectorInfo.values());
+ }
+
+ DataTierTupleSource getConnectorRequest(AtomicRequestID id) {
+ return this.connectorInfo.get(id);
+ }
+
+ public List<TeiidException> getWarnings() {
+ return warnings;
+ }
+
+ @Override
+ public String toString() {
+ return this.requestID.toString();
+ }
+
+ public DQPWorkContext getDqpWorkContext() {
+ return dqpWorkContext;
+ }
+
+ public long getProcessingTimestamp() {
+ return processingTimestamp;
+ }
+
+ @Override
+ public void release() {
+ try {
+ requestCancel();
+ } catch (TeiidComponentException e) {
+ LogManager.logWarning(LogConstants.CTX_DQP, e, "Failed to cancel " + requestID); //$NON-NLS-1$
+ }
+ }
+
+ private void doneProducingBatches() {
+ this.doneProducingBatches = true;
+ dqpCore.finishProcessing(this);
+ }
+
+ @Override
+ public int getPriority() {
+ return (closeRequested || isCanceled) ? 0 : 1000;
+ }
+
+ @Override
+ public long getCreationTime() {
+ return processingTimestamp;
+ }
+
+}
\ No newline at end of file
Deleted: tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
===================================================================
--- branches/7.2.x/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java 2010-11-05 03:19:55 UTC (rev 2709)
@@ -1,296 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.dqp.internal.process;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.teiid.cache.Cachable;
-import org.teiid.cache.Cache;
-import org.teiid.cache.CacheConfiguration;
-import org.teiid.cache.CacheFactory;
-import org.teiid.cache.DefaultCache;
-import org.teiid.cache.DefaultCacheFactory;
-import org.teiid.cache.CacheConfiguration.Policy;
-import org.teiid.common.buffer.BufferManager;
-import org.teiid.core.types.DataTypeManager;
-import org.teiid.core.util.EquivalenceUtil;
-import org.teiid.core.util.HashCodeUtil;
-import org.teiid.query.function.metadata.FunctionMethod;
-import org.teiid.query.parser.ParseInfo;
-import org.teiid.vdb.runtime.VDBKey;
-
-
-/**
- * This class is used to cache session aware objects
- */
-public class SessionAwareCache<T> {
- public static final int DEFAULT_MAX_SIZE_TOTAL = 512;
-
- private Cache<CacheID, T> localCache;
- private Cache<CacheID, T> distributedCache;
- private Cache tupleBatchCache;
-
- private int maxSize = DEFAULT_MAX_SIZE_TOTAL;
-
- private AtomicInteger cacheHit = new AtomicInteger();
- private AtomicInteger totalRequests = new AtomicInteger();
-
- private BufferManager bufferManager;
-
- public SessionAwareCache(){
- this(DEFAULT_MAX_SIZE_TOTAL);
- }
-
- SessionAwareCache(int maxSize){
- this(new DefaultCacheFactory(), Cache.Type.RESULTSET, new CacheConfiguration(Policy.LRU, 60, maxSize));
- }
-
- SessionAwareCache (final CacheFactory cacheFactory, final Cache.Type type, final CacheConfiguration config){
- this.maxSize = config.getMaxEntries();
- if(this.maxSize < 0){
- this.maxSize = DEFAULT_MAX_SIZE_TOTAL;
- }
- this.localCache = new DefaultCache<CacheID, T>("local", maxSize, config.getMaxAgeInSeconds()*1000); //$NON-NLS-1$
-
- if (type == Cache.Type.PREPAREDPLAN) {
- this.distributedCache = localCache;
- }
- else {
- this.distributedCache = cacheFactory.get(type, config);
- if (type == Cache.Type.RESULTSET) {
- this.tupleBatchCache = cacheFactory.get(Cache.Type.RESULTSET_BATCHES, config);
- }
- else {
- this.tupleBatchCache = this.distributedCache;
- }
- }
- }
-
- public T get(CacheID id){
-
- this.totalRequests.getAndIncrement();
-
- id.setSessionId(id.originalSessionId);
- T result = localCache.get(id);
-
- if (result == null) {
- id.setSessionId(null);
-
- id.setUserName(id.originalUserName);
- result = distributedCache.get(id);
-
- if (result == null) {
- id.setUserName(null);
- result = distributedCache.get(id);
- }
-
- if (result != null && result instanceof Cachable) {
- Cachable c = (Cachable)result;
- if (!c.restore(this.tupleBatchCache, this.bufferManager)) {
- result = null;
- }
- }
- }
-
- if (result != null) {
- cacheHit.getAndIncrement();
- }
- return result;
- }
-
- public int getCacheHitCount() {
- return cacheHit.get();
- }
-
- public int getRequestCount() {
- return this.totalRequests.get();
- }
-
- public int getTotalCacheEntries() {
- if (this.localCache == this.distributedCache) {
- return this.localCache.size();
- }
- return localCache.size() + distributedCache.size();
- }
-
- public void put(CacheID id, int determinismLevel, T t, Long ttl){
- if (determinismLevel >= FunctionMethod.SESSION_DETERMINISTIC) {
- id.setSessionId(id.originalSessionId);
- this.localCache.put(id, t, ttl);
- }
- else {
-
- boolean insert = true;
-
- id.setSessionId(null);
-
- if (determinismLevel == FunctionMethod.USER_DETERMINISTIC) {
- id.setUserName(id.originalUserName);
- }
- else {
- id.setUserName(null);
- }
-
- if (t instanceof Cachable) {
- Cachable c = (Cachable)t;
- insert = c.prepare(this.tupleBatchCache, this.bufferManager);
- }
-
- if (insert) {
- this.distributedCache.put(id, t, ttl);
- }
- }
- }
-
- /**
- * Clear all the cached plans for all the clientConns
- * @param clientConn ClientConnection
- */
- public void clearAll(){
- this.localCache.clear();
- this.distributedCache.clear();
- }
-
- public void clearForVDB(String vdbName, int version) {
- clearCache(this.localCache, vdbName, version);
- clearCache(this.distributedCache, vdbName, version);
- }
-
- private void clearCache(Cache<CacheID, T> cache, String vdbName, int version) {
- Set<CacheID> keys = cache.keys();
- VDBKey vdbKey = new VDBKey(vdbName, version);
- for (CacheID key:keys) {
- if (key.vdbInfo.equals(vdbKey)) {
- cache.remove(key);
- }
- }
- }
-
- public static class CacheID implements Serializable {
- private static final long serialVersionUID = 8261905111156764744L;
- private String sql;
- private VDBKey vdbInfo;
- private ParseInfo pi;
- private String sessionId;
- private String originalSessionId;
- private List<Serializable> parameters;
- private String userName;
- private String originalUserName;
-
- public CacheID(DQPWorkContext context, ParseInfo pi, String sql){
- this(pi, sql, context.getVdbName(), context.getVdbVersion(), context.getSessionId(), context.getUserName());
- }
-
- public CacheID(ParseInfo pi, String sql, String vdbName, int vdbVersion, String sessionId, String userName){
- this.sql = sql;
- this.vdbInfo = new VDBKey(vdbName, vdbVersion);
- this.pi = pi;
- this.originalSessionId = sessionId;
- this.originalUserName = userName;
- }
-
-
- public String getSessionId() {
- return sessionId;
- }
-
- public String getUserName() {
- return userName;
- }
-
- private void setSessionId(String sessionId) {
- this.sessionId = sessionId;
- }
-
- /**
- * Set the raw (non-Constant) parameter values.
- * @param parameters
- * @return
- */
- public boolean setParameters(List<?> parameters) {
- if (parameters != null && !parameters.isEmpty()) {
- this.parameters = new ArrayList<Serializable>();
- for (Object obj:parameters) {
- if (obj == null) {
- this.parameters.add(null);
- continue;
- }
- if (!(obj instanceof Serializable)) {
- return false;
- }
-
- Class<?> type = DataTypeManager.determineDataTypeClass(obj);
- if (DataTypeManager.isLOB(type) || type == DataTypeManager.DefaultDataClasses.OBJECT) {
- return false;
- }
- this.parameters.add((Serializable)obj);
- }
- }
- return true;
- }
-
- public String getSql() {
- return sql;
- }
-
- void setUserName(String name) {
- this.userName = name;
- }
-
- public boolean equals(Object obj){
- if(obj == this) {
- return true;
- }
- if(! (obj instanceof CacheID)) {
- return false;
- }
- CacheID that = (CacheID)obj;
- return EquivalenceUtil.areEqual(this.pi, that.pi) && this.vdbInfo.equals(that.vdbInfo) && this.sql.equals(that.sql)
- && EquivalenceUtil.areEqual(this.userName, that.userName)
- && EquivalenceUtil.areEqual(this.sessionId, that.sessionId)
- && EquivalenceUtil.areEqual(this.parameters, that.parameters);
- }
-
- public int hashCode() {
- return HashCodeUtil.hashCode(0, vdbInfo, sql, pi, this.userName, sessionId, parameters);
- }
-
- @Override
- public String toString() {
- return "Cache Entry<" + originalSessionId + "="+ originalUserName + "> params:" + parameters + " sql:" + sql; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
-
- }
-
- int getSpaceAllowed() {
- return maxSize;
- }
-
- public void setBufferManager(BufferManager bufferManager) {
- this.bufferManager = bufferManager;
- }
-}
Copied: tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java (from rev 2707, branches/7.2.x/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java)
===================================================================
--- tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java (rev 0)
+++ tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java 2010-11-05 03:19:55 UTC (rev 2709)
@@ -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.dqp.internal.process;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.teiid.cache.Cachable;
+import org.teiid.cache.Cache;
+import org.teiid.cache.CacheConfiguration;
+import org.teiid.cache.CacheFactory;
+import org.teiid.cache.DefaultCache;
+import org.teiid.cache.DefaultCacheFactory;
+import org.teiid.cache.CacheConfiguration.Policy;
+import org.teiid.common.buffer.BufferManager;
+import org.teiid.core.types.DataTypeManager;
+import org.teiid.core.util.EquivalenceUtil;
+import org.teiid.core.util.HashCodeUtil;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.query.function.metadata.FunctionMethod;
+import org.teiid.query.parser.ParseInfo;
+import org.teiid.vdb.runtime.VDBKey;
+
+
+/**
+ * This class is used to cache session aware objects
+ */
+public class SessionAwareCache<T> {
+ public static final int DEFAULT_MAX_SIZE_TOTAL = 512;
+
+ private Cache<CacheID, T> localCache;
+ private Cache<CacheID, T> distributedCache;
+ private Cache tupleBatchCache;
+
+ private int maxSize = DEFAULT_MAX_SIZE_TOTAL;
+
+ private AtomicInteger cacheHit = new AtomicInteger();
+ private AtomicInteger totalRequests = new AtomicInteger();
+
+ private BufferManager bufferManager;
+
+ public SessionAwareCache(){
+ this(DEFAULT_MAX_SIZE_TOTAL);
+ }
+
+ SessionAwareCache(int maxSize){
+ this(new DefaultCacheFactory(), Cache.Type.RESULTSET, new CacheConfiguration(Policy.LRU, 60, maxSize));
+ }
+
+ SessionAwareCache (final CacheFactory cacheFactory, final Cache.Type type, final CacheConfiguration config){
+ this.maxSize = config.getMaxEntries();
+ if(this.maxSize < 0){
+ this.maxSize = DEFAULT_MAX_SIZE_TOTAL;
+ }
+ this.localCache = new DefaultCache<CacheID, T>("local", maxSize, config.getMaxAgeInSeconds()*1000); //$NON-NLS-1$
+
+ if (type == Cache.Type.PREPAREDPLAN) {
+ this.distributedCache = localCache;
+ }
+ else {
+ this.distributedCache = cacheFactory.get(type, config);
+ if (type == Cache.Type.RESULTSET) {
+ this.tupleBatchCache = cacheFactory.get(Cache.Type.RESULTSET_BATCHES, config);
+ }
+ else {
+ this.tupleBatchCache = this.distributedCache;
+ }
+ }
+ }
+
+ public T get(CacheID id){
+
+ this.totalRequests.getAndIncrement();
+
+ id.setSessionId(id.originalSessionId);
+ T result = localCache.get(id);
+
+ if (result == null) {
+ id.setSessionId(null);
+
+ id.setUserName(id.originalUserName);
+ result = distributedCache.get(id);
+
+ if (result == null) {
+ id.setUserName(null);
+ result = distributedCache.get(id);
+ }
+
+ if (result != null && result instanceof Cachable) {
+ Cachable c = (Cachable)result;
+ if (!c.restore(this.tupleBatchCache, this.bufferManager)) {
+ result = null;
+ }
+ }
+ }
+
+ if (result != null) {
+ LogManager.logTrace(LogConstants.CTX_DQP, "Cache hit for", id); //$NON-NLS-1$
+ cacheHit.getAndIncrement();
+ } else {
+ LogManager.logTrace(LogConstants.CTX_DQP, "Cache miss for", id); //$NON-NLS-1$
+ }
+ return result;
+ }
+
+ public int getCacheHitCount() {
+ return cacheHit.get();
+ }
+
+ public int getRequestCount() {
+ return this.totalRequests.get();
+ }
+
+ public int getTotalCacheEntries() {
+ if (this.localCache == this.distributedCache) {
+ return this.localCache.size();
+ }
+ return localCache.size() + distributedCache.size();
+ }
+
+ public void put(CacheID id, int determinismLevel, T t, Long ttl){
+ if (determinismLevel >= FunctionMethod.SESSION_DETERMINISTIC) {
+ id.setSessionId(id.originalSessionId);
+ LogManager.logTrace(LogConstants.CTX_DQP, "Adding to session/local cache", id); //$NON-NLS-1$
+ this.localCache.put(id, t, ttl);
+ }
+ else {
+
+ boolean insert = true;
+
+ id.setSessionId(null);
+
+ if (determinismLevel == FunctionMethod.USER_DETERMINISTIC) {
+ id.setUserName(id.originalUserName);
+ }
+ else {
+ id.setUserName(null);
+ }
+
+ if (t instanceof Cachable) {
+ Cachable c = (Cachable)t;
+ insert = c.prepare(this.tupleBatchCache, this.bufferManager);
+ }
+
+ if (insert) {
+ LogManager.logTrace(LogConstants.CTX_DQP, "Adding to global/distributed cache", id); //$NON-NLS-1$
+ this.distributedCache.put(id, t, ttl);
+ }
+ }
+ }
+
+ /**
+ * Clear all the cached plans for all the clientConns
+ * @param clientConn ClientConnection
+ */
+ public void clearAll(){
+ this.localCache.clear();
+ this.distributedCache.clear();
+ this.totalRequests.set(0);
+ this.cacheHit.set(0);
+ }
+
+ public void clearForVDB(String vdbName, int version) {
+ clearCache(this.localCache, vdbName, version);
+ clearCache(this.distributedCache, vdbName, version);
+ }
+
+ private void clearCache(Cache<CacheID, T> cache, String vdbName, int version) {
+ Set<CacheID> keys = cache.keys();
+ VDBKey vdbKey = new VDBKey(vdbName, version);
+ for (CacheID key:keys) {
+ if (key.vdbInfo.equals(vdbKey)) {
+ cache.remove(key);
+ }
+ }
+ }
+
+ public static class CacheID implements Serializable {
+ private static final long serialVersionUID = 8261905111156764744L;
+ private String sql;
+ private VDBKey vdbInfo;
+ private ParseInfo pi;
+ private String sessionId;
+ private String originalSessionId;
+ private List<Serializable> parameters;
+ private String userName;
+ private String originalUserName;
+
+ public CacheID(DQPWorkContext context, ParseInfo pi, String sql){
+ this(pi, sql, context.getVdbName(), context.getVdbVersion(), context.getSessionId(), context.getUserName());
+ }
+
+ public CacheID(ParseInfo pi, String sql, String vdbName, int vdbVersion, String sessionId, String userName){
+ this.sql = sql;
+ this.vdbInfo = new VDBKey(vdbName, vdbVersion);
+ this.pi = pi;
+ this.originalSessionId = sessionId;
+ this.originalUserName = userName;
+ }
+
+
+ public String getSessionId() {
+ return sessionId;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ private void setSessionId(String sessionId) {
+ this.sessionId = sessionId;
+ }
+
+ /**
+ * Set the raw (non-Constant) parameter values.
+ * @param parameters
+ * @return
+ */
+ public boolean setParameters(List<?> parameters) {
+ if (parameters != null && !parameters.isEmpty()) {
+ this.parameters = new ArrayList<Serializable>();
+ for (Object obj:parameters) {
+ if (obj == null) {
+ this.parameters.add(null);
+ continue;
+ }
+ if (!(obj instanceof Serializable)) {
+ return false;
+ }
+
+ Class<?> type = DataTypeManager.determineDataTypeClass(obj);
+ if (DataTypeManager.isLOB(type) || type == DataTypeManager.DefaultDataClasses.OBJECT) {
+ return false;
+ }
+ this.parameters.add((Serializable)obj);
+ }
+ }
+ return true;
+ }
+
+ public String getSql() {
+ return sql;
+ }
+
+ void setUserName(String name) {
+ this.userName = name;
+ }
+
+ public boolean equals(Object obj){
+ if(obj == this) {
+ return true;
+ }
+ if(! (obj instanceof CacheID)) {
+ return false;
+ }
+ CacheID that = (CacheID)obj;
+ return EquivalenceUtil.areEqual(this.pi, that.pi) && this.vdbInfo.equals(that.vdbInfo) && this.sql.equals(that.sql)
+ && EquivalenceUtil.areEqual(this.userName, that.userName)
+ && EquivalenceUtil.areEqual(this.sessionId, that.sessionId)
+ && EquivalenceUtil.areEqual(this.parameters, that.parameters);
+ }
+
+ public int hashCode() {
+ return HashCodeUtil.hashCode(0, vdbInfo, sql, pi, this.userName, sessionId, parameters);
+ }
+
+ @Override
+ public String toString() {
+ return "Cache Entry<" + originalSessionId + "="+ originalUserName + "> params:" + parameters + " sql:" + sql; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ }
+
+ }
+
+ int getSpaceAllowed() {
+ return maxSize;
+ }
+
+ public void setBufferManager(BufferManager bufferManager) {
+ this.bufferManager = bufferManager;
+ }
+}
Deleted: tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java
===================================================================
--- branches/7.2.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java 2010-11-05 03:19:55 UTC (rev 2709)
@@ -1,591 +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.query.optimizer.relational.rules;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.teiid.api.exception.query.QueryMetadataException;
-import org.teiid.core.TeiidComponentException;
-import org.teiid.query.QueryPlugin;
-import org.teiid.query.analysis.AnalysisRecord;
-import org.teiid.query.function.metadata.FunctionMethod;
-import org.teiid.query.metadata.QueryMetadataInterface;
-import org.teiid.query.metadata.SupportConstants;
-import org.teiid.query.optimizer.capabilities.CapabilitiesFinder;
-import org.teiid.query.optimizer.capabilities.SourceCapabilities;
-import org.teiid.query.optimizer.capabilities.SourceCapabilities.Capability;
-import org.teiid.query.processor.ProcessorPlan;
-import org.teiid.query.processor.relational.AccessNode;
-import org.teiid.query.processor.relational.RelationalNode;
-import org.teiid.query.processor.relational.RelationalPlan;
-import org.teiid.query.sql.LanguageObject;
-import org.teiid.query.sql.LanguageVisitor;
-import org.teiid.query.sql.lang.AbstractCompareCriteria;
-import org.teiid.query.sql.lang.AbstractSetCriteria;
-import org.teiid.query.sql.lang.Command;
-import org.teiid.query.sql.lang.CompareCriteria;
-import org.teiid.query.sql.lang.CompoundCriteria;
-import org.teiid.query.sql.lang.DependentSetCriteria;
-import org.teiid.query.sql.lang.ExistsCriteria;
-import org.teiid.query.sql.lang.IsNullCriteria;
-import org.teiid.query.sql.lang.MatchCriteria;
-import org.teiid.query.sql.lang.NotCriteria;
-import org.teiid.query.sql.lang.Query;
-import org.teiid.query.sql.lang.QueryCommand;
-import org.teiid.query.sql.lang.SetCriteria;
-import org.teiid.query.sql.lang.SubqueryCompareCriteria;
-import org.teiid.query.sql.lang.SubqueryContainer;
-import org.teiid.query.sql.lang.SubquerySetCriteria;
-import org.teiid.query.sql.navigator.PreOrderNavigator;
-import org.teiid.query.sql.symbol.AggregateSymbol;
-import org.teiid.query.sql.symbol.CaseExpression;
-import org.teiid.query.sql.symbol.Function;
-import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.symbol.QueryString;
-import org.teiid.query.sql.symbol.ScalarSubquery;
-import org.teiid.query.sql.symbol.SearchedCaseExpression;
-import org.teiid.query.sql.symbol.TextLine;
-import org.teiid.query.sql.symbol.XMLAttributes;
-import org.teiid.query.sql.symbol.XMLElement;
-import org.teiid.query.sql.symbol.XMLForest;
-import org.teiid.query.sql.symbol.XMLNamespaces;
-import org.teiid.query.sql.symbol.XMLParse;
-import org.teiid.query.sql.symbol.XMLQuery;
-import org.teiid.query.sql.symbol.XMLSerialize;
-import org.teiid.query.sql.util.SymbolMap;
-import org.teiid.query.sql.visitor.EvaluatableVisitor;
-import org.teiid.query.sql.visitor.GroupCollectorVisitor;
-
-
-/**
- */
-public class CriteriaCapabilityValidatorVisitor extends LanguageVisitor {
-
- // Initialization state
- private Object modelID;
- private QueryMetadataInterface metadata;
- private CapabilitiesFinder capFinder;
- private AnalysisRecord analysisRecord;
-
- // Retrieved during initialization and cached
- private SourceCapabilities caps;
-
- // Output state
- private TeiidComponentException exception;
- private boolean valid = true;
-
- /**
- * @param iterator
- * @throws TeiidComponentException
- * @throws QueryMetadataException
- */
- CriteriaCapabilityValidatorVisitor(Object modelID, QueryMetadataInterface metadata, CapabilitiesFinder capFinder, SourceCapabilities caps) throws QueryMetadataException, TeiidComponentException {
- this.modelID = modelID;
- this.metadata = metadata;
- this.capFinder = capFinder;
- this.caps = caps;
- }
-
- @Override
- public void visit(XMLAttributes obj) {
- markInvalid(obj, "Pushdown of XMLAttributes not allowed"); //$NON-NLS-1$
- }
-
- @Override
- public void visit(XMLNamespaces obj) {
- markInvalid(obj, "Pushdown of XMLNamespaces not allowed"); //$NON-NLS-1$
- }
-
- @Override
- public void visit(TextLine obj) {
- markInvalid(obj, "Pushdown of TextLine not allowed"); //$NON-NLS-1$
- }
-
- @Override
- public void visit(XMLForest obj) {
- markInvalid(obj, "Pushdown of XMLForest not allowed"); //$NON-NLS-1$
- }
-
- @Override
- public void visit(XMLElement obj) {
- markInvalid(obj, "Pushdown of XMLElement not allowed"); //$NON-NLS-1$
- }
-
- @Override
- public void visit(XMLSerialize obj) {
- markInvalid(obj, "Pushdown of XMLSerialize not allowed"); //$NON-NLS-1$
- }
-
- @Override
- public void visit(XMLParse obj) {
- markInvalid(obj, "Pushdown of XMLParse not allowed"); //$NON-NLS-1$
- }
-
- @Override
- public void visit(XMLQuery obj) {
- markInvalid(obj, "Pushdown of XMLQuery not allowed"); //$NON-NLS-1$
- }
-
- @Override
- public void visit(QueryString obj) {
- markInvalid(obj, "Pushdown of QueryString not allowed"); //$NON-NLS-1$
- }
-
- public void visit(AggregateSymbol obj) {
- try {
- if(! CapabilitiesUtil.supportsAggregateFunction(modelID, obj, metadata, capFinder)) {
- markInvalid(obj, "Aggregate function pushdown not supported by source"); //$NON-NLS-1$
- }
- } catch(QueryMetadataException e) {
- handleException(new TeiidComponentException(e));
- } catch(TeiidComponentException e) {
- handleException(e);
- }
- }
-
- public void visit(CaseExpression obj) {
- if(! this.caps.supportsCapability(Capability.QUERY_CASE)) {
- markInvalid(obj, "CaseExpression pushdown not supported by source"); //$NON-NLS-1$
- }
- }
-
- public void visit(CompareCriteria obj) {
- checkCompareCriteria(obj);
- }
-
- public void checkCompareCriteria(AbstractCompareCriteria obj) {
- boolean negated = false;
- // Check if operation is allowed
- Capability operatorCap = null;
- switch(obj.getOperator()) {
- case CompareCriteria.NE:
- negated = true;
- case CompareCriteria.EQ:
- operatorCap = Capability.CRITERIA_COMPARE_EQ;
- break;
- case CompareCriteria.LT:
- case CompareCriteria.GT:
- negated = true;
- case CompareCriteria.LE:
- case CompareCriteria.GE:
- operatorCap = Capability.CRITERIA_COMPARE_ORDERED;
- break;
- }
-
- // Check if compares are allowed
- if(! this.caps.supportsCapability(operatorCap)) {
- markInvalid(obj, "ordered CompareCriteria not supported by source"); //$NON-NLS-1$
- return;
- }
- if (negated && !this.caps.supportsCapability(Capability.CRITERIA_NOT)) {
- markInvalid(obj, "Negation is not supported by source"); //$NON-NLS-1$
- return;
- }
-
- // Check capabilities of the elements
- try {
- checkElementsAreSearchable(obj, SupportConstants.Element.SEARCHABLE_COMPARE);
- } catch(QueryMetadataException e) {
- handleException(new TeiidComponentException(e));
- } catch(TeiidComponentException e) {
- handleException(e);
- }
- }
-
- public void visit(CompoundCriteria crit) {
- int operator = crit.getOperator();
-
- // Verify capabilities are supported
- if(operator == CompoundCriteria.OR && !this.caps.supportsCapability(Capability.CRITERIA_OR)) {
- markInvalid(crit, "OR criteria not supported by source"); //$NON-NLS-1$
- }
- }
-
- public void visit(Function obj) {
- try {
- //if the function can be evaluated then return as it will get replaced during the final rewrite
- if (EvaluatableVisitor.willBecomeConstant(obj, true)) {
- return;
- }
- if(obj.getFunctionDescriptor().getPushdown() == FunctionMethod.CANNOT_PUSHDOWN) {
- markInvalid(obj, "Function metadata indicates it cannot be pusheddown."); //$NON-NLS-1$
- return;
- }
- if (! CapabilitiesUtil.supportsScalarFunction(modelID, obj, metadata, capFinder)) {
- markInvalid(obj, (obj.isImplicit()?"(implicit) convert":"") + " Function not supported by source"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- } catch(QueryMetadataException e) {
- handleException(new TeiidComponentException(e));
- } catch(TeiidComponentException e) {
- handleException(e);
- }
- }
-
- public void visit(IsNullCriteria obj) {
- // Check if compares are allowed
- if(! this.caps.supportsCapability(Capability.CRITERIA_ISNULL)) {
- markInvalid(obj, "IsNull not supported by source"); //$NON-NLS-1$
- return;
- }
-
- if (obj.isNegated() && !this.caps.supportsCapability(Capability.CRITERIA_NOT)) {
- markInvalid(obj, "Negation is not supported by source"); //$NON-NLS-1$
- return;
- }
- }
-
- public void visit(MatchCriteria obj) {
- // Check if compares are allowed
- if(! this.caps.supportsCapability(Capability.CRITERIA_LIKE)) {
- markInvalid(obj, "Like is not supported by source"); //$NON-NLS-1$
- return;
- }
-
- // Check ESCAPE char if necessary
- if(obj.getEscapeChar() != MatchCriteria.NULL_ESCAPE_CHAR) {
- if(! this.caps.supportsCapability(Capability.CRITERIA_LIKE_ESCAPE)) {
- markInvalid(obj, "Like escape is not supported by source"); //$NON-NLS-1$
- return;
- }
- }
-
- //check NOT
- if(obj.isNegated() && ! this.caps.supportsCapability(Capability.CRITERIA_NOT)) {
- markInvalid(obj, "Negation is not supported by source"); //$NON-NLS-1$
- return;
- }
-
- // Check capabilities of the elements
- try {
- checkElementsAreSearchable(obj, SupportConstants.Element.SEARCHABLE_LIKE);
- } catch(QueryMetadataException e) {
- handleException(new TeiidComponentException(e));
- } catch(TeiidComponentException e) {
- handleException(e);
- }
- }
-
- public void visit(NotCriteria obj) {
- // Check if compares are allowed
- if(! this.caps.supportsCapability(Capability.CRITERIA_NOT)) {
- markInvalid(obj, "Negation is not supported by source"); //$NON-NLS-1$
- return;
- }
- }
-
- public void visit(SearchedCaseExpression obj) {
- if(! this.caps.supportsCapability(Capability.QUERY_SEARCHED_CASE)) {
- markInvalid(obj, "SearchedCase is not supported by source"); //$NON-NLS-1$
- }
- }
-
- public void visit(SetCriteria crit) {
- checkAbstractSetCriteria(crit);
- try {
- int maxSize = CapabilitiesUtil.getMaxInCriteriaSize(modelID, metadata, capFinder);
-
- if (maxSize > 0 && crit.getValues().size() > maxSize) {
- markInvalid(crit, "SetCriteria size exceeds maximum for source"); //$NON-NLS-1$
- return;
- }
- } catch(QueryMetadataException e) {
- handleException(new TeiidComponentException(e));
- } catch(TeiidComponentException e) {
- handleException(e);
- }
- }
-
- /**
- * @see org.teiid.query.sql.LanguageVisitor#visit(org.teiid.query.sql.lang.ExistsCriteria)
- */
- public void visit(ExistsCriteria crit) {
- // Check if exists criteria are allowed
- if(! this.caps.supportsCapability(Capability.CRITERIA_EXISTS)) {
- markInvalid(crit, "Exists is not supported by source"); //$NON-NLS-1$
- return;
- }
-
- try {
- if (validateSubqueryPushdown(crit, modelID, metadata, capFinder, analysisRecord) == null) {
- markInvalid(crit.getCommand(), "Subquery cannot be pushed down"); //$NON-NLS-1$
- }
- } catch (TeiidComponentException e) {
- handleException(e);
- }
- }
-
- /**
- * @see org.teiid.query.sql.LanguageVisitor#visit(org.teiid.query.sql.lang.SubqueryCompareCriteria)
- */
- public void visit(SubqueryCompareCriteria crit) {
- // Check if quantification operator is allowed
- Capability capability = Capability.QUERY_SUBQUERIES_SCALAR;
- switch(crit.getPredicateQuantifier()) {
- case SubqueryCompareCriteria.ALL:
- capability = Capability.CRITERIA_QUANTIFIED_ALL;
- break;
- case SubqueryCompareCriteria.ANY:
- capability = Capability.CRITERIA_QUANTIFIED_SOME;
- break;
- case SubqueryCompareCriteria.SOME:
- capability = Capability.CRITERIA_QUANTIFIED_SOME;
- break;
- }
- if(! this.caps.supportsCapability(capability)) {
- markInvalid(crit, "SubqueryCompare not supported by source"); //$NON-NLS-1$
- return;
- }
-
- checkCompareCriteria(crit);
-
- // Check capabilities of the elements
- try {
- if (validateSubqueryPushdown(crit, modelID, metadata, capFinder, analysisRecord) == null) {
- markInvalid(crit.getCommand(), "Subquery cannot be pushed down"); //$NON-NLS-1$
- }
- } catch(QueryMetadataException e) {
- handleException(new TeiidComponentException(e));
- } catch(TeiidComponentException e) {
- handleException(e);
- }
- }
-
- @Override
- public void visit(ScalarSubquery obj) {
- try {
- if(!this.caps.supportsCapability(Capability.QUERY_SUBQUERIES_SCALAR)
- || validateSubqueryPushdown(obj, modelID, metadata, capFinder, analysisRecord) == null) {
- if (obj.getCommand().getCorrelatedReferences() == null) {
- obj.setShouldEvaluate(true);
- } else {
- markInvalid(obj.getCommand(), !this.caps.supportsCapability(Capability.QUERY_SUBQUERIES_SCALAR)?
- "Correlated ScalarSubquery is not supported":"Subquery cannot be pushed down"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- } catch(QueryMetadataException e) {
- handleException(new TeiidComponentException(e));
- } catch(TeiidComponentException e) {
- handleException(e);
- }
- }
-
- public void visit(SubquerySetCriteria crit) {
- checkAbstractSetCriteria(crit);
- try {
- // Check if compares with subqueries are allowed
- if(! this.caps.supportsCapability(Capability.CRITERIA_IN_SUBQUERY)) {
- markInvalid(crit, "SubqueryIn is not supported by source"); //$NON-NLS-1$
- return;
- }
-
- if (validateSubqueryPushdown(crit, modelID, metadata, capFinder, analysisRecord) == null) {
- markInvalid(crit.getCommand(), "Subquery cannot be pushed down"); //$NON-NLS-1$
- }
- } catch(QueryMetadataException e) {
- handleException(new TeiidComponentException(e));
- } catch(TeiidComponentException e) {
- handleException(e);
- }
- }
-
- public void checkAbstractSetCriteria(AbstractSetCriteria crit) {
- try {
- // Check if compares are allowed
- if(! this.caps.supportsCapability(Capability.CRITERIA_IN)) {
- markInvalid(crit, "In is not supported by source"); //$NON-NLS-1$
- return;
- }
-
- if (crit.isNegated() && !this.caps.supportsCapability(Capability.CRITERIA_NOT)) {
- markInvalid(crit, "Negation is not supported by source"); //$NON-NLS-1$
- return;
- }
- // Check capabilities of the elements
- checkElementsAreSearchable(crit, SupportConstants.Element.SEARCHABLE_COMPARE);
-
- } catch(QueryMetadataException e) {
- handleException(new TeiidComponentException(e));
- } catch(TeiidComponentException e) {
- handleException(e);
- }
-
- }
-
- public void visit(DependentSetCriteria crit) {
- checkAbstractSetCriteria(crit);
- }
-
- private void checkElementsAreSearchable(LanguageObject crit, int searchableType)
- throws QueryMetadataException, TeiidComponentException {
- if (!CapabilitiesUtil.checkElementsAreSearchable(Arrays.asList(crit), metadata, searchableType)) {
- markInvalid(crit, "not all source columns support search type"); //$NON-NLS-1$
- }
- }
-
- /**
- * Return null if the subquery cannot be pushed down, otherwise the model
- * id of the pushdown target.
- * @param subqueryContainer
- * @param critNodeModelID
- * @param metadata
- * @param capFinder
- * @return
- * @throws TeiidComponentException
- */
- public static Object validateSubqueryPushdown(SubqueryContainer subqueryContainer, Object critNodeModelID,
- QueryMetadataInterface metadata, CapabilitiesFinder capFinder, AnalysisRecord analysisRecord) throws TeiidComponentException {
- ProcessorPlan plan = subqueryContainer.getCommand().getProcessorPlan();
- if (plan != null) {
- QueryCommand queryCommand = getQueryCommand(plan);
-
- if (queryCommand == null) {
- return null;
- }
-
- critNodeModelID = validateCommandPushdown(critNodeModelID, metadata, capFinder, queryCommand);
- }
- if (critNodeModelID == null) {
- return null;
- }
- // Check whether source supports correlated subqueries and if not, whether criteria has them
- SymbolMap refs = subqueryContainer.getCommand().getCorrelatedReferences();
- try {
- if(refs != null && !refs.asMap().isEmpty()) {
- if(! CapabilitiesUtil.supports(Capability.QUERY_SUBQUERIES_CORRELATED, critNodeModelID, metadata, capFinder)) {
- return null;
- }
- //TODO: this check sees as correlated references as coming from the containing scope
- //but this is only an issue with deeply nested subqueries
- if (!CriteriaCapabilityValidatorVisitor.canPushLanguageObject(subqueryContainer.getCommand(), critNodeModelID, metadata, capFinder, analysisRecord )) {
- return null;
- }
- }
- } catch(QueryMetadataException e) {
- throw new TeiidComponentException(e);
- }
-
- // Found no reason why this node is not eligible
- return critNodeModelID;
- }
-
- public static Object validateCommandPushdown(Object critNodeModelID,
- QueryMetadataInterface metadata, CapabilitiesFinder capFinder,
- QueryCommand queryCommand) throws TeiidComponentException {
- // Check that query in access node is for the same model as current node
- try {
- Collection subQueryGroups = GroupCollectorVisitor.getGroupsIgnoreInlineViews(queryCommand, false);
- if(subQueryGroups.size() == 0) {
- // No FROM?
- return null;
- }
- GroupSymbol subQueryGroup = (GroupSymbol)subQueryGroups.iterator().next();
-
- Object modelID = subQueryGroup.getModelMetadataId();
- if (modelID == null) {
- modelID = metadata.getModelID(subQueryGroup.getMetadataID());
- }
- if (critNodeModelID == null) {
- critNodeModelID = modelID;
- } else if(!CapabilitiesUtil.isSameConnector(critNodeModelID, modelID, metadata, capFinder)) {
- return null;
- }
- } catch(QueryMetadataException e) {
- throw new TeiidComponentException(e, QueryPlugin.Util.getString("RulePushSelectCriteria.Error_getting_modelID")); //$NON-NLS-1$
- }
- return critNodeModelID;
- }
-
- public static QueryCommand getQueryCommand(ProcessorPlan plan) {
- if(!(plan instanceof RelationalPlan)) {
- return null;
- }
-
- RelationalPlan rplan = (RelationalPlan) plan;
-
- // Check that the plan is just an access node
- RelationalNode accessNode = rplan.getRootNode();
- if(accessNode == null || ! (accessNode instanceof AccessNode) || accessNode.getChildren()[0] != null) {
- return null;
- }
-
- // Check that command in access node is a query
- Command command = ((AccessNode)accessNode).getCommand();
- if(command == null || !(command instanceof QueryCommand) || ((command instanceof Query) && ((Query)command).getIsXML())) {
- return null;
- }
-
- QueryCommand queryCommand = (QueryCommand)command;
- return queryCommand;
- }
-
- private void handleException(TeiidComponentException e) {
- this.valid = false;
- this.exception = e;
- setAbort(true);
- }
-
- public TeiidComponentException getException() {
- return this.exception;
- }
-
- private void markInvalid(LanguageObject object, String reason) {
- this.valid = false;
- setAbort(true);
- if (analysisRecord != null && analysisRecord.recordDebug()) {
- analysisRecord.println(reason + " " + object); //$NON-NLS-1$
- }
- }
-
- public boolean isValid() {
- return this.valid;
- }
-
- public static boolean canPushLanguageObject(LanguageObject obj, Object modelID, QueryMetadataInterface metadata, CapabilitiesFinder capFinder, AnalysisRecord analysisRecord) throws QueryMetadataException, TeiidComponentException {
- if(obj == null) {
- return true;
- }
-
- if(modelID == null || metadata.isVirtualModel(modelID)) {
- // Couldn't determine model ID, so give up
- return false;
- }
-
- String modelName = metadata.getFullName(modelID);
- SourceCapabilities caps = capFinder.findCapabilities(modelName);
-
- if (caps == null) {
- return true; //this doesn't seem right, but tests were expecting it...
- }
-
- CriteriaCapabilityValidatorVisitor visitor = new CriteriaCapabilityValidatorVisitor(modelID, metadata, capFinder, caps);
- PreOrderNavigator.doVisit(obj, visitor);
-
- if(visitor.getException() != null) {
- throw visitor.getException();
- }
-
- return visitor.isValid();
- }
-
-}
Copied: tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java (from rev 2707, branches/7.2.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java)
===================================================================
--- tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java (rev 0)
+++ tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java 2010-11-05 03:19:55 UTC (rev 2709)
@@ -0,0 +1,591 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.query.optimizer.relational.rules;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.teiid.api.exception.query.QueryMetadataException;
+import org.teiid.core.TeiidComponentException;
+import org.teiid.query.QueryPlugin;
+import org.teiid.query.analysis.AnalysisRecord;
+import org.teiid.query.function.metadata.FunctionMethod;
+import org.teiid.query.metadata.QueryMetadataInterface;
+import org.teiid.query.metadata.SupportConstants;
+import org.teiid.query.optimizer.capabilities.CapabilitiesFinder;
+import org.teiid.query.optimizer.capabilities.SourceCapabilities;
+import org.teiid.query.optimizer.capabilities.SourceCapabilities.Capability;
+import org.teiid.query.processor.ProcessorPlan;
+import org.teiid.query.processor.relational.AccessNode;
+import org.teiid.query.processor.relational.RelationalNode;
+import org.teiid.query.processor.relational.RelationalPlan;
+import org.teiid.query.sql.LanguageObject;
+import org.teiid.query.sql.LanguageVisitor;
+import org.teiid.query.sql.lang.AbstractCompareCriteria;
+import org.teiid.query.sql.lang.AbstractSetCriteria;
+import org.teiid.query.sql.lang.Command;
+import org.teiid.query.sql.lang.CompareCriteria;
+import org.teiid.query.sql.lang.CompoundCriteria;
+import org.teiid.query.sql.lang.DependentSetCriteria;
+import org.teiid.query.sql.lang.ExistsCriteria;
+import org.teiid.query.sql.lang.IsNullCriteria;
+import org.teiid.query.sql.lang.MatchCriteria;
+import org.teiid.query.sql.lang.NotCriteria;
+import org.teiid.query.sql.lang.Query;
+import org.teiid.query.sql.lang.QueryCommand;
+import org.teiid.query.sql.lang.SetCriteria;
+import org.teiid.query.sql.lang.SubqueryCompareCriteria;
+import org.teiid.query.sql.lang.SubqueryContainer;
+import org.teiid.query.sql.lang.SubquerySetCriteria;
+import org.teiid.query.sql.navigator.PreOrderNavigator;
+import org.teiid.query.sql.symbol.AggregateSymbol;
+import org.teiid.query.sql.symbol.CaseExpression;
+import org.teiid.query.sql.symbol.Function;
+import org.teiid.query.sql.symbol.GroupSymbol;
+import org.teiid.query.sql.symbol.QueryString;
+import org.teiid.query.sql.symbol.ScalarSubquery;
+import org.teiid.query.sql.symbol.SearchedCaseExpression;
+import org.teiid.query.sql.symbol.TextLine;
+import org.teiid.query.sql.symbol.XMLAttributes;
+import org.teiid.query.sql.symbol.XMLElement;
+import org.teiid.query.sql.symbol.XMLForest;
+import org.teiid.query.sql.symbol.XMLNamespaces;
+import org.teiid.query.sql.symbol.XMLParse;
+import org.teiid.query.sql.symbol.XMLQuery;
+import org.teiid.query.sql.symbol.XMLSerialize;
+import org.teiid.query.sql.util.SymbolMap;
+import org.teiid.query.sql.visitor.EvaluatableVisitor;
+import org.teiid.query.sql.visitor.GroupCollectorVisitor;
+
+
+/**
+ */
+public class CriteriaCapabilityValidatorVisitor extends LanguageVisitor {
+
+ // Initialization state
+ private Object modelID;
+ private QueryMetadataInterface metadata;
+ private CapabilitiesFinder capFinder;
+ private AnalysisRecord analysisRecord;
+
+ // Retrieved during initialization and cached
+ private SourceCapabilities caps;
+
+ // Output state
+ private TeiidComponentException exception;
+ private boolean valid = true;
+
+ /**
+ * @param iterator
+ * @throws TeiidComponentException
+ * @throws QueryMetadataException
+ */
+ CriteriaCapabilityValidatorVisitor(Object modelID, QueryMetadataInterface metadata, CapabilitiesFinder capFinder, SourceCapabilities caps) throws QueryMetadataException, TeiidComponentException {
+ this.modelID = modelID;
+ this.metadata = metadata;
+ this.capFinder = capFinder;
+ this.caps = caps;
+ }
+
+ @Override
+ public void visit(XMLAttributes obj) {
+ markInvalid(obj, "Pushdown of XMLAttributes not allowed"); //$NON-NLS-1$
+ }
+
+ @Override
+ public void visit(XMLNamespaces obj) {
+ markInvalid(obj, "Pushdown of XMLNamespaces not allowed"); //$NON-NLS-1$
+ }
+
+ @Override
+ public void visit(TextLine obj) {
+ markInvalid(obj, "Pushdown of TextLine not allowed"); //$NON-NLS-1$
+ }
+
+ @Override
+ public void visit(XMLForest obj) {
+ markInvalid(obj, "Pushdown of XMLForest not allowed"); //$NON-NLS-1$
+ }
+
+ @Override
+ public void visit(XMLElement obj) {
+ markInvalid(obj, "Pushdown of XMLElement not allowed"); //$NON-NLS-1$
+ }
+
+ @Override
+ public void visit(XMLSerialize obj) {
+ markInvalid(obj, "Pushdown of XMLSerialize not allowed"); //$NON-NLS-1$
+ }
+
+ @Override
+ public void visit(XMLParse obj) {
+ markInvalid(obj, "Pushdown of XMLParse not allowed"); //$NON-NLS-1$
+ }
+
+ @Override
+ public void visit(XMLQuery obj) {
+ markInvalid(obj, "Pushdown of XMLQuery not allowed"); //$NON-NLS-1$
+ }
+
+ @Override
+ public void visit(QueryString obj) {
+ markInvalid(obj, "Pushdown of QueryString not allowed"); //$NON-NLS-1$
+ }
+
+ public void visit(AggregateSymbol obj) {
+ try {
+ if(! CapabilitiesUtil.supportsAggregateFunction(modelID, obj, metadata, capFinder)) {
+ markInvalid(obj, "Aggregate function pushdown not supported by source"); //$NON-NLS-1$
+ }
+ } catch(QueryMetadataException e) {
+ handleException(new TeiidComponentException(e));
+ } catch(TeiidComponentException e) {
+ handleException(e);
+ }
+ }
+
+ public void visit(CaseExpression obj) {
+ if(! this.caps.supportsCapability(Capability.QUERY_CASE)) {
+ markInvalid(obj, "CaseExpression pushdown not supported by source"); //$NON-NLS-1$
+ }
+ }
+
+ public void visit(CompareCriteria obj) {
+ checkCompareCriteria(obj);
+ }
+
+ public void checkCompareCriteria(AbstractCompareCriteria obj) {
+ boolean negated = false;
+ // Check if operation is allowed
+ Capability operatorCap = null;
+ switch(obj.getOperator()) {
+ case CompareCriteria.NE:
+ negated = true;
+ case CompareCriteria.EQ:
+ operatorCap = Capability.CRITERIA_COMPARE_EQ;
+ break;
+ case CompareCriteria.LT:
+ case CompareCriteria.GT:
+ negated = true;
+ case CompareCriteria.LE:
+ case CompareCriteria.GE:
+ operatorCap = Capability.CRITERIA_COMPARE_ORDERED;
+ break;
+ }
+
+ // Check if compares are allowed
+ if(! this.caps.supportsCapability(operatorCap)) {
+ markInvalid(obj, "ordered CompareCriteria not supported by source"); //$NON-NLS-1$
+ return;
+ }
+ if (negated && !this.caps.supportsCapability(Capability.CRITERIA_NOT)) {
+ markInvalid(obj, "Negation is not supported by source"); //$NON-NLS-1$
+ return;
+ }
+
+ // Check capabilities of the elements
+ try {
+ checkElementsAreSearchable(obj, SupportConstants.Element.SEARCHABLE_COMPARE);
+ } catch(QueryMetadataException e) {
+ handleException(new TeiidComponentException(e));
+ } catch(TeiidComponentException e) {
+ handleException(e);
+ }
+ }
+
+ public void visit(CompoundCriteria crit) {
+ int operator = crit.getOperator();
+
+ // Verify capabilities are supported
+ if(operator == CompoundCriteria.OR && !this.caps.supportsCapability(Capability.CRITERIA_OR)) {
+ markInvalid(crit, "OR criteria not supported by source"); //$NON-NLS-1$
+ }
+ }
+
+ public void visit(Function obj) {
+ try {
+ //if the function can be evaluated then return as it will get replaced during the final rewrite
+ if (EvaluatableVisitor.willBecomeConstant(obj, true)) {
+ return;
+ }
+ if(obj.getFunctionDescriptor().getPushdown() == FunctionMethod.CANNOT_PUSHDOWN) {
+ markInvalid(obj, "Function metadata indicates it cannot be pusheddown."); //$NON-NLS-1$
+ return;
+ }
+ if (! CapabilitiesUtil.supportsScalarFunction(modelID, obj, metadata, capFinder)) {
+ markInvalid(obj, (obj.isImplicit()?"(implicit) ":"") + obj.getName() + " function not supported by source"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ } catch(QueryMetadataException e) {
+ handleException(new TeiidComponentException(e));
+ } catch(TeiidComponentException e) {
+ handleException(e);
+ }
+ }
+
+ public void visit(IsNullCriteria obj) {
+ // Check if compares are allowed
+ if(! this.caps.supportsCapability(Capability.CRITERIA_ISNULL)) {
+ markInvalid(obj, "IsNull not supported by source"); //$NON-NLS-1$
+ return;
+ }
+
+ if (obj.isNegated() && !this.caps.supportsCapability(Capability.CRITERIA_NOT)) {
+ markInvalid(obj, "Negation is not supported by source"); //$NON-NLS-1$
+ return;
+ }
+ }
+
+ public void visit(MatchCriteria obj) {
+ // Check if compares are allowed
+ if(! this.caps.supportsCapability(Capability.CRITERIA_LIKE)) {
+ markInvalid(obj, "Like is not supported by source"); //$NON-NLS-1$
+ return;
+ }
+
+ // Check ESCAPE char if necessary
+ if(obj.getEscapeChar() != MatchCriteria.NULL_ESCAPE_CHAR) {
+ if(! this.caps.supportsCapability(Capability.CRITERIA_LIKE_ESCAPE)) {
+ markInvalid(obj, "Like escape is not supported by source"); //$NON-NLS-1$
+ return;
+ }
+ }
+
+ //check NOT
+ if(obj.isNegated() && ! this.caps.supportsCapability(Capability.CRITERIA_NOT)) {
+ markInvalid(obj, "Negation is not supported by source"); //$NON-NLS-1$
+ return;
+ }
+
+ // Check capabilities of the elements
+ try {
+ checkElementsAreSearchable(obj, SupportConstants.Element.SEARCHABLE_LIKE);
+ } catch(QueryMetadataException e) {
+ handleException(new TeiidComponentException(e));
+ } catch(TeiidComponentException e) {
+ handleException(e);
+ }
+ }
+
+ public void visit(NotCriteria obj) {
+ // Check if compares are allowed
+ if(! this.caps.supportsCapability(Capability.CRITERIA_NOT)) {
+ markInvalid(obj, "Negation is not supported by source"); //$NON-NLS-1$
+ return;
+ }
+ }
+
+ public void visit(SearchedCaseExpression obj) {
+ if(! this.caps.supportsCapability(Capability.QUERY_SEARCHED_CASE)) {
+ markInvalid(obj, "SearchedCase is not supported by source"); //$NON-NLS-1$
+ }
+ }
+
+ public void visit(SetCriteria crit) {
+ checkAbstractSetCriteria(crit);
+ try {
+ int maxSize = CapabilitiesUtil.getMaxInCriteriaSize(modelID, metadata, capFinder);
+
+ if (maxSize > 0 && crit.getValues().size() > maxSize) {
+ markInvalid(crit, "SetCriteria size exceeds maximum for source"); //$NON-NLS-1$
+ return;
+ }
+ } catch(QueryMetadataException e) {
+ handleException(new TeiidComponentException(e));
+ } catch(TeiidComponentException e) {
+ handleException(e);
+ }
+ }
+
+ /**
+ * @see org.teiid.query.sql.LanguageVisitor#visit(org.teiid.query.sql.lang.ExistsCriteria)
+ */
+ public void visit(ExistsCriteria crit) {
+ // Check if exists criteria are allowed
+ if(! this.caps.supportsCapability(Capability.CRITERIA_EXISTS)) {
+ markInvalid(crit, "Exists is not supported by source"); //$NON-NLS-1$
+ return;
+ }
+
+ try {
+ if (validateSubqueryPushdown(crit, modelID, metadata, capFinder, analysisRecord) == null) {
+ markInvalid(crit.getCommand(), "Subquery cannot be pushed down"); //$NON-NLS-1$
+ }
+ } catch (TeiidComponentException e) {
+ handleException(e);
+ }
+ }
+
+ /**
+ * @see org.teiid.query.sql.LanguageVisitor#visit(org.teiid.query.sql.lang.SubqueryCompareCriteria)
+ */
+ public void visit(SubqueryCompareCriteria crit) {
+ // Check if quantification operator is allowed
+ Capability capability = Capability.QUERY_SUBQUERIES_SCALAR;
+ switch(crit.getPredicateQuantifier()) {
+ case SubqueryCompareCriteria.ALL:
+ capability = Capability.CRITERIA_QUANTIFIED_ALL;
+ break;
+ case SubqueryCompareCriteria.ANY:
+ capability = Capability.CRITERIA_QUANTIFIED_SOME;
+ break;
+ case SubqueryCompareCriteria.SOME:
+ capability = Capability.CRITERIA_QUANTIFIED_SOME;
+ break;
+ }
+ if(! this.caps.supportsCapability(capability)) {
+ markInvalid(crit, "SubqueryCompare not supported by source"); //$NON-NLS-1$
+ return;
+ }
+
+ checkCompareCriteria(crit);
+
+ // Check capabilities of the elements
+ try {
+ if (validateSubqueryPushdown(crit, modelID, metadata, capFinder, analysisRecord) == null) {
+ markInvalid(crit.getCommand(), "Subquery cannot be pushed down"); //$NON-NLS-1$
+ }
+ } catch(QueryMetadataException e) {
+ handleException(new TeiidComponentException(e));
+ } catch(TeiidComponentException e) {
+ handleException(e);
+ }
+ }
+
+ @Override
+ public void visit(ScalarSubquery obj) {
+ try {
+ if(!this.caps.supportsCapability(Capability.QUERY_SUBQUERIES_SCALAR)
+ || validateSubqueryPushdown(obj, modelID, metadata, capFinder, analysisRecord) == null) {
+ if (obj.getCommand().getCorrelatedReferences() == null) {
+ obj.setShouldEvaluate(true);
+ } else {
+ markInvalid(obj.getCommand(), !this.caps.supportsCapability(Capability.QUERY_SUBQUERIES_SCALAR)?
+ "Correlated ScalarSubquery is not supported":"Subquery cannot be pushed down"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ } catch(QueryMetadataException e) {
+ handleException(new TeiidComponentException(e));
+ } catch(TeiidComponentException e) {
+ handleException(e);
+ }
+ }
+
+ public void visit(SubquerySetCriteria crit) {
+ checkAbstractSetCriteria(crit);
+ try {
+ // Check if compares with subqueries are allowed
+ if(! this.caps.supportsCapability(Capability.CRITERIA_IN_SUBQUERY)) {
+ markInvalid(crit, "SubqueryIn is not supported by source"); //$NON-NLS-1$
+ return;
+ }
+
+ if (validateSubqueryPushdown(crit, modelID, metadata, capFinder, analysisRecord) == null) {
+ markInvalid(crit.getCommand(), "Subquery cannot be pushed down"); //$NON-NLS-1$
+ }
+ } catch(QueryMetadataException e) {
+ handleException(new TeiidComponentException(e));
+ } catch(TeiidComponentException e) {
+ handleException(e);
+ }
+ }
+
+ public void checkAbstractSetCriteria(AbstractSetCriteria crit) {
+ try {
+ // Check if compares are allowed
+ if(! this.caps.supportsCapability(Capability.CRITERIA_IN)) {
+ markInvalid(crit, "In is not supported by source"); //$NON-NLS-1$
+ return;
+ }
+
+ if (crit.isNegated() && !this.caps.supportsCapability(Capability.CRITERIA_NOT)) {
+ markInvalid(crit, "Negation is not supported by source"); //$NON-NLS-1$
+ return;
+ }
+ // Check capabilities of the elements
+ checkElementsAreSearchable(crit, SupportConstants.Element.SEARCHABLE_COMPARE);
+
+ } catch(QueryMetadataException e) {
+ handleException(new TeiidComponentException(e));
+ } catch(TeiidComponentException e) {
+ handleException(e);
+ }
+
+ }
+
+ public void visit(DependentSetCriteria crit) {
+ checkAbstractSetCriteria(crit);
+ }
+
+ private void checkElementsAreSearchable(LanguageObject crit, int searchableType)
+ throws QueryMetadataException, TeiidComponentException {
+ if (!CapabilitiesUtil.checkElementsAreSearchable(Arrays.asList(crit), metadata, searchableType)) {
+ markInvalid(crit, "not all source columns support search type"); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Return null if the subquery cannot be pushed down, otherwise the model
+ * id of the pushdown target.
+ * @param subqueryContainer
+ * @param critNodeModelID
+ * @param metadata
+ * @param capFinder
+ * @return
+ * @throws TeiidComponentException
+ */
+ public static Object validateSubqueryPushdown(SubqueryContainer subqueryContainer, Object critNodeModelID,
+ QueryMetadataInterface metadata, CapabilitiesFinder capFinder, AnalysisRecord analysisRecord) throws TeiidComponentException {
+ ProcessorPlan plan = subqueryContainer.getCommand().getProcessorPlan();
+ if (plan != null) {
+ QueryCommand queryCommand = getQueryCommand(plan);
+
+ if (queryCommand == null) {
+ return null;
+ }
+
+ critNodeModelID = validateCommandPushdown(critNodeModelID, metadata, capFinder, queryCommand);
+ }
+ if (critNodeModelID == null) {
+ return null;
+ }
+ // Check whether source supports correlated subqueries and if not, whether criteria has them
+ SymbolMap refs = subqueryContainer.getCommand().getCorrelatedReferences();
+ try {
+ if(refs != null && !refs.asMap().isEmpty()) {
+ if(! CapabilitiesUtil.supports(Capability.QUERY_SUBQUERIES_CORRELATED, critNodeModelID, metadata, capFinder)) {
+ return null;
+ }
+ //TODO: this check sees as correlated references as coming from the containing scope
+ //but this is only an issue with deeply nested subqueries
+ if (!CriteriaCapabilityValidatorVisitor.canPushLanguageObject(subqueryContainer.getCommand(), critNodeModelID, metadata, capFinder, analysisRecord )) {
+ return null;
+ }
+ }
+ } catch(QueryMetadataException e) {
+ throw new TeiidComponentException(e);
+ }
+
+ // Found no reason why this node is not eligible
+ return critNodeModelID;
+ }
+
+ public static Object validateCommandPushdown(Object critNodeModelID,
+ QueryMetadataInterface metadata, CapabilitiesFinder capFinder,
+ QueryCommand queryCommand) throws TeiidComponentException {
+ // Check that query in access node is for the same model as current node
+ try {
+ Collection subQueryGroups = GroupCollectorVisitor.getGroupsIgnoreInlineViews(queryCommand, false);
+ if(subQueryGroups.size() == 0) {
+ // No FROM?
+ return null;
+ }
+ GroupSymbol subQueryGroup = (GroupSymbol)subQueryGroups.iterator().next();
+
+ Object modelID = subQueryGroup.getModelMetadataId();
+ if (modelID == null) {
+ modelID = metadata.getModelID(subQueryGroup.getMetadataID());
+ }
+ if (critNodeModelID == null) {
+ critNodeModelID = modelID;
+ } else if(!CapabilitiesUtil.isSameConnector(critNodeModelID, modelID, metadata, capFinder)) {
+ return null;
+ }
+ } catch(QueryMetadataException e) {
+ throw new TeiidComponentException(e, QueryPlugin.Util.getString("RulePushSelectCriteria.Error_getting_modelID")); //$NON-NLS-1$
+ }
+ return critNodeModelID;
+ }
+
+ public static QueryCommand getQueryCommand(ProcessorPlan plan) {
+ if(!(plan instanceof RelationalPlan)) {
+ return null;
+ }
+
+ RelationalPlan rplan = (RelationalPlan) plan;
+
+ // Check that the plan is just an access node
+ RelationalNode accessNode = rplan.getRootNode();
+ if(accessNode == null || ! (accessNode instanceof AccessNode) || accessNode.getChildren()[0] != null) {
+ return null;
+ }
+
+ // Check that command in access node is a query
+ Command command = ((AccessNode)accessNode).getCommand();
+ if(command == null || !(command instanceof QueryCommand) || ((command instanceof Query) && ((Query)command).getIsXML())) {
+ return null;
+ }
+
+ QueryCommand queryCommand = (QueryCommand)command;
+ return queryCommand;
+ }
+
+ private void handleException(TeiidComponentException e) {
+ this.valid = false;
+ this.exception = e;
+ setAbort(true);
+ }
+
+ public TeiidComponentException getException() {
+ return this.exception;
+ }
+
+ private void markInvalid(LanguageObject object, String reason) {
+ this.valid = false;
+ setAbort(true);
+ if (analysisRecord != null && analysisRecord.recordDebug()) {
+ analysisRecord.println(reason + " " + object); //$NON-NLS-1$
+ }
+ }
+
+ public boolean isValid() {
+ return this.valid;
+ }
+
+ public static boolean canPushLanguageObject(LanguageObject obj, Object modelID, QueryMetadataInterface metadata, CapabilitiesFinder capFinder, AnalysisRecord analysisRecord) throws QueryMetadataException, TeiidComponentException {
+ if(obj == null) {
+ return true;
+ }
+
+ if(modelID == null || metadata.isVirtualModel(modelID)) {
+ // Couldn't determine model ID, so give up
+ return false;
+ }
+
+ String modelName = metadata.getFullName(modelID);
+ SourceCapabilities caps = capFinder.findCapabilities(modelName);
+
+ if (caps == null) {
+ return true; //this doesn't seem right, but tests were expecting it...
+ }
+
+ CriteriaCapabilityValidatorVisitor visitor = new CriteriaCapabilityValidatorVisitor(modelID, metadata, capFinder, caps);
+ PreOrderNavigator.doVisit(obj, visitor);
+
+ if(visitor.getException() != null) {
+ throw visitor.getException();
+ }
+
+ return visitor.isValid();
+ }
+
+}
Deleted: tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/query/optimizer/relational/rules/JoinRegion.java
===================================================================
--- branches/7.2.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/JoinRegion.java 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/query/optimizer/relational/rules/JoinRegion.java 2010-11-05 03:19:55 UTC (rev 2709)
@@ -1,515 +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.query.optimizer.relational.rules;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.teiid.api.exception.query.QueryMetadataException;
-import org.teiid.core.TeiidComponentException;
-import org.teiid.query.function.metadata.FunctionMethod;
-import org.teiid.query.metadata.QueryMetadataInterface;
-import org.teiid.query.optimizer.relational.RelationalPlanner;
-import org.teiid.query.optimizer.relational.plantree.NodeConstants;
-import org.teiid.query.optimizer.relational.plantree.PlanNode;
-import org.teiid.query.resolver.util.AccessPattern;
-import org.teiid.query.sql.lang.CompareCriteria;
-import org.teiid.query.sql.lang.CompoundCriteria;
-import org.teiid.query.sql.lang.Criteria;
-import org.teiid.query.sql.symbol.ElementSymbol;
-import org.teiid.query.sql.symbol.Expression;
-import org.teiid.query.sql.symbol.Function;
-import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.visitor.ElementCollectorVisitor;
-import org.teiid.query.sql.visitor.FunctionCollectorVisitor;
-import org.teiid.query.sql.visitor.GroupsUsedByElementsVisitor;
-
-
-/**
- * A join region is a set of cross and inner joins whose ordering is completely interchangeable.
- *
- * It can be conceptually thought of as:
- * Criteria node some combination of groups A, B, C
- * Criteria node some combination of groups A, B, C
- * ...
- * Join
- * JoinSourceA
- * JoinSourceB
- * JoinSourceC
- *
- * A full binary join tree is then constructed out of this join region such that all of the
- * criteria is pushed to its lowest point.
- *
- */
-class JoinRegion {
-
- private PlanNode joinRoot;
-
- public static final int UNKNOWN_TUPLE_EST = 100000;
-
- private LinkedHashMap<PlanNode, PlanNode> dependentJoinSourceNodes = new LinkedHashMap<PlanNode, PlanNode>();
- private LinkedHashMap<PlanNode, PlanNode> joinSourceNodes = new LinkedHashMap<PlanNode, PlanNode>();
-
- private List<PlanNode> dependentCritieraNodes = new ArrayList<PlanNode>();
- private List<PlanNode> criteriaNodes = new ArrayList<PlanNode>();
-
- private List<Collection<AccessPattern>> unsatisfiedAccessPatterns = new LinkedList<Collection<AccessPattern>>();
- private boolean containsNestedTable;
-
- private Map<ElementSymbol, Set<Collection<GroupSymbol>>> dependentCriteriaElements;
- private Map<PlanNode, Set<PlanNode>> critieriaToSourceMap;
-
- public PlanNode getJoinRoot() {
- return joinRoot;
- }
-
- public void setContainsNestedTable(boolean containsNestedTable) {
- this.containsNestedTable = containsNestedTable;
- }
-
- public boolean containsNestedTable() {
- return containsNestedTable;
- }
-
- public List<Collection<AccessPattern>> getUnsatisfiedAccessPatterns() {
- return unsatisfiedAccessPatterns;
- }
-
- public Map<PlanNode, PlanNode> getJoinSourceNodes() {
- return joinSourceNodes;
- }
-
- public Map<PlanNode, PlanNode> getDependentJoinSourceNodes() {
- return dependentJoinSourceNodes;
- }
-
- public List<PlanNode> getCriteriaNodes() {
- return criteriaNodes;
- }
-
- public List<PlanNode> getDependentCriteriaNodes() {
- return dependentCritieraNodes;
- }
-
- public Map<ElementSymbol, Set<Collection<GroupSymbol>>> getDependentCriteriaElements() {
- return this.dependentCriteriaElements;
- }
-
- public Map<PlanNode, Set<PlanNode>> getCritieriaToSourceMap() {
- return this.critieriaToSourceMap;
- }
-
- public void addJoinSourceNode(PlanNode sourceNode) {
- PlanNode root = sourceNode;
- while (root.getParent() != null && root.getParent().getType() == NodeConstants.Types.SELECT) {
- root = root.getParent();
- }
- if (sourceNode.hasCollectionProperty(NodeConstants.Info.ACCESS_PATTERNS)) {
- Collection<AccessPattern> aps = (Collection<AccessPattern>)sourceNode.getProperty(NodeConstants.Info.ACCESS_PATTERNS);
- unsatisfiedAccessPatterns.add(aps);
- dependentJoinSourceNodes.put(sourceNode, root);
- } else {
- joinSourceNodes.put(sourceNode, root);
- }
-
- if (joinRoot == null) {
- joinRoot = root;
- }
- }
-
- public void addParentCriteria(PlanNode sourceNode) {
- PlanNode parent = sourceNode.getParent();
- while (parent != null && parent.getType() == NodeConstants.Types.SELECT) {
- criteriaNodes.add(parent);
- sourceNode = parent;
- parent = parent.getParent();
- }
- if (joinRoot == null) {
- joinRoot = sourceNode;
- }
- }
-
- public void addJoinCriteriaList(List<? extends Criteria> joinCriteria) {
- if (joinCriteria == null || joinCriteria.isEmpty()) {
- return;
- }
- for (Criteria crit : joinCriteria) {
- criteriaNodes.add(RelationalPlanner.createSelectNode(crit, false));
- }
- }
-
- /**
- * This will rebuild the join tree starting at the join root.
- *
- * A left linear tree will be constructed out of the ordering of the
- * join sources.
- *
- * Criteria nodes are simply placed at the top of the join region in order
- * to be pushed by rule PushSelectSriteria.
- *
- */
- public void reconstructJoinRegoin() {
- LinkedHashMap<PlanNode, PlanNode> combined = new LinkedHashMap<PlanNode, PlanNode>(joinSourceNodes);
- combined.putAll(dependentJoinSourceNodes);
-
- PlanNode root = null;
-
- if (combined.size() < 2) {
- root = combined.values().iterator().next();
- root.removeProperty(NodeConstants.Info.EST_CARDINALITY);
- } else {
- root = RulePlanJoins.createJoinNode();
-
- for (Map.Entry<PlanNode, PlanNode> entry : combined.entrySet()) {
- PlanNode joinSourceRoot = entry.getValue();
- joinSourceRoot.removeProperty(NodeConstants.Info.EST_CARDINALITY);
- if (root.getChildCount() == 2) {
- PlanNode parentJoin = RulePlanJoins.createJoinNode();
- parentJoin.addFirstChild(root);
- parentJoin.addGroups(root.getGroups());
- root = parentJoin;
- }
- root.addLastChild(joinSourceRoot);
- root.addGroups(entry.getKey().getGroups());
- }
- }
- LinkedList<PlanNode> criteria = new LinkedList<PlanNode>(dependentCritieraNodes);
- criteria.addAll(criteriaNodes);
-
- PlanNode parent = this.joinRoot.getParent();
-
- boolean isLeftChild = parent.getFirstChild() == this.joinRoot;
-
- parent.removeChild(joinRoot);
-
- for (PlanNode critNode : criteria) {
- critNode.removeFromParent();
- critNode.removeAllChildren();
- critNode.addFirstChild(root);
- root = critNode;
- critNode.removeProperty(NodeConstants.Info.IS_COPIED);
- critNode.removeProperty(NodeConstants.Info.EST_CARDINALITY);
- }
-
- if (isLeftChild) {
- parent.addFirstChild(root);
- } else {
- parent.addLastChild(root);
- }
- this.joinRoot = root;
- }
-
- /**
- * Will provide an estimate of cost by summing the estimated tuples flowing through
- * each intermediate join.
- *
- * @param joinOrder
- * @param metadata
- * @return
- * @throws TeiidComponentException
- * @throws QueryMetadataException
- */
- public double scoreRegion(Object[] joinOrder, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException {
- List<Map.Entry<PlanNode, PlanNode>> joinSourceEntries = new ArrayList<Map.Entry<PlanNode, PlanNode>>(joinSourceNodes.entrySet());
- double totalIntermediatCost = 0;
- double cost = 1;
-
- HashSet<PlanNode> criteria = new HashSet<PlanNode>(this.criteriaNodes);
- HashSet<GroupSymbol> groups = new HashSet<GroupSymbol>(this.joinSourceNodes.size());
-
- for (int i = 0; i < joinOrder.length; i++) {
- Integer source = (Integer)joinOrder[i];
-
- Map.Entry<PlanNode, PlanNode> entry = joinSourceEntries.get(source.intValue());
- PlanNode joinSourceRoot = entry.getValue();
-
- //check to make sure that this group ordering satisfies the access patterns
- if (!this.unsatisfiedAccessPatterns.isEmpty() || this.containsNestedTable) {
- PlanNode joinSource = entry.getKey();
-
- Collection<GroupSymbol> requiredGroups = (Collection<GroupSymbol>)joinSource.getProperty(NodeConstants.Info.REQUIRED_ACCESS_PATTERN_GROUPS);
-
- if (requiredGroups != null && !groups.containsAll(requiredGroups)) {
- return Double.MAX_VALUE;
- }
- }
-
- groups.addAll(joinSourceRoot.getGroups());
-
- float sourceCost = ((Float)joinSourceRoot.getProperty(NodeConstants.Info.EST_CARDINALITY)).floatValue();
-
- List<PlanNode> applicableCriteria = null;
-
- if (!criteria.isEmpty() && i > 0) {
- applicableCriteria = getJoinCriteriaForGroups(groups, criteria);
- }
-
- if (sourceCost == NewCalculateCostUtil.UNKNOWN_VALUE) {
- sourceCost = UNKNOWN_TUPLE_EST;
- if (applicableCriteria != null && !applicableCriteria.isEmpty()) {
- CompoundCriteria cc = new CompoundCriteria();
- for (PlanNode planNode : applicableCriteria) {
- cc.addCriteria((Criteria) planNode.getProperty(NodeConstants.Info.SELECT_CRITERIA));
- }
- sourceCost = (float)cost;
- criteria.removeAll(applicableCriteria);
- applicableCriteria = null;
- if (NewCalculateCostUtil.usesKey(cc, metadata)) {
- sourceCost = Math.min(UNKNOWN_TUPLE_EST, sourceCost * Math.min(NewCalculateCostUtil.UNKNOWN_JOIN_SCALING, sourceCost));
- } else {
- sourceCost = Math.min(UNKNOWN_TUPLE_EST, sourceCost * Math.min(NewCalculateCostUtil.UNKNOWN_JOIN_SCALING * 2, sourceCost));
- }
- }
- } else if (Double.isInfinite(sourceCost) || Double.isNaN(sourceCost)) {
- return Double.MAX_VALUE;
- }
-
- cost *= sourceCost;
-
- if (applicableCriteria != null) {
- for (PlanNode criteriaNode : applicableCriteria) {
- float filter = ((Float)criteriaNode.getProperty(NodeConstants.Info.EST_SELECTIVITY)).floatValue();
-
- cost *= filter;
- }
-
- criteria.removeAll(applicableCriteria);
- }
- totalIntermediatCost += cost;
- }
-
- return totalIntermediatCost;
- }
-
- /**
- * Returns true if every element in an unsatisfied access pattern can be satisfied by the current join criteria
- * This does not necessarily mean that a join tree will be successfully created
- */
- public boolean isSatisfiable() {
- for (Collection<AccessPattern> accessPatterns : getUnsatisfiedAccessPatterns()) {
- boolean matchedAll = false;
- for (AccessPattern ap : accessPatterns) {
- if (dependentCriteriaElements.keySet().containsAll(ap.getUnsatisfied())) {
- matchedAll = true;
- break;
- }
- }
- if (!matchedAll) {
- return false;
- }
- }
-
- return true;
- }
-
- public void initializeCostingInformation(QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException {
- for (PlanNode node : joinSourceNodes.values()) {
- NewCalculateCostUtil.computeCostForTree(node, metadata);
- }
-
- estimateCriteriaSelectivity(metadata);
- }
-
- /**
- * @param metadata
- * @throws QueryMetadataException
- * @throws TeiidComponentException
- */
- private void estimateCriteriaSelectivity(QueryMetadataInterface metadata) throws QueryMetadataException,
- TeiidComponentException {
- for (PlanNode node : criteriaNodes) {
- Criteria crit = (Criteria)node.getProperty(NodeConstants.Info.SELECT_CRITERIA);
-
- float[] baseCosts = new float[] {100, 10000, 1000000};
-
- float filterValue = 0;
-
- for (int j = 0; j < baseCosts.length; j++) {
- float filter = NewCalculateCostUtil.recursiveEstimateCostOfCriteria(baseCosts[j], node, crit, metadata);
-
- filterValue += filter/baseCosts[j];
- }
-
- filterValue /= baseCosts.length;
-
- node.setProperty(NodeConstants.Info.EST_SELECTIVITY, new Float(filterValue));
- }
- }
-
- /**
- * Initializes information on the joinRegion about dependency information, etc.
- *
- * TODO: assumptions are made here about how dependent criteria must look that are a little restrictive
- */
- public void initializeJoinInformation() {
- critieriaToSourceMap = new HashMap<PlanNode, Set<PlanNode>>();
-
- LinkedList<PlanNode> crits = new LinkedList<PlanNode>(criteriaNodes);
- crits.addAll(dependentCritieraNodes);
-
- LinkedHashMap<PlanNode, PlanNode> source = new LinkedHashMap<PlanNode, PlanNode>(joinSourceNodes);
- source.putAll(dependentJoinSourceNodes);
-
- for (PlanNode critNode : crits) {
- for (GroupSymbol group : critNode.getGroups()) {
- for (PlanNode node : source.keySet()) {
- if (node.getGroups().contains(group)) {
- Set<PlanNode> sources = critieriaToSourceMap.get(critNode);
- if (sources == null) {
- sources = new HashSet<PlanNode>();
- critieriaToSourceMap.put(critNode, sources);
- }
- sources.add(node);
- break;
- }
- }
- }
- }
-
- if (unsatisfiedAccessPatterns.isEmpty()) {
- return;
- }
-
- Map<GroupSymbol, PlanNode> dependentGroupToSourceMap = new HashMap<GroupSymbol, PlanNode>();
-
- for (PlanNode node : dependentJoinSourceNodes.keySet()) {
- for (GroupSymbol symbol : node.getGroups()) {
- dependentGroupToSourceMap.put(symbol, node);
- }
- }
-
- for (Iterator<PlanNode> i = getCriteriaNodes().iterator(); i.hasNext();) {
- PlanNode node = i.next();
-
- for (GroupSymbol symbol : node.getGroups()) {
- if (dependentGroupToSourceMap.containsKey(symbol)) {
- i.remove();
- dependentCritieraNodes.add(node);
- break;
- }
- }
- }
-
- dependentCriteriaElements = new HashMap<ElementSymbol, Set<Collection<GroupSymbol>>>();
-
- for (PlanNode critNode : dependentCritieraNodes) {
- Criteria crit = (Criteria)critNode.getProperty(NodeConstants.Info.SELECT_CRITERIA);
- if(!(crit instanceof CompareCriteria)) {
- continue;
- }
- CompareCriteria compCrit = (CompareCriteria) crit;
- if(compCrit.getOperator() != CompareCriteria.EQ) {
- continue;
- }
- CompareCriteria compareCriteria = (CompareCriteria)crit;
- //this may be a proper dependent join criteria
- Collection<ElementSymbol>[] critElements = new Collection[2];
- critElements[0] = ElementCollectorVisitor.getElements(compareCriteria.getLeftExpression(), true);
- if (critElements[0].isEmpty()) {
- continue;
- }
- critElements[1] = ElementCollectorVisitor.getElements(compareCriteria.getRightExpression(), true);
- if (critElements[1].isEmpty()) {
- continue;
- }
- for (int expr = 0; expr < critElements.length; expr++) {
- //simplifying assumption that there will be a single element on the dependent side
- if (critElements[expr].size() != 1) {
- continue;
- }
- ElementSymbol elem = critElements[expr].iterator().next();
- if (!dependentGroupToSourceMap.containsKey(elem.getGroupSymbol())) {
- continue;
- }
- //this is also a simplifying assumption. don't consider criteria that can't be pushed
- if (containsFunctionsThatCannotBePushed(expr==0?compareCriteria.getRightExpression():compareCriteria.getLeftExpression())) {
- continue;
- }
- Set<Collection<GroupSymbol>> independentGroups = dependentCriteriaElements.get(elem);
- if (independentGroups == null) {
- independentGroups = new HashSet<Collection<GroupSymbol>>();
- dependentCriteriaElements.put(elem, independentGroups);
- }
- //set the other side as independent elements
- independentGroups.add(GroupsUsedByElementsVisitor.getGroups(critElements[(expr+1)%2]));
- }
- }
- }
-
- /**
- * Returns true if the expression is, or contains, any functions that cannot be pushed
- * down to the source
- * @param expression
- * @return
- * @since 4.2
- */
- private static boolean containsFunctionsThatCannotBePushed(Expression expression) {
- Iterator functions = FunctionCollectorVisitor.getFunctions(expression, true).iterator();
- while (functions.hasNext()) {
- Function function = (Function)functions.next();
- if (function.getFunctionDescriptor().getPushdown() == FunctionMethod.CANNOT_PUSHDOWN) {
- return true;
- }
- }
- return false;
- }
-
- public List<PlanNode> getJoinCriteriaForGroups(Set<GroupSymbol> groups) {
- return getJoinCriteriaForGroups(groups, getCriteriaNodes());
- }
-
- //TODO: this should be better than a linear search
- protected List<PlanNode> getJoinCriteriaForGroups(Set<GroupSymbol> groups, Collection<PlanNode> nodes) {
- List<PlanNode> result = new LinkedList<PlanNode>();
-
- for (PlanNode critNode : nodes) {
- if (groups.containsAll(critNode.getGroups())) {
- result.add(critNode);
- }
- }
-
- return result;
- }
-
- public void changeJoinOrder(Object[] joinOrder) {
- List<Map.Entry<PlanNode, PlanNode>> joinSourceEntries = new ArrayList<Map.Entry<PlanNode, PlanNode>>(joinSourceNodes.entrySet());
-
- for (int i = 0; i < joinOrder.length; i++) {
- Integer source = (Integer)joinOrder[i];
-
- Map.Entry<PlanNode, PlanNode> entry = joinSourceEntries.get(source.intValue());
-
- this.joinSourceNodes.remove(entry.getKey());
- this.joinSourceNodes.put(entry.getKey(), entry.getValue());
- }
- }
-
-}
\ No newline at end of file
Copied: tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/query/optimizer/relational/rules/JoinRegion.java (from rev 2707, branches/7.2.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/JoinRegion.java)
===================================================================
--- tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/query/optimizer/relational/rules/JoinRegion.java (rev 0)
+++ tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/query/optimizer/relational/rules/JoinRegion.java 2010-11-05 03:19:55 UTC (rev 2709)
@@ -0,0 +1,513 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.query.optimizer.relational.rules;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.teiid.api.exception.query.QueryMetadataException;
+import org.teiid.core.TeiidComponentException;
+import org.teiid.query.function.metadata.FunctionMethod;
+import org.teiid.query.metadata.QueryMetadataInterface;
+import org.teiid.query.optimizer.relational.RelationalPlanner;
+import org.teiid.query.optimizer.relational.plantree.NodeConstants;
+import org.teiid.query.optimizer.relational.plantree.PlanNode;
+import org.teiid.query.resolver.util.AccessPattern;
+import org.teiid.query.sql.lang.CompareCriteria;
+import org.teiid.query.sql.lang.CompoundCriteria;
+import org.teiid.query.sql.lang.Criteria;
+import org.teiid.query.sql.symbol.ElementSymbol;
+import org.teiid.query.sql.symbol.Expression;
+import org.teiid.query.sql.symbol.Function;
+import org.teiid.query.sql.symbol.GroupSymbol;
+import org.teiid.query.sql.visitor.ElementCollectorVisitor;
+import org.teiid.query.sql.visitor.FunctionCollectorVisitor;
+import org.teiid.query.sql.visitor.GroupsUsedByElementsVisitor;
+
+
+/**
+ * A join region is a set of cross and inner joins whose ordering is completely interchangeable.
+ *
+ * It can be conceptually thought of as:
+ * Criteria node some combination of groups A, B, C
+ * Criteria node some combination of groups A, B, C
+ * ...
+ * Join
+ * JoinSourceA
+ * JoinSourceB
+ * JoinSourceC
+ *
+ * A full binary join tree is then constructed out of this join region such that all of the
+ * criteria is pushed to its lowest point.
+ *
+ */
+class JoinRegion {
+
+ private PlanNode joinRoot;
+
+ public static final int UNKNOWN_TUPLE_EST = 100000;
+
+ private LinkedHashMap<PlanNode, PlanNode> dependentJoinSourceNodes = new LinkedHashMap<PlanNode, PlanNode>();
+ private LinkedHashMap<PlanNode, PlanNode> joinSourceNodes = new LinkedHashMap<PlanNode, PlanNode>();
+
+ private List<PlanNode> dependentCritieraNodes = new ArrayList<PlanNode>();
+ private List<PlanNode> criteriaNodes = new ArrayList<PlanNode>();
+
+ private List<Collection<AccessPattern>> unsatisfiedAccessPatterns = new LinkedList<Collection<AccessPattern>>();
+ private boolean containsNestedTable;
+
+ private Map<ElementSymbol, Set<Collection<GroupSymbol>>> dependentCriteriaElements;
+ private Map<PlanNode, Set<PlanNode>> critieriaToSourceMap;
+
+ public PlanNode getJoinRoot() {
+ return joinRoot;
+ }
+
+ public void setContainsNestedTable(boolean containsNestedTable) {
+ this.containsNestedTable = containsNestedTable;
+ }
+
+ public boolean containsNestedTable() {
+ return containsNestedTable;
+ }
+
+ public List<Collection<AccessPattern>> getUnsatisfiedAccessPatterns() {
+ return unsatisfiedAccessPatterns;
+ }
+
+ public Map<PlanNode, PlanNode> getJoinSourceNodes() {
+ return joinSourceNodes;
+ }
+
+ public Map<PlanNode, PlanNode> getDependentJoinSourceNodes() {
+ return dependentJoinSourceNodes;
+ }
+
+ public List<PlanNode> getCriteriaNodes() {
+ return criteriaNodes;
+ }
+
+ public List<PlanNode> getDependentCriteriaNodes() {
+ return dependentCritieraNodes;
+ }
+
+ public Map<ElementSymbol, Set<Collection<GroupSymbol>>> getDependentCriteriaElements() {
+ return this.dependentCriteriaElements;
+ }
+
+ public Map<PlanNode, Set<PlanNode>> getCritieriaToSourceMap() {
+ return this.critieriaToSourceMap;
+ }
+
+ public void addJoinSourceNode(PlanNode sourceNode) {
+ PlanNode root = sourceNode;
+ while (root.getParent() != null && root.getParent().getType() == NodeConstants.Types.SELECT) {
+ root = root.getParent();
+ }
+ if (sourceNode.hasCollectionProperty(NodeConstants.Info.ACCESS_PATTERNS)) {
+ Collection<AccessPattern> aps = (Collection<AccessPattern>)sourceNode.getProperty(NodeConstants.Info.ACCESS_PATTERNS);
+ unsatisfiedAccessPatterns.add(aps);
+ dependentJoinSourceNodes.put(sourceNode, root);
+ } else {
+ joinSourceNodes.put(sourceNode, root);
+ }
+
+ if (joinRoot == null) {
+ joinRoot = root;
+ }
+ }
+
+ public void addParentCriteria(PlanNode sourceNode) {
+ PlanNode parent = sourceNode.getParent();
+ while (parent != null && parent.getType() == NodeConstants.Types.SELECT) {
+ criteriaNodes.add(parent);
+ sourceNode = parent;
+ parent = parent.getParent();
+ }
+ if (joinRoot == null) {
+ joinRoot = sourceNode;
+ }
+ }
+
+ public void addJoinCriteriaList(List<? extends Criteria> joinCriteria) {
+ if (joinCriteria == null || joinCriteria.isEmpty()) {
+ return;
+ }
+ for (Criteria crit : joinCriteria) {
+ criteriaNodes.add(RelationalPlanner.createSelectNode(crit, false));
+ }
+ }
+
+ /**
+ * This will rebuild the join tree starting at the join root.
+ *
+ * A left linear tree will be constructed out of the ordering of the
+ * join sources.
+ *
+ * Criteria nodes are simply placed at the top of the join region in order
+ * to be pushed by rule PushSelectSriteria.
+ *
+ */
+ public void reconstructJoinRegoin() {
+ LinkedHashMap<PlanNode, PlanNode> combined = new LinkedHashMap<PlanNode, PlanNode>(joinSourceNodes);
+ combined.putAll(dependentJoinSourceNodes);
+
+ PlanNode root = null;
+
+ if (combined.size() < 2) {
+ root = combined.values().iterator().next();
+ } else {
+ root = RulePlanJoins.createJoinNode();
+
+ for (Map.Entry<PlanNode, PlanNode> entry : combined.entrySet()) {
+ PlanNode joinSourceRoot = entry.getValue();
+ if (root.getChildCount() == 2) {
+ PlanNode parentJoin = RulePlanJoins.createJoinNode();
+ parentJoin.addFirstChild(root);
+ parentJoin.addGroups(root.getGroups());
+ root = parentJoin;
+ }
+ root.addLastChild(joinSourceRoot);
+ root.addGroups(entry.getKey().getGroups());
+ }
+ }
+ LinkedList<PlanNode> criteria = new LinkedList<PlanNode>(dependentCritieraNodes);
+ criteria.addAll(criteriaNodes);
+
+ PlanNode parent = this.joinRoot.getParent();
+
+ boolean isLeftChild = parent.getFirstChild() == this.joinRoot;
+
+ parent.removeChild(joinRoot);
+
+ for (PlanNode critNode : criteria) {
+ critNode.removeFromParent();
+ critNode.removeAllChildren();
+ critNode.addFirstChild(root);
+ root = critNode;
+ critNode.removeProperty(NodeConstants.Info.IS_COPIED);
+ critNode.removeProperty(NodeConstants.Info.EST_CARDINALITY);
+ }
+
+ if (isLeftChild) {
+ parent.addFirstChild(root);
+ } else {
+ parent.addLastChild(root);
+ }
+ this.joinRoot = root;
+ }
+
+ /**
+ * Will provide an estimate of cost by summing the estimated tuples flowing through
+ * each intermediate join.
+ *
+ * @param joinOrder
+ * @param metadata
+ * @return
+ * @throws TeiidComponentException
+ * @throws QueryMetadataException
+ */
+ public double scoreRegion(Object[] joinOrder, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException {
+ List<Map.Entry<PlanNode, PlanNode>> joinSourceEntries = new ArrayList<Map.Entry<PlanNode, PlanNode>>(joinSourceNodes.entrySet());
+ double totalIntermediatCost = 0;
+ double cost = 1;
+
+ HashSet<PlanNode> criteria = new HashSet<PlanNode>(this.criteriaNodes);
+ HashSet<GroupSymbol> groups = new HashSet<GroupSymbol>(this.joinSourceNodes.size());
+
+ for (int i = 0; i < joinOrder.length; i++) {
+ Integer source = (Integer)joinOrder[i];
+
+ Map.Entry<PlanNode, PlanNode> entry = joinSourceEntries.get(source.intValue());
+ PlanNode joinSourceRoot = entry.getValue();
+
+ //check to make sure that this group ordering satisfies the access patterns
+ if (!this.unsatisfiedAccessPatterns.isEmpty() || this.containsNestedTable) {
+ PlanNode joinSource = entry.getKey();
+
+ Collection<GroupSymbol> requiredGroups = (Collection<GroupSymbol>)joinSource.getProperty(NodeConstants.Info.REQUIRED_ACCESS_PATTERN_GROUPS);
+
+ if (requiredGroups != null && !groups.containsAll(requiredGroups)) {
+ return Double.MAX_VALUE;
+ }
+ }
+
+ groups.addAll(joinSourceRoot.getGroups());
+
+ float sourceCost = ((Float)joinSourceRoot.getProperty(NodeConstants.Info.EST_CARDINALITY)).floatValue();
+
+ List<PlanNode> applicableCriteria = null;
+
+ if (!criteria.isEmpty() && i > 0) {
+ applicableCriteria = getJoinCriteriaForGroups(groups, criteria);
+ }
+
+ if (sourceCost == NewCalculateCostUtil.UNKNOWN_VALUE) {
+ sourceCost = UNKNOWN_TUPLE_EST;
+ if (applicableCriteria != null && !applicableCriteria.isEmpty()) {
+ CompoundCriteria cc = new CompoundCriteria();
+ for (PlanNode planNode : applicableCriteria) {
+ cc.addCriteria((Criteria) planNode.getProperty(NodeConstants.Info.SELECT_CRITERIA));
+ }
+ sourceCost = (float)cost;
+ criteria.removeAll(applicableCriteria);
+ applicableCriteria = null;
+ if (NewCalculateCostUtil.usesKey(cc, metadata)) {
+ sourceCost = Math.min(UNKNOWN_TUPLE_EST, sourceCost * Math.min(NewCalculateCostUtil.UNKNOWN_JOIN_SCALING, sourceCost));
+ } else {
+ sourceCost = Math.min(UNKNOWN_TUPLE_EST, sourceCost * Math.min(NewCalculateCostUtil.UNKNOWN_JOIN_SCALING * 2, sourceCost));
+ }
+ }
+ } else if (Double.isInfinite(sourceCost) || Double.isNaN(sourceCost)) {
+ return Double.MAX_VALUE;
+ }
+
+ cost *= sourceCost;
+
+ if (applicableCriteria != null) {
+ for (PlanNode criteriaNode : applicableCriteria) {
+ float filter = ((Float)criteriaNode.getProperty(NodeConstants.Info.EST_SELECTIVITY)).floatValue();
+
+ cost *= filter;
+ }
+
+ criteria.removeAll(applicableCriteria);
+ }
+ totalIntermediatCost += cost;
+ }
+
+ return totalIntermediatCost;
+ }
+
+ /**
+ * Returns true if every element in an unsatisfied access pattern can be satisfied by the current join criteria
+ * This does not necessarily mean that a join tree will be successfully created
+ */
+ public boolean isSatisfiable() {
+ for (Collection<AccessPattern> accessPatterns : getUnsatisfiedAccessPatterns()) {
+ boolean matchedAll = false;
+ for (AccessPattern ap : accessPatterns) {
+ if (dependentCriteriaElements.keySet().containsAll(ap.getUnsatisfied())) {
+ matchedAll = true;
+ break;
+ }
+ }
+ if (!matchedAll) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public void initializeCostingInformation(QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException {
+ for (PlanNode node : joinSourceNodes.values()) {
+ NewCalculateCostUtil.computeCostForTree(node, metadata);
+ }
+
+ estimateCriteriaSelectivity(metadata);
+ }
+
+ /**
+ * @param metadata
+ * @throws QueryMetadataException
+ * @throws TeiidComponentException
+ */
+ private void estimateCriteriaSelectivity(QueryMetadataInterface metadata) throws QueryMetadataException,
+ TeiidComponentException {
+ for (PlanNode node : criteriaNodes) {
+ Criteria crit = (Criteria)node.getProperty(NodeConstants.Info.SELECT_CRITERIA);
+
+ float[] baseCosts = new float[] {100, 10000, 1000000};
+
+ float filterValue = 0;
+
+ for (int j = 0; j < baseCosts.length; j++) {
+ float filter = NewCalculateCostUtil.recursiveEstimateCostOfCriteria(baseCosts[j], node, crit, metadata);
+
+ filterValue += filter/baseCosts[j];
+ }
+
+ filterValue /= baseCosts.length;
+
+ node.setProperty(NodeConstants.Info.EST_SELECTIVITY, new Float(filterValue));
+ }
+ }
+
+ /**
+ * Initializes information on the joinRegion about dependency information, etc.
+ *
+ * TODO: assumptions are made here about how dependent criteria must look that are a little restrictive
+ */
+ public void initializeJoinInformation() {
+ critieriaToSourceMap = new HashMap<PlanNode, Set<PlanNode>>();
+
+ LinkedList<PlanNode> crits = new LinkedList<PlanNode>(criteriaNodes);
+ crits.addAll(dependentCritieraNodes);
+
+ LinkedHashMap<PlanNode, PlanNode> source = new LinkedHashMap<PlanNode, PlanNode>(joinSourceNodes);
+ source.putAll(dependentJoinSourceNodes);
+
+ for (PlanNode critNode : crits) {
+ for (GroupSymbol group : critNode.getGroups()) {
+ for (PlanNode node : source.keySet()) {
+ if (node.getGroups().contains(group)) {
+ Set<PlanNode> sources = critieriaToSourceMap.get(critNode);
+ if (sources == null) {
+ sources = new HashSet<PlanNode>();
+ critieriaToSourceMap.put(critNode, sources);
+ }
+ sources.add(node);
+ break;
+ }
+ }
+ }
+ }
+
+ if (unsatisfiedAccessPatterns.isEmpty()) {
+ return;
+ }
+
+ Map<GroupSymbol, PlanNode> dependentGroupToSourceMap = new HashMap<GroupSymbol, PlanNode>();
+
+ for (PlanNode node : dependentJoinSourceNodes.keySet()) {
+ for (GroupSymbol symbol : node.getGroups()) {
+ dependentGroupToSourceMap.put(symbol, node);
+ }
+ }
+
+ for (Iterator<PlanNode> i = getCriteriaNodes().iterator(); i.hasNext();) {
+ PlanNode node = i.next();
+
+ for (GroupSymbol symbol : node.getGroups()) {
+ if (dependentGroupToSourceMap.containsKey(symbol)) {
+ i.remove();
+ dependentCritieraNodes.add(node);
+ break;
+ }
+ }
+ }
+
+ dependentCriteriaElements = new HashMap<ElementSymbol, Set<Collection<GroupSymbol>>>();
+
+ for (PlanNode critNode : dependentCritieraNodes) {
+ Criteria crit = (Criteria)critNode.getProperty(NodeConstants.Info.SELECT_CRITERIA);
+ if(!(crit instanceof CompareCriteria)) {
+ continue;
+ }
+ CompareCriteria compCrit = (CompareCriteria) crit;
+ if(compCrit.getOperator() != CompareCriteria.EQ) {
+ continue;
+ }
+ CompareCriteria compareCriteria = (CompareCriteria)crit;
+ //this may be a proper dependent join criteria
+ Collection<ElementSymbol>[] critElements = new Collection[2];
+ critElements[0] = ElementCollectorVisitor.getElements(compareCriteria.getLeftExpression(), true);
+ if (critElements[0].isEmpty()) {
+ continue;
+ }
+ critElements[1] = ElementCollectorVisitor.getElements(compareCriteria.getRightExpression(), true);
+ if (critElements[1].isEmpty()) {
+ continue;
+ }
+ for (int expr = 0; expr < critElements.length; expr++) {
+ //simplifying assumption that there will be a single element on the dependent side
+ if (critElements[expr].size() != 1) {
+ continue;
+ }
+ ElementSymbol elem = critElements[expr].iterator().next();
+ if (!dependentGroupToSourceMap.containsKey(elem.getGroupSymbol())) {
+ continue;
+ }
+ //this is also a simplifying assumption. don't consider criteria that can't be pushed
+ if (containsFunctionsThatCannotBePushed(expr==0?compareCriteria.getRightExpression():compareCriteria.getLeftExpression())) {
+ continue;
+ }
+ Set<Collection<GroupSymbol>> independentGroups = dependentCriteriaElements.get(elem);
+ if (independentGroups == null) {
+ independentGroups = new HashSet<Collection<GroupSymbol>>();
+ dependentCriteriaElements.put(elem, independentGroups);
+ }
+ //set the other side as independent elements
+ independentGroups.add(GroupsUsedByElementsVisitor.getGroups(critElements[(expr+1)%2]));
+ }
+ }
+ }
+
+ /**
+ * Returns true if the expression is, or contains, any functions that cannot be pushed
+ * down to the source
+ * @param expression
+ * @return
+ * @since 4.2
+ */
+ private static boolean containsFunctionsThatCannotBePushed(Expression expression) {
+ Iterator functions = FunctionCollectorVisitor.getFunctions(expression, true).iterator();
+ while (functions.hasNext()) {
+ Function function = (Function)functions.next();
+ if (function.getFunctionDescriptor().getPushdown() == FunctionMethod.CANNOT_PUSHDOWN) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public List<PlanNode> getJoinCriteriaForGroups(Set<GroupSymbol> groups) {
+ return getJoinCriteriaForGroups(groups, getCriteriaNodes());
+ }
+
+ //TODO: this should be better than a linear search
+ protected List<PlanNode> getJoinCriteriaForGroups(Set<GroupSymbol> groups, Collection<PlanNode> nodes) {
+ List<PlanNode> result = new LinkedList<PlanNode>();
+
+ for (PlanNode critNode : nodes) {
+ if (groups.containsAll(critNode.getGroups())) {
+ result.add(critNode);
+ }
+ }
+
+ return result;
+ }
+
+ public void changeJoinOrder(Object[] joinOrder) {
+ List<Map.Entry<PlanNode, PlanNode>> joinSourceEntries = new ArrayList<Map.Entry<PlanNode, PlanNode>>(joinSourceNodes.entrySet());
+
+ for (int i = 0; i < joinOrder.length; i++) {
+ Integer source = (Integer)joinOrder[i];
+
+ Map.Entry<PlanNode, PlanNode> entry = joinSourceEntries.get(source.intValue());
+
+ this.joinSourceNodes.remove(entry.getKey());
+ this.joinSourceNodes.put(entry.getKey(), entry.getValue());
+ }
+ }
+
+}
\ No newline at end of file
Deleted: tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/query/optimizer/relational/rules/NewCalculateCostUtil.java
===================================================================
--- branches/7.2.x/engine/src/main/java/org/teiid/query/optimizer/relational/rules/NewCalculateCostUtil.java 2010-11-05 02:27:49 UTC (rev 2706)
+++ tags/teiid-parent-7.2.0.Final/engine/src/main/java/org/teiid/query/optimizer/relational/rules/NewCalculateCostUtil.java 2010-11-05 03:19:55 UTC (rev 2709)
@@ -1,1100 +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.query.optimizer.relational.rules;
-
-import java.sql.Date;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.teiid.api.exception.query.QueryMetadataException;
-import org.teiid.common.buffer.BufferManager;
-import org.teiid.core.TeiidComponentException;
-import org.teiid.core.types.DataTypeManager;
-import org.teiid.logging.LogConstants;
-import org.teiid.logging.LogManager;
-import org.teiid.query.QueryPlugin;
-import org.teiid.query.metadata.QueryMetadataInterface;
-import org.teiid.query.metadata.SupportConstants;
-import org.teiid.query.optimizer.capabilities.CapabilitiesFinder;
-import org.teiid.query.optimizer.relational.plantree.NodeConstants;
-import org.teiid.query.optimizer.relational.plantree.NodeEditor;
-import org.teiid.query.optimizer.relational.plantree.PlanNode;
-import org.teiid.query.processor.relational.JoinNode.JoinStrategyType;
-import org.teiid.query.sql.lang.AbstractSetCriteria;
-import org.teiid.query.sql.lang.CompareCriteria;
-import org.teiid.query.sql.lang.CompoundCriteria;
-import org.teiid.query.sql.lang.Criteria;
-import org.teiid.query.sql.lang.IsNullCriteria;
-import org.teiid.query.sql.lang.JoinType;
-import org.teiid.query.sql.lang.MatchCriteria;
-import org.teiid.query.sql.lang.NotCriteria;
-import org.teiid.query.sql.lang.PredicateCriteria;
-import org.teiid.query.sql.lang.SetCriteria;
-import org.teiid.query.sql.lang.SetQuery;
-import org.teiid.query.sql.lang.SubquerySetCriteria;
-import org.teiid.query.sql.symbol.Constant;
-import org.teiid.query.sql.symbol.ElementSymbol;
-import org.teiid.query.sql.symbol.Expression;
-import org.teiid.query.sql.symbol.GroupSymbol;
-import org.teiid.query.sql.symbol.SingleElementSymbol;
-import org.teiid.query.sql.util.SymbolMap;
-import org.teiid.query.sql.visitor.ElementCollectorVisitor;
-import org.teiid.query.sql.visitor.EvaluatableVisitor;
-import org.teiid.query.sql.visitor.GroupsUsedByElementsVisitor;
-import org.teiid.query.util.CommandContext;
-
-/**
- * @since 4.3
- */
-public class NewCalculateCostUtil {
-
- public static final int UNKNOWN_JOIN_SCALING = 20;
- public static final float UNKNOWN_VALUE = -1;
-
- // the following variables are used to hold cost estimates (roughly in milliseconds)
- private final static float compareTime = .05f; //TODO: a better estimate would be based upon the number of conjuncts
- private final static float readTime = .001f; //TODO: should come from the connector
- private final static float procNewRequestTime = 100; //TODO: should come from the connector
- private final static float procMoreRequestTime = 15; //TODO: should come from the connector
-
- /**
- * Calculate cost of a node and all children, recursively from the bottom up.
- * @param node
- * @param metadata
- * @return Cost computed at the passed node
- * @throws QueryMetadataException
- * @throws TeiidComponentException
- */
- static float computeCostForTree(PlanNode node, QueryMetadataInterface metadata)
- throws QueryMetadataException, TeiidComponentException {
-
- Float cost = (Float) node.getProperty(NodeConstants.Info.EST_CARDINALITY);
-
- // check if already computed
- if(cost == null) {
- for (PlanNode child : node.getChildren()) {
- computeCostForTree(child, metadata);
- }
- computeNodeCost(node, metadata);
- cost = (Float) node.getProperty(NodeConstants.Info.EST_CARDINALITY);
- }
-
- if(cost != null) {
- return cost.floatValue();
- }
-
- return UNKNOWN_VALUE;
- }
-
- /**
- * This method attempts to estimate a cost for each type of node.
- * @param node
- * @param metadata
- * @throws QueryMetadataException
- * @throws TeiidComponentException
- */
- private static void computeNodeCost(PlanNode node, QueryMetadataInterface metadata)
- throws QueryMetadataException, TeiidComponentException {
-
- switch(node.getType()) {
- case NodeConstants.Types.SOURCE:
- estimateSourceNodeCost(node, metadata);
- break;
-
- case NodeConstants.Types.SELECT:
- estimateSelectNodeCost(node, metadata);
- break;
-
- case NodeConstants.Types.JOIN:
- estimateJoinNodeCost(node, metadata);
- break;
-
- case NodeConstants.Types.DUP_REMOVE:
- estimateNodeCost(node, FrameUtil.findTopCols(node), metadata);
- break;
-
- case NodeConstants.Types.GROUP:
- if (!node.hasCollectionProperty(NodeConstants.Info.GROUP_COLS)) {
- setCardinalityEstimate(node, 1f);
- } else {
- estimateNodeCost(node, (List)node.getProperty(NodeConstants.Info.GROUP_COLS), metadata);
- }
- break;
- case NodeConstants.Types.ACCESS:
- case NodeConstants.Types.SORT:
- {
- //Simply record the cost of the only child
- PlanNode child = node.getFirstChild();
- Float childCost = (Float)child.getProperty(NodeConstants.Info.EST_CARDINALITY);
- setCardinalityEstimate(node, childCost);
- break;
- }
- case NodeConstants.Types.NULL:
- setCardinalityEstimate(node, 0f);
- break;
-
- case NodeConstants.Types.PROJECT:
- {
- Float childCost = null;
- //Simply record the cost of the only child
- if (node.getChildCount() != 0) {
- PlanNode child = node.getFirstChild();
- childCost = (Float)child.getProperty(NodeConstants.Info.EST_CARDINALITY);
- } else {
- childCost = 1f;
- }
- setCardinalityEstimate(node, childCost);
- break;
- }
- case NodeConstants.Types.SET_OP:
- {
- estimateSetOpCost(node, metadata);
- break;
- }
- case NodeConstants.Types.TUPLE_LIMIT:
- {
- PlanNode child = node.getFirstChild();
- float childCost = child.getCardinality();
-
- Expression offset = (Expression)node.getProperty(NodeConstants.Info.OFFSET_TUPLE_COUNT);
- Float cost = childCost;
-
- if (childCost != UNKNOWN_VALUE && offset instanceof Constant) {
- float offsetCost = childCost - ((Number)((Constant)offset).getValue()).floatValue();
- cost = new Float((offsetCost < 0) ? 0 : offsetCost);
- }
-
- Expression limit = (Expression)node.getProperty(NodeConstants.Info.MAX_TUPLE_LIMIT);
- if (limit instanceof Constant) {
- float limitCost = ((Number)((Constant)limit).getValue()).floatValue();
- if (cost.floatValue() != UNKNOWN_VALUE) {
- cost = new Float(Math.min(limitCost, cost.floatValue()));
- } else {
- cost = new Float(limitCost);
- }
- }
- setCardinalityEstimate(node, cost);
- break;
- }
- }
- }
-
- private static void estimateSetOpCost(PlanNode node,
- QueryMetadataInterface metadata) throws QueryMetadataException,
- TeiidComponentException {
- float cost = 0;
-
- SetQuery.Operation op = (SetQuery.Operation)node.getProperty(NodeConstants.Info.SET_OPERATION);
-
- float leftCost = (Float)node.getFirstChild().getProperty(NodeConstants.Info.EST_CARDINALITY);
- float rightCost = (Float)node.getLastChild().getProperty(NodeConstants.Info.EST_CARDINALITY);
-
- if (!node.hasBooleanProperty(NodeConstants.Info.USE_ALL)) {
- leftCost = getDistinctEstimate(node.getFirstChild(), metadata, leftCost);
- rightCost = getDistinctEstimate(node.getLastChild(), metadata, rightCost);
- }
-
- cost = leftCost;
-
- switch (op) {
- case EXCEPT:
- if (leftCost != UNKNOWN_VALUE && rightCost != UNKNOWN_VALUE) {
- cost = Math.max(1, leftCost - .5f * rightCost);
- }
- break;
- case INTERSECT:
- if (rightCost != UNKNOWN_VALUE) {
- if (leftCost != UNKNOWN_VALUE) {
- cost = .5f * Math.min(leftCost, rightCost);
- } else {
- cost = rightCost;
- }
- }
- break;
- default: //union
- if (leftCost != UNKNOWN_VALUE && rightCost != UNKNOWN_VALUE) {
- if (!node.hasBooleanProperty(NodeConstants.Info.USE_ALL)) {
- cost = Math.max(leftCost, rightCost) + .5f * Math.min(leftCost, rightCost);
- } else {
- cost = rightCost + leftCost;
- }
- }
- break;
- }
-
- setCardinalityEstimate(node, new Float(cost));
- }
-
- private static float getDistinctEstimate(PlanNode node,
- QueryMetadataInterface metadata, float cost)
- throws QueryMetadataException, TeiidComponentException {
- PlanNode projectNode = NodeEditor.findNodePreOrder(node, NodeConstants.Types.PROJECT);
- if (projectNode != null) {
- cost = getDistinctEstimate(projectNode, (List)projectNode.getProperty(NodeConstants.Info.PROJECT_COLS), metadata, cost);
- }
- return cost;
- }
-
- private static void setCardinalityEstimate(PlanNode node, Float bestEstimate) {
- if (bestEstimate == null){
- bestEstimate = Float.valueOf(UNKNOWN_VALUE);
- }
- node.setProperty(NodeConstants.Info.EST_CARDINALITY, bestEstimate);
- }
-
- /**
- * Method estimateJoinNodeCost.
- * @param node
- * @param metadata
- */
- private static void estimateJoinNodeCost(PlanNode node, QueryMetadataInterface metadata)
- throws QueryMetadataException, TeiidComponentException {
-
- Iterator<PlanNode> children = node.getChildren().iterator();
- PlanNode child1 = children.next();
- float childCost1 = child1.getCardinality();
- PlanNode child2 = children.next();
- float childCost2 = child2.getCardinality();
-
- if (childCost1 == UNKNOWN_VALUE || childCost2 == UNKNOWN_VALUE) {
- setCardinalityEstimate(node, null);
- return;
- }
-
- JoinType joinType = (JoinType)node.getProperty(NodeConstants.Info.JOIN_TYPE);
- List joinCriteria = (List) node.getProperty(NodeConstants.Info.JOIN_CRITERIA);
-
- float baseCost = childCost1 * childCost2;
-
- if (joinCriteria != null && !joinCriteria.isEmpty()) {
- Criteria crit = Criteria.combineCriteria(joinCriteria);
- //TODO: we may be able to get a fairly accurate join estimate if the
- //unknown side is being joined with a key
- baseCost = recursiveEstimateCostOfCriteria(baseCost, node, crit, metadata);
- }
-
- Float cost = null;
- if (JoinType.JOIN_CROSS.equals(joinType)){
- cost = new Float(baseCost);
- } else if (JoinType.JOIN_FULL_OUTER.equals(joinType)) {
- cost = new Float(Math.max((childCost1+childCost2),baseCost));
- } else if (JoinType.JOIN_LEFT_OUTER.equals(joinType)) {
- cost = new Float(Math.max(childCost1,baseCost));
- } else if (JoinType.JOIN_RIGHT_OUTER.equals(joinType)) {
- cost = new Float(Math.max(childCost2,baseCost));
- } else if (JoinType.JOIN_INNER.equals(joinType)) {
- cost = new Float(baseCost);
- }
-
- setCardinalityEstimate(node, cost);
- }
-
- /**
- * Estimate the cost of a selection. This is not easy to do without information
- * about the value count for each relation attribute.
- * @param metadata
- */
- private static void estimateSelectNodeCost(PlanNode node, QueryMetadataInterface metadata)
- throws QueryMetadataException, TeiidComponentException {
-
- PlanNode child = node.getFirstChild();
- float childCost = child.getCardinality();
-
- //Get list of conjuncts
- Criteria selectCriteria = (Criteria)node.getProperty(NodeConstants.Info.SELECT_CRITERIA);
- float newCost = recursiveEstimateCostOfCriteria(childCost, node, selectCriteria, metadata);
- setCardinalityEstimate(node, new Float(newCost));
- }
-
- /**
- * For a source node, the cost is basically the cardinality of the source
- * (if it is known).
- * @param node
- * @param metadata
- * @throws QueryMetadataException
- * @throws TeiidComponentException
- */
- private static void estimateSourceNodeCost(PlanNode node, QueryMetadataInterface metadata)
- throws QueryMetadataException, TeiidComponentException {
-
- float cost = UNKNOWN_VALUE;
- if(node.getChildCount() > 0) {
- SymbolMap references = (SymbolMap)node.getProperty(NodeConstants.Info.CORRELATED_REFERENCES);
- //only cost non-correlated TODO: a better estimate for correlated
- if (references == null) {
- PlanNode child = node.getFirstChild();
- cost = child.getCardinality();
- }
- }else {
- GroupSymbol group = node.getGroups().iterator().next();
- float cardinality = metadata.getCardinality(group.getMetadataID());
- if (cardinality <= QueryMetadataInterface.UNKNOWN_CARDINALITY){
- cardinality = UNKNOWN_VALUE;
- }
- cost = cardinality;
- }
-
- setCardinalityEstimate(node, new Float(cost));
- }
-
- /**
- * For a Group or Dup Removal node, the cost is basically the smaller of the largest NDV of the
- * selected columns and cost of the child node (if it is known).
- * @param node
- * @param metadata
- * @throws QueryMetadataException
- * @throws TeiidComponentException
- */
- private static void estimateNodeCost(PlanNode node, List expressions, QueryMetadataInterface metadata)
- throws QueryMetadataException, TeiidComponentException {
-
- PlanNode child = node.getFirstChild();
- float childCost = child.getCardinality();
-
- if(childCost == UNKNOWN_VALUE) {
- setCardinalityEstimate(node, null);
- return;
- }
-
- Float newCost = getDistinctEstimate(node, expressions, metadata, childCost);
- setCardinalityEstimate(node, newCost);
- }
-
- private static Float getDistinctEstimate(PlanNode node,
- List elements,
- QueryMetadataInterface metadata,
- float childCost) throws QueryMetadataException,
- TeiidComponentException {
- if(elements == null) {
- return new Float(childCost);
- }
- HashSet<ElementSymbol> elems = new HashSet<ElementSymbol>();
- ElementCollectorVisitor.getElements(elements, elems);
- if (usesKey(elements, metadata)) {
- return new Float(childCost);
- }
- float ndvCost = getNDV(elems, node, childCost, metadata);
- if(ndvCost == UNKNOWN_VALUE) {
- ndvCost = childCost;
- }
-
- Float newCost = new Float(Math.min(childCost, ndvCost));
- return newCost;
- }
-
- static float recursiveEstimateCostOfCriteria(float childCost, PlanNode currentNode, Criteria crit, QueryMetadataInterface metadata)
- throws QueryMetadataException, TeiidComponentException {
-
- float cost = childCost;
- if(crit instanceof CompoundCriteria) {
- CompoundCriteria compCrit = (CompoundCriteria) crit;
- if (compCrit.getOperator() == CompoundCriteria.OR) {
- cost = 0;
- }
- if (usesKey(compCrit, metadata)) {
- return 1;
- }
- for (Criteria critPart : compCrit.getCriteria()) {
- float nextCost = recursiveEstimateCostOfCriteria(childCost, currentNode, critPart, metadata);
-
- if(compCrit.getOperator() == CompoundCriteria.AND) {
- if (nextCost == UNKNOWN_VALUE) {
- continue;
- }
- if (childCost != UNKNOWN_VALUE) {
- cost *= nextCost/childCost;
- } else {
- if (cost == UNKNOWN_VALUE) {
- cost = nextCost;
- } else {
- cost = Math.min(cost, nextCost);
- }
- }
- if (cost <= 1) {
- return 1;
- }
- } else {
- if (nextCost == UNKNOWN_VALUE) {
- return childCost;
- }
- //this assumes that all disjuncts are completely disjoint
- cost += nextCost;
- if (childCost != UNKNOWN_VALUE) {
- cost = Math.min(cost, childCost);
- }
- }
- }
- if (cost == UNKNOWN_VALUE) {
- return childCost;
- }
- } else if(crit instanceof NotCriteria){
- if (childCost == UNKNOWN_VALUE) {
- return UNKNOWN_VALUE;
- }
- float nextCost = recursiveEstimateCostOfCriteria(childCost, currentNode, ((NotCriteria)crit).getCriteria(), metadata);
- if (nextCost == UNKNOWN_VALUE){
- return childCost;
- }
- cost -= nextCost;
- } else {
- cost = estimatePredicateCost(childCost, currentNode, (PredicateCriteria) crit, metadata);
-
- if (cost == UNKNOWN_VALUE) {
- return childCost;
- }
- }
-
- cost = Math.max(cost, 1);
-
- return cost;
- }
-
- /**
- * This method is a helper to examine whether a compound criteria covers
- * a compound key. A "valid"