teiid SVN: r2316 - trunk/engine/src/test/java/org/teiid/query/processor.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-06-28 15:12:13 -0400 (Mon, 28 Jun 2010)
New Revision: 2316
Modified:
trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java
Log:
TEIID-108 ensuring consistent (and correct) xsd type conversion.
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java 2010-06-28 17:35:22 UTC (rev 2315)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java 2010-06-28 19:12:13 UTC (rev 2316)
@@ -28,7 +28,9 @@
import java.sql.Timestamp;
import java.util.Arrays;
import java.util.List;
+import java.util.TimeZone;
+import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.teiid.api.exception.query.ExpressionEvaluationException;
@@ -36,6 +38,7 @@
import org.teiid.core.types.BlobType;
import org.teiid.core.types.InputStreamFactory;
import org.teiid.core.util.ObjectConverterUtil;
+import org.teiid.core.util.TimestampWithTimezone;
import org.teiid.core.util.UnitTestUtil;
import org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder;
import org.teiid.query.unittest.FakeMetadataFactory;
@@ -359,9 +362,14 @@
private static FakeDataManager dataManager = new FakeDataManager();
@BeforeClass public static void oneTimeSetUp() {
+ TimestampWithTimezone.resetCalendar(TimeZone.getTimeZone("GMT-06:00")); //$NON-NLS-1$
sampleData1(dataManager);
}
+ @AfterClass public static void oneTimeTearDown() {
+ TimestampWithTimezone.resetCalendar(null); //$NON-NLS-1$
+ }
+
private void process(String sql, List<?>[] expected) throws Exception {
ProcessorPlan plan = helpGetPlan(helpParse(sql), FakeMetadataFactory.example1Cached(), new DefaultCapabilitiesFinder(), createCommandContext());
14 years, 6 months
teiid SVN: r2315 - in branches/7.0.x: build/assembly and 2 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-06-28 13:35:22 -0400 (Mon, 28 Jun 2010)
New Revision: 2315
Modified:
branches/7.0.x/
branches/7.0.x/build/assembly/docs.xml
branches/7.0.x/build/assembly/jboss-container/dist.xml
branches/7.0.x/documentation/pom.xml
Log:
adding client developer's guide to 7.0
Property changes on: branches/7.0.x
___________________________________________________________________
Name: svn:ignore
- .classpath
.settings
target
.project
build.xml
+ .classpath
.settings
target
.project
build.xml
Legal_Notice.html
Modified: branches/7.0.x/build/assembly/docs.xml
===================================================================
--- branches/7.0.x/build/assembly/docs.xml 2010-06-28 17:02:11 UTC (rev 2314)
+++ branches/7.0.x/build/assembly/docs.xml 2010-06-28 17:35:22 UTC (rev 2315)
@@ -18,6 +18,7 @@
<include>org.jboss.teiid.documentation:reference</include>
<include>org.jboss.teiid.documentation:developer-guide</include>
<include>org.jboss.teiid.documentation:quick-start-example</include>
+ <include>org.jboss.teiid.documentation:client-developers-guide</include>
</includes>
<sources>
Modified: branches/7.0.x/build/assembly/jboss-container/dist.xml
===================================================================
--- branches/7.0.x/build/assembly/jboss-container/dist.xml 2010-06-28 17:02:11 UTC (rev 2314)
+++ branches/7.0.x/build/assembly/jboss-container/dist.xml 2010-06-28 17:35:22 UTC (rev 2315)
@@ -65,7 +65,7 @@
<outputDirectory>teiid-docs</outputDirectory>
</file>
<file>
- <source>target/distribution/teiid-${version}-docs/client-developer-guide/en-US/pdf/teiid_client_developers_guide.pdf</source>
+ <source>target/distribution/teiid-${version}-docs/client-developers-guide/en-US/pdf/teiid_client_developers_guide.pdf</source>
<outputDirectory>teiid-docs</outputDirectory>
</file>
</files>
Modified: branches/7.0.x/documentation/pom.xml
===================================================================
--- branches/7.0.x/documentation/pom.xml 2010-06-28 17:02:11 UTC (rev 2314)
+++ branches/7.0.x/documentation/pom.xml 2010-06-28 17:35:22 UTC (rev 2315)
@@ -16,6 +16,7 @@
<module>reference</module>
<module>developer-guide</module>
<module>quick-start-example</module>
+ <module>client-developers-guide</module>
</modules>
<!--<repositories>
<repository>
14 years, 6 months
teiid SVN: r2314 - in branches/7.0.x: documentation and 1 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-06-28 13:02:11 -0400 (Mon, 28 Jun 2010)
New Revision: 2314
Added:
branches/7.0.x/documentation/client-developers-guide/
Modified:
branches/7.0.x/build/assembly/jboss-container/dist.xml
branches/7.0.x/documentation/client-developers-guide/pom.xml
Log:
adding client developer's guide to 7.0
Modified: branches/7.0.x/build/assembly/jboss-container/dist.xml
===================================================================
--- branches/7.0.x/build/assembly/jboss-container/dist.xml 2010-06-28 16:55:37 UTC (rev 2313)
+++ branches/7.0.x/build/assembly/jboss-container/dist.xml 2010-06-28 17:02:11 UTC (rev 2314)
@@ -64,6 +64,10 @@
<source>target/distribution/teiid-${version}-docs/developer-guide/en-US/pdf/teiid_developer_guide.pdf</source>
<outputDirectory>teiid-docs</outputDirectory>
</file>
+ <file>
+ <source>target/distribution/teiid-${version}-docs/client-developer-guide/en-US/pdf/teiid_client_developers_guide.pdf</source>
+ <outputDirectory>teiid-docs</outputDirectory>
+ </file>
</files>
Copied: branches/7.0.x/documentation/client-developers-guide (from rev 2313, trunk/documentation/client-developers-guide)
Modified: branches/7.0.x/documentation/client-developers-guide/pom.xml
===================================================================
--- trunk/documentation/client-developers-guide/pom.xml 2010-06-28 16:55:37 UTC (rev 2313)
+++ branches/7.0.x/documentation/client-developers-guide/pom.xml 2010-06-28 17:02:11 UTC (rev 2314)
@@ -3,7 +3,7 @@
<parent>
<groupId>org.jboss.teiid</groupId>
<artifactId>documentation</artifactId>
- <version>7.1.0-SNAPSHOT</version>
+ <version>7.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>client-developers-guide</artifactId>
@@ -51,7 +51,7 @@
<format>
<formatName>pdf</formatName>
<stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
- <finalName>client_developers_guide.pdf</finalName>
+ <finalName>teiid_client_developers_guide.pdf</finalName>
</format>
<format>
<formatName>html_single</formatName>
14 years, 6 months
teiid SVN: r2313 - in trunk: client/src/main/java/org/teiid/jdbc and 8 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-06-28 12:55:37 -0400 (Mon, 28 Jun 2010)
New Revision: 2313
Added:
trunk/documentation/admin-guide/src/main/docbook/en-US/content/performance.xml
trunk/documentation/reference/src/main/docbook/en-US/content/entitlements.xml
Modified:
trunk/build/kits/jboss-container/teiid-releasenotes.html
trunk/client/src/main/java/org/teiid/jdbc/TeiidStatement.java
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/mysql/MySQLExecutionFactory.java
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java
trunk/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/execution/QueryExecutionImpl.java
trunk/documentation/admin-guide/src/main/docbook/en-US/content/security.xml
trunk/documentation/client-developers-guide/
trunk/documentation/reference/src/main/docbook/en-US/Reference.xml
trunk/documentation/reference/src/main/docbook/en-US/content/system_schema.xml
trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml
Log:
forward merge from 7.0
Modified: trunk/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- trunk/build/kits/jboss-container/teiid-releasenotes.html 2010-06-28 16:47:59 UTC (rev 2312)
+++ trunk/build/kits/jboss-container/teiid-releasenotes.html 2010-06-28 16:55:37 UTC (rev 2313)
@@ -95,8 +95,30 @@
<ul>
<li>Start time is now significantly longer due to the container deployment. However many operations can be performed on configruation files that will trigger a redeployment without the need for a restart.
<li>Parallel execution of source queries within a query plan has been temporarily disabled.
+ <li>Inversion of parse, format, and convert system functions is not used if it can be narrowing. In situations where a predicate has the form: parseTime(column, 'format') = {t 'time value'} may lead to reduced performance, since
+ the parseTime function cannot be pushed down. This should be addressed in future releases.
</ul>
+<h4>Salesforce as Source</h4>
+Before Salesforce is used in your data integration project, the below issues need to be resolved.
+<ul>
+ <li>Manually copy the following libraries from the JBOSS_HOME/client directory to the JBOSS_HOME/lib/endorsed directory, so that the JAX-WS 2.0 apis supported by JBossWS are used:
+ <ul>
+ <li>jbossws-native-saaj.jar</li>
+ <li>jbossws-native-jaxrpc.jar</li>
+ <li>jbossws-native-jaxws.jar</li>
+ <li>jbossws-native-jaxws-ext.jar</li>
+ </ul>
+ </li>
+ <li>There is issue with invoking "https" based URL with out specifying the either a keystore or truststore properties with JBoss remoting 2.5.1. Generally you do not need to specify the truststore as a anonymous truststore will be negotiated, however if you fail to supply the following system properties there will be a error message in the log (query will execute even with out the properties). Add these to JBOSS_INSTALL/bin/run.conf file under JAVA_OPTS
+ <ul>
+ <li>-Djava.net.ssl.keyStore=<path-to-truststore></li>
+ <li>-Djava.net.ssl.keyStoreType=<certificate-type></li>
+ <li>-Djava.net.ssl.keyStorePassword=<password></li>
+ </ul>
+ </li>
+</ul>
+
<h2><a name="LibraryUpdates">Thirdparty Library Updates</a></h2>
The following components have been updated:
Modified: trunk/client/src/main/java/org/teiid/jdbc/TeiidStatement.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/TeiidStatement.java 2010-06-28 16:47:59 UTC (rev 2312)
+++ trunk/client/src/main/java/org/teiid/jdbc/TeiidStatement.java 2010-06-28 16:55:37 UTC (rev 2313)
@@ -64,7 +64,7 @@
/**
* Obtain the query planner debug log from the last command
* executed on this Statement, if it was requested with
- * OPTION DEBUG. If no debug output was requested, this
+ * SHOWPLAN DEBUG. If no debug output was requested, this
* method will return null.
* @return Debug log or null if no log exists
*/
Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java 2010-06-28 16:47:59 UTC (rev 2312)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java 2010-06-28 16:55:37 UTC (rev 2313)
@@ -40,6 +40,7 @@
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
+import java.util.concurrent.atomic.AtomicBoolean;
import javax.sql.DataSource;
@@ -139,7 +140,7 @@
private boolean useCommentsInSourceQuery;
private String version;
- boolean initialConnection = true;
+ private AtomicBoolean initialConnection = new AtomicBoolean(true);
public JDBCExecutionFactory() {
setSupportsFullOuterJoins(true);
@@ -216,7 +217,7 @@
public ResultSetExecution createResultSetExecution(QueryExpression command, ExecutionContext executionContext, RuntimeMetadata metadata, Connection conn)
throws TranslatorException {
//TODO: This is not correct; this should be only called once for connection creation
- afterConnectionCreation(conn);
+ obtainedConnection(conn);
return new JDBCQueryExecution(command, conn, executionContext, this);
}
@@ -224,7 +225,7 @@
public ProcedureExecution createProcedureExecution(Call command, ExecutionContext executionContext, RuntimeMetadata metadata, Connection conn)
throws TranslatorException {
//TODO: This is not correct; this should be only called once for connection creation
- afterConnectionCreation(conn);
+ obtainedConnection(conn);
return new JDBCProcedureExecution(command, conn, executionContext, this);
}
@@ -232,7 +233,7 @@
public UpdateExecution createUpdateExecution(Command command, ExecutionContext executionContext, RuntimeMetadata metadata, Connection conn)
throws TranslatorException {
//TODO: This is not correct; this should be only called once for connection creation
- afterConnectionCreation(conn);
+ obtainedConnection(conn);
return new JDBCUpdateExecution(command, conn, executionContext, this);
}
@@ -989,12 +990,12 @@
* Called exactly once for this source.
* @param connection
*/
- protected void afterInitialConnectionCreation(Connection connection) {
+ protected void afterInitialConnectionObtained(Connection connection) {
// now dig some details about this driver/database for log.
try {
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = new StringBuffer(getClass().getSimpleName());
DatabaseMetaData dbmd = connection.getMetaData();
- sb.append("Commit=").append(connection.getAutoCommit()); //$NON-NLS-1$
+ sb.append(" Commit=").append(connection.getAutoCommit()); //$NON-NLS-1$
sb.append(";DatabaseProductName=").append(dbmd.getDatabaseProductName()); //$NON-NLS-1$
sb.append(";DatabaseProductVersion=").append(dbmd.getDatabaseProductVersion()); //$NON-NLS-1$
sb.append(";DriverMajorVersion=").append(dbmd.getDriverMajorVersion()); //$NON-NLS-1$
@@ -1012,19 +1013,13 @@
/**
* Provides a hook to call source specific logic when
- * a connection is created.
+ * a connection is obtained.
*
* defect request 13979 & 13978
*/
- public void afterConnectionCreation(Connection connection) {
- if (initialConnection) {
- synchronized (this) {
- if (!initialConnection) {
- return;
- }
- initialConnection = false;
- afterInitialConnectionCreation(connection);
- }
+ public void obtainedConnection(Connection connection) {
+ if (initialConnection.compareAndSet(true, false)) {
+ afterInitialConnectionObtained(connection);
}
}
Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/mysql/MySQLExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/mysql/MySQLExecutionFactory.java 2010-06-28 16:47:59 UTC (rev 2312)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/mysql/MySQLExecutionFactory.java 2010-06-28 16:55:37 UTC (rev 2313)
@@ -22,10 +22,7 @@
package org.teiid.translator.jdbc.mysql;
-import java.sql.Connection;
import java.sql.Date;
-import java.sql.SQLException;
-import java.sql.Statement;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.ArrayList;
@@ -33,11 +30,9 @@
import java.util.List;
import org.teiid.language.Function;
-import org.teiid.logging.LogConstants;
-import org.teiid.logging.LogManager;
+import org.teiid.translator.SourceSystemFunctions;
import org.teiid.translator.Translator;
import org.teiid.translator.TranslatorException;
-import org.teiid.translator.SourceSystemFunctions;
import org.teiid.translator.TypeFacility;
import org.teiid.translator.jdbc.ConvertModifier;
import org.teiid.translator.jdbc.FunctionModifier;
@@ -130,26 +125,6 @@
}
@Override
- public void afterConnectionCreation(Connection connection) {
- super.afterConnectionCreation(connection);
-
- Statement stmt = null;
- try {
- stmt = connection.createStatement();
- stmt.execute("set SESSION sql_mode = 'ANSI'"); //$NON-NLS-1$
- } catch (SQLException e) {
- LogManager.logError(LogConstants.CTX_CONNECTOR, e, "Error setting ANSI mode"); //$NON-NLS-1$
- } finally {
- if (stmt != null) {
- try {
- stmt.close();
- } catch (SQLException e) {
- LogManager.logDetail("Error closing statement", e); //$NON-NLS-1$
- }
- }
- }
- }
- @Override
public boolean useParensForJoins() {
return true;
}
Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java 2010-06-28 16:47:59 UTC (rev 2312)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java 2010-06-28 16:55:37 UTC (rev 2313)
@@ -24,11 +24,8 @@
*/
package org.teiid.translator.jdbc.oracle;
-import java.sql.Connection;
import java.sql.PreparedStatement;
-import java.sql.ResultSet;
import java.sql.SQLException;
-import java.sql.Statement;
import java.sql.Timestamp;
import java.sql.Types;
import java.util.ArrayList;
@@ -51,8 +48,6 @@
import org.teiid.language.SQLConstants.Tokens;
import org.teiid.language.SetQuery.Operation;
import org.teiid.language.visitor.CollectorVisitor;
-import org.teiid.logging.LogConstants;
-import org.teiid.logging.LogManager;
import org.teiid.metadata.Column;
import org.teiid.translator.ExecutionContext;
import org.teiid.translator.SourceSystemFunctions;
@@ -64,7 +59,6 @@
import org.teiid.translator.jdbc.ExtractFunctionModifier;
import org.teiid.translator.jdbc.FunctionModifier;
import org.teiid.translator.jdbc.JDBCExecutionFactory;
-import org.teiid.translator.jdbc.JDBCPlugin;
import org.teiid.translator.jdbc.LocateFunctionModifier;
@@ -395,41 +389,6 @@
}
@Override
- public void afterInitialConnectionCreation(Connection connection) {
- String errorStr = JDBCPlugin.Util.getString("ConnectionListener.failed_to_report_oracle_connection_details"); //$NON-NLS-1$
- ResultSet rs = null;
- Statement stmt = null;
- try {
- stmt = connection.createStatement();
- rs = stmt.executeQuery("select * from v$instance"); //$NON-NLS-1$
-
- int columnCount = rs.getMetaData().getColumnCount();
- while (rs.next()) {
- StringBuffer sb = new StringBuffer();
- for (int i = 1; i <= columnCount; i++) {
- sb.append(rs.getMetaData().getColumnName(i)).append("=").append(rs.getString(i)).append(";"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- // log the queried information
- LogManager.logInfo(LogConstants.CTX_CONNECTOR, sb.toString());
- }
-
- } catch (SQLException e) {
- LogManager.logInfo(LogConstants.CTX_CONNECTOR, errorStr);
- }finally {
- try {
- if (rs != null) {
- rs.close();
- }
- if (stmt != null) {
- stmt.close();
- }
- } catch (SQLException e1) {
- LogManager.logInfo(LogConstants.CTX_CONNECTOR, errorStr);
- }
- }
- }
-
- @Override
public NullOrder getDefaultNullOrder() {
return NullOrder.HIGH;
}
Modified: trunk/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/execution/QueryExecutionImpl.java
===================================================================
--- trunk/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/execution/QueryExecutionImpl.java 2010-06-28 16:47:59 UTC (rev 2312)
+++ trunk/connectors/translator-salesforce/src/main/java/org/teiid/translator/salesforce/execution/QueryExecutionImpl.java 2010-06-28 16:55:37 UTC (rev 2313)
@@ -114,14 +114,14 @@
@Override
public void execute() throws TranslatorException {
try {
- LogManager.logDetail(LogConstants.CTX_CONNECTOR, getLogPreamble() + "Incoming Query: " + query.toString()); //$NON-NLS-1$
+ LogManager.logDetail(LogConstants.CTX_CONNECTOR, getLogPreamble(), "Incoming Query:", query); //$NON-NLS-1$
List<TableReference> from = ((Select)query).getFrom();
String finalQuery;
if(from.get(0) instanceof Join) {
visitor = new JoinQueryVisitor(metadata);
visitor.visitNode(query);
finalQuery = visitor.getQuery().trim();
- LogManager.logDetail(LogConstants.CTX_CONNECTOR, getLogPreamble() + "Executing Query: " + finalQuery); //$NON-NLS-1$
+ LogManager.logDetail(LogConstants.CTX_CONNECTOR, getLogPreamble(), "Executing Query:", finalQuery); //$NON-NLS-1$
results = connection.query(finalQuery, this.context.getBatchSize(), visitor.getQueryAll());
} else {
@@ -132,7 +132,7 @@
visitor.getTableName(), visitor.getIdInCriteria());
} else {
finalQuery = visitor.getQuery().trim();
- LogManager.logDetail(LogConstants.CTX_CONNECTOR, getLogPreamble() + "Executing Query: " + finalQuery); //$NON-NLS-1$
+ LogManager.logDetail(LogConstants.CTX_CONNECTOR, getLogPreamble(), "Executing Query:", finalQuery); //$NON-NLS-1$
results = connection.query(finalQuery, this.context.getBatchSize(), visitor.getQueryAll());
}
}
@@ -147,6 +147,9 @@
List<?> result;
if (query.getProjectedQuery().getDerivedColumns().get(0)
.getExpression() instanceof AggregateFunction) {
+ if (results == null) {
+ return null;
+ }
result = Arrays.asList(results.getSize());
results = null;
Copied: trunk/documentation/admin-guide/src/main/docbook/en-US/content/performance.xml (from rev 2311, branches/7.0.x/documentation/admin-guide/src/main/docbook/en-US/content/performance.xml)
===================================================================
--- trunk/documentation/admin-guide/src/main/docbook/en-US/content/performance.xml (rev 0)
+++ trunk/documentation/admin-guide/src/main/docbook/en-US/content/performance.xml 2010-06-28 16:55:37 UTC (rev 2313)
@@ -0,0 +1,28 @@
+<!--
+TODO: incorporate a performance chapter.
+
+The information about document materialization belongs in the reference though. And is not completely correct
+w.r.t. the use of document projection.
+
+ <para>Your application can use a statement object to execute queries that return XML documents.
+ The query must specify a valid document in VDB, or should have used SQL XML functions
+ to create a XMl document.</para>
+ <sect3>
+ <title>XML Streaming</title>
+ <para>XML documents are streamed from Teiid Server to the Teiid JDBC API.
+ Normally, the document never materializes in the server memory, avoiding potential
+ out-of-memory issues and improving the first response time for large documents.
+ When using style sheets, or XQuery, the whole document
+ must be materialized on the server. Therefore memory issues may occur for large documents.
+ A result document can be obtained from the JDBC resultset using <code>getSQLXML</code> method.
+ </para>
+ <para>The document is broken into pieces when being created and streamed.
+ The maximum size of each piece in the stream can be configured with the
+ <code>"lobChunkSizeInKB"</code> system property on the Server. The default value is 100 KB.
+ At any given time, this is the maximum amount of memory that can be held by a particular
+ XML query against the system. In heavily loaded or memory-constrained scenarios,
+ this value can decrease the amount of memory used. As a side effect, streaming will occur in smaller pieces, reducing initial document response time while
+ increasing full response time (as this is less efficient).</para>
+ </sect3>
+
+ -->
\ No newline at end of file
Modified: trunk/documentation/admin-guide/src/main/docbook/en-US/content/security.xml
===================================================================
--- trunk/documentation/admin-guide/src/main/docbook/en-US/content/security.xml 2010-06-28 16:47:59 UTC (rev 2312)
+++ trunk/documentation/admin-guide/src/main/docbook/en-US/content/security.xml 2010-06-28 16:55:37 UTC (rev 2313)
@@ -3,7 +3,7 @@
<chapter id="custom_security">
<title>Teiid Security</title>
<para>The Teiid system provides a range of built-in and extensible security features to enable the
- secure access of data. </para>
+ secure access of data.</para>
<sect1>
<title>Authentication</title>
<para>JDBC clients may use simple passwords to authenticate a user.</para>
@@ -11,6 +11,13 @@
identity of the user can be discerned by the password credential alone. In
any case it is up to the configured security domain to determine whether a user can be
authenticated.</para>
+
+ <note><para>By default, access to Teiid is NOT secure. The default login modules are only
+ backed by file based authentication, which has a well known user
+ name and password.
+ The same is true for making connections to the Admin Console application.
+ We DO NOT recommend leaving the default security profile as defined when you
+ are exposing sensitive data.</para></note>
</sect1>
<sect1>
<title>Authorization</title>
@@ -59,6 +66,14 @@
Details of the failed attempt including invalid users, which
domains were consulted, etc. will be in the server log with appropriate
levels of severity.</para>
+ <note>
+ <para>The security-domain defined for the JDBC connection and Admin connections are separate.
+ The default name of JDBC connection's security-domain is "teiid-security". The default name for Admin connection
+ is "jmx-console". For the Admin connection's security domain, the user is allowed
+ to change which LoginModule that "jmx-console" pointing to, however should not change the name of the domain, as this name is
+ shared between the "admin-console" application.</para>
+ </note>
+
<sect2>
<title>Built-in LoginModules</title>
<para>JBossAS provides several LoginModules for common authentication needs, such as authenticating from text files or LDAP.</para>
@@ -71,12 +86,52 @@
If you want use a your own Custom Login module, check out the Developer's Guide for instructions.
</para>
</sect2>
+
</sect1>
- <note>
- <para>The security-domain defined for the JDBC connection and Admin connections are separate.
- The default name of JDBC connection's security-domain is "teiid-security". The default name for Admin connection
- is "jmx-console". For the Admin connection's security domain, the user is allowed
- to change which LoginModule that "jmx-console" pointing to, however should not change the name of the domain, as this name is
- shared between the "admin-console" application.</para>
- </note>
+
+ <sect1 id="connfigure_server">
+ <title>Configuring SSL</title>
+ <para>The Teiid's configuration file
+ <code><jboss-install>/server/<profile>/deploy/teiid/teiid-jboss-beans.xml</code>,
+ contains the properties to configure SSL.</para>
+ <itemizedlist>
+ <para>There are two separate connection profiles:</para>
+ <listitem><para>JDBC Connection - The <code>JdbcSslConfiguration</code> bean configuration defines this.</para></listitem>
+ <listitem><para>Admin Connection - The <code>AdminSslConfiguration</code> bean configuration defines this.</para></listitem>
+ </itemizedlist>
+ <example><title>Example Configuration</title>
+ <programlisting><![CDATA[<bean name="JdbcSslConfiguration" class="org.teiid.transport.SSLConfiguration">
+ <property name="sslEnabled">false</property>
+ <property name="keystoreFilename">cert.keystore</property>
+ <property name="keystorePassword">passwd</property>
+ <property name="keystoreType">JKS</property>
+ <property name="sslProtocol">SSLv3</property>
+ <property name="keymanagementAlgorithm">false</property>
+ <property name="truststoreFilename">cert.truststore</property>
+ <property name="truststorePassword">passwd</property>
+ <!-- 1-way, 2-way, anonymous -->
+ <property name="authenticationMode">1-way</property>
+ <property name="clientEncryptionEnabled">true</property>
+</bean>]]></programlisting>
+</example>
+ <orderedlist>
+ <title>Properties</title>
+ <listitem><para>sslEnabled - true|false, SSL usage either turned ON or OFF </para></listitem>
+ <listitem><para>sslProtocol- Type of SSL protocol to be used. Default is SSLv3</para></listitem>
+ <listitem><para>keystoreType - Keystore type created by the keytool. Default "JKS" is used.</para></listitem>
+ <listitem><para>authenticationMode - anonymous|1-way|2-way, Type of SSL mode, see
+ above about different <link linkend="ssl_modes">SSL modes</link> available.</para></listitem>
+ <listitem><para>keymanagementAlgorithm - Type of key algorithm used. Default
+ is based upon the VM, e.g. "SunX509"</para></listitem>
+ <listitem><para>keystoreFilename - The file name of the keystore, which contains the
+ private key of the Server. This must be available in the classpath of Teiid Server</para></listitem>
+ <listitem><para>keystorePassword - password for the keystore.</para></listitem>
+ <listitem><para>truststoreFilename - if "authenticationMode" is chosen
+ as "2-way", then this property must be provided. This is the truststore that contains the
+ public key for the client. Depending upon how you created the keystore and truststores,
+ this may be same file as defined under "keystoreFilename" property.</para></listitem>
+ <listitem><para>truststorePassword - password for the truststore. </para></listitem>
+ </orderedlist>
+
+ </sect1>
</chapter>
\ No newline at end of file
Property changes on: trunk/documentation/client-developers-guide
___________________________________________________________________
Name: svn:ignore
- target
.project
.settings
.classpath
+ target
.project
.settings
.classpath
Legal_Notice.html
Modified: trunk/documentation/reference/src/main/docbook/en-US/Reference.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/Reference.xml 2010-06-28 16:47:59 UTC (rev 2312)
+++ trunk/documentation/reference/src/main/docbook/en-US/Reference.xml 2010-06-28 16:55:37 UTC (rev 2313)
@@ -53,6 +53,7 @@
<xi:include href="content/scalar_functions.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="content/procedures.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="content/transaction_support.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="content/entitlements.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="content/system_schema.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="content/translators.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="content/federated_planning.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
Copied: trunk/documentation/reference/src/main/docbook/en-US/content/entitlements.xml (from rev 2311, branches/7.0.x/documentation/reference/src/main/docbook/en-US/content/entitlements.xml)
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/entitlements.xml (rev 0)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/entitlements.xml 2010-06-28 16:55:37 UTC (rev 2313)
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % CustomDTD SYSTEM "../../../../../../docbook/custom.dtd">
+%CustomDTD;
+]>
+<chapter id="entitlements">
+ <title>Data Roles</title>
+ <para>Data roles, also called entitlements, are sets of permissions that are defined
+ per VDB that dictate data access (create, read, update, delete). The use of data roles is controlled system wide with the property in
+ <code><jboss-install>/server/<profile>/deploy/teiid/teiid-jboss-beans.xml</code> file
+ in bean configuration section of <code>RuntimeEngineDeployer</code> with property <code>useEntitlements</code>.</para>
+
+ <para>Once data roles are enabled, the access permissions defined in a VDB will be enforced by the Teiid Server.</para>
+
+ <sect1>
+ <title>Permissions</title>
+ <orderedlist>
+ <para>To process a <code>SELECT</code> statement or a stored procedure execution, the user account requires the following access rights:</para>
+ <listitem> <para><code>READ</code> - on the Table(s) being accessed or the procedure being called.</para></listitem>
+ <listitem> <para><code>READ</code> - on every column referenced.</para></listitem>
+ </orderedlist>
+
+ <orderedlist>
+ <para>To process an <code>INSERT</code> statement, the user account requires the following access rights:</para>
+ <listitem> <para><code>CREATE</code> - on the Table being inserted into.</para></listitem>
+ <listitem> <para><code>CREATE</code> - on every column being inserted on that Table.</para></listitem>
+ </orderedlist>
+
+ <orderedlist>
+ <para>To process an <code>UPDATE</code> statement, the user account requires the following access rights:</para>
+ <listitem> <para><code>UPDATE</code> - on the Table being updated.</para></listitem>
+ <listitem> <para><code>UPDATE</code> - on every column being updated on that Table.</para></listitem>
+ <listitem> <para><code>READ</code> - on every column referenced in the criteria.</para></listitem>
+ </orderedlist>
+
+ <orderedlist>
+ <para>To process a <code>DELETE</code> statement, the user account requires the following access rights:</para>
+ <listitem> <para><code>DELETE</code> - on the Table being deleted.</para></listitem>
+ <listitem> <para><code>READ</code> - on every column referenced in the criteria.</para></listitem>
+ </orderedlist>
+ </sect1>
+
+ <sect1>
+ <title>XML Definition</title>
+ <para>Data roles are defined inside the <code>vdb.xml</code> file (inside the .vdb Zip archive under META-INF/vdb.xml) if you used Designer.
+ This example will show a sample "vdb.xml" file with few simple data rules.</para>
+
+ <para>For example, if a VDB defines a table "TableA" in schema "modelName" with columns (column1, column2) - note that the column types do not matter. And we wish to define three roles "RoleA", "RoleB", "RoleC" with following permissions:
+ <orderedlist>
+ <listitem><para>RoleA has privileges to read, write access to TableA, but can not delete.</para></listitem>
+ <listitem><para>RoleB has no privileges that allow access to TableA</para></listitem>
+ <listitem><para>RoleC has privileges that only allow read access to TableA.column1</para></listitem>
+ </orderedlist>
+ </para>
+ <example><title>vdb.xml defining RoleA, RoleB, and RoleC</title>
+ <programlisting><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
+<vdb name="sample" version="1">
+
+ <model name="modelName">
+ <source name="source-name" translator-name="oracle" connection-jndi-name="java:myDS" />
+ </model>
+
+ <data-policy name="RoleA">
+ <description>Allow all, except Delete</description>
+
+ <permission>
+ <resource-name>modelName.TableA</resource-name>
+ <allow-create />
+ <allow-read />
+ <allow-update />
+ </permission>
+
+ <permission>
+ <resource-name>modelName.TableA.colum1</resource-name>
+ <allow-create />
+ <allow-read />
+ <allow-update />
+ </permission>
+
+ <permission>
+ <resource-name>modelName.TableA.column2</resource-name>
+ <allow-create />
+ <allow-read />
+ <allow-update />
+ </permission>
+
+ <mapped-role-name>role1</mapped-role-name>
+
+ </data-policy>
+
+ <data-policy name="RoleC">
+ <description>Allow read only</description>
+
+ <permission>
+ <resource-name>modelName.TableA</resource-name>
+ <allow-read />
+ </permission>
+
+ <permission>
+ <resource-name>modelName.TableA.colum1</resource-name>
+ <allow-read />
+ </permission>
+
+ <mapped-role-name>role2</mapped-role-name>
+ </data-policy>
+</vdb>]]></programlisting>
+</example>
+ <para>The above XML defined two data roles, "RoleA" which allows everything except delete on the table, "RoleC" that
+ allows only read operation on the table. Since Teiid uses deny by default, there is no explict data-policy entry needed for "RoleB". The "mapped-role-name" defines the "role" to whom these policies are applicable. Each data-policy
+ must define a "role" to be enforced by the Teiid Server.</para>
+
+ <para>For assigning the roles to your users, in the JBoss AS,
+ check out the instructions for the selected Login Module. Check "Admin Guide" for configuring Login Modules.</para>
+
+ <para>"vdb.xml" file is checked against the schema file <code>vdb-deployer.xsd</code>, check the documents sections of the Teiid kit
+ to find a copy of the schema file.</para>
+
+ <note><para>Currently there is no GUI tooling support in the Designer or any other management tool to create this data roles
+ permissions xml, however this is in our roadmap for future releases to provide.</para></note>
+ </sect1>
+
+</chapter>
\ No newline at end of file
Modified: trunk/documentation/reference/src/main/docbook/en-US/content/system_schema.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/system_schema.xml 2010-06-28 16:47:59 UTC (rev 2312)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/system_schema.xml 2010-06-28 16:55:37 UTC (rev 2313)
@@ -1518,7 +1518,7 @@
<para>getCharacterVDBResource</para>
</entry>
<entry>
- <para>(string resourcePath)/para>
+ <para>(string resourcePath)</para>
</entry>
<entry>
<para>A single column containing the resource as a clob.</para>
@@ -1551,7 +1551,7 @@
<para>getXMLSchemas</para>
</entry>
<entry>
- <para>string document</para>
+ <para>(string document)</para>
</entry>
<entry>
<para>A single column containing the schemas as clobs.</para>
Modified: trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml 2010-06-28 16:47:59 UTC (rev 2312)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml 2010-06-28 16:55:37 UTC (rev 2313)
@@ -137,12 +137,9 @@
<para><emphasis>metamatrix</emphasis> - for use with MetaMatrix 5.5.0 or later.</para>
</listitem>
<listitem>
-<para><emphasis>mysql</emphasis> - for use with MySQL version 4.x.</para>
+<para><emphasis>mysql</emphasis>/<emphasis>mysql5</emphasis> - for use with MySQL version 4.x and 5 or later respectively. <note>The MySQL Translators expect the database or session to be using ANSI mode. If the database is not using ANSI mode, an initialization query should be used on the pool to set ANSI mode: <programlisting>set SESSION sql_mode = 'ANSI'</programlisting></note></para>
</listitem>
<listitem>
-<para><emphasis>mysql5</emphasis> - for use with MySQL version 5 or later.</para>
-</listitem>
-<listitem>
<para><emphasis>oracle</emphasis> - for use with Oracle 9i or later. Sequences may be used with the Oracle translator.
A sequence may be modeled as a table with a name in source of DUAL and columns with the name in source set to <sequencesequence name>.[nextval|currentval].
You can use a sequence as the default value for insert columns by setting the column to autoincrement and the name in source to <element name>:SEQUENCE=<sequence name>.<sequence value>.</para>
14 years, 6 months
teiid SVN: r2312 - branches/7.0.x/documentation.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-06-28 12:47:59 -0400 (Mon, 28 Jun 2010)
New Revision: 2312
Removed:
branches/7.0.x/documentation/client-developers-guide/
Log:
replacing client guide with the one from 7.1
14 years, 6 months
teiid SVN: r2311 - branches/7.0.x/build/kits/jboss-container.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-06-28 12:28:16 -0400 (Mon, 28 Jun 2010)
New Revision: 2311
Modified:
branches/7.0.x/build/kits/jboss-container/teiid-releasenotes.html
Log:
updating the release notes with the parse/format inversion issue
Modified: branches/7.0.x/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- branches/7.0.x/build/kits/jboss-container/teiid-releasenotes.html 2010-06-28 16:14:55 UTC (rev 2310)
+++ branches/7.0.x/build/kits/jboss-container/teiid-releasenotes.html 2010-06-28 16:28:16 UTC (rev 2311)
@@ -95,6 +95,8 @@
<ul>
<li>Start time is now significantly longer due to the container deployment. However many operations can be performed on configruation files that will trigger a redeployment without the need for a restart.
<li>Parallel execution of source queries within a query plan has been temporarily disabled.
+ <li>Inversion of parse, format, and convert system functions is not used if it can be narrowing. In situations where a predicate has the form: parseTime(column, 'format') = {t 'time value'} may lead to reduced performance, since
+ the parseTime function cannot be pushed down. This should be addressed in future releases.
</ul>
<h4>Salesforce as Source</h4>
14 years, 6 months
teiid SVN: r2310 - in trunk: engine/src/main/java/org/teiid/query/function/source and 10 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-06-28 12:14:55 -0400 (Mon, 28 Jun 2010)
New Revision: 2310
Modified:
trunk/engine/src/main/java/org/teiid/query/function/FunctionDescriptor.java
trunk/engine/src/main/java/org/teiid/query/function/source/XMLSystemFunctions.java
trunk/engine/src/main/java/org/teiid/query/processor/relational/XMLTableNode.java
trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLValueTranslator.java
trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
trunk/engine/src/main/java/org/teiid/query/xquery/saxon/SaxonXQueryExpression.java
trunk/engine/src/main/resources/org/teiid/query/i18n.properties
trunk/engine/src/test/java/org/teiid/query/function/source/TestXMLSystemFunctions.java
trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java
trunk/engine/src/test/java/org/teiid/query/processor/xml/TestXMLValueTranslator.java
trunk/runtime/src/main/java/org/teiid/transport/ObjectEncoder.java
trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestXMLTypeTranslations.java
Log:
TEIID-108 ensuring consistent (and correct) xsd type conversion.
Modified: trunk/engine/src/main/java/org/teiid/query/function/FunctionDescriptor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/function/FunctionDescriptor.java 2010-06-28 14:47:10 UTC (rev 2309)
+++ trunk/engine/src/main/java/org/teiid/query/function/FunctionDescriptor.java 2010-06-28 16:14:55 UTC (rev 2310)
@@ -252,28 +252,9 @@
values = newValues;
}
Object result = method.invoke(null, values);
- if (!ALLOW_NAN_INFINITY) {
- if (result instanceof Double) {
- Double floatVal = (Double)result;
- if (Double.isInfinite(floatVal) || Double.isNaN(floatVal)) {
- throw new FunctionExecutionException(new ArithmeticException("Infinite or invalid result"), ErrorMessageKeys.FUNCTION_0003, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0003, getName())); //$NON-NLS-1$
- }
- } else if (result instanceof Float) {
- Float floatVal = (Float)result;
- if (Float.isInfinite(floatVal) || Float.isNaN(floatVal)) {
- throw new FunctionExecutionException(new ArithmeticException("Infinite or invalid result"), ErrorMessageKeys.FUNCTION_0003, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0003, getName())); //$NON-NLS-1$
- }
- }
- }
- result = DataTypeManager.convertToRuntimeType(result);
- result = DataTypeManager.transformValue(result, getReturnType());
- if (result instanceof String) {
- String s = (String)result;
- if (s.length() > DataTypeManager.MAX_STRING_LENGTH) {
- return s.substring(0, DataTypeManager.MAX_STRING_LENGTH);
- }
- }
- return result;
+ return importValue(result, getReturnType());
+ } catch(ArithmeticException e) {
+ throw new FunctionExecutionException(e, ErrorMessageKeys.FUNCTION_0003, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0003, getName()));
} catch(InvocationTargetException e) {
throw new FunctionExecutionException(e.getTargetException(), ErrorMessageKeys.FUNCTION_0003, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0003, getName()));
} catch(IllegalAccessException e) {
@@ -281,5 +262,31 @@
} catch (TransformationException e) {
throw new FunctionExecutionException(e, e.getMessage());
}
+ }
+
+ public static Object importValue(Object result, Class<?> expectedType)
+ throws ArithmeticException, TransformationException {
+ if (!ALLOW_NAN_INFINITY) {
+ if (result instanceof Double) {
+ Double floatVal = (Double)result;
+ if (Double.isInfinite(floatVal) || Double.isNaN(floatVal)) {
+ throw new ArithmeticException("Infinite or invalid result"); //$NON-NLS-1$
+ }
+ } else if (result instanceof Float) {
+ Float floatVal = (Float)result;
+ if (Float.isInfinite(floatVal) || Float.isNaN(floatVal)) {
+ throw new ArithmeticException("Infinite or invalid result"); //$NON-NLS-1$
+ }
+ }
+ }
+ result = DataTypeManager.convertToRuntimeType(result);
+ result = DataTypeManager.transformValue(result, expectedType);
+ if (result instanceof String) {
+ String s = (String)result;
+ if (s.length() > DataTypeManager.MAX_STRING_LENGTH) {
+ return s.substring(0, DataTypeManager.MAX_STRING_LENGTH);
+ }
+ }
+ return result;
}
}
Modified: trunk/engine/src/main/java/org/teiid/query/function/source/XMLSystemFunctions.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/function/source/XMLSystemFunctions.java 2010-06-28 14:47:10 UTC (rev 2309)
+++ trunk/engine/src/main/java/org/teiid/query/function/source/XMLSystemFunctions.java 2010-06-28 16:14:55 UTC (rev 2310)
@@ -30,10 +30,11 @@
import java.nio.CharBuffer;
import java.sql.Blob;
import java.sql.Clob;
+import java.sql.Date;
import java.sql.SQLException;
import java.sql.SQLXML;
+import java.sql.Time;
import java.sql.Timestamp;
-import java.util.Calendar;
import java.util.Collections;
import java.util.List;
@@ -56,26 +57,28 @@
import javax.xml.transform.stream.StreamSource;
import javax.xml.xpath.XPathExpressionException;
+import net.sf.saxon.expr.JPConverter;
import net.sf.saxon.om.Item;
import net.sf.saxon.om.Name11Checker;
import net.sf.saxon.sxpath.XPathEvaluator;
import net.sf.saxon.sxpath.XPathExpression;
import net.sf.saxon.trans.XPathException;
+import net.sf.saxon.value.AtomicValue;
+import net.sf.saxon.value.DateTimeValue;
+import net.sf.saxon.value.DateValue;
+import net.sf.saxon.value.DayTimeDurationValue;
+import net.sf.saxon.value.TimeValue;
-import org.teiid.api.exception.query.FunctionExecutionException;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
import org.teiid.core.types.ClobImpl;
import org.teiid.core.types.ClobType;
-import org.teiid.core.types.DataTypeManager;
import org.teiid.core.types.SQLXMLImpl;
-import org.teiid.core.types.TransformationException;
import org.teiid.core.types.XMLTranslator;
import org.teiid.core.types.XMLType;
import org.teiid.core.types.XMLType.Type;
import org.teiid.query.eval.Evaluator;
import org.teiid.query.function.CharsetUtils;
-import org.teiid.query.function.FunctionMethods;
import org.teiid.query.processor.xml.XMLUtil;
import org.teiid.query.util.CommandContext;
import org.teiid.translator.WSConnection.Util;
@@ -89,21 +92,7 @@
public class XMLSystemFunctions {
private static final String P_OUTPUT_VALIDATE_STRUCTURE = "com.ctc.wstx.outputValidateStructure"; //$NON-NLS-1$
- //YEAR 0 in the server timezone. used to determine negative years
- public static long YEAR_ZERO;
- static String DATETIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss"; //$NON-NLS-1$
- static String TIMESTAMP_MICROZEROS = "000000000"; //$NON-NLS-1$
-
- static {
- Calendar cal = Calendar.getInstance();
-
- for (int i = 0; i <= Calendar.MILLISECOND; i++) {
- cal.set(i, 0);
- }
- YEAR_ZERO = cal.getTimeInMillis();
- }
-
public static ClobType xslTransform(CommandContext context, Object xml, Object styleSheet) throws Exception {
Source styleSource = null;
Source xmlSource = null;
@@ -219,7 +208,7 @@
if (attributes != null) {
for (Evaluator.NameValuePair<?> nameValuePair : attributes) {
if (nameValuePair.value != null) {
- eventWriter.add(eventFactory.createAttribute(new QName(nameValuePair.name), getStringValue(nameValuePair.value)));
+ eventWriter.add(eventFactory.createAttribute(new QName(nameValuePair.name), convertToAtomicValue(nameValuePair.value).getStringValue()));
}
}
}
@@ -299,19 +288,22 @@
return result;
}
- static String getStringValue(Object object) throws TransformerException {
- if (object instanceof Timestamp) {
- try {
- return timestampToDateTime((Timestamp)object);
- } catch (FunctionExecutionException e) {
- throw new TransformerException(e);
- }
- }
- try {
- return DataTypeManager.transformValue(object, DataTypeManager.DefaultDataClasses.STRING);
- } catch (TransformationException e) {
- throw new TransformerException(e);
- }
+ public static AtomicValue convertToAtomicValue(Object value) throws TransformerException {
+ if (value instanceof java.util.Date) { //special handling for time types
+ java.util.Date d = (java.util.Date)value;
+ DateTimeValue tdv = DateTimeValue.fromJavaDate(d);
+ if (value instanceof Date) {
+ value = new DateValue(tdv.getYear(), tdv.getMonth(), tdv.getDay(), tdv.getTimezoneInMinutes());
+ } else if (value instanceof Time) {
+ value = new TimeValue(tdv.getHour(), tdv.getMinute(), tdv.getSecond(), tdv.getMicrosecond(), tdv.getTimezoneInMinutes());
+ } else if (value instanceof Timestamp) {
+ Timestamp ts = (Timestamp)value;
+ value = tdv.add(DayTimeDurationValue.fromMicroseconds(ts.getNanos() / 1000));
+ }
+ return (AtomicValue)value;
+ }
+ JPConverter converter = JPConverter.allocate(value.getClass(), null);
+ return (AtomicValue)converter.convert(value, null);
}
static void convertValue(Writer writer, XMLEventWriter eventWriter, XMLEventFactory eventFactory, Object object) throws IOException,
@@ -332,7 +324,7 @@
r = clob.getCharacterStream();
convertReader(writer, eventWriter, r, Type.TEXT);
} else {
- String val = getStringValue(object);
+ String val = convertToAtomicValue(object).getStringValue();
eventWriter.add(eventFactory.createCharacters(val));
}
} catch (SQLException e) {
@@ -391,44 +383,6 @@
return new XMLType(new SQLXMLImpl("<!--" + comment + "-->")); //$NON-NLS-1$ //$NON-NLS-2$
}
- /**
- * Formats a timestamp to an xs:dateTime. This uses DATETIME_FORMAT
- * with a trailing string for nanoseconds (without right zeros).
- */
- public static String timestampToDateTime(Timestamp time) throws FunctionExecutionException {
- String result = FunctionMethods.format(time, DATETIME_FORMAT);
- int nanos = time.getNanos();
- if (nanos == 0) {
- return result;
- }
-
- StringBuffer resultBuffer = new StringBuffer();
- boolean first = true;
- int i = 0;
- for (; i < 9 && nanos > 0; i++) {
- int digit = nanos%10;
- if (first) {
- if (digit > 0) {
- resultBuffer.insert(0, digit);
- first = false;
- }
- } else {
- resultBuffer.insert(0, digit);
- }
- nanos /= 10;
- }
- if (i < 9) {
- resultBuffer.insert(0, TIMESTAMP_MICROZEROS.substring(i));
- }
- resultBuffer.insert(0, "."); //$NON-NLS-1$
- resultBuffer.insert(0, result);
- if (time.getTime() < YEAR_ZERO) {
- resultBuffer.insert(0, "-"); //$NON-NLS-1$
- }
- return resultBuffer.toString();
-
- }
-
public static Source convertToSource(Object value) throws TeiidProcessingException {
if (value == null) {
return null;
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/XMLTableNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/XMLTableNode.java 2010-06-28 14:47:10 UTC (rev 2309)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/XMLTableNode.java 2010-06-28 16:14:55 UTC (rev 2310)
@@ -24,13 +24,19 @@
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import net.sf.saxon.om.Item;
import net.sf.saxon.om.SequenceIterator;
import net.sf.saxon.sxpath.XPathDynamicContext;
import net.sf.saxon.sxpath.XPathExpression;
import net.sf.saxon.trans.XPathException;
+import net.sf.saxon.type.BuiltInAtomicType;
+import net.sf.saxon.type.ConversionResult;
+import net.sf.saxon.value.AtomicValue;
+import net.sf.saxon.value.StringValue;
import net.sf.saxon.value.Value;
import org.teiid.api.exception.query.ExpressionEvaluationException;
@@ -41,6 +47,7 @@
import org.teiid.core.types.DataTypeManager;
import org.teiid.core.types.XMLType;
import org.teiid.query.execution.QueryExecPlugin;
+import org.teiid.query.function.FunctionDescriptor;
import org.teiid.query.sql.lang.XMLTable;
import org.teiid.query.sql.lang.XMLTable.XMLColumn;
@@ -49,6 +56,16 @@
*/
public class XMLTableNode extends SubqueryAwareRelationalNode {
+ private static Map<Class<?>, BuiltInAtomicType> typeMapping = new HashMap<Class<?>, BuiltInAtomicType>();
+
+ static {
+ typeMapping.put(DataTypeManager.DefaultDataClasses.TIMESTAMP, BuiltInAtomicType.DATE_TIME);
+ typeMapping.put(DataTypeManager.DefaultDataClasses.TIME, BuiltInAtomicType.TIME);
+ typeMapping.put(DataTypeManager.DefaultDataClasses.DATE, BuiltInAtomicType.DATE);
+ typeMapping.put(DataTypeManager.DefaultDataClasses.FLOAT, BuiltInAtomicType.FLOAT);
+ typeMapping.put(DataTypeManager.DefaultDataClasses.DOUBLE, BuiltInAtomicType.DOUBLE);
+ }
+
private XMLTable table;
private List<XMLColumn> projectedColumns;
@@ -151,10 +168,20 @@
}
Object value = Value.convertToJava(colItem);
if (value instanceof Item) {
- value = ((Item)value).getStringValue();
+ Item i = (Item)value;
+ BuiltInAtomicType bat = typeMapping.get(proColumn.getSymbol().getType());
+ if (bat != null) {
+ ConversionResult cr = StringValue.convertStringToBuiltInType(i.getStringValueCS(), bat, null);
+ value = cr.asAtomic();
+ value = Value.convertToJava((AtomicValue)value);
+ if (value instanceof Item) {
+ value = ((Item)value).getStringValue();
+ }
+ } else {
+ value = i.getStringValue();
+ }
}
- value = DataTypeManager.convertToRuntimeType(value);
- value = DataTypeManager.transformValue(value, proColumn.getSymbol().getType());
+ value = FunctionDescriptor.importValue(value, proColumn.getSymbol().getType());
tuple.add(value);
} catch (XPathException e) {
throw new TeiidProcessingException(e, QueryExecPlugin.Util.getString("XMLTableNode.path_error", proColumn.getName())); //$NON-NLS-1$
Modified: trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLValueTranslator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLValueTranslator.java 2010-06-28 14:47:10 UTC (rev 2309)
+++ trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLValueTranslator.java 2010-06-28 16:14:55 UTC (rev 2310)
@@ -27,6 +27,11 @@
import java.util.HashMap;
import java.util.Map;
+import javax.xml.transform.TransformerException;
+
+import net.sf.saxon.value.DateTimeValue;
+import net.sf.saxon.value.GYearMonthValue;
+
import org.teiid.api.exception.query.FunctionExecutionException;
import org.teiid.core.types.DataTypeManager;
import org.teiid.core.types.TransformationException;
@@ -48,7 +53,6 @@
private static String GMONTHDAY_FORMAT = "--MM-dd"; //$NON-NLS-1$
private static String GYEAR_FORMAT = "0000"; //$NON-NLS-1$
- private static String GYEARMONTH_FORMAT = "yyyy-MM"; //$NON-NLS-1$
public static final String DATETIME = "dateTime"; //$NON-NLS-1$
public static final String DOUBLE = "double"; //$NON-NLS-1$
@@ -118,7 +122,11 @@
switch (type) {
case DATETIME_CODE:
- valueStr = XMLSystemFunctions.timestampToDateTime((Timestamp)value);
+ try {
+ valueStr = XMLSystemFunctions.convertToAtomicValue(value).getStringValue();
+ } catch (TransformerException e) {
+ throw new TransformationException(e, e.getMessage());
+ }
break;
case DOUBLE_CODE:
valueStr = doubleToDouble((Double)value);
@@ -139,7 +147,13 @@
valueStr = FunctionMethods.format((BigInteger)value, GYEAR_FORMAT);
break;
case GYEARMONTH_CODE:
- valueStr = timestampTogYearMonth(value);
+ DateTimeValue dtv;
+ try {
+ dtv = ((DateTimeValue)XMLSystemFunctions.convertToAtomicValue(value));
+ } catch (TransformerException e) {
+ throw new TransformationException(e, e.getMessage());
+ }
+ valueStr = new GYearMonthValue(dtv.getYear(), dtv.getMonth(), dtv.getTimezoneInMinutes()).getStringValue();
break;
default:
valueStr = defaultTranslation(value);
@@ -156,22 +170,6 @@
return valueStr;
}
- /**
- * @param value
- * @return
- * @throws FunctionExecutionException
- * @since 4.3
- */
- private static String timestampTogYearMonth(Object value) throws FunctionExecutionException {
- String valueStr;
- Timestamp time = (Timestamp)value;
- valueStr = FunctionMethods.format(time, GYEARMONTH_FORMAT);
- if (time.getTime() < XMLSystemFunctions.YEAR_ZERO) {
- valueStr = "-" + valueStr; //$NON-NLS-1$
- }
- return valueStr;
- }
-
/**
* Translate any non-null value to a string by using the Object toString() method.
* This works in any case where the Java string representation of an object is the
Modified: trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java 2010-06-28 14:47:10 UTC (rev 2309)
+++ trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java 2010-06-28 16:14:55 UTC (rev 2310)
@@ -1158,6 +1158,7 @@
continue;
}
validateQName(obj, dc.getAlias());
+ validateXMLContentTypes(dc.getExpression(), obj);
}
}
@@ -1200,9 +1201,18 @@
@Override
public void visit(XMLElement obj) {
+ for (Expression expression : obj.getContent()) {
+ validateXMLContentTypes(expression, obj);
+ }
validateQName(obj, obj.getName());
}
+ public void validateXMLContentTypes(Expression expression, LanguageObject parent) {
+ if (expression.getType() == DataTypeManager.DefaultDataClasses.OBJECT || expression.getType() == DataTypeManager.DefaultDataClasses.BLOB) {
+ handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.xml_content_type", expression), parent); //$NON-NLS-1$
+ }
+ }
+
@Override
public void visit(QueryString obj) {
validateDerivedColumnNames(obj, obj.getArgs());
@@ -1248,8 +1258,11 @@
hadError = true;
}
context = true;
- } else if (!names.add(dc.getAlias().toUpperCase())) {
- handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.duplicate_passing", dc.getAlias()), obj); //$NON-NLS-1$
+ } else {
+ validateXMLContentTypes(dc.getExpression(), obj);
+ if (!names.add(dc.getAlias().toUpperCase())) {
+ handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.duplicate_passing", dc.getAlias()), obj); //$NON-NLS-1$
+ }
}
}
if (xqe.usesContextItem() && !context) {
Modified: trunk/engine/src/main/java/org/teiid/query/xquery/saxon/SaxonXQueryExpression.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/xquery/saxon/SaxonXQueryExpression.java 2010-06-28 14:47:10 UTC (rev 2309)
+++ trunk/engine/src/main/java/org/teiid/query/xquery/saxon/SaxonXQueryExpression.java 2010-06-28 16:14:55 UTC (rev 2310)
@@ -358,13 +358,20 @@
public SequenceIterator evaluateXQuery(Object context, Map<String, Object> parameterValues) throws TeiidProcessingException {
DynamicQueryContext dynamicContext = new DynamicQueryContext(config);
- for (Map.Entry<String, Object> entry : parameterValues.entrySet()) {
- Object value = entry.getValue();
- if(value instanceof SQLXML) {
- value = XMLSystemFunctions.convertToSource(value);
- }
- dynamicContext.setParameter(entry.getKey(), value);
- }
+ try {
+ for (Map.Entry<String, Object> entry : parameterValues.entrySet()) {
+ Object value = entry.getValue();
+ if(value instanceof SQLXML) {
+ value = XMLSystemFunctions.convertToSource(value);
+ } else if (value instanceof java.util.Date) {
+ java.util.Date d = (java.util.Date)value;
+ value = XMLSystemFunctions.convertToAtomicValue(value);
+ }
+ dynamicContext.setParameter(entry.getKey(), value);
+ }
+ } catch (TransformerException e) {
+ throw new TeiidProcessingException(e);
+ }
if (context != null) {
Source source = XMLSystemFunctions.convertToSource(context);
Modified: trunk/engine/src/main/resources/org/teiid/query/i18n.properties
===================================================================
--- trunk/engine/src/main/resources/org/teiid/query/i18n.properties 2010-06-28 14:47:10 UTC (rev 2309)
+++ trunk/engine/src/main/resources/org/teiid/query/i18n.properties 2010-06-28 16:14:55 UTC (rev 2310)
@@ -907,6 +907,7 @@
ValidationVisitor.xml_namespaces_reserved=The namespaces xmlns and xml are reserved.
ValidationVisitor.xml_namespaces_null_uri=The null uri, or empty string, is not allowed as the uri value.
ValidationVisitor.xml_attributes_reserved=The namespace xmlns is reserved.
+ValidationVisitor.xml_content_type=The expression "{0}" is of OBJECT or BLOB type, which cannot be used as an XML content value.
ValidationVisitor.xml_invalid_qname=The qname "{0}" is invalid.
ValidationVisitor.context_item_type=XMLTABLE or XMLQUERY PASSING context item must be an XML value.
ValidationVisitor.passing_requires_name=XMLTABLE or XMLQUERY PASSING clause can only contain at most 1 unnamed item.
Modified: trunk/engine/src/test/java/org/teiid/query/function/source/TestXMLSystemFunctions.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/function/source/TestXMLSystemFunctions.java 2010-06-28 14:47:10 UTC (rev 2309)
+++ trunk/engine/src/test/java/org/teiid/query/function/source/TestXMLSystemFunctions.java 2010-06-28 16:14:55 UTC (rev 2310)
@@ -25,7 +25,6 @@
import static org.junit.Assert.*;
import java.io.File;
-import java.sql.Timestamp;
import java.util.TimeZone;
import net.sf.saxon.trans.XPathException;
@@ -40,6 +39,7 @@
import org.teiid.core.types.XMLType;
import org.teiid.core.util.FileUtil;
import org.teiid.core.util.UnitTestUtil;
+import org.teiid.query.unittest.TimestampUtil;
@SuppressWarnings("nls")
public class TestXMLSystemFunctions {
@@ -197,10 +197,18 @@
helpTestXpathValue(xmlFilePath,xpath, "false"); //$NON-NLS-1$
}
- @Test public void testInvokeXmlElement2() throws Exception {
- assertEquals("1969-12-31T18:00:00", XMLSystemFunctions.getStringValue(new Timestamp(0)));
+ @Test public void testAtomicValueTimestamp() throws Exception {
+ assertEquals("1910-04-01T07:01:02.000055Z", XMLSystemFunctions.convertToAtomicValue(TimestampUtil.createTimestamp(10, 3, 1, 1, 1, 2, 55001)).getStringValue());
}
+ @Test public void testAtomicValueTime() throws Exception {
+ assertEquals("16:03:01Z", XMLSystemFunctions.convertToAtomicValue(TimestampUtil.createTime(10, 3, 1)).getStringValue());
+ }
+
+ @Test public void testAtomicValueDate() throws Exception {
+ assertEquals("1920-03-03Z", XMLSystemFunctions.convertToAtomicValue(TimestampUtil.createDate(20, 2, 3)).getStringValue());
+ }
+
@Test public void testNameEscaping() throws Exception {
assertEquals("_u003A_b", XMLSystemFunctions.escapeName(":b", true));
}
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java 2010-06-28 14:47:10 UTC (rev 2309)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java 2010-06-28 16:14:55 UTC (rev 2310)
@@ -25,6 +25,7 @@
import static org.teiid.query.processor.TestProcessor.*;
import java.io.FileInputStream;
+import java.sql.Timestamp;
import java.util.Arrays;
import java.util.List;
@@ -38,6 +39,7 @@
import org.teiid.core.util.UnitTestUtil;
import org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder;
import org.teiid.query.unittest.FakeMetadataFactory;
+import org.teiid.query.unittest.TimestampUtil;
@SuppressWarnings({"nls", "unchecked"})
public class TestSQLXMLProcessing {
@@ -343,6 +345,16 @@
processPreparedStatement(sql, expected, dataManager, new DefaultCapabilitiesFinder(), FakeMetadataFactory.example1Cached(), Arrays.asList(blobFromFile("udf.xmi")));
}
+
+ @Test public void testXmlTableTypes() throws Exception {
+ String sql = "select * from xmltable('/a' passing xmlparse(document '<a>2000-01-01T01:01:00.2-06:00</a>') columns x timestamp path 'xs:dateTime(./text())', y timestamp path '.') as x"; //$NON-NLS-1$
+ Timestamp ts = TimestampUtil.createTimestamp(100, 0, 1, 1, 1, 0, 200000000);
+ List<?>[] expected = new List<?>[] {
+ Arrays.asList(ts, ts),
+ };
+
+ process(sql, expected);
+ }
private static FakeDataManager dataManager = new FakeDataManager();
Modified: trunk/engine/src/test/java/org/teiid/query/processor/xml/TestXMLValueTranslator.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/xml/TestXMLValueTranslator.java 2010-06-28 14:47:10 UTC (rev 2309)
+++ trunk/engine/src/test/java/org/teiid/query/processor/xml/TestXMLValueTranslator.java 2010-06-28 16:14:55 UTC (rev 2310)
@@ -22,52 +22,60 @@
package org.teiid.query.processor.xml;
+import static org.junit.Assert.*;
+
import java.math.BigInteger;
import java.sql.Timestamp;
+import java.util.TimeZone;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
import org.teiid.core.types.DataTypeManager;
-import org.teiid.query.processor.xml.XMLValueTranslator;
+import org.teiid.core.util.TimestampWithTimezone;
import org.teiid.query.unittest.TimestampUtil;
-import junit.framework.TestCase;
+public class TestXMLValueTranslator {
-public class TestXMLValueTranslator extends TestCase {
-
- public TestXMLValueTranslator(String name) {
- super(name);
- }
+ @BeforeClass public static void setUp() {
+ TimestampWithTimezone.resetCalendar(TimeZone.getTimeZone("GMT-06:00")); //$NON-NLS-1$
+ }
+
+ @AfterClass public static void tearDown() {
+ TimestampWithTimezone.resetCalendar(null);
+ }
- public void test24HourDateTimeTranslation() throws Exception {
- Timestamp ts = TimestampUtil.createTimestamp(100, 0, 2, 14, 14, 5, 6);
+ @Test public void test24HourDateTimeTranslation() throws Exception {
+ Timestamp ts = TimestampUtil.createTimestamp(100, 0, 2, 14, 14, 5, 6000);
String value = XMLValueTranslator.translateToXMLValue(ts, DataTypeManager.DefaultDataClasses.TIMESTAMP, XMLValueTranslator.DATETIME);
- assertEquals("2000-01-02T14:14:05.000000006", value); //$NON-NLS-1$
+ assertEquals("2000-01-02T20:14:05.000006Z", value); //$NON-NLS-1$
}
- public void testDateTimeTranslation() throws Exception {
+ @Test public void testDateTimeTranslation() throws Exception {
Timestamp ts = TimestampUtil.createTimestamp(100, 0, 2, 3, 4, 5, 6);
String value = XMLValueTranslator.translateToXMLValue(ts, DataTypeManager.DefaultDataClasses.TIMESTAMP, XMLValueTranslator.DATETIME);
- assertEquals("2000-01-02T03:04:05.000000006", value); //$NON-NLS-1$
+ assertEquals("2000-01-02T09:04:05Z", value); //$NON-NLS-1$
ts.setNanos(6000);
value = XMLValueTranslator.translateToXMLValue(ts, DataTypeManager.DefaultDataClasses.TIMESTAMP, XMLValueTranslator.DATETIME);
- assertEquals("2000-01-02T03:04:05.000006", value); //$NON-NLS-1$
+ assertEquals("2000-01-02T09:04:05.000006Z", value); //$NON-NLS-1$
ts.setNanos(0);
value = XMLValueTranslator.translateToXMLValue(ts, DataTypeManager.DefaultDataClasses.TIMESTAMP, XMLValueTranslator.DATETIME);
- assertEquals("2000-01-02T03:04:05", value); //$NON-NLS-1$
+ assertEquals("2000-01-02T09:04:05Z", value); //$NON-NLS-1$
ts = TimestampUtil.createTimestamp(-2000, 0, 2, 3, 4, 5, 6);
value = XMLValueTranslator.translateToXMLValue(ts, DataTypeManager.DefaultDataClasses.TIMESTAMP, XMLValueTranslator.DATETIME);
- assertEquals("-0101-01-02T03:04:05.000000006", value); //$NON-NLS-1$
+ assertEquals("-0102-12-30T09:04:05Z", value); //$NON-NLS-1$
}
- public void testgYearTranslation() throws Exception {
+ @Test public void testgYearTranslation() throws Exception {
String value = XMLValueTranslator.translateToXMLValue(new BigInteger("5"), DataTypeManager.DefaultDataClasses.BIG_INTEGER, XMLValueTranslator.GYEAR); //$NON-NLS-1$
assertEquals("0005", value); //$NON-NLS-1$
@@ -75,19 +83,19 @@
assertEquals("-10000", value); //$NON-NLS-1$
}
- public void testgYearMonthTranslation() throws Exception {
+ @Test public void testgYearMonthTranslation() throws Exception {
Timestamp ts = TimestampUtil.createTimestamp(100, 0, 4, 6, 8, 10, 12);
String value = XMLValueTranslator.translateToXMLValue(ts, DataTypeManager.DefaultDataClasses.TIMESTAMP, XMLValueTranslator.GYEARMONTH);
- assertEquals("2000-01", value); //$NON-NLS-1$
+ assertEquals("2000-01Z", value); //$NON-NLS-1$
ts = TimestampUtil.createTimestamp(-30000, 0, 4, 6, 8, 10, 12);
value = XMLValueTranslator.translateToXMLValue(ts, DataTypeManager.DefaultDataClasses.TIMESTAMP, XMLValueTranslator.GYEARMONTH);
- assertEquals("-28101-01", value); //$NON-NLS-1$
+ assertEquals("-28102-06Z", value); //$NON-NLS-1$
}
- public void testDefaultTranslation() throws Exception {
+ @Test public void testDefaultTranslation() throws Exception {
String value = XMLValueTranslator.translateToXMLValue("", DataTypeManager.DefaultDataClasses.STRING, XMLValueTranslator.STRING); //$NON-NLS-1$
assertNull(value);
}
Modified: trunk/runtime/src/main/java/org/teiid/transport/ObjectEncoder.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/ObjectEncoder.java 2010-06-28 14:47:10 UTC (rev 2309)
+++ trunk/runtime/src/main/java/org/teiid/transport/ObjectEncoder.java 2010-06-28 16:14:55 UTC (rev 2310)
@@ -36,7 +36,6 @@
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ChannelPipelineCoverage;
import org.jboss.netty.channel.Channels;
-import org.jboss.netty.channel.DownstreamMessageEvent;
import org.jboss.netty.channel.MessageEvent;
import org.jboss.netty.handler.stream.ChunkedInput;
import org.jboss.netty.handler.stream.ChunkedStream;
Modified: trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestXMLTypeTranslations.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestXMLTypeTranslations.java 2010-06-28 14:47:10 UTC (rev 2309)
+++ trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestXMLTypeTranslations.java 2010-06-28 16:14:55 UTC (rev 2310)
@@ -24,6 +24,7 @@
import java.io.FileInputStream;
import java.math.BigInteger;
+import java.sql.Timestamp;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
@@ -40,7 +41,6 @@
import org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder;
import org.teiid.query.optimizer.capabilities.SourceCapabilities.Capability;
import org.teiid.query.processor.HardcodedDataManager;
-import org.teiid.query.unittest.TimestampUtil;
import org.teiid.translator.SourceSystemFunctions;
@@ -71,22 +71,25 @@
models.add("sample"); //$NON-NLS-1$
dataMgr.setValidModels(models);
+ Timestamp ts = new Timestamp(-2106305630000l);
+ ts.setNanos(3000000);
+
dataMgr.addData("SELECT g_0.\"timestamp\", g_0.\"double\", g_0.\"float\", convert(g_0.\"double\", biginteger), convert(g_0.\"double\", biginteger), convert(g_0.\"date\", timestamp), convert(g_0.\"double\", biginteger), convert(g_0.\"date\", timestamp), '1' FROM sample.RUNTIMEVALUE AS g_0", //$NON-NLS-1$
new List[] { Arrays.asList(new Object[] {
- TimestampUtil.createTimestamp(3, 3, 4, 5, 6, 10, 200),
+ ts,
new Double(Double.NEGATIVE_INFINITY),
new Float(Float.POSITIVE_INFINITY),
new BigInteger("100"), //$NON-NLS-1$
new BigInteger("100"), //$NON-NLS-1$
- TimestampUtil.createTimestamp(3, 3, 4, 5, 6, 7, 0),
+ ts,
new BigInteger("100"), //$NON-NLS-1$
- TimestampUtil.createTimestamp(3, 3, 4, 5, 6, 7, 0),
+ ts,
"1" //$NON-NLS-1$
})});
- List[] expected = new List[] { Arrays.asList(new Object[] {"<?xml version=\"1.0\" encoding=\"UTF-8\"?><XSDTypesNS:test xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:XSDTypesNS=\"http://www.metamatrix.com/XMLSchema/DataSets/XSDTypes\"><book><datetime>1903-04-04T05:06:10.0000002</datetime><double>-INF</double><float>INF</float><gday>---100</gday><gmonth>--100</gmonth><gmonthday>--04-04</gmonthday><gyear>0100</gyear><gyearmonth>1903-04</gyearmonth><string>1</string></book></XSDTypesNS:test>" })}; //$NON-NLS-1$
+ List[] expected = new List[] { Arrays.asList(new Object[] {"<?xml version=\"1.0\" encoding=\"UTF-8\"?><XSDTypesNS:test xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:XSDTypesNS=\"http://www.metamatrix.com/XMLSchema/DataSets/XSDTypes\"><book><datetime>1903-04-04T11:06:10.006Z</datetime><double>-INF</double><float>INF</float><gday>---100</gday><gmonth>--100</gmonth><gmonthday>--04-04</gmonthday><gyear>0100</gyear><gyearmonth>1903-04Z</gyearmonth><string>1</string></book></XSDTypesNS:test>" })}; //$NON-NLS-1$
doProcess(metadata,
sql,
finder, dataMgr , expected, DEBUG);
@@ -117,5 +120,4 @@
}
-
}
14 years, 6 months
teiid SVN: r2309 - in branches/7.0.x: documentation/admin-guide/src/main/docbook/en-US/content and 2 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-06-28 10:47:10 -0400 (Mon, 28 Jun 2010)
New Revision: 2309
Added:
branches/7.0.x/documentation/admin-guide/src/main/docbook/en-US/content/performance.xml
branches/7.0.x/documentation/reference/src/main/docbook/en-US/content/entitlements.xml
Modified:
branches/7.0.x/client/src/main/java/org/teiid/jdbc/TeiidStatement.java
branches/7.0.x/documentation/admin-guide/src/main/docbook/en-US/content/security.xml
branches/7.0.x/documentation/reference/src/main/docbook/en-US/Reference.xml
Log:
adding doc content and correcting javadoc
Modified: branches/7.0.x/client/src/main/java/org/teiid/jdbc/TeiidStatement.java
===================================================================
--- branches/7.0.x/client/src/main/java/org/teiid/jdbc/TeiidStatement.java 2010-06-28 14:43:04 UTC (rev 2308)
+++ branches/7.0.x/client/src/main/java/org/teiid/jdbc/TeiidStatement.java 2010-06-28 14:47:10 UTC (rev 2309)
@@ -64,7 +64,7 @@
/**
* Obtain the query planner debug log from the last command
* executed on this Statement, if it was requested with
- * OPTION DEBUG. If no debug output was requested, this
+ * SHOWPLAN DEBUG. If no debug output was requested, this
* method will return null.
* @return Debug log or null if no log exists
*/
Added: branches/7.0.x/documentation/admin-guide/src/main/docbook/en-US/content/performance.xml
===================================================================
--- branches/7.0.x/documentation/admin-guide/src/main/docbook/en-US/content/performance.xml (rev 0)
+++ branches/7.0.x/documentation/admin-guide/src/main/docbook/en-US/content/performance.xml 2010-06-28 14:47:10 UTC (rev 2309)
@@ -0,0 +1,28 @@
+<!--
+TODO: incorporate a performance chapter.
+
+The information about document materialization belongs in the reference though. And is not completely correct
+w.r.t. the use of document projection.
+
+ <para>Your application can use a statement object to execute queries that return XML documents.
+ The query must specify a valid document in VDB, or should have used SQL XML functions
+ to create a XMl document.</para>
+ <sect3>
+ <title>XML Streaming</title>
+ <para>XML documents are streamed from Teiid Server to the Teiid JDBC API.
+ Normally, the document never materializes in the server memory, avoiding potential
+ out-of-memory issues and improving the first response time for large documents.
+ When using style sheets, or XQuery, the whole document
+ must be materialized on the server. Therefore memory issues may occur for large documents.
+ A result document can be obtained from the JDBC resultset using <code>getSQLXML</code> method.
+ </para>
+ <para>The document is broken into pieces when being created and streamed.
+ The maximum size of each piece in the stream can be configured with the
+ <code>"lobChunkSizeInKB"</code> system property on the Server. The default value is 100 KB.
+ At any given time, this is the maximum amount of memory that can be held by a particular
+ XML query against the system. In heavily loaded or memory-constrained scenarios,
+ this value can decrease the amount of memory used. As a side effect, streaming will occur in smaller pieces, reducing initial document response time while
+ increasing full response time (as this is less efficient).</para>
+ </sect3>
+
+ -->
\ No newline at end of file
Property changes on: branches/7.0.x/documentation/admin-guide/src/main/docbook/en-US/content/performance.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/7.0.x/documentation/admin-guide/src/main/docbook/en-US/content/security.xml
===================================================================
--- branches/7.0.x/documentation/admin-guide/src/main/docbook/en-US/content/security.xml 2010-06-28 14:43:04 UTC (rev 2308)
+++ branches/7.0.x/documentation/admin-guide/src/main/docbook/en-US/content/security.xml 2010-06-28 14:47:10 UTC (rev 2309)
@@ -3,7 +3,7 @@
<chapter id="custom_security">
<title>Teiid Security</title>
<para>The Teiid system provides a range of built-in and extensible security features to enable the
- secure access of data. </para>
+ secure access of data.</para>
<sect1>
<title>Authentication</title>
<para>JDBC clients may use simple passwords to authenticate a user.</para>
@@ -11,6 +11,13 @@
identity of the user can be discerned by the password credential alone. In
any case it is up to the configured security domain to determine whether a user can be
authenticated.</para>
+
+ <note><para>By default, access to Teiid is NOT secure. The default login modules are only
+ backed by file based authentication, which has a well known user
+ name and password.
+ The same is true for making connections to the Admin Console application.
+ We DO NOT recommend leaving the default security profile as defined when you
+ are exposing sensitive data.</para></note>
</sect1>
<sect1>
<title>Authorization</title>
@@ -59,6 +66,14 @@
Details of the failed attempt including invalid users, which
domains were consulted, etc. will be in the server log with appropriate
levels of severity.</para>
+ <note>
+ <para>The security-domain defined for the JDBC connection and Admin connections are separate.
+ The default name of JDBC connection's security-domain is "teiid-security". The default name for Admin connection
+ is "jmx-console". For the Admin connection's security domain, the user is allowed
+ to change which LoginModule that "jmx-console" pointing to, however should not change the name of the domain, as this name is
+ shared between the "admin-console" application.</para>
+ </note>
+
<sect2>
<title>Built-in LoginModules</title>
<para>JBossAS provides several LoginModules for common authentication needs, such as authenticating from text files or LDAP.</para>
@@ -71,12 +86,52 @@
If you want use a your own Custom Login module, check out the Developer's Guide for instructions.
</para>
</sect2>
+
</sect1>
- <note>
- <para>The security-domain defined for the JDBC connection and Admin connections are separate.
- The default name of JDBC connection's security-domain is "teiid-security". The default name for Admin connection
- is "jmx-console". For the Admin connection's security domain, the user is allowed
- to change which LoginModule that "jmx-console" pointing to, however should not change the name of the domain, as this name is
- shared between the "admin-console" application.</para>
- </note>
+
+ <sect1 id="connfigure_server">
+ <title>Configuring SSL</title>
+ <para>The Teiid's configuration file
+ <code><jboss-install>/server/<profile>/deploy/teiid/teiid-jboss-beans.xml</code>,
+ contains the properties to configure SSL.</para>
+ <itemizedlist>
+ <para>There are two separate connection profiles:</para>
+ <listitem><para>JDBC Connection - The <code>JdbcSslConfiguration</code> bean configuration defines this.</para></listitem>
+ <listitem><para>Admin Connection - The <code>AdminSslConfiguration</code> bean configuration defines this.</para></listitem>
+ </itemizedlist>
+ <example><title>Example Configuration</title>
+ <programlisting><![CDATA[<bean name="JdbcSslConfiguration" class="org.teiid.transport.SSLConfiguration">
+ <property name="sslEnabled">false</property>
+ <property name="keystoreFilename">cert.keystore</property>
+ <property name="keystorePassword">passwd</property>
+ <property name="keystoreType">JKS</property>
+ <property name="sslProtocol">SSLv3</property>
+ <property name="keymanagementAlgorithm">false</property>
+ <property name="truststoreFilename">cert.truststore</property>
+ <property name="truststorePassword">passwd</property>
+ <!-- 1-way, 2-way, anonymous -->
+ <property name="authenticationMode">1-way</property>
+ <property name="clientEncryptionEnabled">true</property>
+</bean>]]></programlisting>
+</example>
+ <orderedlist>
+ <title>Properties</title>
+ <listitem><para>sslEnabled - true|false, SSL usage either turned ON or OFF </para></listitem>
+ <listitem><para>sslProtocol- Type of SSL protocol to be used. Default is SSLv3</para></listitem>
+ <listitem><para>keystoreType - Keystore type created by the keytool. Default "JKS" is used.</para></listitem>
+ <listitem><para>authenticationMode - anonymous|1-way|2-way, Type of SSL mode, see
+ above about different <link linkend="ssl_modes">SSL modes</link> available.</para></listitem>
+ <listitem><para>keymanagementAlgorithm - Type of key algorithm used. Default
+ is based upon the VM, e.g. "SunX509"</para></listitem>
+ <listitem><para>keystoreFilename - The file name of the keystore, which contains the
+ private key of the Server. This must be available in the classpath of Teiid Server</para></listitem>
+ <listitem><para>keystorePassword - password for the keystore.</para></listitem>
+ <listitem><para>truststoreFilename - if "authenticationMode" is chosen
+ as "2-way", then this property must be provided. This is the truststore that contains the
+ public key for the client. Depending upon how you created the keystore and truststores,
+ this may be same file as defined under "keystoreFilename" property.</para></listitem>
+ <listitem><para>truststorePassword - password for the truststore. </para></listitem>
+ </orderedlist>
+
+ </sect1>
</chapter>
\ No newline at end of file
Modified: branches/7.0.x/documentation/reference/src/main/docbook/en-US/Reference.xml
===================================================================
--- branches/7.0.x/documentation/reference/src/main/docbook/en-US/Reference.xml 2010-06-28 14:43:04 UTC (rev 2308)
+++ branches/7.0.x/documentation/reference/src/main/docbook/en-US/Reference.xml 2010-06-28 14:47:10 UTC (rev 2309)
@@ -53,6 +53,7 @@
<xi:include href="content/scalar_functions.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="content/procedures.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="content/transaction_support.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="content/entitlements.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="content/system_schema.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="content/translators.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="content/federated_planning.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
Added: branches/7.0.x/documentation/reference/src/main/docbook/en-US/content/entitlements.xml
===================================================================
--- branches/7.0.x/documentation/reference/src/main/docbook/en-US/content/entitlements.xml (rev 0)
+++ branches/7.0.x/documentation/reference/src/main/docbook/en-US/content/entitlements.xml 2010-06-28 14:47:10 UTC (rev 2309)
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % CustomDTD SYSTEM "../../../../../../docbook/custom.dtd">
+%CustomDTD;
+]>
+<chapter id="entitlements">
+ <title>Data Roles</title>
+ <para>Data roles, also called entitlements, are sets of permissions that are defined
+ per VDB that dictate data access (create, read, update, delete). The use of data roles is controlled system wide with the property in
+ <code><jboss-install>/server/<profile>/deploy/teiid/teiid-jboss-beans.xml</code> file
+ in bean configuration section of <code>RuntimeEngineDeployer</code> with property <code>useEntitlements</code>.</para>
+
+ <para>Once data roles are enabled, the access permissions defined in a VDB will be enforced by the Teiid Server.</para>
+
+ <sect1>
+ <title>Permissions</title>
+ <orderedlist>
+ <para>To process a <code>SELECT</code> statement or a stored procedure execution, the user account requires the following access rights:</para>
+ <listitem> <para><code>READ</code> - on the Table(s) being accessed or the procedure being called.</para></listitem>
+ <listitem> <para><code>READ</code> - on every column referenced.</para></listitem>
+ </orderedlist>
+
+ <orderedlist>
+ <para>To process an <code>INSERT</code> statement, the user account requires the following access rights:</para>
+ <listitem> <para><code>CREATE</code> - on the Table being inserted into.</para></listitem>
+ <listitem> <para><code>CREATE</code> - on every column being inserted on that Table.</para></listitem>
+ </orderedlist>
+
+ <orderedlist>
+ <para>To process an <code>UPDATE</code> statement, the user account requires the following access rights:</para>
+ <listitem> <para><code>UPDATE</code> - on the Table being updated.</para></listitem>
+ <listitem> <para><code>UPDATE</code> - on every column being updated on that Table.</para></listitem>
+ <listitem> <para><code>READ</code> - on every column referenced in the criteria.</para></listitem>
+ </orderedlist>
+
+ <orderedlist>
+ <para>To process a <code>DELETE</code> statement, the user account requires the following access rights:</para>
+ <listitem> <para><code>DELETE</code> - on the Table being deleted.</para></listitem>
+ <listitem> <para><code>READ</code> - on every column referenced in the criteria.</para></listitem>
+ </orderedlist>
+ </sect1>
+
+ <sect1>
+ <title>XML Definition</title>
+ <para>Data roles are defined inside the <code>vdb.xml</code> file (inside the .vdb Zip archive under META-INF/vdb.xml) if you used Designer.
+ This example will show a sample "vdb.xml" file with few simple data rules.</para>
+
+ <para>For example, if a VDB defines a table "TableA" in schema "modelName" with columns (column1, column2) - note that the column types do not matter. And we wish to define three roles "RoleA", "RoleB", "RoleC" with following permissions:
+ <orderedlist>
+ <listitem><para>RoleA has privileges to read, write access to TableA, but can not delete.</para></listitem>
+ <listitem><para>RoleB has no privileges that allow access to TableA</para></listitem>
+ <listitem><para>RoleC has privileges that only allow read access to TableA.column1</para></listitem>
+ </orderedlist>
+ </para>
+ <example><title>vdb.xml defining RoleA, RoleB, and RoleC</title>
+ <programlisting><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
+<vdb name="sample" version="1">
+
+ <model name="modelName">
+ <source name="source-name" translator-name="oracle" connection-jndi-name="java:myDS" />
+ </model>
+
+ <data-policy name="RoleA">
+ <description>Allow all, except Delete</description>
+
+ <permission>
+ <resource-name>modelName.TableA</resource-name>
+ <allow-create />
+ <allow-read />
+ <allow-update />
+ </permission>
+
+ <permission>
+ <resource-name>modelName.TableA.colum1</resource-name>
+ <allow-create />
+ <allow-read />
+ <allow-update />
+ </permission>
+
+ <permission>
+ <resource-name>modelName.TableA.column2</resource-name>
+ <allow-create />
+ <allow-read />
+ <allow-update />
+ </permission>
+
+ <mapped-role-name>role1</mapped-role-name>
+
+ </data-policy>
+
+ <data-policy name="RoleC">
+ <description>Allow read only</description>
+
+ <permission>
+ <resource-name>modelName.TableA</resource-name>
+ <allow-read />
+ </permission>
+
+ <permission>
+ <resource-name>modelName.TableA.colum1</resource-name>
+ <allow-read />
+ </permission>
+
+ <mapped-role-name>role2</mapped-role-name>
+ </data-policy>
+</vdb>]]></programlisting>
+</example>
+ <para>The above XML defined two data roles, "RoleA" which allows everything except delete on the table, "RoleC" that
+ allows only read operation on the table. Since Teiid uses deny by default, there is no explict data-policy entry needed for "RoleB". The "mapped-role-name" defines the "role" to whom these policies are applicable. Each data-policy
+ must define a "role" to be enforced by the Teiid Server.</para>
+
+ <para>For assigning the roles to your users, in the JBoss AS,
+ check out the instructions for the selected Login Module. Check "Admin Guide" for configuring Login Modules.</para>
+
+ <para>"vdb.xml" file is checked against the schema file <code>vdb-deployer.xsd</code>, check the documents sections of the Teiid kit
+ to find a copy of the schema file.</para>
+
+ <note><para>Currently there is no GUI tooling support in the Designer or any other management tool to create this data roles
+ permissions xml, however this is in our roadmap for future releases to provide.</para></note>
+ </sect1>
+
+</chapter>
\ No newline at end of file
Property changes on: branches/7.0.x/documentation/reference/src/main/docbook/en-US/content/entitlements.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 6 months
teiid SVN: r2308 - in branches/7.0.x: connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/mysql and 2 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-06-28 10:43:04 -0400 (Mon, 28 Jun 2010)
New Revision: 2308
Modified:
branches/7.0.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java
branches/7.0.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/mysql/MySQLExecutionFactory.java
branches/7.0.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java
branches/7.0.x/documentation/reference/src/main/docbook/en-US/content/translators.xml
Log:
TEIID-1056 removing oracle specific log and mysql setting of the ansi mode
Modified: branches/7.0.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java
===================================================================
--- branches/7.0.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java 2010-06-28 14:36:05 UTC (rev 2307)
+++ branches/7.0.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java 2010-06-28 14:43:04 UTC (rev 2308)
@@ -223,7 +223,7 @@
public ResultSetExecution createResultSetExecution(QueryExpression command, ExecutionContext executionContext, RuntimeMetadata metadata, Connection conn)
throws TranslatorException {
//TODO: This is not correct; this should be only called once for connection creation
- afterConnectionCreation(conn);
+ obtainedConnection(conn);
return new JDBCQueryExecution(command, conn, executionContext, this);
}
@@ -231,7 +231,7 @@
public ProcedureExecution createProcedureExecution(Call command, ExecutionContext executionContext, RuntimeMetadata metadata, Connection conn)
throws TranslatorException {
//TODO: This is not correct; this should be only called once for connection creation
- afterConnectionCreation(conn);
+ obtainedConnection(conn);
return new JDBCProcedureExecution(command, conn, executionContext, this);
}
@@ -239,7 +239,7 @@
public UpdateExecution createUpdateExecution(Command command, ExecutionContext executionContext, RuntimeMetadata metadata, Connection conn)
throws TranslatorException {
//TODO: This is not correct; this should be only called once for connection creation
- afterConnectionCreation(conn);
+ obtainedConnection(conn);
return new JDBCUpdateExecution(command, conn, executionContext, this);
}
@@ -996,12 +996,12 @@
* Called exactly once for this source.
* @param connection
*/
- protected void afterInitialConnectionCreation(Connection connection) {
+ protected void afterInitialConnectionObtained(Connection connection) {
// now dig some details about this driver/database for log.
try {
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = new StringBuffer(getClass().getSimpleName());
DatabaseMetaData dbmd = connection.getMetaData();
- sb.append("Commit=").append(connection.getAutoCommit()); //$NON-NLS-1$
+ sb.append(" Commit=").append(connection.getAutoCommit()); //$NON-NLS-1$
sb.append(";DatabaseProductName=").append(dbmd.getDatabaseProductName()); //$NON-NLS-1$
sb.append(";DatabaseProductVersion=").append(dbmd.getDatabaseProductVersion()); //$NON-NLS-1$
sb.append(";DriverMajorVersion=").append(dbmd.getDriverMajorVersion()); //$NON-NLS-1$
@@ -1019,18 +1019,18 @@
/**
* Provides a hook to call source specific logic when
- * a connection is created.
+ * a connection is obtained.
*
* defect request 13979 & 13978
*/
- public void afterConnectionCreation(Connection connection) {
+ public void obtainedConnection(Connection connection) {
if (initialConnection) {
synchronized (this) {
if (!initialConnection) {
return;
}
initialConnection = false;
- afterInitialConnectionCreation(connection);
+ afterInitialConnectionObtained(connection);
}
}
}
Modified: branches/7.0.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/mysql/MySQLExecutionFactory.java
===================================================================
--- branches/7.0.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/mysql/MySQLExecutionFactory.java 2010-06-28 14:36:05 UTC (rev 2307)
+++ branches/7.0.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/mysql/MySQLExecutionFactory.java 2010-06-28 14:43:04 UTC (rev 2308)
@@ -22,10 +22,7 @@
package org.teiid.translator.jdbc.mysql;
-import java.sql.Connection;
import java.sql.Date;
-import java.sql.SQLException;
-import java.sql.Statement;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.ArrayList;
@@ -33,11 +30,9 @@
import java.util.List;
import org.teiid.language.Function;
-import org.teiid.logging.LogConstants;
-import org.teiid.logging.LogManager;
+import org.teiid.translator.SourceSystemFunctions;
import org.teiid.translator.Translator;
import org.teiid.translator.TranslatorException;
-import org.teiid.translator.SourceSystemFunctions;
import org.teiid.translator.TypeFacility;
import org.teiid.translator.jdbc.ConvertModifier;
import org.teiid.translator.jdbc.FunctionModifier;
@@ -130,26 +125,6 @@
}
@Override
- public void afterConnectionCreation(Connection connection) {
- super.afterConnectionCreation(connection);
-
- Statement stmt = null;
- try {
- stmt = connection.createStatement();
- stmt.execute("set SESSION sql_mode = 'ANSI'"); //$NON-NLS-1$
- } catch (SQLException e) {
- LogManager.logError(LogConstants.CTX_CONNECTOR, e, "Error setting ANSI mode"); //$NON-NLS-1$
- } finally {
- if (stmt != null) {
- try {
- stmt.close();
- } catch (SQLException e) {
- LogManager.logDetail("Error closing statement", e); //$NON-NLS-1$
- }
- }
- }
- }
- @Override
public boolean useParensForJoins() {
return true;
}
Modified: branches/7.0.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java
===================================================================
--- branches/7.0.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java 2010-06-28 14:36:05 UTC (rev 2307)
+++ branches/7.0.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java 2010-06-28 14:43:04 UTC (rev 2308)
@@ -24,11 +24,8 @@
*/
package org.teiid.translator.jdbc.oracle;
-import java.sql.Connection;
import java.sql.PreparedStatement;
-import java.sql.ResultSet;
import java.sql.SQLException;
-import java.sql.Statement;
import java.sql.Types;
import java.util.ArrayList;
import java.util.Arrays;
@@ -50,20 +47,17 @@
import org.teiid.language.SQLConstants.Tokens;
import org.teiid.language.SetQuery.Operation;
import org.teiid.language.visitor.CollectorVisitor;
-import org.teiid.logging.LogConstants;
-import org.teiid.logging.LogManager;
import org.teiid.metadata.Column;
-import org.teiid.translator.Translator;
-import org.teiid.translator.TranslatorException;
import org.teiid.translator.ExecutionContext;
import org.teiid.translator.SourceSystemFunctions;
+import org.teiid.translator.Translator;
+import org.teiid.translator.TranslatorException;
import org.teiid.translator.TypeFacility;
import org.teiid.translator.jdbc.AliasModifier;
import org.teiid.translator.jdbc.ConvertModifier;
import org.teiid.translator.jdbc.ExtractFunctionModifier;
import org.teiid.translator.jdbc.FunctionModifier;
import org.teiid.translator.jdbc.JDBCExecutionFactory;
-import org.teiid.translator.jdbc.JDBCPlugin;
import org.teiid.translator.jdbc.LocateFunctionModifier;
@@ -389,41 +383,6 @@
}
@Override
- public void afterInitialConnectionCreation(Connection connection) {
- String errorStr = JDBCPlugin.Util.getString("ConnectionListener.failed_to_report_oracle_connection_details"); //$NON-NLS-1$
- ResultSet rs = null;
- Statement stmt = null;
- try {
- stmt = connection.createStatement();
- rs = stmt.executeQuery("select * from v$instance"); //$NON-NLS-1$
-
- int columnCount = rs.getMetaData().getColumnCount();
- while (rs.next()) {
- StringBuffer sb = new StringBuffer();
- for (int i = 1; i <= columnCount; i++) {
- sb.append(rs.getMetaData().getColumnName(i)).append("=").append(rs.getString(i)).append(";"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- // log the queried information
- LogManager.logInfo(LogConstants.CTX_CONNECTOR, sb.toString());
- }
-
- } catch (SQLException e) {
- LogManager.logInfo(LogConstants.CTX_CONNECTOR, errorStr);
- }finally {
- try {
- if (rs != null) {
- rs.close();
- }
- if (stmt != null) {
- stmt.close();
- }
- } catch (SQLException e1) {
- LogManager.logInfo(LogConstants.CTX_CONNECTOR, errorStr);
- }
- }
- }
-
- @Override
public NullOrder getDefaultNullOrder() {
return NullOrder.HIGH;
}
Modified: branches/7.0.x/documentation/reference/src/main/docbook/en-US/content/translators.xml
===================================================================
--- branches/7.0.x/documentation/reference/src/main/docbook/en-US/content/translators.xml 2010-06-28 14:36:05 UTC (rev 2307)
+++ branches/7.0.x/documentation/reference/src/main/docbook/en-US/content/translators.xml 2010-06-28 14:43:04 UTC (rev 2308)
@@ -137,12 +137,9 @@
<para><emphasis>metamatrix</emphasis> - for use with MetaMatrix 5.5.0 or later.</para>
</listitem>
<listitem>
-<para><emphasis>mysql</emphasis> - for use with MySQL version 4.x.</para>
+<para><emphasis>mysql</emphasis>/<emphasis>mysql5</emphasis> - for use with MySQL version 4.x and 5 or later respectively. <note>The MySQL Translators expect the database or session to be using ANSI mode. If the database is not using ANSI mode, an initialization query should be used on the pool to set ANSI mode: <programlisting>set SESSION sql_mode = 'ANSI'</programlisting></note></para>
</listitem>
<listitem>
-<para><emphasis>mysql5</emphasis> - for use with MySQL version 5 or later.</para>
-</listitem>
-<listitem>
<para><emphasis>oracle</emphasis> - for use with Oracle 9i or later. Sequences may be used with the Oracle translator.
A sequence may be modeled as a table with a name in source of DUAL and columns with the name in source set to <sequencesequence name>.[nextval|currentval].
You can use a sequence as the default value for insert columns by setting the column to autoincrement and the name in source to <element name>:SEQUENCE=<sequence name>.<sequence value>.</para>
14 years, 6 months