[teiid-commits] teiid SVN: r3797 - in branches/7.6.x: connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc and 3 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Tue Jan 17 14:31:41 EST 2012


Author: shawkins
Date: 2012-01-17 14:31:40 -0500 (Tue, 17 Jan 2012)
New Revision: 3797

Added:
   branches/7.6.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/excel/
   branches/7.6.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/excel/ExcelExecutionFactory.java
Modified:
   branches/7.6.x/build/kits/jboss-container/teiid-releasenotes.html
   branches/7.6.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java
   branches/7.6.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCMetdataProcessor.java
   branches/7.6.x/connectors/translator-jdbc/src/main/resources/META-INF/jboss-beans.xml
   branches/7.6.x/documentation/reference/src/main/docbook/en-US/content/translators.xml
Log:
TEIID-1895 providing more override hooks and adding an excel override for import that will enclose names in square brackets

Modified: branches/7.6.x/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- branches/7.6.x/build/kits/jboss-container/teiid-releasenotes.html	2012-01-17 16:31:33 UTC (rev 3796)
+++ branches/7.6.x/build/kits/jboss-container/teiid-releasenotes.html	2012-01-17 19:31:40 UTC (rev 3797)
@@ -45,7 +45,8 @@
   <LI><B>Non-blocking statement execution</B> - Teiid JDBC extensions TeiidStatement and TeiidPreparedStatement can be used to submit queries against embedded connections with a callback to process results in a non-blocking manner.
   <LI><B>NON_STRICT limit hint</B> - the NON_STRICT hint can be used with unordered limits to tell the optimizer to not inhibit push operations even if the results will not be consistent with the logical application of the limit.
   <LI><B>Source Hints</B> - user and transformation queries can specify a meta source hint, e.g. SELECT /*+ sh my-oracle:'leading' */ * FROM TBL. The hint information will be passed to the translator. The Oracle translator will by default treat the source hint as an Oracle hint.  See the Reference and Developers Guide for more.
-  <LI><B>Hive Translator</B> - Hive translator has been added as a technology preview.  
+  <LI><B>Hive Translator</B> - Hive translator has been added as a technology preview.
+  <LI><B>Excel JDBC Translator</B> - for use with Excel using the JDBC-ODBC bridge.    
 </UL>
 
 <h2><a name="Compatibility">Compatibility Issues</a></h2>

Modified: branches/7.6.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java
===================================================================
--- branches/7.6.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java	2012-01-17 16:31:33 UTC (rev 3796)
+++ branches/7.6.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java	2012-01-17 19:31:40 UTC (rev 3797)
@@ -273,12 +273,17 @@
 	@Override
 	public void getMetadata(MetadataFactory metadataFactory, Connection conn) throws TranslatorException {
 		try {
-			JDBCMetdataProcessor metadataProcessor = new JDBCMetdataProcessor();
+			JDBCMetdataProcessor metadataProcessor = createMetadataProcessor();
 			PropertiesUtils.setBeanProperties(metadataProcessor, metadataFactory.getImportProperties(), "importer"); //$NON-NLS-1$
 			metadataProcessor.getConnectorMetadata(conn, metadataFactory);
 		} catch (SQLException e) {
 			throw new TranslatorException(e);
 		}
+	}
+
+	protected JDBCMetdataProcessor createMetadataProcessor() {
+		JDBCMetdataProcessor metadataProcessor = new JDBCMetdataProcessor();
+		return metadataProcessor;
 	}    
 	
 	@Override

Modified: branches/7.6.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCMetdataProcessor.java
===================================================================
--- branches/7.6.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCMetdataProcessor.java	2012-01-17 16:31:33 UTC (rev 3796)
+++ branches/7.6.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCMetdataProcessor.java	2012-01-17 19:31:40 UTC (rev 3797)
@@ -293,7 +293,7 @@
 		return TypeFacility.getDataTypeNameFromSQLType(type);
 	}
 	
