teiid SVN: r2002 - in trunk: adminshell/src/main/resources and 2 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-03-25 16:13:40 -0400 (Thu, 25 Mar 2010)
New Revision: 2002
Added:
trunk/adminshell/src/main/java/org/teiid/MigrationUtil.java
trunk/adminshell/src/main/resources/connector.xsl
trunk/adminshell/src/main/resources/vdb.xsl
trunk/build/kit-adminshell/migrate.bat
trunk/build/kit-adminshell/migrate.sh
Modified:
trunk/client/src/main/resources/vdb-deployer.xsd
Log:
TEIID-833 adding a migration tool to quickly modifiy older vdbs
Added: trunk/adminshell/src/main/java/org/teiid/MigrationUtil.java
===================================================================
--- trunk/adminshell/src/main/java/org/teiid/MigrationUtil.java (rev 0)
+++ trunk/adminshell/src/main/java/org/teiid/MigrationUtil.java 2010-03-25 20:13:40 UTC (rev 2002)
@@ -0,0 +1,200 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipOutputStream;
+
+import javax.xml.transform.Result;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.TransformerFactoryConfigurationError;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import com.metamatrix.common.util.ApplicationInfo;
+import com.metamatrix.core.util.FileUtils;
+import com.metamatrix.core.util.ObjectConverterUtil;
+
+@SuppressWarnings("nls")
+public class MigrationUtil {
+
+ //TODO: sys out info on what ds needs creating
+ public static void main(String[] args) throws IOException, TransformerConfigurationException, TransformerFactoryConfigurationError, TransformerException {
+ if (args.length != 1) {
+ System.err.println(
+ "Teiid 7.0 VDB Migration Utility" +
+ "\n\nUsage:" +
+ "\n A vdb or .def file must be specified as the only argument." +
+ "\n\nResult:"+
+ "\n 7.0 compatible replacement files will be created in the same directory " +
+ "\n as your file." +
+ "\n If you supply a vdb, the new vdb file will have a _70.vdb suffix." +
+ "\n If you supply a dynamic vdb file, then two new files will be created: " +
+ "\n <file name>-vdb.xml and <file name>-bindings.xml" +
+ "\n\nNote: this program will only create connector binding connection factories " +
+ "\n if the bindings are present in the specified file." +
+ "\n\nNote: this program will NOT create the -ds.xml files needed by JBoss to " +
+ "\n create underlying DataSource connection pools." +
+ "\n You will need to manually create one -ds.xml for each JDBC DataSource " +
+ "\n with a JNDI name of <connector binding name>DS, " +
+ "\n where any spaces in the name are replace by _");
+ System.exit(-1);
+ }
+ File file = new File(args[0]);
+ if (!file.exists()) {
+ System.err.println(args[0] + " does not exist."); //$NON-NLS-1$
+ System.exit(-1);
+ }
+ String fullName = file.getName();
+ String fileName = fullName.substring(0, fullName.length() - 4);
+ String ext = FileUtils.getExtension(file);
+ if (ext == null) {
+ System.err.println(fullName + " is not a vdb or xml file."); //$NON-NLS-1$
+ System.exit(-1);
+ }
+ ext = ext.toLowerCase();
+ if (ext.endsWith("vdb")) {
+ File dir = createTempDirectory();
+ try {
+ extract(file, dir);
+ File metainf = new File(dir, "META-INF");
+ File config = new File(dir, "ConfigurationInfo.def");
+ File manifest = new File(dir, "MetaMatrix-VdbManifestModel.xmi");
+ if (manifest.exists()) {
+ String configStr = ObjectConverterUtil.convertFileToString(config);
+ String manifestStr = ObjectConverterUtil.convertFileToString(manifest);
+ int index = configStr.lastIndexOf("</VDB>");
+ int manifestBegin = manifestStr.indexOf("<xmi");
+ configStr = configStr.substring(0, index) + manifestStr.substring(manifestBegin) + "</VDB>";
+ FileUtils.write(configStr.getBytes(), config);
+ manifest.delete();
+ }
+ transformConfig(config, "/vdb.xsl", new StreamResult(new File(metainf, "vdb.xml")));
+ transformConfig(config, "/connector.xsl", new StreamResult(new File(metainf, "bindings-ds.xml")));
+ config.delete();
+ FileOutputStream out = new FileOutputStream(new File(file.getParent(), fileName + "_70.vdb"));
+ ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(out));
+ int parentLength = dir.getPath().length();
+ addDirectory(dir, zos, parentLength);
+ zos.close();
+ } finally {
+ FileUtils.removeDirectoryAndChildren(dir);
+ }
+ } else if (ext.endsWith("xml") || ext.endsWith("def")){
+ File parent = file.getParentFile();
+ transformConfig(file, "/vdb.xsl", new StreamResult(new File(parent, fileName + "-vdb.xml")));
+ transformConfig(file, "/connector.xsl", new StreamResult(new File(parent, fileName + "-bindings-ds.xml")));
+ } else {
+ System.err.println(fullName + " is not a vdb or xml file. Run with no arguments for help."); //$NON-NLS-1$
+ System.exit(-1);
+ }
+ }
+
+ private static void addDirectory(File dir, ZipOutputStream zos,
+ int parentLength) throws IOException {
+ String[] files = dir.list();
+ for (String entry : files) {
+ File f = new File(dir, entry);
+ if (f.isDirectory()) {
+ addDirectory(f, zos, parentLength);
+ } else {
+ ZipEntry e = new ZipEntry(f.getPath().substring(parentLength));
+ zos.putNextEntry(e);
+ FileUtils.write(f, zos);
+ zos.closeEntry();
+ }
+ }
+ }
+
+ private static void transformConfig(File config, String styleSheet, Result target)
+ throws TransformerFactoryConfigurationError,
+ TransformerConfigurationException, TransformerException {
+ TransformerFactory tf = TransformerFactory.newInstance();
+ Transformer t = tf.newTransformer(new StreamSource(MigrationUtil.class.getResourceAsStream(styleSheet)));
+ t.setParameter("version", ApplicationInfo.getInstance().getReleaseNumber()); //$NON-NLS-1$
+ t.transform(new StreamSource(config), target);
+ }
+
+ /**
+ * Extract the given zip file to the given destination directory base.
+ *
+ * @param zipFileName
+ * The full path and file name of the Zip file to extract.
+ * @param destinationDirectory
+ * The root directory to extract to.
+ * @throws IOException
+ */
+ static void extract(final File sourceZipFile, File unzipDestinationDirectory) throws IOException {
+ // Open Zip file for reading
+ ZipFile zipFile = new ZipFile(sourceZipFile, ZipFile.OPEN_READ);
+
+ // Create an enumeration of the entries in the zip file
+ Enumeration zipFileEntries = zipFile.entries();
+
+ // Process each entry
+ while (zipFileEntries.hasMoreElements()) {
+ // grab a zip file entry
+ ZipEntry entry = (ZipEntry) zipFileEntries.nextElement();
+
+ String currentEntry = entry.getName();
+
+ File destFile = new File(unzipDestinationDirectory, currentEntry);
+
+ // grab file's parent directory structure
+ File destinationParent = destFile.getParentFile();
+
+ // create the parent directory structure if needed
+ destinationParent.mkdirs();
+
+ // extract file if not a directory
+ if (!entry.isDirectory()) {
+ ObjectConverterUtil.write(zipFile.getInputStream(entry),
+ destFile);
+ }
+ }
+ zipFile.close();
+ }
+
+ static File createTempDirectory() throws IOException {
+ File temp = File.createTempFile("temp", Long.toString(System.nanoTime()));
+
+ temp.delete();
+
+ if (!(temp.mkdir())) {
+ throw new IOException("Could not create temp directory: "
+ + temp.getAbsolutePath());
+ }
+
+ return temp;
+ }
+
+}
Property changes on: trunk/adminshell/src/main/java/org/teiid/MigrationUtil.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/adminshell/src/main/resources/connector.xsl
===================================================================
--- trunk/adminshell/src/main/resources/connector.xsl (rev 0)
+++ trunk/adminshell/src/main/resources/connector.xsl 2010-03-25 20:13:40 UTC (rev 2002)
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:param name="version">7.0</xsl:param>
+ <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
+ <xsl:strip-space elements="*"/>
+ <xsl:template match="Header"/>
+ <xsl:template match="VDB/ConnectorBindings/Connector">
+ <no-tx-connection-factory>
+ <jndi-name><xsl:value-of select="translate(@Name, ' ', '_')" /></jndi-name>
+ <xsl:choose>
+ <xsl:when test="@ComponentType='Text File Connector'">
+ <rar-name>connector-text-<xsl:value-of select="$version"/>.rar</rar-name>
+ </xsl:when>
+ <xsl:when test="starts-with(@ComponentType,'Apache ') or starts-with(@ComponentType,'MySQL ')
+ or starts-with(@ComponentType,'Oracle ') or starts-with(@ComponentType,'PostgreSQL ')
+ or starts-with(@ComponentType,'SQL Server ') or starts-with(@ComponentType,'DB2 ')
+ or starts-with(@ComponentType,'MS Access ') or starts-with(@ComponentType,'MS Excel ')
+ or starts-with(@ComponentType,'JDBC ') or starts-with(@ComponentType,'Teiid ')
+ or starts-with(@ComponentType,'MM ') or starts-with(@ComponentType,'H2 ')
+ or starts-with(@ComponentType,'HSQLDB ') or starts-with(@ComponentType,'Sybase ')
+ ">
+ <rar-name>connector-jdbc-<xsl:value-of select="$version"/>.rar</rar-name>
+ </xsl:when>
+ <xsl:when test="@ComponentType='LDAP Connector'">
+ <rar-name>connector-ldap-<xsl:value-of select="$version"/>.rar</rar-name>
+ </xsl:when>
+ <xsl:when test="@ComponentType='Loopback Connector'">
+ <rar-name>connector-loopback-<xsl:value-of select="$version"/>.rar</rar-name>
+ </xsl:when>
+ <xsl:when test="@ComponentType='Salesforce Connector'">
+ <rar-name>connector-salesforce-<xsl:value-of select="$version"/>.rar</rar-name>
+ </xsl:when>
+ <xsl:when test="@ComponentType='XML File Connector' or @ComponentType='XML-Relational File Connector'">
+ <rar-name>connector-xml-file-<xsl:value-of select="$version"/>.rar</rar-name>
+ </xsl:when>
+ <xsl:when test="@ComponentType='XML SOAP Connector' or @ComponentType='XML-Relational Soap Connector'">
+ <rar-name>connector-xml-soap-<xsl:value-of select="$version"/>.rar</rar-name>
+ </xsl:when>
+ <xsl:when test="@ComponentType='XML-Relational HTTP Connector'">
+ <rar-name>connector-xml-http-<xsl:value-of select="$version"/>.rar</rar-name>
+ </xsl:when>
+ </xsl:choose>
+ <connection-definition>org.teiid.connector.api.Connector</connection-definition>
+ <xsl:for-each select="Properties/Property">
+ <xsl:choose>
+ <xsl:when test="@Name='ConnectorMaxConnections' or @Name='UsePostDelegation'
+ or @Name='ConnectorThreadTTL' or @Name='DeployedName'
+ or @Name='ConnectorMaxThreads'
+ or @Name='ConnectorClassPath' or @Name='SourceConnectionTestInterval'
+ or @Name='metamatrix.service.essentialservice' or @Name='ServiceMonitoringEnabled'
+ or @Name='ConnectorClass' or @Name='ServiceClassName'
+ or @Name='SynchWorkers' or @Name='UseCredentialMap'
+ or @Name='ConnectionPoolEnabled' or @Name='AdminConnectionsAllowed'
+ or @Name='com.metamatrix.data.pool.max_connections_for_each_id' or @Name='com.metamatrix.data.pool.live_and_unused_time'
+ or @Name='com.metamatrix.data.pool.wait_for_source_time' or @Name='com.metamatrix.data.pool.cleaning_interval'
+ or @Name='com.metamatrix.data.pool.enable_shrinking' or starts-with(@Name, 'getMax')
+ or starts-with(@Name, 'supports') or starts-with(@Name, 'getSupported')
+ or @Name='requiresCriteria' or @Name='useAnsiJoin'
+ or @Name='URL' or @Name='ConnectionSource'
+ or @Name='User' or @Name='Password'"/>
+ <xsl:when test="@Name='MaxResultRows' and text()='0'">
+ <config-property>
+ <xsl:attribute name="name">
+ <xsl:value-of select="@Name"/>
+ </xsl:attribute>-1</config-property>
+ </xsl:when>
+ <xsl:otherwise>
+ <config-property>
+ <xsl:attribute name="name">
+ <xsl:value-of select="@Name"/>
+ </xsl:attribute>
+ <xsl:value-of select="text()"/>
+ </config-property>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ <xsl:if test="starts-with(@ComponentType,'Apache ') or starts-with(@ComponentType,'MySQL ')
+ or starts-with(@ComponentType,'Oracle ') or starts-with(@ComponentType,'PostgreSQL ')
+ or starts-with(@ComponentType,'SQL Server ') or starts-with(@ComponentType,'DB2 ')
+ or starts-with(@ComponentType,'MS Access ') or starts-with(@ComponentType,'MS Excel ')
+ or starts-with(@ComponentType,'JDBC ') or starts-with(@ComponentType,'Teiid ')
+ or starts-with(@ComponentType,'MM ') or starts-with(@ComponentType,'H2 ')
+ or starts-with(@ComponentType,'HSQLDB ') or starts-with(@ComponentType,'Sybase ')
+ ">
+ <config-property name="SourceJNDIName">java:<xsl:value-of select="translate(@Name, ' ', '_')" />DS</config-property>
+ <xsl:choose>
+ <xsl:when test="starts-with(@ComponentType,'Apache ')">
+ <config-property name="ExtensionTranslationClassName">org.teiid.connector.jdbc.derby.DerbySQLTranslator</config-property>
+ </xsl:when>
+ <xsl:when test="starts-with(@ComponentType,'MySQL 5 ')">
+ <config-property name="ExtensionTranslationClassName">org.teiid.connector.jdbc.mysql.MySQL5Translator</config-property>
+ </xsl:when>
+ <xsl:when test="starts-with(@ComponentType,'MySQL JDBC')">
+ <config-property name="ExtensionTranslationClassName">org.teiid.connector.jdbc.mysql.MySQLTranslator</config-property>
+ </xsl:when>
+ <xsl:when test="starts-with(@ComponentType,'Oracle')">
+ <config-property name="ExtensionTranslationClassName">org.teiid.connector.jdbc.oracle.OracleSQLTranslator</config-property>
+ </xsl:when>
+ <xsl:when test="starts-with(@ComponentType,'PostgreSQL')">
+ <config-property name="ExtensionTranslationClassName">org.teiid.connector.jdbc.postgresql.PostgreSQLTranslator</config-property>
+ </xsl:when>
+ <xsl:when test="starts-with(@ComponentType,'SQL Server')">
+ <config-property name="ExtensionTranslationClassName">org.teiid.connector.jdbc.sqlserver.SQLServerSQLTranslator</config-property>
+ </xsl:when>
+ <xsl:when test="starts-with(@ComponentType,'DB2')">
+ <config-property name="ExtensionTranslationClassName">org.teiid.connector.jdbc.sqlserver.DB2SQLTranslator</config-property>
+ </xsl:when>
+ <xsl:when test="starts-with(@ComponentType,'H2')">
+ <config-property name="ExtensionTranslationClassName">org.teiid.connector.jdbc.h2.H2Translator</config-property>
+ </xsl:when>
+ <xsl:when test="starts-with(@ComponentType,'HSQLDQ')">
+ <config-property name="ExtensionTranslationClassName">org.teiid.connector.jdbc.hsql.HSSQLTranslator</config-property>
+ </xsl:when>
+ <xsl:when test="starts-with(@ComponentType,'Sybase')">
+ <config-property name="ExtensionTranslationClassName">org.teiid.connector.jdbc.sybase.SybaseSQLTranslator</config-property>
+ </xsl:when>
+ <xsl:otherwise>
+ <config-property name="ExtensionTranslationClassName">org.teiid.connector.jdbc.translator.Translator</config-property>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ <xsl:if test="contains(@ComponentType,'XA')">
+ <config-property name="IsXA">true</config-property>
+ </xsl:if>
+ <xsl:if test="Properties/Property[@Name='ConnectorMaxConnections']">
+ <max-pool-size><xsl:value-of select="Properties/Property[@Name='ConnectorMaxConnections']/text()"/></max-pool-size>
+ </xsl:if>
+ </no-tx-connection-factory>
+ </xsl:template>
+</xsl:stylesheet>
Property changes on: trunk/adminshell/src/main/resources/connector.xsl
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/adminshell/src/main/resources/vdb.xsl
===================================================================
--- trunk/adminshell/src/main/resources/vdb.xsl (rev 0)
+++ trunk/adminshell/src/main/resources/vdb.xsl 2010-03-25 20:13:40 UTC (rev 2002)
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:output method="xml" indent="yes" />
+ <xsl:strip-space elements="*" />
+ <xsl:template match="VDB">
+ <vdb>
+ <xsl:attribute name="name"><xsl:value-of select="VDBInfo/Property[@Name='Name']/@Value" /></xsl:attribute>
+ <xsl:attribute name="version"><xsl:value-of select="VDBInfo/Property[@Name='Version']/@Value" /></xsl:attribute>
+ <xsl:if test="VDBInfo/Property[@Name='Description']">
+ <description><xsl:value-of select="VDBInfo/Property[@Name='Description']/@Value" /></description>
+ </xsl:if>
+ <xsl:for-each select="VDBInfo/Property">
+ <xsl:if
+ test="@Name!='Name' and @Name!='Version' and @Name!='Description' and @Name!='GUID' and @Name!='VDBArchiveName'">
+ <property>
+ <xsl:attribute name="name"><xsl:value-of select="@Name" /></xsl:attribute>
+ <xsl:attribute name="value"><xsl:value-of select="@Value" /></xsl:attribute>
+ </property>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:for-each select="Model">
+ <model>
+ <xsl:attribute name="name"><xsl:value-of select="Property[@Name='Name']/@Value" /></xsl:attribute>
+ <xsl:if test="Property[@Name='Visibility' and @Value='Private']">
+ <xsl:attribute name="visible">false</xsl:attribute>
+ </xsl:if>
+ <xsl:variable name="name" select="Property[@Name='Name']/@Value" />
+ <xsl:if test="//models[starts-with(@name, concat($name, '.'))]">
+ <xsl:attribute name="type"><xsl:value-of
+ select="//models[starts-with(@name, concat($name, '.'))]/@modelType" /></xsl:attribute>
+ </xsl:if>
+ <xsl:for-each select="Property">
+ <xsl:if test="@Name!='Name' and @Name!='Visibility'">
+ <property>
+ <xsl:attribute name="name"><xsl:value-of select="@Name" /></xsl:attribute>
+ <xsl:attribute name="value"><xsl:value-of select="@Value" /></xsl:attribute>
+ </property>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:for-each select="ConnectorBindings/Connector">
+ <source>
+ <xsl:attribute name="name"><xsl:value-of select="@Name" /></xsl:attribute>
+ <xsl:attribute name="jndi-name"><xsl:value-of select="concat('java:',translate(@Name, ' ', '_'))" /></xsl:attribute>
+ </source>
+ </xsl:for-each>
+ </model>
+ </xsl:for-each>
+ </vdb>
+ </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file
Property changes on: trunk/adminshell/src/main/resources/vdb.xsl
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/build/kit-adminshell/migrate.bat
===================================================================
--- trunk/build/kit-adminshell/migrate.bat (rev 0)
+++ trunk/build/kit-adminshell/migrate.bat 2010-03-25 20:13:40 UTC (rev 2002)
@@ -0,0 +1,64 @@
+@ECHO OFF
+@setlocal
+
+@REM JBoss, Home of Professional Open Source.
+@REM Copyright (C) 2008 Red Hat, Inc.
+@REM Licensed to Red Hat, Inc. under one or more contributor
+@REM license agreements. See the copyright.txt file in the
+@REM distribution for a full listing of individual contributors.
+@REM
+@REM This library is free software; you can redistribute it and/or
+@REM modify it under the terms of the GNU Lesser General Public
+@REM License as published by the Free Software Foundation; either
+@REM version 2.1 of the License, or (at your option) any later version.
+@REM
+@REM This library is distributed in the hope that it will be useful,
+@REM but WITHOUT ANY WARRANTY; without even the implied warranty of
+@REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+@REM Lesser General Public License for more details.
+@REM
+@REM You should have received a copy of the GNU Lesser General Public
+@REM License along with this library; if not, write to the Free Software
+@REM Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+@REM 02110-1301 USA.
+
+@REM This assumes it's run from its installation directory. It is also assumed there is a java
+@REM executable defined along the PATH
+
+@if not "%ECHO%" == "" echo %ECHO%
+@if "%OS%" == "Windows_NT" setlocal
+
+if "%OS%" == "Windows_NT" (
+ set "DIRNAME=%~dp0%"
+) else (
+ set DIRNAME=.\
+)
+
+pushd %DIRNAME%
+if "x%TEIID_HOME%" == "x" (
+ set "TEIID_HOME=%CD%"
+)
+popd
+
+set DIRNAME=
+
+if "x%JAVA_HOME%" == "x" (
+ set JAVA=java
+ echo JAVA_HOME is not set. Unexpected results may occur.
+ echo Set JAVA_HOME to the directory of your local JDK to avoid this message.
+) else (
+ set "JAVA=%JAVA_HOME%\bin\java"
+ if exist "%JAVA_HOME%\lib\tools.jar" (
+ set "JAVAC_JAR=%JAVA_HOME%\lib\tools.jar"
+ )
+)
+
+set TEIID_CLASSPATH=%TEIID_HOME%\lib\patches\*;%TEIID_HOME%\lib\*;
+
+rem JVM memory allocation pool parameters. Modify as appropriate.
+set JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx256m -XX:MaxPermSize=256m
+set JAVA_OPTS=%JAVA_OPTS% -Djava.util.logging.config.file=log.properties
+
+"%JAVA%" %JAVA_OPTS% ^
+ -classpath "%TEIID_CLASSPATH%" ^
+ org.teiid.MigrationUtil %*
Property changes on: trunk/build/kit-adminshell/migrate.bat
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/build/kit-adminshell/migrate.sh
===================================================================
--- trunk/build/kit-adminshell/migrate.sh (rev 0)
+++ trunk/build/kit-adminshell/migrate.sh 2010-03-25 20:13:40 UTC (rev 2002)
@@ -0,0 +1,70 @@
+#!/bin/sh
+#
+# JBoss, Home of Professional Open Source.
+# Copyright (C) 2008 Red Hat, Inc.
+# Licensed to Red Hat, Inc. under one or more contributor
+# license agreements. See the copyright.txt file in the
+# distribution for a full listing of individual contributors.
+#
+# 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.
+
+DIRNAME=`dirname $0`
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false;
+linux=false;
+case "`uname`" in
+ CYGWIN*)
+ cygwin=true
+ ;;
+
+ Linux)
+ linux=true
+ ;;
+esac
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin ; then
+ [ -n "$TEIID_HOME" ] &&
+ TEIID_HOME=`cygpath --unix "$TEIID_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+# Setup TEIID_HOME
+if [ "x$TEIID_HOME" = "x" ]; then
+ # get the full path (without any relative bits)
+ TEIID_HOME=`cd $DIRNAME; pwd`
+fi
+export TEIID_HOME
+
+# Setup the JVM
+if [ "x$JAVA" = "x" ]; then
+ if [ "x$JAVA_HOME" != "x" ]; then
+ JAVA="$JAVA_HOME/bin/java"
+ else
+ JAVA="java"
+ fi
+fi
+
+# JPDA options. Uncomment and modify as appropriate to enable remote debugging.
+# JAVA_OPTS="$JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
+
+TEIID_CLASSPATH="$TEIID_HOME/lib/patches/*:$TEIID_HOME/lib/*"
+JAVA_OPTS="$JAVA_OPTS -Xms128m -Xmx256m -XX:MaxPermSize=256m"
+JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.config.file=log.properties"
+
+$JAVA $JAVA_OPTS -cp $TEIID_CLASSPATH -Xmx256m org.teiid.MigrationUtil $*
\ No newline at end of file
Property changes on: trunk/build/kit-adminshell/migrate.sh
___________________________________________________________________
Name: svn:executable
+ *
Modified: trunk/client/src/main/resources/vdb-deployer.xsd
===================================================================
--- trunk/client/src/main/resources/vdb-deployer.xsd 2010-03-25 16:55:55 UTC (rev 2001)
+++ trunk/client/src/main/resources/vdb-deployer.xsd 2010-03-25 20:13:40 UTC (rev 2002)
@@ -42,6 +42,10 @@
<xs:enumeration value="PHYSICAL"/>
<xs:enumeration value="VIRTUAL"/>
<xs:enumeration value="FUNCTION"/>
+ <xs:enumeration value="TYPE"/>
+ <xs:enumeration value="EXTENSION"/>
+ <xs:enumeration value="LOGICAL"/>
+ <xs:enumeration value="MATERIALIZATION"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
14 years, 9 months
teiid SVN: r2001 - in trunk: client/src/test/java/org/teiid/jdbc and 34 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-03-25 12:55:55 -0400 (Thu, 25 Mar 2010)
New Revision: 2001
Added:
trunk/common-core/src/main/java/com/metamatrix/common/types/JDBCSQLTypeInfo.java
Removed:
trunk/common-core/src/main/java/com/metamatrix/common/types/MMJDBCSQLTypeInfo.java
trunk/test-integration/db/src/main/java/org/teiid/jdbc/
Modified:
trunk/client/src/main/java/org/teiid/jdbc/CallableStatementImpl.java
trunk/client/src/main/java/org/teiid/jdbc/DataTypeTransformer.java
trunk/client/src/main/java/org/teiid/jdbc/DatabaseMetaDataImpl.java
trunk/client/src/main/java/org/teiid/jdbc/ParameterMetaDataImpl.java
trunk/client/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java
trunk/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java
trunk/client/src/main/java/org/teiid/jdbc/ResultSetMetaDataImpl.java
trunk/client/src/test/java/org/teiid/jdbc/TestAllResultsImpl.java
trunk/client/src/test/java/org/teiid/jdbc/TestMMCallableStatement.java
trunk/common-core/src/main/java/com/metamatrix/common/types/ClobType.java
trunk/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java
trunk/common-core/src/main/java/com/metamatrix/common/types/StandardXMLTranslator.java
trunk/common-core/src/test/java/com/metamatrix/common/types/TestDataTypeManager.java
trunk/common-core/src/test/java/com/metamatrix/common/types/TestXMLStreamSourceTranslator.java
trunk/connector-api/src/main/java/org/teiid/connector/api/TypeFacility.java
trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xmlsource/file/FileProcedureExecution.java
trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xmlsource/file/TestFileExecution.java
trunk/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferManagerImpl.java
trunk/engine/src/main/java/com/metamatrix/common/log/LogConstants.java
trunk/engine/src/main/java/com/metamatrix/query/analysis/AnalysisRecord.java
trunk/engine/src/main/java/com/metamatrix/query/analysis/QueryAnnotation.java
trunk/engine/src/main/java/com/metamatrix/query/optimizer/QueryOptimizer.java
trunk/engine/src/main/java/com/metamatrix/query/optimizer/proc/ProcedurePlanner.java
trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/RelationalPlanner.java
trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleChooseDependent.java
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/validator/AuthorizationValidationVisitor.java
trunk/engine/src/test/java/com/metamatrix/query/analysis/TestAnalysisRecord.java
trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestOptimizer.java
trunk/engine/src/test/java/com/metamatrix/query/optimizer/batch/TestBatchedUpdatePlanner.java
trunk/engine/src/test/java/com/metamatrix/query/optimizer/proc/TestProcedurePlanner.java
trunk/engine/src/test/java/com/metamatrix/query/optimizer/relational/TestMaterialization.java
trunk/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestRuleAccessPatternValidation.java
trunk/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestRuleChooseDependent.java
trunk/engine/src/test/java/com/metamatrix/query/optimizer/xml/TestXMLPlanner.java
trunk/engine/src/test/java/com/metamatrix/query/processor/TestProcessor.java
trunk/engine/src/test/java/com/metamatrix/query/processor/dynamic/TestSqlEval.java
trunk/engine/src/test/java/com/metamatrix/query/processor/proc/TestProcedureProcessor.java
trunk/engine/src/test/java/com/metamatrix/query/processor/xml/TestXMLProcessor.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedPlanCache.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
trunk/runtime/src/main/java/org/teiid/logging/Log4JUtil.java
trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
trunk/runtime/src/main/java/org/teiid/services/TeiidLoginContext.java
trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/BaseQueryTest.java
Log:
TEIID-1026 correcting some logging logic and making expanded use of of the analysisrecord
Modified: trunk/client/src/main/java/org/teiid/jdbc/CallableStatementImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/CallableStatementImpl.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/client/src/main/java/org/teiid/jdbc/CallableStatementImpl.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -111,14 +111,6 @@
super.close();
}
- /**
- * <p>Gets the value of a OUTPUT parameter as a java.math.BigDecimal object with
- * scale digits to the right of the decimal point.
- * @param parameterIndex whose value is to be fetched from the result.
- * @return The parameter at the given index is returned as an BigDecimal object.
- * @throws SQLException if param datatype is not NUMERIC
- * @deprecated
- */
public java.math.BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException {
BigDecimal bigDecimalParam = DataTypeTransformer.getBigDecimal(getObject(parameterIndex));
@@ -428,7 +420,7 @@
}
public byte[] getBytes(int parameterIndex) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
+ return DataTypeTransformer.getBytes(getObject(parameterIndex));
}
public byte[] getBytes(String parameterName) throws SQLException {
@@ -436,7 +428,7 @@
}
public Reader getCharacterStream(int parameterIndex) throws SQLException {
- throw SqlUtil.createFeatureNotSupportedException();
+ return DataTypeTransformer.getCharacterStream(getObject(parameterIndex));
}
public Reader getCharacterStream(String parameterName) throws SQLException {
Modified: trunk/client/src/main/java/org/teiid/jdbc/DataTypeTransformer.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/DataTypeTransformer.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/client/src/main/java/org/teiid/jdbc/DataTypeTransformer.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -22,6 +22,8 @@
package org.teiid.jdbc;
+import java.io.Reader;
+import java.io.StringReader;
import java.math.BigDecimal;
import java.sql.Blob;
import java.sql.Clob;
@@ -267,4 +269,20 @@
static final SQLXML getSQLXML(Object value) throws SQLException {
return transform(value, SQLXML.class, DefaultDataClasses.XML, "SQLXML"); //$NON-NLS-1$
}
+
+ static final Reader getCharacterStream(Object value) throws SQLException {
+ if (value == null) {
+ return null;
+ }
+
+ if (value instanceof Clob) {
+ return ((Clob) value).getCharacterStream();
+ }
+
+ if (value instanceof SQLXML) {
+ return ((SQLXML)value).getCharacterStream();
+ }
+
+ return new StringReader(getString(value));
+ }
}
\ No newline at end of file
Modified: trunk/client/src/main/java/org/teiid/jdbc/DatabaseMetaDataImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/DatabaseMetaDataImpl.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/client/src/main/java/org/teiid/jdbc/DatabaseMetaDataImpl.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -42,7 +42,7 @@
import org.teiid.client.metadata.ResultsMetadataDefaults;
import com.metamatrix.common.types.DataTypeManager;
-import com.metamatrix.common.types.MMJDBCSQLTypeInfo;
+import com.metamatrix.common.types.JDBCSQLTypeInfo;
import com.metamatrix.common.util.SqlUtil;
import com.metamatrix.core.CoreConstants;
import com.metamatrix.core.MetaMatrixRuntimeException;
@@ -120,7 +120,7 @@
private static final String PRECISION_MAPPING;
static {
- String[] internalTypes = MMJDBCSQLTypeInfo.getMMTypeNames();
+ String[] internalTypes = JDBCSQLTypeInfo.getMMTypeNames();
StringBuffer typeMapping = new StringBuffer();
StringBuffer precisionMapping = new StringBuffer();
for (int i = 0; i < internalTypes.length; i++) {
@@ -128,7 +128,7 @@
typeMapping.append(","); //$NON-NLS-1$
precisionMapping.append(","); //$NON-NLS-1$
}
- typeMapping.append(internalTypes[i]).append(",").append(MMJDBCSQLTypeInfo.getSQLType(internalTypes[i])); //$NON-NLS-1$
+ typeMapping.append(internalTypes[i]).append(",").append(JDBCSQLTypeInfo.getSQLType(internalTypes[i])); //$NON-NLS-1$
precisionMapping.append(internalTypes[i]).append(",").append(ResultsMetadataDefaults.getDefaultPrecision(internalTypes[i])); //$NON-NLS-1$
}
TYPE_MAPPING = typeMapping.toString();
@@ -394,35 +394,35 @@
// HardCoding metadata details for SCOPE column
metadataList[0] = getColumnMetadata(null, JDBCColumnNames.BEST_ROW.SCOPE,
- MMJDBCSQLTypeInfo.SHORT, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
+ JDBCSQLTypeInfo.SHORT, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
// HardCoding metadata details for COLUMN_NAME column
metadataList[1] = getColumnMetadata(null, JDBCColumnNames.BEST_ROW.COLUMN_NAME,
- MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
+ JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
// HardCoding metadata details for DATA_TYPE column
metadataList[2] = getColumnMetadata(null, JDBCColumnNames.BEST_ROW.DATA_TYPE,
- MMJDBCSQLTypeInfo.SHORT, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
+ JDBCSQLTypeInfo.SHORT, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
// HardCoding metadata details for TYPE_NAME column
metadataList[3] = getColumnMetadata(null, JDBCColumnNames.BEST_ROW.TYPE_NAME,
- MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
+ JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
// HardCoding metadata details for COLUMN_SIZE column
metadataList[4] = getColumnMetadata(null, JDBCColumnNames.BEST_ROW.COLUMN_SIZE,
- MMJDBCSQLTypeInfo.INTEGER, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
+ JDBCSQLTypeInfo.INTEGER, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
// HardCoding metadata details for BUFFER_LENGTH column
metadataList[5] = getColumnMetadata(null, JDBCColumnNames.BEST_ROW.BUFFER_LENGTH,
- MMJDBCSQLTypeInfo.INTEGER, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
+ JDBCSQLTypeInfo.INTEGER, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
// HardCoding metadata details for DECIMAL_DIGITS column
metadataList[6] = getColumnMetadata(null, JDBCColumnNames.BEST_ROW.DECIMAL_DIGITS,
- MMJDBCSQLTypeInfo.SHORT, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
+ JDBCSQLTypeInfo.SHORT, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
// HardCoding metadata details for PSEUDO_COLUMN column
metadataList[7] = getColumnMetadata(null, JDBCColumnNames.BEST_ROW.PSEUDO_COLUMN,
- MMJDBCSQLTypeInfo.SHORT, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
+ JDBCSQLTypeInfo.SHORT, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
// logging
String logMsg = JDBCPlugin.Util.getString("MMDatabaseMetadata.Best_row_sucess", table); //$NON-NLS-1$
@@ -443,7 +443,7 @@
// HardCoding metadata details for TABLE_CAT column
metadataList[0] = getColumnMetadata(null, JDBCColumnNames.CATALOGS.TABLE_CAT,
- MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
+ JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
// logging
String logMsg = JDBCPlugin.Util.getString("MMDatabaseMetadata.Catalog_success"); //$NON-NLS-1$
@@ -526,21 +526,21 @@
Map[] metadataList = new Map[8];
metadataList[0] = getColumnMetadata(null, JDBCColumnNames.PRIVILEGES.TABLE_CAT,
- MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
+ JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
metadataList[1] = getColumnMetadata(null, JDBCColumnNames.PRIVILEGES.TABLE_SCHEM,
- MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
+ JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
metadataList[2] = getColumnMetadata(null, JDBCColumnNames.PRIVILEGES.TABLE_NAME,
- MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
+ JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
metadataList[3] = getColumnMetadata(null, JDBCColumnNames.PRIVILEGES.COLUMN_NAME,
- MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
+ JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
metadataList[4] = getColumnMetadata(null, JDBCColumnNames.PRIVILEGES.GRANTOR,
- MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
+ JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
metadataList[5] = getColumnMetadata(null, JDBCColumnNames.PRIVILEGES.GRANTEE,
- MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
+ JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
metadataList[6] = getColumnMetadata(null, JDBCColumnNames.PRIVILEGES.PRIVILEGE,
- MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
+ JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
metadataList[7] = getColumnMetadata(null, JDBCColumnNames.PRIVILEGES.IS_GRANTABLE,
- MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
+ JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
return createResultSet(records, metadataList);
@@ -1364,19 +1364,19 @@
// HardCoding metadata details for TABLE_CAT column
metadataList[0] = getColumnMetadata(null, JDBCColumnNames.SUPER_TABLES.TABLE_CAT,
- MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
+ JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
// HardCoding metadata details for TABLE_SCHEM column
metadataList[1] = getColumnMetadata(null, JDBCColumnNames.SUPER_TABLES.TABLE_SCHEM,
- MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
+ JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
// HardCoding metadata details for TABLE_NAME column
metadataList[2] = getColumnMetadata(null, JDBCColumnNames.SUPER_TABLES.TABLE_NAME,
- MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
+ JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
// HardCoding metadata details for SUPERTABLE_NAME column
metadataList[3] = getColumnMetadata(null, JDBCColumnNames.SUPER_TABLES.SUPERTABLE_NAME,
- MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
+ JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
// construct results object from column values and their metadata
return createResultSet(records, metadataList);
@@ -1402,27 +1402,27 @@
// HardCoding metadata details for TYPE_CAT column
metadataList[0] = getColumnMetadata(null, JDBCColumnNames.SUPER_TYPES.TYPE_CAT,
- MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
+ JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
// HardCoding metadata details for TYPE_SCHEM column
metadataList[1] = getColumnMetadata(null, JDBCColumnNames.SUPER_TYPES.TYPE_SCHEM,
- MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
+ JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
// HardCoding metadata details for TYPE_NAME column
metadataList[2] = getColumnMetadata(null, JDBCColumnNames.SUPER_TYPES.TYPE_NAME,
- MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
+ JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
// HardCoding metadata details for SUPERTYPE_CAT column
metadataList[3] = getColumnMetadata(null, JDBCColumnNames.SUPER_TYPES.SUPERTYPE_CAT,
- MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
+ JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
// HardCoding metadata details for SUPERTYPE_SCHEM column
metadataList[4] = getColumnMetadata(null, JDBCColumnNames.SUPER_TYPES.SUPERTYPE_SCHEM,
- MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
+ JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
// HardCoding metadata details for SUPERTYPE_NAME column
metadataList[5] = getColumnMetadata(null, JDBCColumnNames.SUPER_TYPES.SUPERTYPE_NAME,
- MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
+ JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
// construct results object from column values and their metadata
return createResultSet(records, metadataList);
@@ -1440,19 +1440,19 @@
Map[] metadataList = new Map[7];
metadataList[0] = getColumnMetadata(null, JDBCColumnNames.PRIVILEGES.TABLE_CAT,
- MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
+ JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
metadataList[1] = getColumnMetadata(null, JDBCColumnNames.PRIVILEGES.TABLE_SCHEM,
- MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
+ JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
metadataList[2] = getColumnMetadata(null, JDBCColumnNames.PRIVILEGES.TABLE_NAME,
- MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
+ JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
metadataList[3] = getColumnMetadata(null, JDBCColumnNames.PRIVILEGES.GRANTOR,
- MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
+ JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
metadataList[4] = getColumnMetadata(null, JDBCColumnNames.PRIVILEGES.GRANTEE,
- MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
+ JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
metadataList[5] = getColumnMetadata(null, JDBCColumnNames.PRIVILEGES.PRIVILEGE,
- MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
+ JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
metadataList[6] = getColumnMetadata(null, JDBCColumnNames.PRIVILEGES.IS_GRANTABLE,
- MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
+ JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE);
return createResultSet(records, metadataList);
@@ -1576,7 +1576,7 @@
Map[] metadataList = new Map[1];
metadataList[0] = getColumnMetadata(null, JDBCColumnNames.TABLE_TYPES.TABLE_TYPE,
- MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
+ JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NOT_NULL);
logger.fine(JDBCPlugin.Util.getString("MMDatabaseMetadata.getTableType_success")); //$NON-NLS-1$
@@ -1614,24 +1614,24 @@
Map[] metadataList = new Map[18];
- metadataList[0] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.TYPE_NAME, MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NOT_NULL, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE);//$NON-NLS-1$
- metadataList[1] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.DATA_TYPE, MMJDBCSQLTypeInfo.INTEGER, ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$
- metadataList[2] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.PRECISION, MMJDBCSQLTypeInfo.INTEGER, ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$
- metadataList[3] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.LITERAL_PREFIX, MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$
- metadataList[4] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.LITERAL_SUFFIX, MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$
- metadataList[5] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.CREATE_PARAMS, MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$
- metadataList[6] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.NULLABLE, MMJDBCSQLTypeInfo.SHORT, ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$
- metadataList[7] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.CASE_SENSITIVE, MMJDBCSQLTypeInfo.BOOLEAN, ResultsMetadataConstants.NULL_TYPES.NOT_NULL, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.FALSE, Boolean.FALSE, Boolean.TRUE);//$NON-NLS-1$
- metadataList[8] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.SEARCHABLE, MMJDBCSQLTypeInfo.SHORT, ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$
- metadataList[9] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.UNSIGNED_ATTRIBUTE, MMJDBCSQLTypeInfo.BOOLEAN, ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$
- metadataList[10] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.FIXED_PREC_SCALE, MMJDBCSQLTypeInfo.BOOLEAN, ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$
- metadataList[11] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.AUTOINCREMENT, MMJDBCSQLTypeInfo.BOOLEAN, ResultsMetadataConstants.NULL_TYPES.NOT_NULL, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.FALSE, Boolean.TRUE, Boolean.TRUE);//$NON-NLS-1$
- metadataList[12] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.LOCAL_TYPE_NAME, MMJDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NOT_NULL, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE);//$NON-NLS-1$
- metadataList[13] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.MINIMUM_SCALE, MMJDBCSQLTypeInfo.SHORT, ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$
- metadataList[14] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.MAXIMUM_SCALE, MMJDBCSQLTypeInfo.SHORT, ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$
- metadataList[15] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.SQL_DATA_TYPE, MMJDBCSQLTypeInfo.INTEGER, ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$
- metadataList[16] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.SQL_DATETIME_SUB, MMJDBCSQLTypeInfo.INTEGER, ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$
- metadataList[17] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.NUM_PREC_RADIX, MMJDBCSQLTypeInfo.INTEGER, ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE);//$NON-NLS-1$
+ metadataList[0] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.TYPE_NAME, JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NOT_NULL, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE);//$NON-NLS-1$
+ metadataList[1] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.DATA_TYPE, JDBCSQLTypeInfo.INTEGER, ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$
+ metadataList[2] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.PRECISION, JDBCSQLTypeInfo.INTEGER, ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$
+ metadataList[3] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.LITERAL_PREFIX, JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$
+ metadataList[4] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.LITERAL_SUFFIX, JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$
+ metadataList[5] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.CREATE_PARAMS, JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$
+ metadataList[6] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.NULLABLE, JDBCSQLTypeInfo.SHORT, ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$
+ metadataList[7] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.CASE_SENSITIVE, JDBCSQLTypeInfo.BOOLEAN, ResultsMetadataConstants.NULL_TYPES.NOT_NULL, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.FALSE, Boolean.FALSE, Boolean.TRUE);//$NON-NLS-1$
+ metadataList[8] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.SEARCHABLE, JDBCSQLTypeInfo.SHORT, ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$
+ metadataList[9] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.UNSIGNED_ATTRIBUTE, JDBCSQLTypeInfo.BOOLEAN, ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$
+ metadataList[10] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.FIXED_PREC_SCALE, JDBCSQLTypeInfo.BOOLEAN, ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$
+ metadataList[11] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.AUTOINCREMENT, JDBCSQLTypeInfo.BOOLEAN, ResultsMetadataConstants.NULL_TYPES.NOT_NULL, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.FALSE, Boolean.TRUE, Boolean.TRUE);//$NON-NLS-1$
+ metadataList[12] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.LOCAL_TYPE_NAME, JDBCSQLTypeInfo.STRING, ResultsMetadataConstants.NULL_TYPES.NOT_NULL, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE);//$NON-NLS-1$
+ metadataList[13] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.MINIMUM_SCALE, JDBCSQLTypeInfo.SHORT, ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$
+ metadataList[14] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.MAXIMUM_SCALE, JDBCSQLTypeInfo.SHORT, ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$
+ metadataList[15] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.SQL_DATA_TYPE, JDBCSQLTypeInfo.INTEGER, ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$
+ metadataList[16] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.SQL_DATETIME_SUB, JDBCSQLTypeInfo.INTEGER, ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$
+ metadataList[17] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.NUM_PREC_RADIX, JDBCSQLTypeInfo.INTEGER, ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE);//$NON-NLS-1$
ResultSetMetaData rmetadata = new ResultSetMetaDataImpl(new MetadataProvider(metadataList));
@@ -1642,7 +1642,7 @@
}
private Object[] createTypeInfoRow(String typeName, String prefix, String suffix, Boolean unsigned, Boolean fixedPrecScale, int radix){
- return new Object[] {typeName, new Integer(MMJDBCSQLTypeInfo.getSQLType(typeName)), ResultsMetadataDefaults.getDefaultPrecision(typeName), prefix, suffix, null, new Short((short)DatabaseMetaData.typeNullable), Boolean.FALSE, new Short((short)DatabaseMetaData.typeSearchable), unsigned, fixedPrecScale, Boolean.FALSE, typeName, new Short((short)0), new Short((short)255), null, null, new Integer(radix)};
+ return new Object[] {typeName, new Integer(JDBCSQLTypeInfo.getSQLType(typeName)), ResultsMetadataDefaults.getDefaultPrecision(typeName), prefix, suffix, null, new Short((short)DatabaseMetaData.typeNullable), Boolean.FALSE, new Short((short)DatabaseMetaData.typeSearchable), unsigned, fixedPrecScale, Boolean.FALSE, typeName, new Short((short)0), new Short((short)255), null, null, new Integer(radix)};
}
/**
@@ -1677,13 +1677,13 @@
JDBCColumnNames.UDTS.BASE_TYPE
};
String[] dataTypes = new String[] {
- MMJDBCSQLTypeInfo.STRING,
- MMJDBCSQLTypeInfo.STRING,
- MMJDBCSQLTypeInfo.STRING,
- MMJDBCSQLTypeInfo.STRING,
- MMJDBCSQLTypeInfo.STRING,
- MMJDBCSQLTypeInfo.STRING,
- MMJDBCSQLTypeInfo.SHORT
+ JDBCSQLTypeInfo.STRING,
+ JDBCSQLTypeInfo.STRING,
+ JDBCSQLTypeInfo.STRING,
+ JDBCSQLTypeInfo.STRING,
+ JDBCSQLTypeInfo.STRING,
+ JDBCSQLTypeInfo.STRING,
+ JDBCSQLTypeInfo.SHORT
};
return createEmptyResultSet(columnNames, dataTypes);
}
@@ -1947,8 +1947,8 @@
}
public boolean supportsConvert(int fromType, int toType) throws SQLException {
- String fromName = MMJDBCSQLTypeInfo.getTypeName(fromType);
- String toName = MMJDBCSQLTypeInfo.getTypeName(toType);
+ String fromName = JDBCSQLTypeInfo.getTypeName(fromType);
+ String toName = JDBCSQLTypeInfo.getTypeName(toType);
if (fromName.equals(toName)) {
if (fromName.equals(DataTypeManager.DefaultDataTypes.OBJECT) && fromName != toName) {
Modified: trunk/client/src/main/java/org/teiid/jdbc/ParameterMetaDataImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/ParameterMetaDataImpl.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/client/src/main/java/org/teiid/jdbc/ParameterMetaDataImpl.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -27,7 +27,7 @@
import java.sql.PreparedStatement;
import java.sql.SQLException;
-import com.metamatrix.common.types.MMJDBCSQLTypeInfo;
+import com.metamatrix.common.types.JDBCSQLTypeInfo;
/**
* Note: this is currently only accurate for {@link PreparedStatement}s.
@@ -43,7 +43,7 @@
@Override
public String getParameterClassName(int param) throws SQLException {
- return MMJDBCSQLTypeInfo.getJavaClassName(getParameterType(param));
+ return JDBCSQLTypeInfo.getJavaClassName(getParameterType(param));
}
@Override
Modified: trunk/client/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/client/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -60,7 +60,7 @@
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
-import com.metamatrix.common.types.MMJDBCSQLTypeInfo;
+import com.metamatrix.common.types.JDBCSQLTypeInfo;
import com.metamatrix.common.util.SqlUtil;
import com.metamatrix.common.util.TimestampWithTimezone;
import com.metamatrix.core.util.ArgCheck;
@@ -501,37 +501,37 @@
}
// get the java class name for the given JDBC type
- String javaClassName = MMJDBCSQLTypeInfo.getJavaClassName(targetJdbcType);
+ String javaClassName = JDBCSQLTypeInfo.getJavaClassName(targetJdbcType);
// transform the value to the target datatype
- if(javaClassName.equalsIgnoreCase(MMJDBCSQLTypeInfo.STRING_CLASS)) {
+ if(javaClassName.equalsIgnoreCase(JDBCSQLTypeInfo.STRING_CLASS)) {
targetObject = value.toString();
- } else if(javaClassName.equalsIgnoreCase(MMJDBCSQLTypeInfo.CHAR_CLASS)) {
+ } else if(javaClassName.equalsIgnoreCase(JDBCSQLTypeInfo.CHAR_CLASS)) {
targetObject = DataTypeTransformer.getCharacter(value);
- } else if(javaClassName.equalsIgnoreCase(MMJDBCSQLTypeInfo.INTEGER_CLASS)) {
+ } else if(javaClassName.equalsIgnoreCase(JDBCSQLTypeInfo.INTEGER_CLASS)) {
targetObject = DataTypeTransformer.getInteger(value);
- } else if(javaClassName.equalsIgnoreCase(MMJDBCSQLTypeInfo.BYTE_CLASS)) {
+ } else if(javaClassName.equalsIgnoreCase(JDBCSQLTypeInfo.BYTE_CLASS)) {
targetObject = DataTypeTransformer.getByte(value);
- } else if(javaClassName.equalsIgnoreCase(MMJDBCSQLTypeInfo.SHORT_CLASS)) {
+ } else if(javaClassName.equalsIgnoreCase(JDBCSQLTypeInfo.SHORT_CLASS)) {
targetObject = DataTypeTransformer.getShort(value);
- } else if(javaClassName.equalsIgnoreCase(MMJDBCSQLTypeInfo.LONG_CLASS)) {
+ } else if(javaClassName.equalsIgnoreCase(JDBCSQLTypeInfo.LONG_CLASS)) {
targetObject = DataTypeTransformer.getLong(value);
- } else if(javaClassName.equalsIgnoreCase(MMJDBCSQLTypeInfo.FLOAT_CLASS)) {
+ } else if(javaClassName.equalsIgnoreCase(JDBCSQLTypeInfo.FLOAT_CLASS)) {
targetObject = DataTypeTransformer.getFloat(value);
- } else if(javaClassName.equalsIgnoreCase(MMJDBCSQLTypeInfo.DOUBLE_CLASS)) {
+ } else if(javaClassName.equalsIgnoreCase(JDBCSQLTypeInfo.DOUBLE_CLASS)) {
targetObject = DataTypeTransformer.getDouble(value);
- } else if(javaClassName.equalsIgnoreCase(MMJDBCSQLTypeInfo.BOOLEAN_CLASS)) {
+ } else if(javaClassName.equalsIgnoreCase(JDBCSQLTypeInfo.BOOLEAN_CLASS)) {
targetObject = DataTypeTransformer.getBoolean(value);
- } else if(javaClassName.equalsIgnoreCase(MMJDBCSQLTypeInfo.BIGDECIMAL_CLASS)) {
+ } else if(javaClassName.equalsIgnoreCase(JDBCSQLTypeInfo.BIGDECIMAL_CLASS)) {
targetObject = DataTypeTransformer.getBigDecimal(value);
- } else if(javaClassName.equalsIgnoreCase(MMJDBCSQLTypeInfo.TIMESTAMP_CLASS)) {
+ } else if(javaClassName.equalsIgnoreCase(JDBCSQLTypeInfo.TIMESTAMP_CLASS)) {
targetObject = DataTypeTransformer.getTimestamp(value);
- } else if(javaClassName.equalsIgnoreCase(MMJDBCSQLTypeInfo.DATE_CLASS)) {
+ } else if(javaClassName.equalsIgnoreCase(JDBCSQLTypeInfo.DATE_CLASS)) {
targetObject = DataTypeTransformer.getDate(value);
- } else if(javaClassName.equalsIgnoreCase(MMJDBCSQLTypeInfo.TIME_CLASS)) {
+ } else if(javaClassName.equalsIgnoreCase(JDBCSQLTypeInfo.TIME_CLASS)) {
targetObject = DataTypeTransformer.getTime(value);
- } else if (javaClassName.equalsIgnoreCase(MMJDBCSQLTypeInfo.BLOB_CLASS)) {
+ } else if (javaClassName.equalsIgnoreCase(JDBCSQLTypeInfo.BLOB_CLASS)) {
targetObject = DataTypeTransformer.getBlob(value);
- } else if (javaClassName.equalsIgnoreCase(MMJDBCSQLTypeInfo.CLOB_CLASS)) {
+ } else if (javaClassName.equalsIgnoreCase(JDBCSQLTypeInfo.CLOB_CLASS)) {
targetObject = DataTypeTransformer.getClob(value);
} else {
String msg = JDBCPlugin.Util.getString("MMPreparedStatement.Err_transform_obj"); //$NON-NLS-1$
Modified: trunk/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -554,19 +554,7 @@
public java.io.Reader getCharacterStream(int columnIndex)
throws SQLException {
Object value = getObject(columnIndex);
- if (value == null) {
- return null;
- }
-
- if (value instanceof Clob) {
- return ((Clob) value).getCharacterStream();
- }
-
- if (value instanceof SQLXML) {
- return ((SQLXML)value).getCharacterStream();
- }
-
- return new StringReader(getString(columnIndex));
+ return DataTypeTransformer.getCharacterStream(value);
}
/**
Modified: trunk/client/src/main/java/org/teiid/jdbc/ResultSetMetaDataImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/ResultSetMetaDataImpl.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/client/src/main/java/org/teiid/jdbc/ResultSetMetaDataImpl.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -27,7 +27,7 @@
import org.teiid.client.metadata.ResultsMetadataConstants;
-import com.metamatrix.common.types.MMJDBCSQLTypeInfo;
+import com.metamatrix.common.types.JDBCSQLTypeInfo;
/**
*/
@@ -140,7 +140,7 @@
public int getColumnType(int index) throws SQLException {
String runtimeTypeName = provider.getStringValue(adjustColumn(index), ResultsMetadataConstants.DATA_TYPE);
- return MMJDBCSQLTypeInfo.getSQLType(runtimeTypeName);
+ return JDBCSQLTypeInfo.getSQLType(runtimeTypeName);
}
public String getColumnTypeName(int index) throws SQLException {
@@ -160,7 +160,7 @@
}
public String getColumnClassName(int index) throws SQLException {
- return MMJDBCSQLTypeInfo.getJavaClassName(getColumnType(index));
+ return JDBCSQLTypeInfo.getJavaClassName(getColumnType(index));
}
}
Modified: trunk/client/src/test/java/org/teiid/jdbc/TestAllResultsImpl.java
===================================================================
--- trunk/client/src/test/java/org/teiid/jdbc/TestAllResultsImpl.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/client/src/test/java/org/teiid/jdbc/TestAllResultsImpl.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -49,7 +49,7 @@
import org.teiid.jdbc.StatementImpl;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
-import com.metamatrix.common.types.MMJDBCSQLTypeInfo;
+import com.metamatrix.common.types.JDBCSQLTypeInfo;
import com.metamatrix.common.util.TimestampWithTimezone;
import com.metamatrix.query.unittest.TimestampUtil;
@@ -758,8 +758,8 @@
private String[] dataTypes() {
String[] types = new String[2];
- types[0] = MMJDBCSQLTypeInfo.INTEGER;
- types[1] = MMJDBCSQLTypeInfo.STRING;
+ types[0] = JDBCSQLTypeInfo.INTEGER;
+ types[1] = JDBCSQLTypeInfo.STRING;
return types;
}
@@ -780,7 +780,7 @@
/** without metadata info. */
private ResultsMessage exampleResultsMsg1() {
- return exampleMessage(exampleResults1(5), new String[] { "IntNum" }, new String[] { MMJDBCSQLTypeInfo.INTEGER }); //$NON-NLS-1$
+ return exampleMessage(exampleResults1(5), new String[] { "IntNum" }, new String[] { JDBCSQLTypeInfo.INTEGER }); //$NON-NLS-1$
}
private ResultsMessage exampleMessage(List<Object>[] results, String[] columnNames, String[] datatypes) {
@@ -798,7 +798,7 @@
/** without metadata info. */
private ResultsMessage exampleResultsMsg2() {
- return exampleMessage(exampleResults2(), new String[] { "IntNum", "StringNum" }, new String[] { MMJDBCSQLTypeInfo.INTEGER, MMJDBCSQLTypeInfo.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ return exampleMessage(exampleResults2(), new String[] { "IntNum", "StringNum" }, new String[] { JDBCSQLTypeInfo.INTEGER, JDBCSQLTypeInfo.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
}
/** with limited metadata info. */
@@ -817,7 +817,7 @@
/** no rows. */
private ResultsMessage exampleResultsMsg3() {
- return exampleMessage(new List[0], new String[] { "IntNum", "StringNum" }, new String[] { MMJDBCSQLTypeInfo.INTEGER, MMJDBCSQLTypeInfo.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
+ return exampleMessage(new List[0], new String[] { "IntNum", "StringNum" }, new String[] { JDBCSQLTypeInfo.INTEGER, JDBCSQLTypeInfo.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
}
private static ResultsMessage exampleResultsMsg4(int begin, int length, int fetchSize, boolean lastBatch) {
@@ -827,7 +827,7 @@
List[] results = exampleResults1(length, begin);
resultsMsg.setResults(results);
resultsMsg.setColumnNames(new String[] { "IntKey" }); //$NON-NLS-1$
- resultsMsg.setDataTypes(new String[] { MMJDBCSQLTypeInfo.INTEGER });
+ resultsMsg.setDataTypes(new String[] { JDBCSQLTypeInfo.INTEGER });
resultsMsg.setFirstRow(begin);
if (lastBatch) {
resultsMsg.setFinalRow(begin + results.length - 1);
@@ -854,7 +854,7 @@
ResultsMessage resultsMsg = new ResultsMessage(request);
resultsMsg.setResults(new List[] {Arrays.asList(new Timestamp(0))});
resultsMsg.setColumnNames(new String[] { "TS" }); //$NON-NLS-1$
- resultsMsg.setDataTypes(new String[] { MMJDBCSQLTypeInfo.TIMESTAMP });
+ resultsMsg.setDataTypes(new String[] { JDBCSQLTypeInfo.TIMESTAMP });
resultsMsg.setFirstRow(1);
resultsMsg.setFinalRow(1);
resultsMsg.setLastRow(1);
@@ -871,7 +871,7 @@
@Test public void testWasNull() throws SQLException{
ResultsMessage message = exampleMessage(new List[] { Arrays.asList((String)null), Arrays.asList("1") }, new String[] { "string" }, //$NON-NLS-1$
- new String[] { MMJDBCSQLTypeInfo.STRING });
+ new String[] { JDBCSQLTypeInfo.STRING });
ResultSetImpl rs = new ResultSetImpl(message, statement);
assertTrue(rs.next());
assertEquals(Boolean.FALSE.booleanValue(), rs.getBoolean(1));
@@ -898,7 +898,7 @@
TimeZone.setDefault(TimeZone.getTimeZone("GMT-05:00")); //$NON-NLS-1$
ResultsMessage message = exampleMessage(new List[] { Arrays.asList(1, TimestampUtil.createTime(0, 0, 0), TimestampUtil.createDate(1, 1, 1), TimestampUtil.createTimestamp(1, 1, 1, 1, 1, 1, 1), "<root/>") }, //$NON-NLS-1$
new String[] { "int", "time", "date", "timestamp", "sqlxml" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- new String[] { MMJDBCSQLTypeInfo.INTEGER, MMJDBCSQLTypeInfo.TIME, MMJDBCSQLTypeInfo.DATE, MMJDBCSQLTypeInfo.TIMESTAMP, MMJDBCSQLTypeInfo.STRING });
+ new String[] { JDBCSQLTypeInfo.INTEGER, JDBCSQLTypeInfo.TIME, JDBCSQLTypeInfo.DATE, JDBCSQLTypeInfo.TIMESTAMP, JDBCSQLTypeInfo.STRING });
TimestampWithTimezone.resetCalendar(TimeZone.getTimeZone("GMT-06:00")); //$NON-NLS-1$
ResultSetImpl rs = new ResultSetImpl(message, statement);
assertTrue(rs.next());
Modified: trunk/client/src/test/java/org/teiid/jdbc/TestMMCallableStatement.java
===================================================================
--- trunk/client/src/test/java/org/teiid/jdbc/TestMMCallableStatement.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/client/src/test/java/org/teiid/jdbc/TestMMCallableStatement.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -42,7 +42,7 @@
import org.teiid.jdbc.ResultSetImpl;
import org.teiid.net.ServerConnection;
-import com.metamatrix.common.types.MMJDBCSQLTypeInfo;
+import com.metamatrix.common.types.JDBCSQLTypeInfo;
public class TestMMCallableStatement extends TestCase {
@@ -72,7 +72,7 @@
List[] results = new List[] {Arrays.asList(null, null, null), Arrays.asList(null, 1, 2)};
resultsMsg.setResults(results);
resultsMsg.setColumnNames(new String[] { "IntNum", "Out1", "Out2" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- resultsMsg.setDataTypes(new String[] { MMJDBCSQLTypeInfo.INTEGER, MMJDBCSQLTypeInfo.INTEGER, MMJDBCSQLTypeInfo.INTEGER });
+ resultsMsg.setDataTypes(new String[] { JDBCSQLTypeInfo.INTEGER, JDBCSQLTypeInfo.INTEGER, JDBCSQLTypeInfo.INTEGER });
resultsMsg.setFinalRow(results.length);
resultsMsg.setLastRow(results.length);
resultsMsg.setFirstRow(1);
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/ClobType.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/ClobType.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/ClobType.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -157,7 +157,7 @@
return data;
}
- private final static int CHAR_SEQUENCE_BUFFER_SIZE = 2 << 12;
+ private final static int CHAR_SEQUENCE_BUFFER_SIZE = 1 << 12;
public CharSequence getCharSequence() {
return new CharSequence() {
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -51,7 +51,6 @@
import com.metamatrix.common.types.basic.AnyToStringTransform;
import com.metamatrix.common.types.basic.BooleanToNumberTransform;
import com.metamatrix.common.types.basic.ClobToSQLXMLTransform;
-import com.metamatrix.common.types.basic.ClobToStringTransform;
import com.metamatrix.common.types.basic.FixedNumberToBigDecimalTransform;
import com.metamatrix.common.types.basic.FixedNumberToBigIntegerTransform;
import com.metamatrix.common.types.basic.FloatingNumberToBigDecimalTransform;
@@ -772,7 +771,7 @@
if (value instanceof InputStreamFactory) {
return new XMLType(new SQLXMLImpl((InputStreamFactory)value));
}
- StandardXMLTranslator sxt = new StandardXMLTranslator(value, null);
+ StandardXMLTranslator sxt = new StandardXMLTranslator(value);
try {
return new XMLType(new SQLXMLImpl(sxt.getString()));
} catch (Exception e) {
Copied: trunk/common-core/src/main/java/com/metamatrix/common/types/JDBCSQLTypeInfo.java (from rev 1988, trunk/common-core/src/main/java/com/metamatrix/common/types/MMJDBCSQLTypeInfo.java)
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/JDBCSQLTypeInfo.java (rev 0)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/JDBCSQLTypeInfo.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -0,0 +1,264 @@
+/*
+ * 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 com.metamatrix.common.types;
+
+import java.sql.Blob;
+import java.sql.Clob;
+//## JDBC4.0-begin ##
+import java.sql.SQLXML;
+//## JDBC4.0-end ##
+
+/*## JDBC3.0-JDK1.5-begin ##
+import com.metamatrix.core.jdbc.SQLXML;
+## JDBC3.0-JDK1.5-end ##*/
+import java.sql.Types;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * <p> This is a helper class used to obtain SQL type information for java types.
+ * The SQL type information is obtained from java.sql.Types class. The integers and
+ * strings returned by methods in this class are based on constants in java.sql.Types.
+ */
+
+public final class JDBCSQLTypeInfo {
+
+
+ // Prevent instantiation
+ private JDBCSQLTypeInfo() {}
+
+ // metamatrix types
+ public static final String STRING = DataTypeManager.DefaultDataTypes.STRING;
+ public static final String BOOLEAN = DataTypeManager.DefaultDataTypes.BOOLEAN;
+ public static final String TIME = DataTypeManager.DefaultDataTypes.TIME;
+ public static final String DATE = DataTypeManager.DefaultDataTypes.DATE;
+ public static final String TIMESTAMP = DataTypeManager.DefaultDataTypes.TIMESTAMP;
+ public static final String INTEGER = DataTypeManager.DefaultDataTypes.INTEGER;
+ public static final String FLOAT = DataTypeManager.DefaultDataTypes.FLOAT;
+ public static final String DOUBLE = DataTypeManager.DefaultDataTypes.DOUBLE;
+ public static final String BIGDECIMAL = DataTypeManager.DefaultDataTypes.BIG_DECIMAL;
+ public static final String BIGINTEGER = DataTypeManager.DefaultDataTypes.BIG_INTEGER;
+ public static final String BYTE = DataTypeManager.DefaultDataTypes.BYTE;
+ public static final String SHORT = DataTypeManager.DefaultDataTypes.SHORT;
+ public static final String LONG = DataTypeManager.DefaultDataTypes.LONG;
+ public static final String CHAR = DataTypeManager.DefaultDataTypes.CHAR;
+ public static final String OBJECT = DataTypeManager.DefaultDataTypes.OBJECT;
+ public static final String CLOB = DataTypeManager.DefaultDataTypes.CLOB;
+ public static final String BLOB = DataTypeManager.DefaultDataTypes.BLOB;
+ public static final String XML = DataTypeManager.DefaultDataTypes.XML;
+ public static final String NULL = DataTypeManager.DefaultDataTypes.NULL;
+
+ //java class names
+ public static final String STRING_CLASS = DataTypeManager.DefaultDataClasses.STRING.getName();
+ public static final String BOOLEAN_CLASS = DataTypeManager.DefaultDataClasses.BOOLEAN.getName();
+ public static final String TIME_CLASS = DataTypeManager.DefaultDataClasses.TIME.getName();
+ public static final String DATE_CLASS = DataTypeManager.DefaultDataClasses.DATE.getName();
+ public static final String TIMESTAMP_CLASS = DataTypeManager.DefaultDataClasses.TIMESTAMP.getName();
+ public static final String INTEGER_CLASS = DataTypeManager.DefaultDataClasses.INTEGER.getName();
+ public static final String FLOAT_CLASS = DataTypeManager.DefaultDataClasses.FLOAT.getName();
+ public static final String DOUBLE_CLASS = DataTypeManager.DefaultDataClasses.DOUBLE.getName();
+ public static final String BIGDECIMAL_CLASS = DataTypeManager.DefaultDataClasses.BIG_DECIMAL.getName();
+ public static final String BYTE_CLASS = DataTypeManager.DefaultDataClasses.BYTE.getName();
+ public static final String SHORT_CLASS = DataTypeManager.DefaultDataClasses.SHORT.getName();
+ public static final String LONG_CLASS = DataTypeManager.DefaultDataClasses.LONG.getName();
+ public static final String CHAR_CLASS = DataTypeManager.DefaultDataClasses.CHAR.getName();
+ public static final String BIGINTEGER_CLASS = DataTypeManager.DefaultDataClasses.BIG_INTEGER.getName();
+ public static final String OBJECT_CLASS = DataTypeManager.DefaultDataClasses.OBJECT.getName();
+ public static final String CLOB_CLASS = Clob.class.getName();
+ public static final String BLOB_CLASS = Blob.class.getName();
+ //## JDBC4.0-begin ##
+ public static final String XML_CLASS = SQLXML.class.getName();
+ //## JDBC4.0-end ##
+ /*## JDBC3.0-JDK1.5-begin ##
+ public static final String XML_CLASS = DataTypeManager.DefaultDataClasses.OBJECT.getName();
+ ## JDBC3.0-JDK1.5-end ##*/
+
+ private static Map<String, Integer> NAME_TO_TYPE_MAP = new HashMap<String, Integer>();
+ private static Map<Integer, String> TYPE_TO_NAME_MAP = new HashMap<Integer, String>();
+ private static Map<String, String> NAME_TO_CLASSNAME = new HashMap<String, String>();
+ private static Map<String, String> CLASSNAME_TO_NAME = new HashMap<String, String>();
+
+ static {
+ addTypeMapping(STRING, STRING_CLASS, Types.VARCHAR, Types.LONGVARCHAR, Types.CHAR);
+ addTypeMapping(CHAR, CHAR_CLASS, Types.CHAR, false);
+ addTypeMapping(BOOLEAN, BOOLEAN_CLASS, Types.BIT);
+ addTypeMapping(TIME, TIME_CLASS, Types.TIME);
+ addTypeMapping(DATE, DATE_CLASS, Types.DATE);
+ addTypeMapping(TIMESTAMP, TIMESTAMP_CLASS, Types.TIMESTAMP);
+ addTypeMapping(INTEGER, INTEGER_CLASS, Types.INTEGER);
+ addTypeMapping(FLOAT, FLOAT_CLASS, Types.REAL);
+ addTypeMapping(DOUBLE, DOUBLE_CLASS, Types.DOUBLE, Types.FLOAT);
+ addTypeMapping(BIGDECIMAL, BIGDECIMAL_CLASS, Types.NUMERIC, Types.DECIMAL);
+ addTypeMapping(BIGINTEGER, BIGINTEGER_CLASS, Types.NUMERIC, false);
+ addTypeMapping(BYTE, BYTE_CLASS, Types.TINYINT);
+ addTypeMapping(SHORT, SHORT_CLASS, Types.SMALLINT);
+ addTypeMapping(LONG, LONG_CLASS, Types.BIGINT);
+ addTypeMapping(OBJECT, OBJECT_CLASS, Types.JAVA_OBJECT);
+ addTypeMapping(CLOB, CLOB_CLASS, Types.CLOB);
+ addTypeMapping(BLOB, BLOB_CLASS, Types.BLOB, Types.BINARY, Types.VARBINARY, Types.LONGVARBINARY);
+
+ addTypeMapping(NULL, null, Types.NULL);
+
+ //## JDBC4.0-begin ##
+ addTypeMapping(XML, XML_CLASS, Types.SQLXML);
+ TYPE_TO_NAME_MAP.put(Types.NVARCHAR, STRING);
+ TYPE_TO_NAME_MAP.put(Types.LONGNVARCHAR, STRING);
+ TYPE_TO_NAME_MAP.put(Types.NCHAR, CHAR);
+ TYPE_TO_NAME_MAP.put(Types.NCLOB, CLOB);
+ //## JDBC4.0-end ##
+
+ /*## JDBC3.0-JDK1.5-begin ##
+ NAME_TO_CLASSNAME.put(XML, OBJECT_CLASS);
+ ## JDBC3.0-JDK1.5-end ##*/
+ }
+
+ private static void addTypeMapping(String typeName, String javaClass, int sqlType, int ... secondaryTypes) {
+ addTypeMapping(typeName, javaClass, sqlType, true);
+ for (int type : secondaryTypes) {
+ TYPE_TO_NAME_MAP.put(type, typeName);
+ }
+ }
+
+ private static void addTypeMapping(String typeName, String javaClass, int sqlType, boolean preferedType) {
+ NAME_TO_TYPE_MAP.put(typeName, sqlType);
+ if (preferedType) {
+ TYPE_TO_NAME_MAP.put(sqlType, typeName);
+ }
+ if (javaClass != null) {
+ NAME_TO_CLASSNAME.put(typeName, javaClass);
+ CLASSNAME_TO_NAME.put(javaClass, typeName);
+ }
+ }
+
+ /**
+ * This method is used to obtain a short indicating JDBC SQL type for any object.
+ * The short values that give the type info are from java.sql.Types.
+ * @param Name of the metamatrix type.
+ * @return A short value representing SQL Type for the given java type.
+ */
+ public static final int getSQLType(String typeName) {
+
+ if (typeName == null) {
+ return Types.NULL;
+ }
+
+ Integer sqlType = NAME_TO_TYPE_MAP.get(typeName);
+
+ if (sqlType == null) {
+ return Types.JAVA_OBJECT;
+ }
+
+ return sqlType.intValue();
+ }
+
+ /**
+ * Get sql Type from java class type name. This should not be called with runtime types
+ * as Clob and Blob are represented by ClobType and BlobType respectively.
+ * @param typeName
+ * @return int
+ */
+ public static final int getSQLTypeFromClass(String className) {
+
+ if (className == null) {
+ return Types.NULL;
+ }
+
+ String name = CLASSNAME_TO_NAME.get(className);
+
+ if (name == null) {
+ return Types.JAVA_OBJECT;
+ }
+
+ return getSQLType(name);
+ }
+
+ /**
+ * Get the sql type from the given runtime type
+ * @param type
+ * @return
+ */
+ public static final int getSQLTypeFromRuntimeType(Class<?> type) {
+ if (type == null) {
+ return Types.NULL;
+ }
+
+ String name = DataTypeManager.getDataTypeName(type);
+
+ if (name == null) {
+ return Types.JAVA_OBJECT;
+ }
+
+ return getSQLType(name);
+ }
+
+ /**
+ * This method is used to obtain a the java class name given an int value
+ * indicating JDBC SQL type. The int values that give the type info are from
+ * java.sql.Types.
+ * @param int value giving the SQL type code.
+ * @return A String representing the java class name for the given SQL Type.
+ */
+ public static final String getJavaClassName(int jdbcSQLType) {
+ String className = NAME_TO_CLASSNAME.get(getTypeName(jdbcSQLType));
+
+ if (className == null) {
+ return OBJECT_CLASS;
+ }
+
+ return className;
+ }
+
+ public static final String getTypeName(int sqlType) {
+ String name = TYPE_TO_NAME_MAP.get(sqlType);
+
+ if (name == null) {
+ return OBJECT;
+ }
+
+ return name;
+ }
+
+ public static String[] getMMTypeNames() {
+ return new String[] {
+ STRING,
+ BOOLEAN,
+ TIME,
+ DATE,
+ TIMESTAMP,
+ INTEGER,
+ FLOAT,
+ DOUBLE,
+ BIGDECIMAL,
+ BIGINTEGER,
+ BYTE,
+ SHORT,
+ LONG,
+ CHAR,
+ OBJECT,
+ CLOB,
+ BLOB,
+ XML
+ };
+ }
+
+}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/MMJDBCSQLTypeInfo.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/MMJDBCSQLTypeInfo.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/MMJDBCSQLTypeInfo.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -1,264 +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 com.metamatrix.common.types;
-
-import java.sql.Blob;
-import java.sql.Clob;
-//## JDBC4.0-begin ##
-import java.sql.SQLXML;
-//## JDBC4.0-end ##
-
-/*## JDBC3.0-JDK1.5-begin ##
-import com.metamatrix.core.jdbc.SQLXML;
-## JDBC3.0-JDK1.5-end ##*/
-import java.sql.Types;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * <p> This is a helper class used to obtain SQL type information for java types.
- * The SQL type information is obtained from java.sql.Types class. The integers and
- * strings returned by methods in this class are based on constants in java.sql.Types.
- */
-
-public final class MMJDBCSQLTypeInfo {
-
-
- // Prevent instantiation
- private MMJDBCSQLTypeInfo() {}
-
- // metamatrix types
- public static final String STRING = DataTypeManager.DefaultDataTypes.STRING;
- public static final String BOOLEAN = DataTypeManager.DefaultDataTypes.BOOLEAN;
- public static final String TIME = DataTypeManager.DefaultDataTypes.TIME;
- public static final String DATE = DataTypeManager.DefaultDataTypes.DATE;
- public static final String TIMESTAMP = DataTypeManager.DefaultDataTypes.TIMESTAMP;
- public static final String INTEGER = DataTypeManager.DefaultDataTypes.INTEGER;
- public static final String FLOAT = DataTypeManager.DefaultDataTypes.FLOAT;
- public static final String DOUBLE = DataTypeManager.DefaultDataTypes.DOUBLE;
- public static final String BIGDECIMAL = DataTypeManager.DefaultDataTypes.BIG_DECIMAL;
- public static final String BIGINTEGER = DataTypeManager.DefaultDataTypes.BIG_INTEGER;
- public static final String BYTE = DataTypeManager.DefaultDataTypes.BYTE;
- public static final String SHORT = DataTypeManager.DefaultDataTypes.SHORT;
- public static final String LONG = DataTypeManager.DefaultDataTypes.LONG;
- public static final String CHAR = DataTypeManager.DefaultDataTypes.CHAR;
- public static final String OBJECT = DataTypeManager.DefaultDataTypes.OBJECT;
- public static final String CLOB = DataTypeManager.DefaultDataTypes.CLOB;
- public static final String BLOB = DataTypeManager.DefaultDataTypes.BLOB;
- public static final String XML = DataTypeManager.DefaultDataTypes.XML;
- public static final String NULL = DataTypeManager.DefaultDataTypes.NULL;
-
- //java class names
- public static final String STRING_CLASS = DataTypeManager.DefaultDataClasses.STRING.getName();
- public static final String BOOLEAN_CLASS = DataTypeManager.DefaultDataClasses.BOOLEAN.getName();
- public static final String TIME_CLASS = DataTypeManager.DefaultDataClasses.TIME.getName();
- public static final String DATE_CLASS = DataTypeManager.DefaultDataClasses.DATE.getName();
- public static final String TIMESTAMP_CLASS = DataTypeManager.DefaultDataClasses.TIMESTAMP.getName();
- public static final String INTEGER_CLASS = DataTypeManager.DefaultDataClasses.INTEGER.getName();
- public static final String FLOAT_CLASS = DataTypeManager.DefaultDataClasses.FLOAT.getName();
- public static final String DOUBLE_CLASS = DataTypeManager.DefaultDataClasses.DOUBLE.getName();
- public static final String BIGDECIMAL_CLASS = DataTypeManager.DefaultDataClasses.BIG_DECIMAL.getName();
- public static final String BYTE_CLASS = DataTypeManager.DefaultDataClasses.BYTE.getName();
- public static final String SHORT_CLASS = DataTypeManager.DefaultDataClasses.SHORT.getName();
- public static final String LONG_CLASS = DataTypeManager.DefaultDataClasses.LONG.getName();
- public static final String CHAR_CLASS = DataTypeManager.DefaultDataClasses.CHAR.getName();
- public static final String BIGINTEGER_CLASS = DataTypeManager.DefaultDataClasses.BIG_INTEGER.getName();
- public static final String OBJECT_CLASS = DataTypeManager.DefaultDataClasses.OBJECT.getName();
- public static final String CLOB_CLASS = Clob.class.getName();
- public static final String BLOB_CLASS = Blob.class.getName();
- //## JDBC4.0-begin ##
- public static final String XML_CLASS = SQLXML.class.getName();
- //## JDBC4.0-end ##
- /*## JDBC3.0-JDK1.5-begin ##
- public static final String XML_CLASS = DataTypeManager.DefaultDataClasses.OBJECT.getName();
- ## JDBC3.0-JDK1.5-end ##*/
-
- private static Map<String, Integer> NAME_TO_TYPE_MAP = new HashMap<String, Integer>();
- private static Map<Integer, String> TYPE_TO_NAME_MAP = new HashMap<Integer, String>();
- private static Map<String, String> NAME_TO_CLASSNAME = new HashMap<String, String>();
- private static Map<String, String> CLASSNAME_TO_NAME = new HashMap<String, String>();
-
- static {
- addTypeMapping(STRING, STRING_CLASS, Types.VARCHAR, Types.LONGVARCHAR, Types.CHAR);
- addTypeMapping(CHAR, CHAR_CLASS, Types.CHAR, false);
- addTypeMapping(BOOLEAN, BOOLEAN_CLASS, Types.BIT);
- addTypeMapping(TIME, TIME_CLASS, Types.TIME);
- addTypeMapping(DATE, DATE_CLASS, Types.DATE);
- addTypeMapping(TIMESTAMP, TIMESTAMP_CLASS, Types.TIMESTAMP);
- addTypeMapping(INTEGER, INTEGER_CLASS, Types.INTEGER);
- addTypeMapping(FLOAT, FLOAT_CLASS, Types.REAL);
- addTypeMapping(DOUBLE, DOUBLE_CLASS, Types.DOUBLE, Types.FLOAT);
- addTypeMapping(BIGDECIMAL, BIGDECIMAL_CLASS, Types.NUMERIC, Types.DECIMAL);
- addTypeMapping(BIGINTEGER, BIGINTEGER_CLASS, Types.NUMERIC, false);
- addTypeMapping(BYTE, BYTE_CLASS, Types.TINYINT);
- addTypeMapping(SHORT, SHORT_CLASS, Types.SMALLINT);
- addTypeMapping(LONG, LONG_CLASS, Types.BIGINT);
- addTypeMapping(OBJECT, OBJECT_CLASS, Types.JAVA_OBJECT);
- addTypeMapping(CLOB, CLOB_CLASS, Types.CLOB);
- addTypeMapping(BLOB, BLOB_CLASS, Types.BLOB, Types.BINARY, Types.VARBINARY, Types.LONGVARBINARY);
-
- addTypeMapping(NULL, null, Types.NULL);
-
- //## JDBC4.0-begin ##
- addTypeMapping(XML, XML_CLASS, Types.SQLXML);
- TYPE_TO_NAME_MAP.put(Types.NVARCHAR, STRING);
- TYPE_TO_NAME_MAP.put(Types.LONGNVARCHAR, STRING);
- TYPE_TO_NAME_MAP.put(Types.NCHAR, CHAR);
- TYPE_TO_NAME_MAP.put(Types.NCLOB, CLOB);
- //## JDBC4.0-end ##
-
- /*## JDBC3.0-JDK1.5-begin ##
- NAME_TO_CLASSNAME.put(XML, OBJECT_CLASS);
- ## JDBC3.0-JDK1.5-end ##*/
- }
-
- private static void addTypeMapping(String typeName, String javaClass, int sqlType, int ... secondaryTypes) {
- addTypeMapping(typeName, javaClass, sqlType, true);
- for (int type : secondaryTypes) {
- TYPE_TO_NAME_MAP.put(type, typeName);
- }
- }
-
- private static void addTypeMapping(String typeName, String javaClass, int sqlType, boolean preferedType) {
- NAME_TO_TYPE_MAP.put(typeName, sqlType);
- if (preferedType) {
- TYPE_TO_NAME_MAP.put(sqlType, typeName);
- }
- if (javaClass != null) {
- NAME_TO_CLASSNAME.put(typeName, javaClass);
- CLASSNAME_TO_NAME.put(javaClass, typeName);
- }
- }
-
- /**
- * This method is used to obtain a short indicating JDBC SQL type for any object.
- * The short values that give the type info are from java.sql.Types.
- * @param Name of the metamatrix type.
- * @return A short value representing SQL Type for the given java type.
- */
- public static final int getSQLType(String typeName) {
-
- if (typeName == null) {
- return Types.NULL;
- }
-
- Integer sqlType = NAME_TO_TYPE_MAP.get(typeName);
-
- if (sqlType == null) {
- return Types.JAVA_OBJECT;
- }
-
- return sqlType.intValue();
- }
-
- /**
- * Get sql Type from java class type name. This should not be called with runtime types
- * as Clob and Blob are represented by ClobType and BlobType respectively.
- * @param typeName
- * @return int
- */
- public static final int getSQLTypeFromClass(String className) {
-
- if (className == null) {
- return Types.NULL;
- }
-
- String name = CLASSNAME_TO_NAME.get(className);
-
- if (name == null) {
- return Types.JAVA_OBJECT;
- }
-
- return getSQLType(name);
- }
-
- /**
- * Get the sql type from the given runtime type
- * @param type
- * @return
- */
- public static final int getSQLTypeFromRuntimeType(Class<?> type) {
- if (type == null) {
- return Types.NULL;
- }
-
- String name = DataTypeManager.getDataTypeName(type);
-
- if (name == null) {
- return Types.JAVA_OBJECT;
- }
-
- return getSQLType(name);
- }
-
- /**
- * This method is used to obtain a the java class name given an int value
- * indicating JDBC SQL type. The int values that give the type info are from
- * java.sql.Types.
- * @param int value giving the SQL type code.
- * @return A String representing the java class name for the given SQL Type.
- */
- public static final String getJavaClassName(int jdbcSQLType) {
- String className = NAME_TO_CLASSNAME.get(getTypeName(jdbcSQLType));
-
- if (className == null) {
- return OBJECT_CLASS;
- }
-
- return className;
- }
-
- public static final String getTypeName(int sqlType) {
- String name = TYPE_TO_NAME_MAP.get(sqlType);
-
- if (name == null) {
- return OBJECT;
- }
-
- return name;
- }
-
- public static String[] getMMTypeNames() {
- return new String[] {
- STRING,
- BOOLEAN,
- TIME,
- DATE,
- TIMESTAMP,
- INTEGER,
- FLOAT,
- DOUBLE,
- BIGDECIMAL,
- BIGINTEGER,
- BYTE,
- SHORT,
- LONG,
- CHAR,
- OBJECT,
- CLOB,
- BLOB,
- XML
- };
- }
-
-}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/StandardXMLTranslator.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/StandardXMLTranslator.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/StandardXMLTranslator.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -23,57 +23,26 @@
package com.metamatrix.common.types;
import java.io.IOException;
-import java.io.StringReader;
import java.io.Writer;
-import java.util.Properties;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
public class StandardXMLTranslator extends XMLTranslator {
- static String lineSep = System.getProperty("line.separator"); //$NON-NLS-1$
- public static final String INDENT = "indent"; //$NON-NLS-1$
- public static final String idenityTransform =
- "<xsl:stylesheet version=\"2.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">" + lineSep + //$NON-NLS-1$
- "<xsl:output method = \"xml\" omit-xml-declaration=\"yes\"/>" + lineSep + //$NON-NLS-1$
- "<xsl:template match=\"@*|node()\">" + lineSep +//$NON-NLS-1$
- " <xsl:copy>\r\n" + lineSep+ //$NON-NLS-1$
- " <xsl:apply-templates select=\"@*|node()\"/>" +lineSep+//$NON-NLS-1$
- " </xsl:copy>" + lineSep + //$NON-NLS-1$
- "</xsl:template>" + lineSep +//$NON-NLS-1$
- "</xsl:stylesheet>" + lineSep + //$NON-NLS-1$
- ""; //$NON-NLS-1$
-
- static final String XMLPI = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; //$NON-NLS-1$
- static final String newLine = "\n"; //$NON-NLS-1$
-
private Source source;
- private Properties properties;
- public StandardXMLTranslator(Source source, Properties props) {
+ public StandardXMLTranslator(Source source) {
this.source = source;
- this.properties = props;
}
@Override
public void translate(Writer writer) throws TransformerException, IOException {
- Transformer t = TransformerFactory.newInstance().newTransformer(new StreamSource(new StringReader(idenityTransform)));
- writer.write(XMLPI);
- if (useIndentation()) {
- writer.write(newLine);
- }
+ Transformer t = TransformerFactory.newInstance().newTransformer();
t.transform(source, new StreamResult(writer));
}
- private boolean useIndentation() {
- if (properties != null) {
- return "yes".equalsIgnoreCase(properties.getProperty(INDENT)); //$NON-NLS-1$
- }
- return false;
- }
}
Modified: trunk/common-core/src/test/java/com/metamatrix/common/types/TestDataTypeManager.java
===================================================================
--- trunk/common-core/src/test/java/com/metamatrix/common/types/TestDataTypeManager.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/common-core/src/test/java/com/metamatrix/common/types/TestDataTypeManager.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -167,25 +167,25 @@
@Test public void testJDBCSQLTypeInfo() {
- String[] types = MMJDBCSQLTypeInfo.getMMTypeNames();
+ String[] types = JDBCSQLTypeInfo.getMMTypeNames();
for (int i = 0; i < types.length; i++) {
String type = types[i];
- assertEquals("Didn't get match for "+ type, MMJDBCSQLTypeInfo.getSQLType(type), MMJDBCSQLTypeInfo.getSQLTypeFromRuntimeType(DataTypeManager.getDataTypeClass(type))); //$NON-NLS-1$
+ assertEquals("Didn't get match for "+ type, JDBCSQLTypeInfo.getSQLType(type), JDBCSQLTypeInfo.getSQLTypeFromRuntimeType(DataTypeManager.getDataTypeClass(type))); //$NON-NLS-1$
//the classnames will not match the runtime types for xml, clob, blob
if (!type.equalsIgnoreCase(DataTypeManager.DefaultDataTypes.XML) && !type.equalsIgnoreCase(DataTypeManager.DefaultDataTypes.CLOB) && !type.equalsIgnoreCase(DataTypeManager.DefaultDataTypes.BLOB)) {
- assertEquals("Didn't get match for "+ type, MMJDBCSQLTypeInfo.getSQLType(type), MMJDBCSQLTypeInfo.getSQLTypeFromClass(DataTypeManager.getDataTypeClass(type).getName())); //$NON-NLS-1$
+ assertEquals("Didn't get match for "+ type, JDBCSQLTypeInfo.getSQLType(type), JDBCSQLTypeInfo.getSQLTypeFromClass(DataTypeManager.getDataTypeClass(type).getName())); //$NON-NLS-1$
}
}
- assertEquals(Types.TIMESTAMP, MMJDBCSQLTypeInfo.getSQLTypeFromRuntimeType(DataTypeManager.DefaultDataClasses.TIMESTAMP));
+ assertEquals(Types.TIMESTAMP, JDBCSQLTypeInfo.getSQLTypeFromRuntimeType(DataTypeManager.DefaultDataClasses.TIMESTAMP));
//## JDBC4.0-begin ##
- assertEquals(Types.SQLXML, MMJDBCSQLTypeInfo.getSQLTypeFromRuntimeType(DataTypeManager.DefaultDataClasses.XML));
+ assertEquals(Types.SQLXML, JDBCSQLTypeInfo.getSQLTypeFromRuntimeType(DataTypeManager.DefaultDataClasses.XML));
//## JDBC4.0-end ##
- assertEquals(DataTypeManager.DefaultDataTypes.STRING, MMJDBCSQLTypeInfo.getTypeName(Types.CHAR));
- assertEquals(Types.CHAR, MMJDBCSQLTypeInfo.getSQLTypeFromRuntimeType(DataTypeManager.DefaultDataClasses.CHAR));
+ assertEquals(DataTypeManager.DefaultDataTypes.STRING, JDBCSQLTypeInfo.getTypeName(Types.CHAR));
+ assertEquals(Types.CHAR, JDBCSQLTypeInfo.getSQLTypeFromRuntimeType(DataTypeManager.DefaultDataClasses.CHAR));
}
@Test public void testRuntimeTypeConversion() throws Exception {
Modified: trunk/common-core/src/test/java/com/metamatrix/common/types/TestXMLStreamSourceTranslator.java
===================================================================
--- trunk/common-core/src/test/java/com/metamatrix/common/types/TestXMLStreamSourceTranslator.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/common-core/src/test/java/com/metamatrix/common/types/TestXMLStreamSourceTranslator.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -23,7 +23,6 @@
package com.metamatrix.common.types;
import java.io.StringReader;
-import java.util.Properties;
import java.util.StringTokenizer;
import javax.xml.transform.stream.StreamSource;
@@ -78,7 +77,7 @@
"</Books:bookCollection>"; //$NON-NLS-1$
public void testStreamSourceWithStream() throws Exception {
- StandardXMLTranslator translator = new StandardXMLTranslator(new StreamSource(new StringReader(sourceXML)), new Properties());
+ StandardXMLTranslator translator = new StandardXMLTranslator(new StreamSource(new StringReader(sourceXML)));
compareDocuments(sourceXML, translator.getString());
}
Modified: trunk/connector-api/src/main/java/org/teiid/connector/api/TypeFacility.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/api/TypeFacility.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/connector-api/src/main/java/org/teiid/connector/api/TypeFacility.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -26,7 +26,7 @@
import java.util.TimeZone;
import com.metamatrix.common.types.DataTypeManager;
-import com.metamatrix.common.types.MMJDBCSQLTypeInfo;
+import com.metamatrix.common.types.JDBCSQLTypeInfo;
/**
*/
@@ -95,11 +95,11 @@
* @return
*/
public static final int getSQLTypeFromRuntimeType(Class<?> type) {
- return MMJDBCSQLTypeInfo.getSQLTypeFromRuntimeType(type);
+ return JDBCSQLTypeInfo.getSQLTypeFromRuntimeType(type);
}
public static final String getDataTypeNameFromSQLType(int sqlType) {
- return MMJDBCSQLTypeInfo.getTypeName(sqlType);
+ return JDBCSQLTypeInfo.getTypeName(sqlType);
}
/**
Modified: trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xmlsource/file/FileProcedureExecution.java
===================================================================
--- trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xmlsource/file/FileProcedureExecution.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xmlsource/file/FileProcedureExecution.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -27,11 +27,10 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.sql.SQLXML;
import java.util.Arrays;
import java.util.List;
-import javax.xml.transform.Source;
-
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.DataNotAvailableException;
import org.teiid.connector.api.ExecutionContext;
@@ -55,7 +54,7 @@
private Call procedure;
private FileManagedConnectionFactory config;
private boolean returnedResult;
- protected Source returnValue;
+ private SQLXML returnValue;
/**
* @param env
@@ -95,13 +94,13 @@
String encoding = this.config.getCharacterEncodingScheme();
- returnValue = new InputStreamFactory(encoding) {
+ returnValue = (SQLXML)this.config.getTypeFacility().convertToRuntimeType(new InputStreamFactory(encoding) {
@Override
public InputStream getInputStream() throws IOException {
return new BufferedInputStream(new FileInputStream(xmlFile));
}
- };
+ });
this.config.getLogger().logDetail(XMLSourcePlugin.Util.getString("executing_procedure", new Object[] {procedure.getProcedureName()})); //$NON-NLS-1$
}
Modified: trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xmlsource/file/TestFileExecution.java
===================================================================
--- trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xmlsource/file/TestFileExecution.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/connectors/connector-xml-file/src/test/java/org/teiid/connector/xmlsource/file/TestFileExecution.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -22,9 +22,8 @@
package org.teiid.connector.xmlsource.file;
-import java.io.FileReader;
+import java.io.File;
import java.io.PrintWriter;
-import java.io.Reader;
import java.sql.SQLXML;
import java.util.List;
@@ -33,60 +32,54 @@
import org.mockito.Mockito;
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.language.LanguageFactory;
import org.teiid.connector.language.Call;
+import org.teiid.connector.language.LanguageFactory;
import org.teiid.connector.metadata.runtime.Procedure;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
-import org.teiid.connector.xmlsource.file.FileConnection;
-import org.teiid.connector.xmlsource.file.FileProcedureExecution;
-import org.teiid.connector.xmlsource.file.FileManagedConnectionFactory;
+import com.metamatrix.core.util.ObjectConverterUtil;
import com.metamatrix.core.util.UnitTestUtil;
/**
*/
+@SuppressWarnings("nls")
public class TestFileExecution extends TestCase {
- public void testGoodFile() throws Exception {
+ public void testGoodFile() throws Exception {
String file = UnitTestUtil.getTestDataPath();
FileManagedConnectionFactory config = new FileManagedConnectionFactory();
config.setLogWriter(Mockito.mock(PrintWriter.class));
config.setDirectoryLocation(file);
- try {
- FileConnection conn = new FileConnection(config);
- assertTrue(conn.isConnected());
- RuntimeMetadata metadata = Mockito.mock(RuntimeMetadata.class);
+ FileConnection conn = new FileConnection(config);
+ assertTrue(conn.isConnected());
+ RuntimeMetadata metadata = Mockito.mock(RuntimeMetadata.class);
- LanguageFactory fact = config.getLanguageFactory();
- Call procedure = fact.createCall("GetXMLFile", null, createMockProcedureMetadata("BookCollection.xml")); //$NON-NLS-1$
+ LanguageFactory fact = config.getLanguageFactory();
+ Call procedure = fact.createCall("GetXMLFile", null, createMockProcedureMetadata("BookCollection.xml")); //$NON-NLS-1$
- FileProcedureExecution exec = (FileProcedureExecution)conn.createExecution(procedure, Mockito.mock(ExecutionContext.class), metadata); //$NON-NLS-1$ //$NON-NLS-2$
-
- exec.execute();
-
- List result = exec.next();
- assertNotNull(result);
- assertNull(exec.next());
- try {
- exec.getOutputParameterValues();
- fail("should have thrown error in returning a return"); //$NON-NLS-1$
- }catch(Exception e) {
- }
- SQLXML xmlSource = (SQLXML)result.get(0);
- assertNotNull(xmlSource);
- String xml = xmlSource.getString();
-
- String fileContents = readFile(file+"/BookCollection.xml"); //$NON-NLS-1$
- fileContents = fileContents.replaceAll("\r", ""); //$NON-NLS-1$ //$NON-NLS-2$
- //System.out.println(fileContents);
-
- assertEquals(fileContents, xml);
- } catch (ConnectorException e) {
- e.printStackTrace();
- fail("must have passed connection"); //$NON-NLS-1$
- }
+ FileProcedureExecution exec = (FileProcedureExecution)conn.createExecution(procedure, Mockito.mock(ExecutionContext.class), metadata); //$NON-NLS-1$ //$NON-NLS-2$
+
+ exec.execute();
+
+ List<?> result = exec.next();
+ assertNotNull(result);
+ assertNull(exec.next());
+ try {
+ exec.getOutputParameterValues();
+ fail("should have thrown error in returning a return"); //$NON-NLS-1$
+ }catch(Exception e) {
+ }
+ SQLXML xmlSource = (SQLXML)result.get(0);
+ assertNotNull(xmlSource);
+ String xml = xmlSource.getString();
+
+ String fileContents = ObjectConverterUtil.convertFileToString(new File(file+"/BookCollection.xml")); //$NON-NLS-1$
+ fileContents = fileContents.replaceAll("\r", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ //System.out.println(fileContents);
+
+ assertEquals(fileContents, xml);
}
public void testBadFile() throws Exception {
@@ -111,18 +104,6 @@
}
}
- String readFile(String filename) throws Exception {
- Reader reader = new FileReader(filename);
- StringBuffer fileContents = new StringBuffer();
- int c= reader.read();
- while (c != -1) {
- fileContents.append((char)c);
- c = reader.read();
- }
- reader.close();
- return fileContents.toString();
- }
-
public static Procedure createMockProcedureMetadata(String nameInSource) {
Procedure rm = Mockito.mock(Procedure.class);
Mockito.stub(rm.getNameInSource()).toReturn(nameInSource);
Modified: trunk/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferManagerImpl.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferManagerImpl.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/engine/src/main/java/com/metamatrix/common/buffer/impl/BufferManagerImpl.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -371,7 +371,7 @@
if (value instanceof InputStreamFactory) {
return new XMLType(new SQLXMLImpl((InputStreamFactory)value));
}
- StandardXMLTranslator sxt = new StandardXMLTranslator(value, null);
+ StandardXMLTranslator sxt = new StandardXMLTranslator(value);
SQLXMLImpl sqlxml;
try {
sqlxml = XMLUtil.saveToBufferManager(BufferManagerImpl.this, sxt, Streamable.STREAMING_BATCH_SIZE_IN_BYTES);
Modified: trunk/engine/src/main/java/com/metamatrix/common/log/LogConstants.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/common/log/LogConstants.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/engine/src/main/java/com/metamatrix/common/log/LogConstants.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -26,9 +26,7 @@
public interface LogConstants {
// add the new contexts to the Log4JUtil.java class, for configuration purpose
- public static final String CTX_SESSION = "SESSION"; //$NON-NLS-1$
- public static final String CTX_MEMBERSHIP = "MEMBERSHIP"; //$NON-NLS-1$
- public static final String CTX_AUTHORIZATION = "AUTHORIZATION"; //$NON-NLS-1$
+ public static final String CTX_SECURITY = "SECURITY"; //$NON-NLS-1$
public static final String CTX_TRANSPORT = "TRANSPORT"; //$NON-NLS-1$
public static final String CTX_QUERY_PLANNER = "PLANNER"; //$NON-NLS-1$
public static final String CTX_DQP = "PROCESSOR"; //$NON-NLS-1$
Modified: trunk/engine/src/main/java/com/metamatrix/query/analysis/AnalysisRecord.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/analysis/AnalysisRecord.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/engine/src/main/java/com/metamatrix/query/analysis/AnalysisRecord.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -25,6 +25,10 @@
import java.io.*;
import java.util.*;
+import com.metamatrix.common.log.LogConstants;
+import com.metamatrix.common.log.LogManager;
+import com.metamatrix.core.log.MessageLevel;
+
/**
* <p>The AnalysisRecord holds all debug/analysis information for
* a particular query as it is executed. This includes:</p>
@@ -38,37 +42,41 @@
public class AnalysisRecord implements Serializable {
// Flags regarding what should be recorded
- private boolean recordQueryPlan = false;
- private boolean recordAnnotations = false;
- private boolean recordDebug = false;
+ private boolean recordQueryPlan;
+ private boolean recordDebug;
+ private boolean logDebug;
// Query plan
private Map queryPlan;
// Annotations
- private Collection annotations;
+ private Collection<QueryAnnotation> annotations;
// Debug trace log
private StringWriter stringWriter; // inner
private PrintWriter debugWriter; // public
- public AnalysisRecord(boolean recordQueryPlan, boolean recordAnnotations, boolean recordDebug) {
+ public AnalysisRecord(boolean recordQueryPlan, boolean recordDebug) {
this.recordQueryPlan = recordQueryPlan;
- this.recordAnnotations = recordAnnotations;
- this.recordDebug = recordDebug;
+ this.logDebug = recordDebug;
+ this.recordDebug = recordDebug | LogManager.isMessageToBeRecorded(LogConstants.CTX_QUERY_PLANNER, MessageLevel.TRACE);
- if(recordAnnotations) {
- this.annotations = new ArrayList();
+ if(recordQueryPlan) {
+ this.annotations = new ArrayList<QueryAnnotation>();
}
- if(recordDebug) {
+ if(this.recordDebug) {
this.stringWriter = new StringWriter();
this.debugWriter = new PrintWriter(this.stringWriter);
}
}
+ public boolean logDebug() {
+ return logDebug;
+ }
+
public static AnalysisRecord createNonRecordingRecord() {
- return new AnalysisRecord(false, false, false);
+ return new AnalysisRecord(false, false);
}
/**
@@ -84,7 +92,7 @@
* @return True to record
*/
public boolean recordAnnotations() {
- return this.recordAnnotations;
+ return this.recordQueryPlan;
}
/**
@@ -124,7 +132,7 @@
* Get annotations.
* @return
*/
- public Collection getAnnotations() {
+ public Collection<QueryAnnotation> getAnnotations() {
return this.annotations;
}
Modified: trunk/engine/src/main/java/com/metamatrix/query/analysis/QueryAnnotation.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/analysis/QueryAnnotation.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/engine/src/main/java/com/metamatrix/query/analysis/QueryAnnotation.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -28,6 +28,7 @@
public class QueryAnnotation {
public static final String MATERIALIZED_VIEW = "Materialized View"; //$NON-NLS-1$
+ public static final String HINTS = "Hints"; //$NON-NLS-1$
public static final int LOW = 1;
public static final int MEDIUM = 2;
Modified: trunk/engine/src/main/java/com/metamatrix/query/optimizer/QueryOptimizer.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/optimizer/QueryOptimizer.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/engine/src/main/java/com/metamatrix/query/optimizer/QueryOptimizer.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -70,7 +70,7 @@
throws QueryPlannerException, QueryMetadataException, MetaMatrixComponentException {
if (analysisRecord == null) {
- analysisRecord = new AnalysisRecord(false, false, false);
+ analysisRecord = new AnalysisRecord(false, false);
}
if (context == null) {
Modified: trunk/engine/src/main/java/com/metamatrix/query/optimizer/proc/ProcedurePlanner.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/optimizer/proc/ProcedurePlanner.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/engine/src/main/java/com/metamatrix/query/optimizer/proc/ProcedurePlanner.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -22,7 +22,6 @@
package com.metamatrix.query.optimizer.proc;
-import java.util.Iterator;
import java.util.Map;
import com.metamatrix.api.exception.MetaMatrixComponentException;
Modified: trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/RelationalPlanner.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/RelationalPlanner.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/RelationalPlanner.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -237,7 +237,7 @@
* @param groups List of groups (Strings) to be made dependent
* @param plan The canonical plan
*/
- private static void distributeDependentHints(Collection<String> groups, PlanNode plan, QueryMetadataInterface metadata, NodeConstants.Info hintProperty)
+ private void distributeDependentHints(Collection<String> groups, PlanNode plan, QueryMetadataInterface metadata, NodeConstants.Info hintProperty)
throws QueryMetadataException, MetaMatrixComponentException {
if(groups == null || groups.isEmpty()) {
@@ -261,7 +261,9 @@
}
if(! appliedHint) {
- LogManager.logWarning(LogConstants.CTX_QUERY_PLANNER, QueryExecPlugin.Util.getString(ErrorMessageKeys.OPTIMIZER_0010, groupName));
+ String msg = QueryExecPlugin.Util.getString(ErrorMessageKeys.OPTIMIZER_0010, groupName);
+ LogManager.logInfo(LogConstants.CTX_QUERY_PLANNER, msg);
+ this.analysisRecord.addAnnotation(new QueryAnnotation(QueryAnnotation.HINTS, msg, "ignoring hint", QueryAnnotation.MEDIUM)); //$NON-NLS-1$
}
}
}
Modified: trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleChooseDependent.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleChooseDependent.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/engine/src/main/java/com/metamatrix/query/optimizer/relational/rules/RuleChooseDependent.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -31,8 +31,6 @@
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.query.QueryMetadataException;
import com.metamatrix.api.exception.query.QueryPlannerException;
-import com.metamatrix.common.log.LogConstants;
-import com.metamatrix.common.log.LogManager;
import com.metamatrix.query.analysis.AnalysisRecord;
import com.metamatrix.query.metadata.QueryMetadataInterface;
import com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder;
@@ -68,7 +66,7 @@
throws QueryPlannerException, QueryMetadataException, MetaMatrixComponentException {
// Find first criteria node in plan with conjuncts
- List<CandidateJoin> matches = findCandidate(plan, metadata);
+ List<CandidateJoin> matches = findCandidate(plan, metadata, analysisRecord);
boolean pushCriteria = false;
@@ -84,7 +82,7 @@
JoinStrategyType joinStrategy = (JoinStrategyType)joinNode.getProperty(NodeConstants.Info.JOIN_STRATEGY);
- PlanNode chosenNode = chooseDepWithoutCosting(sourceNode, bothCandidates?siblingNode:null);
+ PlanNode chosenNode = chooseDepWithoutCosting(sourceNode, bothCandidates?siblingNode:null, analysisRecord);
if(chosenNode != null) {
pushCriteria |= markDependent(chosenNode, joinNode);
continue;
@@ -148,7 +146,7 @@
* @param node Root node to search
* @param matches Collection to accumulate matches in
*/
- List<CandidateJoin> findCandidate(PlanNode root, QueryMetadataInterface metadata) {
+ List<CandidateJoin> findCandidate(PlanNode root, QueryMetadataInterface metadata, AnalysisRecord analysisRecord) {
List<CandidateJoin> candidates = new ArrayList<CandidateJoin>();
@@ -159,7 +157,7 @@
PlanNode child = (PlanNode)j.next();
child = FrameUtil.findJoinSourceNode(child);
- if(child.hasBooleanProperty(NodeConstants.Info.MAKE_NOT_DEP) || !isValidJoin(joinNode, child)) {
+ if(child.hasBooleanProperty(NodeConstants.Info.MAKE_NOT_DEP) || !isValidJoin(joinNode, child, analysisRecord)) {
continue;
}
if (candidate == null) {
@@ -185,39 +183,48 @@
* join that has the outer side not the same as the dependent.
* @param joinNode The join node to check
* @param sourceNode The access node being considered
+ * @param analysisRecord TODO
* @return True if valid for making dependent
*/
- boolean isValidJoin(PlanNode joinNode, PlanNode sourceNode) {
+ boolean isValidJoin(PlanNode joinNode, PlanNode sourceNode, AnalysisRecord analysisRecord) {
JoinType jtype = (JoinType) joinNode.getProperty(NodeConstants.Info.JOIN_TYPE);
// Check that join is not a CROSS join or FULL OUTER join
if(jtype.equals(JoinType.JOIN_CROSS) || jtype.equals(JoinType.JOIN_FULL_OUTER)) {
- LogManager.logTrace(LogConstants.CTX_QUERY_PLANNER, new Object[] {"Rejecting dependent access node as parent join is CROSS or FULL OUTER: ", sourceNode.nodeToString()}); //$NON-NLS-1$
+ if (analysisRecord.recordDebug()) {
+ analysisRecord.println("Rejecting dependent access node as parent join is CROSS or FULL OUTER: "+ sourceNode.nodeToString()); //$NON-NLS-1$
+ }
return false;
}
// Check that join criteria exist
List jcrit = (List) joinNode.getProperty(NodeConstants.Info.JOIN_CRITERIA);
if(jcrit == null || jcrit.size() == 0) {
- LogManager.logTrace(LogConstants.CTX_QUERY_PLANNER, new Object[] {"Rejecting dependent access node as parent join has no join criteria: ", sourceNode.nodeToString()}); //$NON-NLS-1$
+ if (analysisRecord.recordDebug()) {
+ analysisRecord.println("Rejecting dependent access node as parent join has no join criteria: "+ sourceNode.nodeToString()); //$NON-NLS-1$
+ }
return false;
}
if(joinNode.getProperty(NodeConstants.Info.LEFT_EXPRESSIONS) == null) {
- LogManager.logTrace(LogConstants.CTX_QUERY_PLANNER, new Object[] {"Rejecting dependent access node as parent join has no equality expressions: ", sourceNode.nodeToString()}); //$NON-NLS-1$
+ if (analysisRecord.recordDebug()) {
+ analysisRecord.println("Rejecting dependent access node as parent join has no equality expressions: "+ sourceNode.nodeToString()); //$NON-NLS-1$
+ }
return false;
}
// Check that for a left or right outer join the dependent side must be the inner
if(jtype.isOuter() && JoinUtil.getInnerSideJoinNodes(joinNode)[0] != sourceNode) {
- LogManager.logTrace(LogConstants.CTX_QUERY_PLANNER, new Object[] {"Rejecting dependent access node as it is on outer side of a join: ", sourceNode.nodeToString()}); //$NON-NLS-1$
+ if (analysisRecord.recordDebug()) {
+ analysisRecord.println("Rejecting dependent access node as it is on outer side of a join: "+ sourceNode.nodeToString()); //$NON-NLS-1$
+ }
return false;
}
return true;
}
- PlanNode chooseDepWithoutCosting(PlanNode rootNode1, PlanNode rootNode2) {
+ PlanNode chooseDepWithoutCosting(PlanNode rootNode1, PlanNode rootNode2, AnalysisRecord analysisRecord) {
PlanNode sourceNode1 = FrameUtil.findJoinSourceNode(rootNode1);
PlanNode sourceNode2 = null;
@@ -228,23 +235,31 @@
if (sourceNode2 != null && sourceNode2.hasCollectionProperty(NodeConstants.Info.ACCESS_PATTERNS) ) {
//Return null - query planning should fail because both access nodes
//have unsatisfied access patterns
- LogManager.logTrace(LogConstants.CTX_QUERY_PLANNER, new Object[] {"Neither access node can be made dependent because both have unsatisfied access patterns: ", sourceNode1.nodeToString(), "\n", sourceNode2.toString()}); //$NON-NLS-1$ //$NON-NLS-2$
+ if (analysisRecord.recordDebug()) {
+ analysisRecord.println("Neither access node can be made dependent because both have unsatisfied access patterns: " + sourceNode1.nodeToString() + "\n" + sourceNode2.toString()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
return null;
}
return rootNode1;
} else if (sourceNode2 != null && sourceNode2.hasCollectionProperty(NodeConstants.Info.ACCESS_PATTERNS) ) {
//Access node 2 has unsatisfied access pattern,
//so try to make node 2 dependent
- LogManager.logTrace(LogConstants.CTX_QUERY_PLANNER, new Object[] {"Making access node dependent to satisfy access pattern: ", sourceNode2.nodeToString()}); //$NON-NLS-1$
+ if (analysisRecord.recordDebug()) {
+ analysisRecord.println("Making access node dependent to satisfy access pattern: "+ sourceNode2.nodeToString()); //$NON-NLS-1$
+ }
return rootNode2;
}
// Check for hints, which over-rule heuristics
if(sourceNode1.hasBooleanProperty(NodeConstants.Info.MAKE_DEP)) {
- LogManager.logTrace(LogConstants.CTX_QUERY_PLANNER, new Object[] {"Making access node dependent due to hint: ", sourceNode1.nodeToString()}); //$NON-NLS-1$
+ if (analysisRecord.recordDebug()) {
+ analysisRecord.println("Making access node dependent due to hint: "+ sourceNode1.nodeToString()); //$NON-NLS-1$
+ }
return rootNode1;
} else if(sourceNode2 != null && sourceNode2.hasBooleanProperty(NodeConstants.Info.MAKE_DEP)) {
- LogManager.logTrace(LogConstants.CTX_QUERY_PLANNER, new Object[] {"Making access node dependent due to hint: ", sourceNode2.nodeToString()}); //$NON-NLS-1$
+ if (analysisRecord.recordDebug()) {
+ analysisRecord.println("Making access node dependent due to hint: "+ sourceNode2.nodeToString()); //$NON-NLS-1$
+ }
return rootNode2;
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorManager.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -239,7 +239,7 @@
* @param qr Request that contains the MetaMatrix command information in the transaction.
*/
void logSRCCommand(AtomicRequestMessage qr, ExecutionContext context, Event cmdStatus, Integer finalRowCnt) {
- if (!LogManager.isMessageToBeRecorded(LogConstants.CTX_COMMANDLOGGING, MessageLevel.INFO)) {
+ if (!LogManager.isMessageToBeRecorded(LogConstants.CTX_COMMANDLOGGING, MessageLevel.DETAIL)) {
return;
}
String sqlStr = null;
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 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/DQPCore.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -547,7 +547,7 @@
}
void logMMCommand(RequestWorkItem workItem, Event status, Integer rowCount) {
- if (!LogManager.isMessageToBeRecorded(LogConstants.CTX_COMMANDLOGGING, MessageLevel.INFO)) {
+ if (!LogManager.isMessageToBeRecorded(LogConstants.CTX_COMMANDLOGGING, MessageLevel.DETAIL)) {
return;
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -50,6 +50,7 @@
import com.metamatrix.common.types.DataTypeManager;
import com.metamatrix.core.id.IDGenerator;
import com.metamatrix.core.id.IntegerIDFactory;
+import com.metamatrix.core.log.MessageLevel;
import com.metamatrix.core.util.Assertion;
import com.metamatrix.dqp.DQPPlugin;
import com.metamatrix.dqp.message.RequestID;
@@ -255,7 +256,7 @@
context.setSecurityFunctionEvaluator(new SecurityFunctionEvaluator() {
@Override
public boolean hasRole(String roleType, String roleName) throws MetaMatrixComponentException {
- if (isEntitled() || !useEntitlements) {
+ if (!useEntitlements) {
return true;
}
if (!DATA_ROLE.equalsIgnoreCase(roleType)) {
@@ -450,14 +451,12 @@
} finally {
String debugLog = analysisRecord.getDebugLog();
if(debugLog != null && debugLog.length() > 0) {
- LogManager.logInfo(LogConstants.CTX_DQP, debugLog);
+ LogManager.log(analysisRecord.logDebug()?MessageLevel.INFO:MessageLevel.TRACE, LogConstants.CTX_QUERY_PLANNER, debugLog);
}
}
LogManager.logDetail(LogConstants.CTX_DQP, new Object[] { DQPPlugin.Util.getString("BasicInterceptor.ProcessTree_for__4"), requestId, processPlan }); //$NON-NLS-1$
} catch (QueryMetadataException e) {
- Object[] params = new Object[] { requestId};
- String msg = DQPPlugin.Util.getString("DQPCore.Unknown_query_metadata_exception_while_registering_query__{0}.", params); //$NON-NLS-1$
- throw new QueryPlannerException(e, msg);
+ throw new QueryPlannerException(e, DQPPlugin.Util.getString("DQPCore.Unknown_query_metadata_exception_while_registering_query__{0}.", requestId)); //$NON-NLS-1$
}
}
@@ -470,7 +469,7 @@
debug = option.getDebug();
}
- this.analysisRecord = new AnalysisRecord(getPlan, getPlan, debug);
+ this.analysisRecord = new AnalysisRecord(getPlan, debug);
}
public void processRequest()
@@ -545,15 +544,8 @@
}
protected void validateAccess(Command command) throws QueryValidatorException, MetaMatrixComponentException {
- AuthorizationValidationVisitor visitor = new AuthorizationValidationVisitor(this.workContext.getVDB(), !isEntitled() && this.useEntitlements, this.workContext.getAllowedDataPolicies(), this.workContext.getUserName());
+ AuthorizationValidationVisitor visitor = new AuthorizationValidationVisitor(this.workContext.getVDB(), this.useEntitlements, this.workContext.getAllowedDataPolicies(), this.workContext.getUserName());
validateWithVisitor(visitor, this.metadata, command);
}
- protected boolean isEntitled(){
- if (this.workContext.getSubject() == null) {
- LogManager.logDetail(com.metamatrix.common.log.LogConstants.CTX_AUTHORIZATION,new Object[]{ "Automatically entitling principal", this.workContext.getUserName()}); //$NON-NLS-1$
- return true;
- }
- return false;
- }
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/validator/AuthorizationValidationVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/validator/AuthorizationValidationVisitor.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/validator/AuthorizationValidationVisitor.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -44,6 +44,7 @@
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.api.exception.query.QueryMetadataException;
+import com.metamatrix.common.log.LogConstants;
import com.metamatrix.common.log.LogManager;
import com.metamatrix.core.log.MessageLevel;
import com.metamatrix.dqp.DQPPlugin;
@@ -316,16 +317,15 @@
* Out of resources specified, return the subset for which the specified not have authorization to access.
*/
public Set<String> getInaccessibleResources(DataPolicy.PermissionType action, Set<String> resources, Context context) {
-
- LogManager.logDetail(com.metamatrix.common.log.LogConstants.CTX_AUTHORIZATION, new Object[]{"getInaccessibleResources(", this.userName, ", ", context, ", ", resources, ")"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-
if (!this.useEntitlements) {
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
}
- // Audit - request
- AuditMessage msg = new AuditMessage(context.name(), "getInaccessibleResources-request", this.userName, resources.toArray(new String[resources.size()])); //$NON-NLS-1$
- LogManager.log(MessageLevel.INFO, com.metamatrix.common.log.LogConstants.CTX_AUDITLOGGING, msg);
+ if (LogManager.isMessageToBeRecorded(LogConstants.CTX_AUDITLOGGING, MessageLevel.DETAIL)) {
+ // Audit - request
+ AuditMessage msg = new AuditMessage(context.name(), "getInaccessibleResources-request", this.userName, resources.toArray(new String[resources.size()])); //$NON-NLS-1$
+ LogManager.logDetail(LogConstants.CTX_AUDITLOGGING, msg);
+ }
HashSet<String> results = new HashSet<String>(resources);
@@ -344,13 +344,15 @@
}
}
- if (results.isEmpty()) {
- msg = new AuditMessage(context.name(), "getInaccessibleResources-granted all", this.userName, resources.toArray(new String[resources.size()])); //$NON-NLS-1$
- LogManager.log(MessageLevel.INFO, com.metamatrix.common.log.LogConstants.CTX_AUDITLOGGING, msg);
- } else {
- msg = new AuditMessage(context.name(), "getInaccessibleResources-denied", this.userName, resources.toArray(new String[resources.size()])); //$NON-NLS-1$
- LogManager.log(MessageLevel.INFO, com.metamatrix.common.log.LogConstants.CTX_AUDITLOGGING, msg);
- }
+ if (LogManager.isMessageToBeRecorded(LogConstants.CTX_AUDITLOGGING, MessageLevel.DETAIL)) {
+ if (results.isEmpty()) {
+ AuditMessage msg = new AuditMessage(context.name(), "getInaccessibleResources-granted all", this.userName, resources.toArray(new String[resources.size()])); //$NON-NLS-1$
+ LogManager.logDetail(LogConstants.CTX_AUDITLOGGING, msg);
+ } else {
+ AuditMessage msg = new AuditMessage(context.name(), "getInaccessibleResources-denied", this.userName, resources.toArray(new String[resources.size()])); //$NON-NLS-1$
+ LogManager.logDetail(LogConstants.CTX_AUDITLOGGING, msg);
+ }
+ }
return results;
}
}
Modified: trunk/engine/src/test/java/com/metamatrix/query/analysis/TestAnalysisRecord.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/analysis/TestAnalysisRecord.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/engine/src/test/java/com/metamatrix/query/analysis/TestAnalysisRecord.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -41,7 +41,7 @@
}
public void testQueryPlan() {
- AnalysisRecord rec = new AnalysisRecord(true, false, false);
+ AnalysisRecord rec = new AnalysisRecord(true, false);
assertTrue(rec.recordQueryPlan());
Map plan = new HashMap();
@@ -51,7 +51,7 @@
}
public void testAnnotations() {
- AnalysisRecord rec = new AnalysisRecord(false, true, false);
+ AnalysisRecord rec = new AnalysisRecord(true, false);
assertTrue(rec.recordAnnotations());
QueryAnnotation ann1 = new QueryAnnotation("cat", "ann", "res", QueryAnnotation.MEDIUM); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -60,7 +60,7 @@
rec.addAnnotation(ann1);
rec.addAnnotation(ann2);
- Collection annotations = rec.getAnnotations();
+ Collection<QueryAnnotation> annotations = rec.getAnnotations();
assertEquals(2, annotations.size());
assertTrue(annotations.contains(ann1));
assertTrue(annotations.contains(ann2));
@@ -68,7 +68,7 @@
}
public void testDebugLog() {
- AnalysisRecord rec = new AnalysisRecord(false, false, true);
+ AnalysisRecord rec = new AnalysisRecord(false, true);
assertTrue(rec.recordDebug());
rec.println("a"); //$NON-NLS-1$
Modified: trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestOptimizer.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestOptimizer.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/engine/src/test/java/com/metamatrix/query/optimizer/TestOptimizer.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -282,7 +282,7 @@
// plan
ProcessorPlan plan = null;
if (analysisRecord == null) {
- analysisRecord = new AnalysisRecord(false, false, DEBUG);
+ analysisRecord = new AnalysisRecord(false, DEBUG);
}
if (shouldSucceed) {
try {
Modified: trunk/engine/src/test/java/com/metamatrix/query/optimizer/batch/TestBatchedUpdatePlanner.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/optimizer/batch/TestBatchedUpdatePlanner.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/engine/src/test/java/com/metamatrix/query/optimizer/batch/TestBatchedUpdatePlanner.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -95,7 +95,7 @@
// plan
ProcessorPlan plan = null;
- AnalysisRecord analysisRecord = new AnalysisRecord(false, false, DEBUG);
+ AnalysisRecord analysisRecord = new AnalysisRecord(false, DEBUG);
if (shouldSucceed) {
try {
//do planning
Modified: trunk/engine/src/test/java/com/metamatrix/query/optimizer/proc/TestProcedurePlanner.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/optimizer/proc/TestProcedurePlanner.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/engine/src/test/java/com/metamatrix/query/optimizer/proc/TestProcedurePlanner.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -82,7 +82,7 @@
}
userCommand = QueryRewriter.rewrite(userCommand, metadata, null);
- AnalysisRecord analysisRecord = new AnalysisRecord(false, false, DEBUG);
+ AnalysisRecord analysisRecord = new AnalysisRecord(false, DEBUG);
try {
return QueryOptimizer.optimizePlan(userCommand, metadata, null, new DefaultCapabilitiesFinder(), analysisRecord, null);
Modified: trunk/engine/src/test/java/com/metamatrix/query/optimizer/relational/TestMaterialization.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/optimizer/relational/TestMaterialization.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/engine/src/test/java/com/metamatrix/query/optimizer/relational/TestMaterialization.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -43,16 +43,16 @@
String userSql = "SELECT MATVIEW.E1 FROM MATVIEW"; //$NON-NLS-1$
QueryMetadataInterface metadata = FakeMetadataFactory.exampleMaterializedView();
- AnalysisRecord analysis = new AnalysisRecord(false, true, DEBUG);
+ AnalysisRecord analysis = new AnalysisRecord(true, DEBUG);
Command command = helpGetCommand(userSql, metadata, null);
TestOptimizer.helpPlanCommand(command, metadata, getGenericFinder(), analysis, new String[] {"SELECT g_0.e1 FROM MatTable.MatTable AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
- Collection annotations = analysis.getAnnotations();
+ Collection<QueryAnnotation> annotations = analysis.getAnnotations();
assertNotNull("Expected annotations but got none", annotations); //$NON-NLS-1$
assertTrue("Expected one annotation", annotations.size() == 1); //$NON-NLS-1$
- assertEquals("Expected catagory mat view", ((QueryAnnotation)annotations.iterator().next()).getCategory(), QueryAnnotation.MATERIALIZED_VIEW); //$NON-NLS-1$
+ assertEquals("Expected catagory mat view", annotations.iterator().next().getCategory(), QueryAnnotation.MATERIALIZED_VIEW); //$NON-NLS-1$
}
@Ignore("we no longer auto detect this case, if we need this logic it will have to be added to the rewriter since it changes select into to an insert")
@@ -60,32 +60,32 @@
String userSql = "SELECT MATVIEW.E1 INTO MatTable.MatStage FROM MATVIEW"; //$NON-NLS-1$
QueryMetadataInterface metadata = FakeMetadataFactory.exampleMaterializedView();
- AnalysisRecord analysis = new AnalysisRecord(false, true, DEBUG);
+ AnalysisRecord analysis = new AnalysisRecord(true, DEBUG);
Command command = helpGetCommand(userSql, metadata, null);
TestOptimizer.helpPlanCommand(command, metadata, getGenericFinder(), analysis, new String[] {"SELECT g_0.x FROM MatSrc.MatSrc AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
- Collection annotations = analysis.getAnnotations();
+ Collection<QueryAnnotation> annotations = analysis.getAnnotations();
assertNotNull("Expected annotations but got none", annotations); //$NON-NLS-1$
assertTrue("Expected one annotation", annotations.size() == 1); //$NON-NLS-1$
- assertEquals("Expected catagory mat view", ((QueryAnnotation)annotations.iterator().next()).getCategory(), QueryAnnotation.MATERIALIZED_VIEW); //$NON-NLS-1$
+ assertEquals("Expected catagory mat view", annotations.iterator().next().getCategory(), QueryAnnotation.MATERIALIZED_VIEW); //$NON-NLS-1$
}
@Test public void testMaterializedTransformationNoCache() throws Exception {
String userSql = "SELECT MATVIEW.E1 FROM MATVIEW OPTION NOCACHE MatView.MatView"; //$NON-NLS-1$
QueryMetadataInterface metadata = FakeMetadataFactory.exampleMaterializedView();
- AnalysisRecord analysis = new AnalysisRecord(false, true, DEBUG);
+ AnalysisRecord analysis = new AnalysisRecord(true, DEBUG);
Command command = helpGetCommand(userSql, metadata, null);
TestOptimizer.helpPlanCommand(command, metadata, getGenericFinder(), analysis, new String[] {"SELECT g_0.x FROM MatSrc.MatSrc AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
- Collection annotations = analysis.getAnnotations();
+ Collection<QueryAnnotation> annotations = analysis.getAnnotations();
assertNotNull("Expected annotations but got none", annotations); //$NON-NLS-1$
assertTrue("Expected one annotation", annotations.size() == 1); //$NON-NLS-1$
- assertEquals("Expected catagory mat view", ((QueryAnnotation)annotations.iterator().next()).getCategory(), QueryAnnotation.MATERIALIZED_VIEW); //$NON-NLS-1$
+ assertEquals("Expected catagory mat view", annotations.iterator().next().getCategory(), QueryAnnotation.MATERIALIZED_VIEW); //$NON-NLS-1$
}
//related to defect 14423
@@ -93,23 +93,23 @@
String userSql = "SELECT MATVIEW.E1 FROM MATVIEW OPTION NOCACHE"; //$NON-NLS-1$
QueryMetadataInterface metadata = FakeMetadataFactory.exampleMaterializedView();
- AnalysisRecord analysis = new AnalysisRecord(false, true, DEBUG);
+ AnalysisRecord analysis = new AnalysisRecord(true, DEBUG);
Command command = helpGetCommand(userSql, metadata, null);
TestOptimizer.helpPlanCommand(command, metadata, getGenericFinder(), analysis, new String[] {"SELECT g_0.x FROM MatSrc.MatSrc AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
- Collection annotations = analysis.getAnnotations();
+ Collection<QueryAnnotation> annotations = analysis.getAnnotations();
assertNotNull("Expected annotations but got none", annotations); //$NON-NLS-1$
assertTrue("Expected one annotation", annotations.size() == 1); //$NON-NLS-1$
- assertEquals("Expected catagory mat view", ((QueryAnnotation)annotations.iterator().next()).getCategory(), QueryAnnotation.MATERIALIZED_VIEW); //$NON-NLS-1$
+ assertEquals("Expected catagory mat view", annotations.iterator().next().getCategory(), QueryAnnotation.MATERIALIZED_VIEW); //$NON-NLS-1$
}
@Test public void testNoCacheInTransformation() throws Exception {
String userSql = "SELECT VGROUP.E1 FROM VGROUP"; //$NON-NLS-1$
QueryMetadataInterface metadata = FakeMetadataFactory.exampleMaterializedView();
- AnalysisRecord analysis = new AnalysisRecord(false, true, DEBUG);
+ AnalysisRecord analysis = new AnalysisRecord(true, DEBUG);
Command command = helpGetCommand(userSql, metadata, null);
@@ -120,7 +120,7 @@
String userSql = "SELECT MATVIEW1.E1 FROM MATVIEW1 option nocache matview.matview1"; //$NON-NLS-1$
QueryMetadataInterface metadata = FakeMetadataFactory.exampleMaterializedView();
- AnalysisRecord analysis = new AnalysisRecord(false, true, DEBUG);
+ AnalysisRecord analysis = new AnalysisRecord(true, DEBUG);
Command command = helpGetCommand(userSql, metadata, null);
@@ -131,7 +131,7 @@
String userSql = "SELECT MATVIEW1.E1 FROM MATVIEW1 option nocache"; //$NON-NLS-1$
QueryMetadataInterface metadata = FakeMetadataFactory.exampleMaterializedView();
- AnalysisRecord analysis = new AnalysisRecord(false, true, DEBUG);
+ AnalysisRecord analysis = new AnalysisRecord(true, DEBUG);
Command command = helpGetCommand(userSql, metadata, null);
Modified: trunk/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestRuleAccessPatternValidation.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestRuleAccessPatternValidation.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestRuleAccessPatternValidation.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -119,7 +119,7 @@
System.out.println("EXECUTING " + rule); //$NON-NLS-1$
}
- plan = rule.execute(plan, metadata, FINDER, rules, new AnalysisRecord(false, false, debug), context);
+ plan = rule.execute(plan, metadata, FINDER, rules, new AnalysisRecord(false, debug), context);
if(debug) {
System.out.println("\nAFTER: \n" + plan); //$NON-NLS-1$
}
Modified: trunk/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestRuleChooseDependent.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestRuleChooseDependent.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/engine/src/test/java/com/metamatrix/query/optimizer/relational/rules/TestRuleChooseDependent.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -35,6 +35,7 @@
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.query.QueryMetadataException;
import com.metamatrix.api.exception.query.QueryPlannerException;
+import com.metamatrix.query.analysis.AnalysisRecord;
import com.metamatrix.query.optimizer.TestOptimizer;
import com.metamatrix.query.optimizer.capabilities.FakeCapabilitiesFinder;
import com.metamatrix.query.optimizer.relational.RuleStack;
@@ -168,7 +169,7 @@
public void helpTestValidJoin(PlanNode joinNode, PlanNode accessNode, boolean expectedValid) {
RuleChooseDependent rule = new RuleChooseDependent();
RuleChooseJoinStrategy.chooseJoinStrategy(joinNode, metadata);
- boolean isValid = rule.isValidJoin(joinNode, accessNode);
+ boolean isValid = rule.isValidJoin(joinNode, accessNode, AnalysisRecord.createNonRecordingRecord());
assertEquals("Valid join check is wrong ", expectedValid, isValid); //$NON-NLS-1$
}
Modified: trunk/engine/src/test/java/com/metamatrix/query/optimizer/xml/TestXMLPlanner.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/optimizer/xml/TestXMLPlanner.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/engine/src/test/java/com/metamatrix/query/optimizer/xml/TestXMLPlanner.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -793,7 +793,7 @@
throws QueryPlannerException, QueryMetadataException, MetaMatrixComponentException {
IDGenerator idGenerator = new IDGenerator();
idGenerator.setDefaultFactory(new IntegerIDFactory());
- AnalysisRecord analysis = new AnalysisRecord(false, false, DEBUG);
+ AnalysisRecord analysis = new AnalysisRecord(false, DEBUG);
try {
if (DEBUG) {
System.out.println("\n####################################\n" + command); //$NON-NLS-1$
Modified: trunk/engine/src/test/java/com/metamatrix/query/processor/TestProcessor.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/processor/TestProcessor.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/engine/src/test/java/com/metamatrix/query/processor/TestProcessor.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -144,7 +144,7 @@
static ProcessorPlan helpGetPlan(Command command, QueryMetadataInterface metadata, CapabilitiesFinder capFinder, CommandContext context) {
if(DEBUG) System.out.println("\n####################################\n" + command); //$NON-NLS-1$
- AnalysisRecord analysisRecord = new AnalysisRecord(false, false, DEBUG);
+ AnalysisRecord analysisRecord = new AnalysisRecord(false, DEBUG);
try {
QueryResolver.resolveCommand(command, metadata);
Modified: trunk/engine/src/test/java/com/metamatrix/query/processor/dynamic/TestSqlEval.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/processor/dynamic/TestSqlEval.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/engine/src/test/java/com/metamatrix/query/processor/dynamic/TestSqlEval.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -70,7 +70,7 @@
}
String toXMLString(Source xmlSrc) throws Exception{
- StandardXMLTranslator sxt = new StandardXMLTranslator(xmlSrc, null);
+ StandardXMLTranslator sxt = new StandardXMLTranslator(xmlSrc);
return sxt.getString();
}
Modified: trunk/engine/src/test/java/com/metamatrix/query/processor/proc/TestProcedureProcessor.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/processor/proc/TestProcedureProcessor.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/engine/src/test/java/com/metamatrix/query/processor/proc/TestProcedureProcessor.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -91,7 +91,7 @@
}
QueryRewriter.rewrite(userCommand, metadata, new CommandContext());
- AnalysisRecord analysisRecord = new AnalysisRecord(false, false, DEBUG);
+ AnalysisRecord analysisRecord = new AnalysisRecord(false, DEBUG);
try {
if ( capabilitiesFinder == null ) capabilitiesFinder = new DefaultCapabilitiesFinder();
ProcessorPlan plan = QueryOptimizer.optimizePlan(userCommand, metadata, null, capabilitiesFinder, analysisRecord, null);
Modified: trunk/engine/src/test/java/com/metamatrix/query/processor/xml/TestXMLProcessor.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/processor/xml/TestXMLProcessor.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/engine/src/test/java/com/metamatrix/query/processor/xml/TestXMLProcessor.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -2951,7 +2951,7 @@
if (shouldSucceed){
- AnalysisRecord analysisRecord = new AnalysisRecord(false, false, DEBUG);
+ AnalysisRecord analysisRecord = new AnalysisRecord(false, DEBUG);
CommandContext planningContext = new CommandContext(); //this should be the same as the processing context, but that's not easy to do
ProcessorPlan plan = QueryOptimizer.optimizePlan(command, metadata, null, capFinder, analysisRecord, planningContext);
@@ -2995,7 +2995,7 @@
return plan;
}
Exception expected = null;
- AnalysisRecord analysisRecord = new AnalysisRecord(false, false, DEBUG);
+ AnalysisRecord analysisRecord = new AnalysisRecord(false, DEBUG);
try{
ProcessorPlan plan = QueryOptimizer.optimizePlan(command, metadata, null, new DefaultCapabilitiesFinder(), analysisRecord, null);
@@ -3039,7 +3039,7 @@
private void helpTestProcess(String sql, String[] expectedDocs, FakeMetadataFacade metadata, FakeDataManager dataMgr) throws Exception{
Command command = helpGetCommand(sql, metadata);
- AnalysisRecord analysisRecord = new AnalysisRecord(false, false, DEBUG);
+ AnalysisRecord analysisRecord = new AnalysisRecord(false, DEBUG);
XMLPlan plan = (XMLPlan)QueryOptimizer.optimizePlan(command, metadata, null, new DefaultCapabilitiesFinder(), analysisRecord, null);
if(DEBUG) {
System.out.println(analysisRecord.getDebugLog());
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedPlanCache.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedPlanCache.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestPreparedPlanCache.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -155,7 +155,7 @@
pPlan.setPlan(new RelationalPlan(new ProjectNode(i)));
Map props = new HashMap();
props.put("desc", "desc"+i); //$NON-NLS-1$ //$NON-NLS-2$
- AnalysisRecord analysisRecord = new AnalysisRecord(true, true, false);
+ AnalysisRecord analysisRecord = new AnalysisRecord(true, false);
analysisRecord.setQueryPlan(props);
pPlan.setAnalysisRecord(analysisRecord);
ArrayList refs = new ArrayList();
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/multisource/TestMultiSourcePlanToProcessConverter.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -106,7 +106,7 @@
}
MultiSourceMetadataWrapper wrapper = new MultiSourceMetadataWrapper(metadata, multiSourceModels);
- AnalysisRecord analysis = new AnalysisRecord(false, false, DEBUG);
+ AnalysisRecord analysis = new AnalysisRecord(false, DEBUG);
Command command = TestResolver.helpResolve(userSql, wrapper, analysis);
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -113,14 +113,14 @@
}
public void start() {
- dqpCore.setTransactionService((TransactionService)LogManager.createLoggingProxy(com.metamatrix.common.log.LogConstants.CTX_TXN_LOG, transactionServerImpl, new Class[] {TransactionService.class}, MessageLevel.DETAIL));
+ dqpCore.setTransactionService((TransactionService)LogManager.createLoggingProxy(LogConstants.CTX_TXN_LOG, transactionServerImpl, new Class[] {TransactionService.class}, MessageLevel.DETAIL));
// create the necessary services
createClientServices();
- this.csr.registerClientService(ILogon.class, logon, com.metamatrix.common.log.LogConstants.CTX_SESSION);
- this.csr.registerClientService(DQP.class, proxyService(DQP.class, this.dqpCore), com.metamatrix.common.log.LogConstants.CTX_DQP);
- this.csr.registerClientService(Admin.class, proxyService(Admin.class, admin), com.metamatrix.common.log.LogConstants.CTX_ADMIN_API);
+ this.csr.registerClientService(ILogon.class, logon, LogConstants.CTX_SECURITY);
+ this.csr.registerClientService(DQP.class, proxyService(DQP.class, this.dqpCore), LogConstants.CTX_DQP);
+ this.csr.registerClientService(Admin.class, proxyService(Admin.class, admin), LogConstants.CTX_ADMIN_API);
if (this.jdbcSocketConfiguration.isEnabled()) {
this.jdbcSocket = new SocketTransport(this.jdbcSocketConfiguration, csr);
@@ -133,11 +133,11 @@
if (this.adminSocketConfiguration.isEnabled()) {
this.adminSocket = new SocketTransport(this.adminSocketConfiguration, csr);
this.adminSocket.start();
- LogManager.logInfo(com.metamatrix.common.log.LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("socket_enabled","Teiid Admin", (this.adminSocketConfiguration.getSSLConfiguration().isSslEnabled()?"mms://":"mm://")+this.adminSocketConfiguration.getHostAddress().getHostName()+":"+this.adminSocketConfiguration.getPortNumber())); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("socket_enabled","Teiid Admin", (this.adminSocketConfiguration.getSSLConfiguration().isSslEnabled()?"mms://":"mm://")+this.adminSocketConfiguration.getHostAddress().getHostName()+":"+this.adminSocketConfiguration.getPortNumber())); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
} else {
- LogManager.logInfo(com.metamatrix.common.log.LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("socket_not_enabled", "admin connections")); //$NON-NLS-1$ //$NON-NLS-2$
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("socket_not_enabled", "admin connections")); //$NON-NLS-1$ //$NON-NLS-2$
}
- LogManager.logInfo(com.metamatrix.common.log.LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("engine_started", new Date(System.currentTimeMillis()).toString())); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("engine_started", new Date(System.currentTimeMillis()).toString())); //$NON-NLS-1$
}
public void stop() {
@@ -158,7 +158,7 @@
this.adminSocket.stop();
this.adminSocket = null;
}
- LogManager.logInfo(com.metamatrix.common.log.LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("engine_stopped", new Date(System.currentTimeMillis()).toString())); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("engine_stopped", new Date(System.currentTimeMillis()).toString())); //$NON-NLS-1$
}
private void createClientServices() {
Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -123,7 +123,7 @@
// now save the change in the configuration.
saveVDB(vdb);
- LogManager.logInfo(LogConstants.CTX_DQP, RuntimePlugin.Util.getString("VDBService.vdb_change_status", new Object[] { vdbName, vdbVersion, status})); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, RuntimePlugin.Util.getString("VDBService.vdb_change_status", new Object[] { vdbName, vdbVersion, status})); //$NON-NLS-1$
}
}
Modified: trunk/runtime/src/main/java/org/teiid/logging/Log4JUtil.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/logging/Log4JUtil.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/runtime/src/main/java/org/teiid/logging/Log4JUtil.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -104,9 +104,7 @@
contexts.add(ROOT_CONTEXT+com.metamatrix.common.log.LogConstants.CTX_TXN_LOG);
contexts.add(ROOT_CONTEXT+com.metamatrix.common.log.LogConstants.CTX_COMMANDLOGGING);
contexts.add(ROOT_CONTEXT+com.metamatrix.common.log.LogConstants.CTX_AUDITLOGGING);
- contexts.add(ROOT_CONTEXT+com.metamatrix.common.log.LogConstants.CTX_SESSION);
- contexts.add(ROOT_CONTEXT+com.metamatrix.common.log.LogConstants.CTX_AUTHORIZATION);
- contexts.add(ROOT_CONTEXT+com.metamatrix.common.log.LogConstants.CTX_MEMBERSHIP);
+ contexts.add(ROOT_CONTEXT+com.metamatrix.common.log.LogConstants.CTX_SECURITY);
contexts.add(ROOT_CONTEXT+com.metamatrix.common.log.LogConstants.CTX_TRANSPORT);
contexts.add(ROOT_CONTEXT+com.metamatrix.common.log.LogConstants.CTX_ADMIN_API);
contexts.add(ROOT_CONTEXT+com.metamatrix.common.log.LogConstants.CTX_QUERY_PLANNER);
Modified: trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -97,21 +97,21 @@
for (SessionMetadata info : sessionCache.values()) {
try {
if (!info.isEmbedded() && currentTime - info.getLastPingTime() > ServerConnection.PING_INTERVAL * 5) {
- LogManager.logInfo(LogConstants.CTX_SESSION, RuntimePlugin.Util.getString( "SessionServiceImpl.keepaliveFailed", info.getSessionId())); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_SECURITY, RuntimePlugin.Util.getString( "SessionServiceImpl.keepaliveFailed", info.getSessionId())); //$NON-NLS-1$
closeSession(info.getSessionId());
} else if (sessionExpirationTimeLimit > 0 && currentTime - info.getCreatedTime() > sessionExpirationTimeLimit) {
- LogManager.logInfo(LogConstants.CTX_SESSION, RuntimePlugin.Util.getString( "SessionServiceImpl.expireSession", info.getSessionId())); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_SECURITY, RuntimePlugin.Util.getString( "SessionServiceImpl.expireSession", info.getSessionId())); //$NON-NLS-1$
closeSession(info.getSessionId());
}
} catch (Exception e) {
- LogManager.logDetail(LogConstants.CTX_SESSION, e, "error running session monitor, unable to monitor: " + info.getSessionId()); //$NON-NLS-1$
+ LogManager.logDetail(LogConstants.CTX_SECURITY, e, "error running session monitor, unable to monitor: " + info.getSessionId()); //$NON-NLS-1$
}
}
}
@Override
public void closeSession(long sessionID) throws InvalidSessionException {
- LogManager.logDetail(LogConstants.CTX_SESSION, new Object[] {"closeSession", sessionID}); //$NON-NLS-1$
+ LogManager.logDetail(LogConstants.CTX_SECURITY, new Object[] {"closeSession", sessionID}); //$NON-NLS-1$
SessionMetadata info = this.sessionCache.remove(sessionID);
if (info == null) {
throw new InvalidSessionException(RuntimePlugin.Util.getString("SessionServiceImpl.invalid_session", sessionID)); //$NON-NLS-1$
@@ -120,7 +120,7 @@
try {
dqp.terminateSession(info.getSessionId());
} catch (Exception e) {
- LogManager.logWarning(LogConstants.CTX_SESSION,e,"Exception terminitating session"); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_SECURITY,e,"Exception terminitating session"); //$NON-NLS-1$
}
}
@@ -131,7 +131,7 @@
context.logout();
}
} catch (LoginException e) {
- LogManager.logWarning(LogConstants.CTX_SESSION,e,"Exception terminitating session"); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_SECURITY,e,"Exception terminitating session"); //$NON-NLS-1$
}
}
@@ -141,8 +141,6 @@
ArgCheck.isNotNull(applicationName);
ArgCheck.isNotNull(properties);
- Properties productInfo = new Properties();
-
LoginContext loginContext = null;
String securityDomain = "none"; //$NON-NLS-1$
Object securityContext = null;
@@ -173,10 +171,6 @@
else {
vdb = this.vdbRepository.getVDB(vdbName, Integer.parseInt(vdbVersion));
}
-
- // Reset product info with validated constants
- productInfo.put(TeiidURL.JDBC.VDB_NAME, vdb.getName());
- productInfo.put(TeiidURL.JDBC.VDB_VERSION, vdb.getVersion());
} catch (VirtualDatabaseException e) {
throw new SessionServiceException(RuntimePlugin.Util.getString("VDBService.VDB_does_not_exist._2", vdbName, vdbVersion==null?"latest":vdbVersion)); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -208,7 +202,7 @@
newSession.setSecurityContext(securityContext);
newSession.setVdb(vdb);
newSession.setSessionToken(new SessionToken(id, userName));
- LogManager.logDetail(LogConstants.CTX_SESSION, new Object[] {"Logon successful for \"", userName, "\" - created SessionID \"", "" + id, "\"" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ LogManager.logDetail(LogConstants.CTX_SECURITY, new Object[] {"Logon successful for \"", userName, "\" - created SessionID \"", "" + id, "\"" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
this.sessionCache.put(newSession.getSessionId(), newSession);
return newSession;
}
@@ -260,12 +254,12 @@
@Override
public boolean terminateSession(long terminatedSessionID, long adminSessionID) {
Object[] params = {adminSessionID, terminatedSessionID};
- LogManager.logInfo(LogConstants.CTX_SESSION, RuntimePlugin.Util.getString( "SessionServiceImpl.terminateSession", params)); //$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_SECURITY, RuntimePlugin.Util.getString( "SessionServiceImpl.terminateSession", params)); //$NON-NLS-1$
try {
closeSession(terminatedSessionID);
return true;
} catch (InvalidSessionException e) {
- LogManager.logWarning(LogConstants.CTX_SESSION,e,RuntimePlugin.Util.getString("SessionServiceImpl.invalid_session", new Object[] {e.getMessage()})); //$NON-NLS-1$
+ LogManager.logWarning(LogConstants.CTX_SECURITY,e,RuntimePlugin.Util.getString("SessionServiceImpl.invalid_session", new Object[] {e.getMessage()})); //$NON-NLS-1$
return false;
}
}
@@ -305,7 +299,7 @@
public void setSecurityDomains(String domainNameOrder) {
if (domainNameOrder != null && domainNameOrder.trim().length()>0) {
- LogManager.logDetail(LogConstants.CTX_MEMBERSHIP, "Security Enabled: true"); //$NON-NLS-1$
+ LogManager.logDetail(LogConstants.CTX_SECURITY, "Security Enabled: true"); //$NON-NLS-1$
String[] domainNames = domainNameOrder.split(","); //$NON-NLS-1$
for (String domainName : domainNames) {
@@ -316,7 +310,7 @@
public void setAdminSecurityDomain(String domain) {
this.adminSecurityDomains.add(domain);
- LogManager.logDetail(LogConstants.CTX_MEMBERSHIP, "Admin Security Enabled: true"); //$NON-NLS-1$
+ LogManager.logDetail(LogConstants.CTX_SECURITY, "Admin Security Enabled: true"); //$NON-NLS-1$
}
public void start() {
Modified: trunk/runtime/src/main/java/org/teiid/services/TeiidLoginContext.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/services/TeiidLoginContext.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/runtime/src/main/java/org/teiid/services/TeiidLoginContext.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -59,7 +59,7 @@
public void authenticateUser(String username, Credentials credential, String applicationName, List<String> domains) throws LoginException {
- LogManager.logDetail(LogConstants.CTX_MEMBERSHIP, new Object[] {"authenticateUser", username, applicationName}); //$NON-NLS-1$
+ LogManager.logDetail(LogConstants.CTX_SECURITY, new Object[] {"authenticateUser", username, applicationName}); //$NON-NLS-1$
final String baseUsername = getBaseUsername(username);
final char[] password = credential.getCredentialsAsCharArray();
@@ -92,10 +92,10 @@
this.loginContext.login();
this.userName = baseUsername+AT+domain;
this.securitydomain = domain;
- LogManager.logDetail(LogConstants.CTX_MEMBERSHIP, new Object[] {"Logon successful for \"", username, "\""}); //$NON-NLS-1$ //$NON-NLS-2$
+ LogManager.logDetail(LogConstants.CTX_SECURITY, new Object[] {"Logon successful for \"", username, "\""}); //$NON-NLS-1$ //$NON-NLS-2$
return;
} catch (LoginException e) {
- LogManager.logDetail(LogConstants.CTX_MEMBERSHIP,e, e.getMessage());
+ LogManager.logDetail(LogConstants.CTX_SECURITY,e, e.getMessage());
}
}
throw new LoginException(RuntimePlugin.Util.getString("SessionServiceImpl.The_username_0_and/or_password_are_incorrect", username )); //$NON-NLS-1$
Modified: trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/BaseQueryTest.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/BaseQueryTest.java 2010-03-25 16:42:20 UTC (rev 2000)
+++ trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/BaseQueryTest.java 2010-03-25 16:55:55 UTC (rev 2001)
@@ -60,7 +60,7 @@
Command command = TestOptimizer.helpGetCommand(sql, metadata, null);
// plan
- AnalysisRecord analysisRecord = new AnalysisRecord(false, debug, debug);
+ AnalysisRecord analysisRecord = new AnalysisRecord(false, debug);
ProcessorPlan plan = null;
try {
plan = QueryOptimizer.optimizePlan(command, metadata, null, capFinder, analysisRecord, createCommandContext());
14 years, 9 months
teiid SVN: r2000 - in trunk/documentation/connector-developer-guide/src/main/docbook/en-US: content and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-03-25 12:42:20 -0400 (Thu, 25 Mar 2010)
New Revision: 2000
Added:
trunk/documentation/connector-developer-guide/src/main/docbook/en-US/content/examples.xml
trunk/documentation/connector-developer-guide/src/main/docbook/en-US/content/extending-jdbc-connector.xml
Modified:
trunk/documentation/connector-developer-guide/src/main/docbook/en-US/connector_developer_guide.xml
Log:
merging jdbc connector guide with the connector guide. Note: the connector guide is still out of date.
Modified: trunk/documentation/connector-developer-guide/src/main/docbook/en-US/connector_developer_guide.xml
===================================================================
--- trunk/documentation/connector-developer-guide/src/main/docbook/en-US/connector_developer_guide.xml 2010-03-25 15:15:25 UTC (rev 1999)
+++ trunk/documentation/connector-developer-guide/src/main/docbook/en-US/connector_developer_guide.xml 2010-03-25 16:42:20 UTC (rev 2000)
@@ -51,6 +51,8 @@
<xi:include href="content/connector-deployment.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="content/connection-pooling.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="content/lob-support.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="content/extending-jdbc-connector.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="content/examples.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="content/appendix-a.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
</book>
Copied: trunk/documentation/connector-developer-guide/src/main/docbook/en-US/content/examples.xml (from rev 1988, trunk/documentation/jdbc-connector-guide/src/main/docbook/en-US/content/examples.xml)
===================================================================
--- trunk/documentation/connector-developer-guide/src/main/docbook/en-US/content/examples.xml (rev 0)
+++ trunk/documentation/connector-developer-guide/src/main/docbook/en-US/content/examples.xml 2010-03-25 16:42:20 UTC (rev 2000)
@@ -0,0 +1,212 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+<chapter id="examples">
+ <title>JDBC Extension Examples</title>
+ <para>This chapter contains a series of examples showing how to extend the JDBC Connector for different common scenarios. </para>
+ <sect1>
+ <title>Adding Support for a Scalar Function</title>
+ <sect2>
+ <title>Overview</title>
+ <para>For this example we consider how a connector might provide support for accepting a function supported by MetaMatrix. See the following section for adding support for a new function unknown to MetaMatrix. This example will show you how to declare support for the function and modify how the function is passed to the data source.</para>
+ <para>Following is a summary of all the steps in supporting a new scalar function:</para>
+ <orderedlist>
+ <listitem>
+ <para>Modify the capabilities class to declare support for the function (REQUIRED)</para>
+ </listitem>
+ <listitem>
+ <para>Implement a FunctionModifier to change how a function is translated (OPTIONAL)</para>
+ </listitem>
+ <listitem>
+ <para>Implement a SQLTranslator extension and register the new function modifier (OPTIONAL)</para>
+ </listitem>
+ </orderedlist>
+ <para>The capabilities class has a method getSupportedFunctions() that declares all the scalar functions that can be supported by the connector. To add support for a new function, extend an existing capabilities class (like the base JDBC class JDBCCapabilities or the provided base class in the Connector API, BasicConnectorCapabilities). </para>
+ <para>Below is an example of an extended capabilities class to add support for the “abs” absolute value function:</para>
+ <programlisting><![CDATA[
+ package my.connector;
+
+ import java.util.ArrayList;
+ import java.util.List;
+ import com.metamatrix.connector.jdbc.JDBCCapabilities;
+
+ public class ExtendedCapabilities extends JDBCCapabilities {
+ public List getSupportedFunctions() {
+ List supportedFunctions = new ArrayList();
+ supportedFunctions.addAll(super.getSupportedFunctions());
+ supportedFunctions.add("ABS");
+ return supportedFunctions;
+ }
+ }
+ ]]></programlisting>
+ <para>In general, it is a good idea to call super.getSupportedFunctions() to ensure that you retain any function support provided by the connector you are extending.</para>
+ <para>This may be all that is needed to support a MetaMatrix function if the JDBC data source supports the same syntax as MetaMatrix. The built-in SQL translation will translate most functions as: “function(arg1, arg2, …)”.</para>
+ </sect2>
+ <sect2>
+ <title>Using FunctionModifiers</title>
+ <para>In some cases you may need to translate the function differently or even insert additional function calls above or below the function being translated. The JDBC Connector provides an interface FunctionModifier and a base class BasicFunctionModifier that can be used to register function translations in a SQLTranslator extension. </para>
+ <para>The FunctionModifier interface has two methods: modify and translate. Generally, it is recommended to subclass BasicFunctionModifier and override one method or the other, but not both. Use the modify method to modify the function language objects or otherwise change the attributes of the existing function. Use the translate method to change the way the function is represented; this is typically only necessary when using a non-standard function form with special operators or ways of representing parameters. </para>
+ <para>Below is an example of using a FunctionModifier to modify the incoming function. This particular example is from the Oracle JDBC Connector and is translating the MetaMatrix function HOUR(ts) which takes a timestamp and returns the hour part into the Oracle equivalent TO_NUMBER(TO_CHAR(ts, ‘HH24’)). It demonstrates the use of the ILanguageFactory to construct new functions and literal values.</para>
+ <programlisting><![CDATA[
+ package com.metamatrix.connector.jdbc.oracle;
+
+ import com.metamatrix.connector.jdbc.extension.FunctionModifier;
+ import com.metamatrix.connector.jdbc.extension.impl.BasicFunctionModifier;
+ import com.metamatrix.data.language.*;
+
+ /**
+ * Convert the HOUR function into an equivalent Oracle function.
+ * HOUR(ts) --> TO_NUMBER(TO_CHAR(ts, 'HH24'))
+ */
+ public class HourFunctionModifier extends BasicFunctionModifier implements FunctionModifier {
+
+ private ILanguageFactory langFactory;
+
+ public HourFunctionModifier(ILanguageFactory langFactory) {
+ this.langFactory = langFactory;
+ }
+
+ public IExpression modify(IFunction function) {
+ IExpression[] args = function.getParameters();
+
+ IFunction innerFunction = langFactory.createFunction("TO_CHAR",
+ new IExpression[] {
+ args[0],
+ langFactory.createLiteral("HH24", String.class)},
+ String.class);
+
+ IFunction outerFunction = langFactory.createFunction("TO_NUMBER",
+ new IExpression[] { innerFunction },
+ Integer.class);
+
+ return outerFunction;
+ }
+ }
+ ]]></programlisting>
+
+ <para>Below is an example of overriding just the translate method to translate the MOD(a, b) function into an operator form for Sybase (a % b). The translate method returns a list of strings and language objects that will be assembled by the translator into a final string. The strings will be used as is and the language objects will be further processed by the translator.</para>
+
+ <programlisting><![CDATA[
+ package com.metamatrix.connector.jdbc.sybase;
+
+ import java.util.ArrayList;
+ import java.util.List;
+
+ import com.metamatrix.connector.jdbc.extension.FunctionModifier;
+ import com.metamatrix.data.language.IExpression;
+ import com.metamatrix.data.language.IFunction;
+
+ public class ModFunctionModifier implements FunctionModifier {
+
+ public IExpression modify(IFunction function) {
+ return function;
+ }
+
+ public List translate(IFunction function) {
+ List parts = new ArrayList();
+ parts.add("(");
+ IExpression[] args = function.getParameters();
+ parts.add(args[0]);
+ parts.add(" % ");
+ parts.add(args[1]);
+ parts.add(")");
+ return parts;
+ }
+ }
+ ]]></programlisting>
+
+ <para>In addition to building your own FunctionModifiers, there are a number of pre-built generic function modifiers that are provided with the connector. </para>
+
+ <table frame='all'>
+ <title>Connection Factories</title>
+ <tgroup cols='2' align='left' colsep='1' rowsep='1'>
+ <colspec colname='c1' colwidth="1*"/>
+ <colspec colname='c2' colwidth=".5*"/>
+ <thead>
+ <row>
+ <entry><para>Modifier</para></entry>
+ <entry><para>Description</para></entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><para>AliasModifier</para></entry>
+ <entry><para>Handles simply renaming a function (“ucase” to “upper” for example)</para></entry>
+ </row>
+ <row>
+ <entry><para>DropFunctionModifier</para></entry>
+ <entry><para>Replaces a function with the function’s first argument, effectively dropping the function call if it is unnecessary – useful with unneeded type conversions</para></entry>
+ </row>
+ <row>
+ <entry><para>EscapeSyntaxModifier</para></entry>
+ <entry><para>Wraps a function in the standard JDBC escape syntax for functions: {fn xxxx()}</para></entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <para>To register the function modifiers for your supported functions, you must implement a SQLTranslator extension class. Below is an example that registers some functions.</para>
+ <programlisting><![CDATA[
+ package my.connector;
+
+ import java.util.HashMap;
+ import java.util.Map;
+
+ import com.metamatrix.connector.jdbc.extension.impl.BasicSQLTranslator;
+ import com.metamatrix.data.api.ConnectorEnvironment;
+ import com.metamatrix.data.exception.ConnectorException;
+ import com.metamatrix.data.metadata.runtime.RuntimeMetadata;
+
+ public class ExtendedSQLTranslator extends BasicSQLTranslator {
+
+ private Map modifiers;
+
+ public void initialize(ConnectorEnvironment env, RuntimeMetadata metadata)
+ throws ConnectorException {
+
+ super.initialize(env, metadata);
+
+ modifiers = new HashMap(super.getFunctionModifiers());
+ modifiers.put("abs", new MyAbsModifier());
+ modifiers.put("concat", new AliasModifier(“concat2”));
+ }
+
+ public Map getFunctionModifiers() {
+ return this.modifiers;
+ }
+ }
+ ]]></programlisting>
+ <para>Support for the two functions being registered (“abs” and “concat”) must be declared in the capabilities class as well. Functions that do not have modifiers registered will be translated as usual. In this example, no attempt is made to add to the list of modifiers for the parent class as it does not register any modifiers. However, if you are extending an existing SQLTranslator, you may need to take this into account to add support rather than replace those modifiers defined by the parent class.</para>
+ </sect2>
+ </sect1>
+ <sect1>
+ <title>Pushdown Scalar Functions</title>
+ <para>“Pushdown” scalar functions are special in that they are functions new to MetaMatrix that can be “pushed down” to the connector. Implementing support for a pushdown scalar function is identical to implementing support for a standard MetaMatrix function except that the function must be declared to MetaMatrix as such. This allows MetaMatrix to properly parse and resolve queries using the pushdown function.</para>
+ <para>Pushdown scalar functions are modeled as user-defined functions with a special attribute. They differ from normal user-defined functions in that no code is provided and the MetaMatrix engine does not how to execute the function. Pushdown functions typically must be passed to the connector for evaluation. User-defined scalar functions have a special pushdown attribute that should be set to “Required” when modeling a pushdown function. </para>
+ <para>For more information on modeling user-defined scalar functions, see the MetaMatrix Custom Scalar Functions Tutorial.</para>
+ </sect1>
+
+ <sect1>
+ <title>Connection Pool Test Queries</title>
+ <para>The JDBCSourceConnectionFactory provides a method createConnectionStrategy() that allows subclasses to provide a custom implementation of the ConnectionStrategy interface. The ConnectionStrategy interface provides a means to check a JDBC Connection for whether it is alive or dead. If no ConnectionStrategy is specified by returning null (the default), then the Connection.isClosed() method is used to check this. </para>
+ <para>However, the isClosed() method does not actively test the connection to the database in most JDBC drivers. By providing an instance of the ConnectionQueryStrategy, you can cause a test query to be executed against the data source instead. </para>
+ <para>Below is an example from the DB2 Connector that creates a custom connection factory that uses a DB2-specific test query to test connection liveliness:</para>
+
+ <programlisting><![CDATA[
+ package com.metamatrix.connector.jdbc.db2;
+
+ import com.metamatrix.connector.jdbc.ConnectionQueryStrategy;
+ import com.metamatrix.connector.jdbc.ConnectionStrategy;
+ import com.metamatrix.connector.jdbc.JDBCSingleIdentityConnectionFactory;
+
+ public class DB2SingleIdentityConnectionFactory extends JDBCSingleIdentityConnectionFactory{
+ private String queryTest = "Select 'x' from sysibm.systables where 1 = 2";
+
+ protected ConnectionStrategy createConnectionStrategy() {
+ return new ConnectionQueryStrategy(queryTest,
+ this.sourceConnectionTestInterval);
+ }
+ }
+ ]]></programlisting>
+
+ <para>It is recommended that you for any custom JDBC Connector you should implement a custom connection factory extension as this will allow the pool to better manage connections and detect data source failures accurately.</para>
+ </sect1>
+</chapter>
\ No newline at end of file
Property changes on: trunk/documentation/connector-developer-guide/src/main/docbook/en-US/content/examples.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/documentation/connector-developer-guide/src/main/docbook/en-US/content/extending-jdbc-connector.xml (from rev 1988, trunk/documentation/jdbc-connector-guide/src/main/docbook/en-US/content/extending-jdbc-connector.xml)
===================================================================
--- trunk/documentation/connector-developer-guide/src/main/docbook/en-US/content/extending-jdbc-connector.xml (rev 0)
+++ trunk/documentation/connector-developer-guide/src/main/docbook/en-US/content/extending-jdbc-connector.xml 2010-03-25 16:42:20 UTC (rev 2000)
@@ -0,0 +1,229 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+<chapter id="extendingjdbc">
+ <title>Extending the JDBC Connector</title>
+ <para>The JDBC Connector can be extended to handle new JDBC drivers and database versions. This chapter outlines the process by which a customer or consultant can modify the behavior of the JDBC Connector for a new source</para>
+
+
+ <sect1>
+ <title>Extension Interfaces</title>
+ <para>The JDBC Connector provides four extension interfaces that can be used to customize its behavior. Activate an extension by implementing the appropriate interface and specifying the implementation class name in the appropriate connector binding property.</para>
+ <para>The JDBC Connector loads each of the implementations of these interfaces via reflection and requires that each of these classes have a no-argument constructor. Each extension class will be loaded exactly once and use for the life of a connector binding. Connector bindings never share instances of the extension classes.</para>
+ <para>This table summarizes the available extension points and their purpose. Following the table is a more detailed look at each extension type.</para>
+
+ <table frame='all'>
+ <title>Extension Interfaces</title>
+ <tgroup cols='3' align='left' colsep='1' rowsep='1'>
+ <colspec colname='c1' colwidth="1*"/>
+ <colspec colname='c2' colwidth=".5*"/>
+ <colspec colname='c3' colwidth="2*"/>
+ <thead>
+ <row>
+ <entry><para>Extension</para></entry>
+ <entry><para>Connector Property</para></entry>
+ <entry><para>Purpose</para></entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><para>Connection Factory</para></entry>
+ <entry><para>ExtensionConnectionFactoryClass</para></entry>
+ <entry><para>Customize connection creation and pooling.</para></entry>
+ </row>
+ <row>
+ <entry><para>Connector Capabilities</para></entry>
+ <entry><para>ExtensionCapabilityClass</para></entry>
+ <entry><para>Specify the SQL syntax and functions the source supports.</para></entry>
+ </row>
+ <row>
+ <entry><para>SQL Translator</para></entry>
+ <entry><para>ExtensionSQLTranslationClass</para></entry>
+ <entry><para>Customize what SQL syntax is used, how source-specific functions are supported, how procedures are executed.</para></entry>
+ </row>
+ <row>
+ <entry><para>Results Translator</para></entry>
+ <entry><para>ExtensionResultsTranslationClass</para></entry>
+ <entry><para>Customize how results are retrieved from JDBC and translated.</para></entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <sect2>
+ <title>Connection Factory Extension</title>
+ <para>The Connection Factory extension can be used to plug in a new factory for creating JDBC Connection objects. The factory class is used within the JDBC connection pool and also controls how connections are pooled and maintained. The Connection Factory implementation class is constructed once and reused throughout the life of the connector.</para>
+ <para>The interface to implement is the standard connection factory interface from the Connector API connection pool utility: com.metamatrix.data.pool.SourceConnectionFactory. This interface and its implementation are described in detail in the Connector Developer’s Guide chapter on connection pooling. </para>
+ <para>However, the JDBC Connector provides a number of useful abstract implementations that can make the implementation somewhat easier:</para>
+
+ <table frame='all'>
+ <title>Connection Factories</title>
+ <tgroup cols='4' align='left' colsep='1' rowsep='1'>
+ <colspec colname='c1' colwidth="1*"/>
+ <colspec colname='c2' colwidth=".5*"/>
+ <colspec colname='c3' colwidth="2*"/>
+ <colspec colname='c4' colwidth="2*"/>
+ <thead>
+ <row>
+ <entry><para>Class</para></entry>
+ <entry><para>Pooling</para></entry>
+ <entry><para>Connection Type</para></entry>
+ <entry><para>Description</para></entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><para>SourceConnection Factory</para></entry>
+ <entry><para>Depends on implementation</para></entry>
+ <entry><para>Depends on implementation</para></entry>
+ <entry><para>This is the basic interface – implementing at this level gives you complete freedom to create connections and control pooling in whatever way necessary.</para></entry>
+ </row>
+ <row>
+ <entry><para>JDBCSource ConnectionFactory</para></entry>
+ <entry><para>Depends on implementation</para></entry>
+ <entry><para>Depends on implementation</para></entry>
+ <entry><para>Adds JDBC-specific facilities for connection events, interpreting transaction isolation levels, strategies for determing whether connection is alive, etc.</para></entry>
+ </row>
+ <row>
+ <entry><para>JDBCSingleIdentity ConnectionFactory</para></entry>
+ <entry><para>Create a single connection pool for all connections in a connector binding using the connector binding connection properties.</para></entry>
+ <entry><para>DriverManager</para></entry>
+ <entry><para>Uses a single pool (the most common usage) and DriverManager to obtain connections.</para></entry>
+ </row>
+ <row>
+ <entry><para>JDBCSingleIdentity DSConnectionFactory</para></entry>
+ <entry><para>Create a single connection pool for all connections in a connector binding using the connector binding connection properties.</para></entry>
+ <entry><para>DataSource</para></entry>
+ <entry><para>Uses a single pool (the most common usage) and a DataSource to obtain connections.</para></entry>
+ </row>
+ <row>
+ <entry><para>JDBCUserIdentity ConnectionFactory</para></entry>
+ <entry><para>Create one pool per MetaMatrix user. Subclasses must determine how to obtain each user’s authentication information from the connector properties or trusted payloads.</para></entry>
+ <entry><para>DriverManager</para></entry>
+ <entry><para>Uses a per-user pool when pooling connections.</para></entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <para>For more information on how to subclass and use these abstract classes, see the examples later in this chapter.</para>
+ </sect2>
+
+ <sect2>
+ <title>Connector Capabilities Extension</title>
+ <para>This extension must implement the com.metamatrix.data.api.ConnectorCapabilities interface, which is the standard Connector API interface for describing connector capabilities. </para>
+ <para>It is strongly recommended that any implementation of the ConnectorCapabilities interface should subclass the JDBC version com.metamatrix.connector.jdbc.extension.JDBCCapabilities or minimally, the com.metamatrix.data.basic.BasicConnectorCapabilities base class. Subclassing these will protect custom implementations from breaking when new capabilities are added to the API. </para>
+ <para>This extension often must be modified in tandem with the SQL Translation Extension to modify the capabilities of the connector. The most common example is adding support for a scalar function – this requires both declaring that the connector has the capability to execute the function and often modifying the SQL Translator to translate the function appropriately for the source.</para>
+ <para>Another common example is turning off unsupported SQL capabilities (such as outer joins or subqueries) for less sophisticated JDBC sources. </para>
+ </sect2>
+
+ <sect2>
+ <title>SQL Translation Extension</title>
+ <para>The com.metamatrix.connector.jdbc.extension.SQLTranslator interface defines this extension. It provides ways to modify the command entering the JDBC Connector (in object form) before it is sent to the JDBC driver (as an SQL string). The JDBC Connector defines a base class that should be subclassed when implementing this extension</para>
+
+ <para><emphasis>com.metamatrix.connector.jdbc.extension.impl.BasicSQLTranslator</emphasis></para>
+
+ <para>The SQLTranslator implementation class is constructed once and reused throughout the life of the connector, so it must not maintain any query-specific state. </para>
+ <para>Common functions that the SQLTranslator can perform are:</para>
+
+ <orderedlist>
+ <listitem>
+ <para>Arbitrarily modify the object form of a command before translation </para>
+ </listitem>
+ <listitem>
+ <para>Register one or more “function modifiers” that define how a scalar function should be modified or transformed</para>
+ </listitem>
+ <listitem>
+ <para>Change the way SQL strings are formed from the object for m of a command</para>
+ </listitem>
+ </orderedlist>
+ <para>For more information on how these functions can be performed, see the examples later in this chapter.</para>
+ </sect2>
+
+ <sect2>
+ <title>Results Translation Extension</title>
+ <para>The com.metamatrix.connector.jdbc.extension.ResultsTranslator interface defines ways to modify the results as they are read and returned from the JDBC driver to the MetaMatrix Server. The ResultsTranslator implementation class is constructed once and reused throughout the life of the connector, so it should generally not maintain any query-specific state. Common functions that the ResultsTranslator can perform are:</para>
+ <orderedlist>
+ <listitem>
+ <para>Execute a stored procedure against the driver</para>
+ </listitem>
+ <listitem>
+ <para>Execute a prepared statement with large objects against the driver</para>
+ </listitem>
+ <listitem>
+ <para>Execute a statement for bulk insert</para>
+ </listitem>
+ <listitem>
+ <para>Retrieve values from the JDBC ResultSet</para>
+ </listitem>
+ <listitem>
+ <para>Translate values returned from JDBC into the types expected by MetaMatrix</para>
+ </listitem>
+ <listitem>
+ <para>Arbitrarily modify a batch of results</para>
+ </listitem>
+ </orderedlist>
+
+ <para>For more information on how these functions can be performed, see the examples later in this chapter.</para>
+ </sect2>
+ </sect1>
+
+ <sect1>
+ <title>Developing Extensions</title>
+ <para>When developing a new JDBC Connector extension, you should start with the development environment used to develop any connector, as defined in the Connector Developer’s Guide. Standard connector development requires the inclusion of the following jar: </para>
+ <orderedlist>
+ <listitem>
+ <para>metamatrix-cdk.jar – This jar contains the complete environment needed for developing custom connectors. It can be found in the MetaMatrix Tools kit.</para>
+ </listitem>
+ <listitem>
+ <para>jdbcconn.jar – The JDBC Connector jar, which can be found in the MetaMatrix Server’s installation directory under SERVER\config\extensions or exported from the pre-installed extension modules in the MetaMatrix Console.</para>
+ </listitem>
+ <listitem>
+ <para>MetaMatrixLicense.xml – A valid license for the MetaMatrix JDBC Connector. Your classpath should include a directory containing this file. </para>
+ </listitem>
+ <listitem>
+ <para>MJjdbc.jar – OPTIONAL – If extending an existing MetaMatrix JDBC Connector for access to Oracle, SQL Server, DB2, or Sybase, you may need this jar that contains the actual JDBC drivers for those sources.</para>
+ </listitem>
+ </orderedlist>
+ </sect1>
+
+ <sect1>
+ <title>Installing Extensions</title>
+ <para>Once you have developed an extension to the JDBC Connector, you must install it into the MetaMatrix Server. This process involves creating and installing a Connector Archive File (CAF). Refer to the Connector Developer’s Guide for instructions on creating and installing CAF files.</para>
+
+ <sect2>
+ <title>Connector Archive File Contents</title>
+ <para>When creating your Connector Archive File, you need to include the following jars:</para>
+ <orderedlist>
+ <listitem>
+ <para>jdbcconn.jar (described above) – This contains the base JDBC Connector code.</para>
+ </listitem>
+ <listitem>
+ <para>JDBC drivers – Any drivers needed to access the data source must be included. If you are extending the MetaMatrix JDBC Connector for Oracle, SQL Server, DB2, or Sybase, you will need to include MJjdbc.jar.</para>
+ </listitem>
+ <listitem>
+ <para>Connector jars – Any custom code that extends the JDBC Connector must be compiled and placed in a JAR file for inclusion in the CAF.</para>
+ </listitem>
+ <listitem>
+ <para>External libraries – Any additional JAR files that are needed by your connector must be included.</para>
+ </listitem>
+ <listitem>
+ <para>Other JDBC jars – OPTIONAL – If extending an existing MetaMatrix JDBC Connector other than those whose drivers are found in MJjdbc.jar (see list above), you will need the JDBC jar provided by that vendor. For example to extend the MySQL connector you would need their mysql-connector-java-5.1.5-bin.jar (5.1.5 is the version number and will vary).</para>
+ </listitem>
+ </orderedlist>
+ </sect2>
+
+ <sect2>
+ <title>Connector Type Definition</title>
+ <para>In addition to the JAR files, you will need to create a Connector Type Definition file as described in the Connector Developer’s Guide. This Connector Type Definition file (.cdk file extension) is an XML file describing the properties needed by your JDBC Connector. </para>
+ <para>Typically, the easiest way to create a new Connector Type Definition file to extend the JDBC Connector is to export the JDBC Connector Type from the MetaMatrix Console and modify it. When doing this, you will need to modify the following items:</para>
+ <orderedlist>
+ <listitem>
+ <para>ComponentType Name – name your Connector Type</para>
+ </listitem>
+ <listitem>
+ <para>ComponentType SuperComponent – should be an existing Connector Type such as “JDBC Connector”. If you are extending an existing connector type, that should be specified as the SuperComponent</para>
+ </listitem>
+ </orderedlist>
+ <para>Property value defaults – each property’s default value should be reviewed and updated. In particular the extension class properties should be updated to activate your extension classes.</para>
+ </sect2>
+ </sect1>
+</chapter>
\ No newline at end of file
Property changes on: trunk/documentation/connector-developer-guide/src/main/docbook/en-US/content/extending-jdbc-connector.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 9 months
teiid SVN: r1999 - in trunk/connectors: connector-xml/src/main/java/com/metamatrix/connector/xml/base and 11 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-03-25 11:15:25 -0400 (Thu, 25 Mar 2010)
New Revision: 1999
Removed:
trunk/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/BaseXMLConnectorState.java
trunk/connectors/connector-xml-http/src/test/java/org/teiid/connector/xml/base/
Modified:
trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xmlsource/file/FileProcedureExecution.java
trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xmlsource/file/FileResultSetExecution.java
trunk/connectors/connector-xml-file/src/main/rar/META-INF/ra.xml
trunk/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/XMLConnectorState.java
trunk/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/base/SecureConnectorStateImpl.java
trunk/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/base/XMLConnector.java
trunk/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/base/XMLConnectorStateImpl.java
trunk/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/http/HTTPExecutor.java
trunk/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/http/HTTPManagedConnectionFactory.java
trunk/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/http/HTTPRequest.java
trunk/connectors/connector-xml-http/src/main/rar/META-INF/ra.xml
trunk/connectors/connector-xml-http/src/test/java/org/teiid/connector/xml/http/FakeHttpProperties.java
trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/soap/SOAPRequest.java
trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/soap/SOAPResultSetExecution.java
trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/soap/SoapRequest.java
trunk/connectors/connector-xml-soap/src/main/rar/META-INF/ra.xml
trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/ResultProducer.java
trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/XMLBaseManagedConnectionFactory.java
trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/streaming/BaseStreamingExecution.java
Log:
TEIID-137 refining changes to the xml connector(s)
Modified: trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/ResultProducer.java
===================================================================
--- trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/ResultProducer.java 2010-03-25 12:11:07 UTC (rev 1998)
+++ trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/ResultProducer.java 2010-03-25 15:15:25 UTC (rev 1999)
@@ -21,5 +21,5 @@
*/
public Iterator<Document> getXMLDocuments() throws ConnectorException;
- public void closeStreams();
+ void close() throws ConnectorException;
}
Modified: trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/XMLBaseManagedConnectionFactory.java
===================================================================
--- trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/XMLBaseManagedConnectionFactory.java 2010-03-25 12:11:07 UTC (rev 1998)
+++ trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/XMLBaseManagedConnectionFactory.java 2010-03-25 15:15:25 UTC (rev 1999)
@@ -22,11 +22,16 @@
package com.metamatrix.connector.xml.base;
+import java.sql.SQLXML;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
import org.teiid.connector.basic.BasicManagedConnectionFactory;
public class XMLBaseManagedConnectionFactory extends BasicManagedConnectionFactory {
private String saxFilterProviderClass;
+ private Map<String, SQLXML> responses = new ConcurrentHashMap<String, SQLXML>();
public String getSaxFilterProviderClass() {
return this.saxFilterProviderClass;
@@ -56,4 +61,16 @@
this.inputStreamFilterClass = inputStreamFilterClass;
}
+ public SQLXML getResponse(String key) {
+ return this.responses.get(key);
+ }
+
+ public void setResponse(String key, SQLXML xml) {
+ this.responses.put(key, xml);
+ }
+
+ public SQLXML removeResponse(String key) {
+ return this.responses.remove(key);
+ }
+
}
Modified: trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/streaming/BaseStreamingExecution.java
===================================================================
--- trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/streaming/BaseStreamingExecution.java 2010-03-25 12:11:07 UTC (rev 1998)
+++ trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/streaming/BaseStreamingExecution.java 2010-03-25 15:15:25 UTC (rev 1999)
@@ -29,7 +29,6 @@
import javax.xml.transform.Source;
-import org.teiid.connector.DataPlugin;
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.DataNotAvailableException;
import org.teiid.connector.api.ExecutionContext;
@@ -113,15 +112,8 @@
}
}
- protected SQLXML convertToXMLType(Source value) throws ConnectorException {
- if (value == null) {
- return null;
- }
- Object result = this.config.getTypeFacility().convertToRuntimeType(value);
- if (!(result instanceof SQLXML)) {
- throw new ConnectorException(DataPlugin.Util.getString("unknown_object_type_to_tranfrom_xml")); //$NON-NLS-1$
- }
- return (SQLXML)result;
+ protected SQLXML convertToXMLType(Source value) {
+ return (SQLXML)this.config.getTypeFacility().convertToRuntimeType(value);
}
@Override
Modified: trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xmlsource/file/FileProcedureExecution.java
===================================================================
--- trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xmlsource/file/FileProcedureExecution.java 2010-03-25 12:11:07 UTC (rev 1998)
+++ trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xmlsource/file/FileProcedureExecution.java 2010-03-25 15:15:25 UTC (rev 1999)
@@ -27,13 +27,11 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.sql.SQLXML;
import java.util.Arrays;
import java.util.List;
import javax.xml.transform.Source;
-import org.teiid.connector.DataPlugin;
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.DataNotAvailableException;
import org.teiid.connector.api.ExecutionContext;
@@ -108,22 +106,11 @@
this.config.getLogger().logDetail(XMLSourcePlugin.Util.getString("executing_procedure", new Object[] {procedure.getProcedureName()})); //$NON-NLS-1$
}
- protected SQLXML convertToXMLType(Source value) throws ConnectorException {
- if (value == null) {
- return null;
- }
- Object result = this.config.getTypeFacility().convertToRuntimeType(value);
- if (!(result instanceof SQLXML)) {
- throw new ConnectorException(DataPlugin.Util.getString("unknown_object_type_to_tranfrom_xml")); //$NON-NLS-1$
- }
- return (SQLXML)result;
- }
-
@Override
public List<?> next() throws ConnectorException, DataNotAvailableException {
if (!returnedResult) {
returnedResult = true;
- return Arrays.asList(convertToXMLType(returnValue));
+ return Arrays.asList(returnValue);
}
return null;
}
Modified: trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xmlsource/file/FileResultSetExecution.java
===================================================================
--- trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xmlsource/file/FileResultSetExecution.java 2010-03-25 12:11:07 UTC (rev 1998)
+++ trunk/connectors/connector-xml-file/src/main/java/org/teiid/connector/xmlsource/file/FileResultSetExecution.java 2010-03-25 15:15:25 UTC (rev 1999)
@@ -116,13 +116,8 @@
}
@Override
- public void closeStreams() {
- // Nothing to do
- }
-
- @Override
public void close() throws ConnectorException {
- closeStreams();
+ // Nothing to do
}
@Override
Modified: trunk/connectors/connector-xml-file/src/main/rar/META-INF/ra.xml
===================================================================
--- trunk/connectors/connector-xml-file/src/main/rar/META-INF/ra.xml 2010-03-25 12:11:07 UTC (rev 1998)
+++ trunk/connectors/connector-xml-file/src/main/rar/META-INF/ra.xml 2010-03-25 15:15:25 UTC (rev 1999)
@@ -101,7 +101,7 @@
<description>{$display:"XML Filter Provider",$description:"The class the provides extended XML Filters",$advanced:"true"}</description>
<config-property-name>SaxFilterProviderClass</config-property-name>
<config-property-type>java.lang.String</config-property-type>
- <config-property-value>com.metamatrix.connector.xml.base.NoExtendedFilters</config-property-value>
+ <config-property-value></config-property-value>
</config-property>
<config-property>
@@ -115,14 +115,14 @@
<description>{$display:"Input Stream Filter Class",$description:"The class to use to preprocess raw XML input stream",$advanced:"true"}</description>
<config-property-name>InputStreamFilterClass</config-property-name>
<config-property-type>java.lang.String</config-property-type>
- <config-property-value>com.metamatrix.connector.xml.base.PluggableInputStreamFilterImpl</config-property-value>
+ <config-property-value></config-property-value>
</config-property>
<config-property>
<description>{$display:"Query Preprocessor Class",$description:"The class to use to preprocess the IQuery",$advanced:"true"}</description>
<config-property-name>QueryPreprocessorClass</config-property-name>
<config-property-type>java.lang.String</config-property-type>
- <config-property-value>com.metamatrix.connector.xml.base.NoQueryPreprocessing</config-property-value>
+ <config-property-value></config-property-value>
</config-property>
<config-property>
Deleted: trunk/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/BaseXMLConnectorState.java
===================================================================
--- trunk/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/BaseXMLConnectorState.java 2010-03-25 12:11:07 UTC (rev 1998)
+++ trunk/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/BaseXMLConnectorState.java 2010-03-25 15:15:25 UTC (rev 1999)
@@ -1,42 +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.connector.xml;
-
-
-import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.api.ConnectorLogger;
-import org.teiid.connector.xml.http.HTTPManagedConnectionFactory;
-
-public interface BaseXMLConnectorState {
-
- public abstract java.util.Properties getState();
-
- public abstract void setState(HTTPManagedConnectionFactory env) throws ConnectorException;
-
- public abstract void setLogger(ConnectorLogger logger);
-
- public abstract ConnectorLogger getLogger();
-
-}
Modified: trunk/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/XMLConnectorState.java
===================================================================
--- trunk/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/XMLConnectorState.java 2010-03-25 12:11:07 UTC (rev 1998)
+++ trunk/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/XMLConnectorState.java 2010-03-25 15:15:25 UTC (rev 1999)
@@ -28,11 +28,13 @@
import org.teiid.connector.api.Connection;
import org.teiid.connector.api.ConnectorCapabilities;
import org.teiid.connector.api.ConnectorException;
+import org.teiid.connector.api.ConnectorLogger;
+import org.teiid.connector.xml.http.HTTPManagedConnectionFactory;
import com.metamatrix.connector.xml.IQueryPreprocessor;
import com.metamatrix.connector.xml.SAXFilterProvider;
-public interface XMLConnectorState extends BaseXMLConnectorState {
+public interface XMLConnectorState {
public static final String STATE_CLASS_PROP = "ConnectorStateClass"; //$NON-NLS-1$
@@ -51,8 +53,11 @@
public String getPluggableInputStreamFilterClass();
- public boolean isCaching();
+ public abstract void setState(HTTPManagedConnectionFactory env) throws ConnectorException;
- public SQLXML getResponse(String key);
+ public abstract void setLogger(ConnectorLogger logger);
+ public abstract ConnectorLogger getLogger();
+
+
}
\ No newline at end of file
Modified: trunk/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/base/SecureConnectorStateImpl.java
===================================================================
--- trunk/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/base/SecureConnectorStateImpl.java 2010-03-25 12:11:07 UTC (rev 1998)
+++ trunk/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/base/SecureConnectorStateImpl.java 2010-03-25 15:15:25 UTC (rev 1999)
@@ -24,8 +24,6 @@
package org.teiid.connector.xml.base;
-import java.util.Properties;
-
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.xml.SecureConnectorState;
import org.teiid.connector.xml.TrustedPayloadHandler;
@@ -63,13 +61,6 @@
getTrustDeserializerInstance();
}
- @Override
- public Properties getState() {
- Properties props = super.getState();
- props.setProperty(SECURITY_DESERIALIZER_CLASS, getSecurityDeserializerClass());
- return props;
- }
-
private void setSecurityDeserializerClass(String secClass) {
securityDeserializerClass = secClass;
}
Modified: trunk/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/base/XMLConnector.java
===================================================================
--- trunk/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/base/XMLConnector.java 2010-03-25 12:11:07 UTC (rev 1998)
+++ trunk/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/base/XMLConnector.java 2010-03-25 15:15:25 UTC (rev 1999)
@@ -29,7 +29,6 @@
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.ConnectorLogger;
import org.teiid.connector.basic.BasicConnector;
-import org.teiid.connector.basic.BasicManagedConnectionFactory;
import org.teiid.connector.xml.StatefulConnector;
import org.teiid.connector.xml.XMLConnectorState;
import org.teiid.connector.xml.http.HTTPConnectorState;
Modified: trunk/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/base/XMLConnectorStateImpl.java
===================================================================
--- trunk/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/base/XMLConnectorStateImpl.java 2010-03-25 12:11:07 UTC (rev 1998)
+++ trunk/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/base/XMLConnectorStateImpl.java 2010-03-25 15:15:25 UTC (rev 1999)
@@ -24,10 +24,6 @@
package org.teiid.connector.xml.base;
import java.io.InputStream;
-import java.sql.SQLXML;
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.ConcurrentHashMap;
import org.teiid.connector.api.ConnectorCapabilities;
import org.teiid.connector.api.ConnectorException;
@@ -53,24 +49,12 @@
private String m_pluggableInputStreamFilterClass;
- public static final String CACHE_ENABLED = "CacheEnabled"; //$NON-NLS-1$
+ public static final String SAX_FILTER_PROVIDER_CLASS_DEFAULT = ""; //$NON-NLS-1$
- public static final String LOG_REQUEST_RESPONSE_DOCS = "LogRequestResponseDocs"; //$NON-NLS-1$
-
- public static final String SAX_FILTER_PROVIDER_CLASS = "SaxFilterProviderClass"; //$NON-NLS-1$
-
- public static final String QUERY_PREPROCESS_CLASS = "QueryPreprocessorClass"; //$NON-NLS-1$
+ public static final String QUERY_PREPROCESS_CLASS_DEFAULT = ""; //$NON-NLS-1$
- public static final String INPUT_STREAM_FILTER_CLASS = "InputStreamFilterClass"; //$NON-NLS-1$
+ private static final String INPUT_STREAM_FILTER_CLASS_DEFAULT = ""; //$NON-NLS-1$
- public static final String SAX_FILTER_PROVIDER_CLASS_DEFAULT = "com.metamatrix.connector.xml.base.NoExtendedFilters"; //$NON-NLS-1$
-
- public static final String QUERY_PREPROCESS_CLASS_DEFAULT = "com.metamatrix.connector.xml.base.NoQueryPreprocessing"; //$NON-NLS-1$
-
- private static final String INPUT_STREAM_FILTER_CLASS_DEFAULT = "com.metamatrix.connector.xml.base.PluggableInputStreamFilterImpl"; //$NON-NLS-1$
-
- public static final String CONNECTOR_CAPABILITES = "ConnectorCapabilities";
-
protected ConnectorLogger logger;
private IQueryPreprocessor preprocessor;
@@ -79,11 +63,6 @@
private ConnectorCapabilities capabilites;
-
- private boolean caching = false;
-
- private Map<String, SQLXML> responses = new ConcurrentHashMap<String, SQLXML>();
-
public XMLConnectorStateImpl() {
setPreprocess(true);
setLogRequestResponse(false);
@@ -96,37 +75,28 @@
if (logger == null) {
throw new RuntimeException("Internal Exception: logger is null");
}
- setCaching(env.getCacheEnabled());
setLogRequestResponse(env.getLogRequestResponseDocs());
setCapabilites(loadConnectorCapabilities(env.getCapabilitiesClass()));
String provider = env.getSaxFilterProviderClass();
- if (provider != null && !provider.equals("")) {
+ if (provider != null && !provider.equals(SAX_FILTER_PROVIDER_CLASS_DEFAULT)) {
setSaxProviderClass(provider);
setSAXFilterProvider(loadSAXFilter(getSaxProviderClass()));
}
String preprocessor = env.getQueryPreprocessorClass();
- if (preprocessor != null && !preprocessor.equals("")) {
+ if (preprocessor != null && !preprocessor.equals(QUERY_PREPROCESS_CLASS_DEFAULT)) {
setQueryPreprocessorClass(preprocessor);
setPreprocessor(loadPreprocessor(getQueryPreprocessorClass()));
}
String streamFilter = env.getInputStreamFilterClass();
- if(streamFilter != null && !streamFilter.equals("")) {
+ if(streamFilter != null && !streamFilter.equals(INPUT_STREAM_FILTER_CLASS_DEFAULT)) {
setPluggableInputStreamFilterClass(streamFilter);
}
}
- private void setCaching(Boolean caching) {
- this.caching = caching;
- }
-
- public boolean isCaching() {
- return this.caching;
- }
-
private ConnectorCapabilities loadConnectorCapabilities(
String connectorCapabilitiesClass) throws ConnectorException {
ConnectorCapabilities caps = null;
@@ -158,15 +128,6 @@
return logger;
}
- public java.util.Properties getState() {
- Properties props = new Properties();
- props.setProperty(LOG_REQUEST_RESPONSE_DOCS, Boolean
- .toString(isLogRequestResponse()));
- props.setProperty(SAX_FILTER_PROVIDER_CLASS, getSaxProviderClass());
- props.setProperty(QUERY_PREPROCESS_CLASS, getQueryPreprocessorClass());
- return props;
- }
-
protected boolean isNotNullOrEmpty(String value) {
return (value != null && !value.equals(""));
}
@@ -316,16 +277,4 @@
return stream;
}
- @Override
- public SQLXML getResponse(String key) {
- return this.responses.get(key);
- }
-
- public void setResponse(String key, SQLXML xml) {
- this.responses.put(key, xml);
- }
-
- public void removeResponse(String key) {
- this.responses.remove(key);
- }
}
Modified: trunk/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/http/HTTPExecutor.java
===================================================================
--- trunk/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/http/HTTPExecutor.java 2010-03-25 12:11:07 UTC (rev 1998)
+++ trunk/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/http/HTTPExecutor.java 2010-03-25 15:15:25 UTC (rev 1999)
@@ -76,7 +76,7 @@
}
@Override
- public void closeStreams() {
+ public void close() {
for(HTTPRequest request : this.requests) {
if (request != null) {
request.release();
Modified: trunk/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/http/HTTPManagedConnectionFactory.java
===================================================================
--- trunk/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/http/HTTPManagedConnectionFactory.java 2010-03-25 12:11:07 UTC (rev 1998)
+++ trunk/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/http/HTTPManagedConnectionFactory.java 2010-03-25 15:15:25 UTC (rev 1999)
@@ -155,16 +155,6 @@
this.connectorStateClass = connectorStateClass;
}
- private boolean cacheEnabled;
-
- public boolean getCacheEnabled() {
- return this.cacheEnabled;
- }
-
- public void setCacheEnabled(Boolean cacheEnabled) {
- this.cacheEnabled = cacheEnabled;
- }
-
private boolean logRequestResponseDocs;
public boolean getLogRequestResponseDocs() {
Modified: trunk/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/http/HTTPRequest.java
===================================================================
--- trunk/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/http/HTTPRequest.java 2010-03-25 12:11:07 UTC (rev 1998)
+++ trunk/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/http/HTTPRequest.java 2010-03-25 15:15:25 UTC (rev 1999)
@@ -91,14 +91,14 @@
CriteriaDesc criterion = this.exeInfo.getResponseIDCriterion();
if (criterion != null) {
String responseid = (String) (criterion.getValues().get(0));
- SQLXML xml = this.state.getResponse(responseid);
+ SQLXML xml = this.config.getResponse(responseid);
Assertion.isNotNull(xml);
document = new DocumentImpl(xml, responseid);
} else {
// Not a join, but might still be cached.
// Not cached, so make the request
SQLXML responseBody = executeRequest();
- this.state.setResponse(this.context.getExecutionCountIdentifier(), responseBody);
+ this.config.setResponse(this.context.getExecutionCountIdentifier(), responseBody);
this.response = responseBody;
//InputStream filteredStream = getState().addStreamFilters(responseBody);
document = new DocumentImpl(responseBody, this.context.getExecutionCountIdentifier());
@@ -140,7 +140,7 @@
request.releaseConnection();
}
if (response != null) {
- this.state.removeResponse(this.context.getExecutionCountIdentifier());
+ this.config.removeResponse(this.context.getExecutionCountIdentifier());
try {
response.free();
} catch (SQLException e) {
Modified: trunk/connectors/connector-xml-http/src/main/rar/META-INF/ra.xml
===================================================================
--- trunk/connectors/connector-xml-http/src/main/rar/META-INF/ra.xml 2010-03-25 12:11:07 UTC (rev 1998)
+++ trunk/connectors/connector-xml-http/src/main/rar/META-INF/ra.xml 2010-03-25 15:15:25 UTC (rev 1999)
@@ -38,13 +38,13 @@
<outbound-resourceadapter>
<connection-definition>
- <managedconnectionfactory-class>com.metamatrix.connector.xml.http.HTTPManagedConnectionFactory</managedconnectionfactory-class>
+ <managedconnectionfactory-class>org.teiid.connector.xml.http.HTTPManagedConnectionFactory</managedconnectionfactory-class>
<config-property>
<description>{$display:"Connector Class",$advanced:"true"}</description>
<config-property-name>ConnectorClass</config-property-name>
<config-property-type>java.lang.String</config-property-type>
- <config-property-value>com.metamatrix.connector.xml.base.XMLConnector</config-property-value>
+ <config-property-value>org.teiid.connector.xml.base.XMLConnector</config-property-value>
</config-property>
<config-property>
@@ -88,7 +88,7 @@
<description>{$display:"XML Filter Provider",$description:"The class the provides extended XML Filters",$advanced:"true"}</description>
<config-property-name>SaxFilterProviderClass</config-property-name>
<config-property-type>java.lang.String</config-property-type>
- <config-property-value>com.metamatrix.connector.xml.base.NoExtendedFilters</config-property-value>
+ <config-property-value></config-property-value>
</config-property>
<config-property>
@@ -115,7 +115,7 @@
<description>{$display:"Connector State Class",$required:"true",$advanced:"true"}</description>
<config-property-name>ConnectorStateClass</config-property-name>
<config-property-type>java.lang.String</config-property-type>
- <config-property-value>com.metamatrix.connector.xml.http.HTTPConnectorState</config-property-value>
+ <config-property-value>org.teiid.connector.xml.http.HTTPConnectorState</config-property-value>
</config-property>
<config-property>
@@ -168,7 +168,7 @@
<description>{$display:"Trust Deserializer Class",$description:"The class to use to process trusted payloads and execution payloads",$advanced:"true"}</description>
<config-property-name>TrustDeserializerClass</config-property-name>
<config-property-type>java.lang.String</config-property-type>
- <config-property-value>com.metamatrix.connector.xml.http.DefaultTrustDeserializer</config-property-value>
+ <config-property-value>org.teiid.connector.xml.http.DefaultTrustDeserializer</config-property-value>
</config-property>
<config-property>
@@ -182,7 +182,7 @@
<description>{$display:"Input Stream Filter Class",$description:"The class to use to preprocess raw XML input stream",$advanced:"true"}</description>
<config-property-name>InputStreamFilterClass</config-property-name>
<config-property-type>java.lang.String</config-property-type>
- <config-property-value>com.metamatrix.connector.xml.base.PluggableInputStreamFilterImpl</config-property-value>
+ <config-property-value></config-property-value>
</config-property>
<config-property>
@@ -195,7 +195,7 @@
<description>{$display:"Query Preprocessor Class",$description:"The class to use to preprocess the IQuery",$advanced:"true"}</description>
<config-property-name>QueryPreprocessorClass</config-property-name>
<config-property-type>java.lang.String</config-property-type>
- <config-property-value>com.metamatrix.connector.xml.base.NoQueryPreprocessing</config-property-value>
+ <config-property-value></config-property-value>
</config-property>
<connectionfactory-interface>org.teiid.connector.api.Connector</connectionfactory-interface>
Modified: trunk/connectors/connector-xml-http/src/test/java/org/teiid/connector/xml/http/FakeHttpProperties.java
===================================================================
--- trunk/connectors/connector-xml-http/src/test/java/org/teiid/connector/xml/http/FakeHttpProperties.java 2010-03-25 12:11:07 UTC (rev 1998)
+++ trunk/connectors/connector-xml-http/src/test/java/org/teiid/connector/xml/http/FakeHttpProperties.java 2010-03-25 15:15:25 UTC (rev 1999)
@@ -4,9 +4,8 @@
import org.teiid.connector.xml.SecureConnectorState;
import org.teiid.connector.xml.XMLConnectorState;
-import org.teiid.connector.xml.base.XMLConnectorStateImpl;
-
+@SuppressWarnings("nls")
public class FakeHttpProperties {
public static Properties getDefaultXMLRequestProps() {
Properties defaultHTTPProps = getDefaultHttpProps();
@@ -16,8 +15,6 @@
public static Properties getDefaultHttpProps() {
Properties testHTTPProps = new Properties();
- testHTTPProps.put(XMLConnectorStateImpl.CACHE_ENABLED, Boolean.TRUE);
- testHTTPProps.put(XMLConnectorStateImpl.CONNECTOR_CAPABILITES, "com.metamatrix.connector.xml.base.XMLCapabilities");
testHTTPProps.setProperty(XMLConnectorState.STATE_CLASS_PROP, "com.metamatrix.connector.xml.http.HTTPConnectorState");
testHTTPProps.setProperty(HTTPConnectorState.ACCESS_METHOD,HTTPConnectorState.GET);
testHTTPProps.setProperty(HTTPConnectorState.PARAMETER_METHOD,HTTPConnectorState.PARAMETER_XML_REQUEST);
@@ -36,7 +33,6 @@
public static Properties getDefaultHTTPProps() {
Properties testHTTPProps = new Properties();
- testHTTPProps.setProperty(XMLConnectorStateImpl.CACHE_ENABLED, Boolean.TRUE.toString());
testHTTPProps.setProperty(HTTPConnectorState.URI, "http://localhost:8673"); //$NON-NLS-1$
testHTTPProps.setProperty(HTTPConnectorState.REQUEST_TIMEOUT, "60"); //$NON-NLS-1$
testHTTPProps.setProperty(XMLConnectorState.STATE_CLASS_PROP, "com.metamatrix.connector.xml.http.HTTPConnectorState"); //$NON-NLS-1$
Modified: trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/soap/SOAPRequest.java
===================================================================
--- trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/soap/SOAPRequest.java 2010-03-25 12:11:07 UTC (rev 1998)
+++ trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/soap/SOAPRequest.java 2010-03-25 15:15:25 UTC (rev 1999)
@@ -22,6 +22,7 @@
package org.teiid.connector.xmlsource.soap;
import java.io.StringReader;
+import java.sql.SQLException;
import java.sql.SQLXML;
import java.util.ArrayList;
import java.util.Iterator;
@@ -37,7 +38,6 @@
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.output.XMLOutputter;
-import org.teiid.connector.api.CacheScope;
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.ExecutionContext;
import org.teiid.connector.xmlsource.XMLSourcePlugin;
@@ -121,14 +121,14 @@
CriteriaDesc criterion = this.executionInfo.getResponseIDCriterion();
if (criterion != null) {
String responseid = (String) (criterion.getValues().get(0));
- SQLXML xml = (SQLXML)this.context.getFromCache(CacheScope.REQUEST, responseid);
+ SQLXML xml = this.config.getResponse(responseid);
Assertion.isNotNull(xml);
document = new DocumentImpl(xml, responseid);
} else {
// Not a join, but might still be cached.
// Not cached, so make the request
SQLXML responseBody = executeRequest();
- this.context.storeInCache(CacheScope.REQUEST,this.context.getExecutionCountIdentifier(), responseBody);
+ this.config.setResponse(this.context.getExecutionCountIdentifier(), responseBody);
//InputStream filteredStream = getState().addStreamFilters(responseBody);
document = new DocumentImpl(responseBody, this.context.getExecutionCountIdentifier());
}
@@ -179,7 +179,7 @@
// I should be able to send no value here, but the dispatch throws an exception
// if soapAction == null. We allow the default "" to get sent in that case.
// In SOAP 1.1 we must send a SoapAction.
- String soapAction = (String)this.executionInfo.getOtherProperties().get("SOAPAction");
+ String soapAction = this.executionInfo.getOtherProperties().get("SOAPAction");
if(null != soapAction) {
dispatch.getRequestContext().put(Dispatch.SOAPACTION_URI_PROPERTY, soapAction);
}
@@ -198,12 +198,20 @@
}
}
+ public void release() {
+ SQLXML response = this.config.removeResponse(this.context.getExecutionCountIdentifier());
+ if (response != null) {
+ try {
+ response.free();
+ } catch (SQLException e) {
+ }
+ }
+ }
+
private SQLXML createSQLXML(Source output) {
return (SQLXML)this.config.getTypeFacility().convertToRuntimeType(output);
}
-
-
public int getDocumentCount() throws ConnectorException {
return 1;
}
Modified: trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/soap/SOAPResultSetExecution.java
===================================================================
--- trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/soap/SOAPResultSetExecution.java 2010-03-25 12:11:07 UTC (rev 1998)
+++ trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/soap/SOAPResultSetExecution.java 2010-03-25 15:15:25 UTC (rev 1999)
@@ -75,13 +75,10 @@
@Override
public void close() throws ConnectorException {
- closeStreams();
+ for (SOAPRequest request : requests) {
+ request.release();
+ }
}
-
- @Override
- public void closeStreams() {
- // do clean up?
- }
@Override
public Iterator<Document> getXMLDocuments() throws ConnectorException {
Modified: trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/soap/SoapRequest.java
===================================================================
--- trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/soap/SoapRequest.java 2010-03-25 12:11:07 UTC (rev 1998)
+++ trunk/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xmlsource/soap/SoapRequest.java 2010-03-25 15:15:25 UTC (rev 1999)
@@ -27,7 +27,6 @@
import javax.xml.transform.Source;
-import org.teiid.connector.DataPlugin;
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.xmlsource.XMLSourcePlugin;
import org.teiid.connector.xmlsource.soap.ServiceOperation.ExcutionFailedException;
@@ -101,15 +100,8 @@
}
}
- protected SQLXML convertToXMLType(Source value) throws ConnectorException {
- if (value == null) {
- return null;
- }
- Object result = env.getTypeFacility().convertToRuntimeType(value);
- if (!(result instanceof SQLXML)) {
- throw new ConnectorException(DataPlugin.Util.getString("unknown_object_type_to_tranfrom_xml")); //$NON-NLS-1$
- }
- return (SQLXML)result;
+ protected SQLXML convertToXMLType(Source value) {
+ return (SQLXML)env.getTypeFacility().convertToRuntimeType(value);
}
public List<?> getOutputParameterValues() throws ConnectorException {
Modified: trunk/connectors/connector-xml-soap/src/main/rar/META-INF/ra.xml
===================================================================
--- trunk/connectors/connector-xml-soap/src/main/rar/META-INF/ra.xml 2010-03-25 12:11:07 UTC (rev 1998)
+++ trunk/connectors/connector-xml-soap/src/main/rar/META-INF/ra.xml 2010-03-25 15:15:25 UTC (rev 1999)
@@ -175,7 +175,7 @@
<description>{$display:"XML Filter Provider",$description:"The class the provides extended XML Filters",$advanced:"true"}</description>
<config-property-name>SaxFilterProviderClass</config-property-name>
<config-property-type>java.lang.String</config-property-type>
- <config-property-value>com.metamatrix.connector.xml.base.NoExtendedFilters</config-property-value>
+ <config-property-value></config-property-value>
</config-property>
<config-property>
14 years, 9 months
teiid SVN: r1998 - trunk/build/kit-jboss-container/teiid-examples/simpleclient.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-03-25 08:11:07 -0400 (Thu, 25 Mar 2010)
New Revision: 1998
Modified:
trunk/build/kit-jboss-container/teiid-examples/simpleclient/readme.txt
Log:
correcting for 7.0
Modified: trunk/build/kit-jboss-container/teiid-examples/simpleclient/readme.txt
===================================================================
--- trunk/build/kit-jboss-container/teiid-examples/simpleclient/readme.txt 2010-03-24 21:49:16 UTC (rev 1997)
+++ trunk/build/kit-jboss-container/teiid-examples/simpleclient/readme.txt 2010-03-25 12:11:07 UTC (rev 1998)
@@ -4,8 +4,8 @@
The program expects two arguments <vdb name> and <sql query>. There are helper run scripts
that can be run as follows:
-$run.sh admin "select * from groups"
+$run.sh <vdb> "select * from SYS.tables"
Note that the query is in quotes so that it is understood as a single argument.
-See the other examples for deployable .vdb and .def files to create vdbs.
\ No newline at end of file
+See the other examples for deployable .vdb and .xml files to create vdbs.
\ No newline at end of file
14 years, 9 months
teiid SVN: r1997 - in trunk/build/kit-jboss-container/teiid-examples: sample-connector-bindings and 1 other directory.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-03-24 17:49:16 -0400 (Wed, 24 Mar 2010)
New Revision: 1997
Added:
trunk/build/kit-jboss-container/teiid-examples/sample-connector-bindings/
trunk/build/kit-jboss-container/teiid-examples/sample-connector-bindings/oracle-connector-ds.xml
trunk/build/kit-jboss-container/teiid-examples/sample-connector-bindings/readme.txt
trunk/build/kit-jboss-container/teiid-examples/sample-connector-bindings/text-connector-ds.xml
Log:
TEIID-833: adding some sample connector bindings
Added: trunk/build/kit-jboss-container/teiid-examples/sample-connector-bindings/oracle-connector-ds.xml
===================================================================
--- trunk/build/kit-jboss-container/teiid-examples/sample-connector-bindings/oracle-connector-ds.xml (rev 0)
+++ trunk/build/kit-jboss-container/teiid-examples/sample-connector-bindings/oracle-connector-ds.xml 2010-03-24 21:49:16 UTC (rev 1997)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<connection-factories>
+ <no-tx-connection-factory>
+ <jndi-name>oracle-connector</jndi-name>
+ <rar-name>connector-jdbc-{project.version}.rar</rar-name>
+ <connection-definition>org.teiid.connector.api.Connector</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="CapabilitiesClass" type="java.lang.String">org.teiid.connector.jdbc.oracle.OracleCapabilities</config-property>
+ <config-property name="XaCapable" type="java.lang.Boolean">true</config-property>
+ <config-property name="ExtensionTranslationClassName" type="java.lang.String">org.teiid.connector.jdbc.oracle.OracleSQLTranslator</config-property>
+
+ <!--
+ This xml file is defining a connector for Teiid. Still this is not the source, this is just a
+ Teiid connector wrapping layer. This layer needs access to physical JDBC source, that is defined
+ in the below property. This is a data source in JBoss. This can be any RDBMS. Look at
+ "{jboss.home}/docs/examples/jca" folder for samples.
+ -->
+ <config-property name="SourceJNDIName" type="java.lang.String">java:OracleDS</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/kit-jboss-container/teiid-examples/sample-connector-bindings/oracle-connector-ds.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/build/kit-jboss-container/teiid-examples/sample-connector-bindings/readme.txt
===================================================================
--- trunk/build/kit-jboss-container/teiid-examples/sample-connector-bindings/readme.txt (rev 0)
+++ trunk/build/kit-jboss-container/teiid-examples/sample-connector-bindings/readme.txt 2010-03-24 21:49:16 UTC (rev 1997)
@@ -0,0 +1,4 @@
+The sample files in this directory define how a user can define connector bindings for a VDB in Teiid using the
+JBoss connection factory mechanism. However note that in the case JDBC sources, these connection factories depend on the
+availability of the data sources that they represent. To define such data sources please look at the samples
+"<jboss-install>/docs/examples/jca" folder.
Property changes on: trunk/build/kit-jboss-container/teiid-examples/sample-connector-bindings/readme.txt
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/build/kit-jboss-container/teiid-examples/sample-connector-bindings/text-connector-ds.xml
===================================================================
--- trunk/build/kit-jboss-container/teiid-examples/sample-connector-bindings/text-connector-ds.xml (rev 0)
+++ trunk/build/kit-jboss-container/teiid-examples/sample-connector-bindings/text-connector-ds.xml 2010-03-24 21:49:16 UTC (rev 1997)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<connection-factories>
+
+ <no-tx-connection-factory>
+ <jndi-name>text-connector</jndi-name>
+ <rar-name>connector-text-{project.version}.rar</rar-name>
+ <connection-definition>org.teiid.connector.api.Connector</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>
+
+ </no-tx-connection-factory>
+
+</connection-factories>
\ No newline at end of file
Property changes on: trunk/build/kit-jboss-container/teiid-examples/sample-connector-bindings/text-connector-ds.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 9 months
teiid SVN: r1996 - in trunk: connectors/connector-jdbc/src/main/rar/META-INF and 11 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-03-24 14:09:15 -0400 (Wed, 24 Mar 2010)
New Revision: 1996
Modified:
trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnectionFactory.java
trunk/connectors/connector-jdbc/src/main/rar/META-INF/ra.xml
trunk/connectors/connector-ldap/src/main/rar/META-INF/ra.xml
trunk/connectors/connector-loopback/src/main/java/com/metamatrix/connector/loopback/LoopbackExecution.java
trunk/connectors/connector-loopback/src/main/rar/META-INF/ra.xml
trunk/connectors/connector-salesforce/src/main/rar/META-INF/ra.xml
trunk/connectors/connector-text/src/main/rar/META-INF/ra.xml
trunk/connectors/connector-xml-file/src/main/rar/META-INF/ra.xml
trunk/connectors/connector-xml-http/src/main/rar/META-INF/ra.xml
trunk/connectors/connector-xml-soap/src/main/rar/META-INF/ra.xml
trunk/connectors/sandbox/connector-template/src/main/rar/META-INF/ra.xml
trunk/connectors/sandbox/connector-yahoo/src/main/rar/META-INF/ra.xml
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWorkItem.java
Log:
TEIID-1023 changing the default max rows to unlimited
Modified: trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnectionFactory.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnectionFactory.java 2010-03-24 17:52:06 UTC (rev 1995)
+++ trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicManagedConnectionFactory.java 2010-03-24 18:09:15 UTC (rev 1996)
@@ -62,7 +62,6 @@
private int maxResultRows = -1;
private boolean xaCapable;
- private boolean synchWorkers = true;
private String overrideCapabilitiesFile;
// derived
Modified: trunk/connectors/connector-jdbc/src/main/rar/META-INF/ra.xml
===================================================================
--- trunk/connectors/connector-jdbc/src/main/rar/META-INF/ra.xml 2010-03-24 17:52:06 UTC (rev 1995)
+++ trunk/connectors/connector-jdbc/src/main/rar/META-INF/ra.xml 2010-03-24 18:09:15 UTC (rev 1996)
@@ -79,7 +79,7 @@
<description>{$display:"Maximum Result Rows",$description:"Maximum Result Rows allowed",$advanced:"true"}</description>
<config-property-name>MaxResultRows</config-property-name>
<config-property-type>java.lang.Integer</config-property-type>
- <config-property-value>10000</config-property-value>
+ <config-property-value>-1</config-property-value>
</config-property>
<!-- JDBC Specific properties -->
Modified: trunk/connectors/connector-ldap/src/main/rar/META-INF/ra.xml
===================================================================
--- trunk/connectors/connector-ldap/src/main/rar/META-INF/ra.xml 2010-03-24 17:52:06 UTC (rev 1995)
+++ trunk/connectors/connector-ldap/src/main/rar/META-INF/ra.xml 2010-03-24 18:09:15 UTC (rev 1996)
@@ -79,7 +79,7 @@
<description>{$display:"Maximum Result Rows",$description:"Maximum Result Rows allowed",$advanced:"true"}</description>
<config-property-name>MaxResultRows</config-property-name>
<config-property-type>java.lang.Integer</config-property-type>
- <config-property-value>10000</config-property-value>
+ <config-property-value>-1</config-property-value>
</config-property>
<!-- LDAP Specific properties -->
Modified: trunk/connectors/connector-loopback/src/main/java/com/metamatrix/connector/loopback/LoopbackExecution.java
===================================================================
--- trunk/connectors/connector-loopback/src/main/java/com/metamatrix/connector/loopback/LoopbackExecution.java 2010-03-24 17:52:06 UTC (rev 1995)
+++ trunk/connectors/connector-loopback/src/main/java/com/metamatrix/connector/loopback/LoopbackExecution.java 2010-03-24 18:09:15 UTC (rev 1996)
@@ -63,7 +63,6 @@
private List<Object> row;
private boolean waited = false;
private int rowsReturned = 0;
- private boolean asynch = false;
private int rowsNeeded = 1;
public LoopbackExecution(Command command, LoopbackManagedConnectionFactory config, RuntimeMetadata metadata) {
@@ -78,20 +77,17 @@
// Wait a random amount of time up to waitTime milliseconds
int randomTimeToWait = randomNumber.nextInt(this.config.getWaitTime());
- if(asynch) {
- // If we're asynch and the wait time was longer than the poll interval,
- // then just say we don't have results instead
- if(randomTimeToWait > this.config.getPollIntervalInMilli()) {
- waited = true;
- throw new DataNotAvailableException(randomTimeToWait);
- }
- } else {
- try {
- Thread.sleep(randomTimeToWait);
- } catch(InterruptedException e) {
- }
- waited = true;
+ // If we're asynch and the wait time was longer than the poll interval,
+ // then just say we don't have results instead
+ if(randomTimeToWait > this.config.getPollIntervalInMilli()) {
+ waited = true;
+ throw new DataNotAvailableException(randomTimeToWait);
+ }
+ try {
+ Thread.sleep(randomTimeToWait);
+ } catch(InterruptedException e) {
}
+ waited = true;
}
if(rowsReturned < this.rowsNeeded && row.size() > 0) {
Modified: trunk/connectors/connector-loopback/src/main/rar/META-INF/ra.xml
===================================================================
--- trunk/connectors/connector-loopback/src/main/rar/META-INF/ra.xml 2010-03-24 17:52:06 UTC (rev 1995)
+++ trunk/connectors/connector-loopback/src/main/rar/META-INF/ra.xml 2010-03-24 18:09:15 UTC (rev 1996)
@@ -79,7 +79,7 @@
<description>{$display:"Maximum Result Rows",$description:"Maximum Result Rows allowed",$advanced:"true"}</description>
<config-property-name>MaxResultRows</config-property-name>
<config-property-type>java.lang.Integer</config-property-type>
- <config-property-value>10000</config-property-value>
+ <config-property-value>-1</config-property-value>
</config-property>
<!-- Loopback Specific properties -->
Modified: trunk/connectors/connector-salesforce/src/main/rar/META-INF/ra.xml
===================================================================
--- trunk/connectors/connector-salesforce/src/main/rar/META-INF/ra.xml 2010-03-24 17:52:06 UTC (rev 1995)
+++ trunk/connectors/connector-salesforce/src/main/rar/META-INF/ra.xml 2010-03-24 18:09:15 UTC (rev 1996)
@@ -79,7 +79,7 @@
<description>{$display:"Maximum Result Rows",$description:"Maximum Result Rows allowed",$advanced:"true"}</description>
<config-property-name>MaxResultRows</config-property-name>
<config-property-type>java.lang.Integer</config-property-type>
- <config-property-value>10000</config-property-value>
+ <config-property-value>-1</config-property-value>
</config-property>
<!-- Salesforce Specific properties -->
Modified: trunk/connectors/connector-text/src/main/rar/META-INF/ra.xml
===================================================================
--- trunk/connectors/connector-text/src/main/rar/META-INF/ra.xml 2010-03-24 17:52:06 UTC (rev 1995)
+++ trunk/connectors/connector-text/src/main/rar/META-INF/ra.xml 2010-03-24 18:09:15 UTC (rev 1996)
@@ -79,7 +79,7 @@
<description>{$display:"Maximum Result Rows",$description:"Maximum Result Rows allowed",$advanced:"true"}</description>
<config-property-name>MaxResultRows</config-property-name>
<config-property-type>java.lang.Integer</config-property-type>
- <config-property-value>10000</config-property-value>
+ <config-property-value>-1</config-property-value>
</config-property>
<!-- Text Connector Specific properties -->
Modified: trunk/connectors/connector-xml-file/src/main/rar/META-INF/ra.xml
===================================================================
--- trunk/connectors/connector-xml-file/src/main/rar/META-INF/ra.xml 2010-03-24 17:52:06 UTC (rev 1995)
+++ trunk/connectors/connector-xml-file/src/main/rar/META-INF/ra.xml 2010-03-24 18:09:15 UTC (rev 1996)
@@ -79,7 +79,7 @@
<description>{$display:"Maximum Result Rows",$description:"Maximum Result Rows allowed",$advanced:"true"}</description>
<config-property-name>MaxResultRows</config-property-name>
<config-property-type>java.lang.Integer</config-property-type>
- <config-property-value>10000</config-property-value>
+ <config-property-value>-1</config-property-value>
</config-property>
<!-- XML File Connector Specific properties -->
Modified: trunk/connectors/connector-xml-http/src/main/rar/META-INF/ra.xml
===================================================================
--- trunk/connectors/connector-xml-http/src/main/rar/META-INF/ra.xml 2010-03-24 17:52:06 UTC (rev 1995)
+++ trunk/connectors/connector-xml-http/src/main/rar/META-INF/ra.xml 2010-03-24 18:09:15 UTC (rev 1996)
@@ -79,7 +79,7 @@
<description>{$display:"Maximum Result Rows",$description:"Maximum Result Rows allowed",$advanced:"true"}</description>
<config-property-name>MaxResultRows</config-property-name>
<config-property-type>java.lang.Integer</config-property-type>
- <config-property-value>10000</config-property-value>
+ <config-property-value>-1</config-property-value>
</config-property>
<!-- XML-Relational HTTP Connector Specific properties -->
@@ -101,7 +101,7 @@
<description>{$display:"Request Timeout (in Milliseconds)",$required:"true"}</description>
<config-property-name>RequestTimeout</config-property-name>
<config-property-type>java.lang.Integer</config-property-type>
- <config-property-value>10000</config-property-value>
+ <config-property-value>-1</config-property-value>
</config-property>
<config-property>
Modified: trunk/connectors/connector-xml-soap/src/main/rar/META-INF/ra.xml
===================================================================
--- trunk/connectors/connector-xml-soap/src/main/rar/META-INF/ra.xml 2010-03-24 17:52:06 UTC (rev 1995)
+++ trunk/connectors/connector-xml-soap/src/main/rar/META-INF/ra.xml 2010-03-24 18:09:15 UTC (rev 1996)
@@ -79,7 +79,7 @@
<description>{$display:"Maximum Result Rows",$description:"Maximum Result Rows allowed",$advanced:"true"}</description>
<config-property-name>MaxResultRows</config-property-name>
<config-property-type>java.lang.Integer</config-property-type>
- <config-property-value>10000</config-property-value>
+ <config-property-value>-1</config-property-value>
</config-property>
<!-- XML Source SOAP Connector Specific properties -->
Modified: trunk/connectors/sandbox/connector-template/src/main/rar/META-INF/ra.xml
===================================================================
--- trunk/connectors/sandbox/connector-template/src/main/rar/META-INF/ra.xml 2010-03-24 17:52:06 UTC (rev 1995)
+++ trunk/connectors/sandbox/connector-template/src/main/rar/META-INF/ra.xml 2010-03-24 18:09:15 UTC (rev 1996)
@@ -63,7 +63,7 @@
<description>{$display:"Maximum Result Rows",$description:"Maximum Result Rows allowed",$advanced:"true"}</description>
<config-property-name>MaxResultRows</config-property-name>
<config-property-type>java.lang.Integer</config-property-type>
- <config-property-value>10000</config-property-value>
+ <config-property-value>-1</config-property-value>
</config-property>
<!-- ${connector-name} Specific properties START -->
Modified: trunk/connectors/sandbox/connector-yahoo/src/main/rar/META-INF/ra.xml
===================================================================
--- trunk/connectors/sandbox/connector-yahoo/src/main/rar/META-INF/ra.xml 2010-03-24 17:52:06 UTC (rev 1995)
+++ trunk/connectors/sandbox/connector-yahoo/src/main/rar/META-INF/ra.xml 2010-03-24 18:09:15 UTC (rev 1996)
@@ -79,7 +79,7 @@
<description>{$display:"Maximum Result Rows",$description:"Maximum Result Rows allowed",$advanced:"true"}</description>
<config-property-name>MaxResultRows</config-property-name>
<config-property-type>java.lang.Integer</config-property-type>
- <config-property-value>10000</config-property-value>
+ <config-property-value>-1</config-property-value>
</config-property>
<!-- Yahoo Specific properties -->
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWorkItem.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWorkItem.java 2010-03-24 17:52:06 UTC (rev 1995)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/impl/ConnectorWorkItem.java 2010-03-24 18:09:15 UTC (rev 1996)
@@ -304,7 +304,7 @@
correctTypes(row);
rows.add(row);
// Check for max result rows exceeded
- if(this.connectorEnv.getMaxResultRows() != 0 && this.rowCount >= this.connectorEnv.getMaxResultRows()){
+ if(this.connectorEnv.getMaxResultRows() > -1 && this.rowCount >= this.connectorEnv.getMaxResultRows()){
if (this.rowCount == this.connectorEnv.getMaxResultRows() && !this.connectorEnv.isExceptionOnMaxRows()) {
LogManager.logDetail(LogConstants.CTX_CONNECTOR, new Object[] {this.id, "Exceeded max, returning", this.connectorEnv.getMaxResultRows()}); //$NON-NLS-1$
this.lastBatch = true;
14 years, 9 months