[teiid-commits] teiid SVN: r467 - in trunk: client/src/main/java/com/metamatrix/dqp/message and 31 other directories.
teiid-commits at lists.jboss.org
teiid-commits at lists.jboss.org
Fri Feb 13 11:51:06 EST 2009
Author: shawkins
Date: 2009-02-13 11:51:05 -0500 (Fri, 13 Feb 2009)
New Revision: 467
Added:
trunk/client/src/main/java/com/metamatrix/dqp/exception/SourceWarning.java
trunk/connector-api/src/main/java/com/metamatrix/connector/basic/BasicExecution.java
Removed:
trunk/client/src/main/java/com/metamatrix/dqp/exception/PartialResultsException.java
trunk/client/src/main/java/com/metamatrix/dqp/exception/SourceFailureDetails.java
Modified:
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMPreparedStatement.java
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMResultSet.java
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMStatement.java
trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/WarningUtil.java
trunk/client/src/main/java/com/metamatrix/dqp/message/ResultsMessage.java
trunk/connector-api/src/main/java/com/metamatrix/connector/api/ConnectorLogger.java
trunk/connector-api/src/main/java/com/metamatrix/connector/api/Execution.java
trunk/connector-api/src/main/java/com/metamatrix/connector/basic/BasicConnection.java
trunk/connector-metadata/src/main/java/com/metamatrix/connector/metadata/MetadataProcedureExecution.java
trunk/connector-metadata/src/main/java/com/metamatrix/connector/metadata/adapter/ObjectConnection.java
trunk/connector-metadata/src/main/java/com/metamatrix/connector/metadata/adapter/ObjectSynchExecution.java
trunk/connector-sdk/src/main/java/com/metamatrix/cdk/api/SysLogger.java
trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCBaseExecution.java
trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCProcedureExecution.java
trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCQueryExecution.java
trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCSourceConnection.java
trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCUpdateExecution.java
trunk/connectors/connector-ldap/src/main/java/com/metamatrix/connector/ldap/LDAPConnection.java
trunk/connectors/connector-ldap/src/main/java/com/metamatrix/connector/ldap/LDAPSyncQueryExecution.java
trunk/connectors/connector-ldap/src/main/java/com/metamatrix/connector/ldap/LDAPUpdateExecution.java
trunk/connectors/connector-loopback/src/main/java/com/metamatrix/connector/loopback/LoopbackExecution.java
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/connection/SalesforceConnection.java
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/QueryExecutionImpl.java
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/UpdateExecutionParent.java
trunk/connectors/connector-text/src/main/java/com/metamatrix/connector/text/TextConnection.java
trunk/connectors/connector-text/src/main/java/com/metamatrix/connector/text/TextSynchExecution.java
trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/XMLConnectionImpl.java
trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/XMLExecutionImpl.java
trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/jms/JMSConnection.java
trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/jms/JMSExecution.java
trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xmlsource/XMLSourceConnection.java
trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xmlsource/XMLSourceExecution.java
trunk/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestLoggingInputStreamFilter.java
trunk/connectors/sandbox/connector-exec/src/main/java/com/metamatrix/connector/exec/ExecAntExecution.java
trunk/connectors/sandbox/connector-exec/src/main/java/com/metamatrix/connector/exec/ExecConnection.java
trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/ObjectConnection.java
trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/ObjectProcedureExecution.java
trunk/connectors/sandbox/connector-yahoo/src/main/java/com/metamatrix/connector/yahoo/YahooConnection.java
trunk/connectors/sandbox/connector-yahoo/src/main/java/com/metamatrix/connector/yahoo/YahooExecution.java
trunk/documentation/reference/src/main/docbook/en-US/content/federated_planning.xml
trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/ConnectorWorkItem.java
trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/DefaultConnectorLogger.java
trunk/engine/src/main/java/com/metamatrix/dqp/internal/pooling/connector/PooledConnector.java
trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/DataTierTupleSource.java
trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/RequestWorkItem.java
trunk/engine/src/main/java/com/metamatrix/dqp/message/AtomicResultsMessage.java
trunk/engine/src/main/java/com/metamatrix/query/processor/ProcessorPlan.java
trunk/engine/src/main/java/com/metamatrix/query/processor/QueryProcessor.java
trunk/engine/src/main/java/com/metamatrix/query/processor/relational/RelationalNodeUtil.java
trunk/engine/src/test/java/com/metamatrix/dqp/internal/datamgr/impl/FakeConnector.java
trunk/engine/src/test/java/com/metamatrix/dqp/internal/datamgr/impl/FakeProcedureExecution.java
trunk/engine/src/test/java/com/metamatrix/dqp/internal/datamgr/impl/TestConnectorWorkItem.java
trunk/engine/src/test/java/com/metamatrix/dqp/internal/process/TestDQPCoreRequestHandling.java
trunk/engine/src/test/java/com/metamatrix/dqp/internal/process/TestDataTierManager.java
trunk/engine/src/test/java/com/metamatrix/dqp/service/AutoGenDataService.java
trunk/server/src/main/java/com/metamatrix/platform/security/audit/AuditManager.java
trunk/test-integration/src/test/java/com/metamatrix/data/metadata/runtime/MockConnector.java
Log:
TEIID-191 adding enhancements to the new connector api - BasicExecution, expanded ConnectorLogger, and SourceWarnings.
Deleted: trunk/client/src/main/java/com/metamatrix/dqp/exception/PartialResultsException.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/dqp/exception/PartialResultsException.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/client/src/main/java/com/metamatrix/dqp/exception/PartialResultsException.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -1,111 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.dqp.exception;
-
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-
-import com.metamatrix.admin.AdminPlugin;
-import com.metamatrix.api.exception.MetaMatrixProcessingException;
-
-/**
- * <p>This exception is returned as a warning by <code>getWarning()</code>
- * method on the <code>Results</code> object. This object holds a list of
- * <code>SourceFailureDetails</code> objects. It constructs a warning message
- * from the failure details for each atomic query detailing the data sources
- * against which the query failed.</p>
- */
-
-public class PartialResultsException extends MetaMatrixProcessingException {
-
- private static final String NEW_LINE = System.getProperty("line.separator"); //$NON-NLS-1$
- private static final String EMPTY_STR = ""; //$NON-NLS-1$
- private Collection failureList; // Collection of source failure details
-
- /**
- * <p>Construct a default instance of this class.</p>
- */
- public PartialResultsException() {
- super(EMPTY_STR);
- failureList = new ArrayList();
- }
-
- /**
- * <p>This method is used to add <code>SourceFailureDetails</code> objects
- * for each atomic query failure.</p>
- * @param details A <code>SourceFailureDetails</code> object
- */
- public void addSourceFailure(SourceFailureDetails details) {
- failureList.add(details);
- }
-
- /**
- * <p>Get's a collection of <code>SourceFailureDetails</code> objects</p>
- * @return A List containing <code>SourceFailureDetails</code> objects
- */
- public Collection getSourceFailureDetails() {
- return failureList;
- }
-
- /**
- * <p>This method returns a warning message detailing the data sources
- * against which the query failed. The message details the connector binding
- * name, model name and the actual exception message for each atomic query
- * failure.</p>
- * @return A Warning message detailing atomic query failures.
- */
- public String getMessage() {
-
- Iterator failureIter = failureList.iterator();
- StringBuffer warningBuf = new StringBuffer(AdminPlugin.Util.getString("PartialResultsException.WARNING__There_were_failures_while_processing_the_query")); //$NON-NLS-1$
- warningBuf.append(NEW_LINE);
- while(failureIter.hasNext()) {
- SourceFailureDetails details = (SourceFailureDetails) failureIter.next();
- warningBuf.append(details);
- warningBuf.append(NEW_LINE);
- }
-
- return warningBuf.toString();
- }
-
- /**
- * @see java.io.Externalizable#readExternal(java.io.ObjectInput)
- */
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- super.readExternal(in);
- failureList = (Collection)in.readObject();
- }
-
- /**
- * @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
- */
- public void writeExternal(ObjectOutput out) throws IOException {
- super.writeExternal(out);
- out.writeObject(failureList);
- }
-
-} // END CLASS
Deleted: trunk/client/src/main/java/com/metamatrix/dqp/exception/SourceFailureDetails.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/dqp/exception/SourceFailureDetails.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/client/src/main/java/com/metamatrix/dqp/exception/SourceFailureDetails.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -1,105 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.dqp.exception;
-
-import com.metamatrix.api.exception.MetaMatrixException;
-
-/**
- * <p> This class is used to store the details of an atomic query failure,
- * when the query is run in partial results mode. It stores model name
- * on which the atomic query is based, name of the connector binding for
- * the data source against which the atomic query is executed, and the
- * actual exception thrown when the atomic query is executed.</p>
- */
-
-public class SourceFailureDetails implements java.io.Serializable {
-
-
- private String modelName = "UNKNOWN"; // variable stores the name of the model for the atomic query //$NON-NLS-1$
-
- private String connectorBindingName = "UNKNOWN"; // variable stores name of the connector binding //$NON-NLS-1$
-
- private MetaMatrixException exception; // exception thrown executing the atomic query
-
- /**
- * <p>Constructor that stores atomic query failure details.</p>
- * @param model Name of the model for the atomic query
- * @param connectorBinding Name of the connector binding name for the atomic query
- * @param ex Exception thrown when atomic query fails
- */
- public SourceFailureDetails(String model, String connectorBinding, MetaMatrixException ex) {
-
- if(model != null) {
- this.modelName = model;
- }
- if(connectorBinding != null) {
- this.connectorBindingName = connectorBinding;
- }
- this.exception = ex;
- }
-
- /**
- * <p>Get's the model name for the atomic query.</p>
- * @return The name of the model
- */
- public String getModelName() {
- return modelName;
- }
-
- /**
- * <p>Get's the connector binding name for the atomic query.</p>
- * @return The Connector Binding Name
- */
- public String getConnectorBindingName() {
- return connectorBindingName;
- }
-
- /**
- * <p>Get's the exception thrown when an atomic query fails.</p>
- * @return An exception representing atomic query failure
- */
- public MetaMatrixException getException() {
- return exception;
- }
-
- /**
- * <p>Gets a message detailing the source against which the atomic query failed.</p>
- * @return Message containing details of the source for which there is a failure.
- */
- public String toString() {
-
- StringBuffer warningBuf = new StringBuffer();
-
- warningBuf.append("Error querying the connector with binding name "); //$NON-NLS-1$
- warningBuf.append(connectorBindingName);
- warningBuf.append(" for the model "); //$NON-NLS-1$
- warningBuf.append(modelName);
- warningBuf.append(" : "); //$NON-NLS-1$
- if(exception != null) {
- warningBuf.append(exception.getMessage());
- }
-
- return warningBuf.toString();
- }
-
-} // END CLASS
Copied: trunk/client/src/main/java/com/metamatrix/dqp/exception/SourceWarning.java (from rev 465, trunk/client/src/main/java/com/metamatrix/dqp/exception/SourceFailureDetails.java)
===================================================================
--- trunk/client/src/main/java/com/metamatrix/dqp/exception/SourceWarning.java (rev 0)
+++ trunk/client/src/main/java/com/metamatrix/dqp/exception/SourceWarning.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -0,0 +1,98 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.dqp.exception;
+
+import com.metamatrix.api.exception.MetaMatrixException;
+
+/**
+ * <p> This class is used to store the details of an atomic query warning.
+ * It stores model name on which the atomic query is based, name of the
+ * connector binding for the data source against which the atomic query
+ * is executed, and the actual exception thrown when the atomic
+ * query is executed.</p>
+ */
+
+public class SourceWarning extends MetaMatrixException {
+
+ private String modelName = "UNKNOWN"; // variable stores the name of the model for the atomic query //$NON-NLS-1$
+ private String connectorBindingName = "UNKNOWN"; // variable stores name of the connector binding //$NON-NLS-1$
+ private boolean partialResults;
+
+ /**
+ * <p>Constructor that stores atomic query failure details.</p>
+ * @param model Name of the model for the atomic query
+ * @param connectorBinding Name of the connector binding name for the atomic query
+ * @param ex Exception thrown when atomic query fails
+ */
+ public SourceWarning(String model, String connectorBinding, Throwable ex, boolean partialResults) {
+ super(ex);
+ if(model != null) {
+ this.modelName = model;
+ }
+ if(connectorBinding != null) {
+ this.connectorBindingName = connectorBinding;
+ }
+ this.partialResults = partialResults;
+ }
+
+ /**
+ * <p>Get's the model name for the atomic query.</p>
+ * @return The name of the model
+ */
+ public String getModelName() {
+ return modelName;
+ }
+
+ /**
+ * <p>Get's the connector binding name for the atomic query.</p>
+ * @return The Connector Binding Name
+ */
+ public String getConnectorBindingName() {
+ return connectorBindingName;
+ }
+
+ public boolean isPartialResultsError() {
+ return partialResults;
+ }
+
+ /**
+ * <p>Gets a message detailing the source against which the atomic query failed.</p>
+ * @return Message containing details of the source for which there is a failure.
+ */
+ public String toString() {
+ StringBuffer warningBuf = new StringBuffer();
+ if (partialResults) {
+ warningBuf.append("Error ");
+ } else {
+ warningBuf.append("Warning ");
+ }
+ warningBuf.append("querying the connector with binding name "); //$NON-NLS-1$
+ warningBuf.append(connectorBindingName);
+ warningBuf.append(" for the model "); //$NON-NLS-1$
+ warningBuf.append(modelName);
+ warningBuf.append(" : "); //$NON-NLS-1$
+ warningBuf.append(this.getCause());
+ return warningBuf.toString();
+ }
+
+} // END CLASS
Property changes on: trunk/client/src/main/java/com/metamatrix/dqp/exception/SourceWarning.java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: trunk/client/src/main/java/com/metamatrix/dqp/message/ResultsMessage.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/dqp/message/ResultsMessage.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/client/src/main/java/com/metamatrix/dqp/message/ResultsMessage.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -54,7 +54,7 @@
private MetaMatrixException exception;
/** Warning could be schema validation errors or partial results warnings */
- private List warnings;
+ private List<Exception> warnings;
/** Schemas associated with xml results. */
private Collection schemas;
@@ -260,7 +260,7 @@
/**
* @param list
*/
- public void setWarnings(List list) {
+ public void setWarnings(List<Exception> list) {
warnings = list;
}
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMPreparedStatement.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMPreparedStatement.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMPreparedStatement.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -259,7 +259,7 @@
} else {
// save warnings if have any
if (resultsWarning != null) {
- setWarnings(resultsWarning);
+ accumulateWarnings(resultsWarning);
}
// wrap results into ResultSet, only one update count
resultSet = new MMResultSet(resultsMsg, this);
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMResultSet.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMResultSet.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMResultSet.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -81,8 +81,6 @@
private com.metamatrix.jdbc.api.ResultSetMetaData rmetadata;
// Statement that causes this results
private MMStatement statement;
- // Warning could be schema validation errors or partial results warnings,
- private List warnings;
// This object represents the time when command is submitted to the server.
private java.util.Date processingTimestamp;
@@ -389,13 +387,7 @@
checkClosed(); // check to see if the ResultSet is closed
}
- /**
- * There is no concept of warnings in metamatrix. This method is implemented
- * to do nothing
- *
- * @throws SQLException
- * , should never occur
- */
+ @Override
public void clearWarnings() throws SQLException {
// do nothing
checkClosed(); // check to see if the ResultSet is closed
@@ -1093,13 +1085,7 @@
protected void setResultsData(ResultsMessage resultsMsg) {
this.completedTimestamp = resultsMsg.getCompletedTimestamp();
- if (resultsMsg.getWarnings() != null) {
- if (this.warnings == null) {
- this.warnings = resultsMsg.getWarnings();
- } else {
- this.warnings.addAll(resultsMsg.getWarnings());
- }
- }
+ this.statement.accumulateWarnings(resultsMsg.getWarnings());
}
/**
@@ -1164,10 +1150,6 @@
public SQLWarning getWarnings() throws SQLException {
checkClosed();
- // if the query is run in partial results mode
- if (warnings != null) {
- return WarningUtil.convertWarnings(warnings);
- }
return null;
}
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMStatement.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMStatement.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/MMStatement.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -135,8 +135,7 @@
// exception by metamatrix server, may also thrown by partial mode
private MMSQLException serverException;
- // warnings by validation XML schema or partial mode
- private List serverWarnings;
+ private List<Exception> serverWarnings;
// the per-execution security payload
private Serializable payload;
@@ -442,7 +441,7 @@
// save warnings if have any
if (resultsWarning != null) {
- setWarnings(resultsWarning);
+ accumulateWarnings(resultsWarning);
}
//create out/return parameter index map if there is any
@@ -706,9 +705,14 @@
return rowsAffected;
}
-
- protected void setWarnings(List serverWarnings) {
- this.serverWarnings = serverWarnings;
+ protected void accumulateWarnings(List<Exception> serverWarnings) {
+ if (serverWarnings == null || serverWarnings.isEmpty()) {
+ return;
+ }
+ if (this.serverWarnings == null) {
+ this.serverWarnings = new ArrayList<Exception>();
+ }
+ this.serverWarnings.addAll(serverWarnings);
}
/**
Modified: trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/WarningUtil.java
===================================================================
--- trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/WarningUtil.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/client-jdbc/src/main/java/com/metamatrix/jdbc/WarningUtil.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -23,13 +23,9 @@
package com.metamatrix.jdbc;
import java.sql.SQLWarning;
-import java.util.*;
-import java.util.Collection;
-import java.util.Iterator;
+import java.util.List;
-import com.metamatrix.api.exception.MetaMatrixException;
-import com.metamatrix.dqp.exception.PartialResultsException;
-import com.metamatrix.dqp.exception.SourceFailureDetails;
+import com.metamatrix.dqp.exception.SourceWarning;
import com.metamatrix.jdbc.api.PartialResultsWarning;
/**
@@ -47,84 +43,38 @@
* @param ex Throwable object which needs to be wrapped.
*/
static SQLWarning createWarning(Throwable ex) {
- if(ex instanceof PartialResultsException) {
- return convertToWarning((PartialResultsException)ex);
+ if(ex instanceof SourceWarning) {
+ SourceWarning exception = (SourceWarning)ex;
+ if (exception.isPartialResultsError()) {
+ PartialResultsWarning warning = new PartialResultsWarning(JDBCPlugin.Util.getString("WarningUtil.Failures_occurred")); //$NON-NLS-1$
+ warning.addConnectorFailure(exception.getConnectorBindingName(), MMSQLException.create(exception));
+ return warning;
+ }
}
- return new SQLWarning(ex.getMessage());
+ return new SQLWarning(ex);
}
/**
- * Get child exception based on type of parent
- * @param parent Exception parent
- * @return Child if there is one or null otherwise
- */
- static Throwable getChildException(Throwable parent) {
- Throwable exception;
- if (parent instanceof MetaMatrixException) {
- exception = ((MetaMatrixException) parent).getChild();
- } else if (parent instanceof SQLWarning) {
- exception = ((SQLWarning) parent).getNextException();
- } else {
- exception = null;
- }
- return exception;
- }
-
- /**
- * Used to convert a PartialResultsException into a PartialResultsWarning
- * @param exception The source exception sent from the server
- * @return The warning that is being sent to the user
- */
- static PartialResultsWarning convertToWarning(PartialResultsException exception) {
- PartialResultsWarning warning = new PartialResultsWarning(JDBCPlugin.Util.getString("WarningUtil.Failures_occurred")); //$NON-NLS-1$
-
- Collection failures = exception.getSourceFailureDetails();
- for(Iterator iter = failures.iterator(); iter.hasNext(); ) {
- SourceFailureDetails details = (SourceFailureDetails) iter.next();
- String connectorName = details.getConnectorBindingName();
- MetaMatrixException sourceEx = details.getException();
-
- warning.addConnectorFailure(connectorName, MMSQLException.create(sourceEx));
- }
-
- return warning;
- }
-
- /**
* Convert a List of warnings from the server into a single SQLWarning chain.
* @param exceptions List of exceptions from server
* @return Chain of SQLWarning corresponding to list of exceptions
*/
- static SQLWarning convertWarnings(List exceptions) {
+ static SQLWarning convertWarnings(List<Exception> exceptions) {
if(exceptions == null || exceptions.size() == 0) {
return null;
- } else if(exceptions.size() == 1) {
- return createWarning((Exception) exceptions.get(0));
- } else {
- Iterator exIter = exceptions.iterator();
- SQLWarning warning = null;
+ }
+ SQLWarning warning = null;
- Throwable childException = (Throwable) exIter.next(); // child exception or warning
- while(childException != null) {
- SQLWarning newWarning = createWarning(childException);
- if(warning == null) {
- warning = newWarning;
- } else {
- // This call can be made multiple times - it adds the next exception to
- // the END of the chain (which is quite tricky)
- warning.setNextWarning(newWarning);
- }
-
- // Walk chain or switch to next exception in iterator
- childException = getChildException(childException);
- if(childException == null && exIter.hasNext()) {
- childException = (Throwable) exIter.next();
- }
+ for (Exception ex : exceptions) {
+ SQLWarning newWarning = createWarning(ex);
+ if(warning == null) {
+ warning = newWarning;
+ } else {
+ warning.setNextWarning(newWarning);
}
-
- return warning;
}
+
+ return warning;
}
-
}
Modified: trunk/connector-api/src/main/java/com/metamatrix/connector/api/ConnectorLogger.java
===================================================================
--- trunk/connector-api/src/main/java/com/metamatrix/connector/api/ConnectorLogger.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connector-api/src/main/java/com/metamatrix/connector/api/ConnectorLogger.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -48,21 +48,70 @@
void logWarning( String message );
/**
+ * Log a warning message.
+ * @param message The message
+ */
+ void logWarning( String message, Throwable error );
+
+ /**
* Log an informational message.
* @param message The message
*/
void logInfo( String message );
/**
+ * Log an informational message.
+ * @param message The message
+ */
+ void logInfo( String message, Throwable error);
+
+ /**
* Log a detail debugging message.
* @param message The message
*/
void logDetail( String message );
/**
+ * Log a detail debugging message.
+ * @param message The message
+ */
+ void logDetail( String message, Throwable error );
+
+ /**
* Log a trace debugging message.
* @param message The message
*/
void logTrace( String message );
+
+ /**
+ * Log a trace debugging message.
+ * @param message The message
+ */
+ void logTrace( String message, Throwable error );
+ /**
+ * @return true if error logging is enabled
+ */
+ boolean isErrorEnabled();
+
+ /**
+ * @return true if warning logging is enabled
+ */
+ boolean isWarningEnabled();
+
+ /**
+ * @return true if info logging is enabled
+ */
+ boolean isInfoEnabled();
+
+ /**
+ * @return true if detail logging is enabled
+ */
+ boolean isDetailEnabled();
+
+ /**
+ * @return true if trace logging is enabled
+ */
+ boolean isTraceEnabled();
+
}
Modified: trunk/connector-api/src/main/java/com/metamatrix/connector/api/Execution.java
===================================================================
--- trunk/connector-api/src/main/java/com/metamatrix/connector/api/Execution.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connector-api/src/main/java/com/metamatrix/connector/api/Execution.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -22,6 +22,8 @@
package com.metamatrix.connector.api;
+import java.util.List;
+
import com.metamatrix.connector.exception.ConnectorException;
/**
@@ -46,7 +48,16 @@
*/
void cancel() throws ConnectorException;
+ /**
+ * Execute the associated command. Results will be retrieved through a specific sub-interface call.
+ * @throws ConnectorException
+ */
void execute() throws ConnectorException;
-
- //List<ConnectorException> getWarnings();
+
+ /**
+ * Get and clear the warnings for this execution. Will be called
+ * each time results are retrieved.
+ * @return a List of ConnectorExceptions or null if there are no warnings
+ */
+ List<Exception> getWarnings();
}
Modified: trunk/connector-api/src/main/java/com/metamatrix/connector/basic/BasicConnection.java
===================================================================
--- trunk/connector-api/src/main/java/com/metamatrix/connector/basic/BasicConnection.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connector-api/src/main/java/com/metamatrix/connector/basic/BasicConnection.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -1,6 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
package com.metamatrix.connector.basic;
-import com.metamatrix.connector.api.Connection;
+import com.metamatrix.connector.api.ConnectorCapabilities;
import com.metamatrix.connector.api.Execution;
import com.metamatrix.connector.api.ExecutionContext;
import com.metamatrix.connector.api.ProcedureExecution;
@@ -11,8 +33,9 @@
import com.metamatrix.connector.language.IProcedure;
import com.metamatrix.connector.language.IQueryCommand;
import com.metamatrix.connector.metadata.runtime.RuntimeMetadata;
+import com.metamatrix.connector.pool.PoolAwareConnection;
-public abstract class BasicConnection implements Connection {
+public abstract class BasicConnection implements PoolAwareConnection {
@Override
public Execution createExecution(ICommand command,
@@ -39,4 +62,19 @@
throw new ConnectorException("Unsupported Execution");
}
+ @Override
+ public boolean isAlive() {
+ return true;
+ }
+
+ @Override
+ public void closeCalled() {
+
+ }
+
+ @Override
+ public ConnectorCapabilities getCapabilities() {
+ return null;
+ }
+
}
Added: trunk/connector-api/src/main/java/com/metamatrix/connector/basic/BasicExecution.java
===================================================================
--- trunk/connector-api/src/main/java/com/metamatrix/connector/basic/BasicExecution.java (rev 0)
+++ trunk/connector-api/src/main/java/com/metamatrix/connector/basic/BasicExecution.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.connector.basic;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import com.metamatrix.connector.api.Execution;
+
+public abstract class BasicExecution implements Execution {
+
+ private List<Exception> warnings = new LinkedList<Exception>();
+
+ /**
+ * Add an exception as a warning to this Execution.
+ */
+ public void addWarning(Exception ex) {
+ if (ex == null) {
+ return;
+ }
+ this.warnings.add(ex);
+ }
+
+ @Override
+ public List<Exception> getWarnings() {
+ List<Exception> result = new ArrayList<Exception>(warnings);
+ warnings.clear();
+ return result;
+ }
+
+}
Property changes on: trunk/connector-api/src/main/java/com/metamatrix/connector/basic/BasicExecution.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/connector-metadata/src/main/java/com/metamatrix/connector/metadata/MetadataProcedureExecution.java
===================================================================
--- trunk/connector-metadata/src/main/java/com/metamatrix/connector/metadata/MetadataProcedureExecution.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connector-metadata/src/main/java/com/metamatrix/connector/metadata/MetadataProcedureExecution.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -27,6 +27,7 @@
import com.metamatrix.connector.api.DataNotAvailableException;
import com.metamatrix.connector.api.ProcedureExecution;
+import com.metamatrix.connector.basic.BasicExecution;
import com.metamatrix.connector.exception.ConnectorException;
import com.metamatrix.connector.language.IParameter;
import com.metamatrix.connector.language.IProcedure;
@@ -39,7 +40,7 @@
/**
* @since 4.2
*/
-public class MetadataProcedureExecution implements ProcedureExecution {
+public class MetadataProcedureExecution extends BasicExecution implements ProcedureExecution {
private final RuntimeMetadata metadata;
private final ObjectProcedureProcessor processor;
Modified: trunk/connector-metadata/src/main/java/com/metamatrix/connector/metadata/adapter/ObjectConnection.java
===================================================================
--- trunk/connector-metadata/src/main/java/com/metamatrix/connector/metadata/adapter/ObjectConnection.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connector-metadata/src/main/java/com/metamatrix/connector/metadata/adapter/ObjectConnection.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -22,7 +22,6 @@
package com.metamatrix.connector.metadata.adapter;
-import com.metamatrix.connector.api.ConnectorCapabilities;
import com.metamatrix.connector.api.ConnectorEnvironment;
import com.metamatrix.connector.api.ExecutionContext;
import com.metamatrix.connector.api.ProcedureExecution;
@@ -67,13 +66,6 @@
return connector.getMetadataObjectSource(executionContext);
}
- /*
- * @see com.metamatrix.data.Connection#getCapabilities()
- */
- public ConnectorCapabilities getCapabilities() {
- return null;
- }
-
@Override
public void close() {
}
Modified: trunk/connector-metadata/src/main/java/com/metamatrix/connector/metadata/adapter/ObjectSynchExecution.java
===================================================================
--- trunk/connector-metadata/src/main/java/com/metamatrix/connector/metadata/adapter/ObjectSynchExecution.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connector-metadata/src/main/java/com/metamatrix/connector/metadata/adapter/ObjectSynchExecution.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -27,6 +27,7 @@
import com.metamatrix.connector.api.DataNotAvailableException;
import com.metamatrix.connector.api.ResultSetExecution;
+import com.metamatrix.connector.basic.BasicExecution;
import com.metamatrix.connector.exception.ConnectorException;
import com.metamatrix.connector.language.IQuery;
import com.metamatrix.connector.metadata.MetadataConnectorPlugin;
@@ -40,7 +41,7 @@
* Adapter to expose the object processing logic via the standard connector API.
* Makes the batches coming from the objectSource match the batch sizes requested by the caller.
*/
-public class ObjectSynchExecution implements ResultSetExecution {
+public class ObjectSynchExecution extends BasicExecution implements ResultSetExecution {
private final RuntimeMetadata metadata;
private ObjectQueryProcessor processor;
Modified: trunk/connector-sdk/src/main/java/com/metamatrix/cdk/api/SysLogger.java
===================================================================
--- trunk/connector-sdk/src/main/java/com/metamatrix/cdk/api/SysLogger.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connector-sdk/src/main/java/com/metamatrix/cdk/api/SysLogger.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -101,4 +101,49 @@
log(TRACE, message, null);
}
+ @Override
+ public boolean isDetailEnabled() {
+ return DETAIL <= this.logLevel;
+ }
+
+ @Override
+ public boolean isErrorEnabled() {
+ return ERROR <= this.logLevel;
+ }
+
+ @Override
+ public boolean isInfoEnabled() {
+ return INFO <= this.logLevel;
+ }
+
+ @Override
+ public boolean isTraceEnabled() {
+ return TRACE <= this.logLevel;
+ }
+
+ @Override
+ public boolean isWarningEnabled() {
+ return WARNING <= this.logLevel;
+ }
+
+ @Override
+ public void logDetail(String message, Throwable error) {
+ log(DETAIL, message, error);
+ }
+
+ @Override
+ public void logInfo(String message, Throwable error) {
+ log(INFO, message, error);
+ }
+
+ @Override
+ public void logTrace(String message, Throwable error) {
+ log(TRACE, message, error);
+ }
+
+ @Override
+ public void logWarning(String message, Throwable error) {
+ log(WARNING, message, error);
+ }
+
}
Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCBaseExecution.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCBaseExecution.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCBaseExecution.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -26,6 +26,7 @@
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
+import java.sql.SQLWarning;
import java.sql.Statement;
import java.util.Iterator;
import java.util.List;
@@ -34,6 +35,7 @@
import com.metamatrix.common.util.PropertiesUtils;
import com.metamatrix.connector.api.ConnectorLogger;
import com.metamatrix.connector.api.ExecutionContext;
+import com.metamatrix.connector.basic.BasicExecution;
import com.metamatrix.connector.exception.ConnectorException;
import com.metamatrix.connector.jdbc.extension.ResultsTranslator;
import com.metamatrix.connector.jdbc.extension.SQLTranslator;
@@ -43,7 +45,7 @@
/**
*/
-public abstract class JDBCBaseExecution {
+public abstract class JDBCBaseExecution extends BasicExecution {
// ===========================================================================================================================
// Fields
@@ -185,7 +187,7 @@
TranslatedCommand translatedCommand = new TranslatedCommand(context, sqlTranslator);
translatedCommand.translateCommand(command);
- if (translatedCommand.getSql() != null) {
+ if (translatedCommand.getSql() != null && this.logger.isDetailEnabled()) {
this.logger.logDetail("Source-specific command: " + translatedCommand.getSql()); //$NON-NLS-1$
}
@@ -271,4 +273,18 @@
public SQLTranslator getSqlTranslator() {
return sqlTranslator;
}
+
+ public void addStatementWarnings() throws SQLException {
+ SQLWarning warning = this.statement.getWarnings();
+ while (warning != null) {
+ SQLWarning toAdd = warning;
+ warning = toAdd.getNextWarning();
+ toAdd.setNextException(null);
+ if (logger.isDetailEnabled()) {
+ logger.logDetail(context.getRequestIdentifier() + " Warning: ", warning); //$NON-NLS-1$
+ }
+ addWarning(toAdd);
+ }
+ this.statement.clearWarnings();
+ }
}
Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCProcedureExecution.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCProcedureExecution.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCProcedureExecution.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -96,19 +96,12 @@
parameterIndexMap = createParameterIndexMap(procedure.getParameters(), sql);
CallableStatement cstmt = getCallableStatement(sql);
results = resultsTranslator.executeStoredProcedure(cstmt, translatedComm);
- if (cstmt.getWarnings() != null) {
- logger.logDetail(StringUtil.getStackTrace(cstmt.getWarnings()));
- }
if (results != null) {
initResultSetInfo();
}
+ addStatementWarnings();
}catch(SQLException e){
- // try to cleanup the statement and may be resultset object
- close();
-
- logger.logError(JDBCPlugin.Util.getString("JDBCQueryExecution.Error_executing_query__1", sql)); //$NON-NLS-1$
- // Defect 15316 - always unroll SQLExceptions
- throw new ConnectorException(e);
+ throw new ConnectorException(e, JDBCPlugin.Util.getString("JDBCQueryExecution.Error_executing_query__1", sql));
}
}
Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCQueryExecution.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCQueryExecution.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCQueryExecution.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -117,13 +117,10 @@
throw new ConnectorException(
JDBCPlugin.Util.getString("JDBCSynchExecution.Statement_type_not_support_for_command_1", new Integer(translatedComm.getStatementType()), sql)); //$NON-NLS-1$
}
-
+ addStatementWarnings();
initResultSetInfo();
} catch (SQLException e) {
- // try to cleanup the statement and may be resultset object
- close();
-
throw createAndLogError(e, translatedComm);
}
}
@@ -197,7 +194,7 @@
/**
* @see com.metamatrix.connector.jdbc.JDBCBaseExecution#close()
*/
- public synchronized void close() throws ConnectorException {
+ public void close() throws ConnectorException {
// first we would need to close the result set here then we can close
// the statement, using the base class.
if (results != null) {
Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCSourceConnection.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCSourceConnection.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCSourceConnection.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -27,7 +27,6 @@
import java.sql.SQLException;
import java.util.Properties;
-import com.metamatrix.connector.api.ConnectorCapabilities;
import com.metamatrix.connector.api.ConnectorEnvironment;
import com.metamatrix.connector.api.ConnectorLogger;
import com.metamatrix.connector.api.ExecutionContext;
@@ -113,13 +112,6 @@
}
}
- /*
- * @see com.metamatrix.data.Connection#getCapabilities()
- */
- public ConnectorCapabilities getCapabilities() {
- return null;
- }
-
@Override
public ResultSetExecution createResultSetExecution(IQueryCommand command,
ExecutionContext executionContext, RuntimeMetadata metadata)
Modified: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCUpdateExecution.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCUpdateExecution.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCUpdateExecution.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -182,6 +182,7 @@
}
PreparedStatement stmt = getPreparedStatement(sql);
updateCount = resultsTranslator.executeStatementForBulkInsert(this.connection, stmt, translatedComm);
+ addStatementWarnings();
succeeded = true;
} catch (SQLException e) {
throw createAndLogError(e, translatedComm);
@@ -198,6 +199,7 @@
List commands) throws ConnectorException {
try {
int[] batchResults = statement.executeBatch();
+ addStatementWarnings();
for (int j = 0; j < batchResults.length; j++) {
results[commandCount - 1 - j] = batchResults[batchResults.length - 1 - j];
}
@@ -217,18 +219,21 @@
String sql = translatedComm.getSql();
try {
+ int updateCount;
if (translatedComm.getStatementType() == TranslatedCommand.STMT_TYPE_STATEMENT) {
- return getStatement().executeUpdate(sql);
+ updateCount = getStatement().executeUpdate(sql);
} else if (translatedComm.getStatementType() == TranslatedCommand.STMT_TYPE_PREPARED_STATEMENT) {
PreparedStatement pstatement = getPreparedStatement(sql);
resultsTranslator.bindPreparedStatementValues(this.connection, pstatement, translatedComm);
- return pstatement.executeUpdate();
+ updateCount = pstatement.executeUpdate();
} else {
throw new ConnectorException(
JDBCPlugin.Util.getString("JDBCSynchExecution.Statement_type_not_support_for_command_1", //$NON-NLS-1$
new Integer(translatedComm.getStatementType()),
sql));
}
+ addStatementWarnings();
+ return updateCount;
} catch (SQLException err) {
throw createError(err, translatedComm);
}
Modified: trunk/connectors/connector-ldap/src/main/java/com/metamatrix/connector/ldap/LDAPConnection.java
===================================================================
--- trunk/connectors/connector-ldap/src/main/java/com/metamatrix/connector/ldap/LDAPConnection.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connectors/connector-ldap/src/main/java/com/metamatrix/connector/ldap/LDAPConnection.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -29,7 +29,6 @@
import javax.naming.NamingException;
import javax.naming.ldap.InitialLdapContext;
-import com.metamatrix.connector.api.ConnectorCapabilities;
import com.metamatrix.connector.api.ConnectorLogger;
import com.metamatrix.connector.api.ExecutionContext;
import com.metamatrix.connector.api.ResultSetExecution;
@@ -173,11 +172,6 @@
return new LDAPUpdateExecution(command, executionContext, metadata, this.logger, this.initCtx);
}
- @Override
- public ConnectorCapabilities getCapabilities() {
- return null;
- }
-
/**
* Closes LDAP context, effectively closing the connection to LDAP.
* (non-Javadoc)
Modified: trunk/connectors/connector-ldap/src/main/java/com/metamatrix/connector/ldap/LDAPSyncQueryExecution.java
===================================================================
--- trunk/connectors/connector-ldap/src/main/java/com/metamatrix/connector/ldap/LDAPSyncQueryExecution.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connectors/connector-ldap/src/main/java/com/metamatrix/connector/ldap/LDAPSyncQueryExecution.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -98,6 +98,7 @@
import com.metamatrix.connector.api.ConnectorLogger;
import com.metamatrix.connector.api.ExecutionContext;
import com.metamatrix.connector.api.ResultSetExecution;
+import com.metamatrix.connector.basic.BasicExecution;
import com.metamatrix.connector.exception.ConnectorException;
import com.metamatrix.connector.language.IQuery;
import com.metamatrix.connector.metadata.runtime.Element;
@@ -107,7 +108,7 @@
* LDAPSyncQueryExecution is responsible for executing an LDAP search
* corresponding to a read-only "select" query from MetaMatrix.
*/
-public class LDAPSyncQueryExecution implements ResultSetExecution {
+public class LDAPSyncQueryExecution extends BasicExecution implements ResultSetExecution {
private ConnectorLogger logger;
private LDAPSearchDetails searchDetails;
Modified: trunk/connectors/connector-ldap/src/main/java/com/metamatrix/connector/ldap/LDAPUpdateExecution.java
===================================================================
--- trunk/connectors/connector-ldap/src/main/java/com/metamatrix/connector/ldap/LDAPUpdateExecution.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connectors/connector-ldap/src/main/java/com/metamatrix/connector/ldap/LDAPUpdateExecution.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -37,6 +37,7 @@
import com.metamatrix.connector.api.DataNotAvailableException;
import com.metamatrix.connector.api.ExecutionContext;
import com.metamatrix.connector.api.UpdateExecution;
+import com.metamatrix.connector.basic.BasicExecution;
import com.metamatrix.connector.exception.ConnectorException;
import com.metamatrix.connector.language.ICommand;
import com.metamatrix.connector.language.ICompareCriteria;
@@ -67,7 +68,7 @@
* item in the WHERE clause for UPDATE and DELETE operations, and in the list
* of attributes to assign values in an INSERT operation * Responsible for update/insert/delete operations against LDAP
*/
-public class LDAPUpdateExecution implements UpdateExecution {
+public class LDAPUpdateExecution extends BasicExecution implements UpdateExecution {
private ConnectorLogger logger;
private RuntimeMetadata rm;
private InitialLdapContext initialLdapContext;
Modified: trunk/connectors/connector-loopback/src/main/java/com/metamatrix/connector/loopback/LoopbackExecution.java
===================================================================
--- trunk/connectors/connector-loopback/src/main/java/com/metamatrix/connector/loopback/LoopbackExecution.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connectors/connector-loopback/src/main/java/com/metamatrix/connector/loopback/LoopbackExecution.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -39,6 +39,7 @@
import com.metamatrix.connector.api.ProcedureExecution;
import com.metamatrix.connector.api.TypeFacility;
import com.metamatrix.connector.api.UpdateExecution;
+import com.metamatrix.connector.basic.BasicExecution;
import com.metamatrix.connector.exception.ConnectorException;
import com.metamatrix.connector.language.ICommand;
import com.metamatrix.connector.language.IParameter;
@@ -48,7 +49,7 @@
/**
* Represents the execution of a command.
*/
-public class LoopbackExecution implements UpdateExecution, ProcedureExecution {
+public class LoopbackExecution extends BasicExecution implements UpdateExecution, ProcedureExecution {
private static final String ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; //$NON-NLS-1$
Modified: trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/connection/SalesforceConnection.java
===================================================================
--- trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/connection/SalesforceConnection.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/connection/SalesforceConnection.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -24,7 +24,6 @@
import java.net.URL;
import java.util.List;
-import com.metamatrix.connector.api.ConnectorCapabilities;
import com.metamatrix.connector.api.ConnectorEnvironment;
import com.metamatrix.connector.api.ExecutionContext;
import com.metamatrix.connector.api.ResultSetExecution;
@@ -88,11 +87,6 @@
}
@Override
- public ConnectorCapabilities getCapabilities() {
- return null;
- }
-
- @Override
public void close() {
}
Modified: trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/QueryExecutionImpl.java
===================================================================
--- trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/QueryExecutionImpl.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/QueryExecutionImpl.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -36,6 +36,7 @@
import com.metamatrix.connector.api.DataNotAvailableException;
import com.metamatrix.connector.api.ExecutionContext;
import com.metamatrix.connector.api.ResultSetExecution;
+import com.metamatrix.connector.basic.BasicExecution;
import com.metamatrix.connector.exception.ConnectorException;
import com.metamatrix.connector.language.IQueryCommand;
import com.metamatrix.connector.metadata.runtime.Element;
@@ -47,7 +48,7 @@
import com.sforce.soap.partner.QueryResult;
import com.sforce.soap.partner.sobject.SObject;
-public class QueryExecutionImpl implements ResultSetExecution {
+public class QueryExecutionImpl extends BasicExecution implements ResultSetExecution {
private SalesforceConnection connection;
Modified: trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/UpdateExecutionParent.java
===================================================================
--- trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/UpdateExecutionParent.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/UpdateExecutionParent.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -27,6 +27,7 @@
import com.metamatrix.connector.api.DataNotAvailableException;
import com.metamatrix.connector.api.ExecutionContext;
import com.metamatrix.connector.api.UpdateExecution;
+import com.metamatrix.connector.basic.BasicExecution;
import com.metamatrix.connector.exception.ConnectorException;
import com.metamatrix.connector.language.ICommand;
import com.metamatrix.connector.language.ICompareCriteria;
@@ -48,7 +49,7 @@
* get IDs of Salesforce objects.
*
*/
-public class UpdateExecutionParent implements UpdateExecution {
+public class UpdateExecutionParent extends BasicExecution implements UpdateExecution {
private SalesforceConnection connection;
private RuntimeMetadata metadata;
Modified: trunk/connectors/connector-text/src/main/java/com/metamatrix/connector/text/TextConnection.java
===================================================================
--- trunk/connectors/connector-text/src/main/java/com/metamatrix/connector/text/TextConnection.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connectors/connector-text/src/main/java/com/metamatrix/connector/text/TextConnection.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -25,7 +25,6 @@
import java.util.HashMap;
import java.util.Map;
-import com.metamatrix.connector.api.ConnectorCapabilities;
import com.metamatrix.connector.api.ConnectorEnvironment;
import com.metamatrix.connector.api.ExecutionContext;
import com.metamatrix.connector.api.ResultSetExecution;
@@ -67,11 +66,4 @@
metadataProps = null;
env.getLogger().logInfo("Text Connection is successfully closed."); //$NON-NLS-1$
}
-
- /*
- * @see com.metamatrix.data.Connection#getCapabilities()
- */
- public ConnectorCapabilities getCapabilities() {
- return null;
- }
}
Modified: trunk/connectors/connector-text/src/main/java/com/metamatrix/connector/text/TextSynchExecution.java
===================================================================
--- trunk/connectors/connector-text/src/main/java/com/metamatrix/connector/text/TextSynchExecution.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connectors/connector-text/src/main/java/com/metamatrix/connector/text/TextSynchExecution.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -42,6 +42,7 @@
import com.metamatrix.connector.api.DataNotAvailableException;
import com.metamatrix.connector.api.ResultSetExecution;
import com.metamatrix.connector.api.TypeFacility;
+import com.metamatrix.connector.basic.BasicExecution;
import com.metamatrix.connector.exception.ConnectorException;
import com.metamatrix.connector.language.ICommand;
import com.metamatrix.connector.language.IElement;
@@ -60,7 +61,7 @@
* The essential part that executes the query. It keeps all the execution
* states.
*/
-public class TextSynchExecution implements ResultSetExecution {
+public class TextSynchExecution extends BasicExecution implements ResultSetExecution {
// Command to be executed
private IQuery cmd;
Modified: trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/XMLConnectionImpl.java
===================================================================
--- trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/XMLConnectionImpl.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/XMLConnectionImpl.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -25,7 +25,6 @@
import java.io.Serializable;
-import com.metamatrix.connector.api.ConnectorCapabilities;
import com.metamatrix.connector.api.ConnectorEnvironment;
import com.metamatrix.connector.api.ConnectorLogger;
import com.metamatrix.connector.api.ExecutionContext;
@@ -71,10 +70,6 @@
}
///////////////////////////////////////////////////////////////
//Connection API Implementation
- public ConnectorCapabilities getCapabilities() {
- return null;
- }
-
@Override
public ResultSetExecution createResultSetExecution(IQueryCommand command,
ExecutionContext executionContext, RuntimeMetadata metadata)
Modified: trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/XMLExecutionImpl.java
===================================================================
--- trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/XMLExecutionImpl.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/XMLExecutionImpl.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -33,6 +33,7 @@
import com.metamatrix.connector.api.DataNotAvailableException;
import com.metamatrix.connector.api.ExecutionContext;
import com.metamatrix.connector.api.ResultSetExecution;
+import com.metamatrix.connector.basic.BasicExecution;
import com.metamatrix.connector.exception.ConnectorException;
import com.metamatrix.connector.language.IQuery;
import com.metamatrix.connector.metadata.runtime.RuntimeMetadata;
@@ -42,7 +43,7 @@
import com.metamatrix.connector.xml.XMLExecution;
import com.metamatrix.connector.xml.cache.IDocumentCache;
-public class XMLExecutionImpl implements ResultSetExecution, XMLExecution {
+public class XMLExecutionImpl extends BasicExecution implements ResultSetExecution, XMLExecution {
private XMLConnectionImpl m_conn;
Modified: trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/jms/JMSConnection.java
===================================================================
--- trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/jms/JMSConnection.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/jms/JMSConnection.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -35,7 +35,6 @@
import javax.naming.InitialContext;
import javax.naming.NamingException;
-import com.metamatrix.connector.api.ConnectorCapabilities;
import com.metamatrix.connector.api.ConnectorEnvironment;
import com.metamatrix.connector.api.ExecutionContext;
import com.metamatrix.connector.api.ResultSetExecution;
@@ -145,11 +144,6 @@
}
@Override
- public ConnectorCapabilities getCapabilities() {
- return null;
- }
-
- @Override
public void close() {
try {
jmsConnection.close();
Modified: trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/jms/JMSExecution.java
===================================================================
--- trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/jms/JMSExecution.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/jms/JMSExecution.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -38,6 +38,7 @@
import com.metamatrix.connector.api.DataNotAvailableException;
import com.metamatrix.connector.api.ExecutionContext;
import com.metamatrix.connector.api.ResultSetExecution;
+import com.metamatrix.connector.basic.BasicExecution;
import com.metamatrix.connector.exception.ConnectorException;
import com.metamatrix.connector.language.IQuery;
import com.metamatrix.connector.metadata.runtime.RuntimeMetadata;
@@ -53,7 +54,7 @@
import com.metamatrix.connector.xml.cache.IDocumentCache;
import com.metamatrix.connector.xml.soap.SOAPDocBuilder;
-public class JMSExecution implements ResultSetExecution, XMLExecution {
+public class JMSExecution extends BasicExecution implements ResultSetExecution, XMLExecution {
JMSConnection connection;
RuntimeMetadata metadata;
Modified: trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xmlsource/XMLSourceConnection.java
===================================================================
--- trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xmlsource/XMLSourceConnection.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xmlsource/XMLSourceConnection.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -22,7 +22,6 @@
package com.metamatrix.connector.xmlsource;
-import com.metamatrix.connector.api.ConnectorCapabilities;
import com.metamatrix.connector.api.ConnectorEnvironment;
import com.metamatrix.connector.basic.BasicConnection;
import com.metamatrix.connector.exception.ConnectorException;
@@ -43,13 +42,6 @@
this.env = env;
}
- /**
- * @see com.metamatrix.data.Connection#getCapabilities()
- */
- public ConnectorCapabilities getCapabilities() {
- return null;
- }
-
/**
* @see com.metamatrix.connector.api.Connection#release()
*/
Modified: trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xmlsource/XMLSourceExecution.java
===================================================================
--- trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xmlsource/XMLSourceExecution.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xmlsource/XMLSourceExecution.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -32,6 +32,7 @@
import com.metamatrix.connector.api.ConnectorEnvironment;
import com.metamatrix.connector.api.DataNotAvailableException;
import com.metamatrix.connector.api.ProcedureExecution;
+import com.metamatrix.connector.basic.BasicExecution;
import com.metamatrix.connector.exception.ConnectorException;
import com.metamatrix.connector.language.IParameter;
@@ -39,7 +40,7 @@
/**
* This is main class which will execute request in the XML Source
*/
-public abstract class XMLSourceExecution implements ProcedureExecution {
+public abstract class XMLSourceExecution extends BasicExecution implements ProcedureExecution {
// Connector environment
protected ConnectorEnvironment env;
Modified: trunk/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestLoggingInputStreamFilter.java
===================================================================
--- trunk/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestLoggingInputStreamFilter.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestLoggingInputStreamFilter.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -179,6 +179,60 @@
// TODO Auto-generated method stub
}
+
+ @Override
+ public boolean isDetailEnabled() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isErrorEnabled() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isInfoEnabled() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isTraceEnabled() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isWarningEnabled() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void logDetail(String message, Throwable error) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void logInfo(String message, Throwable error) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void logTrace(String message, Throwable error) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void logWarning(String message, Throwable error) {
+ // TODO Auto-generated method stub
+
+ }
}
}
Modified: trunk/connectors/sandbox/connector-exec/src/main/java/com/metamatrix/connector/exec/ExecAntExecution.java
===================================================================
--- trunk/connectors/sandbox/connector-exec/src/main/java/com/metamatrix/connector/exec/ExecAntExecution.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connectors/sandbox/connector-exec/src/main/java/com/metamatrix/connector/exec/ExecAntExecution.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -52,6 +52,7 @@
import com.metamatrix.connector.api.ConnectorLogger;
import com.metamatrix.connector.api.DataNotAvailableException;
import com.metamatrix.connector.api.ResultSetExecution;
+import com.metamatrix.connector.basic.BasicExecution;
import com.metamatrix.connector.exception.ConnectorException;
import com.metamatrix.connector.language.IQuery;
import com.metamatrix.connector.metadata.runtime.RuntimeMetadata;
@@ -62,7 +63,7 @@
/**
* Represents the execution of a command.
*/
-public class ExecAntExecution implements ResultSetExecution {
+public class ExecAntExecution extends BasicExecution implements ResultSetExecution {
private static final Random random = new Random(System.currentTimeMillis());
private static TempDirectory TEMPDIR = null;
Modified: trunk/connectors/sandbox/connector-exec/src/main/java/com/metamatrix/connector/exec/ExecConnection.java
===================================================================
--- trunk/connectors/sandbox/connector-exec/src/main/java/com/metamatrix/connector/exec/ExecConnection.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connectors/sandbox/connector-exec/src/main/java/com/metamatrix/connector/exec/ExecConnection.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -64,10 +64,4 @@
logger.logDetail("Exec Connection is successfully closed."); //$NON-NLS-1$
}
- /*
- * @see com.metamatrix.data.Connection#getCapabilities()
- */
- public ConnectorCapabilities getCapabilities() {
- return null;
- }
}
Modified: trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/ObjectConnection.java
===================================================================
--- trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/ObjectConnection.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/ObjectConnection.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -24,7 +24,6 @@
import com.metamatrix.admin.api.exception.AdminException;
-import com.metamatrix.connector.api.ConnectorCapabilities;
import com.metamatrix.connector.api.ConnectorEnvironment;
import com.metamatrix.connector.api.ConnectorLogger;
import com.metamatrix.connector.api.ExecutionContext;
@@ -90,14 +89,6 @@
return new ObjectProcedureExecution(command, getObjectSource(), translator, metadata, env);
}
- /*
- * @see com.metamatrix.data.Connection#getCapabilities()
- */
- public ConnectorCapabilities getCapabilities() {
- return null;
- }
-
-
/**
* @see com.metamatrix.connector.object.ObjectConnection#getAPI()
* @since 4.3
Modified: trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/ObjectProcedureExecution.java
===================================================================
--- trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/ObjectProcedureExecution.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/ObjectProcedureExecution.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -28,6 +28,7 @@
import com.metamatrix.connector.api.ConnectorLogger;
import com.metamatrix.connector.api.DataNotAvailableException;
import com.metamatrix.connector.api.ProcedureExecution;
+import com.metamatrix.connector.basic.BasicExecution;
import com.metamatrix.connector.exception.ConnectorException;
import com.metamatrix.connector.language.IParameter;
import com.metamatrix.connector.language.IProcedure;
@@ -41,7 +42,7 @@
/**
* @since 4.3
*/
-public class ObjectProcedureExecution implements ProcedureExecution {
+public class ObjectProcedureExecution extends BasicExecution implements ProcedureExecution {
private RuntimeMetadata metadata = null;
private IObjectSource api;
Modified: trunk/connectors/sandbox/connector-yahoo/src/main/java/com/metamatrix/connector/yahoo/YahooConnection.java
===================================================================
--- trunk/connectors/sandbox/connector-yahoo/src/main/java/com/metamatrix/connector/yahoo/YahooConnection.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connectors/sandbox/connector-yahoo/src/main/java/com/metamatrix/connector/yahoo/YahooConnection.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -22,7 +22,9 @@
package com.metamatrix.connector.yahoo;
-import com.metamatrix.connector.api.*;
+import com.metamatrix.connector.api.ConnectorEnvironment;
+import com.metamatrix.connector.api.ExecutionContext;
+import com.metamatrix.connector.api.ResultSetExecution;
import com.metamatrix.connector.basic.BasicConnection;
import com.metamatrix.connector.exception.ConnectorException;
import com.metamatrix.connector.language.IQuery;
@@ -44,13 +46,6 @@
this.env = env;
}
- /*
- * @see com.metamatrix.data.Connection#getCapabilities()
- */
- public ConnectorCapabilities getCapabilities() {
- return null;
- }
-
@Override
public ResultSetExecution createResultSetExecution(IQueryCommand command,
ExecutionContext executionContext, RuntimeMetadata metadata)
Modified: trunk/connectors/sandbox/connector-yahoo/src/main/java/com/metamatrix/connector/yahoo/YahooExecution.java
===================================================================
--- trunk/connectors/sandbox/connector-yahoo/src/main/java/com/metamatrix/connector/yahoo/YahooExecution.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/connectors/sandbox/connector-yahoo/src/main/java/com/metamatrix/connector/yahoo/YahooExecution.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -43,6 +43,7 @@
import com.metamatrix.connector.api.ConnectorLogger;
import com.metamatrix.connector.api.DataNotAvailableException;
import com.metamatrix.connector.api.ResultSetExecution;
+import com.metamatrix.connector.basic.BasicExecution;
import com.metamatrix.connector.exception.ConnectorException;
import com.metamatrix.connector.language.ICriteria;
import com.metamatrix.connector.language.IElement;
@@ -57,7 +58,7 @@
/**
* Represents the execution of a command.
*/
-public class YahooExecution implements ResultSetExecution {
+public class YahooExecution extends BasicExecution implements ResultSetExecution {
public static final String HTTP_PROXY_HOST = "HttpProxyHost"; //$NON-NLS-1$
public static final String HTTP_PROXY_PORT = "HttpProxyPort"; //$NON-NLS-1$
Modified: trunk/documentation/reference/src/main/docbook/en-US/content/federated_planning.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/federated_planning.xml 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/federated_planning.xml 2009-02-13 16:51:05 UTC (rev 467)
@@ -342,7 +342,7 @@
</warning>
<para> For each source that is excluded from a query, a warning
will be generated describing the source and the failure. These
- warnings can be obtained from the ResultSet.getWarnings()
+ warnings can be obtained from the Statement.getWarnings()
method. This method returns a SQLWarning object but in the
case of "partial results" warnings, this will be an object of
type com.metamatrix.jdbc.api.PartialResultsWarning. This class
@@ -354,7 +354,7 @@
</title>
<programlisting>statement.setExecutionProperty( PROP_PARTIAL_RESULTS_MODE, "true");
ResultSet results = statement.executeQuery("SELECT Name FROM Accounts");
-SQLWarning warning = results.getWarnings();
+SQLWarning warning = statement.getWarnings();
if(warning instanceof PartialResultsWarning) {
PartialResultsWarning partialWarning = (PartialResultsWarning)warning;
Collection failedConnectors = partialWarning.getFailedConnectors();
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/ConnectorWorkItem.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/ConnectorWorkItem.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/ConnectorWorkItem.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -331,6 +331,10 @@
}
return null;
}
+ @Override
+ public List<Exception> getWarnings() {
+ return exec.getWarnings();
+ }
};
}
@@ -389,7 +393,25 @@
}
if (sendResults) {
- sendResults(rows.toArray(new List[rows.size()]), (requestMsg.getCommand()).getProjectedSymbols());
+ int currentRowCount = rows.size();
+ if ( !lastBatch && currentRowCount == 0 ) {
+ // Defect 13366 - Should send all batches, even if they're zero size.
+ // Log warning if received a zero-size non-last batch from the connector.
+ LogManager.logWarning(LogConstants.CTX_CONNECTOR, DQPPlugin.Util.getString("ConnectorWorker.zero_size_non_last_batch", requestMsg.getConnectorID())); //$NON-NLS-1$
+ }
+
+ AtomicResultsMessage response = createResultsMessage(this.requestMsg, rows.toArray(new List[currentRowCount]), requestMsg.getCommand().getProjectedSymbols());
+
+ // if we need to keep the execution alive, then we can not support
+ // implicit close.
+ response.setSupportsImplicitClose(!this.securityContext.keepExecutionAlive());
+ response.setTransactional(this.securityContext.isTransactional());
+ response.setWarnings(this.execution.getWarnings());
+
+ if ( lastBatch ) {
+ response.setFinalRow(rowCount);
+ }
+ this.resultsReceiver.receiveResults(response);
}
}
@@ -403,36 +425,6 @@
handleBatch();
}
- protected void sendResults(List[] rows, List elements)
- throws CommunicationException {
-
- int currentRowCount = rows.length;
- if ( !lastBatch && currentRowCount == 0 ) {
- // Defect 13366 - Should send all batches, even if they're zero size.
- // Log warning if received a zero-size non-last batch from the connector.
- LogManager.logWarning(LogConstants.CTX_CONNECTOR, DQPPlugin.Util.getString("ConnectorWorker.zero_size_non_last_batch", requestMsg.getConnectorID())); //$NON-NLS-1$
- }
-
- AtomicResultsMessage response = createResultsMessage(this.requestMsg, rows, elements);
- response.setFirstRow(rowCount + 1 - currentRowCount);
- response.setLastRow(rowCount);
-
- // if we need to keep the execution alive, then we can not support
- // implicit close.
- response.setSupportsImplicitClose(!this.securityContext.keepExecutionAlive());
- response.setTransactional(this.securityContext.isTransactional());
-
- if ( lastBatch ) {
- response.setFinalRow(rowCount);
- response.setPartialResults(false);
- } else {
- response.setFinalRow(-1);
- response.setPartialResults(true);
- }
-
- this.resultsReceiver.receiveResults(response);
- }
-
public static AtomicResultsMessage createResultsMessage(AtomicRequestMessage message, List[] batch, List columnSymbols) {
String[] columnNames = new String[columnSymbols.size()];
String[] dataTypes = new String[columnSymbols.size()];
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/DefaultConnectorLogger.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/DefaultConnectorLogger.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/DefaultConnectorLogger.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -28,6 +28,7 @@
import com.metamatrix.common.log.LogManager;
import com.metamatrix.connector.api.ConnectorLogger;
+import com.metamatrix.core.log.MessageLevel;
import com.metamatrix.dqp.internal.datamgr.ConnectorID;
import com.metamatrix.dqp.util.LogConstants;
@@ -61,4 +62,49 @@
public void logTrace(String message) {
LogManager.logTrace(LogConstants.CTX_CONNECTOR, message);
}
+
+ @Override
+ public boolean isDetailEnabled() {
+ return LogManager.isMessageToBeRecorded(LogConstants.CTX_CONNECTOR, MessageLevel.DETAIL);
+ }
+
+ @Override
+ public boolean isErrorEnabled() {
+ return LogManager.isMessageToBeRecorded(LogConstants.CTX_CONNECTOR, MessageLevel.ERROR);
+ }
+
+ @Override
+ public boolean isInfoEnabled() {
+ return LogManager.isMessageToBeRecorded(LogConstants.CTX_CONNECTOR, MessageLevel.INFO);
+ }
+
+ @Override
+ public boolean isTraceEnabled() {
+ return LogManager.isMessageToBeRecorded(LogConstants.CTX_CONNECTOR, MessageLevel.TRACE);
+ }
+
+ @Override
+ public boolean isWarningEnabled() {
+ return LogManager.isMessageToBeRecorded(LogConstants.CTX_CONNECTOR, MessageLevel.WARNING);
+ }
+
+ @Override
+ public void logDetail(String message, Throwable error) {
+ LogManager.log(MessageLevel.DETAIL, LogConstants.CTX_CONNECTOR, error, message);
+ }
+
+ @Override
+ public void logInfo(String message, Throwable error) {
+ LogManager.log(MessageLevel.INFO, LogConstants.CTX_CONNECTOR, error, message);
+ }
+
+ @Override
+ public void logTrace(String message, Throwable error) {
+ LogManager.log(MessageLevel.TRACE, LogConstants.CTX_CONNECTOR, error, message);
+ }
+
+ @Override
+ public void logWarning(String message, Throwable error) {
+ LogManager.log(MessageLevel.WARNING, LogConstants.CTX_CONNECTOR, error, message);
+ }
}
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/internal/pooling/connector/PooledConnector.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/internal/pooling/connector/PooledConnector.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/internal/pooling/connector/PooledConnector.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -75,7 +75,9 @@
conn.close();
}
}
- environment.getLogger().logTrace("released connection for transaction " + transactionContext.getTxnID()); //$NON-NLS-1$
+ if (environment.getLogger().isTraceEnabled()) {
+ environment.getLogger().logTrace("released connection for transaction " + transactionContext.getTxnID()); //$NON-NLS-1$
+ }
}
public void beforeCompletion() {
@@ -131,7 +133,9 @@
synchronized (idToConnections) {
conn = idToConnections.get(transactionContext.getTxnID());
if (conn != null){
- environment.getLogger().logTrace("Transaction " + transactionContext.getTxnID() + " already has connection, using the same connection"); //$NON-NLS-1$ //$NON-NLS-2$
+ if (environment.getLogger().isTraceEnabled()) {
+ environment.getLogger().logTrace("Transaction " + transactionContext.getTxnID() + " already has connection, using the same connection"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
conn.lease();
return conn;
}
@@ -141,7 +145,9 @@
conn = xaPool.obtain(executionContext, transactionContext, true);
conn.lease();
if (transactionContext != null) {
- environment.getLogger().logTrace("Obtained new connection for transaction " + transactionContext.getTxnID()); //$NON-NLS-1$
+ if (environment.getLogger().isTraceEnabled()) {
+ environment.getLogger().logTrace("Obtained new connection for transaction " + transactionContext.getTxnID()); //$NON-NLS-1$
+ }
try { //add a synchronization to remove the map entry
transactionContext.getTransaction().registerSynchronization(new RemovalCallback(transactionContext, conn));
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/DataTierTupleSource.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/DataTierTupleSource.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/DataTierTupleSource.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -30,7 +30,7 @@
import com.metamatrix.common.buffer.TupleSource;
import com.metamatrix.common.comm.api.ResultsReceiver;
import com.metamatrix.core.util.Assertion;
-import com.metamatrix.dqp.exception.SourceFailureDetails;
+import com.metamatrix.dqp.exception.SourceWarning;
import com.metamatrix.dqp.internal.datamgr.ConnectorID;
import com.metamatrix.dqp.message.AtomicRequestMessage;
import com.metamatrix.dqp.message.AtomicResultsMessage;
@@ -172,7 +172,7 @@
nextBatch = new List[0];
nextBatchIsLast = true;
String connectorBindingName = dataMgr.getConnectorName(aqr.getConnectorBindingID());
- SourceFailureDetails sourceFailure = new SourceFailureDetails(this.aqr.getModelName(), connectorBindingName, new MetaMatrixComponentException(e));
+ SourceWarning sourceFailure = new SourceWarning(this.aqr.getModelName(), connectorBindingName, e, true);
workItem.addSourceFailureDetails(sourceFailure);
} else {
this.exception = e;
@@ -192,7 +192,6 @@
} else {
supportsImplicitClose = response.supportsImplicitClose();
isTransactional = response.isTransactional();
- aqr.setProcessingTimestamp(response.getProcessingTimestamp());
nextBatch = response.getResults();
nextBatchIsLast = response.getFinalRow() >= 0;
@@ -201,6 +200,13 @@
// reset waitingForData flag
waitingForData = false;
}
+ if (response.getWarnings() != null) {
+ String connectorBindingName = dataMgr.getConnectorName(aqr.getConnectorBindingID());
+ for (Exception warning : response.getWarnings()) {
+ SourceWarning sourceFailure = new SourceWarning(this.aqr.getModelName(), connectorBindingName, warning, true);
+ workItem.addSourceFailureDetails(sourceFailure);
+ }
+ }
if (removeRequest) {
workItem.closeAtomicRequest(this.aqr.getAtomicRequestID());
}
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/RequestWorkItem.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/RequestWorkItem.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/RequestWorkItem.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -36,6 +36,7 @@
import javax.transaction.SystemException;
import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.api.exception.MetaMatrixException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.common.buffer.BlockedException;
import com.metamatrix.common.buffer.BlockedOnMemoryException;
@@ -56,8 +57,7 @@
import com.metamatrix.core.log.MessageLevel;
import com.metamatrix.core.util.Assertion;
import com.metamatrix.dqp.DQPPlugin;
-import com.metamatrix.dqp.exception.PartialResultsException;
-import com.metamatrix.dqp.exception.SourceFailureDetails;
+import com.metamatrix.dqp.exception.SourceWarning;
import com.metamatrix.dqp.internal.cache.CacheID;
import com.metamatrix.dqp.internal.cache.CacheResults;
import com.metamatrix.dqp.internal.cache.ResultSetCache;
@@ -151,7 +151,7 @@
private Throwable processingException;
private Map<AtomicRequestID, DataTierTupleSource> connectorInfo = new ConcurrentHashMap<AtomicRequestID, DataTierTupleSource>(4);
// This exception contains details of all the atomic requests that failed when query is run in partial results mode.
- private PartialResultsException partialWarn;
+ private List<MetaMatrixException> warnings = new LinkedList<MetaMatrixException>();
private boolean doneProducingBatches;
protected boolean isClosed;
@@ -163,8 +163,6 @@
private Map<Integer, LobWorkItem> lobStreams = Collections.synchronizedMap(new HashMap<Integer, LobWorkItem>(4));
- private Object partialWarnLock = new Object();
-
public RequestWorkItem(DQPCore dqpCore, RequestMessage requestMsg, Request request, ResultsReceiver<ResultsMessage> receiver, RequestID requestID, DQPWorkContext workContext) {
this.requestMsg = requestMsg;
this.requestID = requestID;
@@ -457,16 +455,14 @@
response.setSchemas(this.schemas);
// send any warnings with the response object
- List responseWarnings = new ArrayList();
- List currentWarnings = processor.getAndClearWarnings();
+ List<Exception> responseWarnings = new ArrayList<Exception>();
+ List<Exception> currentWarnings = processor.getAndClearWarnings();
if (currentWarnings != null) {
responseWarnings.addAll(currentWarnings);
}
- synchronized (partialWarnLock) {
- if (this.partialWarn != null) {
- responseWarnings.add(partialWarn);
- this.partialWarn = null;
- }
+ synchronized (warnings) {
+ responseWarnings.addAll(this.warnings);
+ this.warnings.clear();
}
response.setWarnings(responseWarnings);
@@ -659,7 +655,7 @@
connectorInfo.remove(atomicRequestId);
LogManager.logTrace(LogConstants.CTX_DQP, new Object[] {"closed atomic-request:", atomicRequestId}); //$NON-NLS-1$
}
-
+
public void addConnectorRequest(AtomicRequestID atomicRequestId, DataTierTupleSource connInfo) {
connectorInfo.put(atomicRequestId, connInfo);
}
@@ -667,17 +663,13 @@
/**
* <p>This method add information to the warning on the work item for the given
* <code>RequestID</code>. This method is called from <code>DataTierManager</code></p>
- * @param details A <code>SourceFailureDetails</code> object, with atomic query failure details.
*/
- public void addSourceFailureDetails(SourceFailureDetails details) {
- synchronized (partialWarnLock) {
- if(this.partialWarn == null) {
- this.partialWarn = new PartialResultsException();
- }
- this.partialWarn.addSourceFailure(details);
+ public void addSourceFailureDetails(SourceWarning details) {
+ synchronized (warnings) {
+ this.warnings.add(details);
}
}
-
+
/**
* Log the command to the MM cmd log.
*/
@@ -732,8 +724,8 @@
return this.connectorInfo.get(id);
}
- PartialResultsException getPartialWarn() {
- return partialWarn;
+ public List<MetaMatrixException> getWarnings() {
+ return warnings;
}
@Override
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/message/AtomicResultsMessage.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/message/AtomicResultsMessage.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/message/AtomicResultsMessage.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -26,36 +26,17 @@
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
-import java.util.Date;
import java.util.List;
import com.metamatrix.common.batch.BatchSerializer;
+import com.metamatrix.connector.exception.ConnectorException;
import com.metamatrix.core.util.ExternalizeUtil;
public class AtomicResultsMessage implements Externalizable {
- // atomic request messages's id if this is result for a atomic request.
- private AtomicRequestID atomicRequestId;
-
- // This object represents the time when command is submitted to the server.
- private Date processingTimestamp;
+ private List[] results;
+ private String[] dataTypes;
- // This object represents the time when results are produced on the server.
- private Date completedTimestamp;
-
- private List[] results = null;
- private String[] columnNames = null;
- private String[] dataTypes = null;
-
- // First row index
- private int firstRow = 0;
-
- // Last row index
- private int lastRow;
-
- // Flag indicating whether this result set is part or all of the entire result set
- private boolean partialResultsFlag;
-
// Final row index in complete result set, if known
private int finalRow = -1;
@@ -63,30 +44,23 @@
private boolean supportsImplicitClose = true;
// this flag is used to notify the connector state
- private boolean requestClosed = false;
+ private boolean requestClosed;
private boolean isTransactional;
+
+ private List<Exception> warnings;
// to honor the externalizable contract
public AtomicResultsMessage() {
}
public AtomicResultsMessage(AtomicRequestMessage msg, List[] results, String[] columnNames, String[] dataTypes) {
-
this(msg);
-
+ this.dataTypes = dataTypes;
this.results = results;
- this.columnNames = columnNames;
- this.dataTypes = dataTypes;
- this.firstRow = 1;
- this.lastRow = results.length;
- this.partialResultsFlag = false;
}
public AtomicResultsMessage(AtomicRequestMessage msg) {
- this.processingTimestamp = msg.getProcessingTimestamp();
- this.completedTimestamp = new Date();
- this.atomicRequestId = msg.getAtomicRequestID();
}
public boolean supportsImplicitClose() {
@@ -97,30 +71,6 @@
this.supportsImplicitClose = supportsImplicitClose;
}
- public int getFirstRow() {
- return firstRow;
- }
-
- public void setFirstRow(int i) {
- firstRow = i;
- }
-
- public int getLastRow() {
- return lastRow;
- }
-
- public void setLastRow(int i) {
- lastRow = i;
- }
-
- public boolean isPartialResults() {
- return partialResultsFlag;
- }
-
- public void setPartialResults(boolean b) {
- partialResultsFlag = b;
- }
-
public int getFinalRow() {
return finalRow;
}
@@ -137,58 +87,26 @@
this.requestClosed = requestClosed;
}
- public AtomicRequestID getAtomicRequestId() {
- return atomicRequestId;
- }
-
public List[] getResults() {
return results;
}
- public String[] getColumnNames() {
- return this.columnNames;
- }
-
- public String[] getDataTypes() {
- return this.dataTypes;
- }
-
- public Date getProcessingTimestamp() {
- return this.processingTimestamp;
- }
-
- public Date getCompletedTimestamp() {
- return this.completedTimestamp;
- }
-
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- atomicRequestId = (AtomicRequestID)in.readObject();
- processingTimestamp = (Date)in.readObject();
- completedTimestamp = (Date)in.readObject();
- columnNames = ExternalizeUtil.readStringArray(in);
dataTypes = ExternalizeUtil.readStringArray(in);
results = BatchSerializer.readBatch(in, dataTypes);
- firstRow = in.readInt();
- lastRow = in.readInt();
- partialResultsFlag = in.readBoolean();
finalRow = in.readInt();
supportsImplicitClose = in.readBoolean();
- requestClosed = in.readBoolean();
+ requestClosed = in.readBoolean();
+ warnings = (List<Exception>)in.readObject();
}
public void writeExternal(ObjectOutput out) throws IOException {
- out.writeObject(atomicRequestId);
- out.writeObject(processingTimestamp);
- out.writeObject(completedTimestamp);
- ExternalizeUtil.writeArray(out, columnNames);
ExternalizeUtil.writeArray(out, dataTypes);
BatchSerializer.writeBatch(out, dataTypes, results);
- out.writeInt(firstRow);
- out.writeInt(lastRow);
- out.writeBoolean(partialResultsFlag);
out.writeInt(finalRow);
out.writeBoolean(supportsImplicitClose);
out.writeBoolean(requestClosed);
+ out.writeObject(warnings);
}
public boolean isTransactional() {
@@ -197,5 +115,13 @@
public void setTransactional(boolean isTransactional) {
this.isTransactional = isTransactional;
- }
+ }
+
+ public void setWarnings(List<Exception> warnings) {
+ this.warnings = warnings;
+ }
+
+ public List<Exception> getWarnings() {
+ return warnings;
+ }
}
Modified: trunk/engine/src/main/java/com/metamatrix/query/processor/ProcessorPlan.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/processor/ProcessorPlan.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/engine/src/main/java/com/metamatrix/query/processor/ProcessorPlan.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -64,7 +64,7 @@
* the current warnings list. The warnings are in order they were detected.
* @return Current list of warnings, never null
*/
- List getAndClearWarnings();
+ List<Exception> getAndClearWarnings();
/**
* Reset a plan so that it can be processed again.
Modified: trunk/engine/src/main/java/com/metamatrix/query/processor/QueryProcessor.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/processor/QueryProcessor.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/engine/src/main/java/com/metamatrix/query/processor/QueryProcessor.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -222,7 +222,7 @@
}
}
- public List getAndClearWarnings() {
+ public List<Exception> getAndClearWarnings() {
return this.processPlan.getAndClearWarnings();
}
Modified: trunk/engine/src/main/java/com/metamatrix/query/processor/relational/RelationalNodeUtil.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/processor/relational/RelationalNodeUtil.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/engine/src/main/java/com/metamatrix/query/processor/relational/RelationalNodeUtil.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -112,7 +112,7 @@
if(criteria == null) {
return true;
- } else if(!EvaluateExpressionVisitor.isFullyEvaluatable(criteria, true)) {
+ } else if(!EvaluateExpressionVisitor.isFullyEvaluatable(criteria, false)) {
// If there are elements present in the criteria,
// then we don't know the result, so assume we need to execute
return true;
@@ -133,7 +133,10 @@
criteria = update.getCriteria();
// If there are elements present in the criteria,
// then we don't know the result, so assume we need to execute
- if(ElementCollectorVisitor.getElements(criteria, true).size() > 0) {
+ if (criteria == null) {
+ return true;
+ }
+ if(!EvaluateExpressionVisitor.isFullyEvaluatable(criteria, false)) {
return true;
} else if(evaluateCriteria(criteria)) {
if (simplifyCriteria) {
@@ -147,7 +150,10 @@
criteria = delete.getCriteria();
// If there are elements present in the criteria,
// then we don't know the result, so assume we need to execute
- if(ElementCollectorVisitor.getElements(criteria, true).size() > 0) {
+ if (criteria == null) {
+ return true;
+ }
+ if(!EvaluateExpressionVisitor.isFullyEvaluatable(criteria, false)) {
return true;
} else if(evaluateCriteria(criteria)) {
if (simplifyCriteria) {
Modified: trunk/engine/src/test/java/com/metamatrix/dqp/internal/datamgr/impl/FakeConnector.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/dqp/internal/datamgr/impl/FakeConnector.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/engine/src/test/java/com/metamatrix/dqp/internal/datamgr/impl/FakeConnector.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -39,6 +39,7 @@
import com.metamatrix.connector.api.ResultSetExecution;
import com.metamatrix.connector.api.UpdateExecution;
import com.metamatrix.connector.basic.BasicConnectorCapabilities;
+import com.metamatrix.connector.basic.BasicExecution;
import com.metamatrix.connector.exception.ConnectorException;
import com.metamatrix.connector.language.ICommand;
import com.metamatrix.connector.language.IQueryCommand;
@@ -104,7 +105,7 @@
}
}
- private final class FakeBlockingExecution implements ResultSetExecution, UpdateExecution {
+ private final class FakeBlockingExecution extends BasicExecution implements ResultSetExecution, UpdateExecution {
private boolean closed = false;
private boolean cancelled = false;
private int rowCount;
@@ -130,7 +131,7 @@
}
@Override
public void execute() throws ConnectorException {
-
+ this.addWarning(new Exception("Some warning")); //$NON-NLS-1$
}
@Override
public List next() throws ConnectorException, DataNotAvailableException {
Modified: trunk/engine/src/test/java/com/metamatrix/dqp/internal/datamgr/impl/FakeProcedureExecution.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/dqp/internal/datamgr/impl/FakeProcedureExecution.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/engine/src/test/java/com/metamatrix/dqp/internal/datamgr/impl/FakeProcedureExecution.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -27,10 +27,11 @@
import com.metamatrix.connector.api.DataNotAvailableException;
import com.metamatrix.connector.api.ProcedureExecution;
+import com.metamatrix.connector.basic.BasicExecution;
import com.metamatrix.connector.exception.ConnectorException;
import com.metamatrix.connector.language.IParameter;
-final class FakeProcedureExecution implements ProcedureExecution {
+final class FakeProcedureExecution extends BasicExecution implements ProcedureExecution {
int resultSetSize;
int rowNum;
Modified: trunk/engine/src/test/java/com/metamatrix/dqp/internal/datamgr/impl/TestConnectorWorkItem.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/dqp/internal/datamgr/impl/TestConnectorWorkItem.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/engine/src/test/java/com/metamatrix/dqp/internal/datamgr/impl/TestConnectorWorkItem.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -304,6 +304,13 @@
}
public void testUpdateExecution() throws Throwable {
+ QueueResultsReceiver receiver = helpExecuteUpdate();
+ AtomicResultsMessage results = receiver.getResults().remove();
+ assertEquals(Integer.valueOf(1), results.getResults()[0].get(0));
+ }
+
+ private QueueResultsReceiver helpExecuteUpdate() throws Exception,
+ Throwable {
Command command = helpGetCommand("update bqt1.smalla set stringkey = 1 where stringkey = 2", EXAMPLE_BQT); //$NON-NLS-1$
AtomicRequestMessage arm = createNewAtomicRequestMessage(1, 1);
arm.setCommand(command);
@@ -313,8 +320,13 @@
if (receiver.exception != null) {
throw receiver.exception;
}
+ return receiver;
+ }
+
+ public void testExecutionWarning() throws Throwable {
+ QueueResultsReceiver receiver = helpExecuteUpdate();
AtomicResultsMessage results = receiver.getResults().remove();
- assertEquals(Integer.valueOf(1), results.getResults()[0].get(0));
+ assertEquals(1, results.getWarnings().size());
}
private static class FakeQueuingAsynchConnectorWorkItem extends
Modified: trunk/engine/src/test/java/com/metamatrix/dqp/internal/process/TestDQPCoreRequestHandling.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/dqp/internal/process/TestDQPCoreRequestHandling.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/engine/src/test/java/com/metamatrix/dqp/internal/process/TestDQPCoreRequestHandling.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -30,7 +30,7 @@
import com.metamatrix.api.exception.MetaMatrixException;
import com.metamatrix.common.buffer.TupleSourceID;
-import com.metamatrix.dqp.exception.SourceFailureDetails;
+import com.metamatrix.dqp.exception.SourceWarning;
import com.metamatrix.dqp.internal.datamgr.ConnectorID;
import com.metamatrix.dqp.message.AtomicRequestMessage;
import com.metamatrix.dqp.message.RequestID;
@@ -105,14 +105,10 @@
compareReqInfos(reqs, actualReqs);
}
- private SourceFailureDetails getSourceFailures(String model, String binding, String message) {
- return new SourceFailureDetails(model, binding, getWarning(message));
+ private SourceWarning getSourceFailures(String model, String binding, String message) {
+ return new SourceWarning(model, binding, new MetaMatrixException(message), true);
}
-
- private MetaMatrixException getWarning(String message) {
- return new MetaMatrixException(message);
- }
-
+
public void testAddRequest() {
DQPCore rm = new DQPCore();
RequestMessage r0 = new RequestMessage("foo"); //$NON-NLS-1$
@@ -132,7 +128,7 @@
workItem.addSourceFailureDetails(getSourceFailures("Model2", "Binding2", "Warning2")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
workItem.addSourceFailureDetails(getSourceFailures("Model3", "Binding3", "Warning3")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- assertNotNull(workItem.getPartialWarn());
+ assertEquals(3, workItem.getWarnings().size());
}
static RequestWorkItem addRequest(DQPCore rm,
Modified: trunk/engine/src/test/java/com/metamatrix/dqp/internal/process/TestDataTierManager.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/dqp/internal/process/TestDataTierManager.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/engine/src/test/java/com/metamatrix/dqp/internal/process/TestDataTierManager.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -158,11 +158,6 @@
AtomicResultsMessage results = new AtomicResultsMessage(request, new List[0], new String[0], new String[0]);
- if (isFirst) {
- results.setFirstRow(1);
- } else {
- results.setFirstRow(5);
- }
if (isLast) {
results.setFinalRow(10);
}
@@ -178,44 +173,44 @@
AtomicResultsMessage results = helpSetup(true, true);
info.receiveResults(results);
- assertNotNull(workItem.getConnectorRequest(results.getAtomicRequestId()));
+ assertNotNull(workItem.getConnectorRequest(request.getAtomicRequestID()));
- DataTierTupleSource connRequest = workItem.getConnectorRequest(results.getAtomicRequestId());
+ DataTierTupleSource connRequest = workItem.getConnectorRequest(request.getAtomicRequestID());
connRequest.closeSource();
- assertNotNull(workItem.getConnectorRequest(results.getAtomicRequestId()));
+ assertNotNull(workItem.getConnectorRequest(request.getAtomicRequestID()));
AtomicResultsMessage closeResult = new AtomicResultsMessage(request);
closeResult.setRequestClosed(true);
info.receiveResults(closeResult);
- assertNull(workItem.getConnectorRequest(closeResult.getAtomicRequestId()));
+ assertNull(workItem.getConnectorRequest(request.getAtomicRequestID()));
}
public void testDeliverMessageNEWResponseNonFinal() throws Exception {
AtomicResultsMessage results = helpSetup(true, false);
info.receiveResults(results);
- assertNotNull(workItem.getConnectorRequest(results.getAtomicRequestId()));
+ assertNotNull(workItem.getConnectorRequest(request.getAtomicRequestID()));
}
public void testDeliverMessageMOREResponseFinal_Defect15646() throws Exception {
AtomicResultsMessage results = helpSetup(false, true);
info.receiveResults(results);
- assertNotNull(workItem.getConnectorRequest(results.getAtomicRequestId()));
+ assertNotNull(workItem.getConnectorRequest(request.getAtomicRequestID()));
- DataTierTupleSource connRequest = workItem.getConnectorRequest(results.getAtomicRequestId());
+ DataTierTupleSource connRequest = workItem.getConnectorRequest(request.getAtomicRequestID());
connRequest.closeSource();
- assertNotNull(workItem.getConnectorRequest(results.getAtomicRequestId()));
+ assertNotNull(workItem.getConnectorRequest(request.getAtomicRequestID()));
AtomicResultsMessage closeResult = new AtomicResultsMessage(request);
closeResult.setRequestClosed(true);
info.receiveResults(closeResult);
- assertNull(workItem.getConnectorRequest(closeResult.getAtomicRequestId()));
+ assertNull(workItem.getConnectorRequest(request.getAtomicRequestID()));
}
public void testExplicitClose() throws Exception {
@@ -225,24 +220,24 @@
results.setSupportsImplicitClose(false);
info.receiveResults(results);
- assertNotNull(workItem.getConnectorRequest(results.getAtomicRequestId()));
+ assertNotNull(workItem.getConnectorRequest(request.getAtomicRequestID()));
- DataTierTupleSource connRequest = workItem.getConnectorRequest(results.getAtomicRequestId());
+ DataTierTupleSource connRequest = workItem.getConnectorRequest(request.getAtomicRequestID());
connRequest.closeSource();
assertFalse(this.dataService.closed);
- assertNotNull(workItem.getConnectorRequest(results.getAtomicRequestId()));
+ assertNotNull(workItem.getConnectorRequest(request.getAtomicRequestID()));
// now explicit close and see it gone
connRequest.fullyCloseSource();
- assertNotNull(workItem.getConnectorRequest(results.getAtomicRequestId()));
+ assertNotNull(workItem.getConnectorRequest(request.getAtomicRequestID()));
AtomicResultsMessage closeResult = new AtomicResultsMessage(request);
closeResult.setRequestClosed(true);
info.receiveResults(closeResult);
- assertNull(workItem.getConnectorRequest(results.getAtomicRequestId()));
+ assertNull(workItem.getConnectorRequest(request.getAtomicRequestID()));
}
@@ -254,19 +249,19 @@
info.receiveResults(results);
- assertNotNull(workItem.getConnectorRequest(results.getAtomicRequestId()));
+ assertNotNull(workItem.getConnectorRequest(request.getAtomicRequestID()));
- DataTierTupleSource connRequest = workItem.getConnectorRequest(results.getAtomicRequestId());
+ DataTierTupleSource connRequest = workItem.getConnectorRequest(request.getAtomicRequestID());
connRequest.closeSource();
assertTrue(this.dataService.closed);
- assertNotNull(workItem.getConnectorRequest(results.getAtomicRequestId()));
+ assertNotNull(workItem.getConnectorRequest(request.getAtomicRequestID()));
AtomicResultsMessage closeResult = new AtomicResultsMessage(request);
closeResult.setRequestClosed(true);
info.receiveResults(closeResult);
- assertNull(workItem.getConnectorRequest(closeResult.getAtomicRequestId()));
+ assertNull(workItem.getConnectorRequest(request.getAtomicRequestID()));
}
public void testImplictCloseWithNotAllowedState() throws Exception {
@@ -277,14 +272,14 @@
info.receiveResults(results);
assertFalse(this.dataService.closed);
- assertNotNull(workItem.getConnectorRequest(results.getAtomicRequestId()));
+ assertNotNull(workItem.getConnectorRequest(request.getAtomicRequestID()));
- DataTierTupleSource connRequest = workItem.getConnectorRequest(results.getAtomicRequestId());
+ DataTierTupleSource connRequest = workItem.getConnectorRequest(request.getAtomicRequestID());
// now implicitly close the request then check to make sure it is not gone
connRequest.closeSource();
assertFalse(this.dataService.closed);
- assertNotNull(workItem.getConnectorRequest(results.getAtomicRequestId()));
+ assertNotNull(workItem.getConnectorRequest(request.getAtomicRequestID()));
}
@@ -292,7 +287,7 @@
AtomicResultsMessage results = helpSetup(false, false);
info.receiveResults(results);
- assertNotNull(workItem.getConnectorRequest(results.getAtomicRequestId()));
+ assertNotNull(workItem.getConnectorRequest(request.getAtomicRequestID()));
}
public void testCodeTableResponseException() throws Exception {
Modified: trunk/engine/src/test/java/com/metamatrix/dqp/service/AutoGenDataService.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/dqp/service/AutoGenDataService.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/engine/src/test/java/com/metamatrix/dqp/service/AutoGenDataService.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -92,10 +92,7 @@
List[] results = createResults(projectedSymbols);
AtomicResultsMessage msg = ConnectorWorkItem.createResultsMessage(request, results, projectedSymbols);
- msg.setFirstRow(1);
- msg.setLastRow(rows);
msg.setFinalRow(rows);
- msg.setPartialResults(false);
resultListener.receiveResults(msg);
AtomicResultsMessage closeMsg = ConnectorWorkItem.createResultsMessage(request, results, projectedSymbols);
closeMsg.setRequestClosed(true);
Modified: trunk/server/src/main/java/com/metamatrix/platform/security/audit/AuditManager.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/platform/security/audit/AuditManager.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/server/src/main/java/com/metamatrix/platform/security/audit/AuditManager.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -135,13 +135,6 @@
public static final String SYSTEM_AUDIT_CONSOLE_PROPERTY_NAME = "metamatrix.audit.console"; //$NON-NLS-1$
/**
- * The name of the configuration property that contains the maximum number of threads
- * for the AuditManager. This is an optional property that defaults to '1'.
- * Note that the maximum value must be greater than or equal to the minimum value.
- */
- public static final String SYSTEM_AUDIT_MAX_THREADS = "metamatrix.audit.maxThreads"; //$NON-NLS-1$
-
- /**
* The name of the configuration property that contains the time to live (in milliseconds) for threads
* in the AuditManager. The time to live is simply the period of thread inactivity
* that determines when a thread may be expired. This is an optional property
@@ -310,11 +303,10 @@
private void initializeQueueWorkers() {
try {
// Create the worker pool
- String maxThreadsString = System.getProperty(SYSTEM_AUDIT_MAX_THREADS, DEFAULT_AUDIT_MAX_THREADS);
String threadTTLString = System.getProperty(SYSTEM_AUDIT_THREAD_TTL, DEFAULT_AUDIT_THREAD_TTL);
this.workerPool = WorkerPoolFactory.newWorkerPool(
"AuditQueue", //$NON-NLS-1$
- Integer.parseInt(maxThreadsString),
+ 1,
Integer.parseInt(threadTTLString));
} catch ( Exception e ) {
I18nLogManager.logError(LogSecurityConstants.CTX_AUDIT, ErrorMessageKeys.SEC_AUDIT_0007, e,
Modified: trunk/test-integration/src/test/java/com/metamatrix/data/metadata/runtime/MockConnector.java
===================================================================
--- trunk/test-integration/src/test/java/com/metamatrix/data/metadata/runtime/MockConnector.java 2009-02-12 21:53:53 UTC (rev 466)
+++ trunk/test-integration/src/test/java/com/metamatrix/data/metadata/runtime/MockConnector.java 2009-02-13 16:51:05 UTC (rev 467)
@@ -128,10 +128,6 @@
return exec;
}
- @Override
- public ConnectorCapabilities getCapabilities() {
- return null;
- }
};
}
More information about the teiid-commits
mailing list