[teiid-commits] teiid SVN: r2147 - in trunk: build/kits/jboss-container/deploy/teiid and 14 other directories.
teiid-commits at lists.jboss.org
teiid-commits at lists.jboss.org
Thu May 20 17:51:06 EDT 2010
Author: shawkins
Date: 2010-05-20 17:51:04 -0400 (Thu, 20 May 2010)
New Revision: 2147
Added:
trunk/build/kits/jboss-container/teiid-examples/portfolio/marketdata-file-ds.xml
trunk/build/kits/jboss-container/teiid-examples/portfolio/marketdata-text-translator.xml
trunk/connectors/connector-file/
Removed:
trunk/build/kits/jboss-container/teiid-examples/portfolio/text-connection-ds.xml
trunk/connectors/connector-text/
Modified:
trunk/build/assembly/jboss-container/dist.xml
trunk/build/kits/jboss-container/deploy/teiid/connectors/jdbc-translator.xml
trunk/build/kits/jboss-container/deploy/teiid/connectors/ldap-translator.xml
trunk/build/kits/jboss-container/deploy/teiid/teiid-connector-templates-jboss-beans.xml
trunk/build/kits/jboss-container/teiid-examples/dynamicvdb-portfolio/README.txt
trunk/build/kits/jboss-container/teiid-examples/dynamicvdb-portfolio/portfolio-dynamic-vdb.xml
trunk/build/kits/jboss-container/teiid-examples/portfolio/PortfolioModel/Portfolio.vdb
trunk/build/kits/jboss-container/teiid-examples/portfolio/README.txt
trunk/build/kits/jboss-container/teiid-examples/simpleclient/readme.txt
trunk/build/kits/jboss-container/teiid-examples/simpleclient/run.bat
trunk/build/kits/jboss-container/teiid-examples/simpleclient/run.sh
trunk/client/src/main/java/org/teiid/client/util/ExceptionHolder.java
trunk/client/src/test/java/org/teiid/client/util/TestExceptionHolder.java
trunk/common-core/src/main/resources/org/teiid/core/i18n.properties
trunk/connectors/connector-file/pom.xml
trunk/connectors/connector-file/src/main/java/org/teiid/resource/adapter/file/FileManagedConnectionFactory.java
trunk/connectors/pom.xml
trunk/connectors/translator-ldap/src/main/java/org/teiid/translator/ldap/IQueryToLdapSearchParser.java
trunk/connectors/translator-ldap/src/main/java/org/teiid/translator/ldap/LDAPExecutionFactory.java
trunk/connectors/translator-xml/src/main/java/org/teiid/translator/xml/XMLExecutionFactory.java
trunk/connectors/translator-xml/src/test/java/org/teiid/translator/xml/file/TestCachingFileConnectorLong.java
trunk/connectors/translator-xml/src/test/java/org/teiid/translator/xml/file/TestFileConnector.java
Log:
TEIID-1077 renaming connector-text to connector-file, adding xml translator to the dist, updating the examples, fixing test errors in the xml translator, and changing the ldap translator to not require a base search dn.
Modified: trunk/build/assembly/jboss-container/dist.xml
===================================================================
--- trunk/build/assembly/jboss-container/dist.xml 2010-05-20 01:13:35 UTC (rev 2146)
+++ trunk/build/assembly/jboss-container/dist.xml 2010-05-20 21:51:04 UTC (rev 2147)
@@ -73,12 +73,13 @@
<include>org.jboss.teiid.connectors:translator-jdbc</include>
<include>org.jboss.teiid.connectors:translator-loopback</include>
<include>org.jboss.teiid.connectors:translator-text</include>
- <include>org.jboss.teiid.connectors:connector-text:rar</include>
+ <include>org.jboss.teiid.connectors:connector-file:rar</include>
<include>org.jboss.teiid.connectors:translator-ldap</include>
<include>org.jboss.teiid.connectors:connector-ldap:rar</include>
<include>org.jboss.teiid.connectors:translator-salesforce</include>
<include>org.jboss.teiid.connectors:connector-salesforce:rar</include>
<include>org.jboss.teiid.connectors:connector-ws:rar</include>
+ <include>org.jboss.teiid.connectors:translator-xml</include>
<!--
<include>org.jboss.teiid.connectors:connector-xml-http:rar</include>
Modified: trunk/build/kits/jboss-container/deploy/teiid/connectors/jdbc-translator.xml
===================================================================
--- trunk/build/kits/jboss-container/deploy/teiid/connectors/jdbc-translator.xml 2010-05-20 01:13:35 UTC (rev 2146)
+++ trunk/build/kits/jboss-container/deploy/teiid/connectors/jdbc-translator.xml 2010-05-20 21:51:04 UTC (rev 2147)
@@ -76,4 +76,18 @@
<xa-capable>true</xa-capable>
<template-name>translator-jdbc-${project.version}</template-name>
</translator>
+
+ <translator>
+ <name>jdbc-simple</name>
+ <execution-factory-class>org.teiid.translator.jdbc.SimpleExecutionFactory</execution-factory-class>
+ <xa-capable>true</xa-capable>
+ <template-name>translator-jdbc-${project.version}</template-name>
+ </translator>
+
+ <translator>
+ <name>jdbc-ansi</name>
+ <execution-factory-class>org.teiid.translator.jdbc.JDBCExecutionFactory</execution-factory-class>
+ <xa-capable>true</xa-capable>
+ <template-name>translator-jdbc-${project.version}</template-name>
+ </translator>
</translator-factory>
\ No newline at end of file
Modified: trunk/build/kits/jboss-container/deploy/teiid/connectors/ldap-translator.xml
===================================================================
--- trunk/build/kits/jboss-container/deploy/teiid/connectors/ldap-translator.xml 2010-05-20 01:13:35 UTC (rev 2146)
+++ trunk/build/kits/jboss-container/deploy/teiid/connectors/ldap-translator.xml 2010-05-20 21:51:04 UTC (rev 2147)
@@ -4,8 +4,5 @@
<name>ldap</name>
<execution-factory-class>org.teiid.translator.ldap.LDAPExecutionFactory</execution-factory-class>
<template-name>translator-ldap-${project.version}</template-name>
- <translator-property name="SearchDefaultBaseDN" value="" />
- <translator-property name="SearchDefaultScope" value="SUBTREE_SCOPE" />
- <translator-property name="RestrictToObjectClass" value="false" />
</translator>
</translator-factory>
\ No newline at end of file
Modified: trunk/build/kits/jboss-container/deploy/teiid/teiid-connector-templates-jboss-beans.xml
===================================================================
--- trunk/build/kits/jboss-container/deploy/teiid/teiid-connector-templates-jboss-beans.xml 2010-05-20 01:13:35 UTC (rev 2146)
+++ trunk/build/kits/jboss-container/deploy/teiid/teiid-connector-templates-jboss-beans.xml 2010-05-20 21:51:04 UTC (rev 2147)
@@ -47,21 +47,36 @@
<property name="rarName">connector-salesforce-${project.version}.rar</property>
</bean>
- <bean name="connector-text-${project.version}" class="org.teiid.templates.connector.ConnectorDeploymentTemplate">
- <property name="info"><inject bean="connector-text-templateinfo"/></property>
+ <bean name="connector-file-${project.version}" class="org.teiid.templates.connector.ConnectorDeploymentTemplate">
+ <property name="info"><inject bean="connector-file-templateinfo"/></property>
<property name="targetTemplate"><inject bean="NoTxConnectionFactoryTemplate"/></property>
</bean>
- <bean name="connector-text-templateinfo" class="org.teiid.templates.connector.ConnectorTemplateInfo">
+ <bean name="connector-file-templateinfo" class="org.teiid.templates.connector.ConnectorTemplateInfo">
<constructor factoryMethod="createTemplateInfo">
<factory bean="DSDeploymentTemplateInfoFactory"/>
<parameter class="java.lang.Class">org.teiid.templates.connector.ConnectorTemplateInfo</parameter>
<parameter class="java.lang.Class">org.jboss.resource.metadata.mcf.NoTxConnectionFactoryDeploymentMetaData</parameter>
- <parameter class="java.lang.String">connector-text-${project.version}</parameter>
- <parameter class="java.lang.String">Teiid Text Connector</parameter>
+ <parameter class="java.lang.String">connector-file-${project.version}</parameter>
+ <parameter class="java.lang.String">Teiid File Connector</parameter>
</constructor>
- <property name="rarName">connector-text-${project.version}.rar</property>
+ <property name="rarName">connector-file-${project.version}.rar</property>
</bean>
+ <bean name="connector-ws-${project.version}" class="org.teiid.templates.connector.ConnectorDeploymentTemplate">
+ <property name="info"><inject bean="connector-ldap-templateinfo"/></property>
+ <property name="targetTemplate"><inject bean="NoTxConnectionFactoryTemplate"/></property>
+ </bean>
+ <bean name="connector-ws-templateinfo" class="org.teiid.templates.connector.ConnectorTemplateInfo">
+ <constructor factoryMethod="createTemplateInfo">
+ <factory bean="DSDeploymentTemplateInfoFactory"/>
+ <parameter class="java.lang.Class">org.teiid.templates.connector.ConnectorTemplateInfo</parameter>
+ <parameter class="java.lang.Class">org.jboss.resource.metadata.mcf.NoTxConnectionFactoryDeploymentMetaData</parameter>
+ <parameter class="java.lang.String">connector-ws-${project.version}</parameter>
+ <parameter class="java.lang.String">Teiid WS Connector</parameter>
+ </constructor>
+ <property name="rarName">connector-ws-${project.version}.rar</property>
+ </bean>
+
<!--
<bean name="connector-xmlsource-file-${project.version}" class="org.teiid.templates.connector.ConnectorDeploymentTemplate">
<property name="info"><inject bean="connector-xmlsource-file-templateinfo"/></property>
Modified: trunk/build/kits/jboss-container/teiid-examples/dynamicvdb-portfolio/README.txt
===================================================================
--- trunk/build/kits/jboss-container/teiid-examples/dynamicvdb-portfolio/README.txt 2010-05-20 01:13:35 UTC (rev 2146)
+++ trunk/build/kits/jboss-container/teiid-examples/dynamicvdb-portfolio/README.txt 2010-05-20 21:51:04 UTC (rev 2147)
@@ -1,16 +1,17 @@
Follow the same derby setup instructions as the portfolio example.
-Copy the followng files to the <jboss.home>/server/default/deploy directory.
+Copy the following files to the <jboss.home>/server/default/deploy directory.
- portfolio-dynamic-vdb.xml
- - ../portfolio/text-connection-ds.xml
+ - ../portfolio/marketdata-file-ds.xml
- ../portfolio/portfolio-ds.xml
+ - ../portfolio/marketdata-text-translator.xml
Start the JBoss Container
Use the simple client example run script i.e.
-$run.sh dynamicportfolio "select * from product, price where product.symbol=price.symbol"
+$run.sh localhost 31000 dynamicportfolio "select * from product, price where product.symbol=price.symbol"
That will execute the query against both Derby and the text file using the
-connector supplied metadata running in Teiid embedded mode.
+connector supplied metadata.
Modified: trunk/build/kits/jboss-container/teiid-examples/dynamicvdb-portfolio/portfolio-dynamic-vdb.xml
===================================================================
--- trunk/build/kits/jboss-container/teiid-examples/dynamicvdb-portfolio/portfolio-dynamic-vdb.xml 2010-05-20 01:13:35 UTC (rev 2146)
+++ trunk/build/kits/jboss-container/teiid-examples/dynamicvdb-portfolio/portfolio-dynamic-vdb.xml 2010-05-20 21:51:04 UTC (rev 2147)
@@ -27,7 +27,7 @@
you can create one. They are defined using "-translator.xml" file. Connections define connections
to physical sources. In JBoss AS they are typically defined using "xxx-ds.xml" files.
-->
- <source name="text-connector" translator-name="text" connection-jndi-name="java:marketdata-text-connection"/>
+ <source name="text-connector" translator-name="marketdata-text" connection-jndi-name="java:marketdata-text-connection"/>
</model>
<model name="Accounts">
Modified: trunk/build/kits/jboss-container/teiid-examples/portfolio/PortfolioModel/Portfolio.vdb
===================================================================
--- trunk/build/kits/jboss-container/teiid-examples/portfolio/PortfolioModel/Portfolio.vdb 2010-05-20 01:13:35 UTC (rev 2146)
+++ trunk/build/kits/jboss-container/teiid-examples/portfolio/PortfolioModel/Portfolio.vdb 2010-05-20 21:51:04 UTC (rev 2147)
@@ -151,10 +151,10 @@
¤ðpìû|¬·ÝÈ®6E=@WÚ<ù·S,ÿ¹/&gs÷ôî9â'ãQÓ½¶¦iäÅV
Õ0¸è.nÔ/f=õüÃÅ÷ÍÉvnärËÃ}jæK¦ñþiÈ!;¹ozþÈÑlQ´´JlàZé|ñe yÂîv8=×ë#Ù¿¶?»VM at wí¡æ\O÷ëÚ³õm³t&×qÃL½xþöÏJï~3óìçIõ±çâÜÍ©ï¹v¥65§9d5ýjÆÒÕ@xâ(áCõ}ß.kZ</²t)G/첦äOáç<)Ó|¶Â¡öÕ¿¾®bN¥¬ûÈYI»_)Ãd.»8±yt§kMâè^~XÆy¦o7i²Öe óæÙkÿE
-¢ÛÞ{m&½DÚÞ¹ûöfç¡ç0/)É/ùÿIõüÐÕcL©«kPH§×6ëûòTÊ LXà æ³B÷®QdZ©<qÌ;ádÌBIè|4ñ
-óÒd#m5
NÜEñKËDh3GP9JÁÈ»ü@Mh{r~êíMoîÚQÄHyºLP¨¾Tu5:çpa-wÓþÆf¸hp$.:ü>Øòåÿ¶?DmxÒvõ¼Þ,ÿù¦ó!¯èxåµÐéÜ®äû$PK
+EÞØÑÍñ,Ò®×O«Ô6òC¶vdz]t2æ0r`&wשS¬í'iDiG$1_I,"&Í:LãÕ²(VÿTOVË×þq
+¨&$Ã!+K`3E)r4á»:í±ãjd¥`«öèüíMoÎØ ~PYtyô»$»°:ÌéOU±®º«ß»[¾ý_iãá§
+Ú¬^ëõâi,þÍ7y
ãÂk¦Ó¥"]òOòùPK
-
\ No newline at end of file
+
\ No newline at end of file
Modified: trunk/build/kits/jboss-container/teiid-examples/portfolio/README.txt
===================================================================
--- trunk/build/kits/jboss-container/teiid-examples/portfolio/README.txt 2010-05-20 01:13:35 UTC (rev 2146)
+++ trunk/build/kits/jboss-container/teiid-examples/portfolio/README.txt 2010-05-20 21:51:04 UTC (rev 2147)
@@ -6,15 +6,16 @@
Copy the PortfolioModel/Portolio.vdb file to the "<jboss home>/server/default/deploy" directory.
-Copy the Connectors for the example
- - text-connection-ds.xml
+Copy the Translators/ConnectionFactories for the example to the "<jboss home>/server/default/deploy" directory.
+ - marketdata-file-ds.xml
- portfolio-ds.xml
+ - marketdata-text-translator.xml
Start the JBoss Container
Use the simple client example run script i.e.
-$run.sh portfolio "select * from CustomerAccount"
+$run.sh localhost 31000 portfolio "select * from CustomerAccount"
-That will execute the query against the CustomerAccount view in the Portfolio VDB running in Teiid embedded mode.
+That will execute the query against the CustomerAccount view in the Portfolio VDB.
Copied: trunk/build/kits/jboss-container/teiid-examples/portfolio/marketdata-file-ds.xml (from rev 2146, trunk/build/kits/jboss-container/teiid-examples/portfolio/text-connection-ds.xml)
===================================================================
--- trunk/build/kits/jboss-container/teiid-examples/portfolio/marketdata-file-ds.xml (rev 0)
+++ trunk/build/kits/jboss-container/teiid-examples/portfolio/marketdata-file-ds.xml 2010-05-20 21:51:04 UTC (rev 2147)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<connection-factories>
+
+ <no-tx-connection-factory>
+ <jndi-name>marketdata-file-connection</jndi-name>
+ <rar-name>connector-file-${project.version}.rar</rar-name>
+ <connection-definition>javax.resource.cci.ConnectionFactory</connection-definition>
+ <!--
+ All the available properties for this connector are defined inside the "ra.xml" defined inside the rar
+ file mentioned above.
+ -->
+
+ <config-property name="ParentDirectory" type="java.lang.String">${jboss.server.home.dir}/teiid-examples/portfolio</config-property>
+
+ <max-pool-size>20</max-pool-size>
+
+ </no-tx-connection-factory>
+
+</connection-factories>
\ No newline at end of file
Property changes on: trunk/build/kits/jboss-container/teiid-examples/portfolio/marketdata-file-ds.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/build/kits/jboss-container/teiid-examples/portfolio/marketdata-text-translator.xml
===================================================================
--- trunk/build/kits/jboss-container/teiid-examples/portfolio/marketdata-text-translator.xml (rev 0)
+++ trunk/build/kits/jboss-container/teiid-examples/portfolio/marketdata-text-translator.xml 2010-05-20 21:51:04 UTC (rev 2147)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<translator-factory>
+ <translator>
+ <name>text</name>
+ <execution-factory-class>org.teiid.translator.text.TextExecutionFactory</execution-factory-class>
+ <template-name>translator-text-${project.version}</template-name>
+ <translator-property name="ParentDirectory" value="file://${jboss.server.home.dir}/teiid-examples/portfolio/marketdata-def.txt"/>
+ </translator>
+</translator-factory>
\ No newline at end of file
Property changes on: trunk/build/kits/jboss-container/teiid-examples/portfolio/marketdata-text-translator.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: trunk/build/kits/jboss-container/teiid-examples/portfolio/text-connection-ds.xml
===================================================================
--- trunk/build/kits/jboss-container/teiid-examples/portfolio/text-connection-ds.xml 2010-05-20 01:13:35 UTC (rev 2146)
+++ trunk/build/kits/jboss-container/teiid-examples/portfolio/text-connection-ds.xml 2010-05-20 21:51:04 UTC (rev 2147)
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<connection-factories>
-
- <no-tx-connection-factory>
- <jndi-name>marketdata-text-connection</jndi-name>
- <rar-name>connector-text-${project.version}.rar</rar-name>
- <connection-definition>javax.resource.cci.ConnectionFactory</connection-definition>
- <!--
- All the available properties for this connector are defined inside the "ra.xml" defined inside the rar
- file mentioned above.
- -->
-
- <config-property name="XaCapable" type="java.lang.Boolean">false</config-property>
-
- <config-property name="DescriptorFile" type="java.lang.String">${jboss.server.home.dir}/teiid-examples/portfolio/marketdata-def.txt</config-property>
-
- <max-pool-size>20</max-pool-size>
-
- </no-tx-connection-factory>
-
-</connection-factories>
\ No newline at end of file
Modified: trunk/build/kits/jboss-container/teiid-examples/simpleclient/readme.txt
===================================================================
--- trunk/build/kits/jboss-container/teiid-examples/simpleclient/readme.txt 2010-05-20 01:13:35 UTC (rev 2146)
+++ trunk/build/kits/jboss-container/teiid-examples/simpleclient/readme.txt 2010-05-20 21:51:04 UTC (rev 2147)
@@ -1,10 +1,10 @@
JDBCClient.java shows making connections to Teiid in embedded mode through both a Driver
and a DataSource.
-The program expects two arguments <vdb name> and <sql query>. There are helper run scripts
+The program expects four arguments <host> <port> <vdb> <sql-command>. There are helper run scripts
that can be run as follows:
-$run.sh <vdb> "select * from SYS.tables"
+$run.sh localhost 31000 portfolio "select * from CustomerAccount"
Note that the query is in quotes so that it is understood as a single argument.
Modified: trunk/build/kits/jboss-container/teiid-examples/simpleclient/run.bat
===================================================================
--- trunk/build/kits/jboss-container/teiid-examples/simpleclient/run.bat 2010-05-20 01:13:35 UTC (rev 2146)
+++ trunk/build/kits/jboss-container/teiid-examples/simpleclient/run.bat 2010-05-20 21:51:04 UTC (rev 2147)
@@ -2,7 +2,7 @@
set CLIENT_PATH=.
rem Second one adds the Teiid client
-set TEIID_PATH=../client/teiid-${pom.version}-client.jar
+set TEIID_PATH=../lib/teiid-${pom.version}-client.jar
java -cp %CLIENT_PATH%;%TEIID_PATH% JDBCClient %*
Modified: trunk/build/kits/jboss-container/teiid-examples/simpleclient/run.sh
===================================================================
--- trunk/build/kits/jboss-container/teiid-examples/simpleclient/run.sh 2010-05-20 01:13:35 UTC (rev 2146)
+++ trunk/build/kits/jboss-container/teiid-examples/simpleclient/run.sh 2010-05-20 21:51:04 UTC (rev 2147)
@@ -4,6 +4,6 @@
CLIENT_PATH=.
#Second one for the Teiid client jar
-TEIID_PATH=../../client/teiid-${pom.version}-client.jar
+TEIID_PATH=../../lib/teiid-${pom.version}-client.jar
java -cp ${CLIENT_PATH}:${TEIID_PATH} JDBCClient "$@"
Modified: trunk/client/src/main/java/org/teiid/client/util/ExceptionHolder.java
===================================================================
--- trunk/client/src/main/java/org/teiid/client/util/ExceptionHolder.java 2010-05-20 01:13:35 UTC (rev 2146)
+++ trunk/client/src/main/java/org/teiid/client/util/ExceptionHolder.java 2010-05-20 21:51:04 UTC (rev 2147)
@@ -137,8 +137,14 @@
}
private Throwable buildException(List<String> classNames, String message, StackTraceElement[] stackTrace, String code) {
- List<String> args = Arrays.asList(CorePlugin.Util.getString("ExceptionHolder.converted_exception", message, classNames)); //$NON-NLS-1$
+ if (classNames.isEmpty()) {
+ return null;
+ }
+ String originalClass = classNames.get(0);
+
+ List<String> args = Arrays.asList(CorePlugin.Util.getString("ExceptionHolder.converted_exception", message, originalClass)); //$NON-NLS-1$
+
Throwable result = null;
for (String className : classNames) {
try {
Modified: trunk/client/src/test/java/org/teiid/client/util/TestExceptionHolder.java
===================================================================
--- trunk/client/src/test/java/org/teiid/client/util/TestExceptionHolder.java 2010-05-20 01:13:35 UTC (rev 2146)
+++ trunk/client/src/test/java/org/teiid/client/util/TestExceptionHolder.java 2010-05-20 21:51:04 UTC (rev 2147)
@@ -43,7 +43,7 @@
ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));
ExceptionHolder holder = (ExceptionHolder)ois.readObject();
assertTrue(holder.getException() instanceof BadException);
- assertEquals("Remote exception: null ... Original type hierarchy [org.teiid.client.util.TestExceptionHolder$BadException, org.teiid.core.TeiidProcessingException, org.teiid.core.TeiidException].", holder.getException().getMessage()); //$NON-NLS-1$
+ assertEquals("Remote org.teiid.client.util.TestExceptionHolder$BadException: null", holder.getException().getMessage()); //$NON-NLS-1$
}
@@ -71,12 +71,12 @@
ExceptionHolder holder = (ExceptionHolder)ois.readObject();
Throwable e = holder.getException();
assertTrue(e instanceof BadException2);
- assertEquals("Remote exception: I have foreign exception embedded in me ... Original type hierarchy [org.teiid.client.util.TestExceptionHolder$BadException2, org.teiid.core.TeiidProcessingException, org.teiid.core.TeiidException].", e.getMessage()); //$NON-NLS-1$
+ assertEquals("Remote org.teiid.client.util.TestExceptionHolder$BadException2: I have foreign exception embedded in me", e.getMessage()); //$NON-NLS-1$
// now unknown exception is not found, so promote known SQL exception up
e = e.getCause();
assertTrue(e instanceof SQLException);
- assertEquals("Remote exception: something bad happended ... Original type hierarchy [java.sql.SQLException].", e.getMessage()); //$NON-NLS-1$
+ assertEquals("Remote java.sql.SQLException: something bad happended", e.getMessage()); //$NON-NLS-1$
}
@Test public void testDeserializationUnknownChildException2() throws Exception {
Modified: trunk/common-core/src/main/resources/org/teiid/core/i18n.properties
===================================================================
--- trunk/common-core/src/main/resources/org/teiid/core/i18n.properties 2010-05-20 01:13:35 UTC (rev 2146)
+++ trunk/common-core/src/main/resources/org/teiid/core/i18n.properties 2010-05-20 21:51:04 UTC (rev 2147)
@@ -397,7 +397,7 @@
ERR.003.030.0180=Driver {0} can not load {1}
ERR.003.030.0181=Failed to connect to the Database at {0} check connection properties.
-ExceptionHolder.converted_exception=Remote exception: {0} ... Original type hierarchy {1}.
+ExceptionHolder.converted_exception=Remote {1}: {0}
PropertiesUtils.failed_to_resolve_property=failed to completely resolve the property value for key {0}
transform.invalid_string_for_date=The string representation ''{0}'' of a {1} value is not valid.
Copied: trunk/connectors/connector-file (from rev 2146, trunk/connectors/connector-text)
Modified: trunk/connectors/connector-file/pom.xml
===================================================================
--- trunk/connectors/connector-text/pom.xml 2010-05-20 01:13:35 UTC (rev 2146)
+++ trunk/connectors/connector-file/pom.xml 2010-05-20 21:51:04 UTC (rev 2147)
@@ -6,11 +6,11 @@
<version>7.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <artifactId>connector-text</artifactId>
+ <artifactId>connector-file</artifactId>
<groupId>org.jboss.teiid.connectors</groupId>
- <name>Text Connector</name>
+ <name>File Connector</name>
<packaging>rar</packaging>
- <description>This connector reads data from text files.</description>
+ <description>This connector reads data from files.</description>
<dependencies>
<dependency>
Modified: trunk/connectors/connector-file/src/main/java/org/teiid/resource/adapter/file/FileManagedConnectionFactory.java
===================================================================
--- trunk/connectors/connector-text/src/main/java/org/teiid/resource/adapter/file/FileManagedConnectionFactory.java 2010-05-20 01:13:35 UTC (rev 2146)
+++ trunk/connectors/connector-file/src/main/java/org/teiid/resource/adapter/file/FileManagedConnectionFactory.java 2010-05-20 21:51:04 UTC (rev 2147)
@@ -22,6 +22,7 @@
package org.teiid.resource.adapter.file;
import javax.resource.ResourceException;
+import javax.resource.spi.InvalidPropertyException;
import org.teiid.resource.spi.BasicConnection;
import org.teiid.resource.spi.BasicConnectionFactory;
@@ -35,6 +36,9 @@
@Override
public Object createConnectionFactory() throws ResourceException {
+ if (this.parentDirectory == null) {
+ throw new InvalidPropertyException("ParentDirectory is not set");
+ }
return new BasicConnectionFactory() {
@Override
Modified: trunk/connectors/pom.xml
===================================================================
--- trunk/connectors/pom.xml 2010-05-20 01:13:35 UTC (rev 2146)
+++ trunk/connectors/pom.xml 2010-05-20 21:51:04 UTC (rev 2147)
@@ -82,7 +82,7 @@
<module>translator-text</module>
<module>translator-salesforce</module>
- <module>connector-text</module>
+ <module>connector-file</module>
<module>connector-salesforce</module>
<module>connector-ldap</module>
<module>salesforce-api</module>
Modified: trunk/connectors/translator-ldap/src/main/java/org/teiid/translator/ldap/IQueryToLdapSearchParser.java
===================================================================
--- trunk/connectors/translator-ldap/src/main/java/org/teiid/translator/ldap/IQueryToLdapSearchParser.java 2010-05-20 01:13:35 UTC (rev 2146)
+++ trunk/connectors/translator-ldap/src/main/java/org/teiid/translator/ldap/IQueryToLdapSearchParser.java 2010-05-20 21:51:04 UTC (rev 2147)
@@ -40,7 +40,6 @@
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
-import java.util.ListIterator;
import javax.naming.NamingException;
import javax.naming.directory.BasicAttribute;
@@ -116,18 +115,18 @@
public LDAPSearchDetails translateSQLQueryToLDAPSearch(Select query) throws TranslatorException {
// Parse SELECT symbols.
// The columns will be translated into LDAP attributes of interest.
- ArrayList attributeList = getAttributesFromSelectSymbols(query);
- ArrayList elementList = getElementsFromSelectSymbols(query);
+ ArrayList<BasicAttribute> attributeList = getAttributesFromSelectSymbols(query);
+ ArrayList<Column> elementList = getElementsFromSelectSymbols(query);
// Parse FROM table.
// Only one table is expected here.
- List fromList = query.getFrom();
- Iterator itr = fromList.listIterator();
+ List<TableReference> fromList = query.getFrom();
+ Iterator<TableReference> itr = fromList.iterator();
if(!itr.hasNext()) {
final String msg = LDAPPlugin.Util.getString("IQueryToLdapSearchParser.noTablesInFromError"); //$NON-NLS-1$
throw new TranslatorException(msg);
}
- TableReference fItm = (TableReference)itr.next();
+ TableReference fItm = itr.next();
if(itr.hasNext()) {
final String msg = LDAPPlugin.Util.getString("IQueryToLdapSearchParser.multiItemsInFromError"); //$NON-NLS-1$
throw new TranslatorException(msg);
@@ -140,36 +139,35 @@
// Parse the WHERE clause.
// Create an equivalent LDAP search filter.
- List searchStringList = new LinkedList();
+ List<String> searchStringList = new LinkedList<String>();
searchStringList = getSearchFilterFromWhereClause(query.getWhere(), searchStringList);
- String filter = new String();
- ListIterator filterItr = searchStringList.listIterator();
- while(filterItr.hasNext()) {
- filter += filterItr.next();
+ StringBuilder filterBuilder = new StringBuilder();
+ for (String string : searchStringList) {
+ filterBuilder.append(string);
}
// GHH 20080326 - if there is a class restriction,
// add it to the search filter
if (classRestriction != null && classRestriction.trim().length()>0) {
- filter = "(&"+filter+"(objectClass="+classRestriction+"))"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ filterBuilder.insert(0, "(&").append("(objectClass=").append(classRestriction).append("))"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
// Parse the ORDER BY clause.
// Create an ordered sort list.
- OrderBy orderBy = (OrderBy)query.getOrderBy();
+ OrderBy orderBy = query.getOrderBy();
// Referenced the JNDI standard...arguably, this should not be done inside this
// class, and we should make our own key class. In practice, this makes things simpler.
SortKey[] sortKeys = getSortKeysFromOrderByClause(orderBy);
// Parse LIMIT clause.
// Note that offsets are not supported.
- Limit limit = (Limit)query.getLimit();
+ Limit limit = query.getLimit();
long countLimit = -1;
if(limit != null) {
countLimit = limit.getRowLimit();
}
// Create Search Details
- LDAPSearchDetails sd = new LDAPSearchDetails(contextName, searchScope, filter, attributeList, sortKeys, countLimit, elementList);
+ LDAPSearchDetails sd = new LDAPSearchDetails(contextName, searchScope, filterBuilder.toString(), attributeList, sortKeys, countLimit, elementList);
// Search Details logging
try {
sd.printDetailsToLog();
@@ -190,26 +188,24 @@
private SortKey[] getSortKeysFromOrderByClause(OrderBy orderBy) throws TranslatorException {
SortKey[] sortKeys = null;
if(orderBy != null) {
- List orderItems = orderBy.getSortSpecifications();
+ List<SortSpecification> orderItems = orderBy.getSortSpecifications();
if(orderItems == null) {
return null;
}
SortKey sortKey = null;
sortKeys = new SortKey[orderItems.size()];
- Iterator orderItr = orderItems.iterator();
+ Iterator<SortSpecification> orderItr = orderItems.iterator();
int i = 0;
while(orderItr.hasNext()) {
- SortSpecification item = (SortSpecification)orderItr.next();
- if(item != null) {
- String itemName = getExpressionString((Expression)item.getExpression());
- LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Adding sort key for item: " + itemName); //$NON-NLS-1$
- if(item.getOrdering() == Ordering.ASC) {
- LogManager.logTrace(LogConstants.CTX_CONNECTOR, "with ASC ordering."); //$NON-NLS-1$
- sortKey = new SortKey(itemName, true, null);
- } else if(item.getOrdering() == Ordering.DESC){
- LogManager.logTrace(LogConstants.CTX_CONNECTOR, "with DESC ordering."); //$NON-NLS-1$
- sortKey = new SortKey(itemName, false, null);
- }
+ SortSpecification item = orderItr.next();
+ String itemName = getExpressionString(item.getExpression());
+ LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Adding sort key for item: " + itemName); //$NON-NLS-1$
+ if(item.getOrdering() == Ordering.ASC) {
+ LogManager.logTrace(LogConstants.CTX_CONNECTOR, "with ASC ordering."); //$NON-NLS-1$
+ sortKey = new SortKey(itemName, true, null);
+ } else if(item.getOrdering() == Ordering.DESC){
+ LogManager.logTrace(LogConstants.CTX_CONNECTOR, "with DESC ordering."); //$NON-NLS-1$
+ sortKey = new SortKey(itemName, false, null);
}
sortKeys[i] = sortKey;
i++;
@@ -514,13 +510,13 @@
LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Parsing IN criteria."); //$NON-NLS-1$
isNegated = ((In) criteria).isNegated();
Expression lhs = ((In)criteria).getLeftExpression();
- List rhsList = ((In)criteria).getRightExpressions();
+ List<Expression> rhsList = ((In)criteria).getRightExpressions();
// Recursively add each IN expression to the filter list.
processInCriteriaList(filterList, rhsList, lhs);
} else if (criteria instanceof Not) {
LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Parsing NOT criteria."); //$NON-NLS-1$
isNegated = true;
- filterList.addAll(getSearchFilterFromWhereClause(((Not)criteria).getCriteria(), new LinkedList()));
+ filterList.addAll(getSearchFilterFromWhereClause(((Not)criteria).getCriteria(), new LinkedList<String>()));
}
if (isNegated) {
@@ -536,16 +532,16 @@
* Process a list of right-hand side IN expresssions and add the corresponding LDAP filter
* clause string to the given filterList.
*/
- private void processInCriteriaList(List filterList, List rhsList, Expression lhs) throws TranslatorException {
+ private void processInCriteriaList(List<String> filterList, List<Expression> rhsList, Expression lhs) throws TranslatorException {
if(rhsList.size() == 0) {
return;
}
filterList.add("("); //$NON-NLS-1$
filterList.add(parseCompoundCriteriaOp(org.teiid.language.AndOr.Operator.OR));
- Iterator rhsItr = rhsList.iterator();
+ Iterator<Expression> rhsItr = rhsList.iterator();
while(rhsItr.hasNext()) {
addCompareCriteriaToList(filterList, Operator.EQ, getExpressionString(lhs),
- getExpressionString((Expression)rhsItr.next()));
+ getExpressionString(rhsItr.next()));
}
filterList.add(")"); //$NON-NLS-1$
}
@@ -557,7 +553,7 @@
* @param lhs left hand side expression
* @param rhs right hand side expression
*/
- private void addCompareCriteriaToList(List filterList, Comparison.Operator op, String lhs, String rhs) throws TranslatorException {
+ private void addCompareCriteriaToList(List<String> filterList, Comparison.Operator op, String lhs, String rhs) throws TranslatorException {
// Push the comparison statement into the list, e.g.:
// (sn=Mike)
// !(empNum>=100)
@@ -594,7 +590,7 @@
// GHH 20080326 - found that code to fall back on Name if NameInSource
// was null wasn't working properly, so replaced with tried and true
// code from another custom connector.
- public String getNameFromElement(Column e) throws TranslatorException {
+ public String getNameFromElement(Column e) {
String ldapAttributeName = null;
ldapAttributeName = e.getNameInSource();
if (ldapAttributeName == null || ldapAttributeName.equals("")) { //$NON-NLS-1$
@@ -609,12 +605,12 @@
* @param query the supplied Query
* @return the list of SELECT elements
*/
- private ArrayList getElementsFromSelectSymbols(Select query) throws TranslatorException {
- ArrayList selectElementList = new ArrayList();
- Iterator selectSymbolItr = query.getDerivedColumns().iterator();
+ private ArrayList<Column> getElementsFromSelectSymbols(Select query) {
+ ArrayList<Column> selectElementList = new ArrayList<Column>();
+ Iterator<DerivedColumn> selectSymbolItr = query.getDerivedColumns().iterator();
while(selectSymbolItr.hasNext()) {
- Column e = getElementFromSymbol((DerivedColumn)selectSymbolItr.next());
+ Column e = getElementFromSymbol(selectSymbolItr.next());
selectElementList.add(e);
}
return selectElementList;
@@ -625,13 +621,13 @@
* @param query the supplied Query
* @return the list of attributes
*/
- private ArrayList getAttributesFromSelectSymbols(Select query) throws TranslatorException {
- ArrayList ldapAttributeList = new ArrayList();
+ private ArrayList<BasicAttribute> getAttributesFromSelectSymbols(Select query) {
+ ArrayList<BasicAttribute> ldapAttributeList = new ArrayList<BasicAttribute>();
- Iterator selectSymbolItr = query.getDerivedColumns().iterator();
+ Iterator<DerivedColumn> selectSymbolItr = query.getDerivedColumns().iterator();
int i=0;
while(selectSymbolItr.hasNext()) {
- Column e = getElementFromSymbol((DerivedColumn)selectSymbolItr.next());
+ Column e = getElementFromSymbol(selectSymbolItr.next());
String ldapAttributeName = this.getNameFromElement(e);
Object ldapAttributeClass = e.getJavaType();
@@ -649,7 +645,7 @@
* @param symbol Input ISelectSymbol
* @return Element returned metadata runtime Element
*/
- private Column getElementFromSymbol(DerivedColumn symbol) throws TranslatorException {
+ private Column getElementFromSymbol(DerivedColumn symbol) {
ColumnReference expr = (ColumnReference) symbol.getExpression();
return expr.getMetadataObject();
}
Modified: trunk/connectors/translator-ldap/src/main/java/org/teiid/translator/ldap/LDAPExecutionFactory.java
===================================================================
--- trunk/connectors/translator-ldap/src/main/java/org/teiid/translator/ldap/LDAPExecutionFactory.java 2010-05-20 01:13:35 UTC (rev 2146)
+++ trunk/connectors/translator-ldap/src/main/java/org/teiid/translator/ldap/LDAPExecutionFactory.java 2010-05-20 21:51:04 UTC (rev 2147)
@@ -53,7 +53,7 @@
private boolean restrictToObjectClass;
private SearchDefaultScope searchDefaultScope = SearchDefaultScope.ONELEVEL_SCOPE;
- @TranslatorProperty(display="Default Search Base DN", description="Default Base DN for LDAP Searches",required=true)
+ @TranslatorProperty(display="Default Search Base DN", description="Default Base DN for LDAP Searches")
public String getSearchDefaultBaseDN() {
return searchDefaultBaseDN;
}
Modified: trunk/connectors/translator-xml/src/main/java/org/teiid/translator/xml/XMLExecutionFactory.java
===================================================================
--- trunk/connectors/translator-xml/src/main/java/org/teiid/translator/xml/XMLExecutionFactory.java 2010-05-20 01:13:35 UTC (rev 2146)
+++ trunk/connectors/translator-xml/src/main/java/org/teiid/translator/xml/XMLExecutionFactory.java 2010-05-20 21:51:04 UTC (rev 2147)
@@ -164,7 +164,10 @@
}
return compasiteExecution;
}
- return createExecution(requestPerms.get(0), executionInfo, executionContext,connectionFactory);
+ if (requestPerms.size() == 1) {
+ return createExecution(requestPerms.get(0), executionInfo, executionContext,connectionFactory);
+ }
+ return createExecution(Collections.EMPTY_LIST, executionInfo, executionContext,connectionFactory);
}
private ResultSetExecution createExecution(List<CriteriaDesc> cds, ExecutionInfo executionInfo, ExecutionContext executionContext, Object connectionFactory)
Modified: trunk/connectors/translator-xml/src/test/java/org/teiid/translator/xml/file/TestCachingFileConnectorLong.java
===================================================================
--- trunk/connectors/translator-xml/src/test/java/org/teiid/translator/xml/file/TestCachingFileConnectorLong.java 2010-05-20 01:13:35 UTC (rev 2146)
+++ trunk/connectors/translator-xml/src/test/java/org/teiid/translator/xml/file/TestCachingFileConnectorLong.java 2010-05-20 21:51:04 UTC (rev 2147)
@@ -1,6 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with 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.xml.file;
-
import java.io.File;
import java.util.List;
@@ -43,17 +64,14 @@
/**
* This primes the cache with the response docs, then gets them from the cache
+ * @throws TranslatorException
*/
- public void testSelectFromCache() {
- try {
- List result = host.executeCommand("SELECT * FROM file_po_list.ITEM");
- assertEquals(5968, result.size());
-
- result = host.executeCommand("SELECT * FROM file_po_list.ITEM");
- assertEquals(5968, result.size());
- } catch (TranslatorException e) {
- fail(e.getMessage());
- }
+ public void testSelectFromCache() throws TranslatorException {
+ List result = host.executeCommand("SELECT * FROM file_po_list.ITEM");
+ assertEquals(5968, result.size());
+
+ result = host.executeCommand("SELECT * FROM file_po_list.ITEM");
+ assertEquals(5968, result.size());
}
static class FileImpl extends BasicConnection implements FileConnection{
Modified: trunk/connectors/translator-xml/src/test/java/org/teiid/translator/xml/file/TestFileConnector.java
===================================================================
--- trunk/connectors/translator-xml/src/test/java/org/teiid/translator/xml/file/TestFileConnector.java 2010-05-20 01:13:35 UTC (rev 2146)
+++ trunk/connectors/translator-xml/src/test/java/org/teiid/translator/xml/file/TestFileConnector.java 2010-05-20 21:51:04 UTC (rev 2147)
@@ -1,6 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with 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.xml.file;
-
import java.util.List;
import javax.resource.ResourceException;
@@ -12,7 +33,6 @@
import org.teiid.resource.spi.BasicConnection;
import org.teiid.resource.spi.BasicConnectionFactory;
import org.teiid.translator.ExecutionContext;
-import org.teiid.translator.TranslatorException;
import org.teiid.translator.xml.XMLExecutionFactory;
import org.teiid.translator.xml.file.TestCachingFileConnectorLong.FileImpl;
@@ -37,11 +57,7 @@
ExecutionContext context = Mockito.mock(ExecutionContext.class);
host.setExecutionContext(context);
- try {
- List result = host.executeCommand("SELECT * FROM file_po_list.ITEM");
- assertEquals(2, result.size());
- } catch (TranslatorException e) {
- fail(e.getMessage());
- }
+ List result = host.executeCommand("SELECT * FROM file_po_list.ITEM");
+ assertEquals(2, result.size());
}
}
More information about the teiid-commits
mailing list