teiid SVN: r658 - in branches/jdbc30-jdk15: client-jdbc30 and 7 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-03-27 17:44:26 -0400 (Fri, 27 Mar 2009)
New Revision: 658
Added:
branches/jdbc30-jdk15/client-jdbc30/
branches/jdbc30-jdk15/client-jdbc30/pom.xml
branches/jdbc30-jdk15/client-jdbc30/src/
branches/jdbc30-jdk15/client-jdbc30/src/main/
branches/jdbc30-jdk15/client-jdbc30/src/main/java/
branches/jdbc30-jdk15/client-jdbc30/src/main/java/com/
branches/jdbc30-jdk15/client-jdbc30/src/main/java/com/metamatrix/
branches/jdbc30-jdk15/client-jdbc30/src/main/java/com/metamatrix/core/
branches/jdbc30-jdk15/client-jdbc30/src/main/java/com/metamatrix/core/jdbc/
branches/jdbc30-jdk15/client-jdbc30/src/main/java/com/metamatrix/core/jdbc/SQLXML.java
Log:
TEIID-177: making source weave with special tags, which will aid in building the 1.6 and 1.5 code base for the jdbc client
Property changes on: branches/jdbc30-jdk15/client-jdbc30
___________________________________________________________________
Name: svn:ignore
+ .classpath
.project
.settings
Added: branches/jdbc30-jdk15/client-jdbc30/pom.xml
===================================================================
--- branches/jdbc30-jdk15/client-jdbc30/pom.xml (rev 0)
+++ branches/jdbc30-jdk15/client-jdbc30/pom.xml 2009-03-27 21:44:26 UTC (rev 658)
@@ -0,0 +1,191 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>teiid</artifactId>
+ <groupId>org.jboss.teiid</groupId>
+ <version>6.0.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-client-jdbc30</artifactId>
+ <name>JDBC 3.0 Client</name>
+ <version>6.0.0-SNAPSHOT</version>
+ <description>JDBC 3.0 Compatible Client for JDK1.5</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ <showDeprecation>false</showDeprecation>
+ <showWarnings>false</showWarnings>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <includes>
+ <include>**/*TestCase.java</include>
+ <include>**/*Test.java</include>
+ <include>**/Test*.java</include>
+ </includes>
+ <excludes>
+ <exclude>**/Abstract*TestCase.java</exclude>
+ <!-- hack to prevent anonymous inner classes in Tests from being run as tests -->
+ <include>**/Test*$*.java</include>
+ </excludes>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>1.7.0</version>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>generate-1.5</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <tasks>
+ <copy todir="${project.build.directory}/generated-sources/main/java" overwrite="true">
+ <fileset dir="${basedir}/../client-jdbc/src/main/java">
+ <include name="**/*.java"/>
+ </fileset>
+ <fileset dir="${basedir}/../common-core/src/main/java">
+ <include name="**/*.java"/>
+ </fileset>
+ <fileset dir="${basedir}/../client/src/main/java">
+ <include name="**/*.java"/>
+ </fileset>
+
+ <filterset begintoken="/*## " endtoken=" ##">
+ <filter token="JDBC3.0-JDK1.5-begin" value=""/>
+ <filter token="JDBC3.0-JDK1.5-end" value=""/>
+ </filterset>
+
+ <filterset begintoken="## " endtoken=" ##*/">
+ <filter token="JDBC3.0-JDK1.5-begin" value=""/>
+ <filter token="JDBC3.0-JDK1.5-end" value=""/>
+ </filterset>
+
+ <filterset begintoken="//## " endtoken=" ##">
+ <filter token="JDBC4.0-begin" value="/*"/>
+ <filter token="JDBC4.0-end" value="*/"/>
+ </filterset>
+ </copy>
+ <copy todir="${project.build.directory}/generated-sources/main/resources" overwrite="true">
+ <fileset dir="${basedir}/../client-jdbc/src/main/resources">
+ <include name="**/*"/>
+ </fileset>
+ <fileset dir="${basedir}/../common-core/src/main/resources">
+ <include name="**/*"/>
+ </fileset>
+ <fileset dir="${basedir}/../client/src/main/resources">
+ <include name="**/*"/>
+ </fileset>
+ </copy>
+ </tasks>
+ <sourceRoot>${project.build.directory}/generated-sources/main/java</sourceRoot>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <!--
+ <execution>
+ <id>generate-1.5-test</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <tasks>
+ <copy todir="${project.build.directory}/generated-sources/test/java" overwrite="true">
+ <fileset dir="${basedir}/../client-jdbc/src/test/java">
+ <include name="**/*.java"/>
+ </fileset>
+ <fileset dir="${basedir}/../common-core/src/test/java">
+ <include name="**/*.java"/>
+ </fileset>
+ <fileset dir="${basedir}/../client/src/test/java">
+ <include name="**/*.java"/>
+ </fileset>
+
+ <filterset begintoken="/*## " endtoken=" ##">
+ <filter token="JDBC3.0-JDK1.5-begin" value=""/>
+ <filter token="JDBC3.0-JDK1.5-end" value=""/>
+ </filterset>
+
+ <filterset begintoken="## " endtoken=" ##*/">
+ <filter token="JDBC3.0-JDK1.5-begin" value=""/>
+ <filter token="JDBC3.0-JDK1.5-end" value=""/>
+ </filterset>
+
+ <filterset begintoken="//## " endtoken=" ##">
+ <filter token="JDBC4.0-begin" value="/*"/>
+ <filter token="JDBC4.0-end" value="*/"/>
+ </filterset>
+ </copy>
+ <copy todir="${project.build.directory}/generated-sources/test/resources" overwrite="true">
+ <fileset dir="${basedir}/../client-jdbc/src/test/resources">
+ <include name="**/*"/>
+ </fileset>
+ <fileset dir="${basedir}/../common-core/src/test/resources">
+ <include name="**/*"/>
+ </fileset>
+ <fileset dir="${basedir}/../client/src/test/resources">
+ <include name="**/*"/>
+ </fileset>
+ </copy>
+ </tasks>
+ <testSourceRoot>${project.build.directory}/generated-sources/test/java</testSourceRoot>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ -->
+ </executions>
+ </plugin>
+ </plugins>
+
+ <resources>
+ <resource>
+ <directory>${project.build.directory}/generated-sources/main/resources</directory>
+ <filtering>false</filtering>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </resource>
+ <!--
+ <resource>
+ <directory>${project.build.directory}/generated-sources/test/resources</directory>
+ <filtering>false</filtering>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </resource>
+ -->
+ </resources>
+
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <version>1.3</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Property changes on: branches/jdbc30-jdk15/client-jdbc30/pom.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/jdbc30-jdk15/client-jdbc30/src/main/java/com/metamatrix/core/jdbc/SQLXML.java
===================================================================
--- branches/jdbc30-jdk15/client-jdbc30/src/main/java/com/metamatrix/core/jdbc/SQLXML.java (rev 0)
+++ branches/jdbc30-jdk15/client-jdbc30/src/main/java/com/metamatrix/core/jdbc/SQLXML.java 2009-03-27 21:44:26 UTC (rev 658)
@@ -0,0 +1,407 @@
+/*
+ * %W% %E%
+ *
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ */
+package com.metamatrix.core.jdbc;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
+import java.sql.SQLException;
+
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+
+/**
+ * The mapping in the JavaTM programming language for the SQL XML type.
+ * XML is a built-in type that stores an XML value
+ * as a column value in a row of a database table.
+ * By default drivers implement an SQLXML object as
+ * a logical pointer to the XML data
+ * rather than the data itself.
+ * An SQLXML object is valid for the duration of the transaction in which it was created.
+ * <p>
+ * The SQLXML interface provides methods for accessing the XML value
+ * as a String, a Reader or Writer, or as a Stream. The XML value
+ * may also be accessed through a Source or set as a Result, which
+ * are used with XML Parser APIs such as DOM, SAX, and StAX, as
+ * well as with XSLT transforms and XPath evaluations.
+ * <p>
+ * Methods in the interfaces ResultSet, CallableStatement, and PreparedStatement,
+ * such as getSQLXML allow a programmer to access an XML value.
+ * In addition, this interface has methods for updating an XML value.
+ * <p>
+ * The XML value of the SQLXML instance may be obtained as a BinaryStream using
+ * <pre>
+ * SQLXML sqlxml = resultSet.getSQLXML(column);
+ * InputStream binaryStream = sqlxml.getBinaryStream();
+ * </pre>
+ * For example, to parse an XML value with a DOM parser:
+ * <pre>
+ * DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ * Document result = parser.parse(binaryStream);
+ * </pre>
+ * or to parse an XML value with a SAX parser to your handler:
+ * <pre>
+ * SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
+ * parser.parse(binaryStream, myHandler);
+ * </pre>
+ * or to parse an XML value with a StAX parser:
+ * <pre>
+ * XMLInputFactory factory = XMLInputFactory.newInstance();
+ * XMLStreamReader streamReader = factory.createXMLStreamReader(binaryStream);
+ * </pre>
+ * <p>
+ * Because databases may use an optimized representation for the XML,
+ * accessing the value through getSource() and
+ * setResult() can lead to improved processing performance
+ * without serializing to a stream representation and parsing the XML.
+ * <p>
+ * For example, to obtain a DOM Document Node:
+ * <pre>
+ * DOMSource domSource = sqlxml.getSource(DOMSource.class);
+ * Document document = (Document) domSource.getNode();
+ * </pre>
+ * or to set the value to a DOM Document Node to myNode:
+ * <pre>
+ * DOMResult domResult = sqlxml.setResult(DOMResult.class);
+ * domResult.setNode(myNode);
+ * </pre>
+ * or, to send SAX events to your handler:
+ * <pre>
+ * SAXSource saxSource = sqlxml.getSource(SAXSource.class);
+ * XMLReader xmlReader = saxSource.getXMLReader();
+ * xmlReader.setContentHandler(myHandler);
+ * xmlReader.parse(saxSource.getInputSource());
+ * </pre>
+ * or, to set the result value from SAX events:
+ * <pre>
+ * SAXResult saxResult = sqlxml.setResult(SAXResult.class);
+ * ContentHandler contentHandler = saxResult.getXMLReader().getContentHandler();
+ * contentHandler.startDocument();
+ * // set the XML elements and attributes into the result
+ * contentHandler.endDocument();
+ * </pre>
+ * or, to obtain StAX events:
+ * <pre>
+ * StAXSource staxSource = sqlxml.getSource(StAXSource.class);
+ * XMLStreamReader streamReader = staxSource.getXMLStreamReader();
+ * </pre>
+ * or, to set the result value from StAX events:
+ * <pre>
+ * StAXResult staxResult = sqlxml.setResult(StAXResult.class);
+ * XMLStreamWriter streamWriter = staxResult.getXMLStreamWriter();
+ * </pre>
+ * or, to perform XSLT transformations on the XML value using the XSLT in xsltFile
+ * output to file resultFile:
+ * <pre>
+ * File xsltFile = new File("a.xslt");
+ * File myFile = new File("result.xml");
+ * Transformer xslt = TransformerFactory.newInstance().newTransformer(new StreamSource(xsltFile));
+ * Source source = sqlxml.getSource(null);
+ * Result result = new StreamResult(myFile);
+ * xslt.transform(source, result);
+ * </pre>
+ * or, to evaluate an XPath expression on the XML value:
+ * <pre>
+ * XPath xpath = XPathFactory.newInstance().newXPath();
+ * DOMSource domSource = sqlxml.getSource(DOMSource.class);
+ * Document document = (Document) domSource.getNode();
+ * String expression = "/foo/@bar";
+ * String barValue = xpath.evaluate(expression, document);
+ * </pre>
+ * To set the XML value to be the result of an XSLT transform:
+ * <pre>
+ * File sourceFile = new File("source.xml");
+ * Transformer xslt = TransformerFactory.newInstance().newTransformer(new StreamSource(xsltFile));
+ * Source streamSource = new StreamSource(sourceFile);
+ * Result result = sqlxml.setResult(null);
+ * xslt.transform(streamSource, result);
+ * </pre>
+ * Any Source can be transformed to a Result using the identity transform
+ * specified by calling newTransformer():
+ * <pre>
+ * Transformer identity = TransformerFactory.newInstance().newTransformer();
+ * Source source = sqlxml.getSource(null);
+ * File myFile = new File("result.xml");
+ * Result result = new StreamResult(myFile);
+ * identity.transform(source, result);
+ * </pre>
+ * To write the contents of a Source to standard output:
+ * <pre>
+ * Transformer identity = TransformerFactory.newInstance().newTransformer();
+ * Source source = sqlxml.getSource(null);
+ * Result result = new StreamResult(System.out);
+ * identity.transform(source, result);
+ * </pre>
+ * To create a DOMSource from a DOMResult:
+ * <pre>
+ * DOMSource domSource = new DOMSource(domResult.getNode());
+ * </pre>
+ * <p>
+ * Incomplete or invalid XML values may cause an SQLException when
+ * set or the exception may occur when execute() occurs. All streams
+ * must be closed before execute() occurs or an SQLException will be thrown.
+ * <p>
+ * Reading and writing XML values to or from an SQLXML object can happen at most once.
+ * The conceptual states of readable and not readable determine if one
+ * of the reading APIs will return a value or throw an exception.
+ * The conceptual states of writable and not writable determine if one
+ * of the writing APIs will set a value or throw an exception.
+ * <p>
+ * The state moves from readable to not readable once free() or any of the
+ * reading APIs are called: getBinaryStream(), getCharacterStream(), getSource(), and getString().
+ * Implementations may also change the state to not writable when this occurs.
+ * <p>
+ * The state moves from writable to not writeable once free() or any of the
+ * writing APIs are called: setBinaryStream(), setCharacterStream(), setResult(), and setString().
+ * Implementations may also change the state to not readable when this occurs.
+ * <p>
+ * <p>
+ * All methods on the <code>SQLXML</code> interface must be fully implemented if the
+ * JDBC driver supports the data type.
+ *
+ * @see javax.xml.parsers
+ * @see javax.xml.stream
+ * @see javax.xml.transform
+ * @see javax.xml.xpath
+ * @since 1.6
+ */
+public interface SQLXML
+{
+ /**
+ * This method closes this object and releases the resources that it held.
+ * The SQL XML object becomes invalid and neither readable or writeable
+ * when this method is called.
+ *
+ * After <code>free</code> has been called, any attempt to invoke a
+ * method other than <code>free</code> will result in a <code>SQLException</code>
+ * being thrown. If <code>free</code> is called multiple times, the subsequent
+ * calls to <code>free</code> are treated as a no-op.
+ * @throws SQLException if there is an error freeing the XML value.
+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
+ * this method
+ * @since 1.6
+ */
+ void free() throws SQLException;
+
+ /**
+ * Retrieves the XML value designated by this SQLXML instance as a stream.
+ * The bytes of the input stream are interpreted according to appendix F of the XML 1.0 specification.
+ * The behavior of this method is the same as ResultSet.getBinaryStream()
+ * when the designated column of the ResultSet has a type java.sql.Types of SQLXML.
+ * <p>
+ * The SQL XML object becomes not readable when this method is called and
+ * may also become not writable depending on implementation.
+ *
+ * @return a stream containing the XML data.
+ * @throws SQLException if there is an error processing the XML value.
+ * An exception is thrown if the state is not readable.
+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
+ * this method
+ * @since 1.6
+ */
+ InputStream getBinaryStream() throws SQLException;
+
+ /**
+ * Retrieves a stream that can be used to write the XML value that this SQLXML instance represents.
+ * The stream begins at position 0.
+ * The bytes of the stream are interpreted according to appendix F of the XML 1.0 specification
+ * The behavior of this method is the same as ResultSet.updateBinaryStream()
+ * when the designated column of the ResultSet has a type java.sql.Types of SQLXML.
+ * <p>
+ * The SQL XML object becomes not writeable when this method is called and
+ * may also become not readable depending on implementation.
+ *
+ * @return a stream to which data can be written.
+ * @throws SQLException if there is an error processing the XML value.
+ * An exception is thrown if the state is not writable.
+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
+ * this method
+ * @since 1.6
+ */
+ OutputStream setBinaryStream() throws SQLException;
+
+ /**
+ * Retrieves the XML value designated by this SQLXML instance as a java.io.Reader object.
+ * The format of this stream is defined by org.xml.sax.InputSource,
+ * where the characters in the stream represent the unicode code points for
+ * XML according to section 2 and appendix B of the XML 1.0 specification.
+ * Although an encoding declaration other than unicode may be present,
+ * the encoding of the stream is unicode.
+ * The behavior of this method is the same as ResultSet.getCharacterStream()
+ * when the designated column of the ResultSet has a type java.sql.Types of SQLXML.
+ * <p>
+ * The SQL XML object becomes not readable when this method is called and
+ * may also become not writable depending on implementation.
+ *
+ * @return a stream containing the XML data.
+ * @throws SQLException if there is an error processing the XML value.
+ * The getCause() method of the exception may provide a more detailed exception, for example,
+ * if the stream does not contain valid characters.
+ * An exception is thrown if the state is not readable.
+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
+ * this method
+ * @since 1.6
+ */
+ Reader getCharacterStream() throws SQLException;
+
+ /**
+ * Retrieves a stream to be used to write the XML value that this SQLXML instance represents.
+ * The format of this stream is defined by org.xml.sax.InputSource,
+ * where the characters in the stream represent the unicode code points for
+ * XML according to section 2 and appendix B of the XML 1.0 specification.
+ * Although an encoding declaration other than unicode may be present,
+ * the encoding of the stream is unicode.
+ * The behavior of this method is the same as ResultSet.updateCharacterStream()
+ * when the designated column of the ResultSet has a type java.sql.Types of SQLXML.
+ * <p>
+ * The SQL XML object becomes not writeable when this method is called and
+ * may also become not readable depending on implementation.
+ *
+ * @return a stream to which data can be written.
+ * @throws SQLException if there is an error processing the XML value.
+ * The getCause() method of the exception may provide a more detailed exception, for example,
+ * if the stream does not contain valid characters.
+ * An exception is thrown if the state is not writable.
+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
+ * this method
+ * @since 1.6
+ */
+ Writer setCharacterStream() throws SQLException;
+
+ /**
+ * Returns a string representation of the XML value designated by this SQLXML instance.
+ * The format of this String is defined by org.xml.sax.InputSource,
+ * where the characters in the stream represent the unicode code points for
+ * XML according to section 2 and appendix B of the XML 1.0 specification.
+ * Although an encoding declaration other than unicode may be present,
+ * the encoding of the String is unicode.
+ * The behavior of this method is the same as ResultSet.getString()
+ * when the designated column of the ResultSet has a type java.sql.Types of SQLXML.
+ * <p>
+ * The SQL XML object becomes not readable when this method is called and
+ * may also become not writable depending on implementation.
+ *
+ * @return a string representation of the XML value designated by this SQLXML instance.
+ * @throws SQLException if there is an error processing the XML value.
+ * The getCause() method of the exception may provide a more detailed exception, for example,
+ * if the stream does not contain valid characters.
+ * An exception is thrown if the state is not readable.
+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
+ * this method
+ * @since 1.6
+ */
+ String getString() throws SQLException;
+
+ /**
+ * Sets the XML value designated by this SQLXML instance to the given String representation.
+ * The format of this String is defined by org.xml.sax.InputSource,
+ * where the characters in the stream represent the unicode code points for
+ * XML according to section 2 and appendix B of the XML 1.0 specification.
+ * Although an encoding declaration other than unicode may be present,
+ * the encoding of the String is unicode.
+ * The behavior of this method is the same as ResultSet.updateString()
+ * when the designated column of the ResultSet has a type java.sql.Types of SQLXML.
+ * <p>
+ * The SQL XML object becomes not writeable when this method is called and
+ * may also become not readable depending on implementation.
+ *
+ * @param value the XML value
+ * @throws SQLException if there is an error processing the XML value.
+ * The getCause() method of the exception may provide a more detailed exception, for example,
+ * if the stream does not contain valid characters.
+ * An exception is thrown if the state is not writable.
+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
+ * this method
+ * @since 1.6
+ */
+ void setString(String value) throws SQLException;
+
+ /**
+ * Returns a Source for reading the XML value designated by this SQLXML instance.
+ * Sources are used as inputs to XML parsers and XSLT transformers.
+ * <p>
+ * Sources for XML parsers will have namespace processing on by default.
+ * The systemID of the Source is implementation dependent.
+ * <p>
+ * The SQL XML object becomes not readable when this method is called and
+ * may also become not writable depending on implementation.
+ * <p>
+ * Note that SAX is a callback architecture, so a returned
+ * SAXSource should then be set with a content handler that will
+ * receive the SAX events from parsing. The content handler
+ * will receive callbacks based on the contents of the XML.
+ * <pre>
+ * SAXSource saxSource = sqlxml.getSource(SAXSource.class);
+ * XMLReader xmlReader = saxSource.getXMLReader();
+ * xmlReader.setContentHandler(myHandler);
+ * xmlReader.parse(saxSource.getInputSource());
+ * </pre>
+ *
+ * @param sourceClass The class of the source, or null.
+ * If the class is null, a vendor specifc Source implementation will be returned.
+ * The following classes are supported at a minimum:
+ * <pre>
+ * javax.xml.transform.dom.DOMSource - returns a DOMSource
+ * javax.xml.transform.sax.SAXSource - returns a SAXSource
+ * javax.xml.transform.stax.StAXSource - returns a StAXSource
+ * javax.xml.transform.stream.StreamSource - returns a StreamSource
+ * </pre>
+ * @return a Source for reading the XML value.
+ * @throws SQLException if there is an error processing the XML value
+ * or if this feature is not supported.
+ * The getCause() method of the exception may provide a more detailed exception, for example,
+ * if an XML parser exception occurs.
+ * An exception is thrown if the state is not readable.
+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
+ * this method
+ * @since 1.6
+ */
+ <T extends Source> T getSource(Class<T> sourceClass) throws SQLException;
+
+ /**
+ * Returns a Result for setting the XML value designated by this SQLXML instance.
+ * <p>
+ * The systemID of the Result is implementation dependent.
+ * <p>
+ * The SQL XML object becomes not writeable when this method is called and
+ * may also become not readable depending on implementation.
+ * <p>
+ * Note that SAX is a callback architecture and the returned
+ * SAXResult has a content handler assigned that will receive the
+ * SAX events based on the contents of the XML. Call the content
+ * handler with the contents of the XML document to assign the values.
+ * <pre>
+ * SAXResult saxResult = sqlxml.setResult(SAXResult.class);
+ * ContentHandler contentHandler = saxResult.getXMLReader().getContentHandler();
+ * contentHandler.startDocument();
+ * // set the XML elements and attributes into the result
+ * contentHandler.endDocument();
+ * </pre>
+ *
+ * @param resultClass The class of the result, or null.
+ * If resultClass is null, a vendor specific Result implementation will be returned.
+ * The following classes are supported at a minimum:
+ * <pre>
+ * javax.xml.transform.dom.DOMResult - returns a DOMResult
+ * javax.xml.transform.sax.SAXResult - returns a SAXResult
+ * javax.xml.transform.stax.StAXResult - returns a StAXResult
+ * javax.xml.transform.stream.StreamResult - returns a StreamResult
+ * </pre>
+ * @return Returns a Result for setting the XML value.
+ * @throws SQLException if there is an error processing the XML value
+ * or if this feature is not supported.
+ * The getCause() method of the exception may provide a more detailed exception, for example,
+ * if an XML parser exception occurs.
+ * An exception is thrown if the state is not writable.
+ * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
+ * this method
+ * @since 1.6
+ */
+ <T extends Result> T setResult(Class<T> resultClass) throws SQLException;
+
+}
Property changes on: branches/jdbc30-jdk15/client-jdbc30/src/main/java/com/metamatrix/core/jdbc/SQLXML.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 9 months
teiid SVN: r657 - in branches/jdbc30-jdk15: client/src/main/java/com/metamatrix/common/comm/platform/client and 15 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-03-27 17:41:20 -0400 (Fri, 27 Mar 2009)
New Revision: 657
Modified:
branches/jdbc30-jdk15/client-jdbc/pom.xml
branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/DataTypeTransformer.java
branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMBlob.java
branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMCallableStatement.java
branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMClob.java
branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java
branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDatabaseMetaData.java
branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMPreparedStatement.java
branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMResultSet.java
branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMSQLXML.java
branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMStatement.java
branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMXAConnection.java
branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/WarningUtil.java
branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/WrapperImpl.java
branches/jdbc30-jdk15/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMResultSet.java
branches/jdbc30-jdk15/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMXAConnection.java
branches/jdbc30-jdk15/client-jdbc/src/test/java/com/metamatrix/jdbc/TestWrapperImpl.java
branches/jdbc30-jdk15/client/src/main/java/com/metamatrix/common/comm/exception/ExceptionHolder.java
branches/jdbc30-jdk15/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java
branches/jdbc30-jdk15/client/src/main/java/com/metamatrix/common/comm/platform/socket/SocketUtil.java
branches/jdbc30-jdk15/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/OioOjbectChannelFactory.java
branches/jdbc30-jdk15/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java
branches/jdbc30-jdk15/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerInstanceImpl.java
branches/jdbc30-jdk15/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/UrlServerDiscovery.java
branches/jdbc30-jdk15/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerConnection.java
branches/jdbc30-jdk15/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerInstanceImpl.java
branches/jdbc30-jdk15/client/src/test/java/com/metamatrix/common/lob/TestReaderInputStream.java
branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/jdbc/SimplePooledConnectionSource.java
branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/protocol/mmfile/MMFileURLConnection.java
branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/types/BlobImpl.java
branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/types/BlobType.java
branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/types/ClobImpl.java
branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/types/ClobType.java
branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java
branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/types/SQLXMLImpl.java
branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/types/XMLType.java
branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/util/NetUtils.java
branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/util/SqlUtil.java
branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/internal/core/log/PlatformLog.java
branches/jdbc30-jdk15/common-core/src/test/java/com/metamatrix/common/jdbc/TestSimplePooledConnectionSource.java
branches/jdbc30-jdk15/common-core/src/test/java/com/metamatrix/common/types/TestBlobValue.java
branches/jdbc30-jdk15/common-core/src/test/java/com/metamatrix/common/types/TestClobValue.java
branches/jdbc30-jdk15/common-core/src/test/java/com/metamatrix/common/types/TestSQLXMLImpl.java
branches/jdbc30-jdk15/common-core/src/test/java/com/metamatrix/common/types/TestXMLValue.java
branches/jdbc30-jdk15/common-core/src/test/java/com/metamatrix/common/types/basic/TestStringToXmlTransform.java
Log:
TEIID-177: making source weave with special tags, which will aid in building the 1.6 and 1.5 code base for the jdbc client
Modified: branches/jdbc30-jdk15/client/src/main/java/com/metamatrix/common/comm/exception/ExceptionHolder.java
===================================================================
--- branches/jdbc30-jdk15/client/src/main/java/com/metamatrix/common/comm/exception/ExceptionHolder.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/client/src/main/java/com/metamatrix/common/comm/exception/ExceptionHolder.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -47,8 +47,10 @@
this.className = exception.getClass().getName();
this.message = exception.getMessage();
}
-
+
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
this.className = (String)in.readObject();
@@ -56,8 +58,9 @@
this.message = (String)in.readObject();
this.exception = (Throwable)in.readObject();
}
-
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public void writeExternal(ObjectOutput out) throws IOException {
out.writeObject(this.className);
out.writeBoolean(this.isProcessingException);
Modified: branches/jdbc30-jdk15/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java
===================================================================
--- branches/jdbc30-jdk15/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -77,7 +77,9 @@
return target;
}
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {
if (method.getName().equals("close")) { //$NON-NLS-1$
Modified: branches/jdbc30-jdk15/client/src/main/java/com/metamatrix/common/comm/platform/socket/SocketUtil.java
===================================================================
--- branches/jdbc30-jdk15/client/src/main/java/com/metamatrix/common/comm/platform/socket/SocketUtil.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/client/src/main/java/com/metamatrix/common/comm/platform/socket/SocketUtil.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -115,7 +115,12 @@
// One way SSL with custom properties defined
result = getClientSSLContext(null, null, truststore, truststorePassword, keystoreAlgorithm, keystoreType, keystoreProtocol);
} else {
+ //## JDBC4.0-begin ##
result = SSLContext.getDefault();
+ //## JDBC4.0-end ##
+ /*## JDBC3.0-JDK1.5-begin ##
+ result = SSLContext.getInstance("Default");
+ ## JDBC3.0-JDK1.5-end ##*/
}
return new SSLSocketFactory(result, anon);
}
Modified: branches/jdbc30-jdk15/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/OioOjbectChannelFactory.java
===================================================================
--- branches/jdbc30-jdk15/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/OioOjbectChannelFactory.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/OioOjbectChannelFactory.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -73,7 +73,9 @@
inputStream = new ObjectDecoderInputStream(new DataInputStream(bis), cl, MAX_OBJECT_SIZE);
}
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public void close() {
log.finer("closing socket"); //$NON-NLS-1$
try {
@@ -98,17 +100,23 @@
}
}
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public SocketAddress getRemoteAddress() {
return socket.getRemoteSocketAddress();
}
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public boolean isOpen() {
return !socket.isClosed();
}
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public Object read() throws IOException, ClassNotFoundException {
log.finer("reading message from socket"); //$NON-NLS-1$
synchronized (readLock) {
@@ -123,7 +131,9 @@
}
}
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public synchronized Future<?> write(Object msg) {
log.finer("writing message to socket"); //$NON-NLS-1$
ResultsFuture<Void> result = new ResultsFuture<Void>();
@@ -152,7 +162,9 @@
PropertiesUtils.setBeanProperties(this, props, "org.teiid.sockets"); //$NON-NLS-1$
}
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public ObjectChannel createObjectChannel(SocketAddress address, boolean ssl) throws IOException,
CommunicationException {
final Socket socket;
Modified: branches/jdbc30-jdk15/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java
===================================================================
--- branches/jdbc30-jdk15/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -67,7 +67,9 @@
this.key = key;
}
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public Object invoke(Object arg0, Method arg1, Object[] arg2)
throws Throwable {
if (arg1.getName().equals("shutdown")) { //$NON-NLS-1$
Modified: branches/jdbc30-jdk15/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerInstanceImpl.java
===================================================================
--- branches/jdbc30-jdk15/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerInstanceImpl.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerInstanceImpl.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -232,7 +232,9 @@
}
@SuppressWarnings("unchecked")
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public <T> T getService(Class<T> iface) {
return (T)Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {iface}, new RemoteInvocationHandler(iface));
}
@@ -247,7 +249,9 @@
this.secure = !ClientSideDQP.class.isAssignableFrom(targetClass);
}
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {
Throwable t = null;
Modified: branches/jdbc30-jdk15/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/UrlServerDiscovery.java
===================================================================
--- branches/jdbc30-jdk15/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/UrlServerDiscovery.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/UrlServerDiscovery.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -43,33 +43,45 @@
this.url = url;
}
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public List<HostInfo> getKnownHosts() {
return url.getHostInfo();
}
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public void init(MMURL url, Properties p) {
this.url = url;
}
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public void connectionSuccessful(HostInfo info,
SocketServerInstance instance) {
}
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public void markInstanceAsBad(HostInfo info) {
}
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public boolean setLogonResult(LogonResult result) {
return false;
}
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public void shutdown() {
}
Modified: branches/jdbc30-jdk15/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerConnection.java
===================================================================
--- branches/jdbc30-jdk15/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerConnection.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerConnection.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -58,7 +58,9 @@
Throwable t;
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public void assertIdentity(
MetaMatrixSessionID sessionId)
throws InvalidSessionException,
@@ -66,14 +68,18 @@
}
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public ResultsFuture<?> logoff()
throws InvalidSessionException,
MetaMatrixComponentException {
return null;
}
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public LogonResult logon(
Properties connectionProperties)
throws LogonException,
@@ -81,7 +87,9 @@
return new LogonResult(new MetaMatrixSessionID(1), "fooUser", new Properties(), 1, "fake"); //$NON-NLS-1$ //$NON-NLS-2$
}
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public ResultsFuture<?> ping()
throws InvalidSessionException,
MetaMatrixComponentException {
@@ -121,7 +129,9 @@
public void testLogonFailsWithMultipleHosts() throws Exception {
Properties p = new Properties();
SocketServerInstanceFactory instanceFactory = new SocketServerInstanceFactory() {
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public SocketServerInstance getServerInstance(HostInfo info,
boolean ssl) throws CommunicationException, IOException {
throw new SingleInstanceCommunicationException();
@@ -170,7 +180,9 @@
Properties p = new Properties();
ServerDiscovery discovery = new UrlServerDiscovery(new MMURL(hostInfo.getHostName(), hostInfo.getPortNumber(), false));
SocketServerInstanceFactory instanceFactory = new SocketServerInstanceFactory() {
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public SocketServerInstance getServerInstance(final HostInfo info,
boolean ssl) throws CommunicationException, IOException {
SocketServerInstance instance = Mockito.mock(SocketServerInstance.class);
Modified: branches/jdbc30-jdk15/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerInstanceImpl.java
===================================================================
--- branches/jdbc30-jdk15/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerInstanceImpl.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerInstanceImpl.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -53,17 +53,23 @@
this.readMsgs = readMsgs;
}
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public void close() {
}
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public boolean isOpen() {
return true;
}
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public Future<?> write(Object msg) {
msgs.add(msg);
ResultsFuture<?> result = new ResultsFuture<Void>();
@@ -71,7 +77,9 @@
return result;
}
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public Object read() throws IOException,
ClassNotFoundException {
Object msg = readMsgs.get(readCount++);
@@ -87,18 +95,24 @@
return msg;
}
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public SocketAddress getRemoteAddress() {
return null;
}
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public ObjectChannel createObjectChannel(SocketAddress address,
boolean ssl) throws IOException, CommunicationException {
return this;
}
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public int getSoTimeout() {
return 1;
}
Modified: branches/jdbc30-jdk15/client/src/test/java/com/metamatrix/common/lob/TestReaderInputStream.java
===================================================================
--- branches/jdbc30-jdk15/client/src/test/java/com/metamatrix/common/lob/TestReaderInputStream.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/client/src/test/java/com/metamatrix/common/lob/TestReaderInputStream.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -53,7 +53,7 @@
ReaderInputStream ris = new ReaderInputStream(new StringReader(actual), Charset.forName("UTF-16"), 1); //$NON-NLS-1$
byte[] result = new byte[(actual.length()) * 2 + 2];
ris.read(result);
- String resultString = new String(result, Charset.forName("UTF-16")); //$NON-NLS-1$
+ String resultString = new String(result, "UTF-16"); //$NON-NLS-1$
assertEquals(resultString, actual);
}
@@ -62,7 +62,7 @@
ReaderInputStream ris = new ReaderInputStream(new StringReader(actual), Charset.forName("US-ASCII"), 1); //$NON-NLS-1$
byte[] result = new byte[actual.length()];
ris.read(result);
- String resultString = new String(result, Charset.forName("US-ASCII")); //$NON-NLS-1$
+ String resultString = new String(result, "US-ASCII"); //$NON-NLS-1$
assertEquals(resultString, actual);
}
Modified: branches/jdbc30-jdk15/client-jdbc/pom.xml
===================================================================
--- branches/jdbc30-jdk15/client-jdbc/pom.xml 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/client-jdbc/pom.xml 2009-03-27 21:41:20 UTC (rev 657)
@@ -31,22 +31,6 @@
<artifactId>teiid-client</artifactId>
<type>test-jar</type>
</dependency>
-
</dependencies>
-
- <build>
- <plugins>
- <!-- Specify the compiler options and settings -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- <showDeprecation>false</showDeprecation>
- <showWarnings>false</showWarnings>
- </configuration>
- </plugin>
- </plugins>
- </build>
+
</project>
\ No newline at end of file
Modified: branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/DataTypeTransformer.java
===================================================================
--- branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/DataTypeTransformer.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/DataTypeTransformer.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -27,7 +27,12 @@
import java.sql.Clob;
import java.sql.Date;
import java.sql.SQLException;
+//## 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.Time;
import java.sql.Timestamp;
@@ -253,5 +258,5 @@
*/
static final SQLXML getSQLXML(Object value) throws SQLException {
return transform(value, SQLXML.class, DefaultDataClasses.XML, "SQLXML"); //$NON-NLS-1$
- }
+ }
}
\ No newline at end of file
Modified: branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMBlob.java
===================================================================
--- branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMBlob.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMBlob.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -27,12 +27,12 @@
import java.io.OutputStream;
import java.sql.Blob;
import java.sql.SQLException;
-import java.sql.SQLFeatureNotSupportedException;
import com.metamatrix.common.lob.LobChunkInputStream;
import com.metamatrix.common.types.BlobImpl;
import com.metamatrix.common.types.BlobType;
import com.metamatrix.common.types.Streamable;
+import com.metamatrix.common.util.SqlUtil;
import com.metamatrix.dqp.client.impl.StreamingLobChunckProducer;
import com.metamatrix.jdbc.LobSearchUtil.StreamProvider;
@@ -185,28 +185,40 @@
}
public void free() throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public InputStream getBinaryStream(long arg0, long arg1)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
- public OutputStream setBinaryStream(long arg0) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+
+ /**
+ * @see java.sql.Blob#setBytes(long, byte[])
+ */
+ public int setBytes(long pos, byte[] bytes) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
}
- public int setBytes(long arg0, byte[] arg1) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ /**
+ * @see java.sql.Blob#setBytes(long, byte[], int, int)
+ */
+ public int setBytes(long pos, byte[] bytes, int offset, int len) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
}
- public int setBytes(long arg0, byte[] arg1, int arg2, int arg3)
- throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ /**
+ * @see java.sql.Blob#setBinaryStream(long)
+ */
+ public OutputStream setBinaryStream(long pos) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
}
- public void truncate(long arg0) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ /**
+ * @see java.sql.Blob#truncate(long)
+ */
+ public void truncate(long len) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
}
}
Modified: branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMCallableStatement.java
===================================================================
--- branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMCallableStatement.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMCallableStatement.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -31,17 +31,24 @@
import java.sql.CallableStatement;
import java.sql.Clob;
import java.sql.Date;
-import java.sql.NClob;
import java.sql.Ref;
-import java.sql.RowId;
import java.sql.SQLException;
-import java.sql.SQLFeatureNotSupportedException;
+//## JDBC4.0-begin ##
import java.sql.SQLXML;
+import java.sql.NClob;
+import java.sql.RowId;
+//## JDBC4.0-end ##
+
+/*## JDBC3.0-JDK1.5-begin ##
+import com.metamatrix.core.jdbc.SQLXML;
+## JDBC3.0-JDK1.5-end ##*/
+
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.Map;
+import com.metamatrix.common.util.SqlUtil;
import com.metamatrix.common.util.TimestampWithTimezone;
import com.metamatrix.dqp.message.RequestMessage;
@@ -396,385 +403,385 @@
}
public Array getArray(int parameterIndex) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public Array getArray(String parameterName) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public BigDecimal getBigDecimal(String parameterName) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public Blob getBlob(String parameterName) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public boolean getBoolean(String parameterName) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public byte getByte(String parameterName) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public byte[] getBytes(int parameterIndex) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public byte[] getBytes(String parameterName) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public Reader getCharacterStream(int parameterIndex) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public Reader getCharacterStream(String parameterName) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public Clob getClob(String parameterName) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public Date getDate(String parameterName) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public Date getDate(String parameterName, Calendar cal) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public double getDouble(String parameterName) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public float getFloat(String parameterName) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public int getInt(String parameterName) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public long getLong(String parameterName) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public Reader getNCharacterStream(int parameterIndex) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public Reader getNCharacterStream(String parameterName) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
+ //## JDBC4.0-begin ##
public NClob getNClob(int parameterIndex) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
+ //## JDBC4.0-end ##
+ //## JDBC4.0-begin ##
public NClob getNClob(String parameterName) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
+ //## JDBC4.0-end ##
public String getNString(int parameterIndex) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public String getNString(String parameterName) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public Object getObject(String parameterName) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
- public Object getObject(int parameterIndex, Map<String, Class<?>> map)
- throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ public Object getObject(int parameterIndex, Map<String, Class<?>> map) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
}
- public Object getObject(String parameterName, Map<String, Class<?>> map)
- throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ public Object getObject(String parameterName, Map<String, Class<?>> map) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
}
public Ref getRef(int parameterIndex) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public Ref getRef(String parameterName) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
+ //## JDBC4.0-begin ##
public RowId getRowId(int parameterIndex) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
+ //## JDBC4.0-end ##
+ //## JDBC4.0-begin ##
public RowId getRowId(String parameterName) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
+ //## JDBC4.0-end ##
public SQLXML getSQLXML(String parameterName) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public short getShort(String parameterName) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public String getString(String parameterName) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public Time getTime(String parameterName) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public Time getTime(String parameterName, Calendar cal) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public Timestamp getTimestamp(String parameterName) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
- public Timestamp getTimestamp(String parameterName, Calendar cal)
- throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ public Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
}
public URL getURL(int parameterIndex) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public URL getURL(String parameterName) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
- public void registerOutParameter(String parameterName, int sqlType)
- throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ public void registerOutParameter(String parameterName, int sqlType) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
}
- public void registerOutParameter(String parameterName, int sqlType,
- int scale) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ public void registerOutParameter(String parameterName, int sqlType,int scale) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
}
- public void registerOutParameter(String parameterName, int sqlType,
- String typeName) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ public void registerOutParameter(String parameterName, int sqlType, String typeName) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
}
- public void setAsciiStream(String parameterName, InputStream x)
- throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ public void setAsciiStream(String parameterName, InputStream x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
}
- public void setAsciiStream(String parameterName, InputStream x, int length)
- throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
}
- public void setAsciiStream(String parameterName, InputStream x, long length)
- throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ public void setAsciiStream(String parameterName, InputStream x, long length) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
}
- public void setBigDecimal(String parameterName, BigDecimal x)
- throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
}
- public void setBinaryStream(String parameterName, InputStream x)
- throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ public void setBinaryStream(String parameterName, InputStream x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setBinaryStream(String parameterName, InputStream x, int length)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setBinaryStream(String parameterName, InputStream x, long length)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setBlob(String parameterName, Blob x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setBlob(String parameterName, InputStream inputStream)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setBlob(String parameterName, InputStream inputStream,
long length) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setBoolean(String parameterName, boolean x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setByte(String parameterName, byte x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setBytes(String parameterName, byte[] x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setCharacterStream(String parameterName, Reader reader)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
- }
+ throw SqlUtil.createFeatureNotSupportedException(); }
public void setCharacterStream(String parameterName, Reader reader,
int length) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setCharacterStream(String parameterName, Reader reader,
long length) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setClob(String parameterName, Clob x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setClob(String parameterName, Reader reader)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setClob(String parameterName, Reader reader, long length)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setDate(String parameterName, Date x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setDate(String parameterName, Date x, Calendar cal)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setDouble(String parameterName, double x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setFloat(String parameterName, float x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setInt(String parameterName, int x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setLong(String parameterName, long x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setNCharacterStream(String parameterName, Reader value)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setNCharacterStream(String parameterName, Reader value,
long length) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
+ //## JDBC4.0-begin ##
public void setNClob(String parameterName, NClob value) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
+ //## JDBC4.0-end ##
public void setNClob(String parameterName, Reader reader)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setNClob(String parameterName, Reader reader, long length)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setNString(String parameterName, String value)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setNull(String parameterName, int sqlType) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setNull(String parameterName, int sqlType, String typeName)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setObject(String parameterName, Object x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setObject(String parameterName, Object x, int targetSqlType)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setObject(String parameterName, Object x, int targetSqlType,
int scale) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
+ //## JDBC4.0-begin ##
public void setRowId(String parameterName, RowId x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
+ //## JDBC4.0-end ##
public void setSQLXML(String parameterName, SQLXML xmlObject)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
+
public void setShort(String parameterName, short x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setString(String parameterName, String x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setTime(String parameterName, Time x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setTime(String parameterName, Time x, Calendar cal)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setTimestamp(String parameterName, Timestamp x)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setTimestamp(String parameterName, Timestamp x, Calendar cal)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setURL(String parameterName, URL val) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
}
\ No newline at end of file
Modified: branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMClob.java
===================================================================
--- branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMClob.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMClob.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -30,13 +30,13 @@
import java.nio.charset.Charset;
import java.sql.Clob;
import java.sql.SQLException;
-import java.sql.SQLFeatureNotSupportedException;
import com.metamatrix.common.lob.LobChunkInputStream;
import com.metamatrix.common.lob.ReaderInputStream;
import com.metamatrix.common.types.ClobImpl;
import com.metamatrix.common.types.ClobType;
import com.metamatrix.common.types.Streamable;
+import com.metamatrix.common.util.SqlUtil;
import com.metamatrix.dqp.client.impl.StreamingLobChunckProducer;
/**
@@ -198,32 +198,32 @@
}
public void free() throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
-
+
public Reader getCharacterStream(long arg0, long arg1) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public OutputStream setAsciiStream(long arg0) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public Writer setCharacterStream(long arg0) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public int setString(long arg0, String arg1) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public int setString(long arg0, String arg1, int arg2, int arg3)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void truncate(long arg0) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
}
Modified: branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java
===================================================================
--- branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMConnection.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -28,14 +28,19 @@
import java.sql.Clob;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
-import java.sql.NClob;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
-import java.sql.SQLClientInfoException;
import java.sql.SQLException;
-import java.sql.SQLFeatureNotSupportedException;
import java.sql.SQLWarning;
+//## JDBC4.0-begin ##
+import java.sql.SQLClientInfoException;
+import java.sql.NClob;
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.Savepoint;
import java.sql.Statement;
import java.sql.Struct;
@@ -55,6 +60,7 @@
import com.metamatrix.common.api.MMURL;
import com.metamatrix.common.comm.api.ServerConnection;
import com.metamatrix.common.comm.exception.CommunicationException;
+import com.metamatrix.common.util.SqlUtil;
import com.metamatrix.common.xa.MMXid;
import com.metamatrix.common.xa.XATransactionException;
import com.metamatrix.dqp.client.ClientSideDQP;
@@ -684,7 +690,7 @@
*/
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency,
int resultSetHoldability ) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
/**
@@ -861,7 +867,7 @@
protected MMXid getTransactionXid() {
return transactionXid;
}
-
+
public boolean isValid(int timeout) throws SQLException {
Statement statement = null;
try {
@@ -907,103 +913,113 @@
abstract BaseDriver getBaseDriver();
abstract boolean isSameProcess(MMConnection conn) throws CommunicationException;
-
+
+ //## JDBC4.0-begin ##
public void setClientInfo(Properties properties)
throws SQLClientInfoException {
-
- }
-
+ }
+
public void setClientInfo(String name, String value)
throws SQLClientInfoException {
- }
-
+ }
+ //## JDBC4.0-end ##
+
public Properties getClientInfo() throws SQLException {
- throw new SQLFeatureNotSupportedException();
- }
-
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
public String getClientInfo(String name) throws SQLException {
- throw new SQLFeatureNotSupportedException();
- }
-
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
public Array createArrayOf(String typeName, Object[] elements)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
- }
-
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
public Blob createBlob() throws SQLException {
- throw new SQLFeatureNotSupportedException();
- }
-
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
public Clob createClob() throws SQLException {
- throw new SQLFeatureNotSupportedException();
- }
-
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
+ //## JDBC4.0-begin ##
public NClob createNClob() throws SQLException {
- throw new SQLFeatureNotSupportedException();
- }
-
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+ //## JDBC4.0-end ##
+
public SQLXML createSQLXML() throws SQLException {
- throw new SQLFeatureNotSupportedException();
- }
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
public Statement createStatement(int resultSetType,
int resultSetConcurrency, int resultSetHoldability)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
+
}
-
+
public Struct createStruct(String typeName, Object[] attributes)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
- }
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
public CallableStatement prepareCall(String sql, int resultSetType,
int resultSetConcurrency, int resultSetHoldability)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
+
}
public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
+
}
public PreparedStatement prepareStatement(String sql, int[] columnIndexes)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
+
}
public PreparedStatement prepareStatement(String sql, String[] columnNames)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
+
}
public void releaseSavepoint(Savepoint savepoint) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
+
}
public void rollback(Savepoint savepoint) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
+
}
public void setHoldability(int holdability) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public Savepoint setSavepoint() throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public Savepoint setSavepoint(String name) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setTransactionIsolation(int level) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
}
Modified: branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDatabaseMetaData.java
===================================================================
--- branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDatabaseMetaData.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDatabaseMetaData.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -27,9 +27,10 @@
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
+//## JDBC4.0-begin ##
import java.sql.RowIdLifetime;
+//## JDBC4.0-end ##
import java.sql.SQLException;
-import java.sql.SQLFeatureNotSupportedException;
import java.sql.Types;
import java.util.ArrayList;
import java.util.Arrays;
@@ -43,6 +44,7 @@
import com.metamatrix.api.exception.query.QueryMetadataException;
import com.metamatrix.common.types.DataTypeManager;
import com.metamatrix.common.types.MMJDBCSQLTypeInfo;
+import com.metamatrix.common.util.SqlUtil;
import com.metamatrix.core.MetaMatrixRuntimeException;
import com.metamatrix.dqp.message.ResultsMessage;
import com.metamatrix.dqp.metadata.ResultsMetadataConstants;
@@ -3340,34 +3342,34 @@
return false;
}
- public ResultSet getAttributes(String catalog, String schemaPattern,
- String typeNamePattern, String attributeNamePattern)
+ public ResultSet getAttributes(String catalog, String schemaPattern, String typeNamePattern, String attributeNamePattern)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public ResultSet getClientInfoProperties() throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public ResultSet getFunctionColumns(String catalog, String schemaPattern,
String functionNamePattern, String columnNamePattern)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public ResultSet getFunctions(String catalog, String schemaPattern,
String functionNamePattern) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
+ //## JDBC4.0-begin ##
public RowIdLifetime getRowIdLifetime() throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
+ //## JDBC4.0-end ##
public ResultSet getSchemas(String catalog, String schemaPattern)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
-
}
Modified: branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMPreparedStatement.java
===================================================================
--- branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMPreparedStatement.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMPreparedStatement.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -30,16 +30,23 @@
import java.sql.Array;
import java.sql.Blob;
import java.sql.Clob;
-import java.sql.NClob;
import java.sql.ParameterMetaData;
import java.sql.PreparedStatement;
import java.sql.Ref;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
-import java.sql.RowId;
import java.sql.SQLException;
-import java.sql.SQLFeatureNotSupportedException;
+
+//## JDBC4.0-begin ##
import java.sql.SQLXML;
+import java.sql.NClob;
+import java.sql.RowId;
+//## 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.ArrayList;
import java.util.Calendar;
@@ -54,6 +61,7 @@
import com.metamatrix.common.types.BlobImpl;
import com.metamatrix.common.types.ClobImpl;
import com.metamatrix.common.types.MMJDBCSQLTypeInfo;
+import com.metamatrix.common.util.SqlUtil;
import com.metamatrix.common.util.TimestampWithTimezone;
import com.metamatrix.core.util.ArgCheck;
import com.metamatrix.dqp.client.MetadataResult;
@@ -168,7 +176,9 @@
throw new MMSQLException(msg);
}
- @Override
+ //## JDBC4.0-begin ##
+ @Override
+ //## JDBC4.0-end ##
public boolean execute() throws SQLException {
executeSql(new String[] {this.prepareSql}, false, null);
return hasResultSet();
@@ -187,13 +197,17 @@
return this.updateCounts;
}
- @Override
+ //## JDBC4.0-begin ##
+ @Override
+ //## JDBC4.0-end ##
public ResultSet executeQuery() throws SQLException {
executeSql(new String[] {this.prepareSql}, false, true);
return resultSet;
}
- @Override
+ //## JDBC4.0-begin ##
+ @Override
+ //## JDBC4.0-end ##
public int executeUpdate() throws SQLException {
executeSql(new String[] {this.prepareSql}, false, false);
return this.updateCounts[0];
@@ -468,7 +482,7 @@
setObject(parameterIndex, bigDecimalObject);
}
}
-
+
public void setObject(int parameterIndex, Object value, int targetJdbcType) throws SQLException {
Object targetObject = null;
@@ -666,96 +680,99 @@
}
public void setArray(int parameterIndex, Array x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setAsciiStream(int parameterIndex, InputStream x)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setAsciiStream(int parameterIndex, InputStream x, long length)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setBinaryStream(int parameterIndex, InputStream x)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setBinaryStream(int parameterIndex, InputStream x, long length)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setBlob(int parameterIndex, InputStream inputStream)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
- public void setBlob(int parameterIndex, InputStream inputStream, long length)
- throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setCharacterStream(int parameterIndex, Reader reader)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setCharacterStream(int parameterIndex, Reader reader,
long length) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setClob(int parameterIndex, Reader reader) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setClob(int parameterIndex, Reader reader, long length)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setNCharacterStream(int parameterIndex, Reader value)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setNCharacterStream(int parameterIndex, Reader value,
long length) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
+ //## JDBC4.0-begin ##
public void setNClob(int parameterIndex, NClob value) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
+ //## JDBC4.0-end ##
public void setNClob(int parameterIndex, Reader reader) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setNClob(int parameterIndex, Reader reader, long length)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setNString(int parameterIndex, String value)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setRef(int parameterIndex, Ref x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
+ //## JDBC4.0-begin ##
public void setRowId(int parameterIndex, RowId x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
+ //## JDBC4.0-end ##
public void setUnicodeStream(int parameterIndex, InputStream x, int length)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
}
Modified: branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMResultSet.java
===================================================================
--- branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMResultSet.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMResultSet.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -30,15 +30,20 @@
import java.sql.Blob;
import java.sql.Clob;
import java.sql.Date;
-import java.sql.NClob;
import java.sql.Ref;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
-import java.sql.RowId;
import java.sql.SQLException;
-import java.sql.SQLFeatureNotSupportedException;
import java.sql.SQLWarning;
+//## JDBC4.0-begin ##
+import java.sql.RowId;
+import java.sql.NClob;
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.Time;
import java.sql.Timestamp;
import java.util.Calendar;
@@ -54,6 +59,7 @@
import com.metamatrix.common.types.ClobType;
import com.metamatrix.common.types.Streamable;
import com.metamatrix.common.types.XMLType;
+import com.metamatrix.common.util.SqlUtil;
import com.metamatrix.common.util.TimestampWithTimezone;
import com.metamatrix.dqp.client.ResultsFuture;
import com.metamatrix.dqp.client.impl.StreamingLobChunckProducer;
@@ -385,7 +391,9 @@
checkClosed(); // check to see if the ResultSet is closed
}
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public void clearWarnings() throws SQLException {
// do nothing
checkClosed(); // check to see if the ResultSet is closed
@@ -1366,23 +1374,23 @@
}
public void deleteRow() throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public Array getArray(int columnIndex) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public Array getArray(String columnLabel) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public InputStream getAsciiStream(int columnIndex) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public InputStream getAsciiStream(String columnLabel) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public Clob getClob(int columnIndex) throws SQLException {
@@ -1397,521 +1405,505 @@
return getClob(findColumn(columnLabel));
}
+
public int getHoldability() throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public Reader getNCharacterStream(int columnIndex) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public Reader getNCharacterStream(String columnLabel) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
+ //## JDBC4.0-begin ##
public NClob getNClob(int columnIndex) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public NClob getNClob(String columnLabel) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
-
+ //## JDBC4.0-end ##
+
public String getNString(int columnIndex) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public String getNString(String columnLabel) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
-
+
public Object getObject(int columnIndex, Map<String, Class<?>> map)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public Object getObject(String columnLabel, Map<String, Class<?>> map)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public Ref getRef(int columnIndex) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public Ref getRef(String columnLabel) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
+ //## JDBC4.0-begin ##
public RowId getRowId(int columnIndex) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
+ //## JDBC4.0-end ##
+ //## JDBC4.0-begin ##
public RowId getRowId(String columnLabel) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
+ //## JDBC4.0-end ##
public SQLXML getSQLXML(String columnLabel) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public InputStream getUnicodeStream(int columnIndex) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public InputStream getUnicodeStream(String columnLabel) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
-
+
public URL getURL(int columnIndex) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public URL getURL(String columnLabel) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void insertRow() throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void moveToInsertRow() throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void refreshRow() throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public boolean rowDeleted() throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public boolean rowInserted() throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public boolean rowUpdated() throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setFetchDirection(int direction) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setFetchSize(int rows) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateArray(int columnIndex, Array x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateArray(String columnLabel, Array x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
+
public void updateAsciiStream(int columnIndex, InputStream x, int length)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
-
+
+ public void updateAsciiStream(String columnLabel, InputStream x, int length)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
public void updateAsciiStream(int columnIndex, InputStream x, long length)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateAsciiStream(int columnIndex, InputStream x)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
- public void updateAsciiStream(String columnLabel, InputStream x, int length)
- throws SQLException {
- throw new SQLFeatureNotSupportedException();
- }
-
public void updateAsciiStream(String columnLabel, InputStream x, long length)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateAsciiStream(String columnLabel, InputStream x)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateBigDecimal(int columnIndex, BigDecimal x)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateBigDecimal(String columnLabel, BigDecimal x)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateBinaryStream(int columnIndex, InputStream x, int length)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
+
+ public void updateBinaryStream(String columnLabel, InputStream x, int length)
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
public void updateBinaryStream(int columnIndex, InputStream x, long length)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateBinaryStream(int columnIndex, InputStream x)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
- public void updateBinaryStream(String columnLabel, InputStream x, int length)
- throws SQLException {
- throw new SQLFeatureNotSupportedException();
- }
-
public void updateBinaryStream(String columnLabel, InputStream x,
long length) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateBinaryStream(String columnLabel, InputStream x)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateBlob(int columnIndex, Blob x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
+
+ public void updateBlob(String columnLabel, Blob x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
public void updateBlob(int columnIndex, InputStream inputStream, long length)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateBlob(int columnIndex, InputStream inputStream)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
-
- public void updateBlob(String columnLabel, Blob x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
- }
-
+
public void updateBlob(String columnLabel, InputStream inputStream,
long length) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
-
+
public void updateBlob(String columnLabel, InputStream inputStream)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
-
+
public void updateBoolean(int columnIndex, boolean x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateBoolean(String columnLabel, boolean x)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateByte(int columnIndex, byte x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateByte(String columnLabel, byte x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateBytes(int columnIndex, byte[] x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateBytes(String columnLabel, byte[] x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
+
public void updateCharacterStream(int columnIndex, Reader x, int length)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
+
+ public void updateCharacterStream(String columnLabel, Reader reader,
+ int length) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
public void updateCharacterStream(int columnIndex, Reader x, long length)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateCharacterStream(int columnIndex, Reader x)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateCharacterStream(String columnLabel, Reader reader,
- int length) throws SQLException {
- throw new SQLFeatureNotSupportedException();
- }
-
- public void updateCharacterStream(String columnLabel, Reader reader,
long length) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateCharacterStream(String columnLabel, Reader reader)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateClob(int columnIndex, Clob x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
+ public void updateClob(String columnLabel, Clob x) throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
+ }
+
public void updateClob(int columnIndex, Reader reader, long length)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateClob(int columnIndex, Reader reader) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
- public void updateClob(String columnLabel, Clob x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
- }
-
public void updateClob(String columnLabel, Reader reader, long length)
- throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateClob(String columnLabel, Reader reader)
- throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throws SQLException {
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateDate(int columnIndex, Date x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateDate(String columnLabel, Date x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateDouble(int columnIndex, double x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateDouble(String columnLabel, double x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateFloat(int columnIndex, float x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateFloat(String columnLabel, float x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateInt(int columnIndex, int x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateInt(String columnLabel, int x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateLong(int columnIndex, long x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateLong(String columnLabel, long x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateNCharacterStream(int columnIndex, Reader x, long length)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateNCharacterStream(int columnIndex, Reader x)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateNCharacterStream(String columnLabel, Reader reader,
long length) throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateNCharacterStream(String columnLabel, Reader reader)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
+ //## JDBC4.0-begin ##
public void updateNClob(int columnIndex, NClob clob) throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
+ //## JDBC4.0-end ##
public void updateNClob(int columnIndex, Reader reader, long length)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateNClob(int columnIndex, Reader reader) throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
+ //## JDBC4.0-begin ##
public void updateNClob(String columnLabel, NClob clob) throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
+ //## JDBC4.0-end ##
public void updateNClob(String columnLabel, Reader reader, long length)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateNClob(String columnLabel, Reader reader)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateNString(int columnIndex, String string)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateNString(String columnLabel, String string)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateNull(int columnIndex) throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateNull(String columnLabel) throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateObject(int columnIndex, Object x, int scaleOrLength)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateObject(int columnIndex, Object x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateObject(String columnLabel, Object x, int scaleOrLength)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateObject(String columnLabel, Object x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateRef(int columnIndex, Ref x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateRef(String columnLabel, Ref x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateRow() throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
+ //## JDBC4.0-begin ##
public void updateRowId(int columnIndex, RowId x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
+ //## JDBC4.0-end ##
+ //## JDBC4.0-begin ##
public void updateRowId(String columnLabel, RowId x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
+ //## JDBC4.0-end ##
public void updateShort(int columnIndex, short x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateShort(String columnLabel, short x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateSQLXML(int columnIndex, SQLXML xmlObject)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateSQLXML(String columnLabel, SQLXML xmlObject)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateString(int columnIndex, String x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateString(String columnLabel, String x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateTime(int columnIndex, Time x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateTime(String columnLabel, Time x) throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateTimestamp(int columnIndex, Timestamp x)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
-
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void updateTimestamp(String columnLabel, Timestamp x)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
-
}
Modified: branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMSQLXML.java
===================================================================
--- branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMSQLXML.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMSQLXML.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -29,9 +29,14 @@
import java.io.Writer;
import java.nio.charset.Charset;
import java.sql.SQLException;
-import java.sql.SQLFeatureNotSupportedException;
+//## 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 javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
@@ -39,6 +44,7 @@
import com.metamatrix.common.lob.LobChunkInputStream;
import com.metamatrix.common.types.Streamable;
import com.metamatrix.common.types.XMLType;
+import com.metamatrix.common.util.SqlUtil;
import com.metamatrix.dqp.client.impl.StreamingLobChunckProducer;
@@ -72,7 +78,12 @@
public String getString() throws SQLException {
LobChunkInputStream in = new LobChunkInputStream(lobChunckFactory.getLobChunkProducer());
try {
+ //## JDBC4.0-begin ##
return new String(in.getByteContents(), Charset.forName("UTF-16")); //$NON-NLS-1$
+ //## JDBC4.0-end ##
+ /*## JDBC3.0-JDK1.5-begin ##
+ return new String(in.getByteContents(), "UTF-16"); //$NON-NLS-1$
+ ## JDBC3.0-JDK1.5-end ##*/
} catch (IOException e) {
throw MMSQLException.create(e);
}
@@ -94,28 +105,27 @@
}
public InputStream getBinaryStream() throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void free() throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public OutputStream setBinaryStream() throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public Writer setCharacterStream() throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public <T extends Result> T setResult(Class<T> resultClass)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setString(String value) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
-
}
Modified: branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMStatement.java
===================================================================
--- branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMStatement.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMStatement.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -29,7 +29,6 @@
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
-import java.sql.SQLFeatureNotSupportedException;
import java.sql.SQLWarning;
import java.util.ArrayList;
import java.util.Arrays;
@@ -53,6 +52,7 @@
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.common.comm.exception.CommunicationException;
import com.metamatrix.common.util.PropertiesUtils;
+import com.metamatrix.common.util.SqlUtil;
import com.metamatrix.dqp.client.ClientSideDQP;
import com.metamatrix.dqp.message.ParameterInfo;
import com.metamatrix.dqp.message.RequestMessage;
@@ -84,7 +84,7 @@
// integer indicating no maximum limit - used in some metadata-ish methods.
private static final int NO_LIMIT = 0;
- // ######## Configuration state #############
+ //######## Configuration state #############
private MMConnection driverConnection;
private Properties execProps = null;
@@ -101,7 +101,7 @@
private int resultSetType = ResultSet.TYPE_FORWARD_ONLY;
private int resultSetConcurrency = ResultSet.CONCUR_READ_ONLY;
- // ######## Processing state #############
+ //######## Processing state #############
// boolean to indicate if this statement object is closed
private boolean isClosed = false;
@@ -112,7 +112,7 @@
// number of seconds for the query to timeout.
protected int queryTimeout = NO_TIMEOUT;
- // ########## Per-execution state ########
+ //########## Per-execution state ########
// ID for current request
protected long currentRequestID = -1;
@@ -321,13 +321,17 @@
}
}
- @Override
+ //## JDBC4.0-begin ##
+ @Override
+ //## JDBC4.0-end ##
public boolean execute(String sql) throws SQLException {
executeSql(new String[] {sql}, false, null);
return hasResultSet();
}
- @Override
+ //## JDBC4.0-begin ##
+ @Override
+ //## JDBC4.0-end ##
public int[] executeBatch() throws SQLException {
if (batchedUpdates == null || batchedUpdates.isEmpty()) {
return new int[0];
@@ -337,13 +341,17 @@
return updateCounts;
}
- @Override
+ //## JDBC4.0-begin ##
+ @Override
+ //## JDBC4.0-end ##
public ResultSet executeQuery(String sql) throws SQLException {
executeSql(new String[] {sql}, false, true);
return resultSet;
}
- @Override
+ //## JDBC4.0-begin ##
+ @Override
+ //## JDBC4.0-end ##
public int executeUpdate(String sql) throws SQLException {
String[] commands = new String[] {sql};
executeSql(commands, false, false);
@@ -830,7 +838,7 @@
* @throws CommunicationException
*/
protected ResultsMessage sendRequestMessageAndWait(RequestMessage reqMsg)
- throws SQLException, InterruptedException, TimeoutException, CommunicationException {
+ throws SQLException, InterruptedException, TimeoutException {
this.currentRequestID = this.driverConnection.nextRequestID();
// Create a request message
@@ -1043,47 +1051,46 @@
public boolean execute(String sql, int autoGeneratedKeys)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public boolean execute(String sql, int[] columnIndexes) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public boolean execute(String sql, String[] columnNames)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public int executeUpdate(String sql, int autoGeneratedKeys)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public int executeUpdate(String sql, int[] columnIndexes)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public int executeUpdate(String sql, String[] columnNames)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public ResultSet getGeneratedKeys() throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public int getResultSetHoldability() throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setCursorName(String name) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void setMaxFieldSize(int max) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
-
}
\ No newline at end of file
Modified: branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMXAConnection.java
===================================================================
--- branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMXAConnection.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/MMXAConnection.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -33,7 +33,9 @@
import javax.sql.ConnectionEvent;
import javax.sql.ConnectionEventListener;
+//## JDBC4.0-begin ##
import javax.sql.StatementEventListener;
+//## JDBC4.0-end ##
import javax.sql.XAConnection;
import javax.transaction.xa.XAResource;
@@ -164,10 +166,11 @@
}
}
+ //## JDBC4.0-begin ##
public void addStatementEventListener(StatementEventListener arg0) {
}
public void removeStatementEventListener(StatementEventListener arg0) {
}
-
+ //## JDBC4.0-end ##
}
Modified: branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/WarningUtil.java
===================================================================
--- branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/WarningUtil.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/WarningUtil.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -51,7 +51,13 @@
return warning;
}
}
+ //## JDBC4.0-begin ##
return new SQLWarning(ex);
+ //## JDBC4.0-end ##
+ /*## JDBC3.0-JDK1.5-begin ##
+ return new SQLWarning(ex.getMessage());
+ ## JDBC3.0-JDK1.5-end ##*/
+
}
/**
@@ -76,5 +82,4 @@
return warning;
}
-
}
Modified: branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/WrapperImpl.java
===================================================================
--- branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/WrapperImpl.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/client-jdbc/src/main/java/com/metamatrix/jdbc/WrapperImpl.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -23,12 +23,17 @@
package com.metamatrix.jdbc;
import java.sql.SQLException;
+//## JDBC4.0-begin ##
import java.sql.Wrapper;
+//## JDBC4.0-end ##
import com.metamatrix.core.util.ArgCheck;
-public class WrapperImpl implements Wrapper {
-
+public class WrapperImpl
+ //## JDBC4.0-begin ##
+ implements Wrapper
+ //## JDBC4.0-end ##
+ {
public boolean isWrapperFor(Class<?> iface) throws SQLException {
ArgCheck.isNotNull(iface);
Modified: branches/jdbc30-jdk15/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMResultSet.java
===================================================================
--- branches/jdbc30-jdk15/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMResultSet.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMResultSet.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -688,11 +688,11 @@
try {
return TestAllResultsImpl.helpTestBatching(statement, fetchSize, Math.min(fetchSize, totalResults), totalResults);
} catch (MetaMatrixProcessingException e) {
- throw new SQLException(e);
+ throw new SQLException(e.getMessage());
} catch (InterruptedException e) {
- throw new SQLException(e);
+ throw new SQLException(e.getMessage());
} catch (ExecutionException e) {
- throw new SQLException(e);
+ throw new SQLException(e.getMessage());
}
}
Modified: branches/jdbc30-jdk15/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMXAConnection.java
===================================================================
--- branches/jdbc30-jdk15/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMXAConnection.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/client-jdbc/src/test/java/com/metamatrix/jdbc/TestMMXAConnection.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -40,14 +40,16 @@
final MMConnection mmConn = TestMMConnection.getMMConnection();
MMXAConnection xaConn = new MMXAConnection(new MMXAConnection.ConnectionSource() {
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public MMConnection createConnection() throws SQLException {
return mmConn;
}
});
Connection conn = xaConn.getConnection();
- Statement stmt = conn.createStatement();
+ MMStatement stmt = (MMStatement)conn.createStatement();
conn.setAutoCommit(false);
conn.close();
@@ -55,7 +57,7 @@
assertTrue(conn.getAutoCommit());
conn = xaConn.getConnection();
- stmt = conn.createStatement();
+ stmt = (MMStatement)conn.createStatement();
XAResource resource = xaConn.getXAResource();
resource.start(new MMXid(1, new byte[0], new byte[0]), XAResource.TMNOFLAGS);
conn.close();
Modified: branches/jdbc30-jdk15/client-jdbc/src/test/java/com/metamatrix/jdbc/TestWrapperImpl.java
===================================================================
--- branches/jdbc30-jdk15/client-jdbc/src/test/java/com/metamatrix/jdbc/TestWrapperImpl.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/client-jdbc/src/test/java/com/metamatrix/jdbc/TestWrapperImpl.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -27,12 +27,14 @@
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.sql.SQLException;
+//## JDBC4.0-begin ##
import java.sql.Wrapper;
+//## JDBC4.0-end ##
import junit.framework.TestCase;
public class TestWrapperImpl extends TestCase {
-
+ //## JDBC4.0-begin ##
interface Foo extends Wrapper {
void callMe();
}
@@ -46,9 +48,9 @@
}
}
-
+ //## JDBC4.0-end ##
public void testProxy() throws SQLException {
-
+ //## JDBC4.0-begin ##
final FooImpl fooImpl = new FooImpl();
Foo proxy = (Foo)Proxy.newProxyInstance(TestWrapperImpl.class.getClassLoader(), new Class[] {Foo.class}, new InvocationHandler() {
@@ -81,7 +83,7 @@
} catch (SQLException e) {
assertEquals("Wrapped object is not an instance of class java.lang.String", e.getMessage());
}
-
+ //## JDBC4.0-end ##
}
}
Modified: branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/jdbc/SimplePooledConnectionSource.java
===================================================================
--- branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/jdbc/SimplePooledConnectionSource.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/jdbc/SimplePooledConnectionSource.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -7,7 +7,10 @@
import java.lang.reflect.Proxy;
import java.sql.Connection;
import java.sql.SQLException;
+//## JDBC4.0-begin ##
import java.sql.SQLFeatureNotSupportedException;
+//## JDBC4.0-end ##
+
import java.util.Properties;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.Semaphore;
@@ -46,8 +49,12 @@
*
* TODO: Should be switched to proxool or some implementation
*/
-public class SimplePooledConnectionSource implements DataSource {
-
+public class SimplePooledConnectionSource
+ //## JDBC4.0-begin ##
+ implements DataSource
+ //## JDBC4.0-end ##
+{
+ //## JDBC4.0-begin ##
public static final String WAIT_TIME_FOR_RESOURCE= "pooling.resource.pool.wait.time"; //$NON-NLS-1$
public static final String MAXIMUM_RESOURCE_POOL_SIZE = "pooling.resource.pool.maximum.size"; //$NON-NLS-1$
public static final String RESOURCE_TEST_INTERVAL = "pooling.resource.pool.test.interval"; //$NON-NLS-1$
@@ -212,5 +219,7 @@
public <T> T unwrap(Class<T> arg0) throws SQLException {
throw new SQLFeatureNotSupportedException();
}
+ //## JDBC4.0-end ##
+}
-}
+
Modified: branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/protocol/mmfile/MMFileURLConnection.java
===================================================================
--- branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/protocol/mmfile/MMFileURLConnection.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/protocol/mmfile/MMFileURLConnection.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -175,14 +175,18 @@
String sort = props.getProperty(FILE_LIST_SORT, DATE);
if (sort.equals(DATE)) {
Arrays.sort(matchedFiles, new Comparator<File>() {
- @Override
+ //## JDBC4.0-begin ##
+ @Override
+ //## JDBC4.0-end ##
public int compare(File o1, File o2) {
return Long.valueOf(o2.lastModified()).compareTo(o1.lastModified()); // latest first.
}
});
} else if (sort.equals(ALPHA)) {
Arrays.sort(matchedFiles, new Comparator<File>() {
- @Override
+ //## JDBC4.0-begin ##
+ @Override
+ //## JDBC4.0-end ##
public int compare(File o1, File o2) {
return o1.getName().compareTo(o2.getName());
}
@@ -190,7 +194,9 @@
} else if (sort.equals(REVERSEALPHA)) {
Arrays.sort(matchedFiles, new Comparator<File>() {
- @Override
+ //## JDBC4.0-begin ##
+ @Override
+ //## JDBC4.0-end ##
public int compare(File o1, File o2) {
return o2.getName().compareTo(o1.getName());
}
Modified: branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/types/BlobImpl.java
===================================================================
--- branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/types/BlobImpl.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/types/BlobImpl.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -29,8 +29,8 @@
import java.io.Serializable;
import java.sql.Blob;
import java.sql.SQLException;
-import java.sql.SQLFeatureNotSupportedException;
+import com.metamatrix.common.util.SqlUtil;
import com.metamatrix.core.CorePlugin;
/**
@@ -262,37 +262,37 @@
* @see java.sql.Blob#setBytes(long, byte[])
*/
public int setBytes(long pos, byte[] bytes) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
/**
* @see java.sql.Blob#setBytes(long, byte[], int, int)
*/
public int setBytes(long pos, byte[] bytes, int offset, int len) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
/**
* @see java.sql.Blob#setBinaryStream(long)
*/
public OutputStream setBinaryStream(long pos) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
/**
* @see java.sql.Blob#truncate(long)
*/
public void truncate(long len) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void free() throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public InputStream getBinaryStream(long arg0, long arg1)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
}
Modified: branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/types/BlobType.java
===================================================================
--- branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/types/BlobType.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/types/BlobType.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -228,7 +228,7 @@
writer.close();
return data;
}
-
+ //## JDBC4.0-begin ##
public void free() throws SQLException {
checkReference();
this.srcBlob.free();
@@ -239,4 +239,5 @@
checkReference();
return this.srcBlob.getBinaryStream(pos, length);
}
+ //## JDBC4.0-end ##
}
Modified: branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/types/ClobImpl.java
===================================================================
--- branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/types/ClobImpl.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/types/ClobImpl.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -34,9 +34,13 @@
import java.nio.charset.Charset;
import java.sql.Clob;
import java.sql.SQLException;
-import java.sql.SQLFeatureNotSupportedException;
import java.util.Arrays;
+/*## JDBC3.0-JDK1.5-begin ##
+import java.io.UnsupportedEncodingException;
+## JDBC3.0-JDK1.5-end ##*/
+
+import com.metamatrix.common.util.SqlUtil;
import com.metamatrix.core.CorePlugin;
/**
@@ -111,7 +115,17 @@
* <code>CLOB</code> value
*/
public InputStream getAsciiStream() throws SQLException {
+ //## JDBC4.0-begin ##
byte[] bytes = new String(data).getBytes(Charset.forName("US-ASCII")); //$NON-NLS-1$
+ //## JDBC4.0-end ##
+ /*## JDBC3.0-JDK1.5-begin ##
+ byte[] bytes;
+ try {
+ bytes = new String(data).getBytes("US-ASCII"); //$NON-NLS-1$
+ } catch (UnsupportedEncodingException e) {
+ throw new SQLException(e.getMessage());
+ }
+ ## JDBC3.0-JDK1.5-end ##*/
return new ByteArrayInputStream(bytes);
}
@@ -285,43 +299,43 @@
* @see java.sql.Clob#setString(long, java.lang.String)
*/
public int setString(long pos, String str) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
/**
* @see java.sql.Clob#setString(long, java.lang.String, int, int)
*/
public int setString(long pos, String str, int offset, int len) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
/**
* @see java.sql.Clob#setAsciiStream(long)
*/
public OutputStream setAsciiStream(long pos) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
/**
* @see java.sql.Clob#setCharacterStream(long)
*/
public Writer setCharacterStream(long pos) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
/**
* @see java.sql.Clob#truncate(long)
*/
public void truncate(long len) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public void free() throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public Reader getCharacterStream(long arg0, long arg1) throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
}
Modified: branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/types/ClobType.java
===================================================================
--- branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/types/ClobType.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/types/ClobType.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -293,7 +293,7 @@
};
}
-
+ //## JDBC4.0-begin ##
public void free() throws SQLException {
checkReference();
this.srcClob.free();
@@ -303,4 +303,5 @@
checkReference();
return this.srcClob.getCharacterStream(pos, length);
}
+ //## JDBC4.0-end ##
}
Modified: branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java
===================================================================
--- branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -24,7 +24,14 @@
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.Timestamp;
import java.util.Arrays;
import java.util.Collections;
@@ -974,55 +981,73 @@
static void loadSourceConversions() {
sourceConverters.put(Clob.class, new SourceTransform<Clob, ClobType>() {
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public ClobType transform(Clob value) {
return new ClobType(value);
}
});
sourceConverters.put(char[].class, new SourceTransform<char[], ClobType>() {
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public ClobType transform(char[] value) {
return new ClobType(new ClobImpl(value));
}
});
sourceConverters.put(Blob.class, new SourceTransform<Blob, BlobType>() {
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public BlobType transform(Blob value) {
return new BlobType(value);
}
});
sourceConverters.put(byte[].class, new SourceTransform<byte[], BlobType>() {
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public BlobType transform(byte[] value) {
return new BlobType(new BlobImpl(value));
}
});
sourceConverters.put(SQLXML.class, new SourceTransform<SQLXML, XMLType>() {
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public XMLType transform(SQLXML value) {
return new XMLType(value);
}
});
sourceConverters.put(DOMSource.class, new SourceTransform<DOMSource, XMLType>() {
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public XMLType transform(DOMSource value) {
return new XMLType(new SQLXMLImpl(value));
}
});
sourceConverters.put(SAXSource.class, new SourceTransform<SAXSource, XMLType>() {
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public XMLType transform(SAXSource value) {
return new XMLType(new SQLXMLImpl(value));
}
});
sourceConverters.put(StreamSource.class, new SourceTransform<StreamSource, XMLType>() {
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public XMLType transform(StreamSource value) {
return new XMLType(new SQLXMLImpl(value));
}
});
sourceConverters.put(Date.class, new SourceTransform<Date, Timestamp>() {
+ //## JDBC4.0-begin ##
@Override
+ //## JDBC4.0-end ##
public Timestamp transform(Date value) {
return new Timestamp(value.getTime());
}
Modified: branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/types/SQLXMLImpl.java
===================================================================
--- branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/types/SQLXMLImpl.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/types/SQLXMLImpl.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -28,8 +28,14 @@
import java.io.Reader;
import java.io.Writer;
import java.sql.SQLException;
-import java.sql.SQLFeatureNotSupportedException;
+//## 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.io.UnsupportedEncodingException;
import java.util.Properties;
import javax.xml.transform.Result;
@@ -38,7 +44,9 @@
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stream.StreamSource;
+import com.metamatrix.common.util.SqlUtil;
+
/**
* This metamatrix specific implementation of the SQLXML interface;
*/
@@ -158,11 +166,11 @@
}
public void free() throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
public <T extends Result> T setResult(Class<T> resultClass)
throws SQLException {
- throw new SQLFeatureNotSupportedException();
+ throw SqlUtil.createFeatureNotSupportedException();
}
}
Modified: branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/types/XMLType.java
===================================================================
--- branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/types/XMLType.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/types/XMLType.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -27,8 +27,14 @@
import java.io.Reader;
import java.io.Writer;
import java.sql.SQLException;
+//## 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 javax.xml.transform.Result;
import javax.xml.transform.Source;
Modified: branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/util/NetUtils.java
===================================================================
--- branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/util/NetUtils.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/util/NetUtils.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -118,7 +118,9 @@
Enumeration<NetworkInterface> ne = NetworkInterface.getNetworkInterfaces();
while (ne.hasMoreElements()) {
NetworkInterface ni = ne.nextElement();
+ //## JDBC4.0-begin ##
if (ni.isUp()) {
+ //## JDBC4.0-end ##
Enumeration<InetAddress> addrs = ni.getInetAddresses();
while (addrs.hasMoreElements()) {
InetAddress addr = addrs.nextElement();
@@ -128,7 +130,9 @@
return addr;
}
}
+ //## JDBC4.0-begin ##
}
+ //## JDBC4.0-end ##
}
} catch (SocketException e) {
// treat this as address not found and return null;
Modified: branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/util/SqlUtil.java
===================================================================
--- branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/util/SqlUtil.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/common/util/SqlUtil.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -22,6 +22,12 @@
package com.metamatrix.common.util;
+import java.sql.SQLException;
+
+//## JDBC4.0-begin ##
+import java.sql.SQLFeatureNotSupportedException;
+//## JDBC4.0-end ##
+
import java.util.regex.Pattern;
import com.metamatrix.core.util.ArgCheck;
@@ -104,4 +110,15 @@
}
return isDifferent;
}
+
+ public static SQLException createFeatureNotSupportedException() {
+ //## JDBC4.0-begin ##
+ return new SQLFeatureNotSupportedException();
+ //## JDBC4.0-end ##
+
+ /*## JDBC3.0-JDK1.5-begin ##
+ return new SQLException("unsupported feature");
+ ## JDBC3.0-JDK1.5-end ##*/
+
+ }
}
Modified: branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/internal/core/log/PlatformLog.java
===================================================================
--- branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/internal/core/log/PlatformLog.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/common-core/src/main/java/com/metamatrix/internal/core/log/PlatformLog.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -139,7 +139,9 @@
return t;
}});
this.executor.setRejectedExecutionHandler(new ThreadPoolExecutor.DiscardPolicy());
+ //## JDBC4.0-begin ##
this.executor.allowCoreThreadTimeOut(true);
+ //## JDBC4.0-end ##
}
public List getLogListeners() {
Modified: branches/jdbc30-jdk15/common-core/src/test/java/com/metamatrix/common/jdbc/TestSimplePooledConnectionSource.java
===================================================================
--- branches/jdbc30-jdk15/common-core/src/test/java/com/metamatrix/common/jdbc/TestSimplePooledConnectionSource.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/common-core/src/test/java/com/metamatrix/common/jdbc/TestSimplePooledConnectionSource.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -33,7 +33,7 @@
import com.metamatrix.api.exception.MetaMatrixException;
public class TestSimplePooledConnectionSource extends TestCase {
-
+ //## JDBC4.0-begin ##
public void testMax() throws Exception {
Properties p = new Properties();
p.setProperty(SimplePooledConnectionSource.MAXIMUM_RESOURCE_POOL_SIZE, String.valueOf(2));
@@ -63,5 +63,5 @@
c.close();
assertSame(c, pool.getConnection());
}
-
+ //## JDBC4.0-end ##
}
Modified: branches/jdbc30-jdk15/common-core/src/test/java/com/metamatrix/common/types/TestBlobValue.java
===================================================================
--- branches/jdbc30-jdk15/common-core/src/test/java/com/metamatrix/common/types/TestBlobValue.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/common-core/src/test/java/com/metamatrix/common/types/TestBlobValue.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -28,6 +28,8 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import com.metamatrix.core.util.UnitTestUtil;
+
import junit.framework.TestCase;
@@ -51,7 +53,7 @@
bv.setReferenceStreamId(key);
// now force to serialize
- File saved = new File("blobassaved.bin"); //$NON-NLS-1$
+ File saved = new File(UnitTestUtil.getTestScratchPath()+"/blobassaved.bin"); //$NON-NLS-1$
ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(saved));
out.writeObject(bv);
out.close();
Modified: branches/jdbc30-jdk15/common-core/src/test/java/com/metamatrix/common/types/TestClobValue.java
===================================================================
--- branches/jdbc30-jdk15/common-core/src/test/java/com/metamatrix/common/types/TestClobValue.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/common-core/src/test/java/com/metamatrix/common/types/TestClobValue.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -28,6 +28,8 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import com.metamatrix.core.util.UnitTestUtil;
+
import junit.framework.TestCase;
@@ -51,7 +53,7 @@
cv.setReferenceStreamId(key);
// now force to serialize
- File saved = new File("clobassaved.bin"); //$NON-NLS-1$
+ File saved = new File(UnitTestUtil.getTestScratchPath()+"/clobassaved.bin"); //$NON-NLS-1$
ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(saved));
out.writeObject(cv);
out.close();
Modified: branches/jdbc30-jdk15/common-core/src/test/java/com/metamatrix/common/types/TestSQLXMLImpl.java
===================================================================
--- branches/jdbc30-jdk15/common-core/src/test/java/com/metamatrix/common/types/TestSQLXMLImpl.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/common-core/src/test/java/com/metamatrix/common/types/TestSQLXMLImpl.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -66,6 +66,7 @@
}
};
+ //## JDBC4.0-begin ##
public void testGetSource() throws Exception {
SQLXMLImpl xml = new SQLXMLImpl(translator);
assertTrue(xml.getSource(null) instanceof StreamSource);
@@ -73,6 +74,7 @@
StreamSource ss = (StreamSource)xml.getSource(null);
assertEquals(testStr, getContents(ss.getReader()));
}
+ //## JDBC4.0-end ##
public void testGetCharacterStream() throws Exception {
SQLXMLImpl xml = new SQLXMLImpl(translator);
Modified: branches/jdbc30-jdk15/common-core/src/test/java/com/metamatrix/common/types/TestXMLValue.java
===================================================================
--- branches/jdbc30-jdk15/common-core/src/test/java/com/metamatrix/common/types/TestXMLValue.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/common-core/src/test/java/com/metamatrix/common/types/TestXMLValue.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -28,6 +28,8 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import com.metamatrix.core.util.UnitTestUtil;
+
import junit.framework.TestCase;
@@ -53,7 +55,7 @@
xv.setPersistenceStreamId(pkey);
// now force to serialize
- File saved = new File("xmlsaved.bin"); //$NON-NLS-1$
+ File saved = new File(UnitTestUtil.getTestScratchPath()+"/xmlsaved.bin"); //$NON-NLS-1$
ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(saved));
out.writeObject(xv);
out.close();
Modified: branches/jdbc30-jdk15/common-core/src/test/java/com/metamatrix/common/types/basic/TestStringToXmlTransform.java
===================================================================
--- branches/jdbc30-jdk15/common-core/src/test/java/com/metamatrix/common/types/basic/TestStringToXmlTransform.java 2009-03-27 18:33:56 UTC (rev 656)
+++ branches/jdbc30-jdk15/common-core/src/test/java/com/metamatrix/common/types/basic/TestStringToXmlTransform.java 2009-03-27 21:41:20 UTC (rev 657)
@@ -22,8 +22,14 @@
package com.metamatrix.common.types.basic;
+//## 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 com.metamatrix.common.types.TransformationException;
import junit.framework.TestCase;
15 years, 9 months
teiid SVN: r656 - in trunk/documentation: admin-guide and 4 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-03-27 14:33:56 -0400 (Fri, 27 Mar 2009)
New Revision: 656
Modified:
trunk/documentation/
trunk/documentation/admin-guide/
trunk/documentation/connector-developer-guide/
trunk/documentation/quick-start-example/
trunk/documentation/reference/
trunk/documentation/server-extensions-guide/
Log:
adding to svn ignore
Property changes on: trunk/documentation
___________________________________________________________________
Name: svn:ignore
- target
+ target
.classpath
.settings
.project
Property changes on: trunk/documentation/admin-guide
___________________________________________________________________
Name: svn:ignore
- target
+ target
.project
.settings
.classpath
Property changes on: trunk/documentation/connector-developer-guide
___________________________________________________________________
Name: svn:ignore
- target
+ target
.settings
.classpath
.project
Property changes on: trunk/documentation/quick-start-example
___________________________________________________________________
Name: svn:ignore
- target
+ target
.classpath
.settings
.project
Property changes on: trunk/documentation/reference
___________________________________________________________________
Name: svn:ignore
- target
+ target
.classpath
.project
.settings
Property changes on: trunk/documentation/server-extensions-guide
___________________________________________________________________
Name: svn:ignore
- target
+ target
.project
.settings
.classpath
15 years, 9 months
teiid SVN: r655 - trunk/soap/src/main/webapp.
by teiid-commits@lists.jboss.org
Author: tejones
Date: 2009-03-27 10:46:49 -0400 (Fri, 27 Mar 2009)
New Revision: 655
Modified:
trunk/soap/src/main/webapp/wsdlurls.jsp
Log:
TEIID-422 - Removed extraneous character causing jsp compile error
Modified: trunk/soap/src/main/webapp/wsdlurls.jsp
===================================================================
--- trunk/soap/src/main/webapp/wsdlurls.jsp 2009-03-25 17:55:48 UTC (rev 654)
+++ trunk/soap/src/main/webapp/wsdlurls.jsp 2009-03-27 14:46:49 UTC (rev 655)
@@ -26,7 +26,7 @@
*/
-->
<html>
-<%/*
+<%
List wsdlUrls = (List) session
.getAttribute(WSDLServletUtil.DISCOVERED_WSDL);
15 years, 9 months
teiid SVN: r654 - in trunk: client/src/main/java/com/metamatrix/common/comm/platform/socket/client and 4 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-03-25 13:55:48 -0400 (Wed, 25 Mar 2009)
New Revision: 654
Modified:
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMServerConnection.java
trunk/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerInstance.java
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerInstanceImpl.java
trunk/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerConnection.java
trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/SocketVMController.java
trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/SocketListener.java
Log:
TEIID-297 misc comm clean ups, ensuring that serverinstances get properly cycled.
Modified: trunk/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java 2009-03-25 16:01:36 UTC (rev 653)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java 2009-03-25 17:55:48 UTC (rev 654)
@@ -40,6 +40,7 @@
import com.metamatrix.common.comm.platform.socket.client.SocketServerConnection;
import com.metamatrix.common.comm.platform.socket.client.SocketServerConnectionFactory;
import com.metamatrix.common.util.MetaMatrixProductNames;
+import com.metamatrix.common.util.PropertiesUtils;
import com.metamatrix.core.MetaMatrixRuntimeException;
/**
@@ -205,10 +206,11 @@
return createAdmin(p);
}
- public ServerAdmin createAdmin(final Properties p)
+ public ServerAdmin createAdmin(Properties p)
throws AdminComponentException, AdminException {
+ p = PropertiesUtils.clone(p);
p.setProperty(MMURL.CONNECTION.PRODUCT_NAME, MetaMatrixProductNames.Platform.PRODUCT_NAME);
-
+ p.setProperty(MMURL.CONNECTION.AUTO_FAILOVER, Boolean.TRUE.toString());
ServerAdmin serverAdmin = (ServerAdmin)Proxy.newProxyInstance(Thread.currentThread()
.getContextClassLoader(), new Class[] { ServerAdmin.class }, new ReconnectingProxy(p));
Modified: trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java 2009-03-25 16:01:36 UTC (rev 653)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java 2009-03-25 17:55:48 UTC (rev 654)
@@ -30,6 +30,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
+import java.net.SocketAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
@@ -54,7 +55,6 @@
import com.metamatrix.common.comm.exception.ConnectionException;
import com.metamatrix.common.comm.exception.SingleInstanceCommunicationException;
import com.metamatrix.common.comm.platform.CommPlatformPlugin;
-import com.metamatrix.dqp.client.ClientSideDQP;
import com.metamatrix.platform.security.api.ILogon;
import com.metamatrix.platform.security.api.LogonResult;
@@ -78,6 +78,7 @@
private ILogon logon;
private Timer pingTimer;
private boolean closed;
+ private boolean failOver;
public SocketServerConnection(
SocketServerInstanceFactory connectionFactory, boolean secure,
@@ -88,6 +89,7 @@
this.connProps = connProps;
this.secure = secure;
this.logon = this.getService(ILogon.class);
+ this.failOver = Boolean.valueOf(connProps.getProperty(MMURL.CONNECTION.AUTO_FAILOVER)).booleanValue();
authenticate();
@@ -111,7 +113,7 @@
if (this.serverInstance.isOpen()) {
return this.serverInstance;
}
- this.serverInstance = null;
+ closeServerInstance();
}
List<HostInfo> hostKeys = new ArrayList<HostInfo>(this.serverDiscovery.getKnownHosts());
List<HostInfo> hostCopy = new ArrayList<HostInfo>(hostKeys);
@@ -157,7 +159,7 @@
try {
this.logonResult = logon.logon(connProps);
if (this.serverDiscovery.setLogonResult(this.logonResult)) {
- selectNewServerInstance();
+ closeServerInstance();
}
return;
} catch (LogonException e) {
@@ -194,20 +196,15 @@
class ServerConnectionInvocationHandler implements InvocationHandler {
private Class<?> targetClass;
- private SocketServerInstance instance;
private Object target;
- private boolean failOver;
public ServerConnectionInvocationHandler(Class<?> targetClass) {
this.targetClass = targetClass;
- this.failOver = Boolean.valueOf(connProps.getProperty(MMURL.CONNECTION.AUTO_FAILOVER)).booleanValue()
- || !ClientSideDQP.class.isAssignableFrom(targetClass);
}
private synchronized Object getTarget() throws CommunicationException {
if (this.target == null) {
- this.instance = selectServerInstance();
- this.target = this.instance.getService(targetClass);
+ this.target = selectServerInstance().getService(targetClass);
}
return this.target;
}
@@ -240,13 +237,6 @@
private synchronized void invalidateTarget() {
this.target = null;
}
-
- synchronized SocketServerInstance getInstance() throws CommunicationException {
- if (instance == null) {
- getTarget();
- }
- return instance;
- }
}
@@ -274,10 +264,7 @@
//ignore
}
- if (this.serverInstance != null) {
- this.serverInstance.shutdown();
- this.serverInstance = null;
- }
+ closeServerInstance();
this.closed = true;
this.serverDiscovery.shutdown();
@@ -298,25 +285,29 @@
return logonResult;
}
- synchronized void selectNewServerInstance() {
- this.serverInstance = null;
+ synchronized void closeServerInstance() {
+ if (this.serverInstance != null) {
+ this.serverInstance.shutdown();
+ this.serverInstance = null;
+ }
}
- public static boolean isSameInstance(Object service, Object otherService) throws CommunicationException {
- try {
- ServerConnectionInvocationHandler handler = (ServerConnectionInvocationHandler)Proxy.getInvocationHandler(service);
- ServerConnectionInvocationHandler otherHandler = (ServerConnectionInvocationHandler)Proxy.getInvocationHandler(otherService);
- return handler.getInstance().getHostInfo().getInetAddress().equals(otherHandler.getInstance().getHostInfo().getInetAddress());
- } catch (IllegalArgumentException e) {
+ public boolean isSameInstance(SocketServerConnection otherService) throws CommunicationException {
+ SocketAddress address = selectServerInstance().getRemoteAddress();
+ if (address == null) {
return false;
- } catch (UnknownHostException e) {
- throw new CommunicationException(e);
}
+ return address.equals(otherService.selectServerInstance().getRemoteAddress());
}
- public static void selectNewServerInstance(Object service) {
+ public void selectNewServerInstance(Object service) {
+ closeServerInstance();
ServerConnectionInvocationHandler handler = (ServerConnectionInvocationHandler)Proxy.getInvocationHandler(service);
handler.invalidateTarget();
}
+
+ public void setFailOver(boolean failOver) {
+ this.failOver = failOver;
+ }
}
\ No newline at end of file
Modified: trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java 2009-03-25 16:01:36 UTC (rev 653)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java 2009-03-25 17:55:48 UTC (rev 654)
@@ -54,6 +54,14 @@
import com.metamatrix.core.util.ReflectionHelper;
import com.metamatrix.platform.security.api.ILogon;
+/**
+ * Responsible for creating socket based connections
+ *
+ * The comm approach is object based and layered. Connections manage failover and identity.
+ * ServerInstances represent the service layer to a particular cluster member. ObjectChannels
+ * abstract the underlying IO.
+ *
+ */
public class SocketServerConnectionFactory implements ServerConnectionFactory, SocketServerInstanceFactory {
private static final String URL = "URL"; //$NON-NLS-1$
Modified: trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerInstance.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerInstance.java 2009-03-25 16:01:36 UTC (rev 653)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerInstance.java 2009-03-25 17:55:48 UTC (rev 654)
@@ -22,7 +22,8 @@
package com.metamatrix.common.comm.platform.socket.client;
-import com.metamatrix.common.api.HostInfo;
+import java.net.SocketAddress;
+
import com.metamatrix.common.util.crypto.Cryptor;
public interface SocketServerInstance {
@@ -31,8 +32,8 @@
void shutdown();
- HostInfo getHostInfo();
-
+ SocketAddress getRemoteAddress();
+
boolean isOpen();
Cryptor getCryptor();
Modified: trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerInstanceImpl.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerInstanceImpl.java 2009-03-25 16:01:36 UTC (rev 653)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerInstanceImpl.java 2009-03-25 17:55:48 UTC (rev 654)
@@ -30,6 +30,7 @@
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.net.InetSocketAddress;
+import java.net.SocketAddress;
import java.net.SocketTimeoutException;
import java.util.Iterator;
import java.util.Map;
@@ -104,11 +105,9 @@
}
}
- /**
- * Return identifier of the server VM this ServerInstance is associated with.
- */
- public HostInfo getHostInfo() {
- return this.hostInfo;
+ @Override
+ public SocketAddress getRemoteAddress() {
+ return this.socketChannel.getRemoteAddress();
}
static String getVersionInfo() {
Modified: trunk/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerConnection.java
===================================================================
--- trunk/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerConnection.java 2009-03-25 16:01:36 UTC (rev 653)
+++ trunk/client/src/test/java/com/metamatrix/common/comm/platform/socket/client/TestSocketServerConnection.java 2009-03-25 17:55:48 UTC (rev 654)
@@ -26,6 +26,7 @@
package com.metamatrix.common.comm.platform.socket.client;
import java.io.IOException;
+import java.net.InetSocketAddress;
import java.util.Properties;
import junit.framework.TestCase;
@@ -41,7 +42,6 @@
import com.metamatrix.common.comm.exception.ConnectionException;
import com.metamatrix.common.comm.exception.SingleInstanceCommunicationException;
import com.metamatrix.common.util.crypto.NullCryptor;
-import com.metamatrix.dqp.client.ClientSideDQP;
import com.metamatrix.dqp.client.ResultsFuture;
import com.metamatrix.platform.security.api.ILogon;
import com.metamatrix.platform.security.api.LogonResult;
@@ -146,6 +146,7 @@
*/
public void testRetry() throws Exception {
SocketServerConnection connection = createConnection(new SingleInstanceCommunicationException());
+ connection.setFailOver(true);
ILogon logon = connection.getService(ILogon.class);
logon.ping();
}
@@ -160,9 +161,21 @@
}
}
+
+ public void testImmediateFail1() throws Exception {
+ SocketServerConnection connection = createConnection(new CommunicationException());
+ connection.setFailOver(true);
+ ILogon logon = connection.getService(ILogon.class);
+ try {
+ logon.ping();
+ fail("expected exception"); //$NON-NLS-1$
+ } catch (MetaMatrixComponentException e) {
+
+ }
+ }
private SocketServerConnection createConnection(final Throwable throwException) throws CommunicationException, ConnectionException {
- return createConnection(throwException, new HostInfo("foo", 1)); //$NON-NLS-1$
+ return createConnection(throwException, new HostInfo("0.0.0.2", 1)); //$NON-NLS-1$
}
private SocketServerConnection createConnection(final Throwable t, HostInfo hostInfo)
@@ -175,7 +188,7 @@
boolean ssl) throws CommunicationException, IOException {
SocketServerInstance instance = Mockito.mock(SocketServerInstance.class);
Mockito.stub(instance.getCryptor()).toReturn(new NullCryptor());
- Mockito.stub(instance.getHostInfo()).toReturn(info);
+ Mockito.stub(instance.getRemoteAddress()).toReturn(new InetSocketAddress(info.getInetAddress(), info.getPortNumber()));
FakeILogon logon = new FakeILogon();
logon.t = t;
Mockito.stub(instance.getService(ILogon.class)).toReturn(logon);
@@ -191,11 +204,8 @@
SocketServerConnection conn = createConnection(null, new HostInfo("0.0.0.0", 1)); //$NON-NLS-1$
SocketServerConnection conn1 = createConnection(null, new HostInfo("0.0.0.1", 1)); //$NON-NLS-1$
- ClientSideDQP dqp = conn.getService(ClientSideDQP.class);
- ClientSideDQP dqp1 = conn1.getService(ClientSideDQP.class);
-
- assertFalse(SocketServerConnection.isSameInstance(dqp, dqp1));
- assertTrue(SocketServerConnection.isSameInstance(dqp, dqp));
+ assertFalse(conn.isSameInstance(conn1));
+ assertTrue(conn.isSameInstance(conn));
}
}
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMServerConnection.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMServerConnection.java 2009-03-25 16:01:36 UTC (rev 653)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMServerConnection.java 2009-03-25 17:55:48 UTC (rev 654)
@@ -108,7 +108,7 @@
super.recycleConnection();
//perform load balancing
if (this.serverConn instanceof SocketServerConnection) {
- SocketServerConnection.selectNewServerInstance(this.getDQP());
+ ((SocketServerConnection)this.serverConn).selectNewServerInstance(this.getDQP());
}
}
@@ -117,7 +117,7 @@
if (conn instanceof MMServerConnection
&& this.serverConn instanceof SocketServerConnection
&& conn.serverConn instanceof SocketServerConnection) {
- return SocketServerConnection.isSameInstance(this.getDQP(), conn.getDQP());
+ return ((SocketServerConnection)this.serverConn).isSameInstance((SocketServerConnection)conn.serverConn);
}
return false;
}
Modified: trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/SocketVMController.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/SocketVMController.java 2009-03-25 16:01:36 UTC (rev 653)
+++ trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/SocketVMController.java 2009-03-25 17:55:48 UTC (rev 654)
@@ -68,8 +68,8 @@
private static final int DEFAULT_MAX_THREADS = 15;
private static final long DEFAULT_TIMETOLIVE = 15000;
private static final long DEFAULT_WAITFORSERVICES = 500;
- private static final int DEFAULT_INPUT_BUFFER_SIZE = 102400;
- private static final int DEFAULT_OUTPUT_BUFFER_SIZE = 102400;
+ private static final int DEFAULT_INPUT_BUFFER_SIZE = 0;
+ private static final int DEFAULT_OUTPUT_BUFFER_SIZE = 0;
private static final String SOCKET_WORKER_POOL_NAME = "SocketWorkerQueue"; //$NON-NLS-1$
private SocketListener listener;
Modified: trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/SocketListener.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/SocketListener.java 2009-03-25 16:01:36 UTC (rev 653)
+++ trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/SocketListener.java 2009-03-25 17:55:48 UTC (rev 654)
@@ -89,14 +89,17 @@
new SynchronousQueue<Runnable>(),
new WorkerPoolFactory.DefaultThreadFactory("ServerNio")); //$NON-NLS-1$
- ChannelFactory factory =
- new NioServerSocketChannelFactory(executor, executor, Runtime.getRuntime().availableProcessors() * 2);
+ ChannelFactory factory = new NioServerSocketChannelFactory(executor, executor);
ServerBootstrap bootstrap = new ServerBootstrap(factory);
this.channelHandler = new SSLAwareChannelHandler(this, engine, Thread.currentThread().getContextClassLoader());
bootstrap.setPipelineFactory(channelHandler);
- bootstrap.setOption("receiveBufferSize", new Integer(inputBufferSize)); //$NON-NLS-1$
- bootstrap.setOption("sendBufferSize", new Integer(outputBufferSize)); //$NON-NLS-1$
+ if (inputBufferSize != 0) {
+ bootstrap.setOption("receiveBufferSize", new Integer(inputBufferSize)); //$NON-NLS-1$
+ }
+ if (outputBufferSize != 0) {
+ bootstrap.setOption("sendBufferSize", new Integer(outputBufferSize)); //$NON-NLS-1$
+ }
bootstrap.setOption("keepAlive", Boolean.TRUE); //$NON-NLS-1$
this.serverChanel = bootstrap.bind(new InetSocketAddress(bindAddress, port));
15 years, 9 months
teiid SVN: r653 - in trunk: client/src/main/java/com/metamatrix/common/comm/platform/socket/client and 10 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-03-25 12:01:36 -0400 (Wed, 25 Mar 2009)
New Revision: 653
Added:
trunk/client/src/main/java/com/metamatrix/common/comm/exception/ExceptionHolder.java
trunk/client/src/test/java/com/metamatrix/common/comm/exception/
trunk/client/src/test/java/com/metamatrix/common/comm/exception/TestExceptionHolder.java
trunk/client/src/test/resources/test.jar
Removed:
trunk/client/src/main/java/com/metamatrix/common/comm/exception/ExceptionHolder.java
trunk/common-core/src/main/java/com/metamatrix/common/util/exception/SQLExceptionUnroller.java
trunk/common-core/src/test/java/com/metamatrix/api/exception/TestMetaMatrixCoreException.java
trunk/common-core/src/test/java/com/metamatrix/common/util/exception/TestSQLExceptionUnroller.java
Modified:
trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerInstanceImpl.java
trunk/client/src/main/java/com/metamatrix/dqp/message/ResultsMessage.java
trunk/client/src/main/resources/com/metamatrix/common/comm/platform/i18n.properties
trunk/common-core/src/main/java/com/metamatrix/core/MetaMatrixCoreException.java
trunk/common-core/src/main/java/com/metamatrix/core/MetaMatrixRuntimeException.java
trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/ServerWorkItem.java
Log:
TEIID-431 changed the approach exception serialization to prevent client class def not found exceptions.
Deleted: trunk/client/src/main/java/com/metamatrix/common/comm/exception/ExceptionHolder.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/exception/ExceptionHolder.java 2009-03-25 15:33:18 UTC (rev 652)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/exception/ExceptionHolder.java 2009-03-25 16:01:36 UTC (rev 653)
@@ -1,78 +0,0 @@
-package com.metamatrix.common.comm.exception;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.api.exception.MetaMatrixProcessingException;
-import com.metamatrix.common.comm.platform.CommPlatformPlugin;
-
-/*
- * 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.
- */
-
-public class ExceptionHolder implements Externalizable {
-
- private String message;
- private String className;
- private boolean isProcessingException;
- private Throwable exception;
-
- public ExceptionHolder() {
- }
-
- public ExceptionHolder(Throwable exception) {
- this.exception = exception;
- this.isProcessingException = exception instanceof MetaMatrixProcessingException;
- this.className = exception.getClass().getName();
- this.message = exception.getMessage();
- }
-
- @Override
- public void readExternal(ObjectInput in) throws IOException,
- ClassNotFoundException {
- this.className = (String)in.readObject();
- this.isProcessingException = in.readBoolean();
- this.message = (String)in.readObject();
- this.exception = (Throwable)in.readObject();
- }
-
- @Override
- public void writeExternal(ObjectOutput out) throws IOException {
- out.writeObject(this.className);
- out.writeBoolean(this.isProcessingException);
- out.writeObject(this.message);
- out.writeObject(this.exception);
- }
-
- public Throwable convertException() {
- if (exception != null) {
- return exception;
- }
- if (isProcessingException) {
- return new MetaMatrixProcessingException(CommPlatformPlugin.Util.getString("ExceptionHolder.converted_exception", this.className, this.message));
- }
- return new MetaMatrixComponentException(CommPlatformPlugin.Util.getString("ExceptionHolder.converted_exception", this.className, this.message));
- }
-
-}
Added: trunk/client/src/main/java/com/metamatrix/common/comm/exception/ExceptionHolder.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/exception/ExceptionHolder.java (rev 0)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/exception/ExceptionHolder.java 2009-03-25 16:01:36 UTC (rev 653)
@@ -0,0 +1,111 @@
+package com.metamatrix.common.comm.exception;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutput;
+import java.io.ObjectOutputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import com.metamatrix.common.comm.platform.CommPlatformPlugin;
+import com.metamatrix.common.comm.platform.socket.ObjectInputStreamWithClassloader;
+import com.metamatrix.core.MetaMatrixCoreException;
+import com.metamatrix.core.MetaMatrixRuntimeException;
+import com.metamatrix.core.util.ReflectionHelper;
+
+/*
+ * 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.
+ */
+
+public class ExceptionHolder implements Externalizable {
+
+ private Throwable exception;
+
+ public ExceptionHolder() {
+ }
+
+ public ExceptionHolder(Throwable exception) {
+ this.exception = exception;
+ }
+
+ @Override
+ public void readExternal(ObjectInput in) throws IOException,
+ ClassNotFoundException {
+ List<String> classNames = (List<String>)in.readObject();
+ String message = (String)in.readObject();
+ StackTraceElement[] stackTrace = (StackTraceElement[])in.readObject();
+ byte[] serializedException = (byte[])in.readObject();
+ ByteArrayInputStream bais = new ByteArrayInputStream(serializedException);
+ ObjectInputStream ois = new ObjectInputStreamWithClassloader(bais, Thread.currentThread().getContextClassLoader());
+ try {
+ this.exception = (Throwable)ois.readObject();
+ } catch (ClassNotFoundException e) {
+ List<String> args = Arrays.asList(CommPlatformPlugin.Util.getString("ExceptionHolder.converted_exception", message, classNames)); //$NON-NLS-1$
+
+ for (String className : classNames) {
+ try {
+ Throwable result = (Throwable)ReflectionHelper.create(className, args, Thread.currentThread().getContextClassLoader());
+ result.initCause(e);
+ result.setStackTrace(stackTrace);
+ this.exception = result;
+ break;
+ } catch (MetaMatrixCoreException e1) {
+ //
+ }
+ }
+ if (this.exception == null) {
+ throw new MetaMatrixRuntimeException(exception, args.get(0));
+ }
+ }
+ }
+
+ @Override
+ public void writeExternal(ObjectOutput out) throws IOException {
+ List<String> classNames = new ArrayList<String>();
+ Class<?> clazz = exception.getClass();
+ while (clazz != null) {
+ if (clazz == Throwable.class || clazz == Exception.class) {
+ break;
+ }
+ classNames.add(clazz.getName());
+ clazz = clazz.getSuperclass();
+ }
+ out.writeObject(classNames);
+ out.writeObject(exception.getMessage());
+ out.writeObject(exception.getStackTrace());
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(this.exception);
+ oos.flush();
+ oos.close();
+ out.writeObject(baos.toByteArray());
+ }
+
+ public Throwable getException() {
+ return exception;
+ }
+
+}
Modified: trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerInstanceImpl.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerInstanceImpl.java 2009-03-25 15:33:18 UTC (rev 652)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerInstanceImpl.java 2009-03-25 16:01:36 UTC (rev 653)
@@ -264,7 +264,7 @@
try {
Object result = getCryptor().unsealObject((Serializable) super.convertResult());
if (result instanceof ExceptionHolder) {
- throw new ExecutionException(((ExceptionHolder)result).convertException());
+ throw new ExecutionException(((ExceptionHolder)result).getException());
}
if (result instanceof Throwable) {
throw new ExecutionException((Throwable)result);
Modified: trunk/client/src/main/java/com/metamatrix/dqp/message/ResultsMessage.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/dqp/message/ResultsMessage.java 2009-03-25 15:33:18 UTC (rev 652)
+++ trunk/client/src/main/java/com/metamatrix/dqp/message/ResultsMessage.java 2009-03-25 16:01:36 UTC (rev 653)
@@ -34,6 +34,7 @@
import com.metamatrix.api.exception.MetaMatrixException;
import com.metamatrix.common.batch.BatchSerializer;
+import com.metamatrix.common.comm.exception.ExceptionHolder;
import com.metamatrix.core.util.ExternalizeUtil;
/**
@@ -339,11 +340,18 @@
// Plan Descriptions
planDescription = ExternalizeUtil.readMap(in);
- exception = (MetaMatrixException)ExternalizeUtil.readThrowable(in);
+ ExceptionHolder holder = (ExceptionHolder)in.readObject();
+ if (holder != null) {
+ this.exception = (MetaMatrixException)holder.getException();
+ }
+ List<ExceptionHolder> holderList = (List<ExceptionHolder>)in.readObject();
+ if (holderList != null) {
+ this.warnings = new ArrayList<Exception>(holderList.size());
+ for (ExceptionHolder exceptionHolder : holderList) {
+ this.warnings.add((Exception)exceptionHolder.getException());
+ }
+ }
- //Warnings
- warnings = ExternalizeUtil.readList(in);
-
//Schemas
schemas = ExternalizeUtil.readList(in);
@@ -375,9 +383,20 @@
// Plan descriptions
ExternalizeUtil.writeMap(out, planDescription);
- ExternalizeUtil.writeThrowable(out, exception);
- // Warnings
- ExternalizeUtil.writeList(out, warnings);
+ if (exception != null) {
+ out.writeObject(new ExceptionHolder(exception));
+ } else {
+ out.writeObject(exception);
+ }
+ if (this.warnings != null) {
+ List<ExceptionHolder> replcement = new ArrayList<ExceptionHolder>(this.warnings.size());
+ for (Exception warning : warnings) {
+ replcement.add(new ExceptionHolder(warning));
+ }
+ out.writeObject(replcement);
+ } else {
+ out.writeObject(this.warnings);
+ }
//Schemas
ExternalizeUtil.writeCollection(out, schemas);
Modified: trunk/client/src/main/resources/com/metamatrix/common/comm/platform/i18n.properties
===================================================================
--- trunk/client/src/main/resources/com/metamatrix/common/comm/platform/i18n.properties 2009-03-25 15:33:18 UTC (rev 652)
+++ trunk/client/src/main/resources/com/metamatrix/common/comm/platform/i18n.properties 2009-03-25 16:01:36 UTC (rev 653)
@@ -115,7 +115,7 @@
SocketServerConnection.closed=Server connection is closed
-ExceptionHolder.converted_exception=Remote exception of type {0} occurred with message {1}
+ExceptionHolder.converted_exception=Remote exception: {0} ... Original type hierarchy {1}.
SocketHelper.keystore_not_found=Key store ''{0}'' was not found.
Added: trunk/client/src/test/java/com/metamatrix/common/comm/exception/TestExceptionHolder.java
===================================================================
--- trunk/client/src/test/java/com/metamatrix/common/comm/exception/TestExceptionHolder.java (rev 0)
+++ trunk/client/src/test/java/com/metamatrix/common/comm/exception/TestExceptionHolder.java 2009-03-25 16:01:36 UTC (rev 653)
@@ -0,0 +1,43 @@
+package com.metamatrix.common.comm.exception;
+
+import static org.junit.Assert.*;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.net.URL;
+
+import org.junit.Test;
+
+import com.metamatrix.api.exception.MetaMatrixProcessingException;
+import com.metamatrix.common.classloader.NonDelegatingClassLoader;
+import com.metamatrix.core.util.ReflectionHelper;
+import com.metamatrix.core.util.UnitTestUtil;
+
+public class TestExceptionHolder {
+
+ @SuppressWarnings("all")
+ public static class BadException extends MetaMatrixProcessingException {
+ private Object obj;
+ public BadException(Object obj) {
+ this.obj = obj;
+ }
+ }
+
+ @Test public void testDeserializationUnknownException() throws Exception {
+ ClassLoader cl = new NonDelegatingClassLoader(new URL[] {UnitTestUtil.getTestDataFile("test.jar").toURI().toURL()}); //$NON-NLS-1$
+ Object obj = ReflectionHelper.create("Test", null, cl); //$NON-NLS-1$
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(new ExceptionHolder(new BadException(obj)));
+ oos.flush();
+
+ ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));
+ ExceptionHolder holder = (ExceptionHolder)ois.readObject();
+ assertTrue(holder.getException() instanceof MetaMatrixProcessingException);
+ assertEquals("Remote exception: null ... Original type hierarchy [com.metamatrix.common.comm.exception.TestExceptionHolder$BadException, com.metamatrix.api.exception.MetaMatrixProcessingException, com.metamatrix.api.exception.MetaMatrixException, com.metamatrix.core.MetaMatrixCoreException].", holder.getException().getMessage()); //$NON-NLS-1$
+ }
+
+}
Property changes on: trunk/client/src/test/java/com/metamatrix/common/comm/exception/TestExceptionHolder.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/client/src/test/resources/test.jar
===================================================================
(Binary files differ)
Property changes on: trunk/client/src/test/resources/test.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/util/exception/SQLExceptionUnroller.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/util/exception/SQLExceptionUnroller.java 2009-03-25 15:33:18 UTC (rev 652)
+++ trunk/common-core/src/main/java/com/metamatrix/common/util/exception/SQLExceptionUnroller.java 2009-03-25 16:01:36 UTC (rev 653)
@@ -1,67 +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.
- */
-
-/*
- * Date: Mar 5, 2003
- * Time: 5:24:57 PM
- */
-package com.metamatrix.common.util.exception;
-
-import java.sql.SQLException;
-
-/**
- * SQLExceptionUnroller.
- * <br>A utility to unroll a chained <code>SQLException</code>.</br>
- * <p>This utility is used to replace proprietary exceptions that may
- * not unmarshall in other VMs that do not have the proprietary libraries.</p>
- *
- * TODO: test causes and next exceptions for non-Java then unroll
- */
-public class SQLExceptionUnroller {
-
- /**
- * Unroll a chain of possibly proprietary <code>SQLException</code>s
- * and create a chain of of generic {@link java.sql.SQLException SQLExceptions}
- * with the original message (reason), SQLState, and vendorCode of the
- * <code>SQLException</code>s in the chain.
- * @param theException The original <code>SQLException</code> possibly
- * with a chain of child exceptions.
- * @return A <code>SQLException</code> mirroring the original
- * exception chain.
- */
- public static SQLException unRollException(final SQLException theException) {
- // Get msg, SQLState and vendorCode from top-level exception
- String SQLState = theException.getSQLState();
- int vendorCode = theException.getErrorCode();
- final SQLException outException = new SQLException(
- (SQLException.class != theException.getClass() ? (theException.getClass().getName() + ": ") : ("")) + theException.getMessage(), SQLState, vendorCode); //$NON-NLS-1$ //$NON-NLS-2$
- outException.setStackTrace(theException.getStackTrace());
-
- // Continue with any chained exceptions
- SQLException ei = theException.getNextException();
- if (ei != null) {
- outException.setNextException(unRollException(ei));
- }
- return outException;
- }
-
-}
Modified: trunk/common-core/src/main/java/com/metamatrix/core/MetaMatrixCoreException.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/core/MetaMatrixCoreException.java 2009-03-25 15:33:18 UTC (rev 652)
+++ trunk/common-core/src/main/java/com/metamatrix/core/MetaMatrixCoreException.java 2009-03-25 16:01:36 UTC (rev 653)
@@ -22,14 +22,8 @@
package com.metamatrix.core;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.sql.SQLException;
-import com.metamatrix.common.util.exception.SQLExceptionUnroller;
-
/**
* Exception which occurs if an error occurs within the server that is not
* business-related. For instance, if a service or bean is not available
@@ -37,8 +31,6 @@
*/
public class MetaMatrixCoreException extends Exception {
- private transient Throwable realCause;
-
public MetaMatrixCoreException() {
}
@@ -51,41 +43,7 @@
}
public MetaMatrixCoreException(Throwable e, String message) {
- super(message);
- this.realCause = e;
+ super(message, e);
}
- @Override
- public Throwable getCause() {
- return this.realCause;
- }
-
- @Override
- public synchronized Throwable initCause(Throwable cause) {
- if (this.realCause != null)
- throw new IllegalStateException("Can't overwrite cause"); //$NON-NSL-1$
- if (cause == this)
- throw new IllegalArgumentException("Self-causation not permitted"); //$NON-NSL-1$
- this.realCause = cause;
- return this;
- }
-
- private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
- in.defaultReadObject();
- try {
- realCause = (Throwable)in.readObject();
- } catch (ClassNotFoundException cnfe) {
- realCause = new MetaMatrixCoreException(cnfe, CorePlugin.Util.getString("MetaMatrixException.deserialization_exception")); //$NON-NSL-1$
- }
- }
-
- private void writeObject(ObjectOutputStream out) throws IOException {
- getStackTrace();
- out.defaultWriteObject();
- if (realCause != this && realCause instanceof SQLException) {
- out.writeObject(SQLExceptionUnroller.unRollException((SQLException)realCause));
- } else {
- out.writeObject(realCause);
- }
- }
}
Modified: trunk/common-core/src/main/java/com/metamatrix/core/MetaMatrixRuntimeException.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/core/MetaMatrixRuntimeException.java 2009-03-25 15:33:18 UTC (rev 652)
+++ trunk/common-core/src/main/java/com/metamatrix/core/MetaMatrixRuntimeException.java 2009-03-25 16:01:36 UTC (rev 653)
@@ -22,15 +22,10 @@
package com.metamatrix.core;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
-import java.sql.SQLException;
import com.metamatrix.api.exception.MetaMatrixException;
-import com.metamatrix.common.util.exception.SQLExceptionUnroller;
import com.metamatrix.core.util.MetaMatrixExceptionUtil;
/**
@@ -69,7 +64,6 @@
/** An error code. */
private String code;
- private transient Throwable realCause;
//############################################################################################################################
//# Constructors #
@@ -143,8 +137,7 @@
* @param message The error message or a resource bundle key
*/
public MetaMatrixRuntimeException(final Throwable e, final int code, final String message) {
- super(message);
- this.realCause = e;
+ super(message, e);
// The following setCode call should be executed after setting the message
setCode(code);
}
@@ -241,38 +234,4 @@
super.printStackTrace(output);
}
- @Override
- public Throwable getCause() {
- return this.realCause;
- }
-
- @Override
- public synchronized Throwable initCause(Throwable cause) {
- if (this.realCause != this)
- throw new IllegalStateException("Can't overwrite cause"); //$NON-NSL-1$
- if (cause == this)
- throw new IllegalArgumentException("Self-causation not permitted"); //$NON-NSL-1$
- this.realCause = cause;
- return this;
- }
-
- private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
- in.defaultReadObject();
- try {
- realCause = (Throwable)in.readObject();
- } catch (ClassNotFoundException cnfe) {
- realCause = new MetaMatrixRuntimeException(cnfe, CorePlugin.Util.getString("MetaMatrixException.deserialization_exception")); //$NON-NSL-1$
- }
- }
-
- private void writeObject(ObjectOutputStream out) throws IOException {
- getStackTrace();
- out.defaultWriteObject();
- if (realCause != this && realCause instanceof SQLException) {
- out.writeObject(SQLExceptionUnroller.unRollException((SQLException)realCause));
- } else {
- out.writeObject(realCause);
- }
- }
-
}
Deleted: trunk/common-core/src/test/java/com/metamatrix/api/exception/TestMetaMatrixCoreException.java
===================================================================
--- trunk/common-core/src/test/java/com/metamatrix/api/exception/TestMetaMatrixCoreException.java 2009-03-25 15:33:18 UTC (rev 652)
+++ trunk/common-core/src/test/java/com/metamatrix/api/exception/TestMetaMatrixCoreException.java 2009-03-25 16:01:36 UTC (rev 653)
@@ -1,65 +0,0 @@
-package com.metamatrix.api.exception;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.ObjectStreamClass;
-import java.sql.BatchUpdateException;
-import java.sql.SQLException;
-
-import javax.naming.OperationNotSupportedException;
-
-import junit.framework.TestCase;
-
-import com.metamatrix.core.MetaMatrixCoreException;
-import com.metamatrix.core.util.UnitTestUtil;
-
-public class TestMetaMatrixCoreException extends TestCase {
-
- public void testSQLExceptionUnrolling() throws Exception {
- SQLException se = new BatchUpdateException("foo", new int[] {1}); //$NON-NLS-1$
- MetaMatrixCoreException mmce = new MetaMatrixCoreException(se);
-
- mmce = UnitTestUtil.helpSerialize(mmce);
- assertEquals(SQLException.class, mmce.getCause().getClass());
- assertEquals("foo", mmce.getMessage()); //$NON-NLS-1$
- assertEquals("java.sql.BatchUpdateException: foo", mmce.getCause().getMessage()); //$NON-NLS-1$
- }
-
- public void testInitCause() throws Exception {
- MetaMatrixCoreException mmce = new MetaMatrixCoreException();
- mmce.initCause(new Exception());
- try {
- mmce.initCause(new Exception());
- fail();
- } catch (IllegalStateException e) {
-
- }
- }
-
- public void defer_testDeserializationUnknownException() throws Exception {
- MetaMatrixCoreException mmce = new MetaMatrixCoreException(new OperationNotSupportedException());
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ObjectOutputStream oos = new ObjectOutputStream(baos);
- oos.writeObject(mmce);
- oos.flush();
-
- ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray())) {
- @Override
- protected Class<?> resolveClass(ObjectStreamClass desc)
- throws IOException, ClassNotFoundException {
- if (desc.getName().equals(OperationNotSupportedException.class.getName())) {
- throw new ClassNotFoundException();
- }
- return super.resolveClass(desc);
- }
-
- };
-
- mmce = (MetaMatrixComponentException)ois.readObject();
- }
-
-}
Deleted: trunk/common-core/src/test/java/com/metamatrix/common/util/exception/TestSQLExceptionUnroller.java
===================================================================
--- trunk/common-core/src/test/java/com/metamatrix/common/util/exception/TestSQLExceptionUnroller.java 2009-03-25 15:33:18 UTC (rev 652)
+++ trunk/common-core/src/test/java/com/metamatrix/common/util/exception/TestSQLExceptionUnroller.java 2009-03-25 16:01:36 UTC (rev 653)
@@ -1,123 +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.util.exception;
-
-import java.sql.SQLException;
-import java.util.Random;
-
-import junit.framework.TestCase;
-
-/**
- * @version 1.0
- * @author
- */
-public class TestSQLExceptionUnroller extends TestCase {
-
- /**
- * Constructor for TestSQLExceptionUnroller.
- * @param name
- */
- public TestSQLExceptionUnroller(String name) {
- super(name);
- }
-
- // ********* H E L P E R M E T H O D S *********
-
- private void helpTestUnroll(SQLException sqlEx, SQLException mmEx) {
- // Get the original SQLException chain
- StringBuffer expectedResult = new StringBuffer(getSQLErrorMsg(sqlEx));
- SQLException sqlChild = sqlEx.getNextException();
- while ( sqlChild != null ) {
- expectedResult.append("|" + getSQLErrorMsg(sqlChild)); //$NON-NLS-1$
- sqlChild = sqlChild.getNextException();
- }
-
- // Get the "unrolled" chain
- StringBuffer result = new StringBuffer(getSQLErrorMsg(mmEx));
- sqlChild = mmEx.getNextException();
- while ( sqlChild != null ) {
- result.append("|" + getSQLErrorMsg(sqlChild)); //$NON-NLS-1$
- sqlChild = sqlChild.getNextException();
- }
-
- assertEquals("Unexpected unroll result!\n", expectedResult.toString(), result.toString()); //$NON-NLS-1$
- }
-
- private static String getSQLErrorMsg(SQLException e) {
- StringBuffer buf = new StringBuffer(e.getMessage());
- buf.append("|" + e.getSQLState()); //$NON-NLS-1$
- buf.append("|" + e.getErrorCode()); //$NON-NLS-1$
- // DEBUG:
-// System.out.println("Emsg: " + buf.toString());
- return buf.toString();
- }
-
- private static SQLException helpTestRoll(int limit) {
- String sqlState = "confusion %^D"; //$NON-NLS-1$
- int vendorCode = -1;
-
- // Create a chain of SQLExceptions
- final SQLException e = new SQLException("Unroll 0", sqlState, vendorCode); //$NON-NLS-1$
-
- Random gen = new Random();
- for ( int i = 0; i < limit - 1; i++ ) {
- sqlState = String.valueOf(gen.nextDouble());
- vendorCode = gen.nextInt();
- SQLException e2 = null;
- if ( vendorCode % 2 == 0 ) {
- e2 = new SQLException("Unroll " + (i + 1), sqlState, vendorCode); //$NON-NLS-1$
- } else {
- // No SQLState (null) or vendorCode (0) should appear
- // in SQLException when vendorCode is odd.
- e2 = new SQLException("Unroll " + (i + 1)); //$NON-NLS-1$
- }
- e.setNextException(e2);
- }
-
- return e;
- }
-
- // ********* T E S T S U I T E M E T H O D S *********
-
- public void testUnroll_1() {
- // Create a SQLException
- final SQLException e = helpTestRoll(1);
-
- // Unroll the exception
- SQLException mmEx = SQLExceptionUnroller.unRollException(e);
-
- // Make sure they're the same.
- helpTestUnroll(e, mmEx);
- }
-
- public void testUnroll_10() {
- // Create a SQLException
- final SQLException e = helpTestRoll(10);
-
- // Unroll the exception
- SQLException mmEx = SQLExceptionUnroller.unRollException(e);
-
- // Make sure they're the same.
- helpTestUnroll(e, mmEx);
- }
-}
Modified: trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/ServerWorkItem.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/ServerWorkItem.java 2009-03-25 15:33:18 UTC (rev 652)
+++ trunk/server/src/main/java/com/metamatrix/common/comm/platform/socket/server/ServerWorkItem.java 2009-03-25 16:01:36 UTC (rev 653)
@@ -84,62 +84,51 @@
String service = null;
final boolean encrypt = message.getContents() instanceof SealedObject;
try {
- /* Defect 15211
- * If a CNFE occurred while deserializing the packet, the packet message should be a
- * MessageHolder containing the exception. Since we can no longer continue processing,
- * we should notify the client of the problem immediately.
- */
- if (message.getContents() instanceof Throwable) {
- LogManager.logWarning(SocketVMController.SOCKET_CONTEXT, (Throwable)message.getContents(),
- "Exception while deserializing message packet."); //$NON-NLS-1$
- result = message;
- } else {
- message.setContents(this.socketClientInstance.getCryptor().unsealObject(message.getContents()));
-
- if (!(message.getContents() instanceof ServiceInvocationStruct)) {
- throw new AssertionError("unknown message contents"); //$NON-NLS-1$
- }
- final ServiceInvocationStruct serviceStruct = (ServiceInvocationStruct)message.getContents();
- Object instance = server.getClientService(serviceStruct.targetClass);
- if (instance == null) {
- throw new ComponentNotFoundException(PlatformPlugin.Util.getString("ServerWorkItem.Component_Not_Found", serviceStruct.targetClass)); //$NON-NLS-1$
- }
- if (!(instance instanceof ILogon)) {
- DQPWorkContext workContext = this.socketClientInstance.getWorkContext();
- sessionService.validateSession(workContext.getSessionId());
- }
- service = serviceStruct.targetClass;
- ReflectionHelper helper = new ReflectionHelper(instance.getClass());
- Method m = helper.findBestMethodOnTarget(serviceStruct.methodName, serviceStruct.args);
- Object methodResult;
- try {
- methodResult = m.invoke(instance, serviceStruct.args);
- } catch (InvocationTargetException e) {
- throw e.getCause();
- }
- if (ResultsFuture.class.isAssignableFrom(m.getReturnType()) && methodResult != null) {
- ResultsFuture<Serializable> future = (ResultsFuture<Serializable>) methodResult;
- future.addCompletionListener(new ResultsFuture.CompletionListener<Serializable>() {
+ message.setContents(this.socketClientInstance.getCryptor().unsealObject(message.getContents()));
+
+ if (!(message.getContents() instanceof ServiceInvocationStruct)) {
+ throw new AssertionError("unknown message contents"); //$NON-NLS-1$
+ }
+ final ServiceInvocationStruct serviceStruct = (ServiceInvocationStruct)message.getContents();
+ Object instance = server.getClientService(serviceStruct.targetClass);
+ if (instance == null) {
+ throw new ComponentNotFoundException(PlatformPlugin.Util.getString("ServerWorkItem.Component_Not_Found", serviceStruct.targetClass)); //$NON-NLS-1$
+ }
+ if (!(instance instanceof ILogon)) {
+ DQPWorkContext workContext = this.socketClientInstance.getWorkContext();
+ sessionService.validateSession(workContext.getSessionId());
+ }
+ service = serviceStruct.targetClass;
+ ReflectionHelper helper = new ReflectionHelper(instance.getClass());
+ Method m = helper.findBestMethodOnTarget(serviceStruct.methodName, serviceStruct.args);
+ Object methodResult;
+ try {
+ methodResult = m.invoke(instance, serviceStruct.args);
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
+ if (ResultsFuture.class.isAssignableFrom(m.getReturnType()) && methodResult != null) {
+ ResultsFuture<Serializable> future = (ResultsFuture<Serializable>) methodResult;
+ future.addCompletionListener(new ResultsFuture.CompletionListener<Serializable>() {
- public void onCompletion(
- ResultsFuture<Serializable> completedFuture) {
- Message asynchResult = new Message();
- try {
- asynchResult.setContents(completedFuture.get());
- } catch (InterruptedException e) {
- asynchResult.setContents(processException(e, serviceStruct.targetClass));
- } catch (ExecutionException e) {
- asynchResult.setContents(processException(e.getCause(), serviceStruct.targetClass));
- }
- sendResult(asynchResult, encrypt);
+ public void onCompletion(
+ ResultsFuture<Serializable> completedFuture) {
+ Message asynchResult = new Message();
+ try {
+ asynchResult.setContents(completedFuture.get());
+ } catch (InterruptedException e) {
+ asynchResult.setContents(processException(e, serviceStruct.targetClass));
+ } catch (ExecutionException e) {
+ asynchResult.setContents(processException(e.getCause(), serviceStruct.targetClass));
}
+ sendResult(asynchResult, encrypt);
+ }
- });
- } else { // synch call
- Message resultHolder = new Message();
- resultHolder.setContents((Serializable)methodResult);
- result = resultHolder;
- }
+ });
+ } else { // synch call
+ Message resultHolder = new Message();
+ resultHolder.setContents((Serializable)methodResult);
+ result = resultHolder;
}
} catch (Throwable t) {
Message holder = new Message();
15 years, 9 months
teiid SVN: r652 - in branches/jdbc30-jdk15: client-jdbc and 1 other directory.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-03-25 11:33:18 -0400 (Wed, 25 Mar 2009)
New Revision: 652
Added:
branches/jdbc30-jdk15/client-jdbc/
Modified:
branches/jdbc30-jdk15/client-jdbc/pom.xml
Log:
Copied: branches/jdbc30-jdk15/client-jdbc (from rev 625, trunk/client-jdbc)
Property changes on: branches/jdbc30-jdk15/client-jdbc
___________________________________________________________________
Name: svn:ignore
+ .settings
.classpath
.project
target
Name: svn:mergeinfo
+
Modified: branches/jdbc30-jdk15/client-jdbc/pom.xml
===================================================================
--- trunk/client-jdbc/pom.xml 2009-03-23 21:08:59 UTC (rev 625)
+++ branches/jdbc30-jdk15/client-jdbc/pom.xml 2009-03-25 15:33:18 UTC (rev 652)
@@ -33,4 +33,20 @@
</dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <!-- Specify the compiler options and settings -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ <showDeprecation>false</showDeprecation>
+ <showWarnings>false</showWarnings>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
\ No newline at end of file
15 years, 9 months
teiid SVN: r651 - in branches/jdbc30-jdk15: client and 1 other directory.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-03-25 11:33:16 -0400 (Wed, 25 Mar 2009)
New Revision: 651
Added:
branches/jdbc30-jdk15/client/
Log:
Copied: branches/jdbc30-jdk15/client (from rev 625, trunk/client)
Property changes on: branches/jdbc30-jdk15/client
___________________________________________________________________
Name: svn:ignore
+ .classpath
.project
target
.settings
Name: svn:mergeinfo
+
15 years, 9 months
teiid SVN: r650 - in branches/jdbc30-jdk15: common-core and 1 other directory.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-03-25 11:33:15 -0400 (Wed, 25 Mar 2009)
New Revision: 650
Added:
branches/jdbc30-jdk15/common-core/
Log:
Copied: branches/jdbc30-jdk15/common-core (from rev 625, trunk/common-core)
Property changes on: branches/jdbc30-jdk15/common-core
___________________________________________________________________
Name: svn:ignore
+ target
.settings
.project
.classpath
Name: svn:mergeinfo
+
15 years, 9 months
teiid SVN: r649 - branches.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2009-03-25 11:33:13 -0400 (Wed, 25 Mar 2009)
New Revision: 649
Added:
branches/jdbc30-jdk15/
Log:
15 years, 9 months