-	private String quoteName(String name) {
+	protected String quoteName(String name) {
 		if (quoteNameInSource) {
 			return quoteString + StringUtil.replaceAll(name, quoteString, quoteString + quoteString) + quoteString;
 		}

Added: branches/7.6.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/excel/ExcelExecutionFactory.java
===================================================================
--- branches/7.6.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/excel/ExcelExecutionFactory.java	                        (rev 0)
+++ branches/7.6.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/excel/ExcelExecutionFactory.java	2012-01-17 19:31:40 UTC (rev 3797)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.translator.jdbc.excel;
+
+import org.teiid.translator.Translator;
+import org.teiid.translator.jdbc.JDBCExecutionFactory;
+import org.teiid.translator.jdbc.JDBCMetdataProcessor;
+
+ at Translator(name="excel-odbc", description="A translator for Excel using the JDBC-ODBC bridge")
+public class ExcelExecutionFactory extends JDBCExecutionFactory {
+	
+	@Override
+	protected JDBCMetdataProcessor createMetadataProcessor() {
+		return new JDBCMetdataProcessor() {
+			@Override
+			protected String quoteName(String name) {
+				return '[' + name + ']';
+			}
+		};
+	}
+
+}


Property changes on: branches/7.6.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/excel/ExcelExecutionFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: branches/7.6.x/connectors/translator-jdbc/src/main/resources/META-INF/jboss-beans.xml
===================================================================
--- branches/7.6.x/connectors/translator-jdbc/src/main/resources/META-INF/jboss-beans.xml	2012-01-17 16:31:33 UTC (rev 3796)
+++ branches/7.6.x/connectors/translator-jdbc/src/main/resources/META-INF/jboss-beans.xml	2012-01-17 19:31:40 UTC (rev 3797)
@@ -351,5 +351,21 @@
             <parameter class="java.lang.String">translator-netezza</parameter>
             <parameter class="java.lang.String">Netezza</parameter>
         </constructor>
+    </bean>
+    
+    <!-- Excel -->
+    <bean name="translator-excel-template" class="org.teiid.templates.TranslatorDeploymentTemplate">
+        <property name="info"><inject bean="translator-excel" /> </property>
+        <property name="managedObjectFactory"> <inject bean="ManagedObjectFactory" /> </property>
+    </bean>
+
+    <bean name="translator-excel" class="org.teiid.templates.TranslatorTemplateInfo">
+        <constructor factoryMethod="createTemplateInfo">
+            <factory bean="TranslatorDeploymentTemplateInfoFactory" />
+            <parameter class="java.lang.Class">org.teiid.templates.TranslatorTemplateInfo</parameter>
+            <parameter class="java.lang.Class">org.teiid.translator.jdbc.excel.ExcelExecutionFactory</parameter>
+            <parameter class="java.lang.String">translator-excel</parameter>
+            <parameter class="java.lang.String">Excel</parameter>
+        </constructor>
     </bean> 
 </deployment>
\ No newline at end of file

Modified: branches/7.6.x/documentation/reference/src/main/docbook/en-US/content/translators.xml
===================================================================
--- branches/7.6.x/documentation/reference/src/main/docbook/en-US/content/translators.xml	2012-01-17 16:31:33 UTC (rev 3796)
+++ branches/7.6.x/documentation/reference/src/main/docbook/en-US/content/translators.xml	2012-01-17 19:31:40 UTC (rev 3797)
@@ -254,6 +254,11 @@
                 </listitem>
                 <listitem>
                     <para>
+                    <emphasis>excel-odbc</emphasis> - for use with Excel 2003 or later via a JDBC-ODBC bridge.
+                    </para>
+                </listitem>
+                <listitem>
+                    <para>
                     <emphasis>h2</emphasis> - for use with H2 version 1.1 or later.
                     </para>
                 </listitem>
@@ -294,7 +299,7 @@
                 </listitem>                
                 <listitem>
                     <para>
-                    <emphasis>informix</emphasis> - for use with any version.
+                    <emphasis>informix</emphasis> - for use with any Informix version.
                     </para>
                 </listitem>
                 <listitem>
@@ -326,6 +331,11 @@
                 </listitem>
                 <listitem>
                     <para>
+                    <emphasis>netezza</emphasis> - for use with any Netezza version.
+                    </para>
+                </listitem>
+                <listitem>
+                    <para>
                     <emphasis>oracle</emphasis> - for use with Oracle 9i or later.  
                     Sequences may be used with the Oracle translator. A sequence may be 
                     modeled as a table with a name in source of DUAL and columns with the 



More information about the teiid-commits mailing list