teiid SVN: r3929 - in trunk: admin and 30 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2012-03-09 14:37:27 -0500 (Fri, 09 Mar 2012)
New Revision: 3929
Modified:
trunk/admin/pom.xml
trunk/adminshell/pom.xml
trunk/api/pom.xml
trunk/build/pom.xml
trunk/client-jdk15/pom.xml
trunk/client/pom.xml
trunk/common-core/pom.xml
trunk/connectors/connector-file/pom.xml
trunk/connectors/connector-ldap/pom.xml
trunk/connectors/connector-salesforce/pom.xml
trunk/connectors/connector-ws/pom.xml
trunk/connectors/pom.xml
trunk/connectors/salesforce-api/pom.xml
trunk/connectors/sandbox/pom.xml
trunk/connectors/sandbox/translator-yahoo/pom.xml
trunk/connectors/translator-file/pom.xml
trunk/connectors/translator-hive/pom.xml
trunk/connectors/translator-jdbc/pom.xml
trunk/connectors/translator-ldap/pom.xml
trunk/connectors/translator-loopback/pom.xml
trunk/connectors/translator-olap/pom.xml
trunk/connectors/translator-salesforce/pom.xml
trunk/connectors/translator-ws/pom.xml
trunk/engine/pom.xml
trunk/hibernate-dialect/pom.xml
trunk/jboss-integration/pom.xml
trunk/metadata/pom.xml
trunk/pom.xml
trunk/runtime/pom.xml
trunk/test-integration/common/pom.xml
trunk/test-integration/db/pom.xml
trunk/test-integration/pom.xml
Log:
[maven-release-plugin] prepare release teiid-parent-8.0.0.Beta1
Modified: trunk/admin/pom.xml
===================================================================
--- trunk/admin/pom.xml 2012-03-09 18:48:43 UTC (rev 3928)
+++ trunk/admin/pom.xml 2012-03-09 19:37:27 UTC (rev 3929)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.beta1-SNAPSHOT</version>
+ <version>8.0.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-admin</artifactId>
Modified: trunk/adminshell/pom.xml
===================================================================
--- trunk/adminshell/pom.xml 2012-03-09 18:48:43 UTC (rev 3928)
+++ trunk/adminshell/pom.xml 2012-03-09 19:37:27 UTC (rev 3929)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.beta1-SNAPSHOT</version>
+ <version>8.0.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-adminshell</artifactId>
Modified: trunk/api/pom.xml
===================================================================
--- trunk/api/pom.xml 2012-03-09 18:48:43 UTC (rev 3928)
+++ trunk/api/pom.xml 2012-03-09 19:37:27 UTC (rev 3929)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.beta1-SNAPSHOT</version>
+ <version>8.0.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-api</artifactId>
Modified: trunk/build/pom.xml
===================================================================
--- trunk/build/pom.xml 2012-03-09 18:48:43 UTC (rev 3928)
+++ trunk/build/pom.xml 2012-03-09 19:37:27 UTC (rev 3929)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.beta1-SNAPSHOT</version>
+ <version>8.0.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid</artifactId>
Modified: trunk/client/pom.xml
===================================================================
--- trunk/client/pom.xml 2012-03-09 18:48:43 UTC (rev 3928)
+++ trunk/client/pom.xml 2012-03-09 19:37:27 UTC (rev 3929)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.beta1-SNAPSHOT</version>
+ <version>8.0.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-client</artifactId>
Modified: trunk/client-jdk15/pom.xml
===================================================================
--- trunk/client-jdk15/pom.xml 2012-03-09 18:48:43 UTC (rev 3928)
+++ trunk/client-jdk15/pom.xml 2012-03-09 19:37:27 UTC (rev 3929)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.beta1-SNAPSHOT</version>
+ <version>8.0.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-client-jdk15</artifactId>
Modified: trunk/common-core/pom.xml
===================================================================
--- trunk/common-core/pom.xml 2012-03-09 18:48:43 UTC (rev 3928)
+++ trunk/common-core/pom.xml 2012-03-09 19:37:27 UTC (rev 3929)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.beta1-SNAPSHOT</version>
+ <version>8.0.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-common-core</artifactId>
Modified: trunk/connectors/connector-file/pom.xml
===================================================================
--- trunk/connectors/connector-file/pom.xml 2012-03-09 18:48:43 UTC (rev 3928)
+++ trunk/connectors/connector-file/pom.xml 2012-03-09 19:37:27 UTC (rev 3929)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.beta1-SNAPSHOT</version>
+ <version>8.0.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-file</artifactId>
Modified: trunk/connectors/connector-ldap/pom.xml
===================================================================
--- trunk/connectors/connector-ldap/pom.xml 2012-03-09 18:48:43 UTC (rev 3928)
+++ trunk/connectors/connector-ldap/pom.xml 2012-03-09 19:37:27 UTC (rev 3929)
@@ -2,7 +2,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.beta1-SNAPSHOT</version>
+ <version>8.0.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-ldap</artifactId>
Modified: trunk/connectors/connector-salesforce/pom.xml
===================================================================
--- trunk/connectors/connector-salesforce/pom.xml 2012-03-09 18:48:43 UTC (rev 3928)
+++ trunk/connectors/connector-salesforce/pom.xml 2012-03-09 19:37:27 UTC (rev 3929)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.beta1-SNAPSHOT</version>
+ <version>8.0.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-salesforce</artifactId>
Modified: trunk/connectors/connector-ws/pom.xml
===================================================================
--- trunk/connectors/connector-ws/pom.xml 2012-03-09 18:48:43 UTC (rev 3928)
+++ trunk/connectors/connector-ws/pom.xml 2012-03-09 19:37:27 UTC (rev 3929)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.beta1-SNAPSHOT</version>
+ <version>8.0.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>connector-ws</artifactId>
Modified: trunk/connectors/pom.xml
===================================================================
--- trunk/connectors/pom.xml 2012-03-09 18:48:43 UTC (rev 3928)
+++ trunk/connectors/pom.xml 2012-03-09 19:37:27 UTC (rev 3929)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.beta1-SNAPSHOT</version>
+ <version>8.0.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: trunk/connectors/salesforce-api/pom.xml
===================================================================
--- trunk/connectors/salesforce-api/pom.xml 2012-03-09 18:48:43 UTC (rev 3928)
+++ trunk/connectors/salesforce-api/pom.xml 2012-03-09 19:37:27 UTC (rev 3929)
@@ -2,7 +2,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.beta1-SNAPSHOT</version>
+ <version>8.0.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>salesforce-api</artifactId>
Modified: trunk/connectors/sandbox/pom.xml
===================================================================
--- trunk/connectors/sandbox/pom.xml 2012-03-09 18:48:43 UTC (rev 3928)
+++ trunk/connectors/sandbox/pom.xml 2012-03-09 19:37:27 UTC (rev 3929)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.beta1-SNAPSHOT</version>
+ <version>8.0.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid.connectors</groupId>
Modified: trunk/connectors/sandbox/translator-yahoo/pom.xml
===================================================================
--- trunk/connectors/sandbox/translator-yahoo/pom.xml 2012-03-09 18:48:43 UTC (rev 3928)
+++ trunk/connectors/sandbox/translator-yahoo/pom.xml 2012-03-09 19:37:27 UTC (rev 3929)
@@ -3,7 +3,7 @@
<parent>
<artifactId>sandbox</artifactId>
<groupId>org.jboss.teiid.connectors</groupId>
- <version>8.0.0.beta1-SNAPSHOT</version>
+ <version>8.0.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-yahoo</artifactId>
Modified: trunk/connectors/translator-file/pom.xml
===================================================================
--- trunk/connectors/translator-file/pom.xml 2012-03-09 18:48:43 UTC (rev 3928)
+++ trunk/connectors/translator-file/pom.xml 2012-03-09 19:37:27 UTC (rev 3929)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.beta1-SNAPSHOT</version>
+ <version>8.0.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-file</artifactId>
Modified: trunk/connectors/translator-hive/pom.xml
===================================================================
--- trunk/connectors/translator-hive/pom.xml 2012-03-09 18:48:43 UTC (rev 3928)
+++ trunk/connectors/translator-hive/pom.xml 2012-03-09 19:37:27 UTC (rev 3929)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.beta1-SNAPSHOT</version>
+ <version>8.0.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-hive</artifactId>
Modified: trunk/connectors/translator-jdbc/pom.xml
===================================================================
--- trunk/connectors/translator-jdbc/pom.xml 2012-03-09 18:48:43 UTC (rev 3928)
+++ trunk/connectors/translator-jdbc/pom.xml 2012-03-09 19:37:27 UTC (rev 3929)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.beta1-SNAPSHOT</version>
+ <version>8.0.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-jdbc</artifactId>
Modified: trunk/connectors/translator-ldap/pom.xml
===================================================================
--- trunk/connectors/translator-ldap/pom.xml 2012-03-09 18:48:43 UTC (rev 3928)
+++ trunk/connectors/translator-ldap/pom.xml 2012-03-09 19:37:27 UTC (rev 3929)
@@ -2,7 +2,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.beta1-SNAPSHOT</version>
+ <version>8.0.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-ldap</artifactId>
Modified: trunk/connectors/translator-loopback/pom.xml
===================================================================
--- trunk/connectors/translator-loopback/pom.xml 2012-03-09 18:48:43 UTC (rev 3928)
+++ trunk/connectors/translator-loopback/pom.xml 2012-03-09 19:37:27 UTC (rev 3929)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.beta1-SNAPSHOT</version>
+ <version>8.0.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-loopback</artifactId>
Modified: trunk/connectors/translator-olap/pom.xml
===================================================================
--- trunk/connectors/translator-olap/pom.xml 2012-03-09 18:48:43 UTC (rev 3928)
+++ trunk/connectors/translator-olap/pom.xml 2012-03-09 19:37:27 UTC (rev 3929)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.beta1-SNAPSHOT</version>
+ <version>8.0.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-olap</artifactId>
Modified: trunk/connectors/translator-salesforce/pom.xml
===================================================================
--- trunk/connectors/translator-salesforce/pom.xml 2012-03-09 18:48:43 UTC (rev 3928)
+++ trunk/connectors/translator-salesforce/pom.xml 2012-03-09 19:37:27 UTC (rev 3929)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.beta1-SNAPSHOT</version>
+ <version>8.0.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-salesforce</artifactId>
Modified: trunk/connectors/translator-ws/pom.xml
===================================================================
--- trunk/connectors/translator-ws/pom.xml 2012-03-09 18:48:43 UTC (rev 3928)
+++ trunk/connectors/translator-ws/pom.xml 2012-03-09 19:37:27 UTC (rev 3929)
@@ -3,7 +3,7 @@
<parent>
<artifactId>connectors</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.beta1-SNAPSHOT</version>
+ <version>8.0.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>translator-ws</artifactId>
Modified: trunk/engine/pom.xml
===================================================================
--- trunk/engine/pom.xml 2012-03-09 18:48:43 UTC (rev 3928)
+++ trunk/engine/pom.xml 2012-03-09 19:37:27 UTC (rev 3929)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.beta1-SNAPSHOT</version>
+ <version>8.0.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-engine</artifactId>
Modified: trunk/hibernate-dialect/pom.xml
===================================================================
--- trunk/hibernate-dialect/pom.xml 2012-03-09 18:48:43 UTC (rev 3928)
+++ trunk/hibernate-dialect/pom.xml 2012-03-09 19:37:27 UTC (rev 3929)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.beta1-SNAPSHOT</version>
+ <version>8.0.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-hibernate-dialect</artifactId>
Modified: trunk/jboss-integration/pom.xml
===================================================================
--- trunk/jboss-integration/pom.xml 2012-03-09 18:48:43 UTC (rev 3928)
+++ trunk/jboss-integration/pom.xml 2012-03-09 19:37:27 UTC (rev 3929)
@@ -2,7 +2,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.beta1-SNAPSHOT</version>
+ <version>8.0.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: trunk/metadata/pom.xml
===================================================================
--- trunk/metadata/pom.xml 2012-03-09 18:48:43 UTC (rev 3928)
+++ trunk/metadata/pom.xml 2012-03-09 19:37:27 UTC (rev 3929)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.beta1-SNAPSHOT</version>
+ <version>8.0.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-metadata</artifactId>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-03-09 18:48:43 UTC (rev 3928)
+++ trunk/pom.xml 2012-03-09 19:37:27 UTC (rev 3929)
@@ -10,7 +10,7 @@
<artifactId>teiid-parent</artifactId>
<packaging>pom</packaging>
<name>Teiid</name>
- <version>8.0.0.beta1-SNAPSHOT</version>
+ <version>8.0.0.Beta1</version>
<description>Federated SQL and XML query engine.</description>
<properties>
<ant.version>1.7.0</ant.version>
@@ -37,9 +37,9 @@
<version.junit>4.10</version.junit>
</properties>
<scm>
- <connection>scm:svn:https://anonsvn.jboss.org/repos/teiid/trunk</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/teiid/trunk</developerConnection>
- <url>http://anonsvn.jboss.org/repos/teiid/trunk</url>
+ <connection>scm:svn:https://anonsvn.jboss.org/repos/teiid/tags/teiid-parent-8.0.0.Beta1</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/teiid/tags/teiid-parent-8.0.0.Beta1</developerConnection>
+ <url>http://anonsvn.jboss.org/repos/teiid/tags/teiid-parent-8.0.0.Beta1</url>
</scm>
<licenses>
<license>
Modified: trunk/runtime/pom.xml
===================================================================
--- trunk/runtime/pom.xml 2012-03-09 18:48:43 UTC (rev 3928)
+++ trunk/runtime/pom.xml 2012-03-09 19:37:27 UTC (rev 3929)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.beta1-SNAPSHOT</version>
+ <version>8.0.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.teiid</groupId>
Modified: trunk/test-integration/common/pom.xml
===================================================================
--- trunk/test-integration/common/pom.xml 2012-03-09 18:48:43 UTC (rev 3928)
+++ trunk/test-integration/common/pom.xml 2012-03-09 19:37:27 UTC (rev 3929)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-test-integration</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.beta1-SNAPSHOT</version>
+ <version>8.0.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>test-integration-common</artifactId>
Modified: trunk/test-integration/db/pom.xml
===================================================================
--- trunk/test-integration/db/pom.xml 2012-03-09 18:48:43 UTC (rev 3928)
+++ trunk/test-integration/db/pom.xml 2012-03-09 19:37:27 UTC (rev 3929)
@@ -9,7 +9,7 @@
<parent>
<artifactId>teiid-test-integration</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.beta1-SNAPSHOT</version>
+ <version>8.0.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: trunk/test-integration/pom.xml
===================================================================
--- trunk/test-integration/pom.xml 2012-03-09 18:48:43 UTC (rev 3928)
+++ trunk/test-integration/pom.xml 2012-03-09 19:37:27 UTC (rev 3929)
@@ -3,7 +3,7 @@
<parent>
<artifactId>teiid-parent</artifactId>
<groupId>org.jboss.teiid</groupId>
- <version>8.0.0.beta1-SNAPSHOT</version>
+ <version>8.0.0.Beta1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>teiid-test-integration</artifactId>
12 years, 9 months
teiid SVN: r3928 - trunk/runtime/src/test/java/org/teiid/deployers.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2012-03-09 13:48:43 -0500 (Fri, 09 Mar 2012)
New Revision: 3928
Modified:
trunk/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java
Log:
TEIID-1280
Modified: trunk/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java
===================================================================
--- trunk/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java 2012-03-09 18:14:33 UTC (rev 3927)
+++ trunk/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java 2012-03-09 18:48:43 UTC (rev 3928)
@@ -66,6 +66,7 @@
cmr.addConnectorManager("source2", getConnectorManager("FakeTranslator2", "FakeConnection2", getFuncsTwo()));
CompositeVDB cvdb = new CompositeVDB(vdbMetaData, metadataStore, null, RealMetadataFactory.SFM.getSystemFunctions(),cmr);
+ cvdb.setMetaloadFinished(true);
return cvdb;
}
12 years, 9 months
teiid SVN: r3927 - trunk/build/kits/jboss-as7/docs/teiid.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2012-03-09 13:14:33 -0500 (Fri, 09 Mar 2012)
New Revision: 3927
Modified:
trunk/build/kits/jboss-as7/docs/teiid/teiid-releasenotes.html
Log:
TEIID-1280
Modified: trunk/build/kits/jboss-as7/docs/teiid/teiid-releasenotes.html
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/teiid-releasenotes.html 2012-03-09 12:33:17 UTC (rev 3926)
+++ trunk/build/kits/jboss-as7/docs/teiid/teiid-releasenotes.html 2012-03-09 18:14:33 UTC (rev 3927)
@@ -26,6 +26,8 @@
</UL>
<H2><A NAME="Highlights"></A>Highlights</H2>
<UL>
+ <LI><B>DDL Based View Definitions</B> - Define virtual tables, procedures and functions for Dynamic VDBs using DDL.
+ <LI><B>MetadataRepository</B> - Pluggable metadata facility for any VDB and models inside it.
<LI><B>CallableStatement Named Parameters</B> - you can now use CallableStatement named parameter get/set methods.
<LI><B>New Translator capabilities</B>
<UL>
@@ -44,7 +46,7 @@
</UL>
<LI><B>VARBINARY type support</B> - the Teiid VARBINARY type can now be used to support source BINARY and VARBINARY types.
<LI><B>Greenplum Translator</B> - for use with the Greenplum database.
- <LI><B>Enhanced parse/format pushdown</B> - added more built-in support and extension points for parse/format function pushdown. Added parse/format timestamp handling for SQLServer, Sybase, Oracle, and PostgreSQL.
+ <LI><B>Enhanced parse/format pushdown</B> - added more built-in support and extension points for parse/format function pushdown. Added parse/format timestamp handling for SQLServer, Sybase, Oracle, and PostgreSQL.
</UL>
<h2><a name="Compatibility">Compatibility Issues</a></h2>
12 years, 9 months
teiid SVN: r3926 - trunk/build/kits/jboss-as7/docs/teiid/datasources/ldap.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2012-03-09 07:33:17 -0500 (Fri, 09 Mar 2012)
New Revision: 3926
Modified:
trunk/build/kits/jboss-as7/docs/teiid/datasources/ldap/create-ldap-ds.cli
Log:
TEIID-1280: Adding implementation for providing the DDL based view definitions and also flexible metadata repository plug-in architecture.
Modified: trunk/build/kits/jboss-as7/docs/teiid/datasources/ldap/create-ldap-ds.cli
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/ldap/create-ldap-ds.cli 2012-03-09 12:32:32 UTC (rev 3925)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/ldap/create-ldap-ds.cli 2012-03-09 12:33:17 UTC (rev 3926)
@@ -4,4 +4,4 @@
/subsystem=resource-adapters/resource-adapter=ldapDS/connection-definitions=ldapDS/config-properties=LdapAdminUserDN:add(value={cn=???,ou=???,dc=???})
/subsystem=resource-adapters/resource-adapter=ldapDS/connection-definitions=ldapDS/config-properties=LdapAdminUserPassword:add(value={pass})
/subsystem=resource-adapters/resource-adapter=ldapDS/connection-definitions=ldapDS/config-properties=LdapTxnTimeoutInMillis:add(value=-1)
-/subsystem=resource-adapters/resource-adapter=ldapDS/connection-definitions=ldapDS:enable
\ No newline at end of file
+/subsystem=resource-adapters/resource-adapter=ldapDS:activate
\ No newline at end of file
12 years, 9 months
teiid SVN: r3925 - in trunk: build/kits/jboss-as7/docs/teiid/datasources/file and 7 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2012-03-09 07:32:32 -0500 (Fri, 09 Mar 2012)
New Revision: 3925
Added:
trunk/test-integration/common/src/test/resources/TestDymamicImportedMetaData/
trunk/test-integration/common/src/test/resources/TestDymamicImportedMetaData/columns.expected
Modified:
trunk/admin/src/main/java/org/teiid/adminapi/AdminFactory.java
trunk/build/kits/jboss-as7/docs/teiid/datasources/file/create-ds.cli
trunk/build/kits/jboss-as7/docs/teiid/datasources/web-service/create-ws-ds.cli
trunk/engine/src/main/java/org/teiid/query/metadata/MetadataValidator.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/ObjectSerializer.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java
trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java
trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDeployment.java
trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDynamicViewDefinition.java
Log:
TEIID-1280: Adding implementation for providing the DDL based view definitions and also flexible metadata repository plug-in architecture.
Modified: trunk/admin/src/main/java/org/teiid/adminapi/AdminFactory.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/AdminFactory.java 2012-03-08 22:48:30 UTC (rev 3924)
+++ trunk/admin/src/main/java/org/teiid/adminapi/AdminFactory.java 2012-03-09 12:32:32 UTC (rev 3925)
@@ -197,23 +197,21 @@
}
}
- private void createConnectionFactory(String deploymentName, String templateName, Properties properties) throws AdminException {
- Set<String> resourceAdapters = getDeployedResourceAdapterNames();
- if (!resourceAdapters.contains(templateName)) {
- addResourceAdapter(templateName);
- }
+ private void createConnectionFactory(String deploymentName, String rarName, Properties properties) throws AdminException {
+
+ ///subsystem=resource-adapters/resource-adapter=fileDS:add
+ addResourceAdapter(deploymentName, rarName);
- ///subsystem=resource-adapters/resource-adapter=teiid-connector-file.rar/connection-definitions=fooDS:add(class-name=org.teiid.resource.adapter.file.FileManagedConnectionFactory, jndi-name=java\:\/fooDS, pool-name=foo-pool)
+ ///subsystem=resource-adapters/resource-adapter=fileDS/connection-definitions=fileDS:add(jndi-name=java\:\/fooDS)
DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder();
final ModelNode request;
try {
builder.addNode("subsystem", "resource-adapters"); //$NON-NLS-1$ //$NON-NLS-2$
- builder.addNode("resource-adapter", templateName); //$NON-NLS-1$ //$NON-NLS-2$
+ builder.addNode("resource-adapter", deploymentName); //$NON-NLS-1$ //$NON-NLS-2$
builder.addNode("connection-definitions", deploymentName); //$NON-NLS-1$ //$NON-NLS-2$
builder.setOperationName("add");
builder.addProperty("jndi-name", addJavaContext(deploymentName));
- builder.addProperty("pool-name", deploymentName);
request = builder.buildRequest();
} catch (OperationFormatException e) {
throw new IllegalStateException("Failed to build operation", e); //$NON-NLS-1$
@@ -225,17 +223,19 @@
Enumeration keys = properties.propertyNames();
while (keys.hasMoreElements()) {
String key = (String)keys.nextElement();
- addConfigProperty(templateName, deploymentName, key, properties.getProperty(key));
+ addConfigProperty(deploymentName, key, properties.getProperty(key));
}
+
+ activateConnectionFactory(deploymentName);
}
- // /subsystem=resource-adapters/resource-adapter=teiid-connector-file.rar/connection-definitions=fooDS/config-properties=ParentDirectory2:add(value=/home/rareddy/testing)
- private void addConfigProperty(String templateName, String deploymentName, String key, String value) throws AdminProcessingException {
+ // /subsystem=resource-adapters/resource-adapter=fileDS/connection-definitions=fileDS/config-properties=ParentDirectory2:add(value=/home/rareddy/testing)
+ private void addConfigProperty(String deploymentName, String key, String value) throws AdminProcessingException {
DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder();
final ModelNode request;
try {
builder.addNode("subsystem", "resource-adapters"); //$NON-NLS-1$ //$NON-NLS-2$
- builder.addNode("resource-adapter", templateName); //$NON-NLS-1$ //$NON-NLS-2$
+ builder.addNode("resource-adapter", deploymentName); //$NON-NLS-1$ //$NON-NLS-2$
builder.addNode("connection-definitions", deploymentName); //$NON-NLS-1$ //$NON-NLS-2$
builder.addNode("config-properties", key); //$NON-NLS-1$ //$NON-NLS-2$
builder.setOperationName("add");
@@ -247,15 +247,31 @@
execute(request);
}
+
+ // /subsystem=resource-adapters/resource-adapter=fileDS:activate
+ private void activateConnectionFactory(String deploymentName) throws AdminProcessingException {
+ DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder();
+ final ModelNode request;
+ try {
+ builder.addNode("subsystem", "resource-adapters"); //$NON-NLS-1$ //$NON-NLS-2$
+ builder.addNode("resource-adapter", deploymentName); //$NON-NLS-1$ //$NON-NLS-2$
+ builder.setOperationName("activate");
+ request = builder.buildRequest();
+ } catch (OperationFormatException e) {
+ throw new IllegalStateException("Failed to build operation", e); //$NON-NLS-1$
+ }
+
+ execute(request);
+ }
// /subsystem=resource-adapters/resource-adapter=teiid-connector-ws.rar:add(archive=teiid-connector-ws.rar, transaction-support=NoTransaction)
- private void addResourceAdapter(String rarName) throws AdminProcessingException {
+ private void addResourceAdapter(String deploymentName, String rarName) throws AdminProcessingException {
DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder();
final ModelNode request;
try {
builder.addNode("subsystem", "resource-adapters"); //$NON-NLS-1$ //$NON-NLS-2$
- builder.addNode("resource-adapter", rarName); //$NON-NLS-1$ //$NON-NLS-2$
+ builder.addNode("resource-adapter", deploymentName); //$NON-NLS-1$ //$NON-NLS-2$
builder.setOperationName("add");
request = builder.buildRequest();
request.get("archive").set(rarName);
Modified: trunk/build/kits/jboss-as7/docs/teiid/datasources/file/create-ds.cli
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/file/create-ds.cli 2012-03-08 22:48:30 UTC (rev 3924)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/file/create-ds.cli 2012-03-09 12:32:32 UTC (rev 3925)
@@ -1,5 +1,5 @@
/subsystem=resource-adapters/resource-adapter=fileDS:add(archive=teiid-connector-file.rar, transaction-support=NoTransaction)
/subsystem=resource-adapters/resource-adapter=fileDS/connection-definitions=fileDS:add(jndi-name=java:/fileDS, class-name=org.teiid.resource.adapter.file.FileManagedConnectionFactory, enabled=true, use-java-context=true)
-/subsystem=resource-adapters/resource-adapter=fileDS/connection-definitions=fileDS/config-properties=Parentdirectory:add(value=/home/rareddy/testing/)
+/subsystem=resource-adapters/resource-adapter=fileDS/connection-definitions=fileDS/config-properties=ParentDirectory:add(value=/home/rareddy/testing/)
/subsystem=resource-adapters/resource-adapter=fileDS/connection-definitions=fileDS/config-properties=AllowParentPaths:add(value=true)
-/subsystem=resource-adapters/resource-adapter=fileDS/connection-definitions=fileDS:enable
\ No newline at end of file
+/subsystem=resource-adapters/resource-adapter=fileDS:activate
\ No newline at end of file
Modified: trunk/build/kits/jboss-as7/docs/teiid/datasources/web-service/create-ws-ds.cli
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/web-service/create-ws-ds.cli 2012-03-08 22:48:30 UTC (rev 3924)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/web-service/create-ws-ds.cli 2012-03-09 12:32:32 UTC (rev 3925)
@@ -1,4 +1,4 @@
/subsystem=resource-adapters/resource-adapter=wsDS:add(archive=teiid-connector-ws.rar, transaction-support=NoTransaction)
/subsystem=resource-adapters/resource-adapter=wsDS/connection-definitions=wsDS:add(jndi-name=java:/wsDS, class-name=org.teiid.resource.adapter.ws.WSManagedConnectionFactory, enabled=true, use-java-context=true)
/subsystem=resource-adapters/resource-adapter=wsDS/connection-definitions=wsDS/config-properties=EndPoint:add(value={end_point})
-/subsystem=resource-adapters/resource-adapter=wsDS/connection-definitions=wsDS:enable
\ No newline at end of file
+/subsystem=resource-adapters/resource-adapter=wsDS:activate
\ No newline at end of file
Modified: trunk/engine/src/main/java/org/teiid/query/metadata/MetadataValidator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/MetadataValidator.java 2012-03-08 22:48:30 UTC (rev 3924)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/MetadataValidator.java 2012-03-09 12:32:32 UTC (rev 3925)
@@ -51,8 +51,8 @@
import org.teiid.query.report.ActivityReport;
import org.teiid.query.report.ReportItem;
import org.teiid.query.resolver.QueryResolver;
+import org.teiid.query.resolver.util.ResolverUtil;
import org.teiid.query.sql.lang.Command;
-import org.teiid.query.sql.lang.Query;
import org.teiid.query.sql.lang.QueryCommand;
import org.teiid.query.sql.symbol.Expression;
import org.teiid.query.sql.symbol.GroupSymbol;
@@ -158,7 +158,9 @@
if (t.getSelectTransformation() == null) {
log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31079, t.getName(), model.getName()));
}
- validate(vdb, model, t, store, report);
+ else {
+ validate(vdb, model, t, store, report);
+ }
}
}
@@ -167,7 +169,9 @@
if (p.getQueryPlan() == null) {
log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31081, p.getName(), model.getName()));
}
- validate(vdb, model, p, store, report);
+ else {
+ validate(vdb, model, p, store, report);
+ }
}
}
}
@@ -209,12 +213,11 @@
}
}
- Query command = (Query)QueryParser.getQueryParser().parseCommand("SELECT * FROM "+t.getFullName()); //$NON-NLS-1$
- QueryResolver.resolveCommand(command, metadata);
- GroupSymbol resolvedGroup = command.getFrom().getGroups().get(0);
+ GroupSymbol symbol = new GroupSymbol(t.getName(), t.getFullName());
+ ResolverUtil.resolveGroup(symbol, metadata);
// this seems to parse, resolve and validate.
- QueryResolver.resolveView(resolvedGroup, new QueryNode(t.getSelectTransformation()), SQLConstants.Reserved.SELECT, metadata);
+ QueryResolver.resolveView(symbol, new QueryNode(t.getSelectTransformation()), SQLConstants.Reserved.SELECT, metadata);
}
if(resolverReport != null && resolverReport.hasItems()) {
for (ValidatorFailure v:resolverReport.getItems()) {
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/ObjectSerializer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/ObjectSerializer.java 2012-03-08 22:48:30 UTC (rev 3924)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/ObjectSerializer.java 2012-03-09 12:32:32 UTC (rev 3925)
@@ -127,6 +127,9 @@
public OutputStream getVdbXmlOutputStream(VDBMetaData vdb) throws IOException {
File f = buildVdbXml(vdb);
+ if (!f.exists()) {
+ f.getParentFile().mkdirs();
+ }
return new FileOutputStream(f);
}
}
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java 2012-03-08 22:48:30 UTC (rev 3924)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java 2012-03-09 12:32:32 UTC (rev 3925)
@@ -58,7 +58,6 @@
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
import org.teiid.metadata.MetadataRepository;
-import org.teiid.metadata.MetadataStore;
import org.teiid.metadata.index.IndexMetadataRepository;
import org.teiid.metadata.index.IndexMetadataStore;
import org.teiid.query.ObjectReplicator;
@@ -131,9 +130,6 @@
indexRepo = new IndexMetadataRepository(indexFactory);
}
- MetadataStore store = new MetadataStore();
- deployment.addAttchment(MetadataStore.class, store);
-
for (ModelMetaData model:deployment.getModelMetaDatas().values()) {
if (model.isSource() && model.getSourceNames().isEmpty()) {
throw new DeploymentUnitProcessingException(IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50087, model.getName(), deployment.getName(), deployment.getVersion()));
Modified: trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java 2012-03-08 22:48:30 UTC (rev 3924)
+++ trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java 2012-03-09 12:32:32 UTC (rev 3925)
@@ -32,13 +32,10 @@
import org.teiid.adminapi.Model;
import org.teiid.adminapi.impl.DataPolicyMetadata;
import org.teiid.adminapi.impl.ModelMetaData;
-import org.teiid.adminapi.impl.SourceMappingMetadata;
import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.core.CoreConstants;
import org.teiid.dqp.internal.datamgr.ConnectorManager;
import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
-import org.teiid.logging.LogConstants;
-import org.teiid.logging.LogManager;
import org.teiid.metadata.AbstractMetadataRecord;
import org.teiid.metadata.Column;
import org.teiid.metadata.ColumnStats;
@@ -70,6 +67,7 @@
private MetadataStore[] additionalStores;
private ConnectorManagerRepository cmr;
private FunctionTree systemFunctions;
+ private boolean metadataloadFinished = false;
// used as cached item to avoid rebuilding
private VDBMetaData mergedVDB;
@@ -103,7 +101,7 @@
}
private synchronized void update() {
- if (this.mergedVDB == null) {
+ if (this.mergedVDB == null && this.metadataloadFinished) {
this.mergedVDB = buildVDB();
@@ -147,7 +145,7 @@
}
public synchronized VDBMetaData getVDB() {
- if (this.mergedVDB == null) {
+ if (this.mergedVDB == null && this.metadataloadFinished) {
update();
}
return this.mergedVDB;
@@ -341,4 +339,8 @@
}
metadataRepository.endLoadVdb(vdbName, vdbVersion);
}
+
+ public void setMetaloadFinished(boolean flag) {
+ this.metadataloadFinished = flag;
+ }
}
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2012-03-08 22:48:30 UTC (rev 3924)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2012-03-09 12:32:32 UTC (rev 3925)
@@ -246,6 +246,7 @@
CompositeVDB v = this.vdbRepo.get(new VDBKey(name, version));
if (v!= null) {
boolean valid = false;
+ v.setMetaloadFinished(true);
VDBMetaData metdataAwareVDB = v.getVDB();
ValidatorReport report = MetadataValidator.validate(metdataAwareVDB, metdataAwareVDB.removeAttachment(MetadataStore.class));
@@ -258,7 +259,7 @@
// check the data sources available
if (valid) {
- valid = isValid(metdataAwareVDB);
+ valid = hasValidDataSources(metdataAwareVDB);
}
if (valid) {
@@ -273,7 +274,7 @@
}
}
- boolean isValid(VDBMetaData vdb) {
+ boolean hasValidDataSources(VDBMetaData vdb) {
ConnectorManagerRepository cmr = vdb.getAttachment(ConnectorManagerRepository.class);
for (ModelMetaData model:vdb.getModelMetaDatas().values()) {
Modified: trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDeployment.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDeployment.java 2012-03-08 22:48:30 UTC (rev 3924)
+++ trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDeployment.java 2012-03-09 12:32:32 UTC (rev 3925)
@@ -62,7 +62,6 @@
@Test
public void testVDBDeployment() throws Exception {
- boolean deployed = false;
try {
Set<?> vdbs = admin.getVDBs();
assertTrue(vdbs.isEmpty());
@@ -73,7 +72,6 @@
}
admin.deploy("bqt.vdb",new FileInputStream(UnitTestUtil.getTestDataFile("bqt.vdb")));
- deployed = true;
vdbs = admin.getVDBs();
assertFalse(vdbs.isEmpty());
@@ -101,9 +99,7 @@
assertFalse(vdb.isValid());
assertTrue(vdb.getStatus().equals(Status.INACTIVE));
} finally {
- if (deployed) {
- admin.undeploy("bqt.vdb");
- }
+ undeploy();
}
}
@@ -111,7 +107,7 @@
public void testTraslators() throws Exception {
Collection<? extends Translator> translators = admin.getTranslators();
System.out.println(translators);
- assertEquals(28, translators.size());
+ assertEquals(29, translators.size());
JavaArchive jar = getLoopyArchive();
@@ -142,12 +138,9 @@
@Test
public void testVDBConnectionType() throws Exception {
- boolean vdbOneDeployed = false;
- boolean vdbTwoDeployed = false;
try {
admin.deploy("bqt.vdb", new FileInputStream(UnitTestUtil.getTestDataFile("bqt.vdb")));
- vdbOneDeployed = true;
VDB vdb = admin.getVDB("bqt", 1);
Model model = vdb.getModels().get(0);
@@ -173,8 +166,6 @@
admin.deploy("bqt2.vdb", new FileInputStream(UnitTestUtil.getTestDataFile("bqt2.vdb")));
admin.assignToModel("bqt", 2, model.getName(), "Source", "h2", "java:jboss/datasources/ExampleDS");
- vdbTwoDeployed = true;
-
try {
Connection conn = TeiidDriver.getInstance().connect("jdbc:teiid:bqt@mm://localhost:31000;user=user;password=user", null);
conn.close();
@@ -197,10 +188,8 @@
assertEquals(ConnectionType.ANY, vdb.getConnectionType());
} finally {
- if (vdbOneDeployed) {
- admin.undeploy("bqt.vdb");
- }
- if (vdbTwoDeployed) {
+ undeploy();
+ if(admin.getVDB("bqt", 2) != null){
admin.undeploy("bqt2.vdb");
}
}
@@ -210,15 +199,13 @@
public void testCacheTypes() throws Exception {
String[] array = {Admin.Cache.PREPARED_PLAN_CACHE.toString(), Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE.toString()};
Collection<String> types = admin.getCacheTypes();
- System.out.println(types);
assertArrayEquals(array, types.toArray());
}
@Test
public void testSessions() throws Exception {
- boolean vdbOneDeployed = false;
try {
- vdbOneDeployed = deployVdb();
+ deployVdb();
Collection<? extends Session> sessions = admin.getSessions();
assertEquals (0, sessions.size());
@@ -255,10 +242,7 @@
}
} finally {
- if (vdbOneDeployed) {
- admin.undeploy("bqt.vdb");
- }
-
+ undeploy();
}
}
@@ -273,14 +257,20 @@
return vdbOneDeployed;
}
+ private void undeploy() throws Exception {
+ VDB vdb = admin.getVDB("bqt", 1);
+ if (vdb != null) {
+ admin.undeploy("bqt.vdb");
+ }
+ }
+
@Test
public void testGetRequests() throws Exception {
- boolean vdbOneDeployed = false;
JavaArchive jar = getLoopyArchive();
try {
admin.deploy("loopy.jar", jar.as(ZipExporter.class).exportAsInputStream());
- vdbOneDeployed = deployVdb();
+ deployVdb();
VDB vdb = admin.getVDB("bqt", 1);
Model model = vdb.getModels().get(0);
Translator t = admin.getTranslator("loopy");
@@ -324,33 +314,29 @@
} finally {
admin.undeploy("loopy.jar");
- if (vdbOneDeployed) {
- admin.undeploy("bqt.vdb");
- }
+ undeploy();
}
}
@Test
public void getDatasourceTemplateNames() throws Exception {
- String[] array = {"teiid-connector-file.rar", "teiid-connector-salesforce.rar", "teiid-connector-ldap.rar", "teiid-connector-ws.rar", "h2"};
- boolean vdbOneDeployed = false;
+ String[] array = {"teiid-connector-file.rar", "teiid-local", "teiid-connector-salesforce.rar", "teiid-connector-ldap.rar", "teiid-connector-ws.rar", "h2"};
try {
- vdbOneDeployed = deployVdb();
+ deployVdb();
Set<String> templates = admin.getDataSourceTemplateNames();
- assertArrayEquals(array, templates.toArray());
+ assertArrayEquals(array, templates.toArray(new String[templates.size()]));
} finally {
- if (vdbOneDeployed) {
- admin.undeploy("bqt.vdb");
- }
+ undeploy();
}
}
@Test
public void getTemplatePropertyDefinitions() throws Exception{
- boolean vdbOneDeployed = false;
try {
HashSet<String> props = new HashSet<String>();
- vdbOneDeployed = deployVdb();
+
+ deployVdb();
+
Collection<? extends PropertyDefinition> pds = admin.getTemplatePropertyDefinitions("h2");
for(PropertyDefinition pd:pds) {
props.add(pd.getName());
@@ -372,31 +358,24 @@
assertTrue(rar_props.contains("AllowParentPaths"));
} finally {
- if (vdbOneDeployed) {
- admin.undeploy("bqt.vdb");
- }
+ undeploy();
}
}
@Test
public void getWorkerPoolStats() throws Exception{
- boolean vdbOneDeployed = false;
try {
- vdbOneDeployed = deployVdb();
+ deployVdb();
assertNotNull(admin.getWorkerPoolStats());
} finally {
- if (vdbOneDeployed) {
- admin.undeploy("bqt.vdb");
- }
+ undeploy();
}
}
@Test
public void testDataRoleMapping() throws Exception{
- boolean vdbOneDeployed = false;
try {
admin.deploy("bqt2.vdb", new FileInputStream(UnitTestUtil.getTestDataFile("bqt2.vdb")));
- vdbOneDeployed = true;
VDB vdb = admin.getVDB("bqt", 2);
Model model = vdb.getModels().get(0);
@@ -442,11 +421,12 @@
assertFalse(dp.isAnyAuthenticated());
} finally {
- if (vdbOneDeployed) {
+ if (admin.getVDB("bqt", 2) != null) {
admin.undeploy("bqt2.vdb");
- }
+ }
}
}
+
}
Modified: trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDynamicViewDefinition.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDynamicViewDefinition.java 2012-03-08 22:48:30 UTC (rev 3924)
+++ trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDynamicViewDefinition.java 2012-03-09 12:32:32 UTC (rev 3925)
@@ -1,9 +1,6 @@
package org.teiid.arquillian;
-import static org.junit.Assert.*;
-
import java.io.FileInputStream;
-import java.sql.Connection;
import java.util.Properties;
import org.jboss.arquillian.junit.Arquillian;
@@ -13,13 +10,11 @@
import org.junit.runner.RunWith;
import org.teiid.adminapi.Admin;
import org.teiid.adminapi.AdminFactory;
+import org.teiid.adminapi.VDB;
import org.teiid.core.util.UnitTestUtil;
import org.teiid.jdbc.AbstractMMQueryTestCase;
-import org.teiid.jdbc.FakeServer;
import org.teiid.jdbc.TeiidDriver;
import org.teiid.jdbc.TestMMDatabaseMetaData;
-import org.teiid.metadata.MetadataFactory;
-import org.teiid.metadata.Procedure;
@RunWith(Arquillian.class)
@SuppressWarnings("nls")
@@ -39,20 +34,33 @@
@Test
public void testViewDefinition() throws Exception {
+
+ admin.deploy("dynamicview-vdb.xml",new FileInputStream(UnitTestUtil.getTestDataFile("dynamicview-vdb.xml")));
Properties props = new Properties();
props.setProperty("ParentDirectory", "../docs/teiid/examples/dynamicvdb-portfolio/data");
props.setProperty("AllowParentPaths", "true");
+
admin.createDataSource("marketdata-file", "teiid-connector-file.rar", props);
+ int count = 0;
+ while (count < 10) {
+ VDB vdb = admin.getVDB("dynamic", 1);
+ if (vdb == null || vdb.getStatus() != VDB.Status.ACTIVE) {
+ Thread.sleep(500);
+ count++;
+ }
+ else {
+ break;
+ }
+ }
- admin.deploy("dynamicview-vdb.xml",new FileInputStream(UnitTestUtil.getTestDataFile("dynamicview-vdb.xml")));
-
this.internalConnection = TeiidDriver.getInstance().connect("jdbc:teiid:dynamic@mm://localhost:31000;user=user;password=user", null);
- execute("select * FROM Portfolio.Stock Where SchemaName = 'portfolio'"); //$NON-NLS-1$
- TestMMDatabaseMetaData.compareResultSet("TestDymamicImportedMetaData/columns", this.internalResultSet);
-
+ execute("SELECT * FROM Sys.Columns WHERE tablename='stock'"); //$NON-NLS-1$
+ //TestMMDatabaseMetaData.compareResultSet("TestDymamicImportedMetaData/columns", this.internalResultSet);
+
+ admin.undeploy("dynamicview-vdb.xml");
}
}
Added: trunk/test-integration/common/src/test/resources/TestDymamicImportedMetaData/columns.expected
===================================================================
--- trunk/test-integration/common/src/test/resources/TestDymamicImportedMetaData/columns.expected (rev 0)
+++ trunk/test-integration/common/src/test/resources/TestDymamicImportedMetaData/columns.expected 2012-03-09 12:32:32 UTC (rev 3925)
@@ -0,0 +1,37 @@
+string string string string integer string string integer integer boolean boolean boolean boolean boolean boolean boolean string string string integer integer string string string string integer integer integer string !
string integer
+VDBName SchemaName TableName Name Position NameInSource DataType Scale Length IsLengthFixed SupportsSelect SupportsUpdates IsCaseSensitive IsSigned IsCurrency IsAutoIncremented NullType MinRange MaxRange DistinctCount NullCount SearchType Format DefaultValue JavaClass Precision CharOctetLength Radix UID !
Description OID
+dynamic portfolio stock symbol 1 <null> string 0 0 false true false false false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.lang.String 0 0 0 mmuuid:779b92e3-b217-!
4984-a0c4-739c6ed77376 <null> 1
+dynamic portfolio stock price 2 <null> bigdecimal 0 0 false true false false false false false Nullable <null> <null> -1 -1 Searchable <null> <null> java.math.BigDecimal 0 0 0 mmuuid:34cec776-ce92-!
4648-b5ef-8229322d767b <null> 2
+Row Count : 2
+getColumnName getColumnType getCatalogName getColumnClassName getColumnLabel getColumnTypeName getSchemaName getTableName getColumnDisplaySize getPrecision getScale isAutoIncrement isCaseSensitive isCurrency isDefinitelyWritable isNullable isReadOnly isSearchable isSigned isWritable
+VDBName 12 dynamic java.lang.String VDBName string SYS Columns 255 255 0 false false false false 0 true true false false
+SchemaName 12 dynamic java.lang.String SchemaName string SYS Columns 255 255 0 false true false true 1 false true true true
+TableName 12 dynamic java.lang.String TableName string SYS Columns 255 255 0 false true false false 0 true true false false
+Name 12 dynamic java.lang.String Name string SYS Columns 255 255 0 false false false false 0 true true false false
+Position 4 dynamic java.lang.Integer Position integer SYS Columns 11 10 0 false false false false 0 true true false false
+NameInSource 12 dynamic java.lang.String NameInSource string SYS Columns 255 255 0 false false false false 1 true true false false
+DataType 12 dynamic java.lang.String DataType string SYS Columns 100 100 0 false true false false 0 true true true false
+Scale 4 dynamic java.lang.Integer Scale integer SYS Columns 11 10 0 false false false false 0 true true false false
+Length 4 dynamic java.lang.Integer Length integer SYS Columns 11 10 0 false false false false 0 true true false false
+IsLengthFixed -7 dynamic java.lang.Boolean IsLengthFixed boolean SYS Columns 5 1 0 false false false false 0 true true false false
+SupportsSelect -7 dynamic java.lang.Boolean SupportsSelect boolean SYS Columns 5 1 0 false false false false 0 true true false false
+SupportsUpdates -7 dynamic java.lang.Boolean SupportsUpdates boolean SYS Columns 5 1 0 false false false false 0 true true false false
+IsCaseSensitive -7 dynamic java.lang.Boolean IsCaseSensitive boolean SYS Columns 5 1 0 false false false false 0 true true false false
+IsSigned -7 dynamic java.lang.Boolean IsSigned boolean SYS Columns 5 1 0 false false false false 0 true true false false
+IsCurrency -7 dynamic java.lang.Boolean IsCurrency boolean SYS Columns 5 1 0 false false false false 0 true true false false
+IsAutoIncremented -7 dynamic java.lang.Boolean IsAutoIncremented boolean SYS Columns 5 1 0 false false false false 0 true true false false
+NullType 12 dynamic java.lang.String NullType string SYS Columns 20 20 0 false true false false 0 true true false false
+MinRange 12 dynamic java.lang.String MinRange string SYS Columns 50 50 0 false false false false 1 true true false false
+MaxRange 12 dynamic java.lang.String MaxRange string SYS Columns 50 50 0 false false false false 1 true true false false
+DistinctCount 4 dynamic java.lang.Integer DistinctCount integer SYS Columns 11 10 0 false true false true 1 false true true true
+NullCount 4 dynamic java.lang.Integer NullCount integer SYS Columns 11 10 0 false true false true 1 false true true true
+SearchType 12 dynamic java.lang.String SearchType string SYS Columns 20 20 0 false false false false 0 true true false false
+Format 12 dynamic java.lang.String Format string SYS Columns 255 255 0 false false false false 1 true true false false
+DefaultValue 12 dynamic java.lang.String DefaultValue string SYS Columns 255 255 0 false false false false 1 true true false false
+JavaClass 12 dynamic java.lang.String JavaClass string SYS Columns 500 500 0 false true false false 0 true true false false
+Precision 4 dynamic java.lang.Integer Precision integer SYS Columns 11 10 0 false false false false 0 true true false false
+CharOctetLength 4 dynamic java.lang.Integer CharOctetLength integer SYS Columns 11 10 0 false false false false 1 true true false false
+Radix 4 dynamic java.lang.Integer Radix integer SYS Columns 11 10 0 false false false false 0 true true false false
+UID 12 dynamic java.lang.String UID string SYS Columns 50 50 0 false false false false 0 true true false false
+Description 12 dynamic java.lang.String Description string SYS Columns 255 255 0 false true false true 1 false true true true
+OID 4 dynamic java.lang.Integer OID integer SYS Columns 11 10 0 false false false false 0 true true false false
12 years, 9 months
teiid SVN: r3924 - in branches/7.7.x/connectors/translator-jdbc/src: test/java/org/teiid/translator/jdbc/oracle and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-03-08 17:48:30 -0500 (Thu, 08 Mar 2012)
New Revision: 3924
Modified:
branches/7.7.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java
branches/7.7.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleTranslator.java
Log:
TEIID-1952 adding detection of char types
Modified: branches/7.7.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java
===================================================================
--- branches/7.7.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java 2012-03-08 20:05:47 UTC (rev 3923)
+++ branches/7.7.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java 2012-03-08 22:48:30 UTC (rev 3924)
@@ -87,6 +87,12 @@
*/
static final class RefCursorType {}
static int CURSOR_TYPE = -10;
+
+ /*
+ * handling for char bindings
+ */
+ static final class FixedCharType {}
+ static int FIXED_CHAR_TYPE = 999;
private boolean oracleSuppliedDriver = true;
@@ -434,6 +440,10 @@
stmt.setNull(i, Types.LONGVARBINARY);
return;
}
+ if (paramType == FixedCharType.class) {
+ stmt.setObject(i, param, FIXED_CHAR_TYPE);
+ return;
+ }
super.bindValue(stmt, param, paramType, i);
}
@@ -448,6 +458,45 @@
}
@Override
+ public SQLConversionVisitor getSQLConversionVisitor() {
+ if (!oracleSuppliedDriver) {
+ return super.getSQLConversionVisitor();
+ }
+ return new SQLConversionVisitor(this) {
+
+ @Override
+ public void visit(Comparison obj) {
+ if (isChar(obj.getLeftExpression()) && obj.getRightExpression() instanceof Literal) {
+ Literal l = (Literal)obj.getRightExpression();
+ l.setType(FixedCharType.class);
+ }
+ super.visit(obj);
+ }
+
+ private boolean isChar(Expression obj) {
+ if (!(obj instanceof ColumnReference)) {
+ return false;
+ }
+ ColumnReference cr = (ColumnReference)obj;
+ return cr.getType() == TypeFacility.RUNTIME_TYPES.STRING && cr.getMetadataObject() != null && "CHAR".equalsIgnoreCase(cr.getMetadataObject().getNativeType()); //$NON-NLS-1$
+ }
+
+ public void visit(In obj) {
+ if (isChar(obj.getLeftExpression())) {
+ for (Expression exp : obj.getRightExpressions()) {
+ if (exp instanceof Literal) {
+ Literal l = (Literal)exp;
+ l.setType(FixedCharType.class);
+ }
+ }
+ }
+ super.visit(obj);
+ }
+
+ };
+ }
+
+ @Override
public List<String> getSupportedFunctions() {
List<String> supportedFunctions = new ArrayList<String>();
supportedFunctions.addAll(super.getSupportedFunctions());
Modified: branches/7.7.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleTranslator.java
===================================================================
--- branches/7.7.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleTranslator.java 2012-03-08 20:05:47 UTC (rev 3923)
+++ branches/7.7.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleTranslator.java 2012-03-08 22:48:30 UTC (rev 3924)
@@ -26,6 +26,7 @@
import java.sql.CallableStatement;
import java.sql.Connection;
+import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Types;
import java.util.Arrays;
@@ -41,6 +42,9 @@
import org.teiid.dqp.internal.datamgr.ExecutionContextImpl;
import org.teiid.dqp.internal.datamgr.FakeExecutionContextImpl;
import org.teiid.language.Command;
+import org.teiid.language.Comparison;
+import org.teiid.language.Literal;
+import org.teiid.language.Select;
import org.teiid.metadata.Column;
import org.teiid.metadata.ColumnSet;
import org.teiid.metadata.MetadataStore;
@@ -56,6 +60,7 @@
import org.teiid.translator.ExecutionContext;
import org.teiid.translator.TranslatorException;
import org.teiid.translator.jdbc.JDBCProcedureExecution;
+import org.teiid.translator.jdbc.JDBCQueryExecution;
import org.teiid.translator.jdbc.SQLConversionVisitor;
import org.teiid.translator.jdbc.TranslatedCommand;
import org.teiid.translator.jdbc.TranslationHelper;
@@ -757,17 +762,20 @@
"DoubleNum", //$NON-NLS-1$
"ID", //$NON-NLS-1$
"timestampvalue", //$NON-NLS-1$
+ "description"
};
String[] elemTypes = new String[] {
DataTypeManager.DefaultDataTypes.DOUBLE,
DataTypeManager.DefaultDataTypes.INTEGER,
DataTypeManager.DefaultDataTypes.TIMESTAMP,
+ DataTypeManager.DefaultDataTypes.STRING,
};
RealMetadataFactory.createElements(x, elemNames, elemTypes);
List<Column> cols = RealMetadataFactory.createElements(table, elemNames, elemTypes);
cols.get(1).setAutoIncremented(true);
cols.get(1).setNameInSource("ID:SEQUENCE=MYSEQUENCE.nextVal"); //$NON-NLS-1$
cols.get(2).setNativeType("date"); //$NON-NLS-1$
+ cols.get(3).setNativeType("CHAR");
RealMetadataFactory.createElements(dual, new String[] {"something"}, new String[] {DataTypeManager.DefaultDataTypes.STRING}); //$NON-NLS-1$
ProcedureParameter in1 = RealMetadataFactory.createParameter("in1", SPParameter.IN, DataTypeManager.DefaultDataTypes.INTEGER); //$NON-NLS-1$
@@ -902,6 +910,20 @@
Mockito.verify(cs, Mockito.times(1)).setObject(1, 2, Types.INTEGER);
}
+ @Test public void testCharType() throws Exception {
+ CommandBuilder commandBuilder = new CommandBuilder(getOracleSpecificMetadata());
+ Command command = commandBuilder.getCommand("select id from smalla where description = 'a'");
+ ((Literal)((Comparison)((Select)command).getWhere()).getRightExpression()).setBindEligible(true);
+ Connection connection = Mockito.mock(Connection.class);
+ PreparedStatement ps = Mockito.mock(PreparedStatement.class);
+ Mockito.stub(connection.prepareStatement("SELECT SmallishA.ID FROM SmallishA WHERE SmallishA.description = ?")).toReturn(ps); //$NON-NLS-1$
+ OracleExecutionFactory ef = new OracleExecutionFactory();
+
+ JDBCQueryExecution e = new JDBCQueryExecution(command, connection, Mockito.mock(ExecutionContext.class), ef);
+ e.execute();
+ Mockito.verify(ps, Mockito.times(1)).setObject(1, "a", 999);
+ }
+
@Test public void testParseFormat() throws Exception {
String input = "select parsetimestamp(smalla.timestampvalue, 'yyyy.MM.dd'), formattimestamp(smalla.timestampvalue, 'yy.MM.dd') from bqt1.smalla"; //$NON-NLS-1$
String output = "SELECT TO_TIMESTAMP(to_char(cast(g_0.TimestampValue AS timestamp), 'YYYY-MM-DD HH24:MI:SS.FF'), YYYY.MM.DD), TO_CHAR(g_0.TimestampValue, YY.MM.DD) FROM SmallA g_0"; //$NON-NLS-1$
12 years, 9 months
teiid SVN: r3923 - trunk/metadata/src/main/java/org/teiid/metadata/index.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2012-03-08 15:05:47 -0500 (Thu, 08 Mar 2012)
New Revision: 3923
Removed:
trunk/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataFactory.java
Log:
TEIID-1280: Adding implementation for providing the DDL based view definitions and also flexible metadata repository plug-in architecture.
Deleted: trunk/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataFactory.java
===================================================================
--- trunk/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataFactory.java 2012-03-08 20:03:01 UTC (rev 3922)
+++ trunk/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataFactory.java 2012-03-08 20:05:47 UTC (rev 3923)
@@ -1,568 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.metadata.index;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.URISyntaxException;
-import java.nio.charset.Charset;
-import java.util.*;
-
-import org.jboss.vfs.VirtualFile;
-import org.jboss.vfs.VirtualFileFilter;
-import org.teiid.adminapi.impl.ModelMetaData;
-import org.teiid.adminapi.impl.VDBMetaData;
-import org.teiid.core.TeiidException;
-import org.teiid.core.TeiidRuntimeException;
-import org.teiid.core.index.IEntryResult;
-import org.teiid.core.util.PropertiesUtils;
-import org.teiid.core.util.StringUtil;
-import org.teiid.internal.core.index.Index;
-import org.teiid.metadata.*;
-import org.teiid.metadata.FunctionMethod.Determinism;
-import org.teiid.metadata.FunctionMethod.PushDown;
-import org.teiid.query.metadata.TransformationMetadata;
-import org.teiid.query.metadata.TransformationMetadata.Resource;
-
-
-/**
- * Loads MetadataRecords from index files.
- */
-public class IndexMetadataFactory {
-
- private Index[] indexes;
- private RecordFactory recordFactory = new RecordFactory() {
-
- protected AbstractMetadataRecord getMetadataRecord(char[] record) {
- if (record == null || record.length == 0) {
- return null;
- }
- char c = record[0];
- switch (c) {
- case MetadataConstants.RECORD_TYPE.ANNOTATION: {
- final List<String> tokens = RecordFactory.getStrings(record, IndexConstants.RECORD_STRING.RECORD_DELIMITER);
-
- // Extract the index version information from the record
- int indexVersion = recordFactory.getIndexVersion(record);
- String uuid = tokens.get(2);
-
- // The tokens are the standard header values
- int tokenIndex = 6;
-
- if(recordFactory.includeAnnotationProperties(indexVersion)) {
- // The next token are the properties, ignore it not going to be read any way
- tokenIndex++;
- }
-
- // The next token is the description
- annotationCache.put(uuid, tokens.get(tokenIndex++));
- return null;
- }
- case MetadataConstants.RECORD_TYPE.PROPERTY: {
- final List<String> tokens = RecordFactory.getStrings(record, IndexConstants.RECORD_STRING.RECORD_DELIMITER);
-
- String uuid = tokens.get(1);
- LinkedHashMap<String, String> result = extensionCache.get(uuid);
- if (result == null) {
- result = new LinkedHashMap<String, String>();
- extensionCache.put(uuid, result);
- }
- // The tokens are the standard header values
- int tokenIndex = 2;
- result.put( tokens.get(tokenIndex++), tokens.get(tokenIndex++));
- return null;
- }
- default:
- AbstractMetadataRecord abstractMetadataRecord = super.getMetadataRecord(record);
- if (abstractMetadataRecord == null) {
- return null; //record type no longer used
- }
- String parentName = null;
- if (record[0] == MetadataConstants.RECORD_TYPE.TABLE) {
- parentName = ((Table)abstractMetadataRecord).getParent().getName();
- } else if (record[0] == MetadataConstants.RECORD_TYPE.CALLABLE) {
- parentName = ((Procedure)abstractMetadataRecord).getParent().getName();
- }
- if (parentName != null) {
- Map<Character, List<AbstractMetadataRecord>> map = schemaEntries.get(parentName);
- if (map == null) {
- map = new HashMap<Character, List<AbstractMetadataRecord>>();
- schemaEntries.put(parentName, map);
- }
- List<AbstractMetadataRecord> typeRecords = map.get(record[0]);
- if (typeRecords == null) {
- typeRecords = new ArrayList<AbstractMetadataRecord>();
- map.put(record[0], typeRecords);
- }
- typeRecords.add(abstractMetadataRecord);
- }
- Map<String, AbstractMetadataRecord> uuidMap = getByType(record[0]);
- uuidMap.put(abstractMetadataRecord.getUUID(), abstractMetadataRecord);
- if (parentId != null) {
- List<AbstractMetadataRecord> typeChildren = getByParent(parentId, record[0], AbstractMetadataRecord.class, true);
- typeChildren.add(abstractMetadataRecord);
- }
- return abstractMetadataRecord;
- }
- }
-
- };
- private Map<String, String> annotationCache = new HashMap<String, String>();
- private Map<String, LinkedHashMap<String, String>> extensionCache = new HashMap<String, LinkedHashMap<String,String>>();
- //map of schema name to record entries
- private Map<String, Map<Character, List<AbstractMetadataRecord>>> schemaEntries = new HashMap<String, Map<Character, List<AbstractMetadataRecord>>>();
- //map of parent uuid to record entries
- private Map<String, Map<Character, List<AbstractMetadataRecord>>> childRecords = new HashMap<String, Map<Character, List<AbstractMetadataRecord>>>();
- //map of type to maps of uuids
- private Map<Character, LinkedHashMap<String, AbstractMetadataRecord>> allRecords = new HashMap<Character, LinkedHashMap<String, AbstractMetadataRecord>>();
- private MetadataStore store;
- private HashSet<VirtualFile> indexFiles = new HashSet<VirtualFile>();
- private LinkedHashMap<String, Resource> vdbEntries;
-
- public IndexMetadataFactory() {
-
- }
-
- /**
- * Load index metadata from a URL. For the system and test vdbs
- * @param url
- * @throws IOException
- * @throws URISyntaxException
- */
- public IndexMetadataFactory(VirtualFile vdb) throws IOException, URISyntaxException {
- List<VirtualFile> children = vdb.getChildrenRecursively(new VirtualFileFilter() {
- @Override
- public boolean accepts(VirtualFile file) {
- return file.getName().endsWith(IndexConstants.NAME_DELIM_CHAR+IndexConstants.INDEX_EXT);
- }
- });
-
- for (VirtualFile f: children) {
- addIndexFile(f);
- }
- //just use the defaults for model visibility
- addEntriesPlusVisibilities(vdb, new VDBMetaData());
- }
-
- Map<String, AbstractMetadataRecord> getByType(char type) {
- LinkedHashMap<String, AbstractMetadataRecord> uuidMap = allRecords.get(type);
- if (uuidMap == null) {
- uuidMap = new LinkedHashMap<String, AbstractMetadataRecord>();
- allRecords.put(type, uuidMap);
- }
- return uuidMap;
- }
-
- <T extends AbstractMetadataRecord> List<T> getByParent(String parentId, char type, @SuppressWarnings("unused") Class<T> clazz, boolean create) {
- Map<Character, List<AbstractMetadataRecord>> children = childRecords.get(parentId);
- if (children == null) {
- children = new HashMap<Character, List<AbstractMetadataRecord>>();
- childRecords.put(parentId, children);
- }
- List<AbstractMetadataRecord> typeChildren = children.get(type);
- if (typeChildren == null) {
- if (!create) {
- return Collections.emptyList();
- }
- typeChildren = new ArrayList<AbstractMetadataRecord>(2);
- children.put(type, typeChildren);
- }
- return (List<T>) typeChildren;
- }
-
- private void loadAll() {
- for (Index index : this.indexes) {
- try {
- IEntryResult[] results = SimpleIndexUtil.queryIndex(new Index[] {index}, new char[0], true, true, false);
- recordFactory.getMetadataRecord(results);
- } catch (TeiidException e) {
- throw new TeiidRuntimeException(RuntimeMetadataPlugin.Event.TEIID80000, e);
- }
- }
- //associate the annotation/extension metadata
- for (Map<String, AbstractMetadataRecord> map : allRecords.values()) {
- for (AbstractMetadataRecord metadataRecord : map.values()) {
- String uuid = metadataRecord.getUUID();
-
- metadataRecord.setAnnotation(this.annotationCache.get(uuid));
- metadataRecord.setProperties(this.extensionCache.get(uuid));
- }
- }
- }
-
- public MetadataStore getMetadataStore(Collection<Datatype> systemDatatypes) throws IOException {
- if (this.store == null) {
- this.store = new MetadataStore();
- if (systemDatatypes == null) {
- InputStream is = this.getClass().getClassLoader().getResourceAsStream("org/teiid/metadata/types.dat"); //$NON-NLS-1$
- try {
- InputStreamReader isr = new InputStreamReader(is, Charset.forName("UTF-8")); //$NON-NLS-1$
- BufferedReader br = new BufferedReader(isr);
- String s = br.readLine();
- String[] props = s.split("\\|"); //$NON-NLS-1$
- while ((s = br.readLine()) != null) {
- Datatype dt = new Datatype();
- String[] vals = s.split("\\|"); //$NON-NLS-1$
- Properties p = new Properties();
- for (int i = 0; i < props.length; i++) {
- if (vals[i].length() != 0) {
- p.setProperty(props[i], new String(vals[i]));
- }
- }
- PropertiesUtils.setBeanProperties(dt, p, null);
- this.store.addDatatype(dt);
- }
- } finally {
- is.close();
- }
- }
- ArrayList<Index> tmp = new ArrayList<Index>();
- for (VirtualFile f : indexFiles) {
- Index index = new Index(f, true);
- index.setDoCache(true);
- tmp.add(index);
- }
- this.indexes = tmp.toArray(new Index[tmp.size()]);
- loadAll();
- //force close, since we cached the index files
- for (Index index : tmp) {
- index.close();
- }
- Map<String, AbstractMetadataRecord> uuidToRecord = getByType(MetadataConstants.RECORD_TYPE.DATATYPE);
- if (systemDatatypes != null) {
- for (Datatype datatype : systemDatatypes) {
- uuidToRecord.put(datatype.getUUID(), datatype);
- }
- } else {
- for (Datatype datatype : this.store.getDatatypes()) {
- uuidToRecord.put(datatype.getUUID(), datatype);
- }
- }
- for (AbstractMetadataRecord datatypeRecordImpl : uuidToRecord.values()) {
- this.store.addDatatype((Datatype) datatypeRecordImpl);
- }
- getModels();
- getTables();
- getProcedures();
- }
- return store;
- }
-
- public void addIndexFile(VirtualFile f) {
- this.indexFiles.add(f);
- }
-
- public void addEntriesPlusVisibilities(VirtualFile root, VDBMetaData vdb) throws IOException {
- LinkedHashMap<String, Resource> visibilityMap = new LinkedHashMap<String, Resource>();
- for(VirtualFile f: root.getChildrenRecursively()) {
- if (f.isFile()) {
- // remove the leading vdb name from the entry
- String path = f.getPathName().substring(root.getPathName().length());
- if (!path.startsWith("/")) { //$NON-NLS-1$
- path = "/" + path; //$NON-NLS-1$
- }
- visibilityMap.put(path, new Resource(f, isFileVisible(f.getPathName(), vdb)));
- }
- }
- this.vdbEntries = visibilityMap;
- }
-
- private boolean isFileVisible(String pathInVDB, VDBMetaData vdb) {
-
- if (pathInVDB.endsWith(".xmi")) { //$NON-NLS-1$
- String modelName = StringUtil.getFirstToken(StringUtil.getLastToken(pathInVDB, "/"), "."); //$NON-NLS-1$ //$NON-NLS-2$
-
- ModelMetaData model = vdb.getModel(modelName);
- if (model != null) {
- return model.isVisible();
- }
- }
-
- if (pathInVDB.startsWith("META-INF/")) {//$NON-NLS-1$
- return false;
- }
-
- String entry = StringUtil.getLastToken(pathInVDB, "/"); //$NON-NLS-1$
-
- // index files should not be visible
- if( entry.endsWith(VdbConstants.INDEX_EXT) || entry.endsWith(VdbConstants.SEARCH_INDEX_EXT)) {
- return false;
- }
-
- // deployment file should not be visible
- if(entry.equalsIgnoreCase(VdbConstants.DEPLOYMENT_FILE)) {
- return false;
- }
-
- // any other file should be visible
- return true;
- }
-
- public LinkedHashMap<String, Resource> getEntriesPlusVisibilities(){
- return this.vdbEntries;
- }
-
- public void getModels() {
- Collection<AbstractMetadataRecord> records = getByType(MetadataConstants.RECORD_TYPE.MODEL).values();
- for (AbstractMetadataRecord modelRecord : records) {
- store.addSchema((Schema) modelRecord);
- }
- }
-
- public void getTables() {
- for (Schema model : store.getSchemas().values()) {
- Map<Character, List<AbstractMetadataRecord>> entries = schemaEntries.get(model.getName());
- if (entries == null) {
- continue;
- }
- List recs = entries.get(MetadataConstants.RECORD_TYPE.TABLE);
- if (recs == null) {
- continue;
- }
- List<Table> records = recs;
-
- //load non-materialized first, so that the uuid->table cache is populated
- Collections.sort(records, new Comparator<Table>() {
- @Override
- public int compare(Table o1, Table o2) {
- if (!o1.isMaterialized()) {
- return -1;
- }
- if (!o2.isMaterialized()) {
- return 1;
- }
- return 0;
- }
- });
- for (Table tableRecord : records) {
- List<Column> columns = new ArrayList<Column>(getByParent(tableRecord.getUUID(), MetadataConstants.RECORD_TYPE.COLUMN, Column.class, false));
- for (Column columnRecordImpl : columns) {
- columnRecordImpl.setDatatype((Datatype) getByType(MetadataConstants.RECORD_TYPE.DATATYPE).get(columnRecordImpl.getDatatypeUUID()));
- columnRecordImpl.setParent(tableRecord);
- String fullName = columnRecordImpl.getName();
- if (fullName.startsWith(tableRecord.getName() + '.')) {
- columnRecordImpl.setName(new String(fullName.substring(tableRecord.getName().length() + 1)));
- }
- }
- Collections.sort(columns);
- tableRecord.setColumns(columns);
- tableRecord.setAccessPatterns(getByParent(tableRecord.getUUID(), MetadataConstants.RECORD_TYPE.ACCESS_PATTERN, KeyRecord.class, false));
- Map<String, Column> uuidColumnMap = new HashMap<String, Column>();
- for (Column columnRecordImpl : columns) {
- uuidColumnMap.put(columnRecordImpl.getUUID(), columnRecordImpl);
- }
- for (KeyRecord columnSetRecordImpl : tableRecord.getAccessPatterns()) {
- loadColumnSetRecords(columnSetRecordImpl, uuidColumnMap);
- columnSetRecordImpl.setParent(tableRecord);
- }
- tableRecord.setForiegnKeys(getByParent(tableRecord.getUUID(), MetadataConstants.RECORD_TYPE.FOREIGN_KEY, ForeignKey.class, false));
- for (ForeignKey foreignKeyRecord : tableRecord.getForeignKeys()) {
- KeyRecord pk = (KeyRecord) getRecordByType(foreignKeyRecord.getUniqueKeyID(), MetadataConstants.RECORD_TYPE.PRIMARY_KEY, false);
- if (pk == null) {
- pk = (KeyRecord) getRecordByType(foreignKeyRecord.getUniqueKeyID(), MetadataConstants.RECORD_TYPE.UNIQUE_KEY);
- }
- foreignKeyRecord.setPrimaryKey(pk);
- loadColumnSetRecords(foreignKeyRecord, uuidColumnMap);
- foreignKeyRecord.setParent(tableRecord);
- }
- tableRecord.setUniqueKeys(getByParent(tableRecord.getUUID(), MetadataConstants.RECORD_TYPE.UNIQUE_KEY, KeyRecord.class, false));
- for (KeyRecord columnSetRecordImpl : tableRecord.getUniqueKeys()) {
- loadColumnSetRecords(columnSetRecordImpl, uuidColumnMap);
- columnSetRecordImpl.setParent(tableRecord);
- }
- List<KeyRecord> indexRecords = tableRecord.getIndexes();
- for (int i = 0; i < indexRecords.size(); i++) {
- indexRecords.set(i, (KeyRecord) getRecordByType(indexRecords.get(i).getUUID(), MetadataConstants.RECORD_TYPE.INDEX));
- }
- for (KeyRecord columnSetRecordImpl : indexRecords) {
- loadColumnSetRecords(columnSetRecordImpl, uuidColumnMap);
- columnSetRecordImpl.setParent(tableRecord);
- }
- if (tableRecord.getPrimaryKey() != null) {
- KeyRecord primaryKey = (KeyRecord) getRecordByType(tableRecord.getPrimaryKey().getUUID(), MetadataConstants.RECORD_TYPE.PRIMARY_KEY);
- loadColumnSetRecords(primaryKey, uuidColumnMap);
- primaryKey.setParent(tableRecord);
- tableRecord.setPrimaryKey(primaryKey);
- }
- String groupUUID = tableRecord.getUUID();
- if (tableRecord.isVirtual()) {
- TransformationRecordImpl update = (TransformationRecordImpl)getRecordByType(groupUUID, MetadataConstants.RECORD_TYPE.UPDATE_TRANSFORM,false);
- if (update != null) {
- tableRecord.setUpdatePlan(update.getTransformation());
- }
- TransformationRecordImpl insert = (TransformationRecordImpl)getRecordByType(groupUUID, MetadataConstants.RECORD_TYPE.INSERT_TRANSFORM,false);
- if (insert != null) {
- tableRecord.setInsertPlan(insert.getTransformation());
- }
- TransformationRecordImpl delete = (TransformationRecordImpl)getRecordByType(groupUUID, MetadataConstants.RECORD_TYPE.DELETE_TRANSFORM,false);
- if (delete != null) {
- tableRecord.setDeletePlan(delete.getTransformation());
- }
- TransformationRecordImpl select = (TransformationRecordImpl)getRecordByType(groupUUID, MetadataConstants.RECORD_TYPE.SELECT_TRANSFORM,false);
- // this group may be an xml document
- if(select == null) {
- select = (TransformationRecordImpl)getRecordByType(groupUUID, MetadataConstants.RECORD_TYPE.MAPPING_TRANSFORM,false);
- }
- if (select != null) {
- tableRecord.setSelectTransformation(select.getTransformation());
- tableRecord.setBindings(select.getBindings());
- tableRecord.setSchemaPaths(select.getSchemaPaths());
- tableRecord.setResourcePath(select.getResourcePath());
- }
- }
- if (tableRecord.isMaterialized()) {
- tableRecord.setMaterializedStageTable((Table)getByType(MetadataConstants.RECORD_TYPE.TABLE).get(tableRecord.getMaterializedStageTable().getUUID()));
- tableRecord.setMaterializedTable((Table)getByType(MetadataConstants.RECORD_TYPE.TABLE).get(tableRecord.getMaterializedTable().getUUID()));
- }
- model.addTable(tableRecord);
- }
- }
- }
-
- private Column findElement(String fullName) {
- Column columnRecord = (Column)getRecordByType(fullName, MetadataConstants.RECORD_TYPE.COLUMN);
- columnRecord.setDatatype((Datatype) getByType(MetadataConstants.RECORD_TYPE.DATATYPE).get(columnRecord.getDatatypeUUID()));
- return columnRecord;
- }
-
- private AbstractMetadataRecord getRecordByType(final String entityName, final char recordType) {
- return getRecordByType(entityName, recordType, true);
- }
-
- private AbstractMetadataRecord getRecordByType(final String entityName, final char recordType, boolean mustExist) {
- // Query the index files
- AbstractMetadataRecord record = getByType(recordType).get(entityName);
-
- if(record == null) {
- if (mustExist) {
- // there should be only one for the UUID
- throw new TeiidRuntimeException(RuntimeMetadataPlugin.Event.TEIID80002, entityName+TransformationMetadata.NOT_EXISTS_MESSAGE);
- }
- return null;
- }
- return record;
- }
-
- public void getProcedures() {
- for (Schema model : store.getSchemas().values()) {
- Map<Character, List<AbstractMetadataRecord>> entries = schemaEntries.get(model.getName());
- if (entries == null) {
- continue;
- }
- List recs = entries.get(MetadataConstants.RECORD_TYPE.CALLABLE);
- if (recs == null) {
- continue;
- }
- List<Procedure> records = recs;
- for (Procedure procedureRecord : records) {
- // get the parameter metadata info
- for (int i = 0; i < procedureRecord.getParameters().size(); i++) {
- ProcedureParameter paramRecord = (ProcedureParameter) this.getRecordByType(procedureRecord.getParameters().get(i).getUUID(), MetadataConstants.RECORD_TYPE.CALLABLE_PARAMETER);
- paramRecord.setDatatype((Datatype) getByType(MetadataConstants.RECORD_TYPE.DATATYPE).get(paramRecord.getDatatypeUUID()));
- procedureRecord.getParameters().set(i, paramRecord);
- paramRecord.setProcedure(procedureRecord);
- }
-
- ColumnSet<Procedure> result = procedureRecord.getResultSet();
- if(result != null) {
- ColumnSet<Procedure> resultRecord = (ColumnSet<Procedure>) getRecordByType(result.getUUID(), MetadataConstants.RECORD_TYPE.RESULT_SET, false);
- if (resultRecord != null) {
- resultRecord.setParent(procedureRecord);
- resultRecord.setName(RecordFactory.getShortName(resultRecord.getName()));
- loadColumnSetRecords(resultRecord, null);
- procedureRecord.setResultSet(resultRecord);
- }
- //it is ok to be null here. it will happen when a
- //virtual stored procedure is created from a
- //physical stored procedure without a result set
- //TODO: find a better fix for this
- }
-
- // if this is a virtual procedure get the procedure plan
- if(procedureRecord.isVirtual()) {
- TransformationRecordImpl transformRecord = (TransformationRecordImpl)getRecordByType(procedureRecord.getUUID(), MetadataConstants.RECORD_TYPE.PROC_TRANSFORM, false);
- if(transformRecord != null) {
- procedureRecord.setQueryPlan(transformRecord.getTransformation());
- }
- } else if (procedureRecord.isFunction()) {
- boolean deterministic = Boolean.valueOf(procedureRecord.getProperty(AbstractMetadataRecord.RELATIONAL_URI + "deterministic", true)); //$NON-NLS-1$
- boolean nullOnNull = Boolean.valueOf(procedureRecord.getProperty(AbstractMetadataRecord.RELATIONAL_URI + "null-on-null", false)); //$NON-NLS-1$
- boolean varargs = Boolean.valueOf(procedureRecord.getProperty(AbstractMetadataRecord.RELATIONAL_URI + "varargs", false)); //$NON-NLS-1$
- FunctionParameter outputParam = null;
- List<FunctionParameter> args = new ArrayList<FunctionParameter>(procedureRecord.getParameters().size() - 1);
- boolean valid = true;
- for (ProcedureParameter param : procedureRecord.getParameters()) {
- FunctionParameter fp = new FunctionParameter();
- fp.setName(param.getName());
- fp.setDescription(param.getAnnotation());
- fp.setType(param.getRuntimeType());
- switch (param.getType()) {
- case ReturnValue:
- if (outputParam != null) {
- valid = false;
- }
- outputParam = fp;
- break;
- case In:
- args.add(fp);
- break;
- default:
- valid = false;
- }
- }
- if (valid && outputParam != null) {
- FunctionMethod function = new FunctionMethod(procedureRecord.getName(), procedureRecord.getAnnotation(), model.getName(), PushDown.MUST_PUSHDOWN,
- null, null, args, outputParam, false, deterministic?Determinism.DETERMINISTIC:Determinism.NONDETERMINISTIC);
- function.setNullOnNull(nullOnNull);
- if (varargs && !function.getInputParameters().isEmpty()) {
- function.getInputParameters().get(args.size() - 1).setVarArg(varargs);
- }
- model.addFunction(function);
- continue;
- }
- }
- model.addProcedure(procedureRecord);
- }
- }
- }
-
- private void loadColumnSetRecords(ColumnSet<?> indexRecord, Map<String, Column> columns) {
- for (int i = 0; i < indexRecord.getColumns().size(); i++) {
- String uuid = indexRecord.getColumns().get(i).getUUID();
- Column c = null;
- if (columns != null) {
- c = columns.get(uuid);
- } else {
- c = findElement(uuid);
- c.setName(RecordFactory.getShortName(c.getName()));
- }
- indexRecord.getColumns().set(i, c);
- if (columns == null) {
- c.setParent(indexRecord);
- }
- }
- }
-
-}
12 years, 9 months
teiid SVN: r3922 - in trunk: admin/src/test/java/org/teiid/adminapi/impl and 62 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2012-03-08 15:03:01 -0500 (Thu, 08 Mar 2012)
New Revision: 3922
Added:
trunk/api/src/main/java/org/teiid/metadata/DefaultMetadataRepository.java
trunk/api/src/main/javacc/
trunk/api/src/main/javacc/org/
trunk/api/src/main/javacc/org/teiid/
trunk/api/src/main/javacc/org/teiid/metadata/
trunk/api/src/main/javacc/org/teiid/metadata/ddl/
trunk/api/src/main/javacc/org/teiid/metadata/ddl/DDLParser.jj
trunk/build/kits/jboss-as7/docs/teiid/datasources/db2/db2-ds.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/db2/db2-xa-ds.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/derby/derby-ds.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/ingres/ingres-ds.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/ingres/ingres-xa-ds.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/intersystems-cache/intersystems-cache-ds.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/mysql/mysql-ds.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/mysql/mysql-xa-ds.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/odbc/odbc-ds.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/oracle/oracle-ds.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/oracle/oracle-xa-ds.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/postgresql/postgresql-ds.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/postgresql/postgresql-xa-ds.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/jtds/sqlserver-ds.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/jtds/sqlserver-xa-ds.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/native/sqlserver-ds.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/native/sqlserver-xa-ds.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/teiid/teiid-ds.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/teiid/teiid-local-ds.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/teiid/teiid-xa-ds.xml
trunk/engine/src/main/java/org/teiid/query/metadata/BaseMetadataRepository.java
trunk/engine/src/main/java/org/teiid/query/metadata/DDLMetadataRepository.java
trunk/engine/src/main/java/org/teiid/query/metadata/MetadataValidator.java
trunk/engine/src/main/java/org/teiid/query/metadata/NativeMetadataRepository.java
trunk/engine/src/test/java/org/teiid/query/metadata/TestMetadataValidator.java
trunk/engine/src/test/java/org/teiid/query/parser/TestDDLParser.java
trunk/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataRepository.java
trunk/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataStore.java
trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDynamicViewDefinition.java
trunk/test-integration/common/src/test/resources/dynamicview-vdb.xml
Removed:
trunk/build/kits/jboss-as7/docs/teiid/datasources/db2/db2-xa.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/db2/db2.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/derby/derby.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/ingres/ingres-xa.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/ingres/ingres.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/intersystems-cache/intersystems-cache.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/mysql/mysql-xa.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/mysql/mysql.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/odbc/odbc.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/oracle/oracle-xa.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/oracle/oracle.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/postgresql/postgresql-xa.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/postgresql/postgresql.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/jtds/sqlserver-xa.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/jtds/sqlserver.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/native/sqlserver-xa.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/native/sqlserver.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/teiid/teiid-local.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/teiid/teiid-xa.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/teiid/teiid.xml
trunk/runtime/src/main/java/org/teiid/deployers/MetadataStoreGroup.java
Modified:
trunk/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataMapper.java
trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataParser.java
trunk/admin/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java
trunk/admin/src/test/resources/parser-test-vdb.xml
trunk/api/src/main/java/org/teiid/connector/DataPlugin.java
trunk/api/src/main/java/org/teiid/metadata/ForeignKey.java
trunk/api/src/main/java/org/teiid/metadata/MetadataFactory.java
trunk/api/src/main/java/org/teiid/metadata/MetadataRepository.java
trunk/api/src/main/java/org/teiid/metadata/MetadataStore.java
trunk/api/src/main/java/org/teiid/metadata/ProcedureParameter.java
trunk/api/src/main/java/org/teiid/metadata/Schema.java
trunk/api/src/main/java/org/teiid/resource/spi/WrappedConnectionFactory.java
trunk/api/src/main/resources/org/teiid/connector/i18n.properties
trunk/build/kits/jboss-as7/docs/teiid/datasources/db2/readme.txt
trunk/build/kits/jboss-as7/docs/teiid/datasources/derby/derby-xa.xml
trunk/build/kits/jboss-as7/docs/teiid/datasources/h2/h2.xml
trunk/build/kits/jboss-as7/domain/configuration/domain-teiid.xml
trunk/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml
trunk/client/src/main/resources/vdb-deployer.xsd
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCMetdataProcessor.java
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCPlugin.java
trunk/connectors/translator-jdbc/src/main/resources/org/teiid/translator/jdbc/i18n.properties
trunk/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/MetadataProcessor.java
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/ConnectorManager.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java
trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java
trunk/engine/src/main/java/org/teiid/query/metadata/CompositeMetadataStore.java
trunk/engine/src/main/java/org/teiid/query/parser/QueryParser.java
trunk/engine/src/main/java/org/teiid/query/parser/SQLParserUtil.java
trunk/engine/src/main/java/org/teiid/query/processor/DdlPlan.java
trunk/engine/src/main/java/org/teiid/query/processor/ProcessorDataManager.java
trunk/engine/src/main/java/org/teiid/query/processor/proc/ProcedurePlan.java
trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj
trunk/engine/src/main/resources/org/teiid/query/i18n.properties
trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestConnectorManager.java
trunk/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java
trunk/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java
trunk/engine/src/test/java/org/teiid/query/processor/HardcodedDataManager.java
trunk/engine/src/test/java/org/teiid/query/processor/relational/TestBatchedUpdateNode.java
trunk/engine/src/test/java/org/teiid/query/processor/relational/TestProjectIntoNode.java
trunk/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java
trunk/jboss-integration/pom.xml
trunk/jboss-integration/src/main/java/org/teiid/jboss/DQPCoreService.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/Element.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/IntegrationPlugin.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidAdd.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidAttachments.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/TranslatorDependencyDeployer.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDependencyDeployer.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java
trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
trunk/jboss-integration/src/test/resources/teiid-model-config.txt
trunk/metadata/src/main/java/org/teiid/metadata/index/RuntimeMetadataPlugin.java
trunk/metadata/src/main/resources/org/teiid/metadata/i18n.properties
trunk/metadata/src/test/java/org/teiid/metadata/index/VDBMetadataFactory.java
trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java
trunk/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java
trunk/runtime/src/main/java/org/teiid/deployers/SystemVDBDeployer.java
trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java
trunk/runtime/src/main/java/org/teiid/runtime/RuntimePlugin.java
trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties
trunk/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java
trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDeployment.java
trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestExecutionReuse.java
trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestRelate.java
trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestDynamicImportedMetaData.java
trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestLocalConnections.java
trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestMatViewAliasing.java
trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestMetadataUpdates.java
trunk/test-integration/common/src/test/java/org/teiid/transport/TestJDBCSocketTransport.java
Log:
TEIID-1280: Adding implementation for providing the DDL based view definitions and also flexible metadata repository plug-in architecture.
Modified: trunk/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -72,6 +72,10 @@
@XmlElement(name = "validation-error")
protected List<ValidationError> errors;
+ protected String schemaSourceType;
+
+ protected String schemaText;
+
@XmlAttribute(name = "name", required = true)
public String getName() {
return super.getName();
@@ -321,5 +325,22 @@
return false;
return true;
}
- }
+ }
+
+ public String getSchemaSourceType() {
+ return schemaSourceType;
+ }
+
+ public void setSchemaSourceType(String schemaSourceType) {
+ this.schemaSourceType = schemaSourceType;
+ }
+
+ public String getSchemaText() {
+ return schemaText;
+ }
+
+ public void setSchemaText(String schemaText) {
+ this.schemaText = schemaText;
+ }
+
}
Modified: trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataMapper.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataMapper.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataMapper.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -236,7 +236,10 @@
private static final String PROPERTIES = "properties"; //$NON-NLS-1$
private static final String SOURCE_MAPPINGS = "source-mappings"; //$NON-NLS-1$
private static final String VALIDITY_ERRORS = "validity-errors"; //$NON-NLS-1$
+ private static final String METADATA= "metadata"; //$NON-NLS-1$
+ private static final String METADATA_TYPE = "metadata-type"; //$NON-NLS-1$
+
public static ModelMetadataMapper INSTANCE = new ModelMetadataMapper();
public ModelNode wrap(ModelMetaData model, ModelNode node) {
@@ -277,6 +280,12 @@
errorsNode.add(ValidationErrorMapper.INSTANCE.wrap(error, new ModelNode()));
}
}
+ if (model.getSchemaText() != null) {
+ node.get(METADATA).set(model.getSchemaText());
+ }
+ if (model.getSchemaSourceType() != null) {
+ node.get(METADATA_TYPE).set(model.getSchemaSourceType());
+ }
return node;
}
@@ -331,6 +340,12 @@
}
}
}
+ if (node.get(METADATA).isDefined()) {
+ model.setSchemaText(node.get(METADATA).asString());
+ }
+ if (node.get(METADATA_TYPE).isDefined()) {
+ model.setSchemaSourceType(node.get(METADATA_TYPE).asString());
+ }
return model;
}
Modified: trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataParser.java
===================================================================
--- trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataParser.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataParser.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -249,11 +249,19 @@
ve.setPath(path);
model.addError(ve);
break;
+ case METADATA:
+ Properties metdataProps = getAttributes(reader);
+ String type = metdataProps.getProperty(Element.TYPE.getLocalName(), "DDL");
+ String schema = reader.getElementText();
+ model.setSchemaSourceType(type);
+ model.setSchemaText(schema);
+ break;
default:
- throw new XMLStreamException(AdminPlugin.Util.gs("unexpected_element4",reader.getName(),
+ throw new XMLStreamException(AdminPlugin.Util.gs("unexpected_element5",reader.getName(),
Element.DESCRIPTION.getLocalName(),
Element.PROPERTY.getLocalName(),
Element.SOURCE.getLocalName(),
+ Element.METADATA.getLocalName(),
Element.VALIDATION_ERROR.getLocalName()), reader.getLocation());
}
}
@@ -303,7 +311,8 @@
ALLOW_EXECUTE("allow-execute"),
ALLOW_ALTER("allow-alter"),
MAPPED_ROLE_NAME("mapped-role-name"),
- ENTRY("entry");
+ ENTRY("entry"),
+ METADATA("metadata");
private final String name;
@@ -453,6 +462,13 @@
writer.writeEndElement();
}
+ if (model.getSchemaSourceType() != null) {
+ writer.writeStartElement(Element.METADATA.getLocalName());
+ writer.writeAttribute(Element.TYPE.getLocalName(), model.getSchemaSourceType());
+ writer.writeCData(model.getSchemaText());
+ writer.writeEndElement();
+ }
+
// model validation errors
for (ValidationError ve:model.getErrors()) {
writer.writeStartElement(Element.VALIDATION_ERROR.getLocalName());
Modified: trunk/admin/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java
===================================================================
--- trunk/admin/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/admin/src/test/java/org/teiid/adminapi/impl/TestVDBMetaData.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -50,7 +50,7 @@
@SuppressWarnings("nls")
public class TestVDBMetaData {
- @Test
+
public void testMarshellUnmarshellUsingJaxb() throws Exception {
VDBMetaData vdb = buildVDB();
@@ -118,6 +118,8 @@
assertTrue(modelTwo.getSourceNames().contains("s2")); //$NON-NLS-1$
assertEquals(Model.Type.VIRTUAL, modelTwo.getModelType()); // this is not persisted in the XML
assertEquals("model-value", modelTwo.getPropertyValue("model-prop")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("DDL", modelTwo.getSchemaSourceType());
+ assertEquals("DDL Here", modelTwo.getSchemaText());
assertTrue(vdb.getValidityErrors().contains("There is an error in VDB")); //$NON-NLS-1$
@@ -182,6 +184,8 @@
modelTwo.addSourceMapping("s2", "translator", "java:binding-two"); //$NON-NLS-1$ //$NON-NLS-2$
modelTwo.setModelType(Model.Type.VIRTUAL); //$NON-NLS-1$
modelTwo.addProperty("model-prop", "model-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ modelTwo.setSchemaSourceType("DDL");
+ modelTwo.setSchemaText("DDL Here");
vdb.addModel(modelTwo);
Modified: trunk/admin/src/test/resources/parser-test-vdb.xml
===================================================================
--- trunk/admin/src/test/resources/parser-test-vdb.xml 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/admin/src/test/resources/parser-test-vdb.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -12,6 +12,7 @@
<property name="model-prop" value="model-value"></property>
<source name="s1" translator-name="translator" connection-jndi-name="java:binding-one"></source>
<source name="s2" translator-name="translator" connection-jndi-name="java:binding-two"></source>
+ <metadata type="DDL"><![CDATA[DDL Here]]></metadata>
</model>
<translator name="oracleOverride" type="oracle" description="hello world">
<property name="my-property" value="my-value"></property>
Modified: trunk/api/src/main/java/org/teiid/connector/DataPlugin.java
===================================================================
--- trunk/api/src/main/java/org/teiid/connector/DataPlugin.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/api/src/main/java/org/teiid/connector/DataPlugin.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -45,6 +45,10 @@
TEIID60008,
TEIID60009,
TEIID60010,
- TEIID60011,
+ TEIID60011,
+ TEIID60012,
+ TEIID60013,
+ TEIID60014,
+ TEIID60015
}
}
Added: trunk/api/src/main/java/org/teiid/metadata/DefaultMetadataRepository.java
===================================================================
--- trunk/api/src/main/java/org/teiid/metadata/DefaultMetadataRepository.java (rev 0)
+++ trunk/api/src/main/java/org/teiid/metadata/DefaultMetadataRepository.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -0,0 +1,117 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.metadata;
+
+import java.util.LinkedHashMap;
+
+/**
+ * This class is being provided for sole reason to inject metadata as it used to be in previous
+ * teiid versions. Take a look at modified interface of the MetadataRepostiory interface.
+ */
+@SuppressWarnings("unused")
+public abstract class DefaultMetadataRepository implements MetadataRepository {
+
+ /**
+ * Marks the start of vdb metadata loading
+ * @param vdbName
+ * @param vdbVersion
+ */
+ public void startLoadVdb(String vdbName, int vdbVersion) {
+ }
+
+ /**
+ * Marks the end of vdb metadata loading
+ * @param vdbName
+ * @param vdbVersion
+ */
+ public void endLoadVdb(String vdbName, int vdbVersion) {
+ }
+
+ /**
+ * Get updated {@link ColumnStats} for the given column
+ * @param vdbName
+ * @param vdbVersion
+ * @param column
+ * @return the stats. a null result or a null stat indicates that the default should be used
+ */
+ public ColumnStats getColumnStats(String vdbName, int vdbVersion, Column column) {
+ return null;
+ }
+
+ /**
+ * Returns an updated trigger definition (FOR EACH ROW ...) or null if the current view definition should be used
+ * should be used.
+ */
+ public String getInsteadOfTriggerDefinition(String vdbName, int vdbVersion, Table table, Table.TriggerEvent triggerOperation) {
+ return null;
+ }
+
+ /**
+ * Returns an updated procedure definition (CREATE PROCEDURE ...) or null if the current procedure definition should be used
+ * should be used.
+ */
+ public String getProcedureDefinition(String vdbName, int vdbVersion, Procedure procedure) {
+ return null;
+ }
+
+ /**
+ * Get updated {@link TableStats} for the given table
+ * @param vdbName
+ * @param vdbVersion
+ * @param table
+ * @return the stats. a null result or a null stat indicates that the current value should be used
+ */
+ public TableStats getTableStats(String vdbName, int vdbVersion, Table table) {
+ return null;
+ }
+
+ /**
+ * Returns an updated view definition (AS SQL only) or null if the current view definition should be used
+ * should be used.
+ */
+ public String getViewDefinition(String vdbName, int vdbVersion, Table table) {
+ return null;
+ }
+
+ /**
+ * Get the extension metadata for a given record.
+ * @param vdbName
+ * @param vdbVersion
+ * @param record
+ * @return
+ */
+ public LinkedHashMap<String, String> getProperties(String vdbName, int vdbVersion, AbstractMetadataRecord record){
+ return null;
+ }
+
+ /**
+ * Returns whether the trigger is enabled
+ * @param vdbName
+ * @param vdbVersion
+ * @param table
+ * @param triggerOperation
+ * @return
+ */
+ public Boolean isInsteadOfTriggerEnabled(String vdbName, int vdbVersion, Table table, Table.TriggerEvent triggerOperation) {
+ return null;
+ }
+}
Property changes on: trunk/api/src/main/java/org/teiid/metadata/DefaultMetadataRepository.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/api/src/main/java/org/teiid/metadata/ForeignKey.java
===================================================================
--- trunk/api/src/main/java/org/teiid/metadata/ForeignKey.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/api/src/main/java/org/teiid/metadata/ForeignKey.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -22,6 +22,8 @@
package org.teiid.metadata;
+import java.util.List;
+
/**
* ForeignKeyRecordImpl
*/
@@ -31,6 +33,8 @@
private String uniqueKeyID;
private KeyRecord primaryKey;
+ private String referenceTableName;
+ private List<String> referenceColumns;
public ForeignKey() {
super(Type.Foreign);
@@ -61,4 +65,20 @@
public void setPrimaryKey(KeyRecord primaryKey) {
this.primaryKey = primaryKey;
}
+
+ public String getReferenceTableName() {
+ return referenceTableName;
+ }
+
+ public void setReferenceTableName(String tableName) {
+ this.referenceTableName = tableName;
+ }
+
+ public List<String> getReferenceColumns() {
+ return referenceColumns;
+ }
+
+ public void setReferenceColumns(List<String> referenceColumns) {
+ this.referenceColumns = referenceColumns;
+ }
}
\ No newline at end of file
Modified: trunk/api/src/main/java/org/teiid/metadata/MetadataFactory.java
===================================================================
--- trunk/api/src/main/java/org/teiid/metadata/MetadataFactory.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/api/src/main/java/org/teiid/metadata/MetadataFactory.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -23,10 +23,13 @@
package org.teiid.metadata;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
+import java.util.TreeMap;
import java.util.UUID;
import org.teiid.connector.DataPlugin;
@@ -40,31 +43,35 @@
* TODO: add support for datatype import
* TODO: add support for unique constraints
*/
-public class MetadataFactory {
+public class MetadataFactory extends Schema {
+ private static final long serialVersionUID = 8590341087771685630L;
- private Schema schema;
+ private String vdbName;
+ private int vdbVersion;
private Map<String, Datatype> dataTypes;
+ private boolean autoCorrectColumnNames = true;
+ private Map<String, String> namespaces = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
+ private String rawMetadata;
private Properties importProperties;
- private MetadataStore store = new MetadataStore();
- private boolean autoCorrectColumnNames = true;
- public MetadataFactory(String modelName, Map<String, Datatype> dataTypes, Properties importProperties) {
+ public MetadataFactory(String vdbName, int vdbVersion, String schemaName, Map<String, Datatype> dataTypes, Properties importProperties, String rawMetadata) {
+ this.vdbName = vdbName;
+ this.vdbVersion = vdbVersion;
this.dataTypes = dataTypes;
- schema = new Schema();
- schema.setName(modelName);
- setUUID(schema);
- store.addSchema(schema);
+ setName(schemaName);
+ setUUID(this);
this.importProperties = importProperties;
+ this.rawMetadata = rawMetadata;
}
-
- public MetadataStore getMetadataStore() {
- return store;
- }
-
+
public Properties getImportProperties() {
return importProperties;
}
+ public String getRawMetadata() {
+ return this.rawMetadata;
+ }
+
protected void setUUID(AbstractMetadataRecord record) {
record.setUUID("mmuuid:" +UUID.randomUUID()); //$NON-NLS-1$
}
@@ -80,7 +87,7 @@
table.setTableType(Table.Type.Table);
table.setName(name);
setUUID(table);
- this.schema.addTable(table);
+ addTable(table);
return table;
}
@@ -180,79 +187,53 @@
index.setName(name);
setUUID(index);
assignColumns(columnNames, table, index);
- table.getIndexes().add(index);
+ if (nonUnique) {
+ table.getIndexes().add(index);
+ }
+ else {
+ table.getUniqueKeys().add(index);
+ }
return index;
}
-
+
+
/**
* Adds a foreign key to the given table. The referenced primary key must already exist. The column names should be in key order.
* @param name
* @param columnNames
- * @param pkTable
+ * @param referenceTable - schema qualified reference table name
* @param table
* @return
* @throws TranslatorException
*/
- public ForeignKey addForiegnKey(String name, List<String> columnNames, Table pkTable, Table table) throws TranslatorException {
- return addForiegnKey(name, columnNames, null, pkTable, table, false);
+ public ForeignKey addForiegnKey(String name, List<String> columnNames, String referenceTable, Table table) throws TranslatorException {
+ return addForiegnKey(name, columnNames, null, referenceTable, table);
}
/**
* Adds a foreign key to the given table. The referenced key may be automatically created if addUniqueConstraint is true. The column names should be in key order.
+ * if reference table is is another schema, they will be resolved during validation.
* @param name
* @param columnNames
* @param referencedColumnNames, may be null to indicate that the primary key should be used.
- * @param pkTable
+ * @param referenceTable - schema qualified reference table name, can be from another schema
* @param table
- * @param addUniqueConstraint
+ * @param addUniqueConstraint - if true, if the referenced table columns do not match with either PK, or FK then a UNIQUE index on reference table is created.
* @return
* @throws TranslatorException
*/
- public ForeignKey addForiegnKey(String name, List<String> columnNames, List<String> referencedColumnNames, Table pkTable, Table table, boolean addUniqueConstraint) throws TranslatorException {
+ public ForeignKey addForiegnKey(String name, List<String> columnNames, List<String> referencedColumnNames, String referenceTable, Table table) throws TranslatorException {
ForeignKey foreignKey = new ForeignKey();
foreignKey.setParent(table);
- KeyRecord uniqueKey = null;
foreignKey.setColumns(new ArrayList<Column>(columnNames.size()));
assignColumns(columnNames, table, foreignKey);
- if (referencedColumnNames == null) {
- uniqueKey = pkTable.getPrimaryKey();
- } else {
- for (KeyRecord record : pkTable.getUniqueKeys()) {
- if (keyMatches(referencedColumnNames, record)) {
- uniqueKey = record;
- break;
- }
- }
- if (uniqueKey == null && pkTable.getPrimaryKey() != null && keyMatches(referencedColumnNames, pkTable.getPrimaryKey())) {
- uniqueKey = pkTable.getPrimaryKey();
- }
- }
- if (uniqueKey == null) {
- if (!addUniqueConstraint) {
- throw new TranslatorException(DataPlugin.Event.TEIID60010, DataPlugin.Util.gs(DataPlugin.Event.TEIID60010, pkTable, referencedColumnNames));
- }
- uniqueKey = addIndex(name + "_unique", false, referencedColumnNames, pkTable); //$NON-NLS-1$
- }
+ foreignKey.setReferenceTableName(referenceTable);
+ foreignKey.setReferenceColumns(referencedColumnNames);
foreignKey.setName(name);
setUUID(foreignKey);
- foreignKey.setPrimaryKey(uniqueKey);
- foreignKey.setUniqueKeyID(uniqueKey.getUUID());
table.getForeignKeys().add(foreignKey);
return foreignKey;
- }
-
- private boolean keyMatches(List<String> names,
- KeyRecord record) {
- if (names.size() != record.getColumns().size()) {
- return false;
- }
- for (int i = 0; i < names.size(); i++) {
- if (!names.get(i).equals(record.getColumns().get(i))) {
- return false;
- }
- }
- return true;
- }
+ }
/**
* Add a procedure with the given name to the model.
@@ -265,7 +246,7 @@
procedure.setName(name);
setUUID(procedure);
procedure.setParameters(new LinkedList<ProcedureParameter>());
- this.schema.addProcedure(procedure);
+ addProcedure(procedure);
return procedure;
}
@@ -336,7 +317,7 @@
FunctionMethod function = new FunctionMethod();
function.setName(name);
setUUID(function);
- this.schema.addFunction(function);
+ addFunction(function);
return function;
}
@@ -348,12 +329,60 @@
this.autoCorrectColumnNames = autoCorrectColumnNames;
}
- public void setMetadataStore(MetadataStore metadataStore) {
- this.store = metadataStore;
- if (this.store.getSchemas().isEmpty()) {
- this.store.addSchema(schema);
- } else {
- this.schema = this.store.getSchemas().values().iterator().next();
+ public void addNamespace(String prefix, String uri) {
+ this.namespaces.put(prefix, uri);
+ }
+
+ public void mergeInto (MetadataStore store) {
+ store.addSchema(this);
+ store.addDataTypes(this.dataTypes.values());
+ store.addNamespaces(this.namespaces);
+ }
+
+ public MetadataStore asMetadataStore() {
+ MetadataStore store = new MetadataStore();
+ mergeInto(store);
+ return store;
+ }
+
+ public void mergeFrom(Schema schema) {
+ setName(schema.getName());
+ setUUID(schema.getUUID());
+
+ for (Table t:schema.getTables().values()) {
+ addTable(t);
}
+ for (Procedure p: schema.getProcedures().values()) {
+ addProcedure(p);
+ }
+ for (FunctionMethod fm:schema.getFunctions().values()) {
+ addFunction(fm);
+ }
+ setProperties(new LinkedHashMap<String, String>(schema.getProperties()));
}
+
+ public Map<String, Datatype> getDataTypes() {
+ return dataTypes;
+ }
+
+ void addDataTypes(Collection<Datatype> types) {
+ for (Datatype type: types) {
+ addDatatype(type);
+ }
+ }
+
+ public void addDatatype(Datatype datatype) {
+ if (this.dataTypes == null) {
+ this.dataTypes = new TreeMap<String, Datatype>();
+ }
+ this.dataTypes.put(datatype.getName(), datatype);
+ }
+
+ public String getVdbName() {
+ return vdbName;
+ }
+
+ public int getVdbVersion() {
+ return vdbVersion;
+ }
}
Modified: trunk/api/src/main/java/org/teiid/metadata/MetadataRepository.java
===================================================================
--- trunk/api/src/main/java/org/teiid/metadata/MetadataRepository.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/api/src/main/java/org/teiid/metadata/MetadataRepository.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -21,50 +21,35 @@
*/
package org.teiid.metadata;
-import java.util.LinkedHashMap;
+
+import org.teiid.translator.ExecutionFactory;
+import org.teiid.translator.TranslatorException;
+
/**
* A hook for externalizing view, procedure, and other metadata.
*/
-public interface MetadataRepository {
-
+public interface MetadataRepository<F,C> {
+
/**
- * Marks the start of vdb metadata loading
- * @param vdbName
- * @param vdbVersion
+ * Loads the schema information for the vdb for the given schemaName. Loads table, procedures, functions, indexes etc.
+ * @param factory
+ * @return
+ * @throws TranslatorException
*/
- void startLoadVdb(String vdbName, int vdbVersion);
-
+ void loadMetadata(MetadataFactory factory, ExecutionFactory<F, C> executionFactory, F connectionFactory) throws TranslatorException;
+
/**
- * Marks the end of vdb metadata loading
+ * Call back function, when "alter view" definition is called
* @param vdbName
* @param vdbVersion
- */
- void endLoadVdb(String vdbName, int vdbVersion);
-
- /**
- * Returns an updated view definition (AS SQL only) or null if the current view definition should be used
- * should be used.
- */
- String getViewDefinition(String vdbName, int vdbVersion, Table table);
-
- /**
- * Set the view definition
- * @param vdbName
- * @param vdbVersion
* @param table
* @param viewDefinition
*/
void setViewDefinition(String vdbName, int vdbVersion, Table table, String viewDefinition);
-
- /**
- * Returns an updated trigger definition (FOR EACH ROW ...) or null if the current view definition should be used
- * should be used.
- */
- String getInsteadOfTriggerDefinition(String vdbName, int vdbVersion, Table table, Table.TriggerEvent triggerOperation);
/**
- *
+ * Call back function, when "alter trigger" is called
* @param vdbName
* @param vdbVersion
* @param table
@@ -72,19 +57,9 @@
* @param triggerDefinition
*/
void setInsteadOfTriggerDefinition(String vdbName, int vdbVersion, Table table, Table.TriggerEvent triggerOperation, String triggerDefinition);
-
- /**
- * Returns whether the trigger is enabled
- * @param vdbName
- * @param vdbVersion
- * @param table
- * @param triggerOperation
- * @return
- */
- Boolean isInsteadOfTriggerEnabled(String vdbName, int vdbVersion, Table table, Table.TriggerEvent triggerOperation);
/**
- * Set the given trigger enabled.
+ * Callback function, when "alter trigger" is called to enable or disable a trigger
* @param vdbName
* @param vdbVersion
* @param table
@@ -93,31 +68,17 @@
*/
void setInsteadOfTriggerEnabled(String vdbName, int vdbVersion, Table table, Table.TriggerEvent triggerOperation, boolean enabled);
- /**
- * Returns an updated procedure definition (CREATE PROCEDURE ...) or null if the current procedure definition should be used
- * should be used.
- */
- String getProcedureDefinition(String vdbName, int vdbVersion, Procedure procedure);
/**
- * Set the procedure definition
+ * Call back function, when "alter procedure" is called to set the procedure definition
* @param vdbName
* @param vdbVersion
* @param table
* @param procedureDefinition
*/
void setProcedureDefinition(String vdbName, int vdbVersion, Procedure procedure, String procedureDefinition);
-
+
/**
- * Get updated {@link TableStats} for the given table
- * @param vdbName
- * @param vdbVersion
- * @param table
- * @return the stats. a null result or a null stat indicates that the current value should be used
- */
- TableStats getTableStats(String vdbName, int vdbVersion, Table table);
-
- /**
* Set the {@link TableStats} for the given table
* @param vdbName
* @param vdbVersion
@@ -126,14 +87,6 @@
*/
void setTableStats(String vdbName, int vdbVersion, Table table, TableStats tableStats);
- /**
- * Get updated {@link ColumnStats} for the given column
- * @param vdbName
- * @param vdbVersion
- * @param column
- * @return the stats. a null result or a null stat indicates that the default should be used
- */
- ColumnStats getColumnStats(String vdbName, int vdbVersion, Column column);
/**
* Set the {@link ColumnStats} for a given column
@@ -145,15 +98,6 @@
void setColumnStats(String vdbName, int vdbVersion, Column column, ColumnStats columnStats);
/**
- * Get the extension metadata for a given record.
- * @param vdbName
- * @param vdbVersion
- * @param record
- * @return
- */
- LinkedHashMap<String, String> getProperties(String vdbName, int vdbVersion, AbstractMetadataRecord record);
-
- /**
* Set an extension metadata property for a given record.
* @param vdbName
* @param vdbVersion
Modified: trunk/api/src/main/java/org/teiid/metadata/MetadataStore.java
===================================================================
--- trunk/api/src/main/java/org/teiid/metadata/MetadataStore.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/api/src/main/java/org/teiid/metadata/MetadataStore.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -30,6 +30,8 @@
import java.util.Map;
import java.util.TreeMap;
+import org.teiid.connector.DataPlugin;
+
/**
* Simple holder for metadata.
*/
@@ -39,13 +41,24 @@
protected Map<String, Schema> schemas = new TreeMap<String, Schema>(String.CASE_INSENSITIVE_ORDER);
protected List<Schema> schemaList = new ArrayList<Schema>(); //used for a stable ordering
protected Collection<Datatype> datatypes = new LinkedHashSet<Datatype>();
+ protected Map<String, String> namespaces = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
public Map<String, Schema> getSchemas() {
return schemas;
}
+ public Schema getSchema(String name) {
+ Schema s = this.schemas.get(name);
+ if (s == null) {
+ s = this.schemas.get(name.toUpperCase());
+ }
+ return s;
+ }
+
public void addSchema(Schema schema) {
- this.schemas.put(schema.getName(), schema);
+ if (this.schemas.put(schema.getCanonicalName(), schema) != null) {
+ throw new DuplicateRecordException(DataPlugin.Util.gs(DataPlugin.Event.TEIID60012, schema.getName()));
+ }
this.schemaList.add(schema);
}
@@ -53,6 +66,10 @@
return schemaList;
}
+ void addDataTypes(Collection<Datatype> types) {
+ this.datatypes.addAll(types);
+ }
+
public void addDatatype(Datatype datatype) {
this.datatypes.add(datatype);
}
@@ -65,4 +82,24 @@
return datatypes;
}
+ public void addNamespace(String prefix, String uri) {
+ this.namespaces.put(prefix, uri);
+ }
+
+ public Map<String, String> getNamespaces() {
+ return this.namespaces;
+ }
+
+ void addNamespaces(Map<String, String> namespaces) {
+ this.namespaces.putAll(namespaces);
+ }
+
+ public void merge(MetadataStore store) {
+ if (store != null) {
+ for (Schema s:store.getSchemaList()) {
+ addSchema(s);
+ }
+ this.datatypes.addAll(store.getDatatypes());
+ }
+ }
}
Modified: trunk/api/src/main/java/org/teiid/metadata/ProcedureParameter.java
===================================================================
--- trunk/api/src/main/java/org/teiid/metadata/ProcedureParameter.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/api/src/main/java/org/teiid/metadata/ProcedureParameter.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -41,6 +41,7 @@
private Type type;
private boolean optional;
private Procedure procedure;
+ private boolean isVarArg;
public void setType(Type type) {
this.type = type;
@@ -66,5 +67,16 @@
public Procedure getParent() {
return this.procedure;
}
+
+ public void setVarArg(boolean isVarArg) {
+ this.isVarArg = isVarArg;
+ }
+ public boolean isVarArg() {
+ return isVarArg;
+ }
+
+ public String toString() {
+ return getName()+(isVarArg?"... ":" ")+" "+getType(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
}
\ No newline at end of file
Modified: trunk/api/src/main/java/org/teiid/metadata/Schema.java
===================================================================
--- trunk/api/src/main/java/org/teiid/metadata/Schema.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/api/src/main/java/org/teiid/metadata/Schema.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -44,21 +44,21 @@
public void addTable(Table table) {
table.setParent(this);
if (this.tables.put(table.getName(), table) != null) {
- throw new DuplicateRecordException(DataPlugin.Util.getString("Schema.duplicate_table", table.getName())); //$NON-NLS-1$
+ throw new DuplicateRecordException(DataPlugin.Util.gs(DataPlugin.Event.TEIID60013, table.getName()));
}
}
public void addProcedure(Procedure procedure) {
procedure.setParent(this);
if (this.procedures.put(procedure.getName(), procedure) != null) {
- throw new DuplicateRecordException(DataPlugin.Util.getString("Schema.duplicate_procedure", procedure.getName())); //$NON-NLS-1$
+ throw new DuplicateRecordException(DataPlugin.Util.gs(DataPlugin.Event.TEIID60014, procedure.getName()));
}
}
public void addFunction(FunctionMethod function) {
function.setParent(this);
if (this.functions.put(function.getName(), function) != null) {
- throw new DuplicateRecordException(DataPlugin.Util.getString("Schema.duplicate_function", function.getName())); //$NON-NLS-1$
+ throw new DuplicateRecordException(DataPlugin.Util.gs(DataPlugin.Event.TEIID60015, function.getName()));
}
}
@@ -70,6 +70,10 @@
return tables;
}
+ public Table getTable(String tableName) {
+ return tables.get(tableName);
+ }
+
/**
* Get the procedures defined in this schema
* @return
@@ -78,6 +82,10 @@
return procedures;
}
+ public Procedure getProcedure(String procName) {
+ return procedures.get(procName);
+ }
+
/**
* Get the functions defined in this schema
* @return
@@ -86,6 +94,10 @@
return functions;
}
+ public FunctionMethod getFunction(String funcName) {
+ return functions.get(funcName);
+ }
+
public String getPrimaryMetamodelUri() {
return primaryMetamodelUri;
}
Modified: trunk/api/src/main/java/org/teiid/resource/spi/WrappedConnectionFactory.java
===================================================================
--- trunk/api/src/main/java/org/teiid/resource/spi/WrappedConnectionFactory.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/api/src/main/java/org/teiid/resource/spi/WrappedConnectionFactory.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -42,6 +42,11 @@
private BasicManagedConnectionFactory mcf;
private Reference reference;
+ public WrappedConnectionFactory() {
+ // need by spec 17.5.1.1, not sure how this will effect as the this
+ // connection factory is always built by ManagedConnectionfactory
+ }
+
public WrappedConnectionFactory(BasicConnectionFactory delegate, ConnectionManager cm, BasicManagedConnectionFactory mcf) {
this.delegate = delegate;
this.cm = cm;
Added: trunk/api/src/main/javacc/org/teiid/metadata/ddl/DDLParser.jj
===================================================================
--- trunk/api/src/main/javacc/org/teiid/metadata/ddl/DDLParser.jj (rev 0)
+++ trunk/api/src/main/javacc/org/teiid/metadata/ddl/DDLParser.jj 2012-03-08 20:03:01 UTC (rev 3922)
@@ -0,0 +1,731 @@
+options {
+ STATIC = false;
+ ERROR_REPORTING = true;
+ JAVA_UNICODE_ESCAPE = true;
+ UNICODE_INPUT = false;
+ IGNORE_CASE = true;
+ DEBUG_PARSER = false;
+ DEBUG_LOOKAHEAD = false;
+ DEBUG_TOKEN_MANAGER = false;
+}
+
+PARSER_BEGIN(DDLParser)
+
+package org.teiid.metadata.ddl;
+
+import java.util.*;
+import org.teiid.metadata.*;
+import org.teiid.connector.*;
+import org.teiid.translator.*;
+
+/**
+ * <p>The DDLParser is a JavaCC-generated parser that reads a SQL string and produces a
+ * Query object. The SQLParser.java file is generated by JavaCC from the DDLParser.jj
+ * file. <B>WARNING:</B> DO NOT MODIFY the DDLParser.java file as it will be
+ * regenerated from the .jj file and your changes will be lost!</p>
+ */
+@SuppressWarnings("nls")
+public class DDLParser extends DDLParserUtil {
+} // end class
+
+PARSER_END(DDLParser)
+
+TOKEN_MGR_DECLS :
+{
+ int commentNestingDepth;
+}
+
+SKIP :
+{
+ " " | "\t" | "\n" | "\r"
+}
+
+MORE :
+{
+ "/*" { commentNestingDepth = 1 ; } : IN_MULTI_LINE_COMMENT
+}
+
+<IN_MULTI_LINE_COMMENT>
+MORE :
+{
+ "/*" { commentNestingDepth += 1 ; }
+}
+
+<IN_MULTI_LINE_COMMENT>
+SPECIAL_TOKEN :
+{
+ "*/" {
+ commentNestingDepth -= 1;
+ SwitchTo( commentNestingDepth==0 ? DEFAULT : IN_MULTI_LINE_COMMENT ) ;
+ }
+}
+
+<IN_MULTI_LINE_COMMENT>
+MORE :
+{
+ < ~[] >
+}
+
+TOKEN: /* Data types */
+{
+ <STRING: "string">
+| <VARBINARY: "varbinary">
+| <VARCHAR: "varchar">
+| <BOOLEAN: "boolean">
+| <BYTE: "byte">
+| <TINYINT: "tinyint">
+| <SHORT: "short">
+| <SMALLINT: "smallint">
+| <CHAR: "char">
+| <INTEGER: "integer">
+| <LONG: "long">
+| <BIGINT: "bigint">
+| <BIGINTEGER: "biginteger">
+| <FLOAT: "float">
+| <REAL: "real">
+| <DOUBLE: "double">
+| <BIGDECIMAL: "bigdecimal">
+| <DECIMAL: "decimal">
+| <DATE: "date">
+| <TIME: "time">
+| <TIMESTAMP: "timestamp">
+| <OBJECT: "object">
+| <BLOB: "blob">
+| <CLOB: "clob">
+| <XML: "xml">
+}
+
+TOKEN : /* Reserved words */
+{
+ <ALTER: "alter">
+| <ACCESS_PATTERN: "accesspattern">
+| <AS: "as">
+| <AUTO_INCREMENT: "auto_increment">
+| <CONSTRAINT: "constraint">
+| <CREATE: "create">
+| <DEFAULT_KEYWORD: "default">
+| <FOREIGN: "foreign">
+| <FUNCTION: "function">
+| <IN: "in">
+| <INOUT: "inout">
+| <INSTEAD: "instead">
+| <INDEX: "index">
+| <NOT: "not">
+| <NULL: "null">
+| <OPTIONS: "options">
+| <OUT: "out">
+| <PRIMARY: "primary">
+| <PROCEDURE: "procedure">
+| <PUSHDOWN: "pushdown">
+| <RETURNS: "returns">
+| <REFERENCES: "references">
+| <TABLE: "table">
+| <TRIGGER: "trigger">
+| <UNIQUE: "unique">
+| <VARARG: "vararg">
+| <VIEW: "view">
+| <VIRTUAL: "virtual">
+
+}
+
+TOKEN : /* User variables and literals */
+{
+ < ALL_IN_GROUP: <ID> <PERIOD> <STAR> >
+
+| < ID: <QUOTED_ID> (<PERIOD> <QUOTED_ID>)* >
+| < #QUOTED_ID: <ID_PART> | ("\"" (("\"\"") | ~["\""] )+ "\"") >
+| < #ID_PART: (("@" | "#" | <LETTER>) (<LETTER> | "_" | <DIGIT>)*) >
+
+| < DATETYPE: "{" "d" >
+| < TIMETYPE: "{" "t" >
+| < TIMESTAMPTYPE: "{" "ts" >
+| < BOOLEANTYPE: "{" "b" >
+| < POS_REF: ["$"] (<DIGIT>)+ >
+| < INTEGERVAL: (<MINUS>)?(<DIGIT>)+ >
+| < DECIMALVAL: (<MINUS>)? (<DIGIT>)* <PERIOD> (<DIGIT>)+ >
+| < FLOATVAL: (<MINUS>)? <DIGIT> <PERIOD> (<DIGIT>)+
+ ["e", "E"] (["+","-"])? (<DIGIT>)+ >
+| < STRINGVAL: (("N"|"E")? "'" ( ("''") | ~["'"] )* "'") >
+| < #LETTER: (["a"-"z","A"-"Z"] | ["\u0153"-"\ufffd"]) >
+| < #DIGIT: ["0"-"9"] >
+| < BINARYSTRINGVAL: ("X"|"x" "'" ( <HEXIT><HEXIT> )+ "'") >
+| < #HEXIT: (["a"-"f","A"-"F"] | <DIGIT> ) >
+}
+
+TOKEN : /* Punctuation */
+{
+ <COMMA: ",">
+| <PERIOD: ".">
+| <LPAREN: "(">
+| <RPAREN: ")">
+| <LBRACE: "{">
+| <RBRACE: "}">
+| <LSBRACE: "[">
+| <RSBRACE: "]">
+| <EQ: "=">
+| <NE: "<>">
+| <NE2: "!=">
+| <LT: "<">
+| <LE: "<=">
+| <GT: ">">
+| <GE: ">=">
+| <STAR: "*">
+| <SLASH: "/">
+| <PLUS: "+">
+| <MINUS: "-">
+| <QMARK: "?">
+| <DOLLAR: "$">
+| <SEMICOLON: ";">
+| <COLON: ":">
+| <CONCAT_OP: "||">
+}
+
+
+//----------------------------------------------------
+//----------------------------------------------------
+
+String stringVal() :
+{
+ Token t = null;
+}
+{
+ (t = <STRINGVAL>)
+ {
+ return normalizeStringLiteral(t.image);
+ }
+}
+
+String id() :
+{
+ Token t = null;
+}
+{
+ (t = <ID>)
+ {
+ return normalizeId(t.image);
+ }
+}
+
+
+void getMetadata(MetadataFactory factory) throws TranslatorException :
+{
+}
+{
+ ddlStmts(factory) (<SEMICOLON> ddlStmts(factory))*
+}
+
+void ddlStmts(MetadataFactory factory) throws TranslatorException :
+{
+}
+{
+ (LOOKAHEAD(3) createTable(factory) |
+ LOOKAHEAD(4) createFunction (factory) |
+ LOOKAHEAD(3) createProcedure(factory) |
+ LOOKAHEAD(4) createTrigger(factory)
+ )
+}
+
+void createFunction(MetadataFactory factory) throws TranslatorException :
+{
+ boolean pushdown = false;
+ String dataTypeString = null;
+ FunctionMethod func = null;
+ List<FunctionParameter> ins = new ArrayList<FunctionParameter>();
+ FunctionParameter in = null;
+ String funcName = null;
+}
+{
+ <CREATE> [<PUSHDOWN> {pushdown = true;}] <FUNCTION>
+ funcName = id()
+ {
+ func = factory.addFunction(funcName);
+ }
+ <LPAREN>
+ [in = readFunctionParameter()]
+ {
+ if (in != null){
+ ins.add(in);
+ }
+ }
+ (<COMMA>
+ (in = readFunctionParameter())
+ {
+ ins.add(in);
+ }
+ )*
+ <RPAREN>
+ <RETURNS> dataTypeString = dataTypeString()
+ [<OPTIONS> <LPAREN>
+ readFunctionOption(func)
+ (<COMMA>
+ readFunctionOption(func)
+ )*
+ <RPAREN>
+ ]
+ {
+ if (pushdown){
+ func.setPushdown(FunctionMethod.PushDown.MUST_PUSHDOWN);
+ }
+ func.setOutputParameter(new FunctionParameter(FunctionParameter.OUTPUT_PARAMETER_NAME, dataTypeString));
+ func.setInputParameters(ins);
+ }
+}
+
+Procedure createProcedure(MetadataFactory factory) throws TranslatorException :
+{
+ boolean virtual = false;
+ Procedure proc = null;
+ String procName = null;
+}
+{
+ <CREATE> [<VIRTUAL> {virtual = true;}] <PROCEDURE>
+ procName = id()
+ {
+ proc = factory.addProcedure(procName);
+ }
+
+ <LPAREN>
+ [readProcedureParameter(factory, proc)]
+ (<COMMA> readProcedureParameter(factory, proc))*
+ <RPAREN>
+
+ <RETURNS> readProcedureReturn(factory, proc)
+
+ [<OPTIONS> <LPAREN>
+ readProcedureOption(proc)
+ (<COMMA>
+ readProcedureOption(proc)
+ )*
+ <RPAREN>
+ ]
+ <AS>
+ {
+ proc.setVirtual(virtual);
+ proc.setFunction(false);
+ return proc;
+ }
+}
+
+void readProcedureParameter(MetadataFactory factory, Procedure proc) throws TranslatorException :
+{
+ String name = null;
+ String type = null;
+ Token direction = null;
+}
+{
+ [((direction = <IN>)|(direction=<OUT>)|(direction=<INOUT>))]
+ name = id()
+ type = dataTypeString()
+ {
+ ProcedureParameter.Type ppType = ProcedureParameter.Type.In;
+
+ if (direction == null){
+ ppType = ProcedureParameter.Type.In;
+ }
+ else if (direction.image.equalsIgnoreCase("in")){
+ ppType = ProcedureParameter.Type.In ;
+ }
+ else if (direction.image.equalsIgnoreCase("out")){
+ ppType = ProcedureParameter.Type.Out;
+ }
+ else if (direction.image.equalsIgnoreCase("inout")){
+ ppType = ProcedureParameter.Type.InOut;
+ }
+ else {
+ throw new ParseException("Unknown type of parameter on procedure "+ proc.getName());
+ }
+ factory.addProcedureParameter(name, type, ppType, proc);
+ }
+}
+
+void readProcedureReturn(MetadataFactory factory, Procedure proc) throws TranslatorException :
+{
+ String name = null;
+ String type = null;
+}
+{
+ <LPAREN>
+ name = id()
+ type = dataTypeString()
+ {
+ factory.addProcedureResultSetColumn(name, type, proc);
+ }
+ (<COMMA>
+ name = id()
+ type = dataTypeString()
+ {
+ factory.addProcedureResultSetColumn(name, type, proc);
+ }
+ )*
+ <RPAREN>
+}
+
+void createTrigger(MetadataFactory factory) throws TranslatorException:
+{
+}
+{
+ <CREATE> <TRIGGER>
+}
+
+void createTable(MetadataFactory factory) throws TranslatorException :
+{
+ Table table = null;
+ String tableName = null;
+ boolean view = false;
+ String queryPlan = null;
+}
+{
+ <CREATE> (<FOREIGN> <TABLE> | <VIEW> {view = true;})
+ tableName = id()
+ <LPAREN>
+ {
+ table = factory.addTable(tableName);
+ table.setVirtual(view);
+ }
+ createColumn(factory, table)
+ (LOOKAHEAD(2) <COMMA>
+ createColumn(factory, table)
+ )*
+ [LOOKAHEAD(2) <COMMA> (readPrimaryKeys(table) | readConstraints(table) | readForeignKeys(factory, table))
+ (<COMMA>
+ (readConstraints(table)|readForeignKeys(factory, table))
+ )*
+ ]
+ <RPAREN>
+ [<OPTIONS> <LPAREN>
+ readTableOption(table)
+ (<COMMA>
+ readTableOption(table)
+ )*
+ <RPAREN>
+ ]
+ [<AS> queryPlan = id()]
+ {
+ if (view && queryPlan == null){
+ throw new ParseException("View definition must have query plan defined");
+ }
+
+ if (view){
+ table.setSelectTransformation(queryPlan);
+ }
+ }
+}
+
+void readForeignKeys(MetadataFactory factory, Table table) :
+{
+ ForeignKey fk = null;
+ Column column = null;
+ String viewName = null;
+ Table reference = null;
+ KeyRecord pk = null;
+}
+{
+ <FOREIGN> nonReserved("KEY")
+ {
+ fk = new ForeignKey();
+ for (String col: getColumnNames()) {
+ column = getColumn(col, table);
+ if (column == null) {
+ throw new ParseException("Column name "+ col + " not found in table "+ table.getName());
+ }
+ fk.addColumn(column);
+ }
+ }
+ <REFERENCES>
+ viewName = id()
+ {
+ pk = new KeyRecord(KeyRecord.Type.Primary);
+ reference = getTable(viewName, factory.getMetadataStore());
+ for (String col: getColumnNames()) {
+ column = getColumn(col, reference);
+ if (column == null) {
+ throw new ParseException("Column name "+ col + " not found in table "+ reference.getName() +" that is being referenced in foreign key on "+ table.getName());
+ }
+ pk.addColumn(column);
+ }
+ fk.setPrimaryKey(pk);
+ table.getForeignKeys().add(fk);
+ }
+}
+
+void readPrimaryKeys(Table table) :
+{
+ KeyRecord keyrecord = null;
+ Column column = null;
+}
+{
+ <PRIMARY> nonReserved("KEY")
+ {
+ keyrecord = new KeyRecord(KeyRecord.Type.Primary);
+ for (String col: getColumnNames()) {
+ column = getColumn(col, table);
+ if (column == null) {
+ throw new ParseException("Column name "+ col + " not found in table "+ table.getName());
+ }
+ keyrecord.addColumn(column);
+ }
+ if (table.getPrimaryKey() == null)
+ table.setPrimaryKey(keyrecord);
+ else
+ throw new ParseException("Primary Key is already defined on "+ table.getName());
+ }
+}
+
+void readConstraints(Table table) :
+{
+ KeyRecord keyrecord = null;
+ Column column = null;
+ boolean index = false;
+ boolean unique = false;
+ boolean ap = false;
+ Token type = null;
+}
+{
+ (<INDEX> { index = true; } |<UNIQUE> { unique = true; } | <ACCESS_PATTERN> { ap = true; } )
+ {
+ if (index) { keyrecord = new KeyRecord(KeyRecord.Type.Index); }
+ if (unique) { keyrecord = new KeyRecord(KeyRecord.Type.Unique); }
+ if (ap) { keyrecord = new KeyRecord(KeyRecord.Type.AccessPattern); }
+
+ for (String col: getColumnNames()) {
+ column = getColumn(col, table);
+ if (column == null) {
+ throw new ParseException("Column name "+ col + " not found in table "+ table.getName());
+ }
+ keyrecord.addColumn(column);
+ }
+
+ if (index) { table.getIndexes().add(keyrecord); }
+ if (unique) { table.getUniqueKeys().add(keyrecord); }
+ if (ap) { table.getAccessPatterns().add(keyrecord); }
+ }
+}
+
+ArrayList<String> getColumnNames() :
+{
+ ArrayList list = new ArrayList<String>();
+ String id = null;
+}
+{
+ <LPAREN>
+ id = id()
+ {
+ list.add(id);
+ }
+ (<COMMA> id = id()
+ {
+ list.add(id);
+ }
+ )*
+ <RPAREN>
+ {
+ return list;
+ }
+}
+
+void createColumn(MetadataFactory factory, Table table) throws TranslatorException :
+{
+ String element = null;
+ String type = null;
+ boolean autoIncrement = false;
+ boolean notNull = false;
+ String defalt = null;
+ KeyRecord unique = null;
+ KeyRecord index = null;
+ KeyRecord pk = null;
+ Column column = null;
+}
+{
+ element = id()
+ (
+ type = dataTypeString()
+ {
+ column = factory.addColumn(validateElementName(element), type, table);
+ }
+ )
+ [<NOT> <NULL> { notNull = true; }]
+ [<AUTO_INCREMENT> { autoIncrement = true; }]
+ ([(<UNIQUE>
+ {
+ unique = new KeyRecord(KeyRecord.Type.Unique);
+ unique.addColumn(column);
+ table.getUniqueKeys().add(unique);
+ })
+ |(<INDEX>
+ {
+ index = new KeyRecord(KeyRecord.Type.Index);
+ index.addColumn(column);
+ table.getIndexes().add(index);
+ })
+ |(<PRIMARY> nonReserved("KEY")
+ {
+ pk = new KeyRecord(KeyRecord.Type.Primary);
+ pk.addColumn(column);
+ if (table.getPrimaryKey() == null)
+ table.setPrimaryKey(pk);
+ else
+ throw new ParseException("Primary Key is already defined on "+ table.getName());
+ })
+ ])
+ [<DEFAULT_KEYWORD> defalt = stringVal()]
+ [<OPTIONS> <LPAREN>
+ readColumnOption(column)
+ (<COMMA>
+ readColumnOption(column)
+ )*
+ <RPAREN>
+ ]
+ {
+ column.setAutoIncremented(autoIncrement);
+ column.setNullType(notNull?Column.NullType.No_Nulls:Column.NullType.Nullable);
+ if (defalt != null){
+ column.setDefaultValue(defalt);
+ }
+ }
+}
+
+void readColumnOption(Column column) :
+{
+ Token value = null;
+ String key = null;
+}
+{
+ key = id()
+ ((value = <STRINGVAL>)
+ {
+ setColumnOption(column, key, normalizeStringLiteral(value.image));
+ }
+ | (value = <INTEGERVAL>)
+ {
+ setColumnOption(column, key, value.image);
+ }
+ | (value = <DECIMALVAL>)
+ {
+ setColumnOption(column, key, value.image);
+ })
+}
+
+void readFunctionOption(FunctionMethod fm) :
+{
+ Token value = null;
+ String key = null;
+}
+{
+ key = id()
+ ((value = <STRINGVAL>)
+ {
+ setFunctionOption(fm, key, normalizeStringLiteral(value.image));
+ }
+ | (value = <INTEGERVAL>)
+ {
+ setFunctionOption(fm, key, value.image);
+ }
+ | (value = <DECIMALVAL>)
+ {
+ setFunctionOption(fm, key, value.image);
+ })
+}
+
+void readProcedureOption(Procedure proc) :
+{
+ Token value = null;
+ String key = null;
+}
+{
+ key = id()
+ ((value = <STRINGVAL>)
+ {
+ setProcedureOption(proc, key, normalizeStringLiteral(value.image));
+ }
+ | (value = <INTEGERVAL>)
+ {
+ setProcedureOption(proc, key, value.image);
+ }
+ | (value = <DECIMALVAL>)
+ {
+ setProcedureOption(proc, key, value.image);
+ })
+}
+
+void readTableOption(Table table) :
+{
+ Token value = null;
+ String key = null;
+}
+{
+ key = id()
+ ((value = <STRINGVAL>)
+ {
+ setTableOption(table, key, normalizeStringLiteral(value.image));
+ }
+ | (value = <INTEGERVAL>)
+ {
+ setTableOption(table, key, value.image);
+ }
+ | (value = <DECIMALVAL>)
+ {
+ setTableOption(table, key, value.image);
+ })
+}
+
+FunctionParameter readFunctionParameter() :
+{
+ String name = null;
+ String type = null;
+ Token vararg = null;
+}
+{
+ name = id()
+ type = dataTypeString()
+ [vararg = <VARARG>]
+ {
+ return new FunctionParameter(name, type, "", (vararg != null));
+ }
+}
+
+String dataTypeString() :
+{
+ Token typeToken = null;
+}
+{
+ (
+ typeToken = <VARCHAR> |
+ typeToken = <BOOLEAN> |
+ typeToken = <BYTE> |
+ typeToken = <SMALLINT> |
+ typeToken = <CHAR> |
+ typeToken = <INTEGER> |
+ typeToken = <LONG> |
+ typeToken = <FLOAT> |
+ typeToken = <REAL> |
+ typeToken = <DOUBLE> |
+ typeToken = <DECIMAL> |
+ typeToken = <DATE> |
+ typeToken = <TIME> |
+ typeToken = <TIMESTAMP> |
+ typeToken = <OBJECT> |
+ typeToken = <BLOB> |
+ typeToken = <CLOB> |
+ typeToken = <VARBINARY> |
+ typeToken = <XML>
+
+ )
+ {
+ return typeToken.image;
+ }
+}
+
+String nonReserved(String... expected) :
+{
+ Token t = null;
+}
+{
+ t = <ID>
+ {
+ String result = matchesAny(t.image, expected);
+ if (result != null) {
+ return result;
+ }
+ throw new ParseException(DataPlugin.Util.getString("SQLParser.expected_non_reserved", Arrays.toString(expected), t.image));
+ }
+}
Modified: trunk/api/src/main/resources/org/teiid/connector/i18n.properties
===================================================================
--- trunk/api/src/main/resources/org/teiid/connector/i18n.properties 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/api/src/main/resources/org/teiid/connector/i18n.properties 2012-03-08 20:03:01 UTC (rev 3922)
@@ -24,10 +24,12 @@
DelegatingHierarchyVisitor.The_pre-_and_post-processing_visitors_cannot_both_be_null._1=The pre- and post-processing visitors cannot both be null.
+TEIID60012=Duplicate Schema {0}
+TEIID60013=Duplicate Table {0}
+TEIID60014=Duplicate Procedure {0}
+TEIID60015=Duplicate Function {0}
-
-
TEIID60009=Unknown datatype {0}
TEIID60011=No column found with name {0}
TEIID60008=Invalid column name ''{0}'', cannot contain the . character.
Copied: trunk/build/kits/jboss-as7/docs/teiid/datasources/db2/db2-ds.xml (from rev 3915, trunk/build/kits/jboss-as7/docs/teiid/datasources/db2/db2.xml)
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/db2/db2-ds.xml (rev 0)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/db2/db2-ds.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -0,0 +1,17 @@
+<!-- Add the below contents under "datasources" subsystem in the standalone-teiid.xml or deploy as -ds.xml file -->
+<datasources>
+ <datasource jndi-name="java:/db2DS" pool-name="db2DS">
+ <driver-class>com.ibm.db2.jcc.DB2Driver</driver-class>
+ <connection-url>jdbc:db2://{host}:50000/{database_name}</connection-url>
+ <driver>db2jcc4.jar</driver>
+ <pool>
+ <prefill>false</prefill>
+ <use-strict-min>false</use-strict-min>
+ <flush-strategy>FailingConnectionOnly</flush-strategy>
+ </pool>
+ <security>
+ <user-name>{user}</user-name>
+ <password>{password}</password>
+ </security>
+ </datasource>
+</datasources>
Property changes on: trunk/build/kits/jboss-as7/docs/teiid/datasources/db2/db2-ds.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: trunk/build/kits/jboss-as7/docs/teiid/datasources/db2/db2-xa-ds.xml (from rev 3915, trunk/build/kits/jboss-as7/docs/teiid/datasources/db2/db2-xa.xml)
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/db2/db2-xa-ds.xml (rev 0)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/db2/db2-xa-ds.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -0,0 +1,40 @@
+<!-- Add the below contents under "datasources" subsystem in the standalone-teiid.xml or deploy as -ds.xml file -->
+<datasources>
+ <xa-datasource jndi-name="java:/db2DS" pool-name="db2DS" enabled="true" use-java-context="true" use-ccm="true">
+ <xa-datasource-class>com.ibm.db2.jcc.DB2XADataSource</xa-datasource-class>
+ <xa-datasource-property name="PortNumber">50000</xa-datasource-property>
+ <xa-datasource-property name="DatabaseName">{db-name}</xa-datasource-property>
+ <xa-datasource-property name="ServerName">{host}</xa-datasource-property>
+
+ <driver>db2jcc4.jar</driver>
+
+ <!--
+ <new-connection-sql>select 1/new-connection-sql>
+ <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
+ -->
+
+ <xa-pool>
+ <min-pool-size>10</min-pool-size>
+ <max-pool-size>20</max-pool-size>
+ <is-same-rm-override>true</is-same-rm-override>
+ <prefill>false</prefill>
+ <use-strict-min>false</use-strict-min>
+ <flush-strategy>FailingConnectionOnly</flush-strategy>
+ <no-tx-separate-pools/>
+ </xa-pool>
+
+ <security>
+ <user-name>{user}</user-name>
+ <password>{password}</password>
+ <!--
+ <security-domain>mysecurity-realm</security-domain>
+ -->
+ </security>
+
+ <!--
+ <validation>
+ <check-valid-connection-sql>select 1</check-valid-connection-sql>
+ </validation>
+ -->
+ </xa-datasource>
+</datasources>
Property changes on: trunk/build/kits/jboss-as7/docs/teiid/datasources/db2/db2-xa-ds.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted: trunk/build/kits/jboss-as7/docs/teiid/datasources/db2/db2-xa.xml
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/db2/db2-xa.xml 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/db2/db2-xa.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -1,48 +0,0 @@
-<!-- If susbsytem is already defined, only copy the contents under it and edit to suit your needs -->
-<subsystem xmlns="urn:jboss:domain:datasources:1.0">
- <datasources>
- <xa-datasource jndi-name="java:/db2DS" pool-name="db2DS" enabled="true" use-java-context="true" use-ccm="true">
-
- <xa-datasource-property name="PortNumber">50000</xa-datasource-property>
- <xa-datasource-property name="DatabaseName">{db-name}</xa-datasource-property>
- <xa-datasource-property name="ServerName">{host}</xa-datasource-property>
-
- <driver>db2jcc4.jar</driver>
-
- <!--
- <new-connection-sql>select 1/new-connection-sql>
- <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
- -->
-
- <xa-pool>
- <min-pool-size>10</min-pool-size>
- <max-pool-size>20</max-pool-size>
- <is-same-rm-override>true</is-same-rm-override>
- <prefill>false</prefill>
- <use-strict-min>false</use-strict-min>
- <flush-strategy>FailingConnectionOnly</flush-strategy>
- <no-tx-separate-pools/>
- </xa-pool>
-
- <security>
- <user-name>{user}</user-name>
- <password>{password}</password>
- <!--
- <security-domain>mysecurity-realm</security-domain>
- -->
- </security>
-
- <!--
- <validation>
- <check-valid-connection-sql>select 1</check-valid-connection-sql>
- </validation>
- -->
- </xa-datasource>
- <drivers>
- <driver name="db2jcc4.jar" module="com.ibm.db2">
- <driver-class>com.ibm.db2.jcc.DB2Driver</driver-class>
- <xa-datasource-class>com.ibm.db2.jcc.DB2XADataSource</xa-datasource-class>
- </driver>
- </drivers>
- </datasources>
-</subsystem>
\ No newline at end of file
Deleted: trunk/build/kits/jboss-as7/docs/teiid/datasources/db2/db2.xml
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/db2/db2.xml 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/db2/db2.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -1,24 +0,0 @@
-<!-- If susbsytem is already defined, only copy the contents under it and edit to suit your needs -->
-<subsystem xmlns="urn:jboss:domain:datasources:1.0">
- <datasources>
- <datasource jndi-name="java:/db2DS" pool-name="db2DS">
- <connection-url>jdbc:db2://{host}:50000/{database_name}</connection-url>
- <driver>db2jcc4.jar</driver>
- <pool>
- <prefill>false</prefill>
- <use-strict-min>false</use-strict-min>
- <flush-strategy>FailingConnectionOnly</flush-strategy>
- </pool>
- <security>
- <user-name>{user}</user-name>
- <password>{password}</password>
- </security>
- </datasource>
- <drivers>
- <driver name="db2jcc4.jar" module="com.ibm.db2">
- <driver-class>com.ibm.db2.jcc.DB2Driver</driver-class>
- <xa-datasource-class>com.ibm.db2.jcc.DB2XADataSource</xa-datasource-class>
- </driver>
- </drivers>
- </datasources>
-</subsystem>
\ No newline at end of file
Modified: trunk/build/kits/jboss-as7/docs/teiid/datasources/db2/readme.txt
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/db2/readme.txt 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/db2/readme.txt 2012-03-08 20:03:01 UTC (rev 3922)
@@ -13,6 +13,7 @@
3) Then copy the db2 database JDBC driver jar file "db2jcc4.jar" into
"<jboss-as>/modules/com/ibm/db2/main" directory.
+ 4) Add following to standalone[-teiid].xml file under "datasources" subsystem under <drivers> element
4) start server
Step 2: Creating the datasource
Copied: trunk/build/kits/jboss-as7/docs/teiid/datasources/derby/derby-ds.xml (from rev 3915, trunk/build/kits/jboss-as7/docs/teiid/datasources/derby/derby.xml)
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/derby/derby-ds.xml (rev 0)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/derby/derby-ds.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -0,0 +1,19 @@
+<!-- Add the below contents under "datasources" subsystem in the standalone-teiid.xml or deploy as -ds.xml file -->
+<subsystem xmlns="urn:jboss:domain:datasources:1.0">
+ <datasources>
+ <datasource jndi-name="java:/derbyDS" pool-name="derbyDS">
+ <driver-class>org.apache.derby.jdbc.ClientDriver</driver-class>
+ <connection-url>jdbc:derby://{host}:1527/{db-name}</connection-url>
+ <driver>derbyclient.jar</driver>
+ <pool>
+ <prefill>false</prefill>
+ <use-strict-min>false</use-strict-min>
+ <flush-strategy>FailingConnectionOnly</flush-strategy>
+ </pool>
+ <security>
+ <user-name>{user}</user-name>
+ <password>{password}</password>
+ </security>
+ </datasource>
+ </datasources>
+</subsystem>
\ No newline at end of file
Property changes on: trunk/build/kits/jboss-as7/docs/teiid/datasources/derby/derby-ds.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/build/kits/jboss-as7/docs/teiid/datasources/derby/derby-xa.xml
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/derby/derby-xa.xml 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/derby/derby-xa.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -1,4 +1,4 @@
-<!-- If susbsytem is already defined, only copy the contents under it and edit to suit your needs -->
+<!-- Add the below contents under "datasources" subsystem in the standalone-teiid.xml or deploy as -ds.xml file -->
<subsystem xmlns="urn:jboss:domain:datasources:1.0">
<datasources>
<xa-datasource jndi-name="java:/derbyDS" pool-name="derbyDS" enabled="true" use-java-context="true" use-ccm="true">
Deleted: trunk/build/kits/jboss-as7/docs/teiid/datasources/derby/derby.xml
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/derby/derby.xml 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/derby/derby.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -1,24 +0,0 @@
-<!-- If susbsytem is already defined, only copy the contents under it and edit to suit your needs -->
-<subsystem xmlns="urn:jboss:domain:datasources:1.0">
- <datasources>
- <datasource jndi-name="java:/derbyDS" pool-name="derbyDS">
- <connection-url>jdbc:derby://{host}:1527/{db-name}</connection-url>
- <driver>derbyclient.jar</driver>
- <pool>
- <prefill>false</prefill>
- <use-strict-min>false</use-strict-min>
- <flush-strategy>FailingConnectionOnly</flush-strategy>
- </pool>
- <security>
- <user-name>{user}</user-name>
- <password>{password}</password>
- </security>
- </datasource>
- <drivers>
- <driver name="derbyclient.jar" module="org.apache.derby">
- <driver-class>org.apache.derby.jdbc.ClientDriver</driver-class>
- <xa-datasource-class>org.apache.derby.jdbc.ClientXADataSource</xa-datasource-class>
- </driver>
- </drivers>
- </datasources>
-</subsystem>
\ No newline at end of file
Modified: trunk/build/kits/jboss-as7/docs/teiid/datasources/h2/h2.xml
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/h2/h2.xml 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/h2/h2.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -1,4 +1,4 @@
-<!-- If susbsytem is already defined, only copy the contents under it and edit to suit your needs -->
+<!-- Add the below contents under "datasources" subsystem in the standalone-teiid.xml or deploy as -ds.xml file -->
<subsystem xmlns="urn:jboss:domain:datasources:1.0">
<datasources>
<datasource jndi-name="java:jboss/datasources/ExampleDS" enabled="true" use-java-context="true" pool-name="H2DS">
Copied: trunk/build/kits/jboss-as7/docs/teiid/datasources/ingres/ingres-ds.xml (from rev 3915, trunk/build/kits/jboss-as7/docs/teiid/datasources/ingres/ingres.xml)
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/ingres/ingres-ds.xml (rev 0)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/ingres/ingres-ds.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -0,0 +1,23 @@
+<!-- Add the below contents under "datasources" subsystem in the standalone-teiid.xml or deploy as -ds.xml file -->
+<datasources>
+ <datasource jndi-name="java:/ingresDS" pool-name="ingresDS">
+ <driver-class>com.ingres.jdbc.IngresDriver</driver-class>
+ <connection-url>jdbc:ingres://{host}:{port:21071}/{database_name}</connection-url>
+ <driver>iijdbc.jar</driver>
+ <pool>
+ <prefill>false</prefill>
+ <use-strict-min>false</use-strict-min>
+ <flush-strategy>FailingConnectionOnly</flush-strategy>
+ </pool>
+ <security>
+ <user-name>{user}</user-name>
+ <password>{password}</password>
+ </security>
+ </datasource>
+ <drivers>
+ <driver name="iijdbc.jar" module="com.ingres">
+
+ <xa-datasource-class>com.ingres.jdbc.IngresXADataSource</xa-datasource-class>
+ </driver>
+ </drivers>
+</datasources>
Property changes on: trunk/build/kits/jboss-as7/docs/teiid/datasources/ingres/ingres-ds.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: trunk/build/kits/jboss-as7/docs/teiid/datasources/ingres/ingres-xa-ds.xml (from rev 3915, trunk/build/kits/jboss-as7/docs/teiid/datasources/ingres/ingres-xa.xml)
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/ingres/ingres-xa-ds.xml (rev 0)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/ingres/ingres-xa-ds.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -0,0 +1,42 @@
+<!-- Add the below contents under "datasources" subsystem in the standalone-teiid.xml or deploy as -ds.xml file -->
+<datasources>
+ <xa-datasource jndi-name="java:/ingresDS" pool-name="ingresDS" enabled="true" use-java-context="true" use-ccm="true">
+ <xa-datasource-class>com.ingres.jdbc.IngresXADataSource</xa-datasource-class>
+ <xa-datasource-property name="DatabaseName">{database}</xa-datasource-property>
+ <xa-datasource-property name="PortNumber">21071</xa-datasource-property>
+ <xa-datasource-property name="ServerName">{host}</xa-datasource-property>
+ <xa-datasource-property name="timeZone">GMT</xa-datasource-property>
+
+
+ <driver>iijdbc.jar</driver>
+
+ <!--
+ <new-connection-sql>select 1/new-connection-sql>
+ <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
+ -->
+
+ <xa-pool>
+ <min-pool-size>10</min-pool-size>
+ <max-pool-size>20</max-pool-size>
+ <is-same-rm-override>true</is-same-rm-override>
+ <prefill>false</prefill>
+ <use-strict-min>false</use-strict-min>
+ <flush-strategy>FailingConnectionOnly</flush-strategy>
+ <no-tx-separate-pools/>
+ </xa-pool>
+
+ <security>
+ <user-name>{user}</user-name>
+ <password>{password}</password>
+ <!--
+ <security-domain>mysecurity-realm</security-domain>
+ -->
+ </security>
+
+ <!--
+ <validation>
+ <check-valid-connection-sql>select 1</check-valid-connection-sql>
+ </validation>
+ -->
+ </xa-datasource>
+</datasources>
Property changes on: trunk/build/kits/jboss-as7/docs/teiid/datasources/ingres/ingres-xa-ds.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted: trunk/build/kits/jboss-as7/docs/teiid/datasources/ingres/ingres-xa.xml
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/ingres/ingres-xa.xml 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/ingres/ingres-xa.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -1,50 +0,0 @@
-<!-- If susbsytem is already defined, only copy the contents under it and edit to suit your needs -->
-<subsystem xmlns="urn:jboss:domain:datasources:1.0">
- <datasources>
- <xa-datasource jndi-name="java:/ingresDS" pool-name="ingresDS" enabled="true" use-java-context="true" use-ccm="true">
-
- <xa-datasource-property name="DatabaseName">{database}</xa-datasource-property>
- <xa-datasource-property name="PortNumber">21071</xa-datasource-property>
- <xa-datasource-property name="ServerName">{host}</xa-datasource-property>
- <xa-datasource-property name="timeZone">GMT</xa-datasource-property>
-
-
- <driver>iijdbc.jar</driver>
-
- <!--
- <new-connection-sql>select 1/new-connection-sql>
- <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
- -->
-
- <xa-pool>
- <min-pool-size>10</min-pool-size>
- <max-pool-size>20</max-pool-size>
- <is-same-rm-override>true</is-same-rm-override>
- <prefill>false</prefill>
- <use-strict-min>false</use-strict-min>
- <flush-strategy>FailingConnectionOnly</flush-strategy>
- <no-tx-separate-pools/>
- </xa-pool>
-
- <security>
- <user-name>{user}</user-name>
- <password>{password}</password>
- <!--
- <security-domain>mysecurity-realm</security-domain>
- -->
- </security>
-
- <!--
- <validation>
- <check-valid-connection-sql>select 1</check-valid-connection-sql>
- </validation>
- -->
- </xa-datasource>
- <drivers>
- <driver name="iijdbc.jar" module="com.ingres">
- <driver-class>com.ingres.jdbc.IngresDriver</driver-class>
- <xa-datasource-class>com.ingres.jdbc.IngresXADataSource</xa-datasource-class>
- </driver>
- </drivers>
- </datasources>
-</subsystem>
\ No newline at end of file
Deleted: trunk/build/kits/jboss-as7/docs/teiid/datasources/ingres/ingres.xml
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/ingres/ingres.xml 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/ingres/ingres.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -1,24 +0,0 @@
-<!-- If susbsytem is already defined, only copy the contents under it and edit to suit your needs -->
-<subsystem xmlns="urn:jboss:domain:datasources:1.0">
- <datasources>
- <datasource jndi-name="java:/ingresDS" pool-name="ingresDS">
- <connection-url>jdbc:ingres://{host}:{port:21071}/{database_name}</connection-url>
- <driver>iijdbc.jar</driver>
- <pool>
- <prefill>false</prefill>
- <use-strict-min>false</use-strict-min>
- <flush-strategy>FailingConnectionOnly</flush-strategy>
- </pool>
- <security>
- <user-name>{user}</user-name>
- <password>{password}</password>
- </security>
- </datasource>
- <drivers>
- <driver name="iijdbc.jar" module="com.ingres">
- <driver-class>com.ingres.jdbc.IngresDriver</driver-class>
- <xa-datasource-class>com.ingres.jdbc.IngresXADataSource</xa-datasource-class>
- </driver>
- </drivers>
- </datasources>
-</subsystem>
\ No newline at end of file
Copied: trunk/build/kits/jboss-as7/docs/teiid/datasources/intersystems-cache/intersystems-cache-ds.xml (from rev 3915, trunk/build/kits/jboss-as7/docs/teiid/datasources/intersystems-cache/intersystems-cache.xml)
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/intersystems-cache/intersystems-cache-ds.xml (rev 0)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/intersystems-cache/intersystems-cache-ds.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -0,0 +1,17 @@
+<!-- Add the below contents under "datasources" subsystem in the standalone-teiid.xml or deploy as -ds.xml file -->
+<datasources>
+ <datasource jndi-name="java:/cacheDS" pool-name="cacheDS">
+ <driver-class>com.intersys.jdbc.CacheDriver</driver-class>
+ <connection-url>jdbc:Cache://{host}:1972/{database}</connection-url>
+ <driver>CacheDB.jar</driver>
+ <pool>
+ <prefill>false</prefill>
+ <use-strict-min>false</use-strict-min>
+ <flush-strategy>FailingConnectionOnly</flush-strategy>
+ </pool>
+ <security>
+ <user-name>{user}</user-name>
+ <password>{password}</password>
+ </security>
+ </datasource>
+</datasources>
Property changes on: trunk/build/kits/jboss-as7/docs/teiid/datasources/intersystems-cache/intersystems-cache-ds.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted: trunk/build/kits/jboss-as7/docs/teiid/datasources/intersystems-cache/intersystems-cache.xml
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/intersystems-cache/intersystems-cache.xml 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/intersystems-cache/intersystems-cache.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -1,23 +0,0 @@
-<!-- If susbsytem is already defined, only copy the contents under it and edit to suit your needs -->
-<subsystem xmlns="urn:jboss:domain:datasources:1.0">
- <datasources>
- <datasource jndi-name="java:/cacheDS" pool-name="cacheDS">
- <connection-url>jdbc:Cache://{host}:1972/{database}</connection-url>
- <driver>CacheDB.jar</driver>
- <pool>
- <prefill>false</prefill>
- <use-strict-min>false</use-strict-min>
- <flush-strategy>FailingConnectionOnly</flush-strategy>
- </pool>
- <security>
- <user-name>{user}</user-name>
- <password>{password}</password>
- </security>
- </datasource>
- <drivers>
- <driver name="CacheDB.jar" module="com.intersys">
- <driver-class>com.intersys.jdbc.CacheDriver</driver-class>
- </driver>
- </drivers>
- </datasources>
-</subsystem>
\ No newline at end of file
Copied: trunk/build/kits/jboss-as7/docs/teiid/datasources/mysql/mysql-ds.xml (from rev 3915, trunk/build/kits/jboss-as7/docs/teiid/datasources/mysql/mysql.xml)
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/mysql/mysql-ds.xml (rev 0)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/mysql/mysql-ds.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -0,0 +1,17 @@
+<!-- Add the below contents under "datasources" subsystem in the standalone-teiid.xml or deploy as -ds.xml file -->
+<datasources>
+ <datasource jndi-name="java:/mysql-ds" pool-name="mysqlDS">
+ <driver-class>com.mysql.jdbc.Driver</driver-class>
+ <connection-url>jdbc:mysql://{host}:3306/{database}</connection-url>
+ <driver>mysql-connector-java-5.1.5.jar</driver>
+ <pool>
+ <prefill>false</prefill>
+ <use-strict-min>false</use-strict-min>
+ <flush-strategy>FailingConnectionOnly</flush-strategy>
+ </pool>
+ <security>
+ <user-name>{user}</user-name>
+ <password>{password}</password>
+ </security>
+ </datasource>
+</datasources>
Property changes on: trunk/build/kits/jboss-as7/docs/teiid/datasources/mysql/mysql-ds.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: trunk/build/kits/jboss-as7/docs/teiid/datasources/mysql/mysql-xa-ds.xml (from rev 3915, trunk/build/kits/jboss-as7/docs/teiid/datasources/mysql/mysql-xa.xml)
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/mysql/mysql-xa-ds.xml (rev 0)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/mysql/mysql-xa-ds.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -0,0 +1,40 @@
+<!-- Add the below contents under "datasources" subsystem in the standalone-teiid.xml or deploy as -ds.xml file -->
+<datasources>
+ <xa-datasource jndi-name="java:/mysqlDS" pool-name="mySQlDS" enabled="true" use-java-context="true" use-ccm="true">
+
+ <xa-datasource-property name="PortNumber">3306</xa-datasource-property>
+ <xa-datasource-property name="DatabaseName">{db-name}</xa-datasource-property>
+ <xa-datasource-property name="ServerName">{host}</xa-datasource-property>
+
+ <driver>mysql-connector-java-5.1.5.jar</driver>
+
+ <!--
+ <new-connection-sql>select 1/new-connection-sql>
+ <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
+ -->
+
+ <xa-pool>
+ <min-pool-size>10</min-pool-size>
+ <max-pool-size>20</max-pool-size>
+ <is-same-rm-override>true</is-same-rm-override>
+ <prefill>false</prefill>
+ <use-strict-min>false</use-strict-min>
+ <flush-strategy>FailingConnectionOnly</flush-strategy>
+ <no-tx-separate-pools/>
+ </xa-pool>
+
+ <security>
+ <user-name>{user}</user-name>
+ <password>{password}</password>
+ <!--
+ <security-domain>mysecurity-realm</security-domain>
+ -->
+ </security>
+
+ <!--
+ <validation>
+ <check-valid-connection-sql>select 1</check-valid-connection-sql>
+ </validation>
+ -->
+ </xa-datasource>
+</datasources>
Property changes on: trunk/build/kits/jboss-as7/docs/teiid/datasources/mysql/mysql-xa-ds.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted: trunk/build/kits/jboss-as7/docs/teiid/datasources/mysql/mysql-xa.xml
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/mysql/mysql-xa.xml 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/mysql/mysql-xa.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -1,48 +0,0 @@
-<!-- If susbsytem is already defined, only copy the contents under it and edit to suit your needs -->
-<subsystem xmlns="urn:jboss:domain:datasources:1.0">
- <datasources>
- <xa-datasource jndi-name="java:/mysqlDS" pool-name="mySQlDS" enabled="true" use-java-context="true" use-ccm="true">
-
- <xa-datasource-property name="PortNumber">3306</xa-datasource-property>
- <xa-datasource-property name="DatabaseName">{db-name}</xa-datasource-property>
- <xa-datasource-property name="ServerName">{host}</xa-datasource-property>
-
- <driver>mysql-connector-java-5.1.5.jar</driver>
-
- <!--
- <new-connection-sql>select 1/new-connection-sql>
- <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
- -->
-
- <xa-pool>
- <min-pool-size>10</min-pool-size>
- <max-pool-size>20</max-pool-size>
- <is-same-rm-override>true</is-same-rm-override>
- <prefill>false</prefill>
- <use-strict-min>false</use-strict-min>
- <flush-strategy>FailingConnectionOnly</flush-strategy>
- <no-tx-separate-pools/>
- </xa-pool>
-
- <security>
- <user-name>{user}</user-name>
- <password>{password}</password>
- <!--
- <security-domain>mysecurity-realm</security-domain>
- -->
- </security>
-
- <!--
- <validation>
- <check-valid-connection-sql>select 1</check-valid-connection-sql>
- </validation>
- -->
- </xa-datasource>
- <drivers>
- <driver name="mysql-connector-java-5.1.5.jar" module="com.mysql">
- <driver-class>com.mysql.jdbc.Driver</driver-class>
- <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
- </driver>
- </drivers>
- </datasources>
-</subsystem>
\ No newline at end of file
Deleted: trunk/build/kits/jboss-as7/docs/teiid/datasources/mysql/mysql.xml
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/mysql/mysql.xml 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/mysql/mysql.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -1,24 +0,0 @@
-<!-- If susbsytem is already defined, only copy the contents under it and edit to suit your needs -->
-<subsystem xmlns="urn:jboss:domain:datasources:1.0">
- <datasources>
- <datasource jndi-name="java:/mysql-ds" pool-name="mysqlDS">
- <connection-url>jdbc:mysql://{host}:3306/{database}</connection-url>
- <driver>mysql-connector-java-5.1.5.jar</driver>
- <pool>
- <prefill>false</prefill>
- <use-strict-min>false</use-strict-min>
- <flush-strategy>FailingConnectionOnly</flush-strategy>
- </pool>
- <security>
- <user-name>{user}</user-name>
- <password>{password}</password>
- </security>
- </datasource>
- <drivers>
- <driver name="mysql-connector-java-5.1.5.jar" module="com.mysql">
- <driver-class>com.mysql.jdbc.Driver</driver-class>
- <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
- </driver>
- </drivers>
- </datasources>
-</subsystem>
\ No newline at end of file
Copied: trunk/build/kits/jboss-as7/docs/teiid/datasources/odbc/odbc-ds.xml (from rev 3915, trunk/build/kits/jboss-as7/docs/teiid/datasources/odbc/odbc.xml)
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/odbc/odbc-ds.xml (rev 0)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/odbc/odbc-ds.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -0,0 +1,23 @@
+<!-- Add the below contents under "datasources" subsystem in the standalone-teiid.xml or deploy as -ds.xml file -->
+<datasources>
+ <datasource jndi-name="java:/odbcDS" pool-name="odbcDS">
+ <!-- Create a DSN using ODBC driver manager, and replace {DSN} below with your DSN name -->
+ <connection-url>jdbc:odbc:{DSN}</connection-url>
+
+ <!-- For DSN less connection URL use the below form to connect to a Excel Sheet
+ <connection-url>jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};Dbq=c:\ODBC\ExcelData.xls</connection-url>
+ -->
+ <driver-class>sun.jdbc.odbc.JdbcOdbcDriver</driver-class>
+ <transaction-isolation>TRANSACTION_NONE</transaction-isolation>
+
+ <pool>
+ <prefill>false</prefill>
+ <use-strict-min>false</use-strict-min>
+ <flush-strategy>FailingConnectionOnly</flush-strategy>
+ </pool>
+ <security>
+ <user-name>{user}</user-name>
+ <password>{password}</password>
+ </security>
+ </datasource>
+</datasources>
Property changes on: trunk/build/kits/jboss-as7/docs/teiid/datasources/odbc/odbc-ds.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted: trunk/build/kits/jboss-as7/docs/teiid/datasources/odbc/odbc.xml
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/odbc/odbc.xml 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/odbc/odbc.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -1,25 +0,0 @@
-<!-- If susbsytem is already defined, only copy the contents under it and edit to suit your needs -->
-<subsystem xmlns="urn:jboss:domain:datasources:1.0">
- <datasources>
- <datasource jndi-name="java:/odbcDS" pool-name="odbcDS">
- <!-- Create a DSN using ODBC driver manager, and replace {DSN} below with your DSN name -->
- <connection-url>jdbc:odbc:{DSN}</connection-url>
-
- <!-- For DSN less connection URL use the below form to connect to a Excel Sheet
- <connection-url>jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};Dbq=c:\ODBC\ExcelData.xls</connection-url>
- -->
- <driver-class>sun.jdbc.odbc.JdbcOdbcDriver</driver-class>
- <transaction-isolation>TRANSACTION_NONE</transaction-isolation>
-
- <pool>
- <prefill>false</prefill>
- <use-strict-min>false</use-strict-min>
- <flush-strategy>FailingConnectionOnly</flush-strategy>
- </pool>
- <security>
- <user-name>{user}</user-name>
- <password>{password}</password>
- </security>
- </datasource>
- </datasources>
-</subsystem>
\ No newline at end of file
Copied: trunk/build/kits/jboss-as7/docs/teiid/datasources/oracle/oracle-ds.xml (from rev 3915, trunk/build/kits/jboss-as7/docs/teiid/datasources/oracle/oracle.xml)
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/oracle/oracle-ds.xml (rev 0)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/oracle/oracle-ds.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -0,0 +1,16 @@
+<!-- Add the below contents under "datasources" subsystem in the standalone-teiid.xml or deploy as -ds.xml file -->
+<datasources>
+ <datasource jndi-name="java:/OracleDS" pool-name="OracleDS" enabled="true" jta="true" use-java-context="true" use-ccm="true">
+ <connection-url>jdbc:oracle:thin:{host}:1521:orcl</connection-url>
+ <driver>ojdbc6.jar</driver>
+ <pool>
+ <prefill>false</prefill>
+ <use-strict-min>false</use-strict-min>
+ <flush-strategy>FailingConnectionOnly</flush-strategy>
+ </pool>
+ <security>
+ <user-name>{user}</user-name>
+ <password>{password}</password>
+ </security>
+ </datasource>
+</datasources>
Property changes on: trunk/build/kits/jboss-as7/docs/teiid/datasources/oracle/oracle-ds.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: trunk/build/kits/jboss-as7/docs/teiid/datasources/oracle/oracle-xa-ds.xml (from rev 3915, trunk/build/kits/jboss-as7/docs/teiid/datasources/oracle/oracle-xa.xml)
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/oracle/oracle-xa-ds.xml (rev 0)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/oracle/oracle-xa-ds.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -0,0 +1,37 @@
+<!-- Add the below contents under "datasources" subsystem in the standalone-teiid.xml or deploy as -ds.xml file -->
+<datasources>
+ <xa-datasource jndi-name="java:/OracleDS" pool-name="OracleDS" enabled="true" use-java-context="true" use-ccm="true">
+ <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
+ <xa-datasource-property name="URL">jdbc:oracle:thin:{host}:1521:orcl</xa-datasource-property>
+ <driver>ojdbc6.jar</driver>
+
+ <!--
+ <new-connection-sql>select * from dual</new-connection-sql>
+ <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
+ -->
+
+ <xa-pool>
+ <min-pool-size>10</min-pool-size>
+ <max-pool-size>20</max-pool-size>
+ <is-same-rm-override>true</is-same-rm-override>
+ <prefill>false</prefill>
+ <use-strict-min>false</use-strict-min>
+ <flush-strategy>FailingConnectionOnly</flush-strategy>
+ <no-tx-separate-pools/>
+ </xa-pool>
+
+ <security>
+ <user-name>{user}</user-name>
+ <password>{password}</password>
+ <!--
+ <security-domain>mysecurity-realm</security-domain>
+ -->
+ </security>
+
+ <!--
+ <validation>
+ <check-valid-connection-sql>select * from dual</check-valid-connection-sql>
+ </validation>
+ -->
+ </xa-datasource>
+</datasources>
Property changes on: trunk/build/kits/jboss-as7/docs/teiid/datasources/oracle/oracle-xa-ds.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted: trunk/build/kits/jboss-as7/docs/teiid/datasources/oracle/oracle-xa.xml
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/oracle/oracle-xa.xml 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/oracle/oracle-xa.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -1,44 +0,0 @@
-<!-- If susbsytem is already defined, only copy the contents under it and edit to suit your needs -->
-<subsystem xmlns="urn:jboss:domain:datasources:1.0">
- <datasources>
- <xa-datasource jndi-name="java:/OracleDS" pool-name="OracleDS" enabled="true" use-java-context="true" use-ccm="true">
-
- <xa-datasource-property name="URL">jdbc:oracle:thin:{host}:1521:orcl</xa-datasource-property>
- <driver>ojdbc6.jar</driver>
-
- <!--
- <new-connection-sql>select * from dual</new-connection-sql>
- <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
- -->
-
- <xa-pool>
- <min-pool-size>10</min-pool-size>
- <max-pool-size>20</max-pool-size>
- <is-same-rm-override>true</is-same-rm-override>
- <prefill>false</prefill>
- <use-strict-min>false</use-strict-min>
- <flush-strategy>FailingConnectionOnly</flush-strategy>
- <no-tx-separate-pools/>
- </xa-pool>
-
- <security>
- <user-name>{user}</user-name>
- <password>{password}</password>
- <!--
- <security-domain>mysecurity-realm</security-domain>
- -->
- </security>
-
- <!--
- <validation>
- <check-valid-connection-sql>select * from dual</check-valid-connection-sql>
- </validation>
- -->
- </xa-datasource>
- <drivers>
- <driver name="ojdbc6.jar" module="com.oracle">
- <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
- </driver>
- </drivers>
- </datasources>
-</subsystem>
\ No newline at end of file
Deleted: trunk/build/kits/jboss-as7/docs/teiid/datasources/oracle/oracle.xml
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/oracle/oracle.xml 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/oracle/oracle.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -1,23 +0,0 @@
-<!-- If susbsytem is already defined, only copy the contents under it and edit to suit your needs -->
-<subsystem xmlns="urn:jboss:domain:datasources:1.0">
- <datasources>
- <datasource jndi-name="java:/OracleDS" pool-name="OracleDS" enabled="true" jta="true" use-java-context="true" use-ccm="true">
- <connection-url>jdbc:oracle:thin:{host}:1521:orcl</connection-url>
- <driver>ojdbc6.jar</driver>
- <pool>
- <prefill>false</prefill>
- <use-strict-min>false</use-strict-min>
- <flush-strategy>FailingConnectionOnly</flush-strategy>
- </pool>
- <security>
- <user-name>{user}</user-name>
- <password>{password}</password>
- </security>
- </datasource>
- <drivers>
- <driver name="ojdbc6.jar" module="com.oracle">
- <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
- </driver>
- </drivers>
- </datasources>
-</subsystem>
Copied: trunk/build/kits/jboss-as7/docs/teiid/datasources/postgresql/postgresql-ds.xml (from rev 3915, trunk/build/kits/jboss-as7/docs/teiid/datasources/postgresql/postgresql.xml)
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/postgresql/postgresql-ds.xml (rev 0)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/postgresql/postgresql-ds.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -0,0 +1,16 @@
+<!-- Add the below contents under "datasources" subsystem in the standalone-teiid.xml or deploy as -ds.xml file -->
+<datasources>
+ <datasource jndi-name="java:/postgres-ds" pool-name="PostgreDS">
+ <connection-url>jdbc:postgresql://{host}:5432/{database}</connection-url>
+ <driver>postgresql-8.3-603.jdbc3.jar</driver>
+ <pool>
+ <prefill>false</prefill>
+ <use-strict-min>false</use-strict-min>
+ <flush-strategy>FailingConnectionOnly</flush-strategy>
+ </pool>
+ <security>
+ <user-name>user</user-name>
+ <password>pass</password>
+ </security>
+ </datasource>
+</datasources>
Property changes on: trunk/build/kits/jboss-as7/docs/teiid/datasources/postgresql/postgresql-ds.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: trunk/build/kits/jboss-as7/docs/teiid/datasources/postgresql/postgresql-xa-ds.xml (from rev 3915, trunk/build/kits/jboss-as7/docs/teiid/datasources/postgresql/postgresql-xa.xml)
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/postgresql/postgresql-xa-ds.xml (rev 0)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/postgresql/postgresql-xa-ds.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -0,0 +1,45 @@
+<!-- Add the below contents under "datasources" subsystem in the standalone-teiid.xml or deploy as -ds.xml file -->
+<datasources>
+ <xa-datasource jndi-name="java:/postgresDS" pool-name="postgresDS" enabled="true" use-java-context="true" use-ccm="true">
+ <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
+ <xa-datasource-property name="PortNumber">5432</xa-datasource-property>
+ <xa-datasource-property name="DatabaseName">{db-name}</xa-datasource-property>
+ <xa-datasource-property name="ServerName">{host}</xa-datasource-property>
+
+ <driver>postgresql-8.3-603.jdbc3.jar</driver>
+
+ <!--
+ <new-connection-sql>select 1</new-connection-sql>
+ <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
+ -->
+
+ <xa-pool>
+ <min-pool-size>10</min-pool-size>
+ <max-pool-size>20</max-pool-size>
+ <is-same-rm-override>true</is-same-rm-override>
+ <prefill>false</prefill>
+ <use-strict-min>false</use-strict-min>
+ <flush-strategy>FailingConnectionOnly</flush-strategy>
+ <no-tx-separate-pools/>
+ </xa-pool>
+
+ <security>
+ <user-name>{user}</user-name>
+ <password>{password}</password>
+ <!--
+ <security-domain>mysecurity-realm</security-domain>
+ -->
+ </security>
+
+ <!--
+ <validation>
+ <check-valid-connection-sql>select 1</check-valid-connection-sql>
+ </validation>
+ -->
+ </xa-datasource>
+ <drivers>
+ <driver name="postgresql-8.3-603.jdbc3.jar" module="org.postgresql">
+
+ </driver>
+ </drivers>
+</datasources>
Property changes on: trunk/build/kits/jboss-as7/docs/teiid/datasources/postgresql/postgresql-xa-ds.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted: trunk/build/kits/jboss-as7/docs/teiid/datasources/postgresql/postgresql-xa.xml
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/postgresql/postgresql-xa.xml 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/postgresql/postgresql-xa.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -1,47 +0,0 @@
-<!-- If susbsytem is already defined, only copy the contents under it and edit to suit your needs -->
-<subsystem xmlns="urn:jboss:domain:datasources:1.0">
- <datasources>
- <xa-datasource jndi-name="java:/postgresDS" pool-name="postgresDS" enabled="true" use-java-context="true" use-ccm="true">
-
- <xa-datasource-property name="PortNumber">5432</xa-datasource-property>
- <xa-datasource-property name="DatabaseName">{db-name}</xa-datasource-property>
- <xa-datasource-property name="ServerName">{host}</xa-datasource-property>
-
- <driver>postgresql-8.3-603.jdbc3.jar</driver>
-
- <!--
- <new-connection-sql>select 1</new-connection-sql>
- <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
- -->
-
- <xa-pool>
- <min-pool-size>10</min-pool-size>
- <max-pool-size>20</max-pool-size>
- <is-same-rm-override>true</is-same-rm-override>
- <prefill>false</prefill>
- <use-strict-min>false</use-strict-min>
- <flush-strategy>FailingConnectionOnly</flush-strategy>
- <no-tx-separate-pools/>
- </xa-pool>
-
- <security>
- <user-name>{user}</user-name>
- <password>{password}</password>
- <!--
- <security-domain>mysecurity-realm</security-domain>
- -->
- </security>
-
- <!--
- <validation>
- <check-valid-connection-sql>select 1</check-valid-connection-sql>
- </validation>
- -->
- </xa-datasource>
- <drivers>
- <driver name="postgresql-8.3-603.jdbc3.jar" module="org.postgresql">
- <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
- </driver>
- </drivers>
- </datasources>
-</subsystem>
\ No newline at end of file
Deleted: trunk/build/kits/jboss-as7/docs/teiid/datasources/postgresql/postgresql.xml
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/postgresql/postgresql.xml 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/postgresql/postgresql.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -1,23 +0,0 @@
-<!-- If susbsytem is already defined, only copy the contents under it and edit to suit your needs -->
-<subsystem xmlns="urn:jboss:domain:datasources:1.0">
- <datasources>
- <datasource jndi-name="java:/postgres-ds" pool-name="PostgreDS">
- <connection-url>jdbc:postgresql://{host}:5432/{database}</connection-url>
- <driver>postgresql-8.3-603.jdbc3.jar</driver>
- <pool>
- <prefill>false</prefill>
- <use-strict-min>false</use-strict-min>
- <flush-strategy>FailingConnectionOnly</flush-strategy>
- </pool>
- <security>
- <user-name>user</user-name>
- <password>pass</password>
- </security>
- </datasource>
- <drivers>
- <driver name="postgresql-8.3-603.jdbc3.jar" module="org.postgresql">
- <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
- </driver>
- </drivers>
- </datasources>
-</subsystem>
\ No newline at end of file
Copied: trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/jtds/sqlserver-ds.xml (from rev 3915, trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/jtds/sqlserver.xml)
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/jtds/sqlserver-ds.xml (rev 0)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/jtds/sqlserver-ds.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -0,0 +1,17 @@
+<!-- Add the below contents under "datasources" subsystem in the standalone-teiid.xml or deploy as -ds.xml file -->
+<datasources>
+ <datasource jndi-name="java:/sqlserverDS" pool-name="sqlserverDS">
+ <driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class>
+ <connection-url>jdbc:jtds:sqlserver://{host}:1433/{database}</connection-url>
+ <driver>jtds-1.2.5.jar</driver>
+ <pool>
+ <prefill>false</prefill>
+ <use-strict-min>false</use-strict-min>
+ <flush-strategy>FailingConnectionOnly</flush-strategy>
+ </pool>
+ <security>
+ <user-name>{user}</user-name>
+ <password>{password}</password>
+ </security>
+ </datasource>
+</datasources>
Property changes on: trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/jtds/sqlserver-ds.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/jtds/sqlserver-xa-ds.xml (from rev 3915, trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/jtds/sqlserver-xa.xml)
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/jtds/sqlserver-xa-ds.xml (rev 0)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/jtds/sqlserver-xa-ds.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -0,0 +1,40 @@
+<!-- Add the below contents under "datasources" subsystem in the standalone-teiid.xml or deploy as -ds.xml file -->
+<datasources>
+ <xa-datasource jndi-name="java:/sqlserverDS" pool-name="sqlserverDS" enabled="true" use-java-context="true" use-ccm="true">
+ <xa-datasource-class>net.sourceforge.jtds.jdbcx.JtdsDataSource</xa-datasource-class>
+ <xa-datasource-property name="PortNumber">1433</xa-datasource-property>
+ <xa-datasource-property name="DatabaseName">{db-name}</xa-datasource-property>
+ <xa-datasource-property name="ServerName">{host}</xa-datasource-property>
+
+ <driver>jtds-1.2.5.jar</driver>
+
+ <!--
+ <new-connection-sql>select 1/new-connection-sql>
+ <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
+ -->
+
+ <xa-pool>
+ <min-pool-size>10</min-pool-size>
+ <max-pool-size>20</max-pool-size>
+ <is-same-rm-override>true</is-same-rm-override>
+ <prefill>false</prefill>
+ <use-strict-min>false</use-strict-min>
+ <flush-strategy>FailingConnectionOnly</flush-strategy>
+ <no-tx-separate-pools/>
+ </xa-pool>
+
+ <security>
+ <user-name>{user}</user-name>
+ <password>{password}</password>
+ <!--
+ <security-domain>mysecurity-realm</security-domain>
+ -->
+ </security>
+
+ <!--
+ <validation>
+ <check-valid-connection-sql>select 1</check-valid-connection-sql>
+ </validation>
+ -->
+ </xa-datasource>
+</datasources>
Property changes on: trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/jtds/sqlserver-xa-ds.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted: trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/jtds/sqlserver-xa.xml
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/jtds/sqlserver-xa.xml 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/jtds/sqlserver-xa.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -1,48 +0,0 @@
-<!-- If susbsytem is already defined, only copy the contents under it and edit to suit your needs -->
-<subsystem xmlns="urn:jboss:domain:datasources:1.0">
- <datasources>
- <xa-datasource jndi-name="java:/sqlserverDS" pool-name="sqlserverDS" enabled="true" use-java-context="true" use-ccm="true">
-
- <xa-datasource-property name="PortNumber">1433</xa-datasource-property>
- <xa-datasource-property name="DatabaseName">{db-name}</xa-datasource-property>
- <xa-datasource-property name="ServerName">{host}</xa-datasource-property>
-
- <driver>jtds-1.2.5.jar</driver>
-
- <!--
- <new-connection-sql>select 1/new-connection-sql>
- <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
- -->
-
- <xa-pool>
- <min-pool-size>10</min-pool-size>
- <max-pool-size>20</max-pool-size>
- <is-same-rm-override>true</is-same-rm-override>
- <prefill>false</prefill>
- <use-strict-min>false</use-strict-min>
- <flush-strategy>FailingConnectionOnly</flush-strategy>
- <no-tx-separate-pools/>
- </xa-pool>
-
- <security>
- <user-name>{user}</user-name>
- <password>{password}</password>
- <!--
- <security-domain>mysecurity-realm</security-domain>
- -->
- </security>
-
- <!--
- <validation>
- <check-valid-connection-sql>select 1</check-valid-connection-sql>
- </validation>
- -->
- </xa-datasource>
- <drivers>
- <driver name="jtds-1.2.5.jar" module="net.sourceforge.jtds">
- <driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class>
- <xa-datasource-class>net.sourceforge.jtds.jdbcx.JtdsDataSource</xa-datasource-class>
- </driver>
- </drivers>
- </datasources>
-</subsystem>
\ No newline at end of file
Deleted: trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/jtds/sqlserver.xml
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/jtds/sqlserver.xml 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/jtds/sqlserver.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -1,24 +0,0 @@
-<!-- If susbsytem is already defined, only copy the contents under it and edit to suit your needs -->
-<subsystem xmlns="urn:jboss:domain:datasources:1.0">
- <datasources>
- <datasource jndi-name="java:/sqlserverDS" pool-name="sqlserverDS">
- <connection-url>jdbc:jtds:sqlserver://{host}:1433/{database}</connection-url>
- <driver>jtds-1.2.5.jar</driver>
- <pool>
- <prefill>false</prefill>
- <use-strict-min>false</use-strict-min>
- <flush-strategy>FailingConnectionOnly</flush-strategy>
- </pool>
- <security>
- <user-name>{user}</user-name>
- <password>{password}</password>
- </security>
- </datasource>
- <drivers>
- <driver name="jtds-1.2.5.jar" module="net.sourceforge.jtds">
- <driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class>
- <xa-datasource-class>net.sourceforge.jtds.jdbcx.JtdsDataSource</xa-datasource-class>
- </driver>
- </drivers>
- </datasources>
-</subsystem>
\ No newline at end of file
Copied: trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/native/sqlserver-ds.xml (from rev 3915, trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/native/sqlserver.xml)
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/native/sqlserver-ds.xml (rev 0)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/native/sqlserver-ds.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -0,0 +1,17 @@
+<!-- Add the below contents under "datasources" subsystem in the standalone-teiid.xml or deploy as -ds.xml file -->
+<datasources>
+ <datasource jndi-name="java:/sqlserverDS" pool-name="sqlserverDS">
+ <driver-class>com.microsoft.jdbc.sqlserver.SQLServerDriver</driver-class>
+ <connection-url>jdbc:microsoft:sqlserver://{host}:1433</connection-url>
+ <driver>sqljdbc4.jar</driver>
+ <pool>
+ <prefill>false</prefill>
+ <use-strict-min>false</use-strict-min>
+ <flush-strategy>FailingConnectionOnly</flush-strategy>
+ </pool>
+ <security>
+ <user-name>{user}</user-name>
+ <password>{password}</password>
+ </security>
+ </datasource>
+</datasources>
Property changes on: trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/native/sqlserver-ds.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/native/sqlserver-xa-ds.xml (from rev 3915, trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/native/sqlserver-xa.xml)
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/native/sqlserver-xa-ds.xml (rev 0)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/native/sqlserver-xa-ds.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -0,0 +1,40 @@
+<!-- Add the below contents under "datasources" subsystem in the standalone-teiid.xml or deploy as -ds.xml file -->
+<datasources>
+ <xa-datasource jndi-name="java:/sqlserverDS" pool-name="sqlserverDS" enabled="true" use-java-context="true" use-ccm="true">
+ <xa-datasource-class>com.microsoft.sqlserver.jdbc.SQLServerXADataSource</xa-datasource-class>
+ <xa-datasource-property name="PortNumber">1433</xa-datasource-property>
+ <xa-datasource-property name="DatabaseName">{db-name}</xa-datasource-property>
+ <xa-datasource-property name="ServerName">{host}</xa-datasource-property>
+
+ <driver>sqljdbc4.jar</driver>
+
+ <!--
+ <new-connection-sql>select 1/new-connection-sql>
+ <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
+ -->
+
+ <xa-pool>
+ <min-pool-size>10</min-pool-size>
+ <max-pool-size>20</max-pool-size>
+ <is-same-rm-override>true</is-same-rm-override>
+ <prefill>false</prefill>
+ <use-strict-min>false</use-strict-min>
+ <flush-strategy>FailingConnectionOnly</flush-strategy>
+ <no-tx-separate-pools/>
+ </xa-pool>
+
+ <security>
+ <user-name>{user}</user-name>
+ <password>{password}</password>
+ <!--
+ <security-domain>mysecurity-realm</security-domain>
+ -->
+ </security>
+
+ <!--
+ <validation>
+ <check-valid-connection-sql>select 1</check-valid-connection-sql>
+ </validation>
+ -->
+ </xa-datasource>
+</datasources>
Property changes on: trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/native/sqlserver-xa-ds.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted: trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/native/sqlserver-xa.xml
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/native/sqlserver-xa.xml 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/native/sqlserver-xa.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -1,48 +0,0 @@
-<!-- If susbsytem is already defined, only copy the contents under it and edit to suit your needs -->
-<subsystem xmlns="urn:jboss:domain:datasources:1.0">
- <datasources>
- <xa-datasource jndi-name="java:/sqlserverDS" pool-name="sqlserverDS" enabled="true" use-java-context="true" use-ccm="true">
-
- <xa-datasource-property name="PortNumber">1433</xa-datasource-property>
- <xa-datasource-property name="DatabaseName">{db-name}</xa-datasource-property>
- <xa-datasource-property name="ServerName">{host}</xa-datasource-property>
-
- <driver>sqljdbc4.jar</driver>
-
- <!--
- <new-connection-sql>select 1/new-connection-sql>
- <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
- -->
-
- <xa-pool>
- <min-pool-size>10</min-pool-size>
- <max-pool-size>20</max-pool-size>
- <is-same-rm-override>true</is-same-rm-override>
- <prefill>false</prefill>
- <use-strict-min>false</use-strict-min>
- <flush-strategy>FailingConnectionOnly</flush-strategy>
- <no-tx-separate-pools/>
- </xa-pool>
-
- <security>
- <user-name>{user}</user-name>
- <password>{password}</password>
- <!--
- <security-domain>mysecurity-realm</security-domain>
- -->
- </security>
-
- <!--
- <validation>
- <check-valid-connection-sql>select 1</check-valid-connection-sql>
- </validation>
- -->
- </xa-datasource>
- <drivers>
- <driver name="sqljdbc4.jar" module="com.microsoft.sqlserver">
- <driver-class>com.microsoft.jdbc.sqlserver.SQLServerDriver</driver-class>
- <xa-datasource-class>com.microsoft.sqlserver.jdbc.SQLServerXADataSource</xa-datasource-class>
- </driver>
- </drivers>
- </datasources>
-</subsystem>
\ No newline at end of file
Deleted: trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/native/sqlserver.xml
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/native/sqlserver.xml 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/sqlserver/native/sqlserver.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -1,24 +0,0 @@
-<!-- If susbsytem is already defined, only copy the contents under it and edit to suit your needs -->
-<subsystem xmlns="urn:jboss:domain:datasources:1.0">
- <datasources>
- <datasource jndi-name="java:/sqlserverDS" pool-name="sqlserverDS">
- <connection-url>jdbc:microsoft:sqlserver://{host}:1433</connection-url>
- <driver>sqljdbc4.jar</driver>
- <pool>
- <prefill>false</prefill>
- <use-strict-min>false</use-strict-min>
- <flush-strategy>FailingConnectionOnly</flush-strategy>
- </pool>
- <security>
- <user-name>{user}</user-name>
- <password>{password}</password>
- </security>
- </datasource>
- <drivers>
- <driver name="sqljdbc4.jar" module="com.microsoft.sqlserver">
- <driver-class>com.microsoft.jdbc.sqlserver.SQLServerDriver</driver-class>
- <xa-datasource-class>com.microsoft.sqlserver.jdbc.SQLServerXADataSource</xa-datasource-class>
- </driver>
- </drivers>
- </datasources>
-</subsystem>
\ No newline at end of file
Copied: trunk/build/kits/jboss-as7/docs/teiid/datasources/teiid/teiid-ds.xml (from rev 3915, trunk/build/kits/jboss-as7/docs/teiid/datasources/teiid/teiid.xml)
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/teiid/teiid-ds.xml (rev 0)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/teiid/teiid-ds.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -0,0 +1,16 @@
+<!-- Add the below contents under "datasources" subsystem in the standalone-teiid.xml or deploy as -ds.xml file -->
+<datasources>
+ <datasource jndi-name="java:/teiidDS" pool-name="teiidDS">
+ <connection-url>jdbc:teiid:{vdb}@mm://{host}:31000</connection-url>
+ <driver>teiid</driver>
+ <pool>
+ <prefill>false</prefill>
+ <use-strict-min>false</use-strict-min>
+ <flush-strategy>FailingConnectionOnly</flush-strategy>
+ </pool>
+ <security>
+ <user-name>{user}</user-name>
+ <password>{password}</password>
+ </security>
+ </datasource>
+</datasources>
Property changes on: trunk/build/kits/jboss-as7/docs/teiid/datasources/teiid/teiid-ds.xml
___________________________________________________________________
Added: svn:keywords
+ Id Revision
Added: svn:eol-style
+ LF
Copied: trunk/build/kits/jboss-as7/docs/teiid/datasources/teiid/teiid-local-ds.xml (from rev 3915, trunk/build/kits/jboss-as7/docs/teiid/datasources/teiid/teiid-local.xml)
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/teiid/teiid-local-ds.xml (rev 0)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/teiid/teiid-local-ds.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -0,0 +1,16 @@
+<!-- Add the below contents under "datasources" subsystem in the standalone-teiid.xml or deploy as -ds.xml file -->
+<datasources>
+ <datasource jndi-name="java:/teiidDS" pool-name="teiidDS">
+ <connection-url>jdbc:teiid:{vdb}</connection-url>
+ <driver>teiid-local</driver>
+ <pool>
+ <prefill>false</prefill>
+ <use-strict-min>false</use-strict-min>
+ <flush-strategy>FailingConnectionOnly</flush-strategy>
+ </pool>
+ <security>
+ <user-name>{user}</user-name>
+ <password>{password}</password>
+ </security>
+ </datasource>
+</datasources>
Property changes on: trunk/build/kits/jboss-as7/docs/teiid/datasources/teiid/teiid-local-ds.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted: trunk/build/kits/jboss-as7/docs/teiid/datasources/teiid/teiid-local.xml
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/teiid/teiid-local.xml 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/teiid/teiid-local.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -1,24 +0,0 @@
-<!-- If susbsytem is already defined, only copy the contents under it and edit to suit your needs -->
-<subsystem xmlns="urn:jboss:domain:datasources:1.0">
- <datasources>
- <datasource jndi-name="java:/teiidDS" pool-name="teiidDS">
- <connection-url>jdbc:teiid:{vdb}</connection-url>
- <driver>teiid-local</driver>
- <pool>
- <prefill>false</prefill>
- <use-strict-min>false</use-strict-min>
- <flush-strategy>FailingConnectionOnly</flush-strategy>
- </pool>
- <security>
- <user-name>{user}</user-name>
- <password>{password}</password>
- </security>
- </datasource>
- <drivers>
- <driver name="teiid-local" module="org.jboss.teiid">
- <driver-class>org.teiid.jdbc.TeiidDriver</driver-class>
- <xa-datasource-class>org.teiid.jdbc.TeiidDataSource</xa-datasource-class>
- </driver>
- </drivers>
- </datasources>
-</subsystem>
\ No newline at end of file
Copied: trunk/build/kits/jboss-as7/docs/teiid/datasources/teiid/teiid-xa-ds.xml (from rev 3915, trunk/build/kits/jboss-as7/docs/teiid/datasources/teiid/teiid-xa.xml)
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/teiid/teiid-xa-ds.xml (rev 0)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/teiid/teiid-xa-ds.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -0,0 +1,40 @@
+<!-- Add the below contents under "datasources" subsystem in the standalone-teiid.xml or deploy as -ds.xml file -->
+<datasources>
+ <xa-datasource jndi-name="java:/teiidDS" pool-name="teiidDS" enabled="true" use-java-context="true" use-ccm="true">
+
+ <xa-datasource-property name="PortNumber">31000</xa-datasource-property>
+ <xa-datasource-property name="DatabaseName">{db-name}</xa-datasource-property>
+ <xa-datasource-property name="ServerName">{host}</xa-datasource-property>
+
+ <driver>teiid</driver>
+
+ <!--
+ <new-connection-sql>select 1/new-connection-sql>
+ <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
+ -->
+
+ <xa-pool>
+ <min-pool-size>10</min-pool-size>
+ <max-pool-size>20</max-pool-size>
+ <is-same-rm-override>true</is-same-rm-override>
+ <prefill>false</prefill>
+ <use-strict-min>false</use-strict-min>
+ <flush-strategy>FailingConnectionOnly</flush-strategy>
+ <no-tx-separate-pools/>
+ </xa-pool>
+
+ <security>
+ <user-name>{user}</user-name>
+ <password>{password}</password>
+ <!--
+ <security-domain>mysecurity-realm</security-domain>
+ -->
+ </security>
+
+ <!--
+ <validation>
+ <check-valid-connection-sql>select 1</check-valid-connection-sql>
+ </validation>
+ -->
+ </xa-datasource>
+</datasources>
Property changes on: trunk/build/kits/jboss-as7/docs/teiid/datasources/teiid/teiid-xa-ds.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted: trunk/build/kits/jboss-as7/docs/teiid/datasources/teiid/teiid-xa.xml
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/teiid/teiid-xa.xml 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/teiid/teiid-xa.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -1,48 +0,0 @@
-<!-- If susbsytem is already defined, only copy the contents under it and edit to suit your needs -->
-<subsystem xmlns="urn:jboss:domain:datasources:1.0">
- <datasources>
- <xa-datasource jndi-name="java:/teiidDS" pool-name="teiidDS" enabled="true" use-java-context="true" use-ccm="true">
-
- <xa-datasource-property name="PortNumber">31000</xa-datasource-property>
- <xa-datasource-property name="DatabaseName">{db-name}</xa-datasource-property>
- <xa-datasource-property name="ServerName">{host}</xa-datasource-property>
-
- <driver>teiid</driver>
-
- <!--
- <new-connection-sql>select 1/new-connection-sql>
- <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
- -->
-
- <xa-pool>
- <min-pool-size>10</min-pool-size>
- <max-pool-size>20</max-pool-size>
- <is-same-rm-override>true</is-same-rm-override>
- <prefill>false</prefill>
- <use-strict-min>false</use-strict-min>
- <flush-strategy>FailingConnectionOnly</flush-strategy>
- <no-tx-separate-pools/>
- </xa-pool>
-
- <security>
- <user-name>{user}</user-name>
- <password>{password}</password>
- <!--
- <security-domain>mysecurity-realm</security-domain>
- -->
- </security>
-
- <!--
- <validation>
- <check-valid-connection-sql>select 1</check-valid-connection-sql>
- </validation>
- -->
- </xa-datasource>
- <drivers>
- <driver name="teiid" module="org.jboss.teiid.client">
- <driver-class>org.teiid.jdbc.TeiidDriver</driver-class>
- <xa-datasource-class>org.teiid.jdbc.TeiidDataSource</xa-datasource-class>
- </driver>
- </drivers>
- </datasources>
-</subsystem>
\ No newline at end of file
Deleted: trunk/build/kits/jboss-as7/docs/teiid/datasources/teiid/teiid.xml
===================================================================
--- trunk/build/kits/jboss-as7/docs/teiid/datasources/teiid/teiid.xml 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/build/kits/jboss-as7/docs/teiid/datasources/teiid/teiid.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -1,24 +0,0 @@
-<!-- If susbsytem is already defined, only copy the contents under it and edit to suit your needs -->
-<subsystem xmlns="urn:jboss:domain:datasources:1.0">
- <datasources>
- <datasource jndi-name="java:/teiidDS" pool-name="teiidDS">
- <connection-url>jdbc:teiid:{vdb}@mm://{host}:31000</connection-url>
- <driver>teiid</driver>
- <pool>
- <prefill>false</prefill>
- <use-strict-min>false</use-strict-min>
- <flush-strategy>FailingConnectionOnly</flush-strategy>
- </pool>
- <security>
- <user-name>{user}</user-name>
- <password>{password}</password>
- </security>
- </datasource>
- <drivers>
- <driver name="teiid" module="org.jboss.teiid.client">
- <driver-class>org.teiid.jdbc.TeiidDriver</driver-class>
- <xa-datasource-class>org.teiid.jdbc.TeiidDataSource</xa-datasource-class>
- </driver>
- </drivers>
- </datasources>
-</subsystem>
\ No newline at end of file
Modified: trunk/build/kits/jboss-as7/domain/configuration/domain-teiid.xml
===================================================================
--- trunk/build/kits/jboss-as7/domain/configuration/domain-teiid.xml 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/build/kits/jboss-as7/domain/configuration/domain-teiid.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -95,6 +95,14 @@
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
+ <driver name="teiid-local" module="org.jboss.teiid">
+ <driver-class>org.teiid.jdbc.TeiidDriver</driver-class>
+ <xa-datasource-class>org.teiid.jdbc.TeiidDataSource</xa-datasource-class>
+ </driver>
+ <driver name="teiid" module="org.jboss.teiid.client">
+ <driver-class>org.teiid.jdbc.TeiidDriver</driver-class>
+ <xa-datasource-class>org.teiid.jdbc.TeiidDataSource</xa-datasource-class>
+ </driver>
</drivers>
</datasources>
</subsystem>
@@ -1081,9 +1089,10 @@
<translator name="hive" module="org.jboss.teiid.translator.hive"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:threads:1.1">
- <queueless-thread-pool name="teiid-async">
- <max-threads count="2"/>
- </queueless-thread-pool>
+ <bounded-queue-thread-pool name="teiid-async">
+ <max-threads count="4"/>
+ <queue-length count="100"/>
+ </bounded-queue-thread-pool>
</subsystem>
<subsystem xmlns="urn:jboss:domain:transactions:1.1">
<core-environment>
Modified: trunk/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml
===================================================================
--- trunk/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/build/kits/jboss-as7/standalone/configuration/standalone-teiid.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -106,6 +106,14 @@
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
+ <driver name="teiid-local" module="org.jboss.teiid">
+ <driver-class>org.teiid.jdbc.TeiidDriver</driver-class>
+ <xa-datasource-class>org.teiid.jdbc.TeiidDataSource</xa-datasource-class>
+ </driver>
+ <driver name="teiid" module="org.jboss.teiid.client">
+ <driver-class>org.teiid.jdbc.TeiidDriver</driver-class>
+ <xa-datasource-class>org.teiid.jdbc.TeiidDataSource</xa-datasource-class>
+ </driver>
</drivers>
</datasources>
</subsystem>
@@ -309,9 +317,10 @@
</subsystem>
<subsystem xmlns="urn:jboss:domain:threads:1.1">
- <queueless-thread-pool name="teiid-async">
- <max-threads count="2"/>
- </queueless-thread-pool>
+ <bounded-queue-thread-pool name="teiid-async">
+ <max-threads count="4"/>
+ <queue-length count="100"/>
+ </bounded-queue-thread-pool>
</subsystem>
<subsystem xmlns="urn:jboss:domain:transactions:1.1">
<core-environment>
Modified: trunk/client/src/main/resources/vdb-deployer.xsd
===================================================================
--- trunk/client/src/main/resources/vdb-deployer.xsd 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/client/src/main/resources/vdb-deployer.xsd 2012-03-08 20:03:01 UTC (rev 3922)
@@ -32,6 +32,17 @@
<xs:attribute name="connection-jndi-name" type="xs:string"/>
</xs:complexType>
</xs:element>
+ <xs:element name="metadata" minOccurs="0" maxOccurs="1">
+ <xs:annotation>
+ <xs:documentation>Schema metadata (tables, views, stored procedures, functions)
+ definitions of the model. If this defined on source model, it becomes source metadata,
+ on virtual model it become view metadata where user can define the logical layer
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:attribute name="type" type="xs:string" default="DDL"/>
+ </xs:complexType>
+ </xs:element>
<xs:element name="validation-error" minOccurs="0" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>When Schema files for model defined by Designer, the validation-errors define
Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -254,6 +254,9 @@
@Override
public void getMetadata(MetadataFactory metadataFactory, Connection conn) throws TranslatorException {
try {
+ if (conn == null) {
+ throw new TranslatorException(JDBCPlugin.Event.TEIID11018, JDBCPlugin.Util.gs(JDBCPlugin.Event.TEIID11018));
+ }
JDBCMetdataProcessor metadataProcessor = createMetadataProcessor();
PropertiesUtils.setBeanProperties(metadataProcessor, metadataFactory.getImportProperties(), "importer"); //$NON-NLS-1$
metadataProcessor.getConnectorMetadata(conn, metadataFactory);
Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCMetdataProcessor.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCMetdataProcessor.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCMetdataProcessor.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -32,6 +32,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
+import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
@@ -42,13 +43,15 @@
import org.teiid.logging.LogManager;
import org.teiid.metadata.AbstractMetadataRecord;
import org.teiid.metadata.BaseColumn;
+import org.teiid.metadata.BaseColumn.NullType;
import org.teiid.metadata.Column;
import org.teiid.metadata.DuplicateRecordException;
+import org.teiid.metadata.ForeignKey;
+import org.teiid.metadata.KeyRecord;
import org.teiid.metadata.MetadataFactory;
import org.teiid.metadata.Procedure;
+import org.teiid.metadata.ProcedureParameter.Type;
import org.teiid.metadata.Table;
-import org.teiid.metadata.BaseColumn.NullType;
-import org.teiid.metadata.ProcedureParameter.Type;
import org.teiid.translator.TranslatorException;
import org.teiid.translator.TypeFacility;
@@ -358,7 +361,11 @@
if (seqNum <= savedSeqNum) {
if (keyColumns != null) {
- metadataFactory.addForiegnKey(fkName, new ArrayList<String>(keyColumns.values()), new ArrayList<String>(referencedKeyColumns.values()), pkTable.table, tableInfo.table, autoCreateUniqueConstraints);
+ KeyRecord record = autoCreateUniqueKeys(autoCreateUniqueConstraints, metadataFactory, fkName, referencedKeyColumns, pkTable.table);
+ ForeignKey fk = metadataFactory.addForiegnKey(fkName, new ArrayList<String>(keyColumns.values()), new ArrayList<String>(referencedKeyColumns.values()), pkTable.table.getName(), tableInfo.table);
+ if (record != null) {
+ fk.setPrimaryKey(record);
+ }
}
keyColumns = new TreeMap<Short, String>();
referencedKeyColumns = new TreeMap<Short, String>();
@@ -384,11 +391,52 @@
}
}
if (keyColumns != null) {
- metadataFactory.addForiegnKey(fkName, new ArrayList<String>(keyColumns.values()), new ArrayList<String>(referencedKeyColumns.values()), pkTable.table, tableInfo.table, autoCreateUniqueConstraints);
+ KeyRecord record = autoCreateUniqueKeys(autoCreateUniqueConstraints, metadataFactory, fkName, referencedKeyColumns, pkTable.table);
+ ForeignKey fk = metadataFactory.addForiegnKey(fkName, new ArrayList<String>(keyColumns.values()), new ArrayList<String>(referencedKeyColumns.values()), pkTable.table.getName(), tableInfo.table);
+ if (record != null) {
+ fk.setPrimaryKey(record);
+ }
}
fks.close();
}
}
+
+ private KeyRecord autoCreateUniqueKeys(boolean create, MetadataFactory factory, String name, TreeMap<Short, String> referencedKeyColumns, Table pkTable) throws TranslatorException {
+ if (referencedKeyColumns != null && pkTable.getPrimaryKey() == null && pkTable.getUniqueKeys().isEmpty()) {
+ factory.addIndex(name + "_unique", false, new ArrayList<String>(referencedKeyColumns.values()), pkTable); //$NON-NLS-1$
+ }
+
+ KeyRecord uniqueKey = null;
+ if (referencedKeyColumns == null) {
+ uniqueKey = pkTable.getPrimaryKey();
+ } else {
+ for (KeyRecord record : pkTable.getUniqueKeys()) {
+ if (keyMatches(new ArrayList(referencedKeyColumns.values()), record)) {
+ uniqueKey = record;
+ break;
+ }
+ }
+ if (uniqueKey == null && pkTable.getPrimaryKey() != null && keyMatches(new ArrayList(referencedKeyColumns.values()), pkTable.getPrimaryKey())) {
+ uniqueKey = pkTable.getPrimaryKey();
+ }
+ }
+ if (uniqueKey == null && create) {
+ uniqueKey = factory.addIndex(name + "_unique", false, new ArrayList(referencedKeyColumns.values()), pkTable); //$NON-NLS-1$
+ }
+ return uniqueKey;
+ }
+
+ private boolean keyMatches(List<String> names, KeyRecord record) {
+ if (names.size() != record.getColumns().size()) {
+ return false;
+ }
+ for (int i = 0; i < names.size(); i++) {
+ if (!names.get(i).equals(record.getColumns().get(i).getName())) {
+ return false;
+ }
+ }
+ return true;
+ }
private void getIndexes(MetadataFactory metadataFactory,
DatabaseMetaData metadata, Collection<TableInfo> tables, boolean uniqueOnly) throws SQLException, TranslatorException {
Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCPlugin.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCPlugin.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCPlugin.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -54,5 +54,6 @@
TEIID11015,
TEIID11016,
TEIID11017,
+ TEIID11018,
}
}
Modified: trunk/connectors/translator-jdbc/src/main/resources/org/teiid/translator/jdbc/i18n.properties
===================================================================
--- trunk/connectors/translator-jdbc/src/main/resources/org/teiid/translator/jdbc/i18n.properties 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/connectors/translator-jdbc/src/main/resources/org/teiid/translator/jdbc/i18n.properties 2012-03-08 20:03:01 UTC (rev 3922)
@@ -31,4 +31,5 @@
TEIID11003=Not using oracle execution payload {0} as hint, since it apprears to contain more than just a single comment.
TEIID11002=Failed to report the JDBC driver and connection information
TEIID11006=Teiid runtime names, which are case insensitive, for the imported metadata are not unique. If not already set, use the setting importer.useFullSchemaName to create Teiid names that include the source schema.
-TEIID11017=Invalid name in source sequence format. Expected <element name> {0} <sequence name>.<sequence value>, but was {1}
\ No newline at end of file
+TEIID11017=Invalid name in source sequence format. Expected <element name> {0} <sequence name>.<sequence value>, but was {1}
+TEIID11018=Connection is null; Datasource may not have been defined. Requires a active connection to retrieve the metadata.
\ No newline at end of file
Modified: trunk/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/MetadataProcessor.java
===================================================================
--- trunk/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/MetadataProcessor.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/MetadataProcessor.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -112,7 +112,7 @@
String columnName = "FK_" + parent.getName() + "_" + col.getName();//$NON-NLS-1$ //$NON-NLS-2$
ArrayList<String> columnNames2 = new ArrayList<String>();
columnNames2.add(col.getName());
- metadataFactory.addForiegnKey(columnName, columnNames2, parent, child);
+ metadataFactory.addForiegnKey(columnName, columnNames2, parent.getName(), child);
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/ConnectorManager.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/ConnectorManager.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/ConnectorManager.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -24,36 +24,24 @@
import java.util.Arrays;
import java.util.List;
-import java.util.Map;
-import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
import javax.naming.InitialContext;
-import javax.resource.ResourceException;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.util.Assertion;
import org.teiid.dqp.message.AtomicRequestID;
import org.teiid.dqp.message.AtomicRequestMessage;
import org.teiid.logging.CommandLogMessage;
+import org.teiid.logging.CommandLogMessage.Event;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
import org.teiid.logging.MessageLevel;
-import org.teiid.logging.CommandLogMessage.Event;
-import org.teiid.metadata.Datatype;
import org.teiid.metadata.FunctionMethod;
-import org.teiid.metadata.MetadataFactory;
-import org.teiid.metadata.MetadataStore;
-import org.teiid.metadata.Schema;
-import org.teiid.metadata.Table;
import org.teiid.query.QueryPlugin;
-import org.teiid.query.function.metadata.FunctionMetadataValidator;
import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
import org.teiid.query.optimizer.capabilities.SourceCapabilities;
-import org.teiid.query.report.ActivityReport;
-import org.teiid.query.report.ReportItem;
import org.teiid.query.sql.lang.Command;
-import org.teiid.resource.spi.WrappedConnection;
import org.teiid.translator.ExecutionContext;
import org.teiid.translator.ExecutionFactory;
import org.teiid.translator.TranslatorException;
@@ -108,50 +96,6 @@
return sb.toString();
}
- public MetadataStore getMetadata(String modelName, Map<String, Datatype> datatypes, Properties importProperties) throws TranslatorException {
- MetadataFactory factory = new MetadataFactory(modelName, datatypes, importProperties);
- Object connectionFactory = getConnectionFactory();
- Object connection = executionFactory.getConnection(connectionFactory, null);
- Object unwrapped = null;
-
- if (connection instanceof WrappedConnection) {
- try {
- unwrapped = ((WrappedConnection)connection).unwrap();
- } catch (ResourceException e) {
- throw new TranslatorException(QueryPlugin.Event.TEIID30480, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30480));
- }
- }
-
- try {
- executionFactory.getMetadata(factory, (unwrapped == null) ? connection:unwrapped);
- } finally {
- executionFactory.closeConnection(connection, connectionFactory);
- }
- validateMetadata(factory.getMetadataStore(), modelName);
- return factory.getMetadataStore();
- }
-
- private void validateMetadata(MetadataStore metadataStore, String schemaName) throws TranslatorException {
- if (metadataStore.getSchemas().size() != 1) {
- throw new TranslatorException(QueryPlugin.Event.TEIID30580, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30580, schemaName));
- }
- Map.Entry<String, Schema> schemaEntry = metadataStore.getSchemas().entrySet().iterator().next();
- if (!schemaName.equalsIgnoreCase(schemaEntry.getKey())) {
- throw new TranslatorException(QueryPlugin.Event.TEIID30580, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30580, schemaName));
- }
- Schema s = schemaEntry.getValue();
- for (Table t : s.getTables().values()) {
- if (t.getColumns() == null || t.getColumns().size() == 0) {
- throw new TranslatorException(QueryPlugin.Event.TEIID30580, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30580, t.getFullName()));
- }
- }
- ActivityReport<ReportItem> report = new ActivityReport<ReportItem>("Translator metadata load " + schemaName); //$NON-NLS-1$
- FunctionMetadataValidator.validateFunctionMethods(s.getFunctions().values(),report);
- if(report.hasItems()) {
- throw new TranslatorException(QueryPlugin.Util.getString("ERR.015.001.0005", report)); //$NON-NLS-1$
- }
- }
-
public List<FunctionMethod> getPushDownFunctions(){
return getExecutionFactory().getPushDownFunctions();
}
@@ -265,7 +209,7 @@
* Get the ConnectionFactory object required by this manager
* @return
*/
- protected Object getConnectionFactory() throws TranslatorException {
+ public Object getConnectionFactory() throws TranslatorException {
if (this.connectionName != null) {
String jndiName = this.connectionName;
if (!this.connectionName.startsWith(JAVA_CONTEXT)) {
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -67,16 +67,15 @@
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.dqp.service.TransactionService;
import org.teiid.events.EventDistributor;
import org.teiid.jdbc.EnhancedTimer;
import org.teiid.logging.CommandLogMessage;
+import org.teiid.logging.CommandLogMessage.Event;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
import org.teiid.logging.MessageLevel;
-import org.teiid.logging.CommandLogMessage.Event;
-import org.teiid.metadata.MetadataRepository;
import org.teiid.query.QueryPlugin;
import org.teiid.query.tempdata.TempTableDataManager;
import org.teiid.query.tempdata.TempTableStore;
@@ -187,7 +186,6 @@
private SessionAwareCache<CachedResults> rsCache;
private TransactionService transactionService;
private EventDistributor eventDistributor;
- private MetadataRepository metadataRepository;
private DQPConfiguration config = new DQPConfiguration();
@@ -672,7 +670,6 @@
DataTierManagerImpl processorDataManager = new DataTierManagerImpl(this, this.bufferManager, this.config.isDetectingChangeEvents());
processorDataManager.setEventDistributor(eventDistributor);
- processorDataManager.setMetadataRepository(metadataRepository);
dataTierMgr = new TempTableDataManager(processorDataManager, this.bufferManager, this.processWorkerPool, this.rsCache);
dataTierMgr.setEventDistributor(eventDistributor);
@@ -687,10 +684,6 @@
this.transactionService = service;
}
- public void setMetadataRepository(MetadataRepository metadataRepository) {
- this.metadataRepository = metadataRepository;
- }
-
public void setEventDistributor(EventDistributor eventDistributor) {
this.eventDistributor = eventDistributor;
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DataTierManagerImpl.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -61,7 +61,19 @@
import org.teiid.events.EventDistributor;
import org.teiid.logging.LogManager;
import org.teiid.logging.MessageLevel;
-import org.teiid.metadata.*;
+import org.teiid.metadata.AbstractMetadataRecord;
+import org.teiid.metadata.Column;
+import org.teiid.metadata.ColumnStats;
+import org.teiid.metadata.Datatype;
+import org.teiid.metadata.ForeignKey;
+import org.teiid.metadata.FunctionMethod;
+import org.teiid.metadata.KeyRecord;
+import org.teiid.metadata.MetadataRepository;
+import org.teiid.metadata.Procedure;
+import org.teiid.metadata.ProcedureParameter;
+import org.teiid.metadata.Schema;
+import org.teiid.metadata.Table;
+import org.teiid.metadata.TableStats;
import org.teiid.query.QueryPlugin;
import org.teiid.query.metadata.CompositeMetadataStore;
import org.teiid.query.metadata.TempMetadataID;
@@ -144,7 +156,6 @@
private BufferManager bufferManager;
private EventDistributor eventDistributor;
private boolean detectChangeEvents;
- private MetadataRepository metadataRepository;
public DataTierManagerImpl(DQPCore requestMgr, BufferManager bufferMgr, boolean detectChangeEvents) {
this.requestMgr = requestMgr;
@@ -164,14 +175,6 @@
return eventDistributor;
}
- public MetadataRepository getMetadataRepository() {
- return metadataRepository;
- }
-
- public void setMetadataRepository(MetadataRepository metadataRepository) {
- this.metadataRepository = metadataRepository;
- }
-
public TupleSource registerRequest(CommandContext context, Command command, String modelName, String connectorBindingId, int nodeID, int limit) throws TeiidComponentException, TeiidProcessingException {
RequestWorkItem workItem = requestMgr.getRequestWorkItem((RequestID)context.getProcessorID());
@@ -413,8 +416,8 @@
if (target == null) {
throw new TeiidProcessingException(QueryPlugin.Event.TEIID30549, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30549, uuid));
}
- if (this.metadataRepository != null) {
- this.metadataRepository.setProperty(vdbName, vdbVersion, target, key, strVal);
+ if (getMetadataRepository(target, vdb) != null) {
+ getMetadataRepository(target, vdb).setProperty(vdbName, vdbVersion, target, key, strVal);
}
result = target.setProperty(key, strVal);
if (eventDistributor != null) {
@@ -457,8 +460,8 @@
columnStats.setNullValues(nullVals);
columnStats.setMaximumValue(max);
columnStats.setMinimumValue(min);
- if (this.metadataRepository != null) {
- this.metadataRepository.setColumnStats(vdbName, vdbVersion, c, columnStats);
+ if (getMetadataRepository(table, vdb) != null) {
+ getMetadataRepository(table, vdb).setColumnStats(vdbName, vdbVersion, c, columnStats);
}
c.setColumnStats(columnStats);
if (eventDistributor != null) {
@@ -470,8 +473,8 @@
int cardinality = (Integer)val.getValue();
TableStats tableStats = new TableStats();
tableStats.setCardinality(cardinality);
- if (this.metadataRepository != null) {
- this.metadataRepository.setTableStats(vdbName, vdbVersion, table, tableStats);
+ if (getMetadataRepository(table, vdb) != null) {
+ getMetadataRepository(table, vdb).setTableStats(vdbName, vdbVersion, table, tableStats);
}
table.setCardinality(cardinality);
if (eventDistributor != null) {
@@ -499,6 +502,33 @@
}
return new CollectionTupleSource(rows.iterator());
}
+
+ public MetadataRepository getMetadataRepository(AbstractMetadataRecord target, VDBMetaData vdb) {
+ String modelName = null;
+
+ if (target instanceof Schema) {
+ modelName = ((Schema)target).getName();
+ }
+ else if (target instanceof Table) {
+ modelName = ((Table)target).getParent().getName();
+ }
+ else if (target instanceof Procedure) {
+ modelName = ((Procedure)target).getParent().getName();
+ }
+ else if (target instanceof FunctionMethod) {
+ modelName = ((FunctionMethod)target).getParent().getName();
+ }
+ else if (target instanceof Column || target instanceof ProcedureParameter) {
+ AbstractMetadataRecord record = ((Column)target).getParent();
+ return getMetadataRepository(record, vdb);
+ }
+
+ if (modelName != null) {
+ ModelMetaData model = vdb.getModel(modelName);
+ return model.getAttachment(MetadataRepository.class);
+ }
+ return null;
+ }
//TODO: do better than a linear search
public static AbstractMetadataRecord getByUuid(CompositeMetadataStore metadata,
Modified: trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -613,6 +613,36 @@
TEIID30580,
TEIID30581,
TEIID30590,
- TEIID30600, TEIID30601 //User defined aggregate errors
+ TEIID30591,
+ TEIID30600, TEIID30601, //User defined aggregate errors
+
+ TEIID31069,
+ TEIID31070,
+ TEIID31071,
+ TEIID31072,
+ TEIID31073,
+ TEIID31074,
+ TEIID31075,
+ TEIID31076,
+ TEIID31077,
+ TEIID31078,
+ TEIID31079,
+ TEIID31080,
+ TEIID31081,
+ TEIID31082,
+ TEIID31083,
+ TEIID31084,
+ TEIID31085,
+ TEIID31086,
+ TEIID31087,
+ TEIID31088,
+ TEIID31089,
+ TEIID31090,
+ TEIID31091,
+ TEIID31092,
+ TEIID31093,
+ TEIID31094,
+ TEIID31095,
+
}
}
Property changes on: trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/7.4.x/engine/src/main/java/org/teiid/query/QueryPlugin.java:3535-3555
/branches/7.6.x/engine/src/main/java/org/teiid/query/QueryPlugin.java:3673-3711,3754-3769
/branches/7.7.x/engine/src/main/java/org/teiid/query/QueryPlugin.java:3816-3868,3876-3915
/trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java:3507-3666
+ /branches/7.4.x/engine/src/main/java/org/teiid/query/QueryPlugin.java:3535-3555
/branches/7.6.x/engine/src/main/java/org/teiid/query/QueryPlugin.java:3673-3711,3754-3769
/branches/7.7.x/engine/src/main/java/org/teiid/query/QueryPlugin.java:3816-3868
/trunk/engine/src/main/java/org/teiid/query/QueryPlugin.java:3507-3666
Added: trunk/engine/src/main/java/org/teiid/query/metadata/BaseMetadataRepository.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/BaseMetadataRepository.java (rev 0)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/BaseMetadataRepository.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.query.metadata;
+
+import org.teiid.metadata.AbstractMetadataRecord;
+import org.teiid.metadata.Column;
+import org.teiid.metadata.ColumnStats;
+import org.teiid.metadata.MetadataRepository;
+import org.teiid.metadata.Procedure;
+import org.teiid.metadata.Table;
+import org.teiid.metadata.Table.TriggerEvent;
+import org.teiid.metadata.TableStats;
+
+public abstract class BaseMetadataRepository<F, C> implements MetadataRepository {
+
+ @Override
+ public void setViewDefinition(String vdbName, int vdbVersion, Table table,
+ String viewDefinition) {
+ }
+
+ @Override
+ public void setInsteadOfTriggerDefinition(String vdbName, int vdbVersion,
+ Table table, TriggerEvent triggerOperation, String triggerDefinition) {
+ }
+
+ @Override
+ public void setInsteadOfTriggerEnabled(String vdbName, int vdbVersion,
+ Table table, TriggerEvent triggerOperation, boolean enabled) {
+ }
+
+ @Override
+ public void setProcedureDefinition(String vdbName, int vdbVersion,
+ Procedure procedure, String procedureDefinition) {
+ }
+
+ @Override
+ public void setTableStats(String vdbName, int vdbVersion, Table table,
+ TableStats tableStats) {
+ }
+
+ @Override
+ public void setColumnStats(String vdbName, int vdbVersion, Column column,
+ ColumnStats columnStats) {
+ }
+
+ @Override
+ public void setProperty(String vdbName, int vdbVersion,
+ AbstractMetadataRecord record, String name, String value) {
+ }
+
+}
Property changes on: trunk/engine/src/main/java/org/teiid/query/metadata/BaseMetadataRepository.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/engine/src/main/java/org/teiid/query/metadata/CompositeMetadataStore.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/CompositeMetadataStore.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/CompositeMetadataStore.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -42,40 +42,29 @@
* Aggregates the metadata from multiple stores.
*/
public class CompositeMetadataStore extends MetadataStore {
-
+ private static final long serialVersionUID = 6868525815774998010L;
+
public CompositeMetadataStore(MetadataStore metadataStore) {
- addMetadataStore(metadataStore);
+ merge(metadataStore);
}
public CompositeMetadataStore(List<MetadataStore> metadataStores) {
for (MetadataStore metadataStore : metadataStores) {
- addMetadataStore(metadataStore);
+ merge(metadataStore);
}
}
- public void addMetadataStore(MetadataStore metadataStore) {
- this.schemas.putAll(metadataStore.getSchemas());
- this.schemaList.addAll(metadataStore.getSchemaList());
- this.datatypes.addAll(metadataStore.getDatatypes());
- }
-
- public Schema getSchema(String fullName)
- throws QueryMetadataException {
- Schema result = getSchemas().get(fullName);
- if (result == null) {
- throw new QueryMetadataException(QueryPlugin.Event.TEIID30352, fullName+TransformationMetadata.NOT_EXISTS_MESSAGE);
- }
- return result;
- }
-
- public Table findGroup(String fullName)
- throws QueryMetadataException {
+ public Table findGroup(String fullName) throws QueryMetadataException {
int index = fullName.indexOf(TransformationMetadata.DELIMITER_STRING);
if (index == -1) {
throw new QueryMetadataException(QueryPlugin.Event.TEIID30353, fullName+TransformationMetadata.NOT_EXISTS_MESSAGE);
}
- String schema = fullName.substring(0, index);
- Table result = getSchema(schema).getTables().get(fullName.substring(index + 1));
+ String schemaName = fullName.substring(0, index);
+ Schema schema = getSchema(schemaName);
+ if (schema == null ) {
+ throw new QueryMetadataException(QueryPlugin.Event.TEIID30352, fullName+TransformationMetadata.NOT_EXISTS_MESSAGE);
+ }
+ Table result = schema.getTables().get(fullName.substring(index + 1));
if (result == null) {
throw new QueryMetadataException(QueryPlugin.Event.TEIID30354, fullName+TransformationMetadata.NOT_EXISTS_MESSAGE);
}
@@ -117,13 +106,16 @@
return true;
}
- public Collection<Procedure> getStoredProcedure(String name)
- throws TeiidComponentException, QueryMetadataException {
+ public Collection<Procedure> getStoredProcedure(String name) throws TeiidComponentException, QueryMetadataException {
List<Procedure> result = new LinkedList<Procedure>();
int index = name.indexOf(TransformationMetadata.DELIMITER_STRING);
if (index > -1) {
- String schema = name.substring(0, index);
- Procedure proc = getSchema(schema).getProcedures().get(name.substring(index + 1));
+ String schemaName = name.substring(0, index);
+ Schema schema = getSchema(schemaName);
+ if (schema == null ) {
+ throw new QueryMetadataException(QueryPlugin.Event.TEIID30352, name+TransformationMetadata.NOT_EXISTS_MESSAGE);
+ }
+ Procedure proc = schema.getProcedures().get(name.substring(index + 1));
if (proc != null) {
result.add(proc);
return result;
Added: trunk/engine/src/main/java/org/teiid/query/metadata/DDLMetadataRepository.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/DDLMetadataRepository.java (rev 0)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/DDLMetadataRepository.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with 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.metadata;
+
+import org.teiid.metadata.MetadataFactory;
+import org.teiid.query.parser.ParseException;
+import org.teiid.query.parser.QueryParser;
+import org.teiid.translator.ExecutionFactory;
+import org.teiid.translator.TranslatorException;
+
+public class DDLMetadataRepository extends BaseMetadataRepository {
+
+ @Override
+ public void loadMetadata(MetadataFactory factory, ExecutionFactory exeuctionFactory, Object connectionFactory) throws TranslatorException {
+ try {
+ QueryParser.getQueryParser().parseDDL(factory, factory.getRawMetadata());
+ } catch (ParseException e) {
+ throw new TranslatorException(e.getMessage());
+ }
+ }
+}
Property changes on: trunk/engine/src/main/java/org/teiid/query/metadata/DDLMetadataRepository.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/engine/src/main/java/org/teiid/query/metadata/MetadataValidator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/MetadataValidator.java (rev 0)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/MetadataValidator.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -0,0 +1,394 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with 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.metadata;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.UUID;
+
+import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.api.exception.query.QueryParserException;
+import org.teiid.api.exception.query.QueryResolverException;
+import org.teiid.api.exception.query.QueryValidatorException;
+import org.teiid.core.TeiidComponentException;
+import org.teiid.language.SQLConstants;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.metadata.AbstractMetadataRecord;
+import org.teiid.metadata.Column;
+import org.teiid.metadata.Datatype;
+import org.teiid.metadata.ForeignKey;
+import org.teiid.metadata.FunctionMethod;
+import org.teiid.metadata.KeyRecord;
+import org.teiid.metadata.MetadataStore;
+import org.teiid.metadata.Procedure;
+import org.teiid.metadata.Schema;
+import org.teiid.metadata.Table;
+import org.teiid.query.QueryPlugin;
+import org.teiid.query.function.metadata.FunctionMetadataValidator;
+import org.teiid.query.mapping.relational.QueryNode;
+import org.teiid.query.parser.QueryParser;
+import org.teiid.query.report.ActivityReport;
+import org.teiid.query.report.ReportItem;
+import org.teiid.query.resolver.QueryResolver;
+import org.teiid.query.sql.lang.Command;
+import org.teiid.query.sql.lang.Query;
+import org.teiid.query.sql.lang.QueryCommand;
+import org.teiid.query.sql.symbol.Expression;
+import org.teiid.query.sql.symbol.GroupSymbol;
+import org.teiid.query.sql.symbol.Symbol;
+import org.teiid.query.validator.Validator;
+import org.teiid.query.validator.ValidatorFailure;
+import org.teiid.query.validator.ValidatorReport;
+import org.teiid.translator.TranslatorException;
+
+public class MetadataValidator {
+
+ interface MetadataRule {
+ void execute(VDBMetaData vdb, MetadataStore vdbStore, ValidatorReport report);
+ }
+
+ public static ValidatorReport validate(VDBMetaData vdb, MetadataStore store) {
+ ValidatorReport report = new ValidatorReport();
+ if (store != null && !store.getSchemaList().isEmpty()) {
+ new SourceModelArtifacts().execute(vdb, store, report);
+ new ResolveQueryPlans().execute(vdb, store, report);
+ new CrossSchemaResolver().execute(vdb, store, report);
+ new MinimalMetadata().execute(vdb, store, report);
+ }
+ return report;
+ }
+
+ // At minimum the model must have table/view, procedure or function
+ static class MinimalMetadata implements MetadataRule {
+ @Override
+ public void execute(VDBMetaData vdb, MetadataStore store, ValidatorReport report) {
+ for (Schema schema:store.getSchemas().values()) {
+ ModelMetaData model = vdb.getModel(schema.getName());
+
+ if (schema.getTables().isEmpty()
+ && schema.getProcedures().isEmpty()
+ && schema.getFunctions().isEmpty()) {
+ log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31070, model.getName()));
+ }
+
+ for (Table t:schema.getTables().values()) {
+ if (t.getColumns() == null || t.getColumns().size() == 0) {
+ log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31071, t.getName()));
+ }
+ }
+
+ // procedure validation is handled in parsing routines.
+
+ if (!schema.getFunctions().isEmpty()) {
+ ActivityReport<ReportItem> funcReport = new ActivityReport<ReportItem>("Translator metadata load " + model.getName()); //$NON-NLS-1$
+ FunctionMetadataValidator.validateFunctionMethods(schema.getFunctions().values(),report);
+ if(report.hasItems()) {
+ log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31073, funcReport));
+ }
+ }
+ }
+ }
+ }
+
+ // do not allow foreign tables, source functions in view model and vice versa
+ static class SourceModelArtifacts implements MetadataRule {
+ @Override
+ public void execute(VDBMetaData vdb, MetadataStore store, ValidatorReport report) {
+ for (Schema schema:store.getSchemas().values()) {
+ ModelMetaData model = vdb.getModel(schema.getName());
+ for (Table t:schema.getTables().values()) {
+ if (t.isVirtual() && model.isSource()) {
+ log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31074, t.getName(), model.getName()));
+ }
+
+ if (t.isPhysical() && !model.isSource()) {
+ log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31075, t.getName(), model.getName()));
+ }
+ }
+
+ for (Procedure p:schema.getProcedures().values()) {
+ if (p.isVirtual() && model.isSource()) {
+ log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31076, p.getName(), model.getName()));
+ }
+
+ if (!p.isVirtual() && !model.isSource()) {
+ log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31077, p.getName(), model.getName()));
+ }
+ }
+
+ for (FunctionMethod func:schema.getFunctions().values()) {
+ if (func.getPushdown().equals(FunctionMethod.PushDown.MUST_PUSHDOWN) && !model.isSource()) {
+ log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31078, func.getName(), model.getName()));
+ }
+ }
+ }
+ }
+ }
+
+ // Resolves metadata query plans to make sure they are accurate
+ static class ResolveQueryPlans implements MetadataRule {
+ @Override
+ public void execute(VDBMetaData vdb, MetadataStore store, ValidatorReport report) {
+ for (Schema schema:store.getSchemas().values()) {
+ ModelMetaData model = vdb.getModel(schema.getName());
+
+ for (Table t:schema.getTables().values()) {
+ if (t.isVirtual()) {
+ if (t.getSelectTransformation() == null) {
+ log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31079, t.getName(), model.getName()));
+ }
+ validate(vdb, model, t, store, report);
+ }
+ }
+
+ for (Procedure p:schema.getProcedures().values()) {
+ if (p.isVirtual() && !p.isFunction()) {
+ if (p.getQueryPlan() == null) {
+ log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31081, p.getName(), model.getName()));
+ }
+ validate(vdb, model, p, store, report);
+ }
+ }
+ }
+ }
+ }
+
+ private static void log(ValidatorReport report, ModelMetaData model, String msg) {
+ model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), msg);
+ LogManager.logInfo(LogConstants.CTX_QUERY_RESOLVER, msg);
+ report.handleValidationError(msg);
+ }
+
+ private static void validate(VDBMetaData vdb, ModelMetaData model, AbstractMetadataRecord record, MetadataStore store, ValidatorReport report) {
+ QueryMetadataInterface metadata = vdb.getAttachment(QueryMetadataInterface.class);
+ ValidatorReport resolverReport = null;
+ try {
+ if (record instanceof Procedure) {
+ Procedure p = (Procedure)record;
+ Command command = QueryParser.getQueryParser().parseCommand(p.getQueryPlan());
+ QueryResolver.resolveCommand(command, new GroupSymbol(p.getFullName()), Command.TYPE_STORED_PROCEDURE, metadata);
+ resolverReport = Validator.validate(command, metadata);
+ }
+ if (record instanceof Table) {
+ Table t = (Table)record;
+
+ if (t.isVirtual() && (t.getColumns() == null || t.getColumns().isEmpty())) {
+ QueryCommand command = (QueryCommand)QueryParser.getQueryParser().parseCommand(t.getSelectTransformation());
+ QueryResolver.resolveCommand(command, metadata);
+ resolverReport = Validator.validate(command, metadata);
+ if(!resolverReport.hasItems()) {
+ List<Expression> symbols = command.getProjectedSymbols();
+ for (Expression column:symbols) {
+ try {
+ addColumn(Symbol.getShortName(column), getDataType(store.getDatatypes(), column.getType()), t);
+ } catch (TranslatorException e) {
+ log(report, model, e.getMessage());
+ }
+ }
+ }
+ }
+
+ Query command = (Query)QueryParser.getQueryParser().parseCommand("SELECT * FROM "+t.getFullName()); //$NON-NLS-1$
+ QueryResolver.resolveCommand(command, metadata);
+ GroupSymbol resolvedGroup = command.getFrom().getGroups().get(0);
+
+ // this seems to parse, resolve and validate.
+ QueryResolver.resolveView(resolvedGroup, new QueryNode(t.getSelectTransformation()), SQLConstants.Reserved.SELECT, metadata);
+ }
+ if(resolverReport != null && resolverReport.hasItems()) {
+ for (ValidatorFailure v:resolverReport.getItems()) {
+ if (v.getStatus() == ValidatorFailure.Status.ERROR) {
+ log(report, model, v.getMessage());
+ }
+ }
+ }
+ } catch (QueryParserException e) {
+ log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31080, record.getFullName(), e.getFullMessage()));
+ } catch (QueryResolverException e) {
+ log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31080, record.getFullName(), e.getFullMessage()));
+ } catch (TeiidComponentException e) {
+ log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31080, record.getFullName(), e.getFullMessage()));
+ } catch (QueryValidatorException e) {
+ log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31080, record.getFullName(), e.getFullMessage()));
+ }
+ }
+
+ private static Datatype getDataType(Collection<Datatype> dataTypes, Class clazz) {
+ for (Datatype type:dataTypes) {
+ if (type.getJavaClassName().equals(clazz.getName())) {
+ return type;
+ }
+ }
+ return null;
+ }
+
+ private static Column addColumn(String name, Datatype type, Table table) throws TranslatorException {
+ Column column = new Column();
+ column.setName(name);
+ if (table.getColumns() != null) {
+ for (Column c:table.getColumns()) {
+ if (c.getName().equalsIgnoreCase(name)) {
+ throw new TranslatorException(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31087, name, table.getFullName()));
+ }
+ }
+ }
+ table.addColumn(column);
+ column.setPosition(table.getColumns().size()); //1 based indexing
+ if (type == null) {
+ throw new TranslatorException(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31086, name, table.getFullName()));
+ }
+ column.setDatatype(type);
+ column.setDatatypeUUID(type.getUUID());
+ column.setLength(type.getLength());
+ column.setPrecision(type.getPrecisionLength());
+ column.setRadix(type.getRadix());
+ column.setRuntimeType(type.getRuntimeTypeName());
+ column.setCaseSensitive(type.isCaseSensitive());
+ column.setAutoIncremented(type.isAutoIncrement());
+ column.setSigned(type.isSigned());
+ column.setUUID("mmuuid:" +UUID.randomUUID()); //$NON-NLS-1$
+ return column;
+ }
+
+ // this class resolves the artifacts that are dependent upon objects from other schemas
+ // materialization sources, fk and data types (coming soon..)
+ static class CrossSchemaResolver implements MetadataRule {
+
+ private boolean keyMatches(List<String> names, KeyRecord record) {
+ if (names.size() != record.getColumns().size()) {
+ return false;
+ }
+ for (int i = 0; i < names.size(); i++) {
+ if (!names.get(i).equals(record.getColumns().get(i).getName())) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public void execute(VDBMetaData vdb, MetadataStore store, ValidatorReport report) {
+ for (Schema schema:store.getSchemas().values()) {
+ ModelMetaData model = vdb.getModel(schema.getName());
+
+ for (Table t:schema.getTables().values()) {
+ if (t.isVirtual()) {
+ if (t.isMaterialized() && t.getMaterializedTable() != null) {
+ String matTableName = t.getMaterializedTable().getName();
+ int index = matTableName.indexOf(Table.NAME_DELIM_CHAR);
+ if (index == -1) {
+ log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31088, matTableName, t.getName()));
+ }
+ else {
+ String schemaName = matTableName.substring(0, index);
+ Schema matSchema = store.getSchema(schemaName);
+ if (matSchema == null) {
+ log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31089, schemaName, matTableName, t.getName()));
+ }
+ else {
+ Table matTable = matSchema.getTable(matTableName.substring(index+1));
+ if (matTable == null) {
+ log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31090, matTableName.substring(index+1), schemaName, t.getName()));
+ }
+ else {
+ t.setMaterializedTable(matTable);
+ }
+ }
+ }
+ }
+ }
+
+ List<ForeignKey> fks = t.getForeignKeys();
+ if (fks == null || fks.isEmpty()) {
+ continue;
+ }
+
+ for (ForeignKey fk:fks) {
+ if (fk.getPrimaryKey() != null) {
+ continue;
+ }
+
+ String referenceTableName = fk.getReferenceTableName();
+ if (referenceTableName == null && fk.getPrimaryKey() == null){
+ log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31091, t.getName()));
+ continue;
+ }
+
+ Table referenceTable = null;
+ String referenceSchemaName = schema.getName();
+ int index = referenceTableName.indexOf(Table.NAME_DELIM_CHAR);
+ if (index == -1) {
+ referenceTable = schema.getTable(referenceTableName);
+ }
+ else {
+ referenceSchemaName = referenceTableName.substring(0, index);
+ Schema referenceSchema = store.getSchema(referenceSchemaName);
+ if (referenceSchema == null) {
+ log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31093, referenceSchemaName, t.getName()));
+ continue;
+ }
+ referenceTable = referenceSchema.getTable(referenceTableName.substring(index+1));
+ }
+
+ if (referenceTable == null) {
+ log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31092, t.getName(), referenceTableName.substring(index+1), referenceSchemaName));
+ continue;
+ }
+
+ KeyRecord uniqueKey = null;
+ if (fk.getReferenceColumns() == null || fk.getReferenceColumns().isEmpty()) {
+ if (referenceTable.getPrimaryKey() == null) {
+ log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31094, t.getName(), referenceTableName.substring(index+1), referenceSchemaName));
+ }
+ else {
+ uniqueKey = referenceTable.getPrimaryKey();
+ }
+
+ } else {
+ for (KeyRecord record : referenceTable.getUniqueKeys()) {
+ if (keyMatches(fk.getReferenceColumns(), record)) {
+ uniqueKey = record;
+ break;
+ }
+ }
+ if (uniqueKey == null && referenceTable.getPrimaryKey() != null && keyMatches(fk.getReferenceColumns(), referenceTable.getPrimaryKey())) {
+ uniqueKey = referenceTable.getPrimaryKey();
+ }
+ }
+ if (uniqueKey == null) {
+ log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31095, t.getName(), referenceTableName.substring(index+1), referenceSchemaName, fk.getReferenceColumns()));
+ }
+ else {
+ fk.setPrimaryKey(uniqueKey);
+ fk.setUniqueKeyID(uniqueKey.getUUID());
+ }
+ }
+ }
+ }
+
+ }
+ }
+
+
+}
Property changes on: trunk/engine/src/main/java/org/teiid/query/metadata/MetadataValidator.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/engine/src/main/java/org/teiid/query/metadata/NativeMetadataRepository.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/NativeMetadataRepository.java (rev 0)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/NativeMetadataRepository.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.query.metadata;
+
+import javax.resource.ResourceException;
+
+import org.teiid.metadata.MetadataFactory;
+import org.teiid.metadata.Table;
+import org.teiid.query.QueryPlugin;
+import org.teiid.query.function.metadata.FunctionMetadataValidator;
+import org.teiid.query.report.ActivityReport;
+import org.teiid.query.report.ReportItem;
+import org.teiid.resource.spi.WrappedConnection;
+import org.teiid.translator.ExecutionFactory;
+import org.teiid.translator.TranslatorException;
+
+public class NativeMetadataRepository extends BaseMetadataRepository {
+
+ @Override
+ public void loadMetadata(MetadataFactory factory, ExecutionFactory executionFactory, Object connectionFactory) throws TranslatorException {
+
+ if (executionFactory == null ) {
+ throw new TranslatorException(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30591, factory.getName()));
+ }
+
+ Object connection = executionFactory.getConnection(connectionFactory, null);
+ Object unwrapped = null;
+
+ if (connection instanceof WrappedConnection) {
+ try {
+ unwrapped = ((WrappedConnection)connection).unwrap();
+ } catch (ResourceException e) {
+ throw new TranslatorException(QueryPlugin.Event.TEIID30480, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30480));
+ }
+ }
+
+ try {
+ executionFactory.getMetadata(factory, (unwrapped == null) ? connection:unwrapped);
+ } finally {
+ executionFactory.closeConnection(connection, connectionFactory);
+ }
+ validateMetadata(factory);
+ }
+
+ private void validateMetadata(MetadataFactory schema) throws TranslatorException {
+ for (Table t : schema.getTables().values()) {
+ if (t.getColumns() == null || t.getColumns().size() == 0) {
+ throw new TranslatorException(QueryPlugin.Event.TEIID30580, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30580, t.getFullName()));
+ }
+ }
+ ActivityReport<ReportItem> report = new ActivityReport<ReportItem>("Translator metadata load " + schema.getName()); //$NON-NLS-1$
+ FunctionMetadataValidator.validateFunctionMethods(schema.getFunctions().values(),report);
+ if(report.hasItems()) {
+ throw new TranslatorException(QueryPlugin.Util.getString("ERR.015.001.0005", report)); //$NON-NLS-1$
+ }
+ }
+}
Property changes on: trunk/engine/src/main/java/org/teiid/query/metadata/NativeMetadataRepository.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/engine/src/main/java/org/teiid/query/parser/QueryParser.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/parser/QueryParser.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/engine/src/main/java/org/teiid/query/parser/QueryParser.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -30,6 +30,7 @@
import java.util.List;
import org.teiid.api.exception.query.QueryParserException;
+import org.teiid.metadata.MetadataFactory;
import org.teiid.query.QueryPlugin;
import org.teiid.query.sql.lang.CacheHint;
import org.teiid.query.sql.lang.Command;
@@ -343,5 +344,10 @@
}
return new QueryParserException(QueryPlugin.Util.getString("QueryParser.parsingError", tme.getMessage())); //$NON-NLS-1$
}
+
+ public void parseDDL(MetadataFactory factory, String ddl) throws ParseException {
+ getSqlParser(ddl).parseMetadata(factory);
+ SQLParserUtil.replaceProceduresWithFunctions(factory);
+ }
}
Modified: trunk/engine/src/main/java/org/teiid/query/parser/SQLParserUtil.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/parser/SQLParserUtil.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/engine/src/main/java/org/teiid/query/parser/SQLParserUtil.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -22,9 +22,11 @@
package org.teiid.query.parser;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -32,10 +34,19 @@
import org.teiid.core.util.PropertiesUtils;
import org.teiid.core.util.StringUtil;
import org.teiid.language.SQLConstants.Reserved;
+import org.teiid.metadata.Column;
+import org.teiid.metadata.FunctionMethod;
+import org.teiid.metadata.FunctionParameter;
+import org.teiid.metadata.MetadataFactory;
+import org.teiid.metadata.Procedure;
+import org.teiid.metadata.ProcedureParameter;
+import org.teiid.metadata.Table;
import org.teiid.query.QueryPlugin;
import org.teiid.query.function.FunctionMethods;
+import org.teiid.query.sql.lang.AlterTrigger;
import org.teiid.query.sql.lang.CacheHint;
import org.teiid.query.sql.lang.CompareCriteria;
+import org.teiid.query.sql.lang.ExistsCriteria.SubqueryHint;
import org.teiid.query.sql.lang.FromClause;
import org.teiid.query.sql.lang.JoinType;
import org.teiid.query.sql.lang.Limit;
@@ -43,9 +54,10 @@
import org.teiid.query.sql.lang.QueryCommand;
import org.teiid.query.sql.lang.SetQuery;
import org.teiid.query.sql.lang.SourceHint;
-import org.teiid.query.sql.lang.ExistsCriteria.SubqueryHint;
import org.teiid.query.sql.proc.Block;
import org.teiid.query.sql.proc.Statement;
+import org.teiid.query.sql.symbol.GroupSymbol;
+import org.teiid.translator.TranslatorException;
public class SQLParserUtil {
@@ -349,4 +361,282 @@
return new Block(stmt);
}
+ void setColumnOption(Column c, String k, String v){
+ int index = k.indexOf(':');
+ if ( index != -1) {
+ k = k.substring(index+1);
+ }
+ if(k.equalsIgnoreCase("UUID")) { //$NON-NLS-1$
+ c.setUUID(v);
+ }
+ else if(k.equalsIgnoreCase("NAMEINSOURCE")) { //$NON-NLS-1$
+ c.setNameInSource(v);
+ }
+ else if(k.equalsIgnoreCase("CASE_SENSITIVE")) { //$NON-NLS-1$
+ c.setCaseSensitive(isTrue(v));
+ }
+ else if(k.equalsIgnoreCase("SELECTABLE")) { //$NON-NLS-1$
+ c.setSelectable(isTrue(v));
+ }
+ else if(k.equalsIgnoreCase("UPDATABLE")) { //$NON-NLS-1$
+ c.setUpdatable(isTrue(v));
+ }
+ else if(k.equalsIgnoreCase("SIGNED")) { //$NON-NLS-1$
+ c.setSigned(isTrue(v));
+ }
+ else if(k.equalsIgnoreCase("CURRENCY")) { //$NON-NLS-1$
+ c.setSigned(isTrue(v));
+ }
+ else if(k.equalsIgnoreCase("FIXED_LENGTH")) { //$NON-NLS-1$
+ c.setFixedLength(isTrue(v));
+ }
+ else if(k.equalsIgnoreCase("SEARCHABLE")) { //$NON-NLS-1$
+ //'YES|NO|LIKE_ONLY|ALL_EXCEPT_LIKE'
+ if (v.equalsIgnoreCase("YES")){//$NON-NLS-1$
+ c.setSearchType(Column.SearchType.Searchable);
+ }
+ else if (v.equalsIgnoreCase("NO")){//$NON-NLS-1$
+ c.setSearchType(Column.SearchType.Unsearchable);
+ }
+ else if (v.equalsIgnoreCase("LIKE_ONLY")){ //$NON-NLS-1$
+ c.setSearchType(Column.SearchType.Like_Only);
+ }
+ else if (v.equalsIgnoreCase("ALL_EXCEPT_LIKE")){ //$NON-NLS-1$
+ c.setSearchType(Column.SearchType.All_Except_Like);
+ }
+ }
+ else if(k.equalsIgnoreCase("MIN_VALUE")) { //$NON-NLS-1$
+ c.setMinimumValue(v);
+ }
+ else if(k.equalsIgnoreCase("MAX_VALUE")) { //$NON-NLS-1$
+ c.setMaximumValue(v);
+ }
+ else if(k.equalsIgnoreCase("CHAR_OCTET_LENGTH")) { //$NON-NLS-1$
+ c.setCharOctetLength(Integer.parseInt(v));
+ }
+ else if(k.equalsIgnoreCase("ANNOTATION")) { //$NON-NLS-1$
+ c.setAnnotation(v);
+ }
+ else if(k.equalsIgnoreCase("NATIVE_TYPE")) { //$NON-NLS-1$
+ c.setNativeType(v);
+ }
+ else if(k.equalsIgnoreCase("RADIX")) { //$NON-NLS-1$
+ c.setRadix(Integer.parseInt(v));
+ }
+ else if(k.equalsIgnoreCase("NULL_VALUE_COUNT")) { //$NON-NLS-1$
+ c.setNullValues(Integer.parseInt(v));
+ }
+ else if(k.equalsIgnoreCase("DISTINCT_VALUES")) { //$NON-NLS-1$
+ c.setDistinctValues(Integer.parseInt(v));
+ }
+ else {
+ c.setProperty(k, v);
+ }
+ }
+
+ void setTableOption(Table table, String k, String value) {
+ int index = k.indexOf(':');
+ if ( index != -1) {
+ k = k.substring(index+1);
+ }
+ if(k.equalsIgnoreCase("UUID")) { //$NON-NLS-1$
+ table.setUUID(value);
+ }
+ else if(k.equalsIgnoreCase("NAMEINSOURCE")) { //$NON-NLS-1$
+ table.setNameInSource(value);
+ }
+ else if(k.equalsIgnoreCase("MATERIALIZED")) { //$NON-NLS-1$
+ table.setMaterialized(isTrue(value));
+ }
+ else if(k.equalsIgnoreCase("MATERIALIZED_TABLE")) { //$NON-NLS-1$
+ Table mattable = new Table();
+ mattable.setName(value);
+ table.setMaterializedTable(mattable);
+ }
+ else if(k.equalsIgnoreCase("UPDATABLE")) { //$NON-NLS-1$
+ table.setSupportsUpdate(isTrue(value));
+ }
+ else if(k.equalsIgnoreCase("ANNOTATION")) { //$NON-NLS-1$
+ table.setAnnotation(value);
+ }
+ else if(k.equalsIgnoreCase("CARDINALITY")) { //$NON-NLS-1$
+ table.setCardinality(Integer.parseInt(value));
+ }
+ else {
+ table.setProperty(k, value);
+ }
+ }
+
+ static void replaceProceduresWithFunctions(MetadataFactory factory) throws ParseException {
+ ArrayList<String> procs = new ArrayList<String>();
+
+ for (Procedure proc: factory.getProcedures().values()) {
+ if (!proc.isFunction()) {
+ continue;
+ }
+
+ procs.add(proc.getName());
+
+ FunctionMethod method = new FunctionMethod();
+ method.setName(proc.getName());
+ method.setPushdown(proc.isVirtual()?FunctionMethod.PushDown.CAN_PUSHDOWN:FunctionMethod.PushDown.MUST_PUSHDOWN);
+
+ ArrayList<FunctionParameter> ins = new ArrayList<FunctionParameter>();
+ for (ProcedureParameter pp:proc.getParameters()) {
+ if (pp.getType() != ProcedureParameter.Type.In) {
+ throw new ParseException("Functions can only support 'In' parameters"); //$NON-NLS-1$
+ }
+
+ FunctionParameter fp = new FunctionParameter(pp.getName(), pp.getDatatype().getName());
+ fp.setVarArg(pp.isVarArg());
+ ins.add(fp);
+ }
+ method.setInputParameters(ins);
+
+ List<Column> returnCols = proc.getResultSet().getColumns();
+ if (returnCols != null && !returnCols.isEmpty()) {
+ if (returnCols.size() > 1) {
+ throw new ParseException("Functions can only return single parameter"); //$NON-NLS-1$
+ }
+ Column c = returnCols.get(0);
+ FunctionParameter fp = new FunctionParameter(c.getName(), c.getDatatype().getName());
+ method.setOutputParameter(fp);
+ }
+
+ method.setAnnotation(proc.getAnnotation());
+ method.setNameInSource(proc.getNameInSource());
+ method.setUUID(proc.getUUID());
+
+ Map<String, String> props = proc.getProperties();
+ for (String key:props.keySet()) {
+ String value = props.get(key);
+ if(key.equalsIgnoreCase("CATEGORY")) { //$NON-NLS-1$
+ method.setCategory(value);
+ }
+ else if(key.equalsIgnoreCase("DETERMINISTIC")) { //$NON-NLS-1$
+ method.setDeterminism(FunctionMethod.Determinism.valueOf(value.toUpperCase()));
+ }
+ else if(key.equalsIgnoreCase("NULLONNULL")) { //$NON-NLS-1$
+ method.setNullOnNull(isTrue(value));
+ }
+ else if(key.equalsIgnoreCase("JAVA_CLASS")) { //$NON-NLS-1$
+ method.setInvocationClass(value);
+ }
+ else if(key.equalsIgnoreCase("JAVA_METHOD")) { //$NON-NLS-1$
+ method.setInvocationMethod(value);
+ }
+ else {
+ method.setProperty(key, value);
+ }
+ }
+
+ factory.addFunction(method);
+ }
+
+ // remove the old procs
+ for (String name:procs) {
+ factory.getProcedures().remove(name);
+ }
+ }
+
+
+ void setProcedureOption(Procedure proc, String k, String value) {
+ int index = k.indexOf(':');
+ if ( index != -1) {
+ k = k.substring(index+1);
+ }
+ if(k.equalsIgnoreCase("UUID")) { //$NON-NLS-1$
+ proc.setUUID(value);
+ }
+ else if(k.equalsIgnoreCase("NAMEINSOURCE")) { //$NON-NLS-1$
+ proc.setNameInSource(value);
+ }
+ else if(k.equalsIgnoreCase("ANNOTATION")) { //$NON-NLS-1$
+ proc.setAnnotation(value);
+ }
+ else if(k.equalsIgnoreCase("UPDATECOUNT")) { //$NON-NLS-1$
+ proc.setUpdateCount(Integer.parseInt(value));
+ }
+ else {
+ proc.setProperty(k, value);
+ }
+ }
+
+ public static boolean isTrue(final String text) {
+ return ("YES".equalsIgnoreCase(text)); //$NON-NLS-1$
+ }
+
+ Column getColumn(String columnName, Table table) {
+ for (Column col:table.getColumns()) {
+ if (col.getName().equalsIgnoreCase(columnName)) {
+ return col;
+ }
+ }
+ return null;
+ }
+
+ void createDDLTrigger(MetadataFactory schema, AlterTrigger trigger) {
+ GroupSymbol group = trigger.getTarget();
+
+ Table table = schema.getTable(group.getName());
+ if (trigger.getEvent().equals(Table.TriggerEvent.INSERT)) {
+ table.setInsertPlan(trigger.getDefinition().toString());
+ }
+ else if (trigger.getEvent().equals(Table.TriggerEvent.UPDATE)) {
+ table.setUpdatePlan(trigger.getDefinition().toString());
+ }
+ else if (trigger.getEvent().equals(Table.TriggerEvent.DELETE)) {
+ table.setDeletePlan(trigger.getDefinition().toString());
+ }
+ }
+
+ void addProcReturnColumn(MetadataFactory factory, Procedure proc, String name, ParsedDataType type) throws ParseException{
+ try {
+ Column column = factory.addProcedureResultSetColumn(name, type.type, proc);
+ if (type.length != null){
+ column.setLength(type.length);
+ }
+ if (type.scale != null){
+ column.setScale(type.scale);
+ }
+ if (type.precision != null){
+ column.setPrecision(type.precision);
+ }
+ } catch (TranslatorException e){
+ throw new ParseException(e.getMessage());
+ }
+ }
+
+ static class ParsedDataType{
+ String type;
+ Integer length;
+ Integer scale;
+ Integer precision;
+
+ public ParsedDataType(String type) {
+ this.type = type;
+ }
+
+ public ParsedDataType(String type, int length, boolean precision) {
+ this.type = type;
+
+ if (precision) {
+ this.precision = length;
+ }
+ else {
+ this.length = length;
+ }
+ }
+
+ public ParsedDataType(String type, int length, int scale, boolean precision) {
+ this.type = type;
+ this.scale = scale;
+ if (precision) {
+ this.precision = length;
+ }
+ else {
+ this.length = length;
+ }
+ }
+ }
}
Modified: trunk/engine/src/main/java/org/teiid/query/processor/DdlPlan.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/DdlPlan.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/engine/src/main/java/org/teiid/query/processor/DdlPlan.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -27,6 +27,7 @@
import java.util.Arrays;
import java.util.List;
+import org.teiid.adminapi.impl.ModelMetaData;
import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.client.plan.PlanNode;
import org.teiid.common.buffer.BlockedException;
@@ -37,6 +38,7 @@
import org.teiid.core.TeiidRuntimeException;
import org.teiid.dqp.internal.process.DQPWorkContext;
import org.teiid.language.SQLConstants;
+import org.teiid.metadata.MetadataRepository;
import org.teiid.metadata.Procedure;
import org.teiid.metadata.Table;
import org.teiid.metadata.Table.TriggerEvent;
@@ -55,13 +57,18 @@
class AlterProcessor extends LanguageVisitor {
DQPWorkContext workContext = DQPWorkContext.getWorkContext();
+ private MetadataRepository getMetadataRepository(VDBMetaData vdb, String schemaName) {
+ ModelMetaData model = vdb.getModel(schemaName);
+ return model.getAttachment(MetadataRepository.class);
+ }
+
@Override
public void visit(AlterView obj) {
VDBMetaData vdb = workContext.getVDB();
Table t = (Table)obj.getTarget().getMetadataID();
String sql = obj.getDefinition().toString();
- if (pdm.getMetadataRepository() != null) {
- pdm.getMetadataRepository().setViewDefinition(workContext.getVdbName(), workContext.getVdbVersion(), t, sql);
+ if (getMetadataRepository(vdb, t.getParent().getName()) != null) {
+ getMetadataRepository(vdb, t.getParent().getName()).setViewDefinition(workContext.getVdbName(), workContext.getVdbVersion(), t, sql);
}
alterView(vdb, t, sql);
if (pdm.getEventDistributor() != null) {
@@ -74,8 +81,8 @@
VDBMetaData vdb = workContext.getVDB();
Procedure p = (Procedure)obj.getTarget().getMetadataID();
String sql = obj.getDefinition().toString();
- if (pdm.getMetadataRepository() != null) {
- pdm.getMetadataRepository().setProcedureDefinition(workContext.getVdbName(), workContext.getVdbVersion(), p, sql);
+ if (getMetadataRepository(vdb, p.getParent().getName()) != null) {
+ getMetadataRepository(vdb, p.getParent().getName()).setProcedureDefinition(workContext.getVdbName(), workContext.getVdbVersion(), p, sql);
}
alterProcedureDefinition(vdb, p, sql);
if (pdm.getEventDistributor() != null) {
@@ -101,11 +108,11 @@
} else if (getPlanForEvent(t, event) == null) {
throw new TeiidRuntimeException(QueryPlugin.Event.TEIID30158, new TeiidProcessingException(QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30158, t.getName(), obj.getEvent())));
}
- if (pdm.getMetadataRepository() != null) {
+ if (getMetadataRepository(vdb, t.getParent().getName()) != null) {
if (sql != null) {
- pdm.getMetadataRepository().setInsteadOfTriggerDefinition(workContext.getVdbName(), workContext.getVdbVersion(), t, obj.getEvent(), sql);
+ getMetadataRepository(vdb, t.getParent().getName()).setInsteadOfTriggerDefinition(workContext.getVdbName(), workContext.getVdbVersion(), t, obj.getEvent(), sql);
} else {
- pdm.getMetadataRepository().setInsteadOfTriggerEnabled(workContext.getVdbName(), workContext.getVdbVersion(), t, obj.getEvent(), obj.getEnabled());
+ getMetadataRepository(vdb, t.getParent().getName()).setInsteadOfTriggerEnabled(workContext.getVdbName(), workContext.getVdbVersion(), t, obj.getEvent(), obj.getEnabled());
}
}
alterInsteadOfTrigger(vdb, t, sql, obj.getEnabled(), event);
Property changes on: trunk/engine/src/main/java/org/teiid/query/processor/DdlPlan.java
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/7.4.x/engine/src/main/java/org/teiid/query/processor/DdlPlan.java:3535-3555
/branches/7.6.x/engine/src/main/java/org/teiid/query/processor/DdlPlan.java:3673-3711,3754-3769
/branches/7.7.x/engine/src/main/java/org/teiid/query/processor/DdlPlan.java:3816-3868,3876-3915
/trunk/engine/src/main/java/org/teiid/query/processor/DdlPlan.java:3507-3666
+ /branches/7.4.x/engine/src/main/java/org/teiid/query/processor/DdlPlan.java:3535-3555
/branches/7.6.x/engine/src/main/java/org/teiid/query/processor/DdlPlan.java:3673-3711,3754-3769
/branches/7.7.x/engine/src/main/java/org/teiid/query/processor/DdlPlan.java:3816-3868
/trunk/engine/src/main/java/org/teiid/query/processor/DdlPlan.java:3507-3666
Modified: trunk/engine/src/main/java/org/teiid/query/processor/ProcessorDataManager.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/ProcessorDataManager.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/engine/src/main/java/org/teiid/query/processor/ProcessorDataManager.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -27,7 +27,6 @@
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
import org.teiid.events.EventDistributor;
-import org.teiid.metadata.MetadataRepository;
import org.teiid.query.sql.lang.Command;
import org.teiid.query.util.CommandContext;
@@ -51,7 +50,4 @@
TeiidComponentException, TeiidProcessingException;
EventDistributor getEventDistributor();
-
- MetadataRepository getMetadataRepository();
-
}
Property changes on: trunk/engine/src/main/java/org/teiid/query/processor/ProcessorDataManager.java
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/7.4.x/engine/src/main/java/org/teiid/query/processor/ProcessorDataManager.java:3535-3555
/branches/7.6.x/engine/src/main/java/org/teiid/query/processor/ProcessorDataManager.java:3673-3711,3754-3769
/branches/7.7.x/engine/src/main/java/org/teiid/query/processor/ProcessorDataManager.java:3816-3868,3876-3915
/trunk/engine/src/main/java/org/teiid/query/processor/ProcessorDataManager.java:3507-3666
+ /branches/7.4.x/engine/src/main/java/org/teiid/query/processor/ProcessorDataManager.java:3535-3555
/branches/7.6.x/engine/src/main/java/org/teiid/query/processor/ProcessorDataManager.java:3673-3711,3754-3769
/branches/7.7.x/engine/src/main/java/org/teiid/query/processor/ProcessorDataManager.java:3816-3868
/trunk/engine/src/main/java/org/teiid/query/processor/ProcessorDataManager.java:3507-3666
Modified: trunk/engine/src/main/java/org/teiid/query/processor/proc/ProcedurePlan.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/proc/ProcedurePlan.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/engine/src/main/java/org/teiid/query/processor/proc/ProcedurePlan.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -180,11 +180,6 @@
}
@Override
- public MetadataRepository getMetadataRepository() {
- return parentDataMrg.getMetadataRepository();
- }
-
- @Override
public EventDistributor getEventDistributor() {
return parentDataMrg.getEventDistributor();
}
Modified: trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableDataManager.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -515,9 +515,4 @@
public EventDistributor getEventDistributor() {
return this.eventDistributor;
}
-
- @Override
- public MetadataRepository getMetadataRepository() {
- return this.processorDataManager.getMetadataRepository();
- }
}
Modified: trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj
===================================================================
--- trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj 2012-03-08 20:03:01 UTC (rev 3922)
@@ -24,6 +24,7 @@
import org.teiid.metadata.*;
import org.teiid.metadata.BaseColumn.NullType;
import org.teiid.language.Like.MatchMode;
+import org.teiid.translator.*;
/**
* <p>The SQLParser is a JavaCC-generated parser that reads a SQL string and produces a
@@ -176,7 +177,7 @@
| <FETCH: "fetch">
| <FILTER: "filter">
| <FOR: "for">
-| <FORIEGN: "foriegn">
+| <FOREIGN: "foreign">
| <FROM: "from">
| <FULL: "full">
| <FUNCTION: "function">
@@ -237,8 +238,10 @@
| <ONLY: "only">
| <OPEN: "open">
| <OPTION: "option">
+| <OPTIONS: "options">
| <OR: "or">
| <ORDER: "order">
+| <OUT: "out">
| <OUTER: "outer">
| <OUTPUT: "output">
| <OVER: "over">
@@ -717,18 +720,18 @@
Column tableElement(ParseInfo info) :
{
String element = null;
- String type = null;
+ ParsedDataType type = null;
boolean autoIncrement = false;
boolean notNull = false;
}
{
element = id()
(
- type = dataTypeString()
+ type = parseDataType()
|
nonReserved("SERIAL")
{
- type = "INTEGER";
+ type = new ParsedDataType("INTEGER");
autoIncrement = true;
notNull = true;
}
@@ -737,7 +740,7 @@
{
Column c = new Column();
c.setName(validateElementName(element));
- c.setRuntimeType(type);
+ c.setRuntimeType(type.type);
c.setAutoIncremented(autoIncrement);
c.setNullType(notNull?NullType.No_Nulls:NullType.Nullable);
return c;
@@ -1176,21 +1179,21 @@
List<TableFunctionReference.ProjectedColumn> createElementsWithTypes(ParseInfo info) :
{
String element = null;
- String type = null;
+ ParsedDataType type = null;
List<TableFunctionReference.ProjectedColumn> elements = new ArrayList<TableFunctionReference.ProjectedColumn>();
}
{
element = id()
- type = dataTypeString()
+ type = parseDataType()
{
- TableFunctionReference.ProjectedColumn symbol = new TableFunctionReference.ProjectedColumn(validateElementName(element), type);
+ TableFunctionReference.ProjectedColumn symbol = new TableFunctionReference.ProjectedColumn(validateElementName(element), type.type);
elements.add(symbol);
}
(LOOKAHEAD(2) <COMMA>
element = id()
- type = dataTypeString()
+ type = parseDataType()
{
- symbol = new TableFunctionReference.ProjectedColumn(validateElementName(element), type);
+ symbol = new TableFunctionReference.ProjectedColumn(validateElementName(element), type.type);
elements.add(symbol);
}
)*
@@ -3889,54 +3892,63 @@
}
}
-String dataTypeString() :
+ParsedDataType parseDataType() :
{
Token typeToken = null;
+ Token lengthToken = null;
+ Token scaleToken = null;
+ boolean precision = true;
}
{
(
- typeToken = <STRING> |
- typeToken = <VARCHAR> |
+ (typeToken = <STRING> ([<LPAREN>lengthToken=<INTEGERVAL><RPAREN>]) {precision = false;} ) |
+ (typeToken = <VARCHAR> ([<LPAREN>lengthToken=<INTEGERVAL><RPAREN>]) {precision = false;} ) |
typeToken = <BOOLEAN> |
- typeToken = <BYTE> |
- typeToken = <TINYINT> |
- typeToken = <SHORT> |
- typeToken = <SMALLINT> |
- typeToken = <CHAR> |
- typeToken = <INTEGER> |
- typeToken = <LONG> |
- typeToken = <BIGINT> |
- typeToken = <BIGINTEGER> |
- typeToken = <FLOAT> |
- typeToken = <REAL> |
- typeToken = <DOUBLE> |
- typeToken = <BIGDECIMAL> |
- typeToken = <DECIMAL> |
+ (typeToken = <BYTE> ([<LPAREN>lengthToken=<INTEGERVAL><RPAREN>]) {precision = false;} ) |
+ (typeToken = <TINYINT> [<LPAREN>lengthToken=<INTEGERVAL><RPAREN>] ) |
+ (typeToken = <SHORT> [<LPAREN>lengthToken=<INTEGERVAL><RPAREN>] ) |
+ (typeToken = <SMALLINT> [<LPAREN>lengthToken=<INTEGERVAL><RPAREN>] ) |
+ (typeToken = <CHAR> ([<LPAREN>lengthToken=<INTEGERVAL><RPAREN>]) {precision = false;} ) |
+ (typeToken = <INTEGER> [<LPAREN>lengthToken=<INTEGERVAL><RPAREN>] ) |
+ (typeToken = <LONG> [<LPAREN>lengthToken=<INTEGERVAL><RPAREN>] ) |
+ (typeToken = <BIGINT> [<LPAREN>lengthToken=<INTEGERVAL><RPAREN>]) |
+ (typeToken = <BIGINTEGER> [<LPAREN>lengthToken=<INTEGERVAL><RPAREN>]) |
+ (typeToken = <FLOAT> [<LPAREN>lengthToken=<INTEGERVAL>[<COMMA>scaleToken=<INTEGERVAL>]<RPAREN>]) |
+ (typeToken = <REAL> [<LPAREN>lengthToken=<INTEGERVAL>[<COMMA>scaleToken=<INTEGERVAL>]<RPAREN>])|
+ (typeToken = <DOUBLE> [<LPAREN>lengthToken=<INTEGERVAL>[<COMMA>scaleToken=<INTEGERVAL>]<RPAREN>])|
+ (typeToken = <BIGDECIMAL> [<LPAREN>lengthToken=<INTEGERVAL>[<COMMA>scaleToken=<INTEGERVAL>]<RPAREN>])|
+ (typeToken = <DECIMAL> [<LPAREN>lengthToken=<INTEGERVAL>[<COMMA>scaleToken=<INTEGERVAL>]<RPAREN>])|
typeToken = <DATE> |
typeToken = <TIME> |
typeToken = <TIMESTAMP> |
typeToken = <OBJECT> |
typeToken = <BLOB> |
typeToken = <CLOB> |
- typeToken = <VARBINARY> |
+ (typeToken = <VARBINARY> ([<LPAREN>lengthToken=<INTEGERVAL><RPAREN>]) {precision = false;} ) |
typeToken = <XML>
)
{
- return typeToken.image;
+ if (scaleToken != null){
+ return new ParsedDataType(typeToken.image, Integer.parseInt(lengthToken.image), Integer.parseInt(scaleToken.image), precision);
+ }
+ else if (scaleToken == null && lengthToken != null){
+ return new ParsedDataType(typeToken.image, Integer.parseInt(lengthToken.image), precision);
+ }
+ return new ParsedDataType(typeToken.image);
}
}
Constant dataType() :
{
- String type = null;
+ ParsedDataType type = null;
}
{
- type = dataTypeString()
+ type = parseDataType()
{
- return new Constant(type);
+ return new Constant(type.type);
}
}
@@ -4038,3 +4050,475 @@
return constant;
}
}
+
+
+
+/*
+ * DDL specific parser
+ */
+
+ void parseMetadata(MetadataFactory factory) :
+{
+}
+{
+ ddlStmts(factory) [<SEMICOLON>] (ddlStmts(factory) [<SEMICOLON>])*
+}
+
+void ddlStmts(MetadataFactory factory) :
+{
+ Command command = null;
+}
+{
+ (LOOKAHEAD(3) createTable(factory) |
+ LOOKAHEAD(4) createDDLProcedure(factory, new ParseInfo()) |
+ LOOKAHEAD(2) createNameSpace(factory) |
+ LOOKAHEAD(4) command=createTrigger(new ParseInfo())
+ {
+ createDDLTrigger(factory, (AlterTrigger)command);
+ }
+ )
+}
+
+void createNameSpace(MetadataFactory factory) :
+{
+ String uri = null;
+ String prefix = null;
+}
+{
+ <SET> nonReserved ("NAMESPACE") uri = stringVal() <AS> prefix = stringVal()
+ {
+ factory.addNamespace(prefix, uri);
+ }
+}
+
+/**
+ * Parse create update procedure command
+ * @throws ParseException if parsing failed
+ */
+CreateProcedureCommand createDDLProcedure(MetadataFactory factory, ParseInfo info) :
+{
+ boolean virtual = false;
+ boolean function = false;
+ Procedure proc = null;
+ String procName = null;
+ CreateProcedureCommand procCmd = new CreateProcedureCommand();
+ Statement stmt = null;
+ ParsedDataType returnDataType = null;
+}
+{
+ <CREATE> [<VIRTUAL> {virtual = true;}] (<PROCEDURE> | <FUNCTION> {function = true;})
+ //the below is optional beacuse to allow the designer based metadata
+ ( procName = id()
+ {
+ try {
+ proc = factory.addProcedure(procName);
+ } catch(TranslatorException e){
+ throw new ParseException(e.getMessage());
+ }
+ }
+
+ <LPAREN>
+ [readProcedureParameter(factory, proc)]
+ (<COMMA> readProcedureParameter(factory, proc))*
+ <RPAREN>
+
+ <RETURNS> (readProcedureReturn(factory, proc) | returnDataType = parseDataType())
+
+ [<OPTIONS> <LPAREN>
+ readProcedureOption(proc)
+ (<COMMA>
+ readProcedureOption(proc)
+ )*
+ <RPAREN>
+ ]
+ [<AS>
+ stmt = statement(info)])
+ {
+ proc.setVirtual(virtual);
+ proc.setFunction(function);
+ if (stmt != null){
+ proc.setQueryPlan("CREATE VIRTUAL PROCEDURE "+asBlock(stmt).toString());
+ }
+
+ if (virtual && !function && stmt == null){
+ throw new ParseException("Virtual procedure " + procName + " must define the procedure block after 'AS' keyword");
+ }
+
+ if (returnDataType != null){
+ addProcReturnColumn(factory, proc, "return", returnDataType);
+ }
+ return procCmd;
+ }
+}
+
+void readProcedureParameter(MetadataFactory factory, Procedure proc) :
+{
+ String name = null;
+ ParsedDataType type = null;
+ Token direction = null;
+ ProcedureParameter param = null;
+}
+{
+ [((direction = <IN>)|(direction=<OUT>)|(direction=<INOUT>))]
+ name = id()
+ type = parseDataType()
+ {
+ ProcedureParameter.Type ppType = ProcedureParameter.Type.In;
+
+ if (direction == null){
+ ppType = ProcedureParameter.Type.In;
+ }
+ else if (direction.image.equalsIgnoreCase("in")){
+ ppType = ProcedureParameter.Type.In ;
+ }
+ else if (direction.image.equalsIgnoreCase("out")){
+ ppType = ProcedureParameter.Type.Out;
+ }
+ else if (direction.image.equalsIgnoreCase("inout")){
+ ppType = ProcedureParameter.Type.InOut;
+ }
+ else {
+ throw new ParseException("Unknown type of parameter on procedure "+ proc.getName());
+ }
+ try {
+ param = factory.addProcedureParameter(name, type.type, ppType, proc);
+ if (type.length != null){
+ param.setLength(type.length);
+ }
+ if (type.scale != null){
+ param.setScale(type.scale);
+ }
+ if (type.precision != null){
+ param.setPrecision(type.precision);
+ }
+ } catch (TranslatorException e){
+ throw new ParseException(e.getMessage());
+ }
+ }
+ [nonReserved("VARARG") {param.setVarArg(true);}]
+
+}
+
+void readProcedureReturn(MetadataFactory factory, Procedure proc) :
+{
+ String name = null;
+ ParsedDataType type = null;
+}
+{
+ <LPAREN>
+ name = id()
+ type = parseDataType()
+ {
+ addProcReturnColumn(factory, proc, name, type);
+ }
+ (<COMMA>
+ name = id()
+ type = parseDataType()
+ {
+ addProcReturnColumn(factory, proc, name, type);
+ }
+ )*
+ <RPAREN>
+}
+
+void createTable(MetadataFactory factory) :
+{
+ Table table = null;
+ String tableName = null;
+ boolean view = false;
+ Command query = null;
+}
+{
+ <CREATE> (<FOREIGN> <TABLE> | [<VIRTUAL>] nonReserved("VIEW") {view = true;})
+ tableName = id()
+ {
+ try{
+ table = factory.addTable(tableName);
+ table.setVirtual(view);
+ } catch(TranslatorException e){
+ throw new ParseException(e.getMessage());
+ }
+ }
+ [<LPAREN>
+ createColumn(factory, table)
+ (LOOKAHEAD(2) <COMMA>
+ createColumn(factory, table)
+ )*
+ [<CONSTRAINT> (readPrimaryKeys(factory, table) | readConstraints(factory, table) | readForeignKeys(factory, table))
+ (<COMMA>
+ (readConstraints(factory, table)|readForeignKeys(factory, table))
+ )*
+ ]
+ <RPAREN>]
+ [<OPTIONS> <LPAREN>
+ readTableOption(table)
+ (<COMMA>
+ readTableOption(table)
+ )*
+ <RPAREN>
+ ]
+ [<AS> query = queryExpression(new ParseInfo())]
+ {
+ if (view && query == null){
+ throw new ParseException("View definition must have query plan defined");
+ }
+
+ if (view){
+ table.setSelectTransformation(query.toString());
+ }
+ }
+}
+
+void readForeignKeys(MetadataFactory factory, Table table) :
+{
+ List<String> columnNames = null;
+ String viewName = null;
+ Table reference = null;
+ KeyRecord pk = null;
+ Column column = null;
+ List<String> pkColumnNames = null;
+}
+{
+ <FOREIGN> nonReserved("KEY")
+ columnNames = getColumnNames()
+ {
+ for (String col: columnNames) {
+ column = getColumn(col, table);
+ if (column == null) {
+ throw new ParseException("Column name "+ col + " not found in table "+ table.getName());
+ }
+ }
+ }
+ <REFERENCES>
+ viewName = id()
+ [pkColumnNames = getColumnNames()]
+ {
+ try{
+ factory.addForiegnKey("FK"+table.getForeignKeys().size(), columnNames, pkColumnNames, viewName, table);
+ } catch (TranslatorException e){
+ throw new ParseException(e.getMessage());
+ }
+ }
+}
+
+void readPrimaryKeys(MetadataFactory factory, Table table) :
+{
+ List<String> columnNames = null;
+ Column column = null;
+}
+{
+ <PRIMARY> nonReserved("KEY")
+ {
+ columnNames = getColumnNames();
+ for (String col: columnNames) {
+ column = getColumn(col, table);
+ if (column == null) {
+ throw new ParseException("Column name "+ col + " not found in table "+ table.getName());
+ }
+ }
+ if (table.getPrimaryKey() != null){
+ throw new ParseException("Primary Key is already defined on "+ table.getName());
+ }
+ try{
+ factory.addPrimaryKey("PK", columnNames, table);
+ } catch(TranslatorException e){
+ throw new ParseException(e.getMessage());
+ }
+ }
+}
+
+void readConstraints(MetadataFactory factory, Table table) :
+{
+ KeyRecord keyrecord = null;
+ Column column = null;
+ List<String> columnNames = null;
+ String type = null;
+}
+{
+ ( <UNIQUE> { type = "UNIQUE"; } | type = nonReserved("INDEX","ACCESSPATTERN"))
+ {
+ columnNames = getColumnNames();
+ for (String col: columnNames) {
+ column = getColumn(col, table);
+ if (column == null) {
+ throw new ParseException("Column name "+ col + " not found in table "+ table.getName());
+ }
+ }
+ try{
+ if (type.equalsIgnoreCase("INDEX")) {
+ factory.addIndex("INDEX"+table.getIndexes().size(), true, columnNames, table);
+ }
+ if (type.equalsIgnoreCase("UNIQUE")) {
+ factory.addIndex("UNIQUE"+table.getUniqueKeys().size(), false, columnNames, table);
+ }
+ if (type.equalsIgnoreCase("ACCESSPATTERN")) {
+ factory.addAccessPattern("AP"+table.getAccessPatterns().size(), columnNames, table);
+ }
+ }catch(TranslatorException e){
+ throw new ParseException(e.getMessage());
+ }
+ }
+}
+
+ArrayList<String> getColumnNames() :
+{
+ ArrayList list = new ArrayList<String>();
+ String id = null;
+}
+{
+ <LPAREN>
+ id = id()
+ {
+ list.add(id);
+ }
+ (<COMMA> id = id()
+ {
+ list.add(id);
+ }
+ )*
+ <RPAREN>
+ {
+ return list;
+ }
+}
+
+void createColumn(MetadataFactory factory, Table table) :
+{
+ String element = null;
+ ParsedDataType type = null;
+ boolean autoIncrement = false;
+ boolean notNull = false;
+ String defalt = null;
+ Column column = null;
+ List<String> columnName = new ArrayList<String>();
+ boolean index = false;
+ boolean unique = false;
+ boolean pk = false;
+ String word = null;
+}
+{
+ element = id()
+ (
+ type = parseDataType()
+ {
+ try{
+ column = factory.addColumn(validateElementName(element), type.type, table);
+ if (type.length != null){
+ column.setLength(type.length);
+ }
+ if (type.scale != null){
+ column.setScale(type.scale);
+ }
+ if (type.precision != null){
+ column.setPrecision(type.precision);
+ }
+ columnName.add(element);
+ }catch(TranslatorException e){
+ throw new ParseException(e.getMessage());
+ }
+ }
+ )
+ [<NOT> <NULL> { notNull = true; }]
+ ([(<UNIQUE> { unique = true; })
+ |(word=nonReserved("INDEX", "AUTO_INCREMENT")
+ { if (word.equalsIgnoreCase("INDEX")) index = true;
+ else if (word.equalsIgnoreCase("AUTO_INCREMENT")) autoIncrement = true;
+ })+
+ |(<PRIMARY> nonReserved("KEY") { pk = true; })
+ ])
+ [<DEFAULT_KEYWORD> defalt = stringVal()]
+ [<OPTIONS> <LPAREN>
+ readColumnOption(column) (<COMMA> readColumnOption(column))*
+ <RPAREN>
+ ]
+ {
+ try{
+ if (index){
+ factory.addIndex(element, true, columnName, table);
+ }
+
+ if (unique){
+ factory.addIndex(element, false, columnName, table);
+ }
+
+ if (pk) {
+ if (table.getPrimaryKey() != null) {
+ throw new ParseException("Primary Key is already defined on "+ table.getName());
+ }
+ factory.addPrimaryKey(element, columnName, table);
+ }
+ }catch(TranslatorException e){
+ throw new ParseException(e.getMessage());
+ }
+
+ column.setAutoIncremented(autoIncrement);
+ column.setNullType(notNull?Column.NullType.No_Nulls:Column.NullType.Nullable);
+ if (defalt != null){
+ column.setDefaultValue(defalt);
+ }
+ }
+}
+
+void readColumnOption(Column column) :
+{
+ Token value = null;
+ String key = null;
+}
+{
+ key = id()
+ ((value = <STRINGVAL>)
+ {
+ setColumnOption(column, key, normalizeStringLiteral(value.image));
+ }
+ | (value = <INTEGERVAL>)
+ {
+ setColumnOption(column, key, value.image);
+ }
+ | (value = <DECIMALVAL>)
+ {
+ setColumnOption(column, key, value.image);
+ })
+}
+
+void readProcedureOption(Procedure proc) :
+{
+ Token value = null;
+ String key = null;
+ Token tk = null;
+}
+{
+ (key=id()|tk=<DETERMINISTIC>{ key = tk.image;})
+ ((value = <STRINGVAL>)
+ {
+ setProcedureOption(proc, key, normalizeStringLiteral(value.image));
+ }
+ | (value = <INTEGERVAL>)
+ {
+ setProcedureOption(proc, key, value.image);
+ }
+ | (value = <DECIMALVAL>)
+ {
+ setProcedureOption(proc, key, value.image);
+ })
+}
+
+void readTableOption(Table table) :
+{
+ Token value = null;
+ String key = null;
+}
+{
+ key = id()
+ ((value = <STRINGVAL>)
+ {
+ setTableOption(table, key, normalizeStringLiteral(value.image));
+ }
+ | (value = <INTEGERVAL>)
+ {
+ setTableOption(table, key, value.image);
+ }
+ | (value = <DECIMALVAL>)
+ {
+ setTableOption(table, key, value.image);
+ })
+}
\ No newline at end of file
Modified: trunk/engine/src/main/resources/org/teiid/query/i18n.properties
===================================================================
--- trunk/engine/src/main/resources/org/teiid/query/i18n.properties 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/engine/src/main/resources/org/teiid/query/i18n.properties 2012-03-08 20:03:01 UTC (rev 3922)
@@ -1028,6 +1028,38 @@
TEIID30581=Invalid table {0}. A table must have 1 or more columns.
TEIID30590=Transaction Is null
+TEIID30591=Metadata for model {0} can not be retrieved from source, as the translator is not available.
+# metadata validation
+TEIID31069=Duplicate model defined {0}
+TEIID31070=Empty model;There are no tables, procedures or functions defined in this model {0}
+TEIID31071=Invalid table; Table {0} has no columns defined
+TEIID31072=Invalid Procedure {0}; No return has been defined.
+TEIID31073=Invalid functions; {0}
+TEIID31074=View table {0} is only allowed in VIRTUAL Model; {0} is defined as PHYSICAL model
+TEIID31075=Foreign table {0} is only allowed to be defined on PHYSICAL model; {1} is defined as VIRTUAL model.
+TEIID31076=Virtual procedure {0} is only allowed to be defined on VIRTUAL model; {1} is defined as PHYSICAL model.
+TEIID31077=Source Stored procedure {0} is only allowed to be defined on PHYSICAL model; {1} is defined as VIRTUAL model.
+TEIID31078=Pushdown function {0} must be defined on PHYSICAL model; {1} is VIRTUAL model.
+TEIID31079=View {0} did not define transformation after "AS select ..."
+TEIID31080=View {0} validation error: {1}
+TEIID31081=Virtual Procedure {0} did not specify any statements as procedure block in model {0}
+TEIID31082={0}.{1} is now "incomplete", because model "{2}" can not retrieve metadata. Please deploy the necessary DataSources.
+TEIID31083={0}.{1} is now "incomplete", because model "{2}" can not retrieve metadata. Please fix any errors and re-deploy relevant DataSources and/or the VDB.
+TEIID31084=Insert plan is enabled on table {0}, however the plan is not provided. Default insert plan is only used when the explicit "create trigger on insert" is not defined.
+TEIID31085=Invalid procedure {0}, return resultset defined, however no columns defined in the resultset.
+TEIID31086=Data type could not be determined on Column {0} on Table {1}
+TEIID31087=Duplicate Column {0} detected on Table {0}
+TEIID31088=The materialization table {0} defined on view {1}, must be defined with "schema" qualifier that represents PHYSICAL model.
+TEIID31089=Invalid Schema qualifier {0} is specified on materialization table {1} for view {2}
+TEIID31090=Materialization table {0} not found in Schema {1} for view {2}
+TEIID31091=Foreign Key definition on view {0} is incomplete. No reference key information not found.
+TEIID31092=Foreign Key definition on view {0} points to non-existent table {1} on schema {2}. Fully qualify the Reference Table name including the schema name.
+TEIID31093=Invalid Schema qualifier {0} is specified on Foreign Key definition for view {1}
+TEIID31094=Foreign Key definition on view {0} points to reference table {1} on schema {2} that has no primary keys
+TEIID31095=Foreign Key definition on view {0} points to reference table {1} on schema {2} that has no Primary Keys or Unique Keys that refer to column names {3}, create PK, or FK on the reference table first.
+
+
TEIID30600=User defined aggregate function "{0}" method "{1}" must not be static.
-TEIID30601=User defined aggregate function "{0}" class "{1}" does not implement {2}
\ No newline at end of file
+TEIID30601=User defined aggregate function "{0}" class "{1}" does not implement {2}
+
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestConnectorManager.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestConnectorManager.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestConnectorManager.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -49,7 +49,7 @@
public ExecutionFactory getExecutionFactory() {
return c;
}
- protected Object getConnectionFactory(){
+ public Object getConnectionFactory(){
return c;
}
};
Added: trunk/engine/src/test/java/org/teiid/query/metadata/TestMetadataValidator.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/metadata/TestMetadataValidator.java (rev 0)
+++ trunk/engine/src/test/java/org/teiid/query/metadata/TestMetadataValidator.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -0,0 +1,248 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with 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.metadata;
+
+import static org.junit.Assert.*;
+
+import java.util.Properties;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.teiid.adminapi.Model;
+import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.metadata.MetadataFactory;
+import org.teiid.metadata.MetadataStore;
+import org.teiid.query.function.SystemFunctionManager;
+import org.teiid.query.parser.TestDDLParser;
+import org.teiid.query.validator.ValidatorFailure;
+import org.teiid.query.validator.ValidatorReport;
+
+@SuppressWarnings("nls")
+public class TestMetadataValidator {
+ public static final SystemFunctionManager SFM = new SystemFunctionManager();
+ private VDBMetaData vdb = new VDBMetaData();
+ private MetadataStore store = new MetadataStore();
+
+ @Before
+ public void setUp() {
+ vdb.setName("myVDB");
+ vdb.setVersion(1);
+ }
+
+ private void buildTransformationMetadata() {
+ TransformationMetadata metadata = new TransformationMetadata(this.vdb, new CompositeMetadataStore(this.store), null, SFM.getSystemFunctions(), null);
+ this.vdb.addAttchment(QueryMetadataInterface.class, metadata);
+ this.vdb.addAttchment(TransformationMetadata.class, metadata);
+ }
+
+ private ModelMetaData buildModel(String modelName, boolean physical, VDBMetaData vdb, MetadataStore store, String ddl) throws Exception {
+ ModelMetaData model = new ModelMetaData();
+ model.setName(modelName);
+ model.setModelType(physical?Model.Type.PHYSICAL:Model.Type.VIRTUAL);
+ vdb.addModel(model);
+
+ DDLMetadataRepository repo = new DDLMetadataRepository();
+ MetadataFactory mf = new MetadataFactory("myVDB",1, modelName, TestDDLParser.getDataTypes(), new Properties(), ddl);
+ repo.loadMetadata(mf, null, null);
+ mf.mergeInto(store);
+ return model;
+ }
+
+ @Test
+ public void testSourceModelArtifacts() throws Exception {
+ String ddl = "create foreign table g1(e1 integer, e2 varchar(12)); create view g2(e1 integer, e2 varchar(12)) AS select * from foo;";
+ buildModel("pm1", true, this.vdb, this.store, ddl);
+ ValidatorReport report = new ValidatorReport();
+ new MetadataValidator.SourceModelArtifacts().execute(vdb, store, report);
+ assertTrue(printError(report), report.hasItems());
+ }
+
+ private String printError(ValidatorReport report) {
+ StringBuilder sb = new StringBuilder();
+ for (ValidatorFailure v:report.getItems()) {
+ if (v.getStatus() == ValidatorFailure.Status.ERROR) {
+ sb.append(v);
+ sb.append("\n");
+ }
+ }
+ return sb.toString();
+ }
+
+ @Test
+ public void testViewModelArtifacts() throws Exception {
+ String ddl = "create foreign table g1(e1 integer, e2 varchar(12)); create view g2(e1 integer, e2 varchar(12)) AS select * from foo;";
+ buildModel("vm1", false, this.vdb, this.store, ddl);
+ ValidatorReport report = new ValidatorReport();
+ new MetadataValidator.SourceModelArtifacts().execute(vdb, store, report);
+ assertTrue(printError(report), report.hasItems());
+ }
+
+ @Test
+ public void testModelArtifactsSucess() throws Exception {
+ buildModel("vm1", false, this.vdb, this.store, "create view g2(e1 integer, e2 varchar(12)) AS select * from foo;");
+ buildModel("pm1", true, this.vdb, this.store, "create foreign table g1(e1 integer, e2 varchar(12));");
+ ValidatorReport report = new ValidatorReport();
+ new MetadataValidator.SourceModelArtifacts().execute(vdb, store, report);
+ assertFalse(printError(report), report.hasItems());
+ }
+
+ @Test
+ public void testMinimalDataNoColumns() throws Exception {
+ buildModel("pm1", true, this.vdb, this.store, "create foreign table g1;");
+ ValidatorReport report = new ValidatorReport();
+ new MetadataValidator.MinimalMetadata().execute(vdb, store, report);
+ assertTrue(printError(report), report.hasItems());
+ }
+
+ @Test
+ public void testResolveMetadata() throws Exception {
+ String ddl = "create view g1 (e1 integer, e2 varchar(12)) AS select * from pm1.g1; " +
+ "create view g2 AS select * from pm1.g1; " +
+ "create trigger on g1 INSTEAD OF UPDATE AS FOR EACH ROW BEGIN ATOMIC END; " +
+ "create virtual procedure proc1(IN e1 varchar) RETURNS (e1 integer, e2 varchar(12)) AS select * from foo; ";
+ buildModel("pm1", true, this.vdb, this.store, "create foreign table g1(e1 integer, e2 varchar(12));");
+ buildModel("vm1", false, this.vdb, this.store, ddl);
+ buildTransformationMetadata();
+ ValidatorReport report = new ValidatorReport();
+ new MetadataValidator.ResolveQueryPlans().execute(vdb, store, report);
+ assertTrue(printError(report), report.hasItems());
+ }
+
+ @Test
+ public void testResolveMetadataError() throws Exception {
+ buildModel("vm1", false, this.vdb, this.store, "create view g1 (e1 integer, e2 varchar(12)) AS select * from pm1.g1; create view g2 AS select * from pm1.g1;");
+ buildTransformationMetadata();
+ ValidatorReport report = new ValidatorReport();
+ new MetadataValidator.ResolveQueryPlans().execute(vdb, store, report);
+ assertTrue(printError(report), report.hasItems());
+ }
+
+ @Test
+ public void testCrossReferenceFK() throws Exception {
+ String ddl = "CREATE FOREIGN TABLE G1(g1e1 integer, g1e2 varchar CONSTRAINT PRIMARY KEY(g1e1, g1e2));";
+ String ddl2 = "CREATE FOREIGN TABLE G2( g2e1 integer, g2e2 varchar CONSTRAINT PRIMARY KEY(g2e1, g2e2), FOREIGN KEY (g2e1, g2e2) REFERENCES pm1.G1(g1e1, g1e2))";
+
+ buildModel("pm1", true, this.vdb, this.store, ddl);
+ buildModel("pm2", true, this.vdb, this.store, ddl2);
+
+ buildTransformationMetadata();
+
+ ValidatorReport report = new ValidatorReport();
+ report = MetadataValidator.validate(this.vdb, this.store);
+ assertFalse(printError(report), report.hasItems());
+
+ assertNotNull(this.store.getSchema("pm2").getTable("G2").getForeignKeys().get(0).getPrimaryKey());
+ assertEquals(2, this.store.getSchema("pm2").getTable("G2").getForeignKeys().get(0).getPrimaryKey().getColumns().size());
+ assertEquals("g1e1", this.store.getSchema("pm2").getTable("G2").getForeignKeys().get(0).getPrimaryKey().getColumns().get(0).getName());
+ }
+
+ @Test
+ public void testCrossReferenceFKFromUniqueKey() throws Exception {
+ String ddl = "CREATE FOREIGN TABLE G1(g1e1 integer, g1e2 varchar CONSTRAINT UNIQUE(g1e2));";
+ String ddl2 = "CREATE FOREIGN TABLE G2(g2e1 integer, g2e2 varchar CONSTRAINT FOREIGN KEY (g2e2) REFERENCES pm1.G1(g1e2))";
+
+ buildModel("pm1", true, this.vdb, this.store, ddl);
+ buildModel("pm2", true, this.vdb, this.store, ddl2);
+
+ buildTransformationMetadata();
+
+ ValidatorReport report = new ValidatorReport();
+ report = MetadataValidator.validate(this.vdb, this.store);
+ assertFalse(printError(report), report.hasItems());
+
+ assertNotNull(this.store.getSchema("pm2").getTable("G2").getForeignKeys().get(0).getPrimaryKey());
+ assertEquals(1, this.store.getSchema("pm2").getTable("G2").getForeignKeys().get(0).getPrimaryKey().getColumns().size());
+ assertEquals("g1e2", this.store.getSchema("pm2").getTable("G2").getForeignKeys().get(0).getPrimaryKey().getColumns().get(0).getName());
+ }
+
+ @Test
+ public void testCrossReferenceResoveOptionalFK() throws Exception {
+ String ddl = "CREATE FOREIGN TABLE G1(g1e1 integer, g1e2 varchar CONSTRAINT PRIMARY KEY(g1e1, g1e2));";
+ String ddl2 = "CREATE FOREIGN TABLE G2( g2e1 integer, g2e2 varchar CONSTRAINT FOREIGN KEY (g2e1, g2e2) REFERENCES pm1.G1)";
+
+ buildModel("pm1", true, this.vdb, this.store, ddl);
+ buildModel("pm2", true, this.vdb, this.store, ddl2);
+
+ buildTransformationMetadata();
+
+ ValidatorReport report = new ValidatorReport();
+ report = MetadataValidator.validate(this.vdb, this.store);
+ assertFalse(printError(report), report.hasItems());
+
+ assertNotNull(this.store.getSchema("pm2").getTable("G2").getForeignKeys().get(0).getPrimaryKey());
+ assertEquals(2, this.store.getSchema("pm2").getTable("G2").getForeignKeys().get(0).getPrimaryKey().getColumns().size());
+ assertEquals("g1e1", this.store.getSchema("pm2").getTable("G2").getForeignKeys().get(0).getPrimaryKey().getColumns().get(0).getName());
+ }
+
+ @Test
+ public void testCrossReferenceFKNoPKonRefTable() throws Exception {
+ // note here the unique here does not matter for non-existent reference columns, only primary key counted.
+ String ddl = "CREATE FOREIGN TABLE G1(g1e1 integer, g1e2 varchar CONSTRAINT UNIQUE(g1e1, g1e2));";
+ String ddl2 = "CREATE FOREIGN TABLE G2( g2e1 integer, g2e2 varchar CONSTRAINT PRIMARY KEY(g2e1, g2e2), FOREIGN KEY (g2e1, g2e2) REFERENCES pm1.G1)";
+
+ buildModel("pm1", true, this.vdb, this.store, ddl);
+ buildModel("pm2", true, this.vdb, this.store, ddl2);
+
+ buildTransformationMetadata();
+
+ ValidatorReport report = new ValidatorReport();
+ report = MetadataValidator.validate(this.vdb, this.store);
+ assertTrue(printError(report), report.hasItems());
+ }
+
+
+ @Test
+ public void testInternalMaterializationValidate() throws Exception {
+ // note here the unique here does not matter for non-existent reference columns, only primary key counted.
+ String ddl = "CREATE FOREIGN TABLE G1(e1 integer, e2 varchar);";
+ String ddl2 = "CREATE VIEW G2 OPTIONS (MATERIALIZED 'YES') AS SELECT * FROM pm1.G1";
+
+ buildModel("pm1", true, this.vdb, this.store, ddl);
+ buildModel("vm1", false, this.vdb, this.store, ddl2);
+
+ buildTransformationMetadata();
+
+ ValidatorReport report = new ValidatorReport();
+ report = MetadataValidator.validate(this.vdb, this.store);
+ assertFalse(printError(report), report.hasItems());
+ }
+
+ @Test
+ public void testExternalMaterializationValidate() throws Exception {
+ // note here the unique here does not matter for non-existent reference columns, only primary key counted.
+ String ddl = "CREATE FOREIGN TABLE G1(e1 integer, e2 varchar);";
+ String ddl2 = "CREATE VIEW G2 OPTIONS (MATERIALIZED 'YES', MATERIALIZED_TABLE 'pm1.G1') AS SELECT * FROM pm1.G1";
+
+ buildModel("pm1", true, this.vdb, this.store, ddl);
+ buildModel("vm1", false, this.vdb, this.store, ddl2);
+
+ buildTransformationMetadata();
+
+ ValidatorReport report = new ValidatorReport();
+ report = MetadataValidator.validate(this.vdb, this.store);
+ assertFalse(printError(report), report.hasItems());
+ assertNotNull("pm1.G1", store.getSchema("vm1").getTable("G2").getMaterializedTable());
+ assertEquals("G1", store.getSchema("vm1").getTable("G2").getMaterializedTable().getName());
+ }
+
+}
Property changes on: trunk/engine/src/test/java/org/teiid/query/metadata/TestMetadataValidator.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/engine/src/test/java/org/teiid/query/metadata/TestTransformationMetadata.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -22,7 +22,8 @@
package org.teiid.query.metadata;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
import java.util.Arrays;
import java.util.Collection;
@@ -72,13 +73,13 @@
throws TranslatorException {
Map<String, Datatype> datatypes = new HashMap<String, Datatype>();
datatypes.put(DataTypeManager.DefaultDataTypes.STRING, new Datatype());
- MetadataFactory mf = new MetadataFactory("x", datatypes, new Properties()); //$NON-NLS-1$
+ MetadataFactory mf = new MetadataFactory(null, 1, "x", datatypes, new Properties(), null); //$NON-NLS-1$
mf.addProcedure("y"); //$NON-NLS-1$
Table t = mf.addTable("foo");
mf.addColumn("col", DataTypeManager.DefaultDataTypes.STRING, t);
- MetadataFactory mf1 = new MetadataFactory("x1", datatypes, new Properties()); //$NON-NLS-1$
+ MetadataFactory mf1 = new MetadataFactory(null, 1, "x1", datatypes, new Properties(), null); //$NON-NLS-1$
mf1.addProcedure("y"); //$NON-NLS-1$
Table table = mf1.addTable("doc");
@@ -88,7 +89,7 @@
HashMap<String, Resource> resources = new HashMap<String, Resource>();
resources.put("/x.xsd", new Resource(VFS.getRootVirtualFile(), true));
- CompositeMetadataStore cms = new CompositeMetadataStore(Arrays.asList(mf.getMetadataStore(), mf1.getMetadataStore()));
+ CompositeMetadataStore cms = new CompositeMetadataStore(Arrays.asList(mf.asMetadataStore(), mf1.asMetadataStore()));
VDBMetaData vdb = new VDBMetaData();
vdb.setName("vdb");
@@ -112,11 +113,11 @@
@Test public void testAmbiguousTableWithPrivateModel() throws Exception {
Map<String, Datatype> datatypes = new HashMap<String, Datatype>();
datatypes.put(DataTypeManager.DefaultDataTypes.STRING, new Datatype());
- MetadataFactory mf = new MetadataFactory("x", datatypes, new Properties()); //$NON-NLS-1$
+ MetadataFactory mf = new MetadataFactory(null, 1, "x", datatypes, new Properties(), null); //$NON-NLS-1$
mf.addTable("y"); //$NON-NLS-1$
- MetadataFactory mf1 = new MetadataFactory("x1", datatypes, new Properties()); //$NON-NLS-1$
+ MetadataFactory mf1 = new MetadataFactory(null, 1, "x1", datatypes, new Properties(), null); //$NON-NLS-1$
mf1.addTable("y"); //$NON-NLS-1$
- CompositeMetadataStore cms = new CompositeMetadataStore(Arrays.asList(mf.getMetadataStore(), mf1.getMetadataStore()));
+ CompositeMetadataStore cms = new CompositeMetadataStore(Arrays.asList(mf.asMetadataStore(), mf1.asMetadataStore()));
VDBMetaData vdb = new VDBMetaData();
vdb.setName("foo");
Added: trunk/engine/src/test/java/org/teiid/query/parser/TestDDLParser.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/parser/TestDDLParser.java (rev 0)
+++ trunk/engine/src/test/java/org/teiid/query/parser/TestDDLParser.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -0,0 +1,603 @@
+package org.teiid.query.parser;
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.math.BigDecimal;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.junit.Test;
+import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.core.types.DataTypeManager;
+import org.teiid.metadata.BaseColumn.NullType;
+import org.teiid.metadata.Column;
+import org.teiid.metadata.ColumnSet;
+import org.teiid.metadata.Datatype;
+import org.teiid.metadata.ForeignKey;
+import org.teiid.metadata.FunctionMethod;
+import org.teiid.metadata.MetadataFactory;
+import org.teiid.metadata.MetadataStore;
+import org.teiid.metadata.Procedure;
+import org.teiid.metadata.ProcedureParameter;
+import org.teiid.metadata.Schema;
+import org.teiid.metadata.Table;
+import org.teiid.query.metadata.MetadataValidator;
+import org.teiid.query.validator.ValidatorReport;
+
+//import static org.junit.Assert.*;
+
+@SuppressWarnings("nls")
+public class TestDDLParser {
+ private QueryParser parser = new QueryParser();
+
+ @Test
+ public void testForeignTable() throws Exception {
+
+ String ddl = "CREATE FOREIGN TABLE G1(\n" +
+ "e1 integer primary key,\n" +
+ "e2 varchar(10) unique,\n" +
+ "e3 date not null unique,\n" +
+ "e4 decimal(12,3),\n" +
+ "e5 integer auto_increment INDEX OPTIONS (UUID 'uuid', NAMEINSOURCE 'nis', SELECTABLE 'NO'),\n" +
+ "e6 varchar index default 'hello')\n" +
+ "OPTIONS (CARDINALITY 12, UUID 'uuid2', UPDATABLE 'yes', FOO 'BAR', ANNOTATION 'Test Table')";
+
+ Schema s = helpParse(ddl, "model");
+ Map<String, Table> tableMap = s.getTables();
+
+ assertTrue("Table not found", tableMap.containsKey("G1"));
+ Table table = tableMap.get("G1");
+ assertTrue(table.isPhysical());
+ assertFalse(table.isVirtual());
+ assertFalse(table.isSystem());
+ assertFalse(table.isMaterialized());
+ assertFalse(table.isDeletePlanEnabled());
+ assertEquals("uuid2", table.getUUID());
+ assertEquals(12, table.getCardinality());
+ assertTrue(table.supportsUpdate());
+ assertEquals("BAR", table.getProperties().get("FOO"));
+ assertEquals("Test Table", table.getAnnotation());
+
+
+ assertEquals(6, table.getColumns().size());
+
+ List<Column> columns = table.getColumns();
+ Column e1 = columns.get(0);
+ Column e2 = columns.get(1);
+ Column e3 = columns.get(2);
+ Column e4 = columns.get(3);
+ Column e5 = columns.get(4);
+ Column e6 = columns.get(5);
+
+ assertEquals("e1", e1.getName());
+ assertEquals("integer", e1.getDatatype().getName());
+ assertEquals("primary key not same", e1, table.getPrimaryKey().getColumns().get(0));
+
+ assertEquals("e2", e2.getName());
+ assertEquals("varchar", e2.getDatatype().getName());
+ assertEquals("unique", e2, table.getUniqueKeys().get(0).getColumns().get(0));
+ assertEquals(NullType.Nullable, e2.getNullType());
+ assertEquals(10, e2.getLength());
+ assertEquals(0, e2.getPrecision());
+
+ assertEquals("e3", e3.getName());
+ assertEquals("date", e3.getDatatype().getName());
+ assertEquals("unique", e3, table.getUniqueKeys().get(1).getColumns().get(0));
+ assertEquals(NullType.No_Nulls, e3.getNullType());
+
+ assertEquals("e4", e4.getName());
+ assertEquals("decimal", e4.getDatatype().getName());
+ assertEquals(false, e4.isAutoIncremented());
+ assertEquals(12, e4.getPrecision());
+ assertEquals(3, e4.getScale());
+
+ assertEquals("e5", e5.getName());
+ assertEquals("integer", e5.getDatatype().getName());
+ assertEquals(true, e5.isAutoIncremented());
+ assertEquals("uuid", e5.getUUID());
+ assertEquals("nis", e5.getNameInSource());
+ assertEquals(false, e5.isSelectable());
+ assertEquals("index", e5, table.getIndexes().get(0).getColumns().get(0));
+
+ assertEquals("e6", e6.getName());
+ assertEquals("varchar", e6.getDatatype().getName());
+ assertEquals("index", e6, table.getIndexes().get(1).getColumns().get(0));
+ assertEquals("hello", e6.getDefaultValue());
+ }
+
+ @Test
+ public void testDuplicatePrimarykey() throws Exception {
+ String ddl = "CREATE FOREIGN TABLE G1( e1 integer primary key, e2 varchar primary key)";
+ try {
+ MetadataStore mds = new MetadataStore();
+ MetadataFactory mf = new MetadataFactory(null, 1, "model", getDataTypes(), new Properties(), null);
+ parser.parseDDL(mf, ddl);
+ mf.mergeInto(mds);
+ fail("two keys can ot be primary keys");
+ } catch (Exception e) {
+ }
+ }
+
+ @Test
+ public void testMultiKeyPK() throws Exception {
+ String ddl = "CREATE FOREIGN TABLE G1( e1 integer, e2 varchar, e3 date CONSTRAINT PRIMARY KEY (e1, e2))";
+
+ Schema s = helpParse(ddl, "model");
+ Map<String, Table> tableMap = s.getTables();
+
+ assertTrue("Table not found", tableMap.containsKey("G1"));
+ Table table = tableMap.get("G1");
+
+ assertEquals(table.getColumns().subList(0, 2), table.getPrimaryKey().getColumns());
+ }
+
+ @Test
+ public void testConstraints() throws Exception {
+ String ddl = "CREATE FOREIGN TABLE G1( e1 integer, e2 varchar, e3 date " +
+ " CONSTRAINT PRIMARY KEY (e1, e2), INDEX(e2, e3), ACCESSPATTERN(e1), UNIQUE(e1)," +
+ " ACCESSPATTERN(e2, e3))";
+
+ Schema s = helpParse(ddl, "model");
+ Map<String, Table> tableMap = s.getTables();
+
+ assertTrue("Table not found", tableMap.containsKey("G1"));
+ Table table = tableMap.get("G1");
+
+ assertEquals(table.getColumns().subList(0, 2), table.getPrimaryKey().getColumns());
+ assertEquals(table.getColumns().subList(1, 3), table.getIndexes().get(0).getColumns());
+ assertEquals(table.getColumns().subList(0, 1), table.getUniqueKeys().get(0).getColumns());
+ assertEquals(2, table.getAccessPatterns().size());
+ assertEquals(table.getColumns().subList(0, 1), table.getAccessPatterns().get(0).getColumns());
+ assertEquals(table.getColumns().subList(1, 3), table.getAccessPatterns().get(1).getColumns());
+ }
+
+ @Test
+ public void testConstraints2() throws Exception {
+ String ddl = "CREATE FOREIGN TABLE G1( e1 integer, e2 varchar, e3 date CONSTRAINT " +
+ "ACCESSPATTERN(e1), UNIQUE(e1), ACCESSPATTERN(e2, e3))";
+
+ Schema s = helpParse(ddl, "model");
+ Map<String, Table> tableMap = s.getTables();
+
+ assertTrue("Table not found", tableMap.containsKey("G1"));
+ Table table = tableMap.get("G1");
+
+ assertEquals(table.getColumns().subList(0, 1), table.getUniqueKeys().get(0).getColumns());
+ assertEquals(2, table.getAccessPatterns().size());
+ assertEquals(table.getColumns().subList(0, 1), table.getAccessPatterns().get(0).getColumns());
+ assertEquals(table.getColumns().subList(1, 3), table.getAccessPatterns().get(1).getColumns());
+ }
+
+ @Test
+ public void testWrongPrimarykey() throws Exception {
+ String ddl = "CREATE FOREIGN TABLE G1( e1 integer, e2 varchar, PRIMARY KEY (e3))";
+
+ try {
+ MetadataStore mds = new MetadataStore();
+ MetadataFactory mf = new MetadataFactory(null, 1, "model", getDataTypes(), new Properties(), null);
+ parser.parseDDL(mf, ddl);
+ mf.mergeInto(mds);
+ fail("should fail to find e3 as the column");
+ } catch(ParseException e) {
+
+ }
+ }
+
+ @Test
+ public void testFK() throws Exception {
+ String ddl = "CREATE FOREIGN TABLE G1(g1e1 integer, g1e2 varchar CONSTRAINT PRIMARY KEY(g1e1, g1e2));\n" +
+ "CREATE FOREIGN TABLE G2( g2e1 integer, g2e2 varchar CONSTRAINT " +
+ "FOREIGN KEY (g2e1, g2e2) REFERENCES G1 (g1e1, g1e2))";
+
+ Schema s = helpParse(ddl, "model");
+ Map<String, Table> tableMap = s.getTables();
+ assertEquals(2, tableMap.size());
+
+ assertTrue("Table not found", tableMap.containsKey("G1"));
+ assertTrue("Table not found", tableMap.containsKey("G2"));
+
+ Table table = tableMap.get("G2");
+ ForeignKey fk = table.getForeignKeys().get(0);
+ assertEquals(fk.getColumns(), table.getColumns());
+ assertEquals("G1", fk.getReferenceTableName());
+ }
+
+ @Test
+ public void testOptionalFK() throws Exception {
+ String ddl = "CREATE FOREIGN TABLE G1(g1e1 integer, g1e2 varchar CONSTRAINT PRIMARY KEY(g1e1, g1e2));\n" +
+ "CREATE FOREIGN TABLE G2( g2e1 integer, g2e2 varchar CONSTRAINT PRIMARY KEY(g2e1, g2e2)," +
+ "FOREIGN KEY (g2e1, g2e2) REFERENCES G1)";
+
+ MetadataFactory s = helpParse(ddl, "model");
+ Map<String, Table> tableMap = s.getTables();
+ assertEquals(2, tableMap.size());
+
+ assertTrue("Table not found", tableMap.containsKey("G1"));
+ assertTrue("Table not found", tableMap.containsKey("G2"));
+
+ Table table = tableMap.get("G2");
+ ForeignKey fk = table.getForeignKeys().get(0);
+ assertEquals(fk.getColumns(), table.getColumns());
+ assertEquals("G1", fk.getReferenceTableName());
+
+ VDBMetaData vdb = new VDBMetaData();
+ vdb.setName("myVDB"); //$NON-NLS-1$
+ ModelMetaData modelOne = new ModelMetaData();
+ modelOne.setName("model"); //$NON-NLS-1$
+ vdb.addModel(modelOne);
+
+ ValidatorReport report = MetadataValidator.validate(vdb, s.asMetadataStore());
+
+ assertFalse(report.hasItems());
+
+ assertEquals(fk.getPrimaryKey().getColumns(), tableMap.get("G1").getColumns());
+ }
+
+ @Test
+ public void testOptionalFKFail() throws Exception {
+ String ddl = "CREATE FOREIGN TABLE G1(g1e1 integer, g1e2 varchar);\n" +
+ "CREATE FOREIGN TABLE G2( g2e1 integer, g2e2 varchar CONSTRAINT PRIMARY KEY(g2e1, g2e2)," +
+ "FOREIGN KEY (g2e1, g2e2) REFERENCES G1)";
+
+ MetadataFactory s = helpParse(ddl, "model");
+ Map<String, Table> tableMap = s.getTables();
+ assertEquals(2, tableMap.size());
+
+ assertTrue("Table not found", tableMap.containsKey("G1"));
+ assertTrue("Table not found", tableMap.containsKey("G2"));
+
+ Table table = tableMap.get("G2");
+ ForeignKey fk = table.getForeignKeys().get(0);
+ assertEquals(fk.getColumns(), table.getColumns());
+ assertEquals("G1", fk.getReferenceTableName());
+
+ VDBMetaData vdb = new VDBMetaData();
+ vdb.setName("myVDB"); //$NON-NLS-1$
+ ModelMetaData modelOne = new ModelMetaData();
+ modelOne.setName("model"); //$NON-NLS-1$
+ vdb.addModel(modelOne);
+
+ ValidatorReport report = MetadataValidator.validate(vdb, s.asMetadataStore());
+
+ assertTrue(report.hasItems());
+ }
+
+ @Test
+ public void testFKAccrossSchemas() throws Exception {
+ String ddl = "CREATE FOREIGN TABLE G1(g1e1 integer, g1e2 varchar CONSTRAINT PRIMARY KEY(g1e1, g1e2));\n";
+
+ String ddl2 = "CREATE FOREIGN TABLE G2( g2e1 integer, g2e2 varchar CONSTRAINT PRIMARY KEY(g2e1, g2e2)," +
+ "FOREIGN KEY (g2e1, g2e2) REFERENCES model.G1)";
+
+ MetadataFactory f1 = helpParse(ddl, "model");
+ MetadataFactory f2 = helpParse(ddl2, "model2");
+
+
+ VDBMetaData vdb = new VDBMetaData();
+ vdb.setName("myVDB"); //$NON-NLS-1$
+ ModelMetaData modelOne = new ModelMetaData();
+ modelOne.setName("model"); //$NON-NLS-1$
+ vdb.addModel(modelOne);
+
+ ModelMetaData modelTwo = new ModelMetaData();
+ modelTwo.setName("model2"); //$NON-NLS-1$
+ vdb.addModel(modelTwo);
+
+ MetadataStore s = f1.asMetadataStore();
+ f2.mergeInto(s);
+
+ ValidatorReport report = MetadataValidator.validate(vdb, s);
+
+ assertFalse(report.hasItems());
+
+ Table table = s.getSchema("model2").getTable("G2");
+ ForeignKey fk = table.getForeignKeys().get(0);
+ assertEquals(fk.getColumns(), table.getColumns());
+ assertEquals("model.G1", fk.getReferenceTableName());
+
+ assertEquals(fk.getPrimaryKey().getColumns(), s.getSchema("model").getTable("G1").getColumns());
+ }
+
+ @Test
+ public void testViewWithoutPlan() throws Exception {
+ String ddl = "CREATE View G1( e1 integer, e2 varchar)";
+ try {
+ MetadataStore mds = new MetadataStore();
+ MetadataFactory mf = new MetadataFactory(null, 1, "model", getDataTypes(), new Properties(), null);
+ parser.parseDDL(mf,ddl);
+ mf.mergeInto(mds);
+ fail("should fail define a view with out a plan");
+ } catch(ParseException e) {
+ }
+ }
+
+ @Test
+ public void testViewWithoutColumns() throws Exception {
+ try {
+ MetadataStore mds = new MetadataStore();
+ MetadataFactory mf = new MetadataFactory(null, 1, "VM1", getDataTypes(), new Properties(), null);
+ parser.parseDDL(mf,"CREATE VIEW V1 AS SELECT * FROM PM1.G1");
+ mf.mergeInto(mds);
+ } catch(ParseException e) {
+ fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testMultipleCommands() throws Exception {
+ String ddl = "CREATE VIEW V1 AS SELECT * FROM PM1.G1 " +
+ "CREATE PROCEDURE FOO(P1 integer) RETURNS (e1 integer, e2 varchar) AS SELECT * FROM PM1.G1;";
+
+ Schema s = helpParse(ddl, "model");
+ Map<String, Table> tableMap = s.getTables();
+ Table table = tableMap.get("V1");
+ assertNotNull(table);
+ assertEquals("SELECT * FROM PM1.G1", table.getSelectTransformation());
+
+ Map<String, Procedure> procedureMap = s.getProcedures();
+ Procedure p = procedureMap.get("FOO");
+ assertNotNull(p);
+ assertEquals("CREATE VIRTUAL PROCEDURE BEGIN\nSELECT * FROM PM1.G1;\nEND", p.getQueryPlan());
+
+ }
+
+ @Test
+ public void testMultipleCommands2() throws Exception {
+ String ddl = " CREATE VIRTUAL PROCEDURE getTweets(query varchar) RETURNS (created_on varchar(25), from_user varchar(25), to_user varchar(25), \n" +
+ " profile_image_url varchar(25), source varchar(25), text varchar(140)) AS \n" +
+ " select tweet.* from \n" +
+ " (call twitter.invokeHTTP(action => 'GET', endpoint =>querystring('',query as \"q\"))) w, \n" +
+ " XMLTABLE('results' passing JSONTOXML('myxml', w.result) columns \n" +
+ " created_on string PATH 'created_at', \n" +
+ " from_user string PATH 'from_user',\n" +
+ " to_user string PATH 'to_user', \n" +
+ " profile_image_url string PATH 'profile_image_url', \n" +
+ " source string PATH 'source', \n" +
+ " text string PATH 'text') tweet;" +
+ " CREATE VIEW Tweet AS select * FROM twitterview.getTweets;";
+
+ Schema s = helpParse(ddl, "model");
+ Map<String, Table> tableMap = s.getTables();
+ Table table = tableMap.get("Tweet");
+ assertNotNull(table);
+
+ Map<String, Procedure> procedureMap = s.getProcedures();
+ Procedure p = procedureMap.get("getTweets");
+ assertNotNull(p);
+
+ }
+
+ @Test
+ public void testView() throws Exception {
+ String ddl = "CREATE View G1( e1 integer, e2 varchar) OPTIONS (CARDINALITY 12) AS select e1, e2 from foo.bar";
+
+ Schema s = helpParse(ddl, "model");
+ Map<String, Table> tableMap = s.getTables();
+
+ Table table = tableMap.get("G1");
+
+ assertEquals("SELECT e1, e2 FROM foo.bar", table.getSelectTransformation());
+ assertEquals(12, table.getCardinality());
+ }
+
+ @Test
+ public void testPushdownFunctionNoArgs() throws Exception {
+ String ddl = "CREATE FUNCTION SourceFunc() RETURNS integer";
+
+ Schema s = helpParse(ddl, "model");
+
+ FunctionMethod fm = s.getFunction("SourceFunc");
+ assertNotNull(fm);
+ assertEquals("integer", fm.getOutputParameter().getType());
+ assertEquals(FunctionMethod.PushDown.MUST_PUSHDOWN, fm.getPushdown());
+ }
+
+ @Test
+ public void testUDF() throws Exception {
+ String ddl = "CREATE VIRTUAL FUNCTION SourceFunc(flag boolean, msg varchar) RETURNS varchar " +
+ "OPTIONS(CATEGORY 'misc', DETERMINISTIC 'DETERMINISTIC', " +
+ "NULLONNULL 'YES', JAVA_CLASS 'foo', JAVA_METHOD 'bar', RANDOM 'any')";
+
+ Schema s = helpParse(ddl, "model");
+
+ FunctionMethod fm = s.getFunction("SourceFunc");
+ assertNotNull(fm);
+ assertEquals("varchar", fm.getOutputParameter().getType());
+ assertEquals(FunctionMethod.PushDown.CAN_PUSHDOWN, fm.getPushdown());
+ assertEquals(2, fm.getInputParameterCount());
+ assertEquals("flag", fm.getInputParameters().get(0).getName());
+ assertEquals("boolean", fm.getInputParameters().get(0).getType());
+ assertEquals("msg", fm.getInputParameters().get(1).getName());
+ assertEquals("varchar", fm.getInputParameters().get(1).getType());
+ assertFalse( fm.getInputParameters().get(1).isVarArg());
+
+ assertEquals(FunctionMethod.Determinism.DETERMINISTIC, fm.getDeterminism());
+ assertEquals("misc", fm.getCategory());
+ assertEquals(true, fm.isNullOnNull());
+ assertEquals("foo", fm.getInvocationClass());
+ assertEquals("bar", fm.getInvocationMethod());
+ assertEquals("any", fm.getProperties().get("RANDOM"));
+ }
+
+ @Test
+ public void testVarArgs() throws Exception {
+ String ddl = "CREATE FUNCTION SourceFunc(flag boolean vararg) RETURNS varchar";
+
+ Schema s = helpParse(ddl, "model");
+
+ FunctionMethod fm = s.getFunction("SourceFunc");
+ assertTrue( fm.getInputParameters().get(0).isVarArg());
+ }
+
+ @Test
+ public void testVirtualProcedure() throws Exception {
+ String ddl = "CREATE VIRTUAL PROCEDURE myProc(OUT p1 boolean, p2 varchar, INOUT p3 decimal) " +
+ "RETURNS (r1 varchar, r2 decimal) " +
+ "OPTIONS(RANDOM 'any', UUID 'uuid', NAMEINSOURCE 'nis', ANNOTATION 'desc', UPDATECOUNT '2') " +
+ "AS BEGIN select * from foo; END";
+
+ Schema s = helpParse(ddl, "model");
+
+ Procedure proc = s.getProcedure("myProc");
+ assertNotNull(proc);
+
+ assertTrue(proc.isVirtual());
+ assertFalse(proc.isFunction());
+
+ assertEquals(3, proc.getParameters().size());
+ assertEquals("p1", proc.getParameters().get(0).getName());
+ assertEquals("boolean", proc.getParameters().get(0).getDatatype().getName());
+ assertEquals(ProcedureParameter.Type.Out, proc.getParameters().get(0).getType());
+
+ assertEquals("p2", proc.getParameters().get(1).getName());
+ assertEquals("varchar", proc.getParameters().get(1).getDatatype().getName());
+ assertEquals(ProcedureParameter.Type.In, proc.getParameters().get(1).getType());
+
+ assertEquals("p3", proc.getParameters().get(2).getName());
+ assertEquals("decimal", proc.getParameters().get(2).getDatatype().getName());
+ assertEquals(ProcedureParameter.Type.InOut, proc.getParameters().get(2).getType());
+
+ ColumnSet<Procedure> ret = proc.getResultSet();
+ assertNotNull(ret);
+ assertEquals(2, ret.getColumns().size());
+ assertEquals("r1", ret.getColumns().get(0).getName());
+ assertEquals("varchar", ret.getColumns().get(0).getDatatype().getName());
+ assertEquals("r2", ret.getColumns().get(1).getName());
+ assertEquals("decimal", ret.getColumns().get(1).getDatatype().getName());
+
+ assertEquals("uuid", proc.getUUID());
+ assertEquals("nis", proc.getNameInSource());
+ assertEquals("desc", proc.getAnnotation());
+ assertEquals(2, proc.getUpdateCount());
+ assertEquals("any", proc.getProperties().get("RANDOM"));
+
+ assertEquals("CREATE VIRTUAL PROCEDURE BEGIN\nSELECT * FROM foo;\nEND", proc.getQueryPlan());
+
+ }
+
+ @Test
+ public void testInsteadOfTrigger() throws Exception {
+ String ddl = "CREATE VIEW G1( e1 integer, e2 varchar) AS select * from foo;" +
+ "CREATE TRIGGER ON G1 INSTEAD OF INSERT AS " +
+ "FOR EACH ROW \n" +
+ "BEGIN ATOMIC \n" +
+ "insert into g1 (e1, e2) values (1, 'trig');\n" +
+ "END;" +
+ "CREATE View G2( e1 integer, e2 varchar) AS select * from foo;";
+
+ Schema s = helpParse(ddl, "model");
+ Map<String, Table> tableMap = s.getTables();
+
+ assertTrue("Table not found", tableMap.containsKey("G1"));
+ assertTrue("Table not found", tableMap.containsKey("G2"));
+ assertEquals("FOR EACH ROW\nBEGIN ATOMIC\nINSERT INTO g1 (e1, e2) VALUES (1, 'trig');\nEND", s.getTable("G1").getInsertPlan());
+ }
+
+ @Test
+ public void testSourceProcedure() throws Exception {
+ String ddl = "CREATE PROCEDURE myProc(OUT p1 boolean, p2 varchar, INOUT p3 decimal) " +
+ "RETURNS (r1 varchar, r2 decimal)" +
+ "OPTIONS(RANDOM 'any', UUID 'uuid', NAMEINSOURCE 'nis', ANNOTATION 'desc', UPDATECOUNT '2');";
+
+ Schema s = helpParse(ddl, "model");
+
+ Procedure proc = s.getProcedure("myProc");
+ assertNotNull(proc);
+
+ assertFalse(proc.isVirtual());
+ assertFalse(proc.isFunction());
+
+ assertEquals(3, proc.getParameters().size());
+ assertEquals("p1", proc.getParameters().get(0).getName());
+ assertEquals("boolean", proc.getParameters().get(0).getDatatype().getName());
+ assertEquals(ProcedureParameter.Type.Out, proc.getParameters().get(0).getType());
+
+ assertEquals("p2", proc.getParameters().get(1).getName());
+ assertEquals("varchar", proc.getParameters().get(1).getDatatype().getName());
+ assertEquals(ProcedureParameter.Type.In, proc.getParameters().get(1).getType());
+
+ assertEquals("p3", proc.getParameters().get(2).getName());
+ assertEquals("decimal", proc.getParameters().get(2).getDatatype().getName());
+ assertEquals(ProcedureParameter.Type.InOut, proc.getParameters().get(2).getType());
+
+ ColumnSet<Procedure> ret = proc.getResultSet();
+ assertNotNull(ret);
+ assertEquals(2, ret.getColumns().size());
+ assertEquals("r1", ret.getColumns().get(0).getName());
+ assertEquals("varchar", ret.getColumns().get(0).getDatatype().getName());
+ assertEquals("r2", ret.getColumns().get(1).getName());
+ assertEquals("decimal", ret.getColumns().get(1).getDatatype().getName());
+
+ assertEquals("uuid", proc.getUUID());
+ assertEquals("nis", proc.getNameInSource());
+ assertEquals("desc", proc.getAnnotation());
+ assertEquals(2, proc.getUpdateCount());
+ assertEquals("any", proc.getProperties().get("RANDOM"));
+ }
+
+ @Test
+ public void testNamespace() throws Exception {
+ String ddl = "set namespace 'http://teiid.org' AS 'teiid'";
+
+ MetadataStore mds = new MetadataStore();
+ MetadataFactory mf = new MetadataFactory(null, 1, "model", getDataTypes(), new Properties(), null);
+ parser.parseDDL(mf, ddl);
+ mf.mergeInto(mds);
+
+ assertTrue(mds.getNamespaces().keySet().contains("teiid"));
+ assertEquals("http://teiid.org", mds.getNamespaces().get("teiid"));
+ }
+
+ private MetadataFactory helpParse(String ddl, String model) throws ParseException {
+ MetadataFactory mf = new MetadataFactory(null, 1, model, getDataTypes(), new Properties(), null);
+ parser.parseDDL(mf, ddl);
+ return mf;
+ }
+
+ public static Map<String, Datatype> getDataTypes() {
+ Map<String, Datatype> datatypes = new HashMap<String, Datatype>();
+ for (String name:DataTypeManager.getAllDataTypeNames()) {
+ Datatype dt = new Datatype();
+ dt.setName(name);
+ dt.setJavaClassName(DataTypeManager.getDataTypeClass(name).getName());
+ datatypes.put(name, dt);
+ }
+ Datatype dt = new Datatype();
+ dt.setName("varchar");
+ datatypes.put("varchar", dt);
+ dt.setJavaClassName(String.class.getName());
+
+ dt = new Datatype();
+ dt.setName("decimal");
+ datatypes.put("decimal", dt);
+ dt.setJavaClassName(BigDecimal.class.getName());
+ return datatypes;
+ }
+}
Property changes on: trunk/engine/src/test/java/org/teiid/query/parser/TestDDLParser.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -403,11 +403,4 @@
// TODO Auto-generated method stub
return null;
}
-
- @Override
- public MetadataRepository getMetadataRepository() {
- // TODO Auto-generated method stub
- return null;
- }
-
}
\ No newline at end of file
Property changes on: trunk/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/7.4.x/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java:3149-3217,3535-3555
/branches/7.6.x/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java:3673-3711,3754-3769
/branches/7.7.x/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java:3816-3868,3876-3915
/trunk/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java:3188-3450,3452-3666
+ /branches/7.4.x/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java:3149-3217,3535-3555
/branches/7.6.x/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java:3673-3711,3754-3769
/branches/7.7.x/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java:3816-3868
/trunk/engine/src/test/java/org/teiid/query/processor/FakeDataManager.java:3188-3450,3452-3666
Modified: trunk/engine/src/test/java/org/teiid/query/processor/HardcodedDataManager.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/HardcodedDataManager.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/engine/src/test/java/org/teiid/query/processor/HardcodedDataManager.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -182,10 +182,4 @@
public EventDistributor getEventDistributor() {
return null;
}
-
- @Override
- public MetadataRepository getMetadataRepository() {
- return null;
- }
-
}
Property changes on: trunk/engine/src/test/java/org/teiid/query/processor/HardcodedDataManager.java
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/7.4.x/engine/src/test/java/org/teiid/query/processor/HardcodedDataManager.java:3535-3555
/branches/7.6.x/engine/src/test/java/org/teiid/query/processor/HardcodedDataManager.java:3673-3711,3754-3769
/branches/7.7.x/engine/src/test/java/org/teiid/query/processor/HardcodedDataManager.java:3816-3868,3876-3915
/trunk/engine/src/test/java/org/teiid/query/processor/HardcodedDataManager.java:3507-3666
+ /branches/7.4.x/engine/src/test/java/org/teiid/query/processor/HardcodedDataManager.java:3535-3555
/branches/7.6.x/engine/src/test/java/org/teiid/query/processor/HardcodedDataManager.java:3673-3711,3754-3769
/branches/7.7.x/engine/src/test/java/org/teiid/query/processor/HardcodedDataManager.java:3816-3868
/trunk/engine/src/test/java/org/teiid/query/processor/HardcodedDataManager.java:3507-3666
Modified: trunk/engine/src/test/java/org/teiid/query/processor/relational/TestBatchedUpdateNode.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/relational/TestBatchedUpdateNode.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/engine/src/test/java/org/teiid/query/processor/relational/TestBatchedUpdateNode.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -226,11 +226,6 @@
// TODO Auto-generated method stub
return null;
}
- @Override
- public MetadataRepository getMetadataRepository() {
- // TODO Auto-generated method stub
- return null;
- }
}
private static final class FakeTupleSource implements TupleSource {
private int currentTuple = 0;
Modified: trunk/engine/src/test/java/org/teiid/query/processor/relational/TestProjectIntoNode.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/relational/TestProjectIntoNode.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/engine/src/test/java/org/teiid/query/processor/relational/TestProjectIntoNode.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -187,11 +187,6 @@
// TODO Auto-generated method stub
return null;
}
- @Override
- public MetadataRepository getMetadataRepository() {
- // TODO Auto-generated method stub
- return null;
- }
}
private static final class FakeDataTupleSource implements TupleSource {
Modified: trunk/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -2178,7 +2178,12 @@
return createTransformationMetadata(metadataStore, "proc");
}
- public static TransformationMetadata exampleBusObj() {
+ public static TransformationMetadata exampleBusObj() {
+ // Create the facade from the store
+ return createTransformationMetadata(exampleBusObjStore(), "busObj");
+ }
+
+ public static MetadataStore exampleBusObjStore() {
MetadataStore metadataStore = new MetadataStore();
// Create db2 tables
Schema db2Model = createPhysicalModel("db2model", metadataStore); //$NON-NLS-1$
@@ -2254,9 +2259,8 @@
createElements(logicalTable2,
new String[] { "b0", "b1", "b2"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new String[] { DataTypeManager.DefaultDataTypes.LONG, DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.INTEGER});
-
- // Create the facade from the store
- return createTransformationMetadata(metadataStore, "busObj");
+
+ return metadataStore;
}
public static TransformationMetadata exampleAggregates() {
Modified: trunk/jboss-integration/pom.xml
===================================================================
--- trunk/jboss-integration/pom.xml 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/jboss-integration/pom.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -88,7 +88,12 @@
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-subsystem-test</artifactId>
<scope>test</scope>
- </dependency>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-cli</artifactId>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.jboss.teiid</groupId>
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/DQPCoreService.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/DQPCoreService.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/DQPCoreService.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -87,7 +87,6 @@
setBufferService(bufferServiceInjector.getValue());
this.dqpCore.setTransactionService((TransactionService)LogManager.createLoggingProxy(LogConstants.CTX_TXN_LOG, transactionServerImpl, new Class[] {TransactionService.class}, MessageLevel.DETAIL, Thread.currentThread().getContextClassLoader()));
- this.dqpCore.setMetadataRepository(getVdbRepository().getMetadataRepository());
this.dqpCore.setEventDistributor(getEventDistributorFactoryInjector().getValue().getEventDistributor());
this.dqpCore.setResultsetCache(getResultSetCacheInjector().getValue());
this.dqpCore.setPreparedPlanCache(getPreparedPlanCacheInjector().getValue());
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/Element.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/Element.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/Element.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -60,7 +60,6 @@
POLICY_DECIDER_MODULE_ELEMENT("policy-decider-module", "policy-decider-module", ModelType.STRING, false, null),
AUTHORIZATION_VALIDATOR_MODULE_ELEMENT("authorization-validator-module", "authorization-validator-module", ModelType.STRING, false, null),
- METADATA_REPO_MODULE_ELEMENT("metadata-repository-module", "metadata-repository-module", ModelType.STRING, false, null),
// buffer manager
BUFFER_SERVICE_ELEMENT("buffer-service"),
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/IntegrationPlugin.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/IntegrationPlugin.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/IntegrationPlugin.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -69,13 +69,13 @@
TEIID50027, // metadata in-process of loading
TEIID50028, // failed metadata loading
TEIID50029, // dynamic metadata loaded
- TEIID50030, // no sources to retrieve data
+ TEIID50030,
TEIID50031, // failed to load cached index files
TEIID50032, // duplicate VDB
TEIID50033, // duplicate source name in vdb
TEIID50034, // Source name mismatch
TEIID50035, // translator not found
- TEIID50036, // failed to retrive metadata
+ TEIID50036,
TEIID50037, // odbc enabled
TEIID50038, // embedded enabled
TEIID50039, // socket_disabled
@@ -106,6 +106,14 @@
TEIID50064,
TEIID50065,
TEIID50066,
- TEIID50067
+ TEIID50067,
+ TEIID50068,
+
+
+
+
+ TEIID50086,
+ TEIID50087,
+ TEIID50088
}
}
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidAdd.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidAdd.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidAdd.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -83,7 +83,6 @@
import org.teiid.events.EventDistributorFactory;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
-import org.teiid.metadata.MetadataRepository;
import org.teiid.query.ObjectReplicator;
import org.teiid.query.function.SystemFunctionManager;
import org.teiid.replication.jboss.JGroupsObjectReplicator;
@@ -108,7 +107,6 @@
Element.WORKMANAGER,
Element.AUTHORIZATION_VALIDATOR_MODULE_ELEMENT,
Element.POLICY_DECIDER_MODULE_ELEMENT,
- Element.METADATA_REPO_MODULE_ELEMENT,
// object replicator
Element.DC_STACK_ATTRIBUTE,
@@ -218,10 +216,6 @@
// VDB repository
final VDBRepository vdbRepository = new VDBRepository();
vdbRepository.setSystemFunctionManager(systemFunctionManager);
- if (Element.METADATA_REPO_MODULE_ELEMENT.isDefined(operation)) {
- MetadataRepository repo = buildService(MetadataRepository.class, Element.METADATA_REPO_MODULE_ELEMENT.asString(operation));
- vdbRepository.setMetadataRepository(repo);
- }
VDBRepositoryService vdbRepositoryService = new VDBRepositoryService(vdbRepository);
newControllers.add(target.addService(TeiidServiceNames.VDB_REPO, vdbRepositoryService).install());
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidAttachments.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidAttachments.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidAttachments.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -26,7 +26,7 @@
import org.jboss.as.server.deployment.DeploymentUnit;
import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.deployers.UDFMetaData;
-import org.teiid.metadata.index.IndexMetadataFactory;
+import org.teiid.metadata.index.IndexMetadataStore;
public final class TeiidAttachments {
@@ -34,7 +34,7 @@
public static final AttachmentKey<VDBMetaData> VDB_METADATA = AttachmentKey.create(VDBMetaData.class);
public static final AttachmentKey<UDFMetaData> UDF_METADATA = AttachmentKey.create(UDFMetaData.class);
- public static final AttachmentKey<IndexMetadataFactory> INDEX_METADATA = AttachmentKey.create(IndexMetadataFactory.class);
+ public static final AttachmentKey<IndexMetadataStore> INDEX_METADATA = AttachmentKey.create(IndexMetadataStore.class);
public static final AttachmentKey<DeploymentType> DEPLOYMENT_TYPE = AttachmentKey.create(DeploymentType.class);
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/TeiidSubsystemParser.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -77,7 +77,6 @@
writeElement(writer, Element.AUTHORIZATION_VALIDATOR_MODULE_ELEMENT, node);
writeElement(writer, Element.POLICY_DECIDER_MODULE_ELEMENT, node);
- writeElement(writer, Element.METADATA_REPO_MODULE_ELEMENT, node);
if (like(node, Element.RESULTSET_CACHE_ELEMENT)){
writer.writeStartElement(Element.RESULTSET_CACHE_ELEMENT.getLocalName());
@@ -278,7 +277,6 @@
case POLICY_DECIDER_MODULE_ELEMENT:
case AUTHORIZATION_VALIDATOR_MODULE_ELEMENT:
- case METADATA_REPO_MODULE_ELEMENT:
case WORKMANAGER:
bootServices.get(reader.getLocalName()).set(reader.getElementText());
break;
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/TranslatorDependencyDeployer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/TranslatorDependencyDeployer.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/TranslatorDependencyDeployer.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -45,8 +45,6 @@
moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create("org.jboss.teiid.common-core"), false, false, false, false)); //$NON-NLS-1$
moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create("javax.api"), false, false, false, false)); //$NON-NLS-1$
moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create("javax.resource.api"), false, false, false, false)); //$NON-NLS-1$
- moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create("org.apache.commons.logging"), false, false, false, false)); //$NON-NLS-1$
- moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create("org.apache.log4j"), false, false, false, false)); //$NON-NLS-1$
} catch (ModuleLoadException e) {
throw new DeploymentUnitProcessingException(e);
}
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDependencyDeployer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDependencyDeployer.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDependencyDeployer.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -45,6 +45,7 @@
import org.jboss.vfs.VirtualFileFilter;
import org.jboss.vfs.VisitorAttributes;
import org.jboss.vfs.util.SuffixMatchFilter;
+import org.teiid.adminapi.impl.VDBMetaData;
class VDBDependencyDeployer implements DeploymentUnitProcessor {
public static final String LIB = "/lib"; //$NON-NLS-1$
@@ -57,15 +58,27 @@
return;
}
- if (!TeiidAttachments.isDynamicVDB(deploymentUnit)) {
- final ResourceRoot deploymentResourceRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
- final VirtualFile deploymentRoot = deploymentResourceRoot.getRoot();
- if(deploymentRoot == null) {
- return;
- }
-
+ String moduleName = null;
+ if (TeiidAttachments.isDynamicVDB(deploymentUnit)) {
+ final VDBMetaData deployment = deploymentUnit.getAttachment(TeiidAttachments.VDB_METADATA);
+ ModuleLoader ml = Module.getCallerModuleLoader();
+ moduleName = deployment.getPropertyValue("lib"); //$NON-NLS-1$
+ if (moduleName != null && ml != null) {
+ try {
+ ml.loadModule(ModuleIdentifier.create(moduleName));
+ } catch (ModuleLoadException e) {
+ throw new DeploymentUnitProcessingException(IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50088, moduleName, deployment.getName(), deployment.getVersion(), e));
+ }
+ }
+ }
+ else {
try {
- final VirtualFile libDir = deploymentRoot.getChild(LIB);
+ final ResourceRoot deploymentResourceRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
+ final VirtualFile deploymentRoot = deploymentResourceRoot.getRoot();
+ if(deploymentRoot == null) {
+ return;
+ }
+ final VirtualFile libDir = deploymentRoot.getChild(LIB);
if (libDir.exists()) {
final List<VirtualFile> archives = libDir.getChildren(DEFAULT_JAR_LIB_FILTER);
for (final VirtualFile archive : archives) {
@@ -78,11 +91,12 @@
throw new DeploymentUnitProcessingException(IntegrationPlugin.Event.TEIID50018.name()+IntegrationPlugin.Util.getString("failed_to_process_vdb_archive", archive), e); //$NON-NLS-1$
}
}
- }
+ }
} catch(IOException e) {
throw new DeploymentUnitProcessingException(e);
- }
+ }
}
+
// add translators as dependent modules to this VDB.
try {
@@ -91,6 +105,9 @@
moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create("org.jboss.teiid.api"), false, false, false, false)); //$NON-NLS-1$
moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create("org.jboss.teiid.common-core"), false, false, false, false)); //$NON-NLS-1$
moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create("javax.api"), false, false, false, false)); //$NON-NLS-1$
+ if (moduleName != null) {
+ moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.create(moduleName), false, false, false, false));
+ }
} catch (ModuleLoadException e) {
throw new DeploymentUnitProcessingException(IntegrationPlugin.Event.TEIID50018.name(), e);
}
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBDeployer.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -21,12 +21,10 @@
*/
package org.teiid.jboss;
-import java.util.ArrayList;
import java.util.List;
+import java.util.ServiceLoader;
import java.util.concurrent.Executor;
-import javax.naming.InitialContext;
-
import org.jboss.as.naming.deployment.ContextNames;
import org.jboss.as.server.deployment.Attachments;
import org.jboss.as.server.deployment.DeploymentPhaseContext;
@@ -34,17 +32,20 @@
import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
import org.jboss.as.server.deployment.DeploymentUnitProcessor;
import org.jboss.modules.Module;
+import org.jboss.modules.ModuleIdentifier;
+import org.jboss.modules.ModuleLoadException;
+import org.jboss.modules.ModuleLoader;
import org.jboss.msc.service.AbstractServiceListener;
import org.jboss.msc.service.Service;
import org.jboss.msc.service.ServiceBuilder;
+import org.jboss.msc.service.ServiceBuilder.DependencyType;
import org.jboss.msc.service.ServiceController;
+import org.jboss.msc.service.ServiceController.Mode;
+import org.jboss.msc.service.ServiceController.State;
import org.jboss.msc.service.ServiceName;
import org.jboss.msc.service.StartContext;
import org.jboss.msc.service.StartException;
import org.jboss.msc.service.StopContext;
-import org.jboss.msc.service.ServiceBuilder.DependencyType;
-import org.jboss.msc.service.ServiceController.Mode;
-import org.jboss.msc.service.ServiceController.State;
import org.teiid.adminapi.Model;
import org.teiid.adminapi.Translator;
import org.teiid.adminapi.impl.ModelMetaData;
@@ -56,8 +57,13 @@
import org.teiid.dqp.internal.datamgr.TranslatorRepository;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
-import org.teiid.metadata.index.IndexMetadataFactory;
+import org.teiid.metadata.MetadataRepository;
+import org.teiid.metadata.MetadataStore;
+import org.teiid.metadata.index.IndexMetadataRepository;
+import org.teiid.metadata.index.IndexMetadataStore;
import org.teiid.query.ObjectReplicator;
+import org.teiid.query.metadata.DDLMetadataRepository;
+import org.teiid.query.metadata.NativeMetadataRepository;
import org.teiid.runtime.RuntimePlugin;
import org.teiid.services.BufferServiceImpl;
@@ -103,13 +109,13 @@
String type = data.getType();
Translator parent = this.translatorRepository.getTranslatorMetaData(type);
- if ( parent == null) {
+ if ( parent == null) {
throw new DeploymentUnitProcessingException(RuntimePlugin.Util.getString("translator_type_not_found", IntegrationPlugin.Event.TEIID50021, type, deploymentName)); //$NON-NLS-1$
}
}
// check if this is a VDB with index files, if there are then build the TransformationMetadata
- UDFMetaData udf = deploymentUnit.getAttachment(TeiidAttachments.UDF_METADATA);
+ UDFMetaData udf = deploymentUnit.removeAttachment(TeiidAttachments.UDF_METADATA);
if (udf != null) {
final Module module = deploymentUnit.getAttachment(Attachments.MODULE);
if (module != null) {
@@ -117,27 +123,28 @@
}
deployment.addAttchment(UDFMetaData.class, udf);
}
-
- IndexMetadataFactory indexFactory = deploymentUnit.getAttachment(TeiidAttachments.INDEX_METADATA);
+
+ // set up the metadata repositories for each models
+ IndexMetadataRepository indexRepo = null;
+ IndexMetadataStore indexFactory = deploymentUnit.removeAttachment(TeiidAttachments.INDEX_METADATA);
if (indexFactory != null) {
- deployment.addAttchment(IndexMetadataFactory.class, indexFactory);
+ indexRepo = new IndexMetadataRepository(indexFactory);
}
- // remove the metadata objects as attachments
- deploymentUnit.removeAttachment(TeiidAttachments.INDEX_METADATA);
- deploymentUnit.removeAttachment(TeiidAttachments.UDF_METADATA);
+ MetadataStore store = new MetadataStore();
+ deployment.addAttchment(MetadataStore.class, store);
+ for (ModelMetaData model:deployment.getModelMetaDatas().values()) {
+ if (model.isSource() && model.getSourceNames().isEmpty()) {
+ throw new DeploymentUnitProcessingException(IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50087, model.getName(), deployment.getName(), deployment.getVersion()));
+ }
+ MetadataRepository repo = getMetadataRepository(deployment, model.getName(), indexRepo);
+ model.addAttchment(MetadataRepository.class, repo);
+ }
+
// build a VDB service
- ArrayList<String> unAvailableDS = new ArrayList<String>();
VDBService vdb = new VDBService(deployment);
final ServiceBuilder<VDBMetaData> vdbService = context.getServiceTarget().addService(TeiidServiceNames.vdbServiceName(deployment.getName(), deployment.getVersion()), vdb);
- for (ModelMetaData model:deployment.getModelMetaDatas().values()) {
- for (String sourceName:model.getSourceNames()) {
- if (!isSourceAvailable(model.getSourceConnectionJndiName(sourceName))) {
- unAvailableDS.add(model.getSourceConnectionJndiName(sourceName));
- }
- }
- }
// add dependencies to data-sources
dataSourceDependencies(deployment, new DependentServices() {
@@ -176,10 +183,6 @@
vdbService.addDependency(DependencyType.OPTIONAL, TeiidServiceNames.OBJECT_REPLICATOR, ObjectReplicator.class, vdb.getObjectReplicatorInjector());
vdbService.setInitialMode(Mode.PASSIVE).install();
- if (!unAvailableDS.isEmpty()) {
- LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50021, deployment.getName(), deployment.getVersion(), unAvailableDS));
- }
-
ServiceController<?> scMain = deploymentUnit.getServiceRegistry().getService(deploymentUnit.getServiceName().append("contents")); //$NON-NLS-1$
scMain.addListener(new AbstractServiceListener<Object>() {
@Override
@@ -250,23 +253,6 @@
}
}
- private boolean isSourceAvailable(String name) {
- String jndiName = getJndiName(name);
- try {
- InitialContext ic = new InitialContext();
- try {
- ic.lookup(jndiName);
- } catch (Exception e) {
- if (!jndiName.equals(name)) {
- ic.lookup(name);
- }
- }
- } catch (Exception e) {
- return false;
- }
- return true;
- }
-
private String getJndiName(String name) {
String jndiName = name;
if (!name.startsWith(JAVA_CONTEXT)) {
@@ -281,5 +267,52 @@
return;
}
}
-
+
+ private MetadataRepository getMetadataRepository(VDBMetaData vdb, String modelName, IndexMetadataRepository indexRepo) throws DeploymentUnitProcessingException {
+ final ModelMetaData model = vdb.getModel(modelName);
+
+ if (model.getSchemaSourceType() == null) {
+ if (!vdb.isDynamic()) {
+ return indexRepo;
+ }
+
+ if (vdb.isDynamic() && model.isSource()) {
+ return new NativeMetadataRepository();
+ }
+ return null;
+ }
+
+ if (model.getSchemaSourceType().equalsIgnoreCase("DDL")) { //$NON-NLS-1$
+ return new DDLMetadataRepository();
+ }
+
+ if (model.getSchemaSourceType().equalsIgnoreCase("INDEX")) { //$NON-NLS-1$
+ return indexRepo;
+ }
+
+ if (model.getSchemaSourceType().equalsIgnoreCase("NATIVE")) { //$NON-NLS-1$
+ return new NativeMetadataRepository();
+ }
+
+ // if the schema type is a module based
+ final Module module;
+ ClassLoader moduleLoader = this.getClass().getClassLoader();
+ ModuleLoader ml = Module.getCallerModuleLoader();
+ if (model.getSchemaSourceType() != null && ml != null) {
+ try {
+ module = ml.loadModule(ModuleIdentifier.create(model.getSchemaSourceType()));
+ moduleLoader = module.getClassLoader();
+ } catch (ModuleLoadException e) {
+ throw new DeploymentUnitProcessingException(IntegrationPlugin.Util.getString("failed_load_module", IntegrationPlugin.Event.TEIID50068, model.getSchemaSourceType(), model.getName())); //$NON-NLS-1$
+ }
+ }
+
+ final ServiceLoader<MetadataRepository> serviceLoader = ServiceLoader.load(MetadataRepository.class, moduleLoader);
+ if (serviceLoader != null) {
+ for (MetadataRepository loader:serviceLoader) {
+ return loader;
+ }
+ }
+ return null;
+ }
}
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBParserDeployer.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -38,7 +38,7 @@
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
import org.teiid.metadata.VdbConstants;
-import org.teiid.metadata.index.IndexMetadataFactory;
+import org.teiid.metadata.index.IndexMetadataStore;
import org.teiid.runtime.RuntimePlugin;
@@ -84,9 +84,9 @@
parseVDBXML(file, deploymentUnit, phaseContext);
}
else if (file.getName().endsWith(VdbConstants.INDEX_EXT)) {
- IndexMetadataFactory imf = deploymentUnit.getAttachment(TeiidAttachments.INDEX_METADATA);
+ IndexMetadataStore imf = deploymentUnit.getAttachment(TeiidAttachments.INDEX_METADATA);
if (imf == null) {
- imf = new IndexMetadataFactory();
+ imf = new IndexMetadataStore();
deploymentUnit.putAttachment(TeiidAttachments.INDEX_METADATA, imf);
}
imf.addIndexFile(file);
@@ -126,7 +126,7 @@
protected VDBMetaData mergeMetaData(DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException {
VDBMetaData vdb = deploymentUnit.getAttachment(TeiidAttachments.VDB_METADATA);
UDFMetaData udf = deploymentUnit.getAttachment(TeiidAttachments.UDF_METADATA);
- IndexMetadataFactory imf = deploymentUnit.getAttachment(TeiidAttachments.INDEX_METADATA);
+ IndexMetadataStore imf = deploymentUnit.getAttachment(TeiidAttachments.INDEX_METADATA);
VirtualFile file = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
if (vdb == null) {
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/VDBService.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -24,10 +24,10 @@
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
+import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.IdentityHashMap;
-import java.util.LinkedHashMap;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Executor;
@@ -56,7 +56,6 @@
import org.teiid.common.buffer.BufferManager;
import org.teiid.core.TeiidException;
import org.teiid.deployers.CompositeVDB;
-import org.teiid.deployers.MetadataStoreGroup;
import org.teiid.deployers.TranslatorUtil;
import org.teiid.deployers.UDFMetaData;
import org.teiid.deployers.VDBLifeCycleListener;
@@ -67,11 +66,11 @@
import org.teiid.dqp.internal.datamgr.TranslatorRepository;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
+import org.teiid.metadata.MetadataFactory;
+import org.teiid.metadata.MetadataRepository;
import org.teiid.metadata.MetadataStore;
-import org.teiid.metadata.index.IndexMetadataFactory;
import org.teiid.query.ObjectReplicator;
import org.teiid.query.metadata.TransformationMetadata;
-import org.teiid.query.metadata.TransformationMetadata.Resource;
import org.teiid.query.tempdata.GlobalTableStore;
import org.teiid.query.tempdata.GlobalTableStoreImpl;
import org.teiid.runtime.RuntimePlugin;
@@ -96,12 +95,14 @@
@Override
public void start(StartContext context) throws StartException {
+
ConnectorManagerRepository cmr = new ConnectorManagerRepository();
TranslatorRepository repo = new TranslatorRepository();
+
this.vdb.addAttchment(TranslatorRepository.class, repo);
+
// check if this is a VDB with index files, if there are then build the TransformationMetadata
UDFMetaData udf = this.vdb.getAttachment(UDFMetaData.class);
- IndexMetadataFactory indexFactory = this.vdb.getAttachment(IndexMetadataFactory.class);
// add required connector managers; if they are not already there
for (Translator t: this.vdb.getOverrideTranslators()) {
@@ -148,96 +149,39 @@
getVDBRepository().addListener(this.vdbListener);
- // check to see if the vdb has been modified when server is down; if it is then clear the old files
- // This is no longer required as VDB can not modified in place in deployment directory as they held inside the data dir
- //if (vdbModifiedTime != -1L && getSerializer().isStale(this.vdb, vdbModifiedTime)) {
- // getSerializer().removeAttachments(this.vdb);
- // LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB ", vdb.getName(), " old cached metadata has been removed"); //$NON-NLS-1$ //$NON-NLS-2$
- //}
-
- boolean asynchLoad = false;
boolean preview = this.vdb.isPreview();
- // if store is null and vdb dynamic vdb then try to get the metadata
- MetadataStoreGroup store = null;
- if (this.vdb.isDynamic()) {
- store = new MetadataStoreGroup();
- asynchLoad = buildDynamicMetadataStore(this.vdb, store, cmr);
- }
- else if (indexFactory != null){
- store = getSerializer().loadSafe(getSerializer().buildVDBFile(this.vdb), MetadataStoreGroup.class);
- if (store == null) {
- store = new MetadataStoreGroup();
- try {
- store.addStore(indexFactory.getMetadataStore(getVDBRepository().getSystemStore().getDatatypes()));
- } catch (IOException e) {
- throw new StartException(IntegrationPlugin.Event.TEIID50031.name(), e);
- }
- }
- else {
- LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB ", vdb.getName(), " was loaded from cached metadata"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
+ MetadataStore store = new MetadataStore();
- // allow empty vdbs for enabling the preview functionality
- if (preview && store == null) {
- store = new MetadataStoreGroup();
- }
-
- if (store == null) {
- LogManager.logError(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50024, this.vdb.getName(), vdb.getVersion()));
- }
-
- LinkedHashMap<String, Resource> visibilityMap = null;
-
- if (indexFactory != null) {
- visibilityMap = indexFactory.getEntriesPlusVisibilities();
- }
-
try {
// add transformation metadata to the repository.
- getVDBRepository().addVDB(this.vdb, store, visibilityMap, udf, cmr);
+ getVDBRepository().addVDB(this.vdb, store, udf, cmr);
} catch (VirtualDatabaseException e) {
throw new StartException(IntegrationPlugin.Event.TEIID50032.name(), e);
+ }
+
+ this.vdb.removeAttachment(UDFMetaData.class);
+
+ // load metadata from the models
+ for (ModelMetaData model: this.vdb.getModelMetaDatas().values()) {
+ MetadataRepository metadataRepository = model.getAttachment(MetadataRepository.class);
+ if (metadataRepository == null) {
+ throw new StartException(IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50086, model.getName(), vdb.getName(), vdb.getVersion()));
+ }
+ model.addAttchment(MetadataRepository.class, metadataRepository);
+ loadMetadata(this.vdb, model, cmr, metadataRepository, store);
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, "Model ", model.getName(), "in VDB ", vdb.getName(), " was being loaded from its repository in separate thread"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- boolean valid = true;
synchronized (this.vdb) {
- if (indexFactory != null) {
- try {
- if (getSerializer().saveAttachment(getSerializer().buildVDBFile(this.vdb),store, false)) {
- LogManager.logTrace(LogConstants.CTX_RUNTIME, "VDB ", vdb.getName(), " metadata has been cached to data folder"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- } catch (IOException e1) {
- LogManager.logWarning(LogConstants.CTX_RUNTIME, e1, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50044, vdb.getName(), vdb.getVersion()));
- }
- }
- if (!preview) {
- valid = validateSources(cmr, vdb);
-
- // Check if the VDB is fully configured.
- if (!valid) {
- vdb.setStatus(VDB.Status.INACTIVE);
- } else if (!asynchLoad) {
- //if asynch this will be set by the loading thread
- getVDBRepository().finishDeployment(vdb.getName(), vdb.getVersion());
- vdb.setStatus(VDB.Status.ACTIVE);
- }
- }
- else {
+ if (preview) {
vdb.setStatus(VDB.Status.ACTIVE);
}
}
- this.vdb.removeAttachment(UDFMetaData.class);
- this.vdb.removeAttachment(MetadataStoreGroup.class);
- this.vdb.removeAttachment(IndexMetadataFactory.class);
-
- LogManager.logInfo(LogConstants.CTX_RUNTIME, valid?RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40003,vdb.getName(), vdb.getVersion()):RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40006,vdb.getName(), vdb.getVersion()));
}
@Override
public void stop(StopContext context) {
-
// stop object replication
if (getObjectReplicatorInjector().getValue() != null) {
GlobalTableStore gts = vdb.getAttachment(GlobalTableStore.class);
@@ -333,137 +277,129 @@
}
}
-
- private boolean validateSources(ConnectorManagerRepository cmr, VDBMetaData deployment) {
- boolean valid = true;
- for(Model m:deployment.getModels()) {
- ModelMetaData model = (ModelMetaData)m;
- List<SourceMappingMetadata> mappings = model.getSourceMappings();
- for (SourceMappingMetadata mapping:mappings) {
- ConnectorManager cm = cmr.getConnectorManager(mapping.getName());
- String msg = cm.getStausMessage();
- if (msg != null && msg.length() > 0) {
- valid = false;
- model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), cm.getStausMessage());
- LogManager.logInfo(LogConstants.CTX_RUNTIME, cm.getStausMessage());
- }
- }
-
- // in the dynamic case the metadata may be still loading.
- if (!model.getErrors().isEmpty()) {
- valid = false;
- }
- }
- return valid;
- }
- private boolean buildDynamicMetadataStore(final VDBMetaData vdb, final MetadataStoreGroup vdbStore, final ConnectorManagerRepository cmr) throws StartException {
+ private boolean loadMetadata(final VDBMetaData vdb, final ModelMetaData model, final ConnectorManagerRepository cmr, final MetadataRepository metadataRepo, final MetadataStore vdbMetadataStore) {
+
+ String msg = IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50029,vdb.getName(), vdb.getVersion(), model.getName(), SimpleDateFormat.getInstance().format(new Date()));
+ model.addError(ModelMetaData.ValidationError.Severity.ERROR.toString(), msg);
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, msg);
+
boolean asynch = false;
- // make sure we are configured correctly first
- for (final ModelMetaData model:vdb.getModelMetaDatas().values()) {
- if (model.getSourceNames().isEmpty()) {
- throw new StartException(RuntimePlugin.Util.getString("fail_to_deploy", vdb.getName()+"-"+vdb.getVersion(), model.getName())); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- final boolean cache = "cached".equalsIgnoreCase(vdb.getPropertyValue("UseConnectorMetadata")); //$NON-NLS-1$ //$NON-NLS-2$
- final File cacheFile = getSerializer().buildModelFile(this.vdb, model.getName());
- boolean loaded = false;
- if (cache) {
- MetadataStore store = getSerializer().loadSafe(cacheFile, MetadataStore.class);
- if (store != null) {
- vdbStore.addStore(store);
- loaded = true;
+ Runnable job = new Runnable() {
+ @Override
+ public void run() {
+
+ boolean metadataLoaded = false;
+ boolean cached = false;
+ List<String> errorMessages = new ArrayList<String>();
+
+ final File cachedFile = getSerializer().buildModelFile(vdb, model.getName());
+ MetadataFactory factory = getSerializer().loadSafe(cachedFile, MetadataFactory.class);
+ if (factory != null) {
+ metadataLoaded = true;
+ cached = true;
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, "Model ", model.getName(), "in VDB ", vdb.getName(), " was loaded from cached metadata"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- }
-
- if (!loaded) {
- Runnable job = new Runnable() {
- @Override
- public void run() {
- Boolean loadStatus = loadMetadata(vdb, model, cache, cacheFile, vdbStore, cmr);
- //if (loadStatus == null) {
- //TODO: a source is up, but we failed. should we retry or poll?
- //}
- if (loadStatus == null || !loadStatus) {
- //defer the load to the status checker if/when a source is available/redeployed
- model.addAttchment(Runnable.class, this);
- }
+
+ if (!metadataLoaded) {
+ factory = new MetadataFactory(vdb.getName(), vdb.getVersion(), model.getName(), getVDBRepository().getBuiltinDatatypes(), model.getProperties(), model.getSchemaText());
+
+
+ ExecutionFactory ef = null;
+ Object cf = null;
+
+ try {
+ ConnectorManager cm = getConnectorManager(model, cmr);
+ ef = ((cm == null)?null:cm.getExecutionFactory());
+ cf = ((cm == null)?null:cm.getConnectionFactory());
+ } catch (TranslatorException e1) {
+ //ignore data source not availability, it may not be required.
}
- };
- Executor executor = getExecutor();
- if (executor == null) {
- job.run();
- }
- else {
- asynch = true;
- executor.execute(job);
- }
- }
+
+ try {
+ metadataRepo.loadMetadata(factory, ef, cf);
+ model.setSchemaText(null); // avoid carrying non required data around.
+ metadataLoaded = true;
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50030,vdb.getName(), vdb.getVersion(), model.getName(), SimpleDateFormat.getInstance().format(new Date())));
+ } catch (TranslatorException e) {
+ errorMessages.add(e.getMessage());
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50036,vdb.getName(), vdb.getVersion(), model.getName(), e.getMessage()));
+ }
+ }
+
+ synchronized (vdb) {
+ if (metadataLoaded) {
+
+ if (!cached) {
+ // cache the schema to disk
+ cacheMetadataStore(vdb, factory);
+ }
+
+ // merge into VDB metadata
+ factory.mergeInto(vdbMetadataStore);
+
+ model.clearErrors();
+
+ if (vdb.isValid()) {
+ getVDBRepository().finishDeployment(vdb.getName(), vdb.getVersion());
+ }
+ }
+ else {
+ for (String errorMsg:errorMessages) {
+ model.addError(ModelMetaData.ValidationError.Severity.ERROR.toString(), errorMsg);
+ LogManager.logWarning(LogConstants.CTX_RUNTIME, errorMsg);
+ }
+ }
+ }
+
+ if (!metadataLoaded) {
+ //defer the load to the status checker if/when a source is available/redeployed
+ model.addAttchment(Runnable.class, this);
+ }
+ }
+ };
+
+ Executor executor = getExecutor();
+ if (executor == null) {
+ job.run();
}
+ else {
+ asynch = true;
+ executor.execute(job);
+ }
return asynch;
}
- /**
- * @return true if loaded, null if not loaded - but a cm is available, else false
- */
- private Boolean loadMetadata(VDBMetaData vdb, ModelMetaData model, boolean cache, File cacheFile, MetadataStoreGroup vdbStore, ConnectorManagerRepository cmr) {
- String msg = RuntimePlugin.Util.getString("model_metadata_loading", vdb.getName(), vdb.getVersion(), model.getName(), SimpleDateFormat.getInstance().format(new Date())); //$NON-NLS-1$
- model.addError(ModelMetaData.ValidationError.Severity.ERROR.toString(), msg);
- LogManager.logInfo(LogConstants.CTX_RUNTIME, msg);
-
- String exceptionMessage = null;
- Boolean loaded = false;
- for (String sourceName: model.getSourceNames()) {
- ConnectorManager cm = cmr.getConnectorManager(sourceName);
- String status = cm.getStausMessage();
- if (status != null && status.length() > 0) {
- exceptionMessage = status;
- continue;
+ private ConnectorManager getConnectorManager(final ModelMetaData model, final ConnectorManagerRepository cmr) {
+ if (model.isSource()) {
+ List<SourceMappingMetadata> mappings = model.getSourceMappings();
+ for (SourceMappingMetadata mapping:mappings) {
+ return cmr.getConnectorManager(mapping.getName());
}
- loaded = null;
- try {
- MetadataStore store = cm.getMetadata(model.getName(), getVDBRepository().getBuiltinDatatypes(), model.getProperties());
- if (cache) {
- getSerializer().saveAttachment(cacheFile, store, false);
- }
- vdbStore.addStore(store);
- loaded = true;
- break;
- } catch (TranslatorException e) {
- //TODO: we aren't effectively differentiating the type of load error - connectivity vs. metadata
- if (exceptionMessage == null) {
- exceptionMessage = e.getMessage();
- }
- } catch (IOException e) {
- if (exceptionMessage == null) {
- exceptionMessage = e.getMessage();
- }
- }
}
-
- synchronized (vdb) {
- if (loaded == null || !loaded) {
- vdb.setStatus(VDB.Status.INACTIVE);
- String failed_msg = IntegrationPlugin.Util.gs(loaded==null?IntegrationPlugin.Event.TEIID50036:IntegrationPlugin.Event.TEIID50030, vdb.getName(), vdb.getVersion(), model.getName());
- model.addError(ModelMetaData.ValidationError.Severity.ERROR.toString(), failed_msg);
- if (exceptionMessage != null) {
- model.addError(ModelMetaData.ValidationError.Severity.ERROR.toString(), exceptionMessage);
- }
- LogManager.logWarning(LogConstants.CTX_RUNTIME, failed_msg);
- } else {
- LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50029,vdb.getName(), vdb.getVersion(), model.getName()));
- model.clearErrors();
- if (vdb.isValid()) {
- getVDBRepository().finishDeployment(vdb.getName(), vdb.getVersion());
- vdb.setStatus(VDB.Status.ACTIVE);
- LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40003,vdb.getName(), vdb.getVersion()));
- }
- }
- }
-
- return loaded;
+ return null;
}
+
+ // if is not dynamic always cache; else check for the flag (this may need to be revisited with index vdb)
+ private void cacheMetadataStore(final VDBMetaData vdb, MetadataFactory schema) {
+ boolean cache = !vdb.isDynamic();
+ if (!vdb.isDynamic()) {
+ cache = "cached".equalsIgnoreCase(vdb.getPropertyValue("UseConnectorMetadata")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ if (cache) {
+ for (ModelMetaData model:vdb.getModelMetaDatas().values()) {
+ final File cachedFile = getSerializer().buildModelFile(vdb, model.getName());
+ try {
+ // TODO: save the model not VDB here.
+ getSerializer().saveAttachment(cachedFile, schema, false);
+ } catch (IOException e) {
+ LogManager.logWarning(LogConstants.CTX_RUNTIME, e, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50044, vdb.getName(), vdb.getVersion(), model.getName()));
+ }
+ }
+ }
+ }
+
public InjectedValue<VDBRepository> getVDBRepositoryInjector(){
return this.vdbRepositoryInjector;
}
Modified: trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties
===================================================================
--- trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/jboss-integration/src/main/resources/org/teiid/jboss/i18n.properties 2012-03-08 20:03:01 UTC (rev 3922)
@@ -79,18 +79,21 @@
failed_to_process_vdb_archive= failed to process VDB archive {0}
TEIID50023=replication failed {0}
TEIID50024=Failed to load metadata for VDB {0}.{1}
-TEIID50044=Failed to save metadata for VDB {0}.{1}
+TEIID50044=Failed to save metadata for VDB {0}.{1} for model {2}
+TEIID50086=No metadata defined for model {0} for VDB {1}.{2}
TEIID50025=VDB "{0}" deployed in {1} state.
+TEIID50087=Model {0} specified with no source information in VDB {1}.{2}
TEIID50026=VDB "{0}" undeployed.
-TEIID50036={0}.{1} is now "incomplete", because model "{2}" can not retrieve metadata. Please fix any errors and re-deploy relevant DataSources and/or the VDB.
-TEIID50030={0}.{1} is now "incomplete", because model "{2}" can not retrieve metadata. Please deploy the necessary DataSources.
-TEIID50029=VDB {0}.{1} model {2} metadata is currently being loaded.
+TEIID50029=VDB {0}.{1} model "{2}" metadata is currently being loaded. Start Time: {3}
+TEIID50030=VDB {0}.{1} model "{2}" metadata loaded. End Time: {3}
+TEIID50036=VDB {0}.{1} model "{2}" metadata failed to load. Reason:{3}
TEIID50042=error setting state {0}
duplicate_source_name={3} Source names are not unique for model {0} in {1}.{2}
source_name_mismatch={3} There are different sources with the name {0} in {1}.{2}
TEIID50043=Invalid metadata file found at {0}; delete this file and restart server.
failed_load_module= Failed to load module {0}
failed_load_translator_module= {0} Failed to load module {1} for translator {2}
+TEIID50088=Failed to load module {0} for UDF in VDB {1}.{2}:{3}
# subsystem description
teiid.add = Add the Teiid Subsystem
@@ -213,7 +216,7 @@
remove.reply.describe=remove service
remove.describe=remove service
-# paramters missing
+# parameters missing
vdb-name.missing=Parameter "vdb-name" is required
vdb-version.missing=Parameter "vdb-version" is required
cache-type.missing=Parameter "cache-type" is required
Modified: trunk/jboss-integration/src/test/resources/teiid-model-config.txt
===================================================================
--- trunk/jboss-integration/src/test/resources/teiid-model-config.txt 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/jboss-integration/src/test/resources/teiid-model-config.txt 2012-03-08 20:03:01 UTC (rev 3922)
@@ -92,11 +92,6 @@
"description" => "Policy Module; Implementation of org.teiid.PolicyDecider class ",
"required" => false
},
- "metadata-repository-module" => {
- "type" => STRING,
- "description" => "Runtime Metadata repository module; Runtime Metadata Updates can be made persistent though by configuring a \"org.teiid.metadata.MetadataRepository\". See Developer's Guide. ",
- "required" => false
- },
"distributed-cache-jgroups-stack" => {
"type" => STRING,
"description" => "JGroups stack name for cache replication channel",
Added: trunk/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataRepository.java
===================================================================
--- trunk/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataRepository.java (rev 0)
+++ trunk/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataRepository.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.metadata.index;
+
+import java.io.IOException;
+
+import org.teiid.metadata.MetadataFactory;
+import org.teiid.query.metadata.BaseMetadataRepository;
+import org.teiid.translator.ExecutionFactory;
+import org.teiid.translator.TranslatorException;
+
+public class IndexMetadataRepository extends BaseMetadataRepository {
+
+ private IndexMetadataStore idxStore;
+
+ public IndexMetadataRepository(IndexMetadataStore index) {
+ this.idxStore = index;
+ }
+
+ @Override
+ public void loadMetadata(MetadataFactory factory, ExecutionFactory executionFactory, Object connectionFactory)
+ throws TranslatorException {
+ try {
+ this.idxStore.load(factory.getName(), factory.getDataTypes() == null?null:factory.getDataTypes().values());
+ if (this.idxStore.getSchema(factory.getName()) == null) {
+ throw new TranslatorException(RuntimeMetadataPlugin.Util.gs(RuntimeMetadataPlugin.Event.TEIID80004, factory.getName()));
+ }
+ factory.mergeFrom(this.idxStore.getSchema(factory.getName()));
+ } catch (IOException e) {
+ throw new TranslatorException(e);
+ }
+ }
+}
Property changes on: trunk/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataRepository.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: trunk/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataStore.java (from rev 3883, trunk/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataFactory.java)
===================================================================
--- trunk/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataStore.java (rev 0)
+++ trunk/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataStore.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -0,0 +1,604 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.metadata.index;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URISyntaxException;
+import java.nio.charset.Charset;
+import java.util.*;
+import java.util.concurrent.Semaphore;
+
+import org.jboss.vfs.VirtualFile;
+import org.jboss.vfs.VirtualFileFilter;
+import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.VDBMetaData;
+import org.teiid.core.TeiidException;
+import org.teiid.core.TeiidRuntimeException;
+import org.teiid.core.index.IEntryResult;
+import org.teiid.core.util.PropertiesUtils;
+import org.teiid.core.util.StringUtil;
+import org.teiid.internal.core.index.Index;
+import org.teiid.metadata.*;
+import org.teiid.metadata.FunctionMethod.Determinism;
+import org.teiid.metadata.FunctionMethod.PushDown;
+import org.teiid.query.metadata.TransformationMetadata;
+import org.teiid.query.metadata.TransformationMetadata.Resource;
+
+
+/**
+ * Loads MetadataRecords from index files.
+ */
+public class IndexMetadataStore extends MetadataStore {
+ private static final long serialVersionUID = -7606516749442597438L;
+
+ private Index[] indexes;
+ private RecordFactory recordFactory = new RecordFactory() {
+
+ protected AbstractMetadataRecord getMetadataRecord(char[] record) {
+ if (record == null || record.length == 0) {
+ return null;
+ }
+ char c = record[0];
+ switch (c) {
+ case MetadataConstants.RECORD_TYPE.ANNOTATION: {
+ final List<String> tokens = RecordFactory.getStrings(record, IndexConstants.RECORD_STRING.RECORD_DELIMITER);
+
+ // Extract the index version information from the record
+ int indexVersion = recordFactory.getIndexVersion(record);
+ String uuid = tokens.get(2);
+
+ // The tokens are the standard header values
+ int tokenIndex = 6;
+
+ if(recordFactory.includeAnnotationProperties(indexVersion)) {
+ // The next token are the properties, ignore it not going to be read any way
+ tokenIndex++;
+ }
+
+ // The next token is the description
+ annotationCache.put(uuid, tokens.get(tokenIndex++));
+ return null;
+ }
+ case MetadataConstants.RECORD_TYPE.PROPERTY: {
+ final List<String> tokens = RecordFactory.getStrings(record, IndexConstants.RECORD_STRING.RECORD_DELIMITER);
+
+ String uuid = tokens.get(1);
+ LinkedHashMap<String, String> result = extensionCache.get(uuid);
+ if (result == null) {
+ result = new LinkedHashMap<String, String>();
+ extensionCache.put(uuid, result);
+ }
+ // The tokens are the standard header values
+ int tokenIndex = 2;
+ result.put( tokens.get(tokenIndex++), tokens.get(tokenIndex++));
+ return null;
+ }
+ default:
+ AbstractMetadataRecord abstractMetadataRecord = super.getMetadataRecord(record);
+ if (abstractMetadataRecord == null) {
+ return null; //record type no longer used
+ }
+ String parentName = null;
+ if (record[0] == MetadataConstants.RECORD_TYPE.TABLE) {
+ parentName = ((Table)abstractMetadataRecord).getParent().getName();
+ } else if (record[0] == MetadataConstants.RECORD_TYPE.CALLABLE) {
+ parentName = ((Procedure)abstractMetadataRecord).getParent().getName();
+ }
+ if (parentName != null) {
+ Map<Character, List<AbstractMetadataRecord>> map = schemaEntries.get(parentName);
+ if (map == null) {
+ map = new HashMap<Character, List<AbstractMetadataRecord>>();
+ schemaEntries.put(parentName, map);
+ }
+ List<AbstractMetadataRecord> typeRecords = map.get(record[0]);
+ if (typeRecords == null) {
+ typeRecords = new ArrayList<AbstractMetadataRecord>();
+ map.put(record[0], typeRecords);
+ }
+ typeRecords.add(abstractMetadataRecord);
+ }
+ Map<String, AbstractMetadataRecord> uuidMap = getByType(record[0]);
+ uuidMap.put(abstractMetadataRecord.getUUID(), abstractMetadataRecord);
+ if (parentId != null) {
+ List<AbstractMetadataRecord> typeChildren = getByParent(parentId, record[0], AbstractMetadataRecord.class, true);
+ typeChildren.add(abstractMetadataRecord);
+ }
+ return abstractMetadataRecord;
+ }
+ }
+ };
+ private Map<String, String> annotationCache = new HashMap<String, String>();
+ private Map<String, LinkedHashMap<String, String>> extensionCache = new HashMap<String, LinkedHashMap<String,String>>();
+ //map of schema name to record entries
+ private Map<String, Map<Character, List<AbstractMetadataRecord>>> schemaEntries = new HashMap<String, Map<Character, List<AbstractMetadataRecord>>>();
+ //map of parent uuid to record entries
+ private Map<String, Map<Character, List<AbstractMetadataRecord>>> childRecords = new HashMap<String, Map<Character, List<AbstractMetadataRecord>>>();
+ //map of type to maps of uuids
+ private Map<Character, LinkedHashMap<String, AbstractMetadataRecord>> allRecords = new HashMap<Character, LinkedHashMap<String, AbstractMetadataRecord>>();
+ private HashSet<VirtualFile> indexFiles = new HashSet<VirtualFile>();
+ private LinkedHashMap<String, Resource> vdbEntries;
+ private boolean loaded = false;
+ private Semaphore lock = new Semaphore(1);
+
+ public IndexMetadataStore() {
+
+ }
+
+ /**
+ * Load index metadata from a URL. For the system and test vdbs
+ * @param url
+ * @throws IOException
+ * @throws URISyntaxException
+ */
+ public IndexMetadataStore(VirtualFile vdb) throws IOException, URISyntaxException {
+ List<VirtualFile> children = vdb.getChildrenRecursively(new VirtualFileFilter() {
+ @Override
+ public boolean accepts(VirtualFile file) {
+ return file.getName().endsWith(IndexConstants.NAME_DELIM_CHAR+IndexConstants.INDEX_EXT);
+ }
+ });
+
+ for (VirtualFile f: children) {
+ addIndexFile(f);
+ }
+ //just use the defaults for model visibility
+ addEntriesPlusVisibilities(vdb, new VDBMetaData());
+ }
+
+ Map<String, AbstractMetadataRecord> getByType(char type) {
+ LinkedHashMap<String, AbstractMetadataRecord> uuidMap = allRecords.get(type);
+ if (uuidMap == null) {
+ uuidMap = new LinkedHashMap<String, AbstractMetadataRecord>();
+ allRecords.put(type, uuidMap);
+ }
+ return uuidMap;
+ }
+
+ <T extends AbstractMetadataRecord> List<T> getByParent(String parentId, char type, @SuppressWarnings("unused") Class<T> clazz, boolean create) {
+ Map<Character, List<AbstractMetadataRecord>> children = childRecords.get(parentId);
+ if (children == null) {
+ children = new HashMap<Character, List<AbstractMetadataRecord>>();
+ childRecords.put(parentId, children);
+ }
+ List<AbstractMetadataRecord> typeChildren = children.get(type);
+ if (typeChildren == null) {
+ if (!create) {
+ return Collections.emptyList();
+ }
+ typeChildren = new ArrayList<AbstractMetadataRecord>(2);
+ children.put(type, typeChildren);
+ }
+ return (List<T>) typeChildren;
+ }
+
+ private void loadAll() {
+ for (Index index : this.indexes) {
+ try {
+ IEntryResult[] results = SimpleIndexUtil.queryIndex(new Index[] {index}, new char[0], true, true, false);
+ recordFactory.getMetadataRecord(results);
+ } catch (TeiidException e) {
+ throw new TeiidRuntimeException(RuntimeMetadataPlugin.Event.TEIID80000, e);
+ }
+ }
+ //associate the annotation/extension metadata
+ for (Map<String, AbstractMetadataRecord> map : allRecords.values()) {
+ for (AbstractMetadataRecord metadataRecord : map.values()) {
+ String uuid = metadataRecord.getUUID();
+
+ metadataRecord.setAnnotation(this.annotationCache.get(uuid));
+ metadataRecord.setProperties(this.extensionCache.get(uuid));
+ }
+ }
+ }
+ public void load(Collection<Datatype> systemDatatypes) throws IOException {
+ load(null, systemDatatypes);
+ Collection<AbstractMetadataRecord> modelRecords = getByType(MetadataConstants.RECORD_TYPE.MODEL).values();
+ for (AbstractMetadataRecord record:modelRecords) {
+ Schema s = (Schema) record;
+ load(s.getName(), systemDatatypes);
+ }
+ }
+
+ public void load(String modelName, Collection<Datatype> systemDatatypes) throws IOException {
+ // there are multiple threads trying to load this, since the initial index lading is not
+ // optimized for multi-thread loading this locking to sync will work
+ try {
+ this.lock.acquire();
+ } catch (InterruptedException e) {
+ }
+
+ if (!this.loaded) {
+ if (systemDatatypes == null) {
+ InputStream is = this.getClass().getClassLoader().getResourceAsStream("org/teiid/metadata/types.dat"); //$NON-NLS-1$
+ try {
+ InputStreamReader isr = new InputStreamReader(is, Charset.forName("UTF-8")); //$NON-NLS-1$
+ BufferedReader br = new BufferedReader(isr);
+ String s = br.readLine();
+ String[] props = s.split("\\|"); //$NON-NLS-1$
+ while ((s = br.readLine()) != null) {
+ Datatype dt = new Datatype();
+ String[] vals = s.split("\\|"); //$NON-NLS-1$
+ Properties p = new Properties();
+ for (int i = 0; i < props.length; i++) {
+ if (vals[i].length() != 0) {
+ p.setProperty(props[i], new String(vals[i]));
+ }
+ }
+ PropertiesUtils.setBeanProperties(dt, p, null);
+ addDatatype(dt);
+ }
+ } finally {
+ is.close();
+ }
+ }
+ ArrayList<Index> tmp = new ArrayList<Index>();
+ for (VirtualFile f : indexFiles) {
+ Index index = new Index(f, true);
+ index.setDoCache(true);
+ tmp.add(index);
+ }
+ this.indexes = tmp.toArray(new Index[tmp.size()]);
+ loadAll();
+ //force close, since we cached the index files
+ for (Index index : tmp) {
+ index.close();
+ }
+ Map<String, AbstractMetadataRecord> uuidToRecord = getByType(MetadataConstants.RECORD_TYPE.DATATYPE);
+ if (systemDatatypes != null) {
+ for (Datatype datatype : systemDatatypes) {
+ uuidToRecord.put(datatype.getUUID(), datatype);
+ }
+ } else {
+ for (Datatype datatype : getDatatypes()) {
+ uuidToRecord.put(datatype.getUUID(), datatype);
+ }
+ }
+ for (AbstractMetadataRecord datatypeRecordImpl : uuidToRecord.values()) {
+ addDatatype((Datatype) datatypeRecordImpl);
+ }
+ this.loaded = true;
+ }
+
+ this.lock.release();
+
+ if (this.loaded) {
+ getModels(modelName);
+ getTables(modelName);
+ getProcedures(modelName);
+ }
+ }
+
+ public void addIndexFile(VirtualFile f) {
+ this.indexFiles.add(f);
+ }
+
+ public void addEntriesPlusVisibilities(VirtualFile root, VDBMetaData vdb) throws IOException {
+ LinkedHashMap<String, Resource> visibilityMap = new LinkedHashMap<String, Resource>();
+ for(VirtualFile f: root.getChildrenRecursively()) {
+ if (f.isFile()) {
+ // remove the leading vdb name from the entry
+ String path = f.getPathName().substring(root.getPathName().length());
+ if (!path.startsWith("/")) { //$NON-NLS-1$
+ path = "/" + path; //$NON-NLS-1$
+ }
+ visibilityMap.put(path, new Resource(f, isFileVisible(f.getPathName(), vdb)));
+ }
+ }
+ this.vdbEntries = visibilityMap;
+ }
+
+ private boolean isFileVisible(String pathInVDB, VDBMetaData vdb) {
+
+ if (pathInVDB.endsWith(".xmi")) { //$NON-NLS-1$
+ String modelName = StringUtil.getFirstToken(StringUtil.getLastToken(pathInVDB, "/"), "."); //$NON-NLS-1$ //$NON-NLS-2$
+
+ ModelMetaData model = vdb.getModel(modelName);
+ if (model != null) {
+ return model.isVisible();
+ }
+ }
+
+ if (pathInVDB.startsWith("META-INF/")) {//$NON-NLS-1$
+ return false;
+ }
+
+ String entry = StringUtil.getLastToken(pathInVDB, "/"); //$NON-NLS-1$
+
+ // index files should not be visible
+ if( entry.endsWith(VdbConstants.INDEX_EXT) || entry.endsWith(VdbConstants.SEARCH_INDEX_EXT)) {
+ return false;
+ }
+
+ // deployment file should not be visible
+ if(entry.equalsIgnoreCase(VdbConstants.DEPLOYMENT_FILE)) {
+ return false;
+ }
+
+ // any other file should be visible
+ return true;
+ }
+
+ public LinkedHashMap<String, Resource> getEntriesPlusVisibilities(){
+ return this.vdbEntries;
+ }
+
+ private void getModels(String modelName) {
+ // the index map below is keyed by uuid not modelname, so map lookup is not possible
+ Collection<AbstractMetadataRecord> modelRecords = getByType(MetadataConstants.RECORD_TYPE.MODEL).values();
+ for (AbstractMetadataRecord modelRecord:modelRecords) {
+ Schema s = (Schema) modelRecord;
+ if (s.getName().equalsIgnoreCase(modelName)) {
+ addSchema((Schema) modelRecord);
+ }
+ }
+ }
+
+ private void getTables(String modelName) {
+ Schema model = getSchemas().get(modelName);
+
+ if (model == null) {
+ return;
+ }
+
+ Map<Character, List<AbstractMetadataRecord>> entries = schemaEntries.get(modelName);
+ if (entries == null) {
+ return;
+ }
+
+ List recs = entries.get(MetadataConstants.RECORD_TYPE.TABLE);
+ if (recs == null) {
+ return;
+ }
+
+ List<Table> records = recs;
+
+ //load non-materialized first, so that the uuid->table cache is populated
+ Collections.sort(records, new Comparator<Table>() {
+ @Override
+ public int compare(Table o1, Table o2) {
+ if (!o1.isMaterialized()) {
+ return -1;
+ }
+ if (!o2.isMaterialized()) {
+ return 1;
+ }
+ return 0;
+ }
+ });
+ for (Table tableRecord : records) {
+ List<Column> columns = new ArrayList<Column>(getByParent(tableRecord.getUUID(), MetadataConstants.RECORD_TYPE.COLUMN, Column.class, false));
+ for (Column columnRecordImpl : columns) {
+ columnRecordImpl.setDatatype((Datatype) getByType(MetadataConstants.RECORD_TYPE.DATATYPE).get(columnRecordImpl.getDatatypeUUID()));
+ columnRecordImpl.setParent(tableRecord);
+ String fullName = columnRecordImpl.getName();
+ if (fullName.startsWith(tableRecord.getName() + '.')) {
+ columnRecordImpl.setName(new String(fullName.substring(tableRecord.getName().length() + 1)));
+ }
+ }
+ Collections.sort(columns);
+ tableRecord.setColumns(columns);
+ tableRecord.setAccessPatterns(getByParent(tableRecord.getUUID(), MetadataConstants.RECORD_TYPE.ACCESS_PATTERN, KeyRecord.class, false));
+ Map<String, Column> uuidColumnMap = new HashMap<String, Column>();
+ for (Column columnRecordImpl : columns) {
+ uuidColumnMap.put(columnRecordImpl.getUUID(), columnRecordImpl);
+ }
+ for (KeyRecord columnSetRecordImpl : tableRecord.getAccessPatterns()) {
+ loadColumnSetRecords(columnSetRecordImpl, uuidColumnMap);
+ columnSetRecordImpl.setParent(tableRecord);
+ }
+ tableRecord.setForiegnKeys(getByParent(tableRecord.getUUID(), MetadataConstants.RECORD_TYPE.FOREIGN_KEY, ForeignKey.class, false));
+ for (ForeignKey foreignKeyRecord : tableRecord.getForeignKeys()) {
+ KeyRecord pk = (KeyRecord) getRecordByType(foreignKeyRecord.getUniqueKeyID(), MetadataConstants.RECORD_TYPE.PRIMARY_KEY, false);
+ if (pk == null) {
+ pk = (KeyRecord) getRecordByType(foreignKeyRecord.getUniqueKeyID(), MetadataConstants.RECORD_TYPE.UNIQUE_KEY);
+ }
+ foreignKeyRecord.setPrimaryKey(pk);
+ loadColumnSetRecords(foreignKeyRecord, uuidColumnMap);
+ foreignKeyRecord.setParent(tableRecord);
+ }
+ tableRecord.setUniqueKeys(getByParent(tableRecord.getUUID(), MetadataConstants.RECORD_TYPE.UNIQUE_KEY, KeyRecord.class, false));
+ for (KeyRecord columnSetRecordImpl : tableRecord.getUniqueKeys()) {
+ loadColumnSetRecords(columnSetRecordImpl, uuidColumnMap);
+ columnSetRecordImpl.setParent(tableRecord);
+ }
+ List<KeyRecord> indexRecords = tableRecord.getIndexes();
+ for (int i = 0; i < indexRecords.size(); i++) {
+ indexRecords.set(i, (KeyRecord) getRecordByType(indexRecords.get(i).getUUID(), MetadataConstants.RECORD_TYPE.INDEX));
+ }
+ for (KeyRecord columnSetRecordImpl : indexRecords) {
+ loadColumnSetRecords(columnSetRecordImpl, uuidColumnMap);
+ columnSetRecordImpl.setParent(tableRecord);
+ }
+ if (tableRecord.getPrimaryKey() != null) {
+ KeyRecord primaryKey = (KeyRecord) getRecordByType(tableRecord.getPrimaryKey().getUUID(), MetadataConstants.RECORD_TYPE.PRIMARY_KEY);
+ loadColumnSetRecords(primaryKey, uuidColumnMap);
+ primaryKey.setParent(tableRecord);
+ tableRecord.setPrimaryKey(primaryKey);
+ }
+ String groupUUID = tableRecord.getUUID();
+ if (tableRecord.isVirtual()) {
+ TransformationRecordImpl update = (TransformationRecordImpl)getRecordByType(groupUUID, MetadataConstants.RECORD_TYPE.UPDATE_TRANSFORM,false);
+ if (update != null) {
+ tableRecord.setUpdatePlan(update.getTransformation());
+ }
+ TransformationRecordImpl insert = (TransformationRecordImpl)getRecordByType(groupUUID, MetadataConstants.RECORD_TYPE.INSERT_TRANSFORM,false);
+ if (insert != null) {
+ tableRecord.setInsertPlan(insert.getTransformation());
+ }
+ TransformationRecordImpl delete = (TransformationRecordImpl)getRecordByType(groupUUID, MetadataConstants.RECORD_TYPE.DELETE_TRANSFORM,false);
+ if (delete != null) {
+ tableRecord.setDeletePlan(delete.getTransformation());
+ }
+ TransformationRecordImpl select = (TransformationRecordImpl)getRecordByType(groupUUID, MetadataConstants.RECORD_TYPE.SELECT_TRANSFORM,false);
+ // this group may be an xml document
+ if(select == null) {
+ select = (TransformationRecordImpl)getRecordByType(groupUUID, MetadataConstants.RECORD_TYPE.MAPPING_TRANSFORM,false);
+ }
+ if (select != null) {
+ tableRecord.setSelectTransformation(select.getTransformation());
+ tableRecord.setBindings(select.getBindings());
+ tableRecord.setSchemaPaths(select.getSchemaPaths());
+ tableRecord.setResourcePath(select.getResourcePath());
+ }
+ }
+ if (tableRecord.isMaterialized()) {
+ tableRecord.setMaterializedStageTable((Table)getByType(MetadataConstants.RECORD_TYPE.TABLE).get(tableRecord.getMaterializedStageTable().getUUID()));
+ tableRecord.setMaterializedTable((Table)getByType(MetadataConstants.RECORD_TYPE.TABLE).get(tableRecord.getMaterializedTable().getUUID()));
+ }
+ model.addTable(tableRecord);
+ }
+ }
+
+ private Column findElement(String fullName) {
+ Column columnRecord = (Column)getRecordByType(fullName, MetadataConstants.RECORD_TYPE.COLUMN);
+ columnRecord.setDatatype((Datatype) getByType(MetadataConstants.RECORD_TYPE.DATATYPE).get(columnRecord.getDatatypeUUID()));
+ return columnRecord;
+ }
+
+ private AbstractMetadataRecord getRecordByType(final String entityName, final char recordType) {
+ return getRecordByType(entityName, recordType, true);
+ }
+
+ private AbstractMetadataRecord getRecordByType(final String entityName, final char recordType, boolean mustExist) {
+ // Query the index files
+ AbstractMetadataRecord record = getByType(recordType).get(entityName);
+
+ if(record == null) {
+ if (mustExist) {
+ // there should be only one for the UUID
+ throw new TeiidRuntimeException(RuntimeMetadataPlugin.Event.TEIID80002, entityName+TransformationMetadata.NOT_EXISTS_MESSAGE);
+ }
+ return null;
+ }
+ return record;
+ }
+
+ private void getProcedures(String modelName) {
+ Schema model = getSchemas().get(modelName);
+ if (model == null) {
+ return;
+ }
+
+ Map<Character, List<AbstractMetadataRecord>> entries = schemaEntries.get(model.getName());
+ if (entries == null) {
+ return;
+ }
+
+ List recs = entries.get(MetadataConstants.RECORD_TYPE.CALLABLE);
+ if (recs == null) {
+ return;
+ }
+
+ List<Procedure> records = recs;
+ for (Procedure procedureRecord : records) {
+ // get the parameter metadata info
+ for (int i = 0; i < procedureRecord.getParameters().size(); i++) {
+ ProcedureParameter paramRecord = (ProcedureParameter) this.getRecordByType(procedureRecord.getParameters().get(i).getUUID(), MetadataConstants.RECORD_TYPE.CALLABLE_PARAMETER);
+ paramRecord.setDatatype((Datatype) getByType(MetadataConstants.RECORD_TYPE.DATATYPE).get(paramRecord.getDatatypeUUID()));
+ procedureRecord.getParameters().set(i, paramRecord);
+ paramRecord.setProcedure(procedureRecord);
+ }
+
+ ColumnSet<Procedure> result = procedureRecord.getResultSet();
+ if(result != null) {
+ ColumnSet<Procedure> resultRecord = (ColumnSet<Procedure>) getRecordByType(result.getUUID(), MetadataConstants.RECORD_TYPE.RESULT_SET, false);
+ if (resultRecord != null) {
+ resultRecord.setParent(procedureRecord);
+ resultRecord.setName(RecordFactory.getShortName(resultRecord.getName()));
+ loadColumnSetRecords(resultRecord, null);
+ procedureRecord.setResultSet(resultRecord);
+ }
+ //it is ok to be null here. it will happen when a
+ //virtual stored procedure is created from a
+ //physical stored procedure without a result set
+ //TODO: find a better fix for this
+ }
+
+ // if this is a virtual procedure get the procedure plan
+ if(procedureRecord.isVirtual()) {
+ TransformationRecordImpl transformRecord = (TransformationRecordImpl)getRecordByType(procedureRecord.getUUID(), MetadataConstants.RECORD_TYPE.PROC_TRANSFORM, false);
+ if(transformRecord != null) {
+ procedureRecord.setQueryPlan(transformRecord.getTransformation());
+ }
+ } else if (procedureRecord.isFunction()) {
+ boolean deterministic = Boolean.valueOf(procedureRecord.getProperty(AbstractMetadataRecord.RELATIONAL_URI + "deterministic", true)); //$NON-NLS-1$
+ boolean nullOnNull = Boolean.valueOf(procedureRecord.getProperty(AbstractMetadataRecord.RELATIONAL_URI + "null-on-null", false)); //$NON-NLS-1$
+ boolean varargs = Boolean.valueOf(procedureRecord.getProperty(AbstractMetadataRecord.RELATIONAL_URI + "varargs", false)); //$NON-NLS-1$
+ FunctionParameter outputParam = null;
+ List<FunctionParameter> args = new ArrayList<FunctionParameter>(procedureRecord.getParameters().size() - 1);
+ boolean valid = true;
+ for (ProcedureParameter param : procedureRecord.getParameters()) {
+ FunctionParameter fp = new FunctionParameter();
+ fp.setName(param.getName());
+ fp.setDescription(param.getAnnotation());
+ fp.setType(param.getRuntimeType());
+ switch (param.getType()) {
+ case ReturnValue:
+ if (outputParam != null) {
+ valid = false;
+ }
+ outputParam = fp;
+ break;
+ case In:
+ args.add(fp);
+ break;
+ default:
+ valid = false;
+ }
+ }
+ if (valid && outputParam != null) {
+ FunctionMethod function = new FunctionMethod(procedureRecord.getName(), procedureRecord.getAnnotation(), model.getName(), PushDown.MUST_PUSHDOWN,
+ null, null, args, outputParam, false, deterministic?Determinism.DETERMINISTIC:Determinism.NONDETERMINISTIC);
+ function.setNullOnNull(nullOnNull);
+ if (varargs && !function.getInputParameters().isEmpty()) {
+ function.getInputParameters().get(args.size() - 1).setVarArg(varargs);
+ }
+ model.addFunction(function);
+ continue;
+ }
+ }
+ model.addProcedure(procedureRecord);
+ }
+ }
+
+ private void loadColumnSetRecords(ColumnSet<?> indexRecord, Map<String, Column> columns) {
+ for (int i = 0; i < indexRecord.getColumns().size(); i++) {
+ String uuid = indexRecord.getColumns().get(i).getUUID();
+ Column c = null;
+ if (columns != null) {
+ c = columns.get(uuid);
+ } else {
+ c = findElement(uuid);
+ c.setName(RecordFactory.getShortName(c.getName()));
+ }
+ indexRecord.getColumns().set(i, c);
+ if (columns == null) {
+ c.setParent(indexRecord);
+ }
+ }
+ }
+
+}
Property changes on: trunk/metadata/src/main/java/org/teiid/metadata/index/IndexMetadataStore.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/metadata/src/main/java/org/teiid/metadata/index/RuntimeMetadataPlugin.java
===================================================================
--- trunk/metadata/src/main/java/org/teiid/metadata/index/RuntimeMetadataPlugin.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/metadata/src/main/java/org/teiid/metadata/index/RuntimeMetadataPlugin.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -47,5 +47,6 @@
TEIID80001,
TEIID80002,
TEIID80003,
+ TEIID80004
}
}
Modified: trunk/metadata/src/main/resources/org/teiid/metadata/i18n.properties
===================================================================
--- trunk/metadata/src/main/resources/org/teiid/metadata/i18n.properties 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/metadata/src/main/resources/org/teiid/metadata/i18n.properties 2012-03-08 20:03:01 UTC (rev 3922)
@@ -25,4 +25,5 @@
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
TransformationMetadata.0={0} ambiguous, more than one entity matching the same name
-exception.wrongFormat=Index file in wrong format
\ No newline at end of file
+exception.wrongFormat=Index file in wrong format
+TEIID80004 = Model {0} not found
\ No newline at end of file
Modified: trunk/metadata/src/test/java/org/teiid/metadata/index/VDBMetadataFactory.java
===================================================================
--- trunk/metadata/src/test/java/org/teiid/metadata/index/VDBMetadataFactory.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/metadata/src/test/java/org/teiid/metadata/index/VDBMetadataFactory.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -40,6 +40,7 @@
import org.teiid.core.TeiidRuntimeException;
import org.teiid.core.util.FileUtils;
import org.teiid.core.util.LRUCache;
+import org.teiid.metadata.Datatype;
import org.teiid.metadata.FunctionMethod;
import org.teiid.metadata.MetadataStore;
import org.teiid.query.function.FunctionTree;
@@ -68,7 +69,7 @@
public static MetadataStore getSystem() {
try {
if (system == null) {
- system = loadMetadata( CoreConstants.SYSTEM_VDB, Thread.currentThread().getContextClassLoader().getResource(CoreConstants.SYSTEM_VDB)).getMetadataStore(null);
+ system= loadMetadata( CoreConstants.SYSTEM_VDB, Thread.currentThread().getContextClassLoader().getResource(CoreConstants.SYSTEM_VDB));
}
return system;
} catch (Exception e) {
@@ -83,7 +84,7 @@
}
try {
- IndexMetadataFactory imf = loadMetadata(vdbName, vdbURL);
+ IndexMetadataStore imf = loadMetadata(vdbName, vdbURL, getSystem().getDatatypes());
Collection <FunctionMethod> methods = null;
Collection<FunctionTree> trees = null;
@@ -93,7 +94,7 @@
trees = Arrays.asList(new FunctionTree(schema, new UDFSource(methods), true));
}
SystemFunctionManager sfm = new SystemFunctionManager();
- vdbmetadata = new TransformationMetadata(null, new CompositeMetadataStore(Arrays.asList(getSystem(), imf.getMetadataStore(getSystem().getDatatypes()))), imf.getEntriesPlusVisibilities(), sfm.getSystemFunctions(), trees);
+ vdbmetadata = new TransformationMetadata(null, new CompositeMetadataStore(Arrays.asList(getSystem(), imf)), imf.getEntriesPlusVisibilities(), sfm.getSystemFunctions(), trees);
VDB_CACHE.put(vdbURL, vdbmetadata);
return vdbmetadata;
} catch (URISyntaxException e) {
@@ -103,14 +104,20 @@
}
}
- public static IndexMetadataFactory loadMetadata(String vdbName, URL url) throws IOException, MalformedURLException, URISyntaxException {
+ public static IndexMetadataStore loadMetadata(String vdbName, URL url, Collection<Datatype> dataTypes) throws IOException, MalformedURLException, URISyntaxException {
VirtualFile root = VFS.getChild(vdbName);
if (!root.exists()) {
VFS.mountZip(url.openStream(), vdbName, root, TempFileProvider.create("vdbs", Executors.newScheduledThreadPool(2)));
// once done this mount should be closed, since this class is only used testing
// it is hard to event when the test is done, otherwise we need to elevate the VFS to top
}
- return new IndexMetadataFactory(root);
+ IndexMetadataStore store = new IndexMetadataStore(root);
+ store.load(dataTypes);
+ return store;
+
+ }
+
+ public static IndexMetadataStore loadMetadata(String vdbName, URL url) throws IOException, MalformedURLException, URISyntaxException {
+ return loadMetadata(vdbName, url, null);
}
-
}
Modified: trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/runtime/src/main/java/org/teiid/deployers/CompositeVDB.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -24,6 +24,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
@@ -31,13 +32,25 @@
import org.teiid.adminapi.Model;
import org.teiid.adminapi.impl.DataPolicyMetadata;
import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.SourceMappingMetadata;
import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.core.CoreConstants;
import org.teiid.dqp.internal.datamgr.ConnectorManager;
import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
+import org.teiid.logging.LogConstants;
+import org.teiid.logging.LogManager;
+import org.teiid.metadata.AbstractMetadataRecord;
+import org.teiid.metadata.Column;
+import org.teiid.metadata.ColumnStats;
+import org.teiid.metadata.DefaultMetadataRepository;
import org.teiid.metadata.FunctionMethod;
+import org.teiid.metadata.MetadataRepository;
import org.teiid.metadata.MetadataStore;
+import org.teiid.metadata.Procedure;
import org.teiid.metadata.Schema;
+import org.teiid.metadata.Table;
+import org.teiid.metadata.TableStats;
+import org.teiid.metadata.index.IndexMetadataStore;
import org.teiid.query.function.FunctionTree;
import org.teiid.query.function.UDFSource;
import org.teiid.query.metadata.CompositeMetadataStore;
@@ -50,7 +63,7 @@
public class CompositeVDB {
private VDBMetaData vdb;
- private MetadataStoreGroup stores;
+ private MetadataStore store;
private LinkedHashMap<String, Resource> visibilityMap;
private UDFMetaData udf;
private LinkedHashMap<VDBKey, CompositeVDB> children;
@@ -61,20 +74,19 @@
// used as cached item to avoid rebuilding
private VDBMetaData mergedVDB;
- public CompositeVDB(VDBMetaData vdb, MetadataStoreGroup stores, LinkedHashMap<String, Resource> visibilityMap, UDFMetaData udf, FunctionTree systemFunctions, ConnectorManagerRepository cmr, MetadataStore... additionalStores) {
+ public CompositeVDB(VDBMetaData vdb, MetadataStore metadataStore, UDFMetaData udf, FunctionTree systemFunctions, ConnectorManagerRepository cmr, MetadataStore... additionalStores) {
this.vdb = vdb;
- this.stores = stores;
- this.visibilityMap = visibilityMap;
+ this.store = metadataStore;
+ if (metadataStore instanceof IndexMetadataStore) {
+ this.visibilityMap = ((IndexMetadataStore)metadataStore).getEntriesPlusVisibilities();
+ }
this.udf = udf;
this.systemFunctions = systemFunctions;
this.cmr = cmr;
- this.additionalStores = additionalStores;
- this.vdb.addAttchment(ConnectorManagerRepository.class, cmr);
- this.mergedVDB = vdb;
- update();
+ this.additionalStores = additionalStores;
}
- public synchronized void addChild(CompositeVDB child) {
+ synchronized void addChild(CompositeVDB child) {
if (this.children == null) {
this.children = new LinkedHashMap<VDBKey, CompositeVDB>();
}
@@ -83,20 +95,35 @@
this.mergedVDB = null;
}
- public synchronized void removeChild(VDBKey child) {
+ synchronized void removeChild(VDBKey child) {
if (this.children != null) {
this.children.remove(child);
}
this.mergedVDB = null;
}
- synchronized void update() {
- TransformationMetadata metadata = buildTransformationMetaData(mergedVDB, getVisibilityMap(), getMetadataStores(), getUDF(), systemFunctions, this.additionalStores);
- mergedVDB.addAttchment(QueryMetadataInterface.class, metadata);
- mergedVDB.addAttchment(TransformationMetadata.class, metadata);
+ private synchronized void update() {
+ if (this.mergedVDB == null) {
+
+ this.mergedVDB = buildVDB();
+
+ MetadataStore mergedStore = getMetadataStore();
+
+ for (ModelMetaData model:this.mergedVDB.getModelMetaDatas().values()) {
+ MetadataRepository repo = model.getAttachment(MetadataRepository.class);
+ if (repo instanceof DefaultMetadataRepository) {
+ updateFromMetadataRepository(this.mergedVDB, mergedStore.getSchema(model.getName()), (DefaultMetadataRepository)repo);
+ }
+ }
+
+ TransformationMetadata metadata = buildTransformationMetaData(this.mergedVDB, getVisibilityMap(), mergedStore, getUDF(), systemFunctions, this.additionalStores);
+ this.mergedVDB.addAttchment(QueryMetadataInterface.class, metadata);
+ this.mergedVDB.addAttchment(TransformationMetadata.class, metadata);
+ this.mergedVDB.addAttchment(MetadataStore.class, mergedStore);
+ }
}
- private static TransformationMetadata buildTransformationMetaData(VDBMetaData vdb, LinkedHashMap<String, Resource> visibilityMap, MetadataStoreGroup stores, UDFMetaData udf, FunctionTree systemFunctions, MetadataStore[] additionalStores) {
+ private static TransformationMetadata buildTransformationMetaData(VDBMetaData vdb, LinkedHashMap<String, Resource> visibilityMap, MetadataStore store, UDFMetaData udf, FunctionTree systemFunctions, MetadataStore[] additionalStores) {
Collection <FunctionTree> udfs = new ArrayList<FunctionTree>();
if (udf != null) {
for (Map.Entry<String, Collection<FunctionMethod>> entry : udf.getFunctions().entrySet()) {
@@ -104,9 +131,9 @@
}
}
- CompositeMetadataStore compositeStore = new CompositeMetadataStore(stores.getStores());
+ CompositeMetadataStore compositeStore = new CompositeMetadataStore(store);
for (MetadataStore s:additionalStores) {
- compositeStore.addMetadataStore(s);
+ compositeStore.merge(s);
for (Schema schema:s.getSchemas().values()) {
if (!schema.getFunctions().isEmpty()) {
udfs.add(new FunctionTree(schema.getName(), new UDFSource(schema.getFunctions().values()), true));
@@ -119,19 +146,14 @@
return metadata;
}
- public MetadataStore[] getAdditionalStores() {
- return additionalStores;
- }
-
public synchronized VDBMetaData getVDB() {
- if (this.mergedVDB == null) {
- this.mergedVDB = buildVDB();
+ if (this.mergedVDB == null) {
update();
}
return this.mergedVDB;
}
- public synchronized boolean hasChildVdb(VDBKey child) {
+ synchronized boolean hasChildVdb(VDBKey child) {
if (this.children != null) {
return this.children.containsKey(child);
}
@@ -139,6 +161,12 @@
}
private VDBMetaData buildVDB() {
+
+ if (this.children == null || this.children.isEmpty()) {
+ this.vdb.addAttchment(ConnectorManagerRepository.class, this.cmr);
+ return this.vdb;
+ }
+
VDBMetaData newMergedVDB = new VDBMetaData();
newMergedVDB.setName(this.vdb.getName());
newMergedVDB.setVersion(this.vdb.getVersion());
@@ -150,20 +178,20 @@
newMergedVDB.setConnectionType(this.vdb.getConnectionType());
ConnectorManagerRepository mergedRepo = new ConnectorManagerRepository();
mergedRepo.getConnectorManagers().putAll(this.cmr.getConnectorManagers());
- if (this.children != null) {
- for (CompositeVDB child:this.children.values()) {
-
- // add models
- for (Model m:child.getVDB().getModels()) {
- newMergedVDB.addModel((ModelMetaData)m);
- }
-
- for (DataPolicy p:child.getVDB().getDataPolicies()) {
- newMergedVDB.addDataPolicy((DataPolicyMetadata)p);
- }
- mergedRepo.getConnectorManagers().putAll(child.cmr.getConnectorManagers());
+
+ for (CompositeVDB child:this.children.values()) {
+
+ // add models
+ for (Model m:child.getVDB().getModels()) {
+ newMergedVDB.addModel((ModelMetaData)m);
}
+
+ for (DataPolicy p:child.getVDB().getDataPolicies()) {
+ newMergedVDB.addDataPolicy((DataPolicyMetadata)p);
+ }
+ mergedRepo.getConnectorManagers().putAll(child.cmr.getConnectorManagers());
}
+
newMergedVDB.addAttchment(ConnectorManagerRepository.class, mergedRepo);
return newMergedVDB;
}
@@ -173,14 +201,12 @@
if (this.udf != null) {
mergedUDF.addFunctions(this.udf);
}
- if (this.stores != null) {
- for(MetadataStore store:this.stores.getStores()) {
- for (Schema schema:store.getSchemas().values()) {
- Collection<FunctionMethod> funcs = schema.getFunctions().values();
- mergedUDF.addFunctions(schema.getName(), funcs);
- }
- }
+
+ for (Schema schema:store.getSchemas().values()) {
+ Collection<FunctionMethod> funcs = schema.getFunctions().values();
+ mergedUDF.addFunctions(schema.getName(), funcs);
}
+
if (this.cmr != null) {
//system scoped common source functions
for (ConnectorManager cm:this.cmr.getConnectorManagers().values()) {
@@ -188,6 +214,7 @@
mergedUDF.addFunctions(CoreConstants.SYSTEM_MODEL, funcs);
}
}
+
if (this.children != null) {
//udf model functions - also scoped to the model
for (CompositeVDB child:this.children.values()) {
@@ -218,21 +245,100 @@
return mergedvisibilityMap;
}
- public synchronized MetadataStoreGroup getMetadataStores() {
+ private synchronized MetadataStore getMetadataStore() {
if (this.children == null || this.children.isEmpty()) {
- return this.stores;
+ return this.store;
}
- MetadataStoreGroup mergedStores = new MetadataStoreGroup();
- if (this.stores != null) {
- mergedStores.addStores(this.stores.getStores());
+ MetadataStore mergedStore = new MetadataStore();
+ if (this.store != null) {
+ mergedStore.merge(this.store);
}
for (CompositeVDB child:this.children.values()) {
- MetadataStoreGroup childStores = child.getMetadataStores();
- if ( childStores != null) {
- mergedStores.addStores(childStores.getStores());
+ MetadataStore childStore = child.getMetadataStore();
+ if ( childStore != null) {
+ mergedStore.merge(childStore);
}
}
- return mergedStores;
+ return mergedStore;
}
+
+ private static void updateFromMetadataRepository(VDBMetaData vdb, Schema schema, DefaultMetadataRepository metadataRepository) {
+ String vdbName = vdb.getName();
+ int vdbVersion = vdb.getVersion();
+ Collection<AbstractMetadataRecord> records = new LinkedHashSet<AbstractMetadataRecord>();
+
+ metadataRepository.startLoadVdb(vdbName, vdbVersion);
+
+ records.add(schema);
+ for (Table t : schema.getTables().values()) {
+ records.add(t);
+ records.addAll(t.getColumns());
+ records.addAll(t.getAllKeys());
+ if (t.isPhysical()) {
+ TableStats stats = metadataRepository.getTableStats(vdbName, vdbVersion, t);
+ if (stats != null) {
+ t.setTableStats(stats);
+ }
+ for (Column c : t.getColumns()) {
+ ColumnStats cStats = metadataRepository.getColumnStats(vdbName, vdbVersion, c);
+ if (cStats != null) {
+ c.setColumnStats(cStats);
+ }
+ }
+ } else {
+ String def = metadataRepository.getViewDefinition(vdbName, vdbVersion, t);
+ if (def != null) {
+ t.setSelectTransformation(def);
+ }
+ if (t.supportsUpdate()) {
+ def = metadataRepository.getInsteadOfTriggerDefinition(vdbName, vdbVersion, t, Table.TriggerEvent.INSERT);
+ if (def != null) {
+ t.setInsertPlan(def);
+ }
+ Boolean enabled = metadataRepository.isInsteadOfTriggerEnabled(vdbName, vdbVersion, t, Table.TriggerEvent.INSERT);
+ if (enabled != null) {
+ t.setInsertPlanEnabled(enabled);
+ }
+ def = metadataRepository.getInsteadOfTriggerDefinition(vdbName, vdbVersion, t, Table.TriggerEvent.UPDATE);
+ if (def != null) {
+ t.setUpdatePlan(def);
+ }
+ enabled = metadataRepository.isInsteadOfTriggerEnabled(vdbName, vdbVersion, t, Table.TriggerEvent.UPDATE);
+ if (enabled != null) {
+ t.setUpdatePlanEnabled(enabled);
+ }
+ def = metadataRepository.getInsteadOfTriggerDefinition(vdbName, vdbVersion, t, Table.TriggerEvent.DELETE);
+ if (def != null) {
+ t.setDeletePlan(def);
+ }
+ enabled = metadataRepository.isInsteadOfTriggerEnabled(vdbName, vdbVersion, t, Table.TriggerEvent.DELETE);
+ if (enabled != null) {
+ t.setDeletePlanEnabled(enabled);
+ }
+ }
+ }
+ }
+ for (Procedure p : schema.getProcedures().values()) {
+ records.add(p);
+ records.addAll(p.getParameters());
+ if (p.getResultSet() != null) {
+ records.addAll(p.getResultSet().getColumns());
+ }
+ if (p.isVirtual() && !p.isFunction()) {
+ String proc = metadataRepository.getProcedureDefinition(vdbName, vdbVersion, p);
+ if (proc != null) {
+ p.setQueryPlan(proc);
+ }
+ }
+ }
+
+ for (AbstractMetadataRecord abstractMetadataRecord : records) {
+ LinkedHashMap<String, String> p = metadataRepository.getProperties(vdbName, vdbVersion, abstractMetadataRecord);
+ if (p != null) {
+ abstractMetadataRecord.setProperties(p);
+ }
+ }
+ metadataRepository.endLoadVdb(vdbName, vdbVersion);
+ }
}
Deleted: trunk/runtime/src/main/java/org/teiid/deployers/MetadataStoreGroup.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/MetadataStoreGroup.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/runtime/src/main/java/org/teiid/deployers/MetadataStoreGroup.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -1,46 +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.deployers;
-
-import java.io.Serializable;
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.teiid.metadata.MetadataStore;
-
-public class MetadataStoreGroup implements Serializable{
- private static final long serialVersionUID = -3702321839716725121L;
-
- List<MetadataStore> stores = new CopyOnWriteArrayList<MetadataStore>();
-
- public void addStores(List<MetadataStore> stores) {
- this.stores.addAll(stores);
- }
-
- public void addStore(MetadataStore store) {
- this.stores.add(store);
- }
-
- public List<MetadataStore> getStores(){
- return this.stores;
- }
-}
Modified: trunk/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/runtime/src/main/java/org/teiid/deployers/PgCatalogMetadataStore.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -42,17 +42,16 @@
import org.teiid.translator.TranslatorException;
public class PgCatalogMetadataStore extends MetadataFactory {
-
- public static final int PG_TYPE_OIDVECTOR = 30;
+ private static final long serialVersionUID = 2158418324376966987L;
+ public static final int PG_TYPE_OIDVECTOR = 30;
public static final int PG_TYPE_OIDARRAY = 1028;
public static final int PG_TYPE_CHARARRAY = 1002;
public static final int PG_TYPE_TEXTARRAY = 1009;
- private static final long serialVersionUID = 5391872008395637166L;
private Random random;
- public PgCatalogMetadataStore(String modelName, Map<String, Datatype> dataTypes, Properties importProperties) throws TranslatorException {
- super(modelName, dataTypes, importProperties);
+ public PgCatalogMetadataStore(String modelName, Map<String, Datatype> dataTypes) throws TranslatorException {
+ super(modelName, 1, modelName, dataTypes, new Properties(), null);
add_pg_namespace();
add_pg_class();
Modified: trunk/runtime/src/main/java/org/teiid/deployers/SystemVDBDeployer.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/SystemVDBDeployer.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/runtime/src/main/java/org/teiid/deployers/SystemVDBDeployer.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -32,7 +32,7 @@
import org.jboss.vfs.VirtualFile;
import org.teiid.core.CoreConstants;
import org.teiid.core.TeiidRuntimeException;
-import org.teiid.metadata.index.IndexMetadataFactory;
+import org.teiid.metadata.index.IndexMetadataStore;
import org.teiid.metadata.index.RuntimeMetadataPlugin;
import org.teiid.runtime.RuntimePlugin;
@@ -62,8 +62,11 @@
this.file = VFS.mountZip(contents, CoreConstants.SYSTEM_VDB, mountPoint, PROVIDER);
}
+ IndexMetadataStore idxStore = new IndexMetadataStore(mountPoint);
+ idxStore.load(null);
+
// uri conversion is only to remove the spaces in URL, note this only with above kind situation
- this.vdbRepository.setSystemStore(new IndexMetadataFactory(mountPoint).getMetadataStore(null));
+ this.vdbRepository.setSystemStore(idxStore);
} catch (URISyntaxException e) {
throw new TeiidRuntimeException(RuntimePlugin.Event.TEIID40022, e, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40022));
} catch (IOException e) {
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -22,21 +22,32 @@
package org.teiid.deployers;
import java.io.Serializable;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.NavigableMap;
import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.CopyOnWriteArrayList;
import org.teiid.adminapi.AdminException;
import org.teiid.adminapi.AdminProcessingException;
+import org.teiid.adminapi.VDB;
+import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.SourceMappingMetadata;
import org.teiid.adminapi.impl.VDBMetaData;
import org.teiid.core.CoreConstants;
import org.teiid.core.types.DataTypeManager;
+import org.teiid.dqp.internal.datamgr.ConnectorManager;
import org.teiid.dqp.internal.datamgr.ConnectorManagerRepository;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
-import org.teiid.metadata.*;
+import org.teiid.metadata.Datatype;
+import org.teiid.metadata.MetadataStore;
import org.teiid.query.function.SystemFunctionManager;
-import org.teiid.query.metadata.TransformationMetadata.Resource;
+import org.teiid.query.metadata.MetadataValidator;
+import org.teiid.query.validator.ValidatorReport;
import org.teiid.runtime.RuntimePlugin;
import org.teiid.translator.TranslatorException;
import org.teiid.vdb.runtime.VDBKey;
@@ -54,14 +65,10 @@
private boolean odbcEnabled = false;
private List<VDBLifeCycleListener> listeners = new CopyOnWriteArrayList<VDBLifeCycleListener>();
private SystemFunctionManager systemFunctionManager;
- private MetadataRepository metadataRepository;
private Map<String, Datatype> datatypeMap = new HashMap<String, Datatype>();
- public MetadataRepository getMetadataRepository() {
- return metadataRepository;
- }
- public void addVDB(VDBMetaData vdb, MetadataStoreGroup stores, LinkedHashMap<String, Resource> visibilityMap, UDFMetaData udf, ConnectorManagerRepository cmr) throws VirtualDatabaseException {
+ public void addVDB(VDBMetaData vdb, MetadataStore metadataStore, UDFMetaData udf, ConnectorManagerRepository cmr) throws VirtualDatabaseException {
if (getVDB(vdb.getName(), vdb.getVersion()) != null) {
throw new VirtualDatabaseException(RuntimePlugin.Event.TEIID40035, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40035, vdb.getName(), vdb.getVersion()));
}
@@ -74,102 +81,18 @@
if (this.odbcEnabled && odbcStore == null) {
this.odbcStore = getODBCMetadataStore();
}
+
CompositeVDB cvdb = null;
if (this.odbcStore == null) {
- cvdb = new CompositeVDB(vdb, stores, visibilityMap, udf, this.systemFunctionManager.getSystemFunctions(), cmr, this.systemStore);
+ cvdb = new CompositeVDB(vdb, metadataStore, udf, this.systemFunctionManager.getSystemFunctions(), cmr, this.systemStore);
}
else {
- cvdb = new CompositeVDB(vdb, stores, visibilityMap, udf, this.systemFunctionManager.getSystemFunctions(), cmr, this.systemStore, odbcStore);
+ cvdb = new CompositeVDB(vdb, metadataStore, udf, this.systemFunctionManager.getSystemFunctions(), cmr, this.systemStore, odbcStore);
}
this.vdbRepo.put(vdbId(vdb), cvdb);
notifyAdd(vdb.getName(), vdb.getVersion(), cvdb);
}
- private void updateFromMetadataRepository(CompositeVDB cvdb) {
- if (metadataRepository == null) {
- return;
- }
- String vdbName = cvdb.getVDB().getName();
- int vdbVersion = cvdb.getVDB().getVersion();
- LinkedList<MetadataStore> allStores = new LinkedList<MetadataStore>(cvdb.getMetadataStores().getStores());
- allStores.addAll(Arrays.asList(cvdb.getAdditionalStores()));
- metadataRepository.startLoadVdb(vdbName, vdbVersion);
- for (MetadataStore metadataStore : allStores) {
- Collection<AbstractMetadataRecord> records = new LinkedHashSet<AbstractMetadataRecord>();
- for (Schema schema : metadataStore.getSchemas().values()) {
- records.add(schema);
- for (Table t : schema.getTables().values()) {
- records.add(t);
- records.addAll(t.getColumns());
- records.addAll(t.getAllKeys());
- if (t.isPhysical()) {
- TableStats stats = metadataRepository.getTableStats(vdbName, vdbVersion, t);
- if (stats != null) {
- t.setTableStats(stats);
- }
- for (Column c : t.getColumns()) {
- ColumnStats cStats = metadataRepository.getColumnStats(vdbName, vdbVersion, c);
- if (cStats != null) {
- c.setColumnStats(cStats);
- }
- }
- } else {
- String def = metadataRepository.getViewDefinition(vdbName, vdbVersion, t);
- if (def != null) {
- t.setSelectTransformation(def);
- }
- if (t.supportsUpdate()) {
- def = metadataRepository.getInsteadOfTriggerDefinition(vdbName, vdbVersion, t, Table.TriggerEvent.INSERT);
- if (def != null) {
- t.setInsertPlan(def);
- }
- Boolean enabled = metadataRepository.isInsteadOfTriggerEnabled(vdbName, vdbVersion, t, Table.TriggerEvent.INSERT);
- if (enabled != null) {
- t.setInsertPlanEnabled(enabled);
- }
- def = metadataRepository.getInsteadOfTriggerDefinition(vdbName, vdbVersion, t, Table.TriggerEvent.UPDATE);
- if (def != null) {
- t.setUpdatePlan(def);
- }
- enabled = metadataRepository.isInsteadOfTriggerEnabled(vdbName, vdbVersion, t, Table.TriggerEvent.UPDATE);
- if (enabled != null) {
- t.setUpdatePlanEnabled(enabled);
- }
- def = metadataRepository.getInsteadOfTriggerDefinition(vdbName, vdbVersion, t, Table.TriggerEvent.DELETE);
- if (def != null) {
- t.setDeletePlan(def);
- }
- enabled = metadataRepository.isInsteadOfTriggerEnabled(vdbName, vdbVersion, t, Table.TriggerEvent.DELETE);
- if (enabled != null) {
- t.setDeletePlanEnabled(enabled);
- }
- }
- }
- }
- for (Procedure p : schema.getProcedures().values()) {
- records.add(p);
- records.addAll(p.getParameters());
- if (p.getResultSet() != null) {
- records.addAll(p.getResultSet().getColumns());
- }
- if (p.isVirtual() && !p.isFunction()) {
- String proc = metadataRepository.getProcedureDefinition(vdbName, vdbVersion, p);
- if (proc != null) {
- p.setQueryPlan(proc);
- }
- }
- }
- }
- for (AbstractMetadataRecord abstractMetadataRecord : records) {
- LinkedHashMap<String, String> p = metadataRepository.getProperties(vdbName, vdbVersion, abstractMetadataRecord);
- if (p != null) {
- abstractMetadataRecord.setProperties(p);
- }
- }
- }
- metadataRepository.endLoadVdb(vdbName, vdbVersion);
- }
-
public VDBMetaData getVDB(String name, int version) {
CompositeVDB v = this.vdbRepo.get(new VDBKey(name, version));
if (v != null) {
@@ -234,16 +157,31 @@
}
}
}
+
+ // add alias types
+ addAliasType(datatypes, DataTypeManager.DataTypeAliases.BIGINT);
+ addAliasType(datatypes, DataTypeManager.DataTypeAliases.DECIMAL);
+ addAliasType(datatypes, DataTypeManager.DataTypeAliases.REAL);
+ addAliasType(datatypes, DataTypeManager.DataTypeAliases.SMALLINT);
+ addAliasType(datatypes, DataTypeManager.DataTypeAliases.TINYINT);
+ addAliasType(datatypes, DataTypeManager.DataTypeAliases.VARCHAR);
+
}
- public void setMetadataRepository(MetadataRepository metadataRepository) {
- this.metadataRepository = metadataRepository;
+ private void addAliasType(Collection<Datatype> datatypes, String alias) {
+ Class<?> typeClass = DataTypeManager.getDataTypeClass(alias);
+ for (Datatype datatypeRecordImpl : datatypes) {
+ if (datatypeRecordImpl.getJavaClassName().equals(typeClass.getName())) {
+ datatypeMap.put(alias, datatypeRecordImpl);
+ break;
+ }
+ }
}
private MetadataStore getODBCMetadataStore() {
try {
- PgCatalogMetadataStore pg = new PgCatalogMetadataStore(CoreConstants.ODBC_MODEL, getBuiltinDatatypes(), new Properties());
- return pg.getMetadataStore();
+ PgCatalogMetadataStore pg = new PgCatalogMetadataStore(CoreConstants.ODBC_MODEL, getBuiltinDatatypes());
+ return pg.asMetadataStore();
} catch (TranslatorException e) {
LogManager.logError(LogConstants.CTX_DQP, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40002));
}
@@ -294,7 +232,7 @@
target.addChild(source);
notifyAdd(targetVDBName, targetVDBVersion, target);
- notifyFinished(targetVDBName, targetVDBVersion, target);
+ finishDeployment(targetVDBName, targetVDBVersion);
}
// this is called by mc
@@ -307,12 +245,56 @@
public void finishDeployment(String name, int version) {
CompositeVDB v = this.vdbRepo.get(new VDBKey(name, version));
if (v!= null) {
- updateFromMetadataRepository(v);
- v.update();
+ boolean valid = false;
+ VDBMetaData metdataAwareVDB = v.getVDB();
+ ValidatorReport report = MetadataValidator.validate(metdataAwareVDB, metdataAwareVDB.removeAttachment(MetadataStore.class));
+
+ if (!report.hasItems()) {
+ valid = true;
+ }
+ else {
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40073, name, version));
+ }
+
+ // check the data sources available
+ if (valid) {
+ valid = isValid(metdataAwareVDB);
+ }
+
+ if (valid) {
+ metdataAwareVDB.setStatus(VDB.Status.ACTIVE);
+ }
+ else {
+ metdataAwareVDB.setStatus(VDB.Status.INACTIVE);
+ }
+
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, (VDB.Status.ACTIVE == metdataAwareVDB.getStatus())?RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40003,name, version):RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40006,name, version));
notifyFinished(name, version, v);
}
}
-
+
+ boolean isValid(VDBMetaData vdb) {
+ ConnectorManagerRepository cmr = vdb.getAttachment(ConnectorManagerRepository.class);
+
+ for (ModelMetaData model:vdb.getModelMetaDatas().values()) {
+ if (model.isSource()) {
+ List<SourceMappingMetadata> mappings = model.getSourceMappings();
+ for (SourceMappingMetadata mapping:mappings) {
+ ConnectorManager cm = cmr.getConnectorManager(mapping.getName());
+ if (cm != null) {
+ String msg = cm.getStausMessage();
+ if (msg != null && msg.length() > 0) {
+ model.addError(ModelMetaData.ValidationError.Severity.ERROR.name(), cm.getStausMessage());
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, cm.getStausMessage());
+ }
+ }
+ }
+ }
+ }
+ return vdb.isValid();
+ }
+
+
private void notifyFinished(String name, int version, CompositeVDB v) {
for(VDBLifeCycleListener l:this.listeners) {
l.finishedDeployment(name, version, v);
@@ -341,5 +323,5 @@
public void setSystemFunctionManager(SystemFunctionManager mgr) {
this.systemFunctionManager = mgr;
- }
+ }
}
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBStatusChecker.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -54,7 +54,7 @@
}
public void translatorRemoved(String translatorName) {
- resourceremoved(translatorName, true);
+ resourceRemoved(translatorName, true);
}
public void dataSourceAdded(String dataSourceName) {
@@ -68,7 +68,7 @@
if (dataSourceName.startsWith(JAVA_CONTEXT)) {
dataSourceName = dataSourceName.substring(5);
}
- resourceremoved(dataSourceName, false);
+ resourceRemoved(dataSourceName, false);
}
public void dataSourceReplaced(String vdbName, int vdbVersion,
@@ -136,8 +136,7 @@
synchronized (vdb) {
ConnectorManagerRepository cmr = vdb.getAttachment(ConnectorManagerRepository.class);
- for (Model m:vdb.getModels()) {
- ModelMetaData model = (ModelMetaData)m;
+ for (ModelMetaData model:vdb.getModelMetaDatas().values()) {
if (model.getErrors().isEmpty()) {
continue;
}
@@ -146,6 +145,7 @@
if (sourceName == null) {
continue;
}
+
ConnectorManager cm = cmr.getConnectorManager(sourceName);
String status = cm.getStausMessage();
if (status != null && status.length() > 0) {
@@ -163,8 +163,7 @@
}
boolean valid = true;
- for (Model m:vdb.getModels()) {
- ModelMetaData model = (ModelMetaData)m;
+ for (ModelMetaData model:vdb.getModelMetaDatas().values()) {
if (!model.getErrors().isEmpty()) {
valid = false;
break;
@@ -177,7 +176,6 @@
getExecutor().execute(runnable);
}
} else if (valid) {
- this.vdbRepository.finishDeployment(vdb.getName(), vdb.getVersion());
vdb.setStatus(VDB.Status.ACTIVE);
LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40003,vdb.getName(), vdb.getVersion()));
}
@@ -185,7 +183,7 @@
}
}
- public void resourceremoved(String resourceName, boolean translator) {
+ public void resourceRemoved(String resourceName, boolean translator) {
for (VDBMetaData vdb:this.vdbRepository.getVDBs()) {
if (vdb.isPreview()) {
continue;
Modified: trunk/runtime/src/main/java/org/teiid/runtime/RuntimePlugin.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/runtime/RuntimePlugin.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/runtime/src/main/java/org/teiid/runtime/RuntimePlugin.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -103,5 +103,7 @@
TEIID40069,
TEIID40070,
TEIID40071,
+ TEIID40072,
+ TEIID40073
}
}
Modified: trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties
===================================================================
--- trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties 2012-03-08 20:03:01 UTC (rev 3922)
@@ -120,4 +120,6 @@
TEIID40031=TranslatorProperty annotation should not both be advanced and required
TEIID40032=Translator {2} not found in repository for VDB {0}.{1}
TEIID40041=Invalid Session. Session may have been terminated. Re-connect and try again.
-TEIID40042=Invalid Session. Session may have been terminated. Re-connect and try again.
\ No newline at end of file
+TEIID40042=Invalid Session. Session may have been terminated. Re-connect and try again.
+TEIID40072=Model {0} is defined as VIRTUAL model, however it is defined with source mappings! check your vdb.xml file.
+TEIID40073=The metadata for the VDB {0}.{1} is loaded, however it is not valid. Check models for errors. Correct the metadata and re-deploy.
\ No newline at end of file
Modified: trunk/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java
===================================================================
--- trunk/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/runtime/src/test/java/org/teiid/deployers/TestCompositeVDB.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -53,22 +53,19 @@
return vdb.getAttachment(TransformationMetadata.class);
}
- private static CompositeVDB createCompositeVDB(MetadataStore metadataStore,
- String vdbName) {
+ private static CompositeVDB createCompositeVDB(MetadataStore metadataStore, String vdbName) {
VDBMetaData vdbMetaData = new VDBMetaData();
vdbMetaData.setName(vdbName); //$NON-NLS-1$
vdbMetaData.setVersion(1);
for (Schema schema : metadataStore.getSchemas().values()) {
vdbMetaData.addModel(RealMetadataFactory.createModel(schema.getName(), schema.isPhysical()));
}
- MetadataStoreGroup metaGroup = new MetadataStoreGroup();
- metaGroup.addStore(metadataStore);
ConnectorManagerRepository cmr = new ConnectorManagerRepository();
cmr.addConnectorManager("source", getConnectorManager("FakeTranslator", "FakeConnection", getFuncsOne()));
cmr.addConnectorManager("source2", getConnectorManager("FakeTranslator2", "FakeConnection2", getFuncsTwo()));
- CompositeVDB cvdb = new CompositeVDB(vdbMetaData, metaGroup, null, null, RealMetadataFactory.SFM.getSystemFunctions(),cmr);
+ CompositeVDB cvdb = new CompositeVDB(vdbMetaData, metadataStore, null, RealMetadataFactory.SFM.getSystemFunctions(),cmr);
return cvdb;
}
@@ -152,7 +149,7 @@
vdb.removeChild(child);
assertNotNull(vdb.getVDB());
assertFalse(vdb.hasChildVdb(child));
- vdb.addChild(createCompositeVDB(RealMetadataFactory.example1Store(), "foo"));
+ vdb.addChild(createCompositeVDB(RealMetadataFactory.exampleBusObjStore(), "foo"));
assertTrue(vdb.hasChildVdb(child));
assertNotNull(vdb.getVDB());
}
Modified: trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDeployment.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDeployment.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDeployment.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -111,7 +111,7 @@
public void testTraslators() throws Exception {
Collection<? extends Translator> translators = admin.getTranslators();
System.out.println(translators);
- assertEquals(29, translators.size());
+ assertEquals(28, translators.size());
JavaArchive jar = getLoopyArchive();
Added: trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDynamicViewDefinition.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDynamicViewDefinition.java (rev 0)
+++ trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDynamicViewDefinition.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -0,0 +1,58 @@
+package org.teiid.arquillian;
+
+import static org.junit.Assert.*;
+
+import java.io.FileInputStream;
+import java.sql.Connection;
+import java.util.Properties;
+
+import org.jboss.arquillian.junit.Arquillian;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.teiid.adminapi.Admin;
+import org.teiid.adminapi.AdminFactory;
+import org.teiid.core.util.UnitTestUtil;
+import org.teiid.jdbc.AbstractMMQueryTestCase;
+import org.teiid.jdbc.FakeServer;
+import org.teiid.jdbc.TeiidDriver;
+import org.teiid.jdbc.TestMMDatabaseMetaData;
+import org.teiid.metadata.MetadataFactory;
+import org.teiid.metadata.Procedure;
+
+(a)RunWith(Arquillian.class)
+@SuppressWarnings("nls")
+public class IntegrationTestDynamicViewDefinition extends AbstractMMQueryTestCase {
+
+ private Admin admin;
+
+ @Before
+ public void setup() throws Exception {
+ admin = AdminFactory.getInstance().createAdmin("localhost", 9999, "admin", "admin".toCharArray());
+ }
+
+ @After
+ public void teardown() {
+ admin.close();
+ }
+
+ @Test
+ public void testViewDefinition() throws Exception {
+
+ Properties props = new Properties();
+ props.setProperty("ParentDirectory", "../docs/teiid/examples/dynamicvdb-portfolio/data");
+ props.setProperty("AllowParentPaths", "true");
+ admin.createDataSource("marketdata-file", "teiid-connector-file.rar", props);
+
+
+ admin.deploy("dynamicview-vdb.xml",new FileInputStream(UnitTestUtil.getTestDataFile("dynamicview-vdb.xml")));
+
+ this.internalConnection = TeiidDriver.getInstance().connect("jdbc:teiid:dynamic@mm://localhost:31000;user=user;password=user", null);
+
+ execute("select * FROM Portfolio.Stock Where SchemaName = 'portfolio'"); //$NON-NLS-1$
+ TestMMDatabaseMetaData.compareResultSet("TestDymamicImportedMetaData/columns", this.internalResultSet);
+
+ }
+
+}
Property changes on: trunk/test-integration/common/src/test/java/org/teiid/arquillian/IntegrationTestDynamicViewDefinition.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestExecutionReuse.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestExecutionReuse.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestExecutionReuse.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -124,7 +124,7 @@
}
@Override
- protected Object getConnectionFactory()
+ public Object getConnectionFactory()
throws TranslatorException {
return null;
}
Modified: trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestRelate.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestRelate.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestRelate.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -71,7 +71,7 @@
ConnectorManagerRepository cmr = new ConnectorManagerRepository();
ConnectorManager cm = new ConnectorManager("source", "bar") {
@Override
- protected Object getConnectionFactory() throws TranslatorException {
+ public Object getConnectionFactory() throws TranslatorException {
return ds;
}
};
Modified: trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -30,7 +30,6 @@
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
-import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -56,7 +55,6 @@
import org.teiid.core.TeiidRuntimeException;
import org.teiid.core.util.UnitTestUtil;
import org.teiid.deployers.CompositeVDB;
-import org.teiid.deployers.MetadataStoreGroup;
import org.teiid.deployers.UDFMetaData;
import org.teiid.deployers.VDBLifeCycleListener;
import org.teiid.deployers.VDBRepository;
@@ -75,7 +73,7 @@
import org.teiid.metadata.MetadataRepository;
import org.teiid.metadata.MetadataStore;
import org.teiid.metadata.Schema;
-import org.teiid.metadata.index.IndexMetadataFactory;
+import org.teiid.metadata.index.IndexMetadataStore;
import org.teiid.metadata.index.VDBMetadataFactory;
import org.teiid.net.CommunicationException;
import org.teiid.net.ConnectionException;
@@ -83,7 +81,6 @@
import org.teiid.query.ReplicatedObject;
import org.teiid.query.function.SystemFunctionManager;
import org.teiid.query.metadata.TransformationMetadata;
-import org.teiid.query.metadata.TransformationMetadata.Resource;
import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
import org.teiid.query.optimizer.capabilities.SourceCapabilities;
import org.teiid.query.tempdata.GlobalTableStore;
@@ -304,7 +301,7 @@
Cache<K, V> result = super.get(location, config);
if (replicator != null) {
try {
- return (Cache<K, V>) replicator.replicate("$RS$", ReplicatedCache.class, new ReplicatedCacheImpl(result), 0);
+ return replicator.replicate("$RS$", ReplicatedCache.class, new ReplicatedCacheImpl(result), 0);
} catch (Exception e) {
throw new TeiidRuntimeException(e);
}
@@ -364,33 +361,30 @@
this.dqp.stop();
}
- public void setMetadataRepository(MetadataRepository metadataRepository) {
- this.repo.setMetadataRepository(metadataRepository);
- this.dqp.setMetadataRepository(metadataRepository);
- }
-
public void setUseCallingThread(boolean useCallingThread) {
this.useCallingThread = useCallingThread;
}
-
+
public void deployVDB(String vdbName, String vdbPath) throws Exception {
- deployVDB(vdbName, vdbPath, null);
+ IndexMetadataStore imf = VDBMetadataFactory.loadMetadata(vdbName, new File(vdbPath).toURI().toURL());
+ deployVDB(vdbName, imf, null, null);
+ }
+
+ public void deployVDB(String vdbName, String vdbPath, MetadataRepository metadataRepo) throws Exception {
+ IndexMetadataStore imf = VDBMetadataFactory.loadMetadata(vdbName, new File(vdbPath).toURI().toURL());
+ deployVDB(vdbName, imf, null, metadataRepo);
}
public void deployVDB(String vdbName, String vdbPath, Map<String, Collection<FunctionMethod>> udfs) throws Exception {
- IndexMetadataFactory imf = VDBMetadataFactory.loadMetadata(vdbName, new File(vdbPath).toURI().toURL());
- MetadataStore metadata = imf.getMetadataStore(repo.getSystemStore().getDatatypes());
- LinkedHashMap<String, Resource> entries = imf.getEntriesPlusVisibilities();
- deployVDB(vdbName, metadata, entries, udfs);
+ IndexMetadataStore imf = VDBMetadataFactory.loadMetadata(vdbName, new File(vdbPath).toURI().toURL());
+ deployVDB(vdbName, imf, udfs, null);
}
- public void deployVDB(String vdbName, MetadataStore metadata,
- LinkedHashMap<String, Resource> entries) {
- deployVDB(vdbName, metadata, entries, null);
+ public void deployVDB(String vdbName, MetadataStore metadata) {
+ deployVDB(vdbName, metadata, null, null);
}
- public void deployVDB(String vdbName, MetadataStore metadata,
- LinkedHashMap<String, Resource> entries, Map<String, Collection<FunctionMethod>> udfs) {
+ public void deployVDB(String vdbName, MetadataStore metadata, Map<String, Collection<FunctionMethod>> udfs, MetadataRepository metadataRepo) {
VDBMetaData vdbMetaData = new VDBMetaData();
vdbMetaData.setName(vdbName);
vdbMetaData.setStatus(VDB.Status.ACTIVE);
@@ -404,12 +398,13 @@
}
for (Schema schema : metadata.getSchemas().values()) {
- addModel(vdbMetaData, schema);
+ ModelMetaData model = addModel(vdbMetaData, schema);
+ if (metadataRepo != null) {
+ model.addAttchment(MetadataRepository.class, metadataRepo);
+ }
}
try {
- MetadataStoreGroup stores = new MetadataStoreGroup();
- stores.addStore(metadata);
UDFMetaData udfMetaData = null;
if (udfs != null) {
udfMetaData = new UDFMetaData();
@@ -417,8 +412,9 @@
udfMetaData.addFunctions(entry.getKey(), entry.getValue());
}
}
- this.repo.addVDB(vdbMetaData, stores, entries, udfMetaData, cmr);
- this.repo.finishDeployment(vdbName, 1);
+ this.repo.addVDB(vdbMetaData, metadata, udfMetaData, cmr);
+ this.repo.finishDeployment(vdbMetaData.getName(), vdbMetaData.getVersion());
+ this.repo.getVDB(vdbMetaData.getName(), vdbMetaData.getVersion()).setStatus(VDB.Status.ACTIVE);
} catch (VirtualDatabaseException e) {
throw new RuntimeException(e);
}
@@ -428,11 +424,12 @@
this.repo.removeVDB(vdbName, 1);
}
- private void addModel(VDBMetaData vdbMetaData, Schema schema) {
+ private ModelMetaData addModel(VDBMetaData vdbMetaData, Schema schema) {
ModelMetaData model = new ModelMetaData();
model.setName(schema.getName());
vdbMetaData.addModel(model);
model.addSourceMapping("source", "translator", "jndi:source");
+ return model;
}
public VDBMetaData getVDB(String vdbName) {
@@ -445,6 +442,7 @@
public void mergeVDBS(String sourceVDB, String targetVDB) throws AdminException {
this.repo.mergeVDBs(sourceVDB, 1, targetVDB, 1);
+ this.repo.getVDB(targetVDB, 1).setStatus(VDB.Status.ACTIVE);
}
public ConnectionImpl createConnection(String embeddedURL) throws Exception {
Modified: trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestDynamicImportedMetaData.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestDynamicImportedMetaData.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestDynamicImportedMetaData.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -22,10 +22,11 @@
package org.teiid.jdbc;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
import java.sql.Connection;
-import java.util.LinkedHashMap;
import java.util.List;
import java.util.Properties;
@@ -35,13 +36,15 @@
import org.teiid.core.types.DataTypeManager;
import org.teiid.core.util.UnitTestUtil;
import org.teiid.deployers.VDBRepository;
+import org.teiid.metadata.Column;
import org.teiid.metadata.ForeignKey;
import org.teiid.metadata.MetadataFactory;
import org.teiid.metadata.MetadataStore;
import org.teiid.metadata.Procedure;
+import org.teiid.metadata.ProcedureParameter;
import org.teiid.metadata.Table;
import org.teiid.metadata.index.VDBMetadataFactory;
-import org.teiid.query.metadata.TransformationMetadata.Resource;
+import org.teiid.query.parser.QueryParser;
import org.teiid.translator.TranslatorException;
import org.teiid.translator.jdbc.teiid.TeiidExecutionFactory;
@@ -73,7 +76,7 @@
private MetadataFactory createMetadataFactory(String schema, Properties importProperties) {
VDBRepository vdbRepository = new VDBRepository();
vdbRepository.setSystemStore(VDBMetadataFactory.getSystem());
- return new MetadataFactory(schema, vdbRepository.getBuiltinDatatypes(), importProperties);
+ return new MetadataFactory("vdb", 1, schema, vdbRepository.getBuiltinDatatypes(), importProperties, null);
}
@Test public void testUniqueReferencedKey() throws Exception {
@@ -84,7 +87,7 @@
importProperties.setProperty("importer.importKeys", "true");
importProperties.setProperty("importer.schemaPattern", "x");
MetadataFactory mf = getMetadata(importProperties, conn);
- Table t = mf.getMetadataStore().getSchemas().get("TEST").getTables().get("VDB.X.A");
+ Table t = mf.asMetadataStore().getSchemas().get("TEST").getTables().get("VDB.X.A");
List<ForeignKey> fks = t.getForeignKeys();
assertEquals(1, fks.size());
assertNotNull(fks.get(0).getPrimaryKey());
@@ -97,7 +100,7 @@
Properties importProperties = new Properties();
importProperties.setProperty("importer.importProcedures", Boolean.TRUE.toString());
MetadataFactory mf = getMetadata(importProperties, conn);
- Procedure p = mf.getMetadataStore().getSchemas().get("TEST").getProcedures().get("VDB.SYS.GETXMLSCHEMAS");
+ Procedure p = mf.asMetadataStore().getSchemas().get("TEST").getProcedures().get("VDB.SYS.GETXMLSCHEMAS");
assertEquals(1, p.getResultSet().getColumns().size());
}
@@ -110,8 +113,8 @@
importProperties.setProperty("importer.excludeTables", "VDB\\.SYS\\..*");
importProperties.setProperty("importer.excludeProcedures", "VDB\\..*");
MetadataFactory mf = getMetadata(importProperties, conn);
- assertEquals(17, mf.getMetadataStore().getSchemas().get("TEST").getTables().size());
- assertEquals(0, mf.getMetadataStore().getSchemas().get("TEST").getProcedures().size());
+ assertEquals(17, mf.asMetadataStore().getSchemas().get("TEST").getTables().size());
+ assertEquals(0, mf.asMetadataStore().getSchemas().get("TEST").getProcedures().size());
}
@Test public void testDuplicateException() throws Exception {
@@ -124,16 +127,16 @@
mf.addColumn("x", DataTypeManager.DefaultDataTypes.STRING, dup);
mf1.addColumn("x", DataTypeManager.DefaultDataTypes.STRING, dup1);
- MetadataStore ms = mf.getMetadataStore();
- ms.addSchema(mf1.getMetadataStore().getSchemas().values().iterator().next());
+ MetadataStore ms = mf.asMetadataStore();
+ ms.addSchema(mf1.asMetadataStore().getSchemas().values().iterator().next());
- server.deployVDB("test", ms, new LinkedHashMap<String, Resource>());
+ server.deployVDB("test", ms);
Connection conn = server.createConnection("jdbc:teiid:test"); //$NON-NLS-1$
Properties importProperties = new Properties();
mf = getMetadata(importProperties, conn);
- Table t = mf.getMetadataStore().getSchemas().get("TEST").getTables().get("TEST.X.DUP");
+ Table t = mf.asMetadataStore().getSchemas().get("TEST").getTables().get("TEST.X.DUP");
assertEquals("\"test\".\"x\".\"dup\"", t.getNameInSource());
importProperties.setProperty("importer.useFullSchemaName", Boolean.FALSE.toString());
@@ -152,16 +155,57 @@
mf.addColumn("x", DataTypeManager.DefaultDataTypes.STRING, dup);
- MetadataStore ms = mf.getMetadataStore();
+ MetadataStore ms = mf.asMetadataStore();
- server.deployVDB("test", ms, new LinkedHashMap<String, Resource>());
+ server.deployVDB("test", ms);
Connection conn = server.createConnection("jdbc:teiid:test"); //$NON-NLS-1$
Properties importProperties = new Properties();
importProperties.setProperty("importer.useCatalogName", Boolean.FALSE.toString());
mf = getMetadata(importProperties, conn);
- Table t = mf.getMetadataStore().getSchemas().get("TEST").getTables().get("X.DUP");
+ Table t = mf.asMetadataStore().getSchemas().get("TEST").getTables().get("X.DUP");
assertEquals("\"x\".\"dup\"", t.getNameInSource());
}
+
+ @Test
+ public void testDDLMetadata() throws Exception {
+ FakeServer server = new FakeServer();
+
+ String ddl = "CREATE PROCEDURE getTextFiles(IN pathAndPattern varchar) RETURNS (file clob, filpath string) OPTIONS(UUID 'uuid')";
+ MetadataFactory mf = createMetadataFactory("MarketData", new Properties());
+ QueryParser.getQueryParser().parseDDL(mf, ddl);
+ MetadataStore ms = mf.asMetadataStore();
+
+ String ddl2 = "CREATE VIEW stock (symbol string, price bigdecimal) " +
+ "AS select stock.* from (call MarketData.getTextFiles('*.txt')) f, " +
+ "TEXTTABLE(f.file COLUMNS symbol string, price bigdecimal HEADER) stock " +
+ "OPTIONS (UUID 'uuid')";
+ MetadataFactory m2 = createMetadataFactory("portfolio", new Properties());
+ QueryParser.getQueryParser().parseDDL(m2, ddl2);
+
+ m2.mergeInto(ms);
+
+ server.deployVDB("test", ms);
+ Connection conn = server.createConnection("jdbc:teiid:test"); //$NON-NLS-1$
+ Properties props = new Properties();
+ props.setProperty("importer.importProcedures", Boolean.TRUE.toString());
+ MetadataStore store = getMetadata(props, conn).asMetadataStore();
+
+ Procedure p = store.getSchema("test").getProcedure("test.MarketData.getTextFiles");
+ assertNotNull(p);
+
+ ProcedureParameter pp = p.getParameters().get(0);
+ assertEquals("pathAndPattern", pp.getName());
+ assertEquals(ProcedureParameter.Type.In, pp.getType());
+ //assertEquals("string", pp.getDatatype().getName());
+
+ Table t = store.getSchema("test").getTable("test.portfolio.stock");
+ assertNotNull(t);
+
+ List<Column> columns = t.getColumns();
+ assertEquals(2, columns.size());
+ assertEquals("symbol", columns.get(0).getName());
+ assertEquals("price", columns.get(1).getName());
+ }
}
Modified: trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestLocalConnections.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestLocalConnections.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestLocalConnections.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -153,7 +153,7 @@
}
@Override
- protected Object getConnectionFactory()
+ public Object getConnectionFactory()
throws TranslatorException {
return null;
}
Modified: trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestMatViewAliasing.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestMatViewAliasing.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestMatViewAliasing.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -27,7 +27,6 @@
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
-import java.util.LinkedHashMap;
import java.util.Properties;
import org.junit.After;
@@ -40,7 +39,6 @@
import org.teiid.metadata.MetadataStore;
import org.teiid.metadata.Table;
import org.teiid.metadata.index.VDBMetadataFactory;
-import org.teiid.query.metadata.TransformationMetadata.Resource;
@SuppressWarnings("nls")
public class TestMatViewAliasing {
@@ -54,7 +52,7 @@
VDBRepository vdbRepository = new VDBRepository();
vdbRepository.setSystemStore(VDBMetadataFactory.getSystem());
- MetadataFactory mf = new MetadataFactory("foo", vdbRepository.getBuiltinDatatypes(), new Properties());
+ MetadataFactory mf = new MetadataFactory(null, 1, "foo", vdbRepository.getBuiltinDatatypes(), new Properties(), null);
Table mat = mf.addTable("mat");
mat.setVirtual(true);
@@ -64,9 +62,9 @@
mf.addColumn("x", DataTypeManager.DefaultDataTypes.INTEGER, mat);
mf.addColumn("Name", DataTypeManager.DefaultDataTypes.STRING, mat);
- MetadataStore ms = mf.getMetadataStore();
+ MetadataStore ms = mf.asMetadataStore();
- server.deployVDB(MATVIEWS, ms, new LinkedHashMap<String, Resource>());
+ server.deployVDB(MATVIEWS, ms);
conn = server.createConnection("jdbc:teiid:"+MATVIEWS);
}
Modified: trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestMetadataUpdates.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestMetadataUpdates.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/test-integration/common/src/test/java/org/teiid/systemmodel/TestMetadataUpdates.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -37,7 +37,7 @@
import org.mockito.stubbing.Answer;
import org.teiid.core.util.UnitTestUtil;
import org.teiid.jdbc.FakeServer;
-import org.teiid.metadata.MetadataRepository;
+import org.teiid.metadata.DefaultMetadataRepository;
import org.teiid.metadata.Procedure;
import org.teiid.metadata.Table;
@@ -49,9 +49,13 @@
static final String VDB = "metadata";
@BeforeClass public static void setUp() throws Exception {
- FakeServer server = new FakeServer();
- MetadataRepository repo = Mockito.mock(MetadataRepository.class);
- server.setMetadataRepository(repo);
+ FakeServer server = new FakeServer();
+ server.deployVDB(VDB, UnitTestUtil.getTestDataPath() + "/metadata.vdb", getMetadataRepo());
+ connection = server.createConnection("jdbc:teiid:" + VDB); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ private static DefaultMetadataRepository getMetadataRepo() {
+ DefaultMetadataRepository repo = Mockito.mock(DefaultMetadataRepository.class);
Mockito.stub(repo.getViewDefinition(Mockito.anyString(), Mockito.anyInt(), (Table)Mockito.anyObject())).toAnswer(new Answer<String>() {
@Override
public String answer(InvocationOnMock invocation) throws Throwable {
@@ -84,9 +88,8 @@
return Boolean.TRUE;
}
});
- server.deployVDB(VDB, UnitTestUtil.getTestDataPath() + "/metadata.vdb");
- connection = server.createConnection("jdbc:teiid:" + VDB); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ return repo;
+ }
@AfterClass public static void tearDown() throws SQLException {
connection.close();
Modified: trunk/test-integration/common/src/test/java/org/teiid/transport/TestJDBCSocketTransport.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/transport/TestJDBCSocketTransport.java 2012-03-08 01:02:30 UTC (rev 3921)
+++ trunk/test-integration/common/src/test/java/org/teiid/transport/TestJDBCSocketTransport.java 2012-03-08 20:03:01 UTC (rev 3922)
@@ -190,7 +190,7 @@
ConnectorManagerRepository cmr = server.getConnectorManagerRepository();
AutoGenDataService agds = new AutoGenDataService() {
@Override
- protected Object getConnectionFactory()
+ public Object getConnectionFactory()
throws TranslatorException {
return null;
}
Property changes on: trunk/test-integration/common/src/test/java/org/teiid/transport/TestJDBCSocketTransport.java
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/7.4.x/test-integration/common/src/test/java/org/teiid/transport/TestJDBCSocketTransport.java:3455-3509,3535-3555
/branches/7.6.x/test-integration/common/src/test/java/org/teiid/transport/TestJDBCSocketTransport.java:3673-3711,3754-3769
/branches/7.7.x/test-integration/common/src/test/java/org/teiid/transport/TestJDBCSocketTransport.java:3816-3868,3876-3915
/trunk/test-integration/common/src/test/java/org/teiid/transport/TestJDBCSocketTransport.java:3507-3666
+ /branches/7.4.x/test-integration/common/src/test/java/org/teiid/transport/TestJDBCSocketTransport.java:3455-3509,3535-3555
/branches/7.6.x/test-integration/common/src/test/java/org/teiid/transport/TestJDBCSocketTransport.java:3673-3711,3754-3769
/branches/7.7.x/test-integration/common/src/test/java/org/teiid/transport/TestJDBCSocketTransport.java:3816-3868
/trunk/test-integration/common/src/test/java/org/teiid/transport/TestJDBCSocketTransport.java:3507-3666
Added: trunk/test-integration/common/src/test/resources/dynamicview-vdb.xml
===================================================================
--- trunk/test-integration/common/src/test/resources/dynamicview-vdb.xml (rev 0)
+++ trunk/test-integration/common/src/test/resources/dynamicview-vdb.xml 2012-03-08 20:03:01 UTC (rev 3922)
@@ -0,0 +1,16 @@
+<vdb name="dynamic" version= "1">
+ <model name="MarketData">
+ <source name="text-connector" translator-name="file" connection-jndi-name="java:/marketdata-file"/>
+ </model>
+ <model visible = "true" type = "VIRTUAL" name = "portfolio">
+ <metadata import-type = "DDL"><![CDATA[
+ CREATE VIEW stock (
+ symbol varchar,
+ price decimal
+ ) AS
+ select stock.* from (call MarketData.getTextFiles('*.txt')) f,
+ TEXTTABLE(f.file COLUMNS symbol string, price bigdecimal HEADER) stock;
+ ]]>
+ </metadata>
+ </model>
+</vdb>
\ No newline at end of file
Property changes on: trunk/test-integration/common/src/test/resources/dynamicview-vdb.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
12 years, 9 months
teiid SVN: r3921 - in branches/7.7.x/engine/src/main: resources/org/teiid/query and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-03-07 20:02:30 -0500 (Wed, 07 Mar 2012)
New Revision: 3921
Modified:
branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
branches/7.7.x/engine/src/main/resources/org/teiid/query/i18n.properties
Log:
TEIID-1964 adding a log about query timeout
Modified: branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
===================================================================
--- branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2012-03-07 21:33:00 UTC (rev 3920)
+++ branches/7.7.x/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2012-03-08 01:02:30 UTC (rev 3921)
@@ -346,6 +346,7 @@
long timeout = workContext.getVDB().getQueryTimeout();
timeout = Math.min(timeout>0?timeout:Long.MAX_VALUE, config.getQueryTimeout()>0?config.getQueryTimeout():Long.MAX_VALUE);
if (timeout < Long.MAX_VALUE) {
+ final long finalTimeout = timeout;
workItem.setCancelTask(this.cancellationTimer.add(new Runnable() {
WeakReference<RequestWorkItem> workItemRef = new WeakReference<RequestWorkItem>(workItem);
@Override
@@ -353,6 +354,7 @@
try {
RequestWorkItem wi = workItemRef.get();
if (wi != null) {
+ LogManager.logInfo(LogConstants.CTX_DQP, QueryPlugin.Util.getString("query_timeout", wi.requestID, finalTimeout)); //$NON-NLS-1$
wi.requestCancel();
}
} catch (TeiidComponentException e) {
Modified: branches/7.7.x/engine/src/main/resources/org/teiid/query/i18n.properties
===================================================================
--- branches/7.7.x/engine/src/main/resources/org/teiid/query/i18n.properties 2012-03-07 21:33:00 UTC (rev 3920)
+++ branches/7.7.x/engine/src/main/resources/org/teiid/query/i18n.properties 2012-03-08 01:02:30 UTC (rev 3921)
@@ -950,4 +950,6 @@
DependentCriteriaProcessor.dep_join_backoff=Not performing dependent join using source {0}, since the number of distinct rows for expression {1} exceeds {2}. You should ensure that your source statistics, including column distinct value counts, accurately reflect the source or use a MAKE_DEP hint to force the join.
invalid_schema=Invalid schema from translator metadata expected {0}, but the returned MetadataStore contained no such schema or more than 1 schema.
-invalid_table=Invalid table {0}. A table must have 1 or more columns.
\ No newline at end of file
+invalid_table=Invalid table {0}. A table must have 1 or more columns.
+
+query_timeout=Cancelling query {0} since it has exceeded the timeout of {1} milliseconds.
\ No newline at end of file
12 years, 9 months
teiid SVN: r3920 - in branches/7.7.x/connectors/translator-jdbc/src: test/java/org/teiid/translator/jdbc/ingres and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2012-03-07 16:33:00 -0500 (Wed, 07 Mar 2012)
New Revision: 3920
Removed:
branches/7.7.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/ingres/LocateFunctionModifier.java
Modified:
branches/7.7.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/ingres/IngresExecutionFactory.java
branches/7.7.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/ingres/TestIngresExecutionFactory.java
Log:
TEIID-1962 removing locate push down support for ingres
Modified: branches/7.7.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/ingres/IngresExecutionFactory.java
===================================================================
--- branches/7.7.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/ingres/IngresExecutionFactory.java 2012-03-07 02:09:38 UTC (rev 3919)
+++ branches/7.7.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/ingres/IngresExecutionFactory.java 2012-03-07 21:33:00 UTC (rev 3920)
@@ -77,7 +77,6 @@
registerFunctionModifier(SourceSystemFunctions.RAND, new AliasModifier("random")); //$NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.UCASE, new AliasModifier("uppercase")); //$NON-NLS-1$
registerFunctionModifier(SourceSystemFunctions.DAYOFMONTH, new AliasModifier("day")); //$NON-NLS-1$
- registerFunctionModifier(SourceSystemFunctions.LOCATE, new LocateFunctionModifier());
addPushDownFunction(INGRES, "bit_add", INTEGER, INTEGER, INTEGER); //$NON-NLS-1$
addPushDownFunction(INGRES, "bit_length", INTEGER, INTEGER); //$NON-NLS-1$
@@ -140,7 +139,6 @@
supportedFunctions.add(SourceSystemFunctions.LCASE);
supportedFunctions.add(SourceSystemFunctions.LEFT);
supportedFunctions.add(SourceSystemFunctions.LPAD);
- supportedFunctions.add(SourceSystemFunctions.LOCATE);
supportedFunctions.add(SourceSystemFunctions.LENGTH);
supportedFunctions.add(SourceSystemFunctions.LOG);
supportedFunctions.add(SourceSystemFunctions.MINUTE);
Deleted: branches/7.7.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/ingres/LocateFunctionModifier.java
===================================================================
--- branches/7.7.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/ingres/LocateFunctionModifier.java 2012-03-07 02:09:38 UTC (rev 3919)
+++ branches/7.7.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/ingres/LocateFunctionModifier.java 2012-03-07 21:33:00 UTC (rev 3920)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-package org.teiid.translator.jdbc.ingres;
-
-import java.util.List;
-
-import org.teiid.language.Expression;
-import org.teiid.language.Function;
-import org.teiid.translator.jdbc.FunctionModifier;
-
-public class LocateFunctionModifier extends FunctionModifier {
-
- public LocateFunctionModifier() {
- }
-
- @Override
- public List<?> translate(Function function) {
- Expression a = function.getParameters().get(0);
- Expression b = function.getParameters().get(1);
- function.getParameters().set(0, b);
- function.getParameters().set(1, a);
- return null;
- }
-
-}
Modified: branches/7.7.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/ingres/TestIngresExecutionFactory.java
===================================================================
--- branches/7.7.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/ingres/TestIngresExecutionFactory.java 2012-03-07 02:09:38 UTC (rev 3919)
+++ branches/7.7.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/ingres/TestIngresExecutionFactory.java 2012-03-07 21:33:00 UTC (rev 3920)
@@ -23,6 +23,7 @@
package org.teiid.translator.jdbc.ingres;
import org.junit.BeforeClass;
+import org.junit.Ignore;
import org.junit.Test;
import org.teiid.translator.TranslatorException;
import org.teiid.translator.jdbc.TranslationHelper;
@@ -37,11 +38,19 @@
TRANSLATOR.start();
}
+ @Ignore
@Test public void testLocate() throws Exception {
String input = "SELECT INTKEY FROM BQT1.SmallA WHERE LOCATE(1, INTKEY) = 1 ORDER BY INTKEY"; //$NON-NLS-1$
String output = "SELECT SmallA.IntKey FROM SmallA WHERE locate(cast(SmallA.IntKey AS varchar(4000)), '1') = 1 ORDER BY SmallA.IntKey"; //$NON-NLS-1$
TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB, input, output, TRANSLATOR);
}
+
+ @Test public void testLimit() throws Exception {
+ String input = "SELECT INTKEY FROM BQT1.SmallA LIMIT 1"; //$NON-NLS-1$
+ String output = "SELECT SmallA.IntKey FROM SmallA FETCH FIRST 1 ROWS ONLY"; //$NON-NLS-1$
+
+ TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB, input, output, TRANSLATOR);
+ }
}
12 years, 9 months