Author: shawkins
Date: 2010-04-20 15:13:08 -0400 (Tue, 20 Apr 2010)
New Revision: 2063
Added:
trunk/client/src/main/java/org/teiid/client/ProcedureErrorInstructionException.java
trunk/engine/src/main/java/com/metamatrix/api/
trunk/engine/src/main/java/com/metamatrix/api/exception/
trunk/engine/src/main/java/com/metamatrix/api/exception/query/
trunk/engine/src/main/java/com/metamatrix/api/exception/query/CriteriaEvaluationException.java
trunk/engine/src/main/java/com/metamatrix/api/exception/query/ExpressionEvaluationException.java
trunk/engine/src/main/java/com/metamatrix/api/exception/query/FunctionExecutionException.java
trunk/engine/src/main/java/com/metamatrix/api/exception/query/FunctionMetadataException.java
trunk/engine/src/main/java/com/metamatrix/api/exception/query/InvalidFunctionException.java
trunk/engine/src/main/java/com/metamatrix/api/exception/query/QueryMetadataException.java
trunk/engine/src/main/java/com/metamatrix/api/exception/query/QueryParserException.java
trunk/engine/src/main/java/com/metamatrix/api/exception/query/QueryPlannerException.java
trunk/engine/src/main/java/com/metamatrix/api/exception/query/QueryProcessingException.java
trunk/engine/src/main/java/com/metamatrix/api/exception/query/QueryResolverException.java
trunk/engine/src/main/java/com/metamatrix/api/exception/query/QueryValidatorException.java
trunk/engine/src/main/java/com/metamatrix/api/exception/query/UnresolvedSymbolDescription.java
Removed:
trunk/adminshell/src/main/java/com/
trunk/client/src/main/java/com/
trunk/common-core/src/main/java/com/metamatrix/common/properties/
trunk/runtime/src/test/java/com/metamatrix/platform/
Modified:
trunk/client/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java
trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java
trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
trunk/client/src/main/java/org/teiid/client/ResultsMessage.java
trunk/client/src/main/java/org/teiid/client/SourceWarning.java
trunk/client/src/main/java/org/teiid/client/plan/Annotation.java
trunk/client/src/main/java/org/teiid/client/security/LogonResult.java
trunk/client/src/main/java/org/teiid/client/security/SessionToken.java
trunk/client/src/main/java/org/teiid/jdbc/CallableStatementImpl.java
trunk/client/src/main/java/org/teiid/jdbc/DatabaseMetaDataImpl.java
trunk/client/src/main/java/org/teiid/jdbc/DeferredMetadataProvider.java
trunk/client/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java
trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java
trunk/client/src/main/java/org/teiid/jdbc/TeiidSQLException.java
trunk/client/src/main/java/org/teiid/net/socket/ServiceInvocationStruct.java
trunk/client/src/main/java/org/teiid/net/socket/SocketUtil.java
trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/CompactObjectInputStream.java
trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/CompactObjectOutputStream.java
trunk/client/src/test/java/org/teiid/jdbc/TestEmbeddedProfile.java
trunk/client/src/test/java/org/teiid/jdbc/TestMMSQLException.java
trunk/common-core/src/main/java/com/metamatrix/api/exception/ComponentNotFoundException.java
trunk/common-core/src/main/java/com/metamatrix/api/exception/ExceptionHolder.java
trunk/common-core/src/main/java/com/metamatrix/api/exception/MetaMatrixComponentException.java
trunk/common-core/src/main/java/com/metamatrix/api/exception/MetaMatrixException.java
trunk/common-core/src/main/java/com/metamatrix/api/exception/MetaMatrixProcessingException.java
trunk/common-core/src/main/java/com/metamatrix/common/types/BaseLob.java
trunk/common-core/src/main/java/com/metamatrix/common/types/BlobImpl.java
trunk/common-core/src/main/java/com/metamatrix/common/types/BlobType.java
trunk/common-core/src/main/java/com/metamatrix/common/types/ClobImpl.java
trunk/common-core/src/main/java/com/metamatrix/common/types/ClobType.java
trunk/common-core/src/main/java/com/metamatrix/common/types/SQLXMLImpl.java
trunk/common-core/src/main/java/com/metamatrix/common/types/Streamable.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToCharacterTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/util/PropertiesUtils.java
trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/DhKeyGenerator.java
trunk/common-core/src/main/java/com/metamatrix/core/MetaMatrixCoreException.java
trunk/common-core/src/main/java/com/metamatrix/core/util/ExternalizeUtil.java
trunk/common-core/src/test/java/com/metamatrix/common/types/TestBlobValue.java
trunk/common-core/src/test/java/com/metamatrix/common/util/TestPropertiesUtils.java
trunk/common-core/src/test/java/com/metamatrix/core/util/TestExternalizeUtil.java
trunk/connector-api/src/main/java/org/teiid/connector/api/MetadataProvider.java
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/connection/impl/ConnectionImpl.java
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ErrorInstruction.java
trunk/engine/src/main/java/org/teiid/metadata/TransformationMetadata.java
trunk/runtime/src/main/java/org/teiid/transport/ObjectDecoder.java
trunk/runtime/src/main/java/org/teiid/transport/ServerWorkItem.java
trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestMMDatabaseMetaData.java
trunk/test-integration/db/src/main/java/org/teiid/test/framework/ConfigPropertyLoader.java
Log:
TEIID-207 changes to ensure that clients will more easily adapt between versions
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java 2010-04-16
21:45:46 UTC (rev 2062)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/AdminObjectImpl.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -41,6 +41,8 @@
private String name;
private ListOverMap<PropertyMetadata> properties = new
ListOverMap<PropertyMetadata>(new KeyBuilder<PropertyMetadata>() {
+ private static final long serialVersionUID = 3687928367250819142L;
+
@Override
public String getKey(PropertyMetadata entry) {
return entry.getName();
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2010-04-16
21:45:46 UTC (rev 2062)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -55,7 +55,9 @@
private static final long serialVersionUID = 3714234763056162230L;
@XmlElement(name = "source")
- protected ListOverMap<SourceMappingMetadata> sources = new ListOverMap(new
KeyBuilder<SourceMappingMetadata>() {
+ protected ListOverMap<SourceMappingMetadata> sources = new
ListOverMap<SourceMappingMetadata>(new KeyBuilder<SourceMappingMetadata>() {
+ private static final long serialVersionUID = 2273673984691112369L;
+
@Override
public String getKey(SourceMappingMetadata entry) {
return entry.getName();
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java 2010-04-16
21:45:46 UTC (rev 2062)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -134,7 +134,7 @@
if (!sourceRequest()) {
return sessionId == value.sessionId && executionId == value.executionId;
}
- return sessionId == value.sessionId && executionId == value.executionId
&& nodeID == value.nodeID;
+ return sessionId == value.sessionId && executionId == value.executionId
&& nodeID.equals(value.nodeID);
}
public int hashCode() {
Modified: trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java
===================================================================
--- trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2010-04-16
21:45:46 UTC (rev 2062)
+++ trunk/client/src/main/java/org/teiid/adminapi/impl/VDBMetaData.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -63,6 +63,8 @@
*/
@XmlElement(name = "model", required = true, type = ModelMetaData.class)
protected ListOverMap<ModelMetaData> models = new
ListOverMap<ModelMetaData>(new KeyBuilder<ModelMetaData>() {
+ private static final long serialVersionUID = 846247100420118961L;
+
@Override
public String getKey(ModelMetaData entry) {
return entry.getName();
Copied:
trunk/client/src/main/java/org/teiid/client/ProcedureErrorInstructionException.java (from
rev 2059,
trunk/client/src/main/java/com/metamatrix/api/exception/query/ProcedureErrorInstructionException.java)
===================================================================
--- trunk/client/src/main/java/org/teiid/client/ProcedureErrorInstructionException.java
(rev 0)
+++
trunk/client/src/main/java/org/teiid/client/ProcedureErrorInstructionException.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.client;
+
+import com.metamatrix.api.exception.MetaMatrixProcessingException;
+
+
+/**
+ * Used to notify the user that the virtual procedure raised an error.
+ * @since 4.3
+ */
+public class ProcedureErrorInstructionException extends MetaMatrixProcessingException {
+
+ /**
+ *
+ * @since 4.3
+ */
+ public ProcedureErrorInstructionException() {
+ super();
+ }
+
+ /**
+ * @param message
+ * @since 4.3
+ */
+ public ProcedureErrorInstructionException(String message) {
+ super(message);
+ }
+
+}
Modified: trunk/client/src/main/java/org/teiid/client/ResultsMessage.java
===================================================================
--- trunk/client/src/main/java/org/teiid/client/ResultsMessage.java 2010-04-16 21:45:46
UTC (rev 2062)
+++ trunk/client/src/main/java/org/teiid/client/ResultsMessage.java 2010-04-20 19:13:08
UTC (rev 2063)
@@ -30,6 +30,7 @@
import java.util.Collection;
import java.util.List;
+import org.teiid.client.metadata.ParameterInfo;
import org.teiid.client.plan.Annotation;
import org.teiid.client.plan.PlanNode;
@@ -67,7 +68,7 @@
private int finalRow = -1;
/** The parameters of a Stored Procedure */
- private List parameters;
+ private List<ParameterInfo> parameters;
/** OPTION DEBUG log if OPTION DEBUG was used */
private String debugLog;
@@ -265,7 +266,7 @@
finalRow = in.readInt();
//Parameters
- parameters = ExternalizeUtil.readList(in);
+ parameters = ExternalizeUtil.readList(in, ParameterInfo.class);
debugLog = (String)in.readObject();
annotations = ExternalizeUtil.readList(in, Annotation.class);
Modified: trunk/client/src/main/java/org/teiid/client/SourceWarning.java
===================================================================
--- trunk/client/src/main/java/org/teiid/client/SourceWarning.java 2010-04-16 21:45:46 UTC
(rev 2062)
+++ trunk/client/src/main/java/org/teiid/client/SourceWarning.java 2010-04-20 19:13:08 UTC
(rev 2063)
@@ -82,9 +82,9 @@
public String toString() {
StringBuffer warningBuf = new StringBuffer();
if (partialResults) {
- warningBuf.append("Error ");
+ warningBuf.append("Error "); //$NON-NLS-1$
} else {
- warningBuf.append("Warning ");
+ warningBuf.append("Warning "); //$NON-NLS-1$
}
warningBuf.append("querying the connector with binding name ");
//$NON-NLS-1$
warningBuf.append(connectorBindingName);
Modified: trunk/client/src/main/java/org/teiid/client/plan/Annotation.java
===================================================================
--- trunk/client/src/main/java/org/teiid/client/plan/Annotation.java 2010-04-16 21:45:46
UTC (rev 2062)
+++ trunk/client/src/main/java/org/teiid/client/plan/Annotation.java 2010-04-20 19:13:08
UTC (rev 2063)
@@ -22,14 +22,16 @@
package org.teiid.client.plan;
-import java.io.Serializable;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
/**
* Annotation describing a decision made during query execution.
*/
-public class Annotation implements Serializable {
+public class Annotation implements Externalizable {
- private static final long serialVersionUID = 7389738177788185542L;
public static final String MATERIALIZED_VIEW = "Materialized View";
//$NON-NLS-1$
public static final String HINTS = "Hints"; //$NON-NLS-1$
@@ -44,6 +46,10 @@
private String resolution;
private Priority priority = Priority.LOW;
+ public Annotation() {
+
+ }
+
public Annotation(String category, String annotation, String resolution, Priority
priority) {
this.category = category;
this.annotation = annotation;
@@ -70,4 +76,21 @@
public String toString() {
return "QueryAnnotation<" + getCategory() + ", " +
getAnnotation() + ">"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
}
+
+ @Override
+ public void readExternal(ObjectInput in) throws IOException,
+ ClassNotFoundException {
+ annotation = (String)in.readObject();
+ category = (String)in.readObject();
+ resolution = (String)in.readObject();
+ priority = Priority.values()[in.readByte()];
+ }
+
+ @Override
+ public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeObject(annotation);
+ out.writeObject(category);
+ out.writeObject(resolution);
+ out.writeByte(priority.ordinal());
+ }
}
Modified: trunk/client/src/main/java/org/teiid/client/security/LogonResult.java
===================================================================
--- trunk/client/src/main/java/org/teiid/client/security/LogonResult.java 2010-04-16
21:45:46 UTC (rev 2062)
+++ trunk/client/src/main/java/org/teiid/client/security/LogonResult.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -22,7 +22,10 @@
package org.teiid.client.security;
-import java.io.Serializable;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.TimeZone;
@@ -33,7 +36,7 @@
*
* Analogous to the server side SessionToken
*/
-public class LogonResult implements Serializable {
+public class LogonResult implements Externalizable {
private static final long serialVersionUID = 4481443514871448269L;
private TimeZone timeZone = TimeZone.getDefault();
@@ -85,5 +88,24 @@
public int getVdbVersion() {
return vdbVersion;
}
+
+ @Override
+ public void readExternal(ObjectInput in) throws IOException,
+ ClassNotFoundException {
+ vdbName = (String)in.readObject();
+ sessionToken = (SessionToken)in.readObject();
+ timeZone = (TimeZone)in.readObject();
+ clusterName = (String)in.readObject();
+ vdbVersion = in.readInt();
+ }
+
+ @Override
+ public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeObject(vdbName);
+ out.writeObject(sessionToken);
+ out.writeObject(timeZone);
+ out.writeObject(clusterName);
+ out.writeInt(vdbVersion);
+ }
}
Modified: trunk/client/src/main/java/org/teiid/client/security/SessionToken.java
===================================================================
--- trunk/client/src/main/java/org/teiid/client/security/SessionToken.java 2010-04-16
21:45:46 UTC (rev 2062)
+++ trunk/client/src/main/java/org/teiid/client/security/SessionToken.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -22,7 +22,10 @@
package org.teiid.client.security;
-import java.io.Serializable;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.UUID;
/**
@@ -33,7 +36,7 @@
* transit if sent to the client. Also it should only be sent to the client
* who creates the session.
*/
-public class SessionToken implements Serializable, Cloneable {
+public class SessionToken implements Externalizable, Cloneable {
public final static long serialVersionUID = -2853708320435636107L;
/** The session ID */
@@ -146,5 +149,20 @@
}
return null;
}
+
+ @Override
+ public void readExternal(ObjectInput in) throws IOException,
+ ClassNotFoundException {
+ secret = (UUID)in.readObject();
+ sessionID = in.readLong();
+ userName = (String)in.readObject();
+ }
+
+ @Override
+ public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeObject(secret);
+ out.writeLong(sessionID);
+ out.writeObject(userName);
+ }
}
Modified: trunk/client/src/main/java/org/teiid/jdbc/CallableStatementImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/CallableStatementImpl.java 2010-04-16
21:45:46 UTC (rev 2062)
+++ trunk/client/src/main/java/org/teiid/jdbc/CallableStatementImpl.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -115,10 +115,7 @@
BigDecimal bigDecimalParam =
DataTypeTransformer.getBigDecimal(getObject(parameterIndex));
// set scale on the param value
- bigDecimalParam.setScale(scale);
-
- // return param value
- return bigDecimalParam;
+ return bigDecimalParam.setScale(scale);
}
/**
Modified: trunk/client/src/main/java/org/teiid/jdbc/DatabaseMetaDataImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/DatabaseMetaDataImpl.java 2010-04-16
21:45:46 UTC (rev 2062)
+++ trunk/client/src/main/java/org/teiid/jdbc/DatabaseMetaDataImpl.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -460,6 +460,7 @@
}
private ResultSet createResultSet(List records, ResultSetMetaData rsmd) throws
SQLException {
+ rsmd.getScale(1); //force the load of the metadata
ResultsMessage resultsMsg = createDummyResultsMessage(null, null, records);
StatementImpl stmt = StatementImpl.newInstance(this.driverConnection,
ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
return new ResultSetImpl(resultsMsg, stmt, rsmd, 0);
@@ -616,18 +617,22 @@
// get the metadata for the results
rmetadata = results.getMetaData();
+ // logging
+ String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.getCols_success",
columnNamePattern, tableNamePattern); //$NON-NLS-1$
+ logger.fine(logMsg);
+
+ // construct results object from column values and their metadata
+ return createResultSet(records, rmetadata);
} catch(Exception e) {
// logging
String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.getCols_error", columnNamePattern,
tableNamePattern, e.getMessage()); //$NON-NLS-1$
throw TeiidSQLException.create(e, logMsg);
+ } finally {
+ if (prepareQuery != null) {
+ prepareQuery.close();
+ }
}
- // logging
- String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.getCols_success",
columnNamePattern, tableNamePattern); //$NON-NLS-1$
- logger.fine(logMsg);
-
- // construct results object from column values and their metadata
- return createResultSet(records, rmetadata);
}
/**
@@ -671,9 +676,10 @@
foreignTable = PERCENT;
}
- ResultSetImpl results = null;
+ ResultSet results = null;
+ PreparedStatement prepareQuery = null;
try {
- PreparedStatement prepareQuery =
driverConnection.prepareStatement(QUERY_CROSS_REFERENCES);
+ prepareQuery = driverConnection.prepareStatement(QUERY_CROSS_REFERENCES);
prepareQuery.setObject(1, primaryCatalog.toUpperCase());
prepareQuery.setObject(2, foreignCatalog.toUpperCase());
prepareQuery.setObject(3, primarySchema.toUpperCase());
@@ -682,20 +688,23 @@
prepareQuery.setObject(6, foreignTable.toUpperCase());
// make a query against runtimemetadata and get results
- results = (ResultSetImpl) prepareQuery.executeQuery();
+ results = prepareQuery.executeQuery();
+
+ ResultSet resultSet = getReferenceKeys(results);
+
+ // logging
+ String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.getCrossRef_success",
primaryTable, foreignTable); //$NON-NLS-1$
+ logger.fine(logMsg);
+ return resultSet;
} catch(Exception e) {
// logging
String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.getCrossRef_error", primaryTable,
foreignTable, e.getMessage()); //$NON-NLS-1$
throw TeiidSQLException.create(e, logMsg);
+ } finally {
+ if (prepareQuery != null) {
+ prepareQuery.close();
+ }
}
-
- ResultSet resultSet = getReferenceKeys(results);
-
- // logging
- String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.getCrossRef_success",
primaryTable, foreignTable); //$NON-NLS-1$
- logger.fine(logMsg);
-
- return resultSet;
}
/**
@@ -810,26 +819,30 @@
table = PERCENT;
}
- ResultSetImpl results = null;
+ ResultSet results = null;
+ PreparedStatement prepareQuery = null;
try {
- PreparedStatement prepareQuery =
driverConnection.prepareStatement(QUERY_EXPORTED_KEYS);
+ prepareQuery = driverConnection.prepareStatement(QUERY_EXPORTED_KEYS);
prepareQuery.setObject(1, catalog.toUpperCase());
prepareQuery.setObject(2, schema.toUpperCase());
prepareQuery.setObject(3, table.toUpperCase());
// make a query against runtimemetadata and get results
- results = (ResultSetImpl) prepareQuery.executeQuery();
+ results = prepareQuery.executeQuery();
+ ResultSet resultSet = getReferenceKeys(results);
+
+
logger.fine(JDBCPlugin.Util.getString("MMDatabaseMetadata.getExpKey_success",
table));//$NON-NLS-1$
+
+ return resultSet;
} catch(Exception e) {
// logging
String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.getExpKey_error", table,
e.getMessage()); //$NON-NLS-1$
throw TeiidSQLException.create(e, logMsg);
+ } finally {
+ if (prepareQuery != null) {
+ prepareQuery.close();
+ }
}
-
- ResultSet resultSet = getReferenceKeys(results);
-
-
logger.fine(JDBCPlugin.Util.getString("MMDatabaseMetadata.getExpKey_success",
table));//$NON-NLS-1$
-
- return resultSet;
}
/**
@@ -876,26 +889,31 @@
table = PERCENT;
}
- ResultSetImpl results = null;
+ ResultSet results = null;
+ PreparedStatement prepareQuery = null;
try {
- PreparedStatement prepareQuery =
driverConnection.prepareStatement(QUERY_IMPORTED_KEYS);
+ prepareQuery = driverConnection.prepareStatement(QUERY_IMPORTED_KEYS);
prepareQuery.setObject(1, catalog.toUpperCase());
prepareQuery.setObject(2, schema.toUpperCase());
prepareQuery.setObject(3, table.toUpperCase());
// make a query against runtimemetadata and get results
- results = (ResultSetImpl) prepareQuery.executeQuery();
+ results = prepareQuery.executeQuery();
+
+ ResultSet resultSet = getReferenceKeys(results);
+
+
logger.fine(JDBCPlugin.Util.getString("MMDatabaseMetadata.getImpKey_success",
table)); //$NON-NLS-1$
+
+ return resultSet;
} catch(Exception e) {
String logMsg =
JDBCPlugin.Util.getString("MMDatabaseMetadata.getImpKey_error", table,
e.getMessage()); //$NON-NLS-1$
throw TeiidSQLException.create(e, logMsg);
+ } finally {
+ if (prepareQuery != null) {
+ prepareQuery.close();
+ }
}
-
- ResultSet resultSet = getReferenceKeys(results);
-
-
logger.fine(JDBCPlugin.Util.getString("MMDatabaseMetadata.getImpKey_success",
table)); //$NON-NLS-1$
-
- return resultSet;
}
/**
@@ -955,15 +973,17 @@
// get the metadata for the results
rmetadata = results.getMetaData();
+
logger.fine(JDBCPlugin.Util.getString("MMDatabaseMetadata.getIndex_success",
table)); //$NON-NLS-1$
+ // construct results object from column values and their metadata
+ return createResultSet(records, rmetadata);
} catch (Exception e) {
throw TeiidSQLException.create(e,
JDBCPlugin.Util.getString("MMDatabaseMetadata.getIndex_error", table,
e.getMessage())); //$NON-NLS-1$
+ } finally {
+ if (prepareQuery != null) {
+ prepareQuery.close();
+ }
}
-
-
logger.fine(JDBCPlugin.Util.getString("MMDatabaseMetadata.getIndex_success",
table)); //$NON-NLS-1$
-
- // construct results object from column values and their metadata
- return createResultSet(records, rmetadata);
}
/**
@@ -1178,14 +1198,17 @@
// get the metadata for the results
rmetadata = results.getMetaData();
+
logger.fine(JDBCPlugin.Util.getString("MMDatabaseMetadata.getPrimaryKey_success"));
//$NON-NLS-1$
+
+ // construct results object from column values and their metadata
+ return createResultSet(records, rmetadata);
} catch (Exception e) {
throw TeiidSQLException.create(e,
JDBCPlugin.Util.getString("MMDatabaseMetadata.getPrimaryKey_error", table,
e.getMessage())); //$NON-NLS-1$
+ } finally {
+ if (prepareQuery != null) {
+ prepareQuery.close();
+ }
}
-
-
logger.fine(JDBCPlugin.Util.getString("MMDatabaseMetadata.getPrimaryKey_success"));
//$NON-NLS-1$
-
- // construct results object from column values and their metadata
- return createResultSet(records, rmetadata);
}
public ResultSet getProcedureColumns(String catalog, String schemaPattern, String
procedureNamePattern, String columnNamePattern) throws SQLException {
@@ -1236,14 +1259,17 @@
}// end of while
rmetadata = results.getMetaData();
+
logger.fine(JDBCPlugin.Util.getString("MMDatabaseMetadata.getProcCol_success",
columnNamePattern, procedureNamePattern)); //$NON-NLS-1$
+
+ // construct results object from column values and their metadata
+ return createResultSet(records, rmetadata);
} catch (Exception e) {
throw TeiidSQLException.create(e,
JDBCPlugin.Util.getString("MMDatabaseMetadata.getProcCol_error",
columnNamePattern, e.getMessage())); //$NON-NLS-1$
+ } finally {
+ if (prepareQuery != null) {
+ prepareQuery.close();
+ }
}
-
-
logger.fine(JDBCPlugin.Util.getString("MMDatabaseMetadata.getProcCol_success",
columnNamePattern, procedureNamePattern)); //$NON-NLS-1$
-
- // construct results object from column values and their metadata
- return createResultSet(records, rmetadata);
}
public ResultSet getProcedures(String catalog, String schemaPattern, String
procedureNamePattern) throws SQLException {
@@ -1294,14 +1320,17 @@
// get the metadata for the results
rmetadata = results.getMetaData();
+
logger.fine(JDBCPlugin.Util.getString("MMDatabaseMetadata.getProc_success",
procedureNamePattern)); //$NON-NLS-1$
+
+ // construct results object from column values and their metadata
+ return createResultSet(records, rmetadata);
} catch (Exception e) {
throw TeiidSQLException.create(e,
JDBCPlugin.Util.getString("MMDatabaseMetadata.getProc_error",
procedureNamePattern, e.getMessage())); //$NON-NLS-1$
+ } finally {
+ if (prepareQuery != null) {
+ prepareQuery.close();
+ }
}
-
-
logger.fine(JDBCPlugin.Util.getString("MMDatabaseMetadata.getProc_success",
procedureNamePattern)); //$NON-NLS-1$
-
- // construct results object from column values and their metadata
- return createResultSet(records, rmetadata);
}
public String getProcedureTerm() throws SQLException {
@@ -1536,23 +1565,18 @@
// get the metadata for the results
rmetadata = results.getMetaData();
- } catch (SQLException e) {
- throw e;
+
+
logger.fine(JDBCPlugin.Util.getString("MMDatabaseMetadata.getTable_success",
tableNamePattern)); //$NON-NLS-1$
+
+ // construct results object from column values and their metadata
+ return createResultSet(records, rmetadata);
} catch (Exception e) {
throw TeiidSQLException.create(e,
JDBCPlugin.Util.getString("MMDatabaseMetadata.getTable_error", tableNamePattern,
e.getMessage())); //$NON-NLS-1$
+ } finally {
+ if (prepareQuery != null) {
+ prepareQuery.close();
+ }
}
-
- // close the results (need to close case results exceed cursor size)
- //results.close();
-
- // close the PreparedStatement, too. Because of the way of closing request in
current framework,
- // manually send out a close request is very necessary for PreparedStatement.
- //prepareQuery.close();
-
-
logger.fine(JDBCPlugin.Util.getString("MMDatabaseMetadata.getTable_success",
tableNamePattern)); //$NON-NLS-1$
-
- // construct results object from column values and their metadata
- return createResultSet(records, rmetadata);
}
public ResultSet getTableTypes() throws SQLException {
@@ -2253,7 +2277,7 @@
* @return ResultSet object giving the reference key info.
* @throws SQLException if there is an accesing server results
*/
- private ResultSet getReferenceKeys(ResultSetImpl results) throws SQLException {
+ private ResultSet getReferenceKeys(ResultSet results) throws SQLException {
// list which represent records containing reference key info
List records = new ArrayList ();
@@ -2402,13 +2426,16 @@
// Get the metadata for the results
rmetadata = results.getMetaData();
+
logger.fine(JDBCPlugin.Util.getString("MMDatabaseMetadata.getschema_success"));
//$NON-NLS-1$
+
+ // construct results object from column values and their metadata
+ return createResultSet(records, rmetadata);
} catch(Exception e) {
throw TeiidSQLException.create(e,
JDBCPlugin.Util.getString("MMDatabaseMetadata.getschema_error",
e.getMessage())); //$NON-NLS-1$
+ } finally {
+ if (prepareQuery != null) {
+ prepareQuery.close();
+ }
}
-
-
logger.fine(JDBCPlugin.Util.getString("MMDatabaseMetadata.getschema_success"));
//$NON-NLS-1$
-
- // construct results object from column values and their metadata
- return createResultSet(records, rmetadata);
}
}
Modified: trunk/client/src/main/java/org/teiid/jdbc/DeferredMetadataProvider.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/DeferredMetadataProvider.java 2010-04-16
21:45:46 UTC (rev 2062)
+++ trunk/client/src/main/java/org/teiid/jdbc/DeferredMetadataProvider.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -40,6 +40,7 @@
public class DeferredMetadataProvider extends MetadataProvider {
private StatementImpl statement;
private long requestID;
+ private boolean loaded;
public DeferredMetadataProvider(String[] columnNames, String[] columnTypes,
StatementImpl statement, long requestID) {
super(loadPartialMetadata(columnNames, columnTypes));
@@ -47,16 +48,16 @@
this.requestID = requestID;
}
- static Map[] loadPartialMetadata(String[] columnNames, String[] columnTypes) {
+ static Map<Integer, String>[] loadPartialMetadata(String[] columnNames,
String[] columnTypes) {
if(columnNames == null || columnTypes == null || columnNames.length !=
columnTypes.length) {
Object[] params = new Object[] {
StringUtil.toString(columnNames), StringUtil.toString(columnTypes)
};
throw new
IllegalArgumentException(JDBCPlugin.Util.getString("DeferredMetadataProvider.Invalid_data",
params)); //$NON-NLS-1$
}
- Map[] columnMetadata = new Map[columnNames.length];
+ Map<Integer, String>[] columnMetadata = new Map[columnNames.length];
for(int i=0; i<columnNames.length; i++) {
- columnMetadata[i] = new HashMap();
+ columnMetadata[i] = new HashMap<Integer, String>();
columnMetadata[i].put(ResultsMetadataConstants.ELEMENT_NAME,
columnNames[i]);
columnMetadata[i].put(ResultsMetadataConstants.DATA_TYPE, columnTypes[i]);
}
@@ -77,14 +78,12 @@
@Override
public Object getValue(int columnIndex, Integer metadataPropertyKey) throws
SQLException {
- Object value = super.getValue(columnIndex, metadataPropertyKey);
-
- if(value == null) {
+ if(!loaded && !(metadataPropertyKey ==
ResultsMetadataConstants.ELEMENT_NAME || metadataPropertyKey ==
ResultsMetadataConstants.DATA_TYPE)) {
loadFullMetadata();
- value = super.getValue(columnIndex, metadataPropertyKey);
+ loaded = true;
}
-
- return value;
+
+ return super.getValue(columnIndex, metadataPropertyKey);
}
}
Modified: trunk/client/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java 2010-04-16
21:45:46 UTC (rev 2062)
+++ trunk/client/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -319,7 +319,7 @@
* @throws SQLException, if parameter type/datatype do not match
*/
public void setBoolean (int parameterIndex, boolean value) throws SQLException {
- setObject(parameterIndex, new Boolean(value));
+ setObject(parameterIndex, value);
}
/**
@@ -473,9 +473,7 @@
// transform the object to a BigDecimal
BigDecimal bigDecimalObject = DataTypeTransformer.getBigDecimal(value);
// set scale on the BigDecimal
- bigDecimalObject.setScale(scale);
-
- setObject(parameterIndex, bigDecimalObject);
+ setObject(parameterIndex, bigDecimalObject.setScale(scale));
}
}
Modified: trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java 2010-04-16 21:45:46 UTC
(rev 2062)
+++ trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java 2010-04-20 19:13:08 UTC
(rev 2063)
@@ -288,7 +288,6 @@
this.driverConnection.closeStatement(this);
logger.fine(JDBCPlugin.Util.getString("MMStatement.Close_stmt_success"));
//$NON-NLS-1$
- driverConnection = null;
}
/**
Modified: trunk/client/src/main/java/org/teiid/jdbc/TeiidSQLException.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/TeiidSQLException.java 2010-04-16 21:45:46
UTC (rev 2062)
+++ trunk/client/src/main/java/org/teiid/jdbc/TeiidSQLException.java 2010-04-20 19:13:08
UTC (rev 2063)
@@ -29,14 +29,13 @@
import java.net.UnknownHostException;
import java.sql.SQLException;
+import org.teiid.client.ProcedureErrorInstructionException;
import org.teiid.client.security.InvalidSessionException;
import org.teiid.client.security.LogonException;
import org.teiid.net.CommunicationException;
import org.teiid.net.ConnectionException;
-
import com.metamatrix.api.exception.MetaMatrixProcessingException;
-import com.metamatrix.api.exception.query.ProcedureErrorInstructionException;
import com.metamatrix.core.MetaMatrixCoreException;
import com.metamatrix.core.MetaMatrixRuntimeException;
Modified: trunk/client/src/main/java/org/teiid/net/socket/ServiceInvocationStruct.java
===================================================================
---
trunk/client/src/main/java/org/teiid/net/socket/ServiceInvocationStruct.java 2010-04-16
21:45:46 UTC (rev 2062)
+++
trunk/client/src/main/java/org/teiid/net/socket/ServiceInvocationStruct.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -35,7 +35,7 @@
public final class ServiceInvocationStruct implements Externalizable {
private static final long serialVersionUID = 1207674062670068350L;
- public String targetClass;
+ public Class<?> targetClass;
public String methodName;
public Object[] args;
@@ -49,12 +49,12 @@
ArgCheck.isNotNull(targetClass);
this.args = args;
this.methodName = methodName;
- this.targetClass = targetClass.getName();
+ this.targetClass = targetClass;
}
public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
- this.targetClass = (String)in.readObject();
+ this.targetClass = (Class<?>)in.readObject();
this.methodName = (String)in.readObject();
this.args = ExternalizeUtil.readArray(in, Object.class);
}
Modified: trunk/client/src/main/java/org/teiid/net/socket/SocketUtil.java
===================================================================
--- trunk/client/src/main/java/org/teiid/net/socket/SocketUtil.java 2010-04-16 21:45:46
UTC (rev 2062)
+++ trunk/client/src/main/java/org/teiid/net/socket/SocketUtil.java 2010-04-20 19:13:08
UTC (rev 2063)
@@ -216,12 +216,15 @@
IOException exception = new
IOException(NetPlugin.Util.getString("SocketHelper.keystore_not_found", name));
//$NON-NLS-1$
exception.initCause(e);
throw exception;
- }
+ }
}
KeyStore ks = KeyStore.getInstance(type);
-
- ks.load(stream, password != null ? password.toCharArray() : null);
+ try {
+ ks.load(stream, password != null ? password.toCharArray() : null);
+ } finally {
+ stream.close();
+ }
return ks;
}
Modified:
trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/CompactObjectInputStream.java
===================================================================
---
trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/CompactObjectInputStream.java 2010-04-16
21:45:46 UTC (rev 2062)
+++
trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/CompactObjectInputStream.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -79,8 +79,12 @@
} else {
clazz = Class.forName(className, true, classLoader);
}
- return ObjectStreamClass.lookup(clazz);
+ return ObjectStreamClass.lookupAny(clazz);
default:
+ clazz = CompactObjectOutputStream.KNOWN_CODES.get(type);
+ if (clazz != null) {
+ return ObjectStreamClass.lookupAny(clazz);
+ }
throw new StreamCorruptedException(
"Unexpected class descriptor type: " + type);
//$NON-NLS-1$
}
Modified:
trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/CompactObjectOutputStream.java
===================================================================
---
trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/CompactObjectOutputStream.java 2010-04-16
21:45:46 UTC (rev 2062)
+++
trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/CompactObjectOutputStream.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -37,16 +37,46 @@
import java.sql.Clob;
import java.sql.SQLException;
import java.sql.SQLXML;
+import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
+import org.teiid.client.DQP;
+import org.teiid.client.RequestMessage;
+import org.teiid.client.ResultsMessage;
+import org.teiid.client.lob.LobChunk;
+import org.teiid.client.metadata.MetadataResult;
+import org.teiid.client.metadata.ParameterInfo;
+import org.teiid.client.plan.Annotation;
+import org.teiid.client.plan.PlanNode;
+import org.teiid.client.security.ILogon;
+import org.teiid.client.security.InvalidSessionException;
+import org.teiid.client.security.LogonException;
+import org.teiid.client.security.LogonResult;
+import org.teiid.client.security.MetaMatrixSecurityException;
+import org.teiid.client.security.SessionToken;
+import org.teiid.client.xa.XATransactionException;
+import org.teiid.client.xa.XidImpl;
+import org.teiid.net.socket.Handshake;
+import org.teiid.net.socket.Message;
+import org.teiid.net.socket.ServiceInvocationStruct;
+
+import com.metamatrix.api.exception.ExceptionHolder;
+import com.metamatrix.api.exception.MetaMatrixComponentException;
+import com.metamatrix.api.exception.MetaMatrixException;
+import com.metamatrix.api.exception.MetaMatrixProcessingException;
import com.metamatrix.common.types.BlobImpl;
+import com.metamatrix.common.types.BlobType;
import com.metamatrix.common.types.ClobImpl;
+import com.metamatrix.common.types.ClobType;
import com.metamatrix.common.types.InputStreamFactory;
import com.metamatrix.common.types.SQLXMLImpl;
import com.metamatrix.common.types.Streamable;
+import com.metamatrix.common.types.XMLType;
import com.metamatrix.common.types.InputStreamFactory.StreamFactoryReference;
import com.metamatrix.common.util.ReaderInputStream;
+import com.metamatrix.core.MetaMatrixRuntimeException;
/**
* @author The Netty Project (netty-dev(a)lists.jboss.org)
@@ -60,9 +90,58 @@
static final int TYPE_PRIMITIVE = 0;
static final int TYPE_NON_PRIMITIVE = 1;
+ public static final Map<Class<?>, Integer> KNOWN_CLASSES = new
HashMap<Class<?>, Integer>();
+ public static final Map<Integer, Class<?>> KNOWN_CODES = new
HashMap<Integer, Class<?>>();
+
private List<InputStream> streams = new LinkedList<InputStream>();
private List<StreamFactoryReference> references = new
LinkedList<StreamFactoryReference>();
+ public static void addKnownClass(Class<?> clazz, byte code) {
+ KNOWN_CLASSES.put(clazz, Integer.valueOf(code));
+ if (KNOWN_CODES.put(Integer.valueOf(code), clazz) != null) {
+ throw new MetaMatrixRuntimeException("Duplicate class"); //$NON-NLS-1$
+ }
+ }
+
+ static {
+ addKnownClass(ServiceInvocationStruct.class, (byte)2);
+ addKnownClass(Handshake.class, (byte)3);
+ addKnownClass(Message.class, (byte)4);
+ addKnownClass(SerializableReader.class, (byte)5);
+ addKnownClass(SerializableInputStream.class, (byte)6);
+
+ addKnownClass(DQP.class, (byte)10);
+ addKnownClass(LobChunk.class, (byte)11);
+ addKnownClass(RequestMessage.class, (byte)12);
+ addKnownClass(ResultsMessage.class, (byte)13);
+ addKnownClass(PlanNode.class, (byte)14);
+ addKnownClass(PlanNode.Property.class, (byte)15);
+ addKnownClass(Annotation.class, (byte)16);
+ addKnownClass(MetadataResult.class, (byte)17);
+ addKnownClass(ParameterInfo.class, (byte)18);
+ addKnownClass(XidImpl.class, (byte)19);
+ addKnownClass(BlobImpl.class, (byte)20);
+ addKnownClass(ClobImpl.class, (byte)21);
+ addKnownClass(SQLXMLImpl.class, (byte)22);
+ addKnownClass(BlobType.class, (byte)23);
+ addKnownClass(ClobType.class, (byte)24);
+ addKnownClass(XMLType.class, (byte)25);
+ addKnownClass(XATransactionException.class, (byte)26);
+
+ addKnownClass(ILogon.class, (byte)30);
+ addKnownClass(LogonResult.class, (byte)31);
+ addKnownClass(SessionToken.class, (byte)32);
+ addKnownClass(LogonException.class, (byte)33);
+ addKnownClass(MetaMatrixSecurityException.class, (byte)34);
+ addKnownClass(InvalidSessionException.class, (byte)35);
+
+ addKnownClass(ExceptionHolder.class, (byte)40);
+ addKnownClass(MetaMatrixRuntimeException.class, (byte)41);
+ addKnownClass(MetaMatrixComponentException.class, (byte)42);
+ addKnownClass(MetaMatrixException.class, (byte)43);
+ addKnownClass(MetaMatrixProcessingException.class, (byte)44);
+ }
+
public CompactObjectOutputStream(OutputStream out) throws IOException {
super(out);
enableReplaceObject(true);
@@ -83,12 +162,18 @@
@Override
protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException {
- if (desc.forClass().isPrimitive()) {
+ if (desc.forClass().isPrimitive()
+ || !(Externalizable.class.isAssignableFrom(desc.forClass()))) {
write(TYPE_PRIMITIVE);
super.writeClassDescriptor(desc);
} else {
- write(TYPE_NON_PRIMITIVE);
- writeUTF(desc.getName());
+ Integer b = KNOWN_CLASSES.get(desc.forClass());
+ if (b != null) {
+ write(b.intValue());
+ } else {
+ write(TYPE_NON_PRIMITIVE);
+ writeUTF(desc.getName());
+ }
}
}
@@ -110,17 +195,17 @@
return sfr;
} else if (obj instanceof SQLXML) {
streams.add(new ReaderInputStream(((SQLXML)obj).getCharacterStream(),
Charset.forName(Streamable.ENCODING)));
- StreamFactoryReference sfr = new SQLXMLImpl((InputStreamFactory)null);
+ StreamFactoryReference sfr = new SQLXMLImpl();
references.add(sfr);
return sfr;
} else if (obj instanceof Clob) {
streams.add(new ReaderInputStream(((Clob)obj).getCharacterStream(),
Charset.forName(Streamable.ENCODING)));
- StreamFactoryReference sfr = new ClobImpl(null, -1);
+ StreamFactoryReference sfr = new ClobImpl();
references.add(sfr);
return sfr;
} else if (obj instanceof Blob) {
streams.add(((Blob)obj).getBinaryStream());
- StreamFactoryReference sfr = new BlobImpl(null);
+ StreamFactoryReference sfr = new BlobImpl();
references.add(sfr);
return sfr;
}
Modified: trunk/client/src/test/java/org/teiid/jdbc/TestEmbeddedProfile.java
===================================================================
--- trunk/client/src/test/java/org/teiid/jdbc/TestEmbeddedProfile.java 2010-04-16 21:45:46
UTC (rev 2062)
+++ trunk/client/src/test/java/org/teiid/jdbc/TestEmbeddedProfile.java 2010-04-20 19:13:08
UTC (rev 2063)
@@ -29,10 +29,7 @@
import org.junit.Test;
-
-
public class TestEmbeddedProfile {
- EmbeddedProfile EmbeddedProfile = new EmbeddedProfile();
/*
* Test method for
'com.metamatrix.jdbc.EmbeddedEmbeddedProfile.acceptsURL(String)'
Modified: trunk/client/src/test/java/org/teiid/jdbc/TestMMSQLException.java
===================================================================
--- trunk/client/src/test/java/org/teiid/jdbc/TestMMSQLException.java 2010-04-16 21:45:46
UTC (rev 2062)
+++ trunk/client/src/test/java/org/teiid/jdbc/TestMMSQLException.java 2010-04-20 19:13:08
UTC (rev 2063)
@@ -31,15 +31,14 @@
import java.net.UnknownHostException;
import java.sql.SQLException;
-import org.teiid.jdbc.TeiidSQLException;
+import junit.framework.TestCase;
+
+import org.teiid.client.ProcedureErrorInstructionException;
import org.teiid.net.CommunicationException;
import org.teiid.net.ConnectionException;
-import junit.framework.TestCase;
-
import com.metamatrix.api.exception.MetaMatrixException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
-import com.metamatrix.api.exception.query.ProcedureErrorInstructionException;
import com.metamatrix.core.MetaMatrixCoreException;
import com.metamatrix.core.MetaMatrixRuntimeException;
Modified:
trunk/common-core/src/main/java/com/metamatrix/api/exception/ComponentNotFoundException.java
===================================================================
---
trunk/common-core/src/main/java/com/metamatrix/api/exception/ComponentNotFoundException.java 2010-04-16
21:45:46 UTC (rev 2062)
+++
trunk/common-core/src/main/java/com/metamatrix/api/exception/ComponentNotFoundException.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -28,7 +28,9 @@
*/
public class ComponentNotFoundException extends MetaMatrixComponentException {
- /**
+ private static final long serialVersionUID = 8484545412724259223L;
+
+ /**
* No-Arg Constructor
*/
public ComponentNotFoundException( ) {
Modified:
trunk/common-core/src/main/java/com/metamatrix/api/exception/ExceptionHolder.java
===================================================================
---
trunk/common-core/src/main/java/com/metamatrix/api/exception/ExceptionHolder.java 2010-04-16
21:45:46 UTC (rev 2062)
+++
trunk/common-core/src/main/java/com/metamatrix/api/exception/ExceptionHolder.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -1,23 +1,3 @@
-package com.metamatrix.api.exception;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutput;
-import java.io.ObjectOutputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import com.metamatrix.core.CorePlugin;
-import com.metamatrix.core.MetaMatrixCoreException;
-import com.metamatrix.core.MetaMatrixRuntimeException;
-import com.metamatrix.core.util.ObjectInputStreamWithClassloader;
-import com.metamatrix.core.util.ReflectionHelper;
-
/*
* JBoss, Home of Professional Open Source.
* See the COPYRIGHT.txt file distributed with this work for information
@@ -40,6 +20,27 @@
* 02110-1301 USA.
*/
+package com.metamatrix.api.exception;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutput;
+import java.io.ObjectOutputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import com.metamatrix.core.CorePlugin;
+import com.metamatrix.core.MetaMatrixCoreException;
+import com.metamatrix.core.MetaMatrixRuntimeException;
+import com.metamatrix.core.util.ExternalizeUtil;
+import com.metamatrix.core.util.ObjectInputStreamWithClassloader;
+import com.metamatrix.core.util.ReflectionHelper;
+
public class ExceptionHolder implements Externalizable {
private Throwable exception;
@@ -57,21 +58,21 @@
this.nested = nested;
}
-
//## JDBC4.0-begin ##
@Override
//## JDBC4.0-end ##
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- List<String> classNames = (List<String>)in.readObject();;
+ List<String> classNames = ExternalizeUtil.readList(in, String.class);
String message = (String)in.readObject();
StackTraceElement[] stackTrace = (StackTraceElement[])in.readObject();
+ String code = (String)in.readObject();
ExceptionHolder causeHolder = (ExceptionHolder)in.readObject();
byte[] serializedException = (byte[])in.readObject();
this.exception = readFromByteArray(serializedException);
if (this.exception == null) {
- Throwable t = buildException(classNames, message, stackTrace);
+ Throwable t = buildException(classNames, message, stackTrace, code);
if (t == null) {
if (causeHolder != null) {
this.exception = causeHolder.exception;
@@ -88,7 +89,7 @@
if (this.exception == null) {
this.exception = new MetaMatrixRuntimeException(message);
this.exception.setStackTrace(stackTrace);
- }
+ }
}
//## JDBC4.0-begin ##
@@ -104,9 +105,14 @@
classNames.add(clazz.getName());
clazz = clazz.getSuperclass();
}
- out.writeObject(classNames);
+ ExternalizeUtil.writeList(out, classNames);
out.writeObject(exception.getMessage());
out.writeObject(exception.getStackTrace());
+ if (exception instanceof MetaMatrixCoreException) {
+ out.writeObject(((MetaMatrixCoreException)exception).getCode());
+ } else {
+ out.writeObject(null);
+ }
// specify that this cause is nested exception; not top level
if (this.exception.getCause() != null && this.exception.getCause() !=
this.exception) {
@@ -129,7 +135,7 @@
return exception;
}
- private Throwable buildException(List<String> classNames, String message,
StackTraceElement[] stackTrace) {
+ private Throwable buildException(List<String> classNames, String message,
StackTraceElement[] stackTrace, String code) {
List<String> args =
Arrays.asList(CorePlugin.Util.getString("ExceptionHolder.converted_exception",
message, classNames)); //$NON-NLS-1$
Throwable result = null;
@@ -142,6 +148,12 @@
//
}
}
+
+ if (result instanceof MetaMatrixCoreException) {
+ ((MetaMatrixCoreException)result).setCode(code);
+ ((MetaMatrixCoreException)result).setOriginalType(classNames.get(0));
+ }
+
return result;
}
@@ -169,7 +181,7 @@
}
public static List<ExceptionHolder> toExceptionHolders(List<? extends
Throwable> throwables){
- List<ExceptionHolder> list = new ArrayList();
+ List<ExceptionHolder> list = new ArrayList<ExceptionHolder>();
for (Throwable t: throwables) {
list.add(new ExceptionHolder(t));
}
@@ -177,7 +189,7 @@
}
public static List<Throwable> toThrowables(List<ExceptionHolder>
exceptionHolders) {
- List<Throwable> list = new ArrayList();
+ List<Throwable> list = new ArrayList<Throwable>();
for(ExceptionHolder e: exceptionHolders) {
list.add(e.getException());
}
Modified:
trunk/common-core/src/main/java/com/metamatrix/api/exception/MetaMatrixComponentException.java
===================================================================
---
trunk/common-core/src/main/java/com/metamatrix/api/exception/MetaMatrixComponentException.java 2010-04-16
21:45:46 UTC (rev 2062)
+++
trunk/common-core/src/main/java/com/metamatrix/api/exception/MetaMatrixComponentException.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -29,8 +29,9 @@
*/
public class MetaMatrixComponentException extends MetaMatrixException {
+ private static final long serialVersionUID = 5853804556425201591L;
- /**
+ /**
* No-arg CTOR
*/
public MetaMatrixComponentException( ) {
Modified:
trunk/common-core/src/main/java/com/metamatrix/api/exception/MetaMatrixException.java
===================================================================
---
trunk/common-core/src/main/java/com/metamatrix/api/exception/MetaMatrixException.java 2010-04-16
21:45:46 UTC (rev 2062)
+++
trunk/common-core/src/main/java/com/metamatrix/api/exception/MetaMatrixException.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -41,7 +41,9 @@
*/
public class MetaMatrixException extends MetaMatrixCoreException {
- /**
+ private static final long serialVersionUID = -7601629097382531311L;
+
+ /**
* No-arg Constructor
*/
public MetaMatrixException() {
Modified:
trunk/common-core/src/main/java/com/metamatrix/api/exception/MetaMatrixProcessingException.java
===================================================================
---
trunk/common-core/src/main/java/com/metamatrix/api/exception/MetaMatrixProcessingException.java 2010-04-16
21:45:46 UTC (rev 2062)
+++
trunk/common-core/src/main/java/com/metamatrix/api/exception/MetaMatrixProcessingException.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -29,8 +29,9 @@
*/
public class MetaMatrixProcessingException extends MetaMatrixException {
+ private static final long serialVersionUID = -4013536109023540872L;
- /**
+ /**
* No-arg Constructor
*/
public MetaMatrixProcessingException() {
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/BaseLob.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/BaseLob.java 2010-04-16
21:45:46 UTC (rev 2062)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/BaseLob.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -1,18 +1,24 @@
package com.metamatrix.common.types;
+import java.io.Externalizable;
import java.io.IOException;
import java.io.InputStream;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.io.Reader;
-import java.io.Serializable;
import java.sql.SQLException;
import com.metamatrix.common.types.InputStreamFactory.StreamFactoryReference;
-public class BaseLob implements Serializable, StreamFactoryReference {
+public class BaseLob implements Externalizable, StreamFactoryReference {
private static final long serialVersionUID = -1586959324208959519L;
private InputStreamFactory streamFactory;
+ public BaseLob() {
+
+ }
+
protected BaseLob(InputStreamFactory streamFactory) {
this.streamFactory = streamFactory;
}
@@ -60,5 +66,16 @@
throw ex;
}
}
+
+ @Override
+ public void readExternal(ObjectInput in) throws IOException,
+ ClassNotFoundException {
+ streamFactory = (InputStreamFactory)in.readObject();
+ }
+
+ @Override
+ public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeObject(streamFactory);
+ }
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/BlobImpl.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/BlobImpl.java 2010-04-16
21:45:46 UTC (rev 2062)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/BlobImpl.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -43,6 +43,10 @@
*/
public class BlobImpl extends BaseLob implements Blob, StreamProvider {
+ public BlobImpl() {
+
+ }
+
/**
* Creates a MMBlob object with the <code>valueID</code>.
* @param valueID reference to value chunk in data source.
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/BlobType.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/BlobType.java 2010-04-16
21:45:46 UTC (rev 2062)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/BlobType.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -39,11 +39,7 @@
private static final long serialVersionUID = 1294191629070433450L;
- /**
- * Can't construct
- */
- BlobType() {
- super();
+ public BlobType() {
}
public BlobType(Blob blob) {
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/ClobImpl.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/ClobImpl.java 2010-04-16
21:45:46 UTC (rev 2062)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/ClobImpl.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -65,8 +65,12 @@
}
}
- private long len;
+ private long len = -1;
+ public ClobImpl() {
+
+ }
+
/**
* Creates a new ClobImpl. Note that the length is not taken from the {@link
InputStreamFactory} since
* it refers to bytes and not chars.
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/ClobType.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/ClobType.java 2010-04-16
21:45:46 UTC (rev 2062)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/ClobType.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -43,10 +43,7 @@
private static final long serialVersionUID = 2753412502127824104L;
- /**
- * Can't construct
- */
- ClobType() {
+ public ClobType() {
}
public ClobType(Clob clob) {
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/SQLXMLImpl.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/SQLXMLImpl.java 2010-04-16
21:45:46 UTC (rev 2062)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/SQLXMLImpl.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -44,6 +44,10 @@
*/
public class SQLXMLImpl extends BaseLob implements SQLXML {
+ public SQLXMLImpl() {
+
+ }
+
/**
* Constructs a SQLXML from bytes that are already encoded in {@link
Streamable#ENCODING}
* @param bytes
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/Streamable.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/Streamable.java 2010-04-16
21:45:46 UTC (rev 2062)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/Streamable.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -22,7 +22,10 @@
package com.metamatrix.common.types;
-import java.io.Serializable;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import com.metamatrix.core.CorePlugin;
@@ -34,7 +37,7 @@
* object is in buffer manager, but the contents will never be written to disk;
* this is the ID that client needs to reference to get the chunk of data.
*/
-public abstract class Streamable<T> implements Serializable {
+public abstract class Streamable<T> implements Externalizable {
private static final long serialVersionUID = -8252488562134729374L;
@@ -84,20 +87,16 @@
}
@Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (!(obj instanceof Streamable<?>)) {
- return false;
- }
- Streamable<?> other = (Streamable<?>)obj;
-
- if (this.reference != null) {
- return this.reference.equals(other.reference);
- }
-
- return this.referenceStreamId == other.referenceStreamId;
+ public void readExternal(ObjectInput in) throws IOException,
+ ClassNotFoundException {
+ length = in.readLong();
+ referenceStreamId = (String)in.readObject();
}
+
+ @Override
+ public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeLong(length);
+ out.writeObject(referenceStreamId);
+ }
}
Modified:
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToCharacterTransform.java
===================================================================
---
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToCharacterTransform.java 2010-04-16
21:45:46 UTC (rev 2062)
+++
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/StringToCharacterTransform.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -39,7 +39,7 @@
String s = (String) value;
if (s.length() == 0) {
- return new Character(' ');
+ return Character.valueOf(' ');
}
return Character.valueOf(s.charAt(0));
Modified: trunk/common-core/src/main/java/com/metamatrix/common/util/PropertiesUtils.java
===================================================================
---
trunk/common-core/src/main/java/com/metamatrix/common/util/PropertiesUtils.java 2010-04-16
21:45:46 UTC (rev 2062)
+++
trunk/common-core/src/main/java/com/metamatrix/common/util/PropertiesUtils.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -41,7 +41,6 @@
import java.util.Map;
import java.util.Properties;
-import com.metamatrix.common.properties.UnmodifiableProperties;
import com.metamatrix.core.CorePlugin;
import com.metamatrix.core.MetaMatrixRuntimeException;
import com.metamatrix.core.util.ArgCheck;
@@ -152,58 +151,22 @@
* copy of the underlying Properties object.
*/
public static Properties clone( Properties props ) {
- boolean makeUnmodifiable = false;
- if ( props instanceof UnmodifiableProperties ) {
- makeUnmodifiable = true;
- }
- return clone(props, makeUnmodifiable);
+ return clone(props, null, false);
}
/**
* Performs a correct deep clone of the properties object by capturing
* all properties in the default(s) and placing them directly into the
- * new Properties object. If an unmodifiable properties object is sought
- * this method returns an
- * <code>UnmodifiableProperties</code> instance around a new (flattened)
- * copy of the underlying Properties object.
- */
- public static Properties clone( Properties props, boolean makeUnmodifiable ) {
- return clone(props, null, false, makeUnmodifiable);
- }
-
- /**
- * Performs a correct deep clone of the properties object by capturing
- * all properties in the default(s) and placing them directly into the
* new Properties object. If the input is an instance of
* <code>UnmodifiableProperties</code>, this method returns an
* <code>UnmodifiableProperties</code> instance around a new (flattened)
* copy of the underlying Properties object.
*/
public static Properties clone( Properties props, Properties defaults, boolean
deepClone ) {
- boolean makeUnmodifiable = false;
- if ( props instanceof UnmodifiableProperties ) {
- makeUnmodifiable = true;
- }
- return clone(props,defaults,deepClone, makeUnmodifiable);
- }
-
- /**
- * Performs a correct deep clone of the properties object by capturing
- * all properties in the default(s) and placing them directly into the
- * new Properties object. If an unmodifiable properties object is sought
- * this method returns an
- * <code>UnmodifiableProperties</code> instance around a new (flattened)
- * copy of the underlying Properties object.
- */
- public static Properties clone( Properties props, Properties defaults, boolean
deepClone, boolean makeUnmodifiable ) {
Properties result = null;
if ( defaults != null ) {
if ( deepClone ) {
- if ( defaults instanceof UnmodifiableProperties ) {
- defaults = clone(defaults,true);
- } else {
- defaults = clone(defaults,false);
- }
+ defaults = clone(defaults);
}
result = new Properties(defaults);
} else {
@@ -212,10 +175,6 @@
putAll(result, props);
- if ( makeUnmodifiable ) {
- result = new UnmodifiableProperties(result);
- }
-
return result;
}
@@ -441,7 +400,7 @@
fr = new FileReader(fileName);
br = new BufferedReader(fr);
String header = br.readLine();
- if (header.indexOf('#') == 0) {
+ if (header != null && header.indexOf('#') == 0) {
header = header.substring(1);
}
return header;
@@ -887,7 +846,7 @@
// First ensure the pattern is safe to work with.
// If the pattern is an empty string, set it to '*',
// which means anything passes.
- pattern.trim();
+ pattern = pattern.trim();
if ( pattern.length() == 0 )
pattern = "*"; //$NON-NLS-1$
Modified:
trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/DhKeyGenerator.java
===================================================================
---
trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/DhKeyGenerator.java 2010-04-16
21:45:46 UTC (rev 2062)
+++
trunk/common-core/src/main/java/com/metamatrix/common/util/crypto/DhKeyGenerator.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -23,6 +23,7 @@
package com.metamatrix.common.util.crypto;
import java.io.IOException;
+import java.io.InputStream;
import java.math.BigInteger;
import java.security.AlgorithmParameterGenerator;
import java.security.AlgorithmParameters;
@@ -45,23 +46,31 @@
import com.metamatrix.core.MetaMatrixRuntimeException;
/**
- * Helper class that supports anonymous ephemeral Diffie-Hellmen
+ * Helper class that supports anonymous ephemeral Diffie-Hellman
*
* Parameters are stored in the dh.properties file
*/
public class DhKeyGenerator {
- private static String ALGORITHM = "DH"; //$NON-NLS-1$
+ private static String ALGORITHM = "DiffieHellman"; //$NON-NLS-1$
private static String DIGEST = "SHA-256"; //$NON-NLS-1$
private static DHParameterSpec DH_SPEC;
static {
Properties props = new Properties();
+ InputStream is = null;
try {
- props.load(DhKeyGenerator.class
- .getResourceAsStream("dh.properties")); //$NON-NLS-1$
+ is = DhKeyGenerator.class.getResourceAsStream("dh.properties");
//$NON-NLS-1$
+ props.load(is);
} catch (IOException e) {
throw new MetaMatrixRuntimeException(e);
+ } finally {
+ try {
+ if (is != null) {
+ is.close();
+ }
+ } catch (IOException e) {
+ }
}
BigInteger p = new BigInteger(props.getProperty("p")); //$NON-NLS-1$
BigInteger g = new BigInteger(props.getProperty("g")); //$NON-NLS-1$
Modified:
trunk/common-core/src/main/java/com/metamatrix/core/MetaMatrixCoreException.java
===================================================================
---
trunk/common-core/src/main/java/com/metamatrix/core/MetaMatrixCoreException.java 2010-04-16
21:45:46 UTC (rev 2062)
+++
trunk/common-core/src/main/java/com/metamatrix/core/MetaMatrixCoreException.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -33,7 +33,9 @@
*/
public class MetaMatrixCoreException extends Exception {
+ private static final long serialVersionUID = -3033427629587497938L;
protected String code;
+ private transient String originalType;
public MetaMatrixCoreException() {
}
@@ -46,7 +48,6 @@
super(message);
this.code = errorCode;
}
-
public MetaMatrixCoreException(Throwable e) {
this(e, e.getMessage());
@@ -66,6 +67,18 @@
return this.code;
}
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+ public String getOriginalType() {
+ return originalType;
+ }
+
+ public void setOriginalType(String originalType) {
+ this.originalType = originalType;
+ }
+
private void setCode(Throwable e) {
if (e instanceof MetaMatrixCoreException) {
this.code = (((MetaMatrixCoreException) e).getCode());
Modified: trunk/common-core/src/main/java/com/metamatrix/core/util/ExternalizeUtil.java
===================================================================
---
trunk/common-core/src/main/java/com/metamatrix/core/util/ExternalizeUtil.java 2010-04-16
21:45:46 UTC (rev 2062)
+++
trunk/common-core/src/main/java/com/metamatrix/core/util/ExternalizeUtil.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -155,15 +155,4 @@
return map;
}
- /*
- * Serializing CoreException and subclasses.
- */
- public static void writeThrowable(ObjectOutput out, Throwable t) throws IOException
{
- out.writeObject(t);
- }
-
- public static Throwable readThrowable(ObjectInput in) throws IOException,
ClassNotFoundException {
- return (Throwable)in.readObject();
- }
-
}
Modified: trunk/common-core/src/test/java/com/metamatrix/common/types/TestBlobValue.java
===================================================================
---
trunk/common-core/src/test/java/com/metamatrix/common/types/TestBlobValue.java 2010-04-16
21:45:46 UTC (rev 2062)
+++
trunk/common-core/src/test/java/com/metamatrix/common/types/TestBlobValue.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -46,7 +46,7 @@
}
- public void testClobValuePersistence() throws Exception {
+ public void testBlobValuePersistence() throws Exception {
String testString = "this is test clob"; //$NON-NLS-1$
SerialBlob blob = new SerialBlob(testString.getBytes());
Modified:
trunk/common-core/src/test/java/com/metamatrix/common/util/TestPropertiesUtils.java
===================================================================
---
trunk/common-core/src/test/java/com/metamatrix/common/util/TestPropertiesUtils.java 2010-04-16
21:45:46 UTC (rev 2062)
+++
trunk/common-core/src/test/java/com/metamatrix/common/util/TestPropertiesUtils.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -36,7 +36,6 @@
import junit.framework.TestCase;
-import com.metamatrix.common.properties.UnmodifiableProperties;
import com.metamatrix.common.util.PropertiesUtils.InvalidPropertyException;
import com.metamatrix.core.util.UnitTestUtil;
@@ -123,127 +122,59 @@
/**
* Tests {@link com.metamatrix.common.utils.PropertiesUtils#clone(Properties)}
*/
- public void testSimpleUnmodifiableClone(){
- Properties a = make(MAP_A, null, UNMODIFIABLE);
- a = PropertiesUtils.clone(a);
- assertTrue(verifyProps(a, LIST_A));
- assertTrue(a instanceof UnmodifiableProperties);
- }
-
- /**
- * Tests {@link com.metamatrix.common.utils.PropertiesUtils#clone(Properties)}
- */
public void testSimpleModifiableClone(){
Properties a = make(MAP_A, null, !UNMODIFIABLE);
a = PropertiesUtils.clone(a);
assertTrue(verifyProps(a, LIST_A));
- assertTrue(!(a instanceof UnmodifiableProperties));
}
/**
* Tests {@link com.metamatrix.common.utils.PropertiesUtils#clone(Properties)}
*/
- public void testSimpleUnmodifiableCloneWithUnmodifiableDefaults(){
- Properties ab = make(MAP_A, make(MAP_B, null, UNMODIFIABLE), UNMODIFIABLE);
- ab = PropertiesUtils.clone(ab);
- assertTrue(verifyProps(ab, LIST_AB));
- assertTrue(ab instanceof UnmodifiableProperties);
- }
-
- /**
- * Tests {@link com.metamatrix.common.utils.PropertiesUtils#clone(Properties)}
- */
public void testSimpleModifiableCloneWithUnmodifiableDefaults(){
Properties ab = make(MAP_A, make(MAP_B, null, UNMODIFIABLE), !UNMODIFIABLE);
ab = PropertiesUtils.clone(ab);
assertTrue(verifyProps(ab, LIST_AB));
- assertTrue(!(ab instanceof UnmodifiableProperties));
}
/**
* Tests {@link com.metamatrix.common.utils.PropertiesUtils#clone(Properties)}
*/
- public void testSimpleUnmodifiableCloneWithModifiableDefaults(){
- Properties ab = make(MAP_A, make(MAP_B, null, !UNMODIFIABLE), UNMODIFIABLE);
- ab = PropertiesUtils.clone(ab);
- assertTrue(verifyProps(ab, LIST_AB));
- assertTrue(ab instanceof UnmodifiableProperties);
- }
-
- /**
- * Tests {@link com.metamatrix.common.utils.PropertiesUtils#clone(Properties)}
- */
public void testSimpleModifiableCloneWithModifiableDefaults(){
Properties ab = make(MAP_A, make(MAP_B, null, !UNMODIFIABLE), !UNMODIFIABLE);
ab = PropertiesUtils.clone(ab);
assertTrue(verifyProps(ab, LIST_AB));
- assertTrue(!(ab instanceof UnmodifiableProperties));
}
-
-
-
-
-
-
-
-
// ##################### clone(Properties, boolean) ##########################
-
/**
* Tests {@link com.metamatrix.common.utils.PropertiesUtils#clone(Properties, boolean)}
*/
public void testCloneModifiableAsModifiable(){
Properties a = make(MAP_A, null, !UNMODIFIABLE);
- a = PropertiesUtils.clone(a, !UNMODIFIABLE);
+ a = PropertiesUtils.clone(a);
assertTrue(verifyProps(a, LIST_A));
- assertTrue(!(a instanceof UnmodifiableProperties));
}
/**
* Tests {@link com.metamatrix.common.utils.PropertiesUtils#clone(Properties, boolean)}
*/
- public void testCloneModifiableAsUnmodifiable(){
- Properties a = make(MAP_A, null, !UNMODIFIABLE);
- a = PropertiesUtils.clone(a, UNMODIFIABLE);
- assertTrue(verifyProps(a, LIST_A));
- assertTrue(a instanceof UnmodifiableProperties);
- }
-
- /**
- * Tests {@link com.metamatrix.common.utils.PropertiesUtils#clone(Properties, boolean)}
- */
public void testCloneUnmodifiableAsModifiable(){
Properties a = make(MAP_A, null, UNMODIFIABLE);
- a = PropertiesUtils.clone(a, !UNMODIFIABLE);
+ a = PropertiesUtils.clone(a);
assertTrue(verifyProps(a, LIST_A));
- assertTrue(!(a instanceof UnmodifiableProperties));
}
/**
* Tests {@link com.metamatrix.common.utils.PropertiesUtils#clone(Properties, boolean)}
*/
- public void testCloneUnmodifiableAsUnmodifiable(){
- Properties a = make(MAP_A, null, UNMODIFIABLE);
- a = PropertiesUtils.clone(a, UNMODIFIABLE);
- assertTrue(verifyProps(a, LIST_A));
- assertTrue(a instanceof UnmodifiableProperties);
- }
-
-
- /**
- * Tests {@link com.metamatrix.common.utils.PropertiesUtils#clone(Properties, boolean)}
- */
public void testCloneModifiableWithModifiableAsModifiable(){
Properties ab = make(MAP_A, make(MAP_B, null, !UNMODIFIABLE), !UNMODIFIABLE);
- ab = PropertiesUtils.clone(ab, !UNMODIFIABLE);
+ ab = PropertiesUtils.clone(ab);
assertTrue(verifyProps(ab, LIST_AB));
- assertTrue(!(ab instanceof UnmodifiableProperties));
}
-
-
// ######## clone(Properties, Properties, boolean, boolean) ##################
/**
@@ -252,9 +183,8 @@
public void testCloneModAndModAsMod(){
Properties a = make(MAP_A, null, !UNMODIFIABLE);
Properties b = make(MAP_B, null, !UNMODIFIABLE);
- a = PropertiesUtils.clone(a, b, !DEEP_CLONE, !UNMODIFIABLE);
+ a = PropertiesUtils.clone(a, b, !DEEP_CLONE);
assertTrue(verifyProps(a, LIST_AB));
- assertTrue(!(a instanceof UnmodifiableProperties));
}
/**
@@ -263,42 +193,18 @@
public void testDeepcloneModAndModAsMod(){
Properties a = make(MAP_A, null, !UNMODIFIABLE);
Properties b = make(MAP_B, null, !UNMODIFIABLE);
- a = PropertiesUtils.clone(a, b, DEEP_CLONE, !UNMODIFIABLE);
+ a = PropertiesUtils.clone(a, b, DEEP_CLONE);
assertTrue(verifyProps(a, LIST_AB));
- assertTrue(!(a instanceof UnmodifiableProperties));
}
/**
* Tests {@link com.metamatrix.common.utils.PropertiesUtils#clone(Properties,
Properties, boolean, boolean)}
*/
- public void testCloneModAndModAsUnmod(){
- Properties a = make(MAP_A, null, !UNMODIFIABLE);
- Properties b = make(MAP_B, null, !UNMODIFIABLE);
- a = PropertiesUtils.clone(a, b, !DEEP_CLONE, UNMODIFIABLE);
- assertTrue(verifyProps(a, LIST_AB));
- assertTrue(a instanceof UnmodifiableProperties);
- }
-
- /**
- * Tests {@link com.metamatrix.common.utils.PropertiesUtils#clone(Properties,
Properties, boolean, boolean)}
- */
- public void testDeepcloneModAndModAsUnmod(){
- Properties a = make(MAP_A, null, !UNMODIFIABLE);
- Properties b = make(MAP_B, null, !UNMODIFIABLE);
- a = PropertiesUtils.clone(a, b, DEEP_CLONE, UNMODIFIABLE);
- assertTrue(verifyProps(a, LIST_AB));
- assertTrue(a instanceof UnmodifiableProperties);
- }
-
- /**
- * Tests {@link com.metamatrix.common.utils.PropertiesUtils#clone(Properties,
Properties, boolean, boolean)}
- */
public void testCloneModAndUnmodAsMod(){
Properties a = make(MAP_A, null, !UNMODIFIABLE);
Properties b = make(MAP_B, null, UNMODIFIABLE);
- a = PropertiesUtils.clone(a, b, !DEEP_CLONE, !UNMODIFIABLE);
+ a = PropertiesUtils.clone(a, b, !DEEP_CLONE);
assertTrue(verifyProps(a, LIST_AB));
- assertTrue(!(a instanceof UnmodifiableProperties));
}
/**
@@ -307,42 +213,18 @@
public void testDeepcloneModAndUnmodAsMod(){
Properties a = make(MAP_A, null, !UNMODIFIABLE);
Properties b = make(MAP_B, null, UNMODIFIABLE);
- a = PropertiesUtils.clone(a, b, DEEP_CLONE, !UNMODIFIABLE);
+ a = PropertiesUtils.clone(a, b, DEEP_CLONE);
assertTrue(verifyProps(a, LIST_AB));
- assertTrue(!(a instanceof UnmodifiableProperties));
}
/**
* Tests {@link com.metamatrix.common.utils.PropertiesUtils#clone(Properties,
Properties, boolean, boolean)}
*/
- public void testCloneModAndUnmodAsUnmod(){
- Properties a = make(MAP_A, null, !UNMODIFIABLE);
- Properties b = make(MAP_B, null, UNMODIFIABLE);
- a = PropertiesUtils.clone(a, b, !DEEP_CLONE, UNMODIFIABLE);
- assertTrue(verifyProps(a, LIST_AB));
- assertTrue(a instanceof UnmodifiableProperties);
- }
-
- /**
- * Tests {@link com.metamatrix.common.utils.PropertiesUtils#clone(Properties,
Properties, boolean, boolean)}
- */
- public void testDeepcloneModAndUnmodAsUnmod(){
- Properties a = make(MAP_A, null, !UNMODIFIABLE);
- Properties b = make(MAP_B, null, UNMODIFIABLE);
- a = PropertiesUtils.clone(a, b, DEEP_CLONE, UNMODIFIABLE);
- assertTrue(verifyProps(a, LIST_AB));
- assertTrue(a instanceof UnmodifiableProperties);
- }
-
- /**
- * Tests {@link com.metamatrix.common.utils.PropertiesUtils#clone(Properties,
Properties, boolean, boolean)}
- */
public void testCloneUnmodAndModAsMod(){
Properties a = make(MAP_A, null, UNMODIFIABLE);
Properties b = make(MAP_B, null, !UNMODIFIABLE);
- a = PropertiesUtils.clone(a, b, !DEEP_CLONE, !UNMODIFIABLE);
+ a = PropertiesUtils.clone(a, b, !DEEP_CLONE);
assertTrue(verifyProps(a, LIST_AB));
- assertTrue(!(a instanceof UnmodifiableProperties));
}
/**
@@ -351,42 +233,18 @@
public void testDeepcloneUnmodAndModAsMod(){
Properties a = make(MAP_A, null, UNMODIFIABLE);
Properties b = make(MAP_B, null, !UNMODIFIABLE);
- a = PropertiesUtils.clone(a, b, DEEP_CLONE, !UNMODIFIABLE);
+ a = PropertiesUtils.clone(a, b, DEEP_CLONE);
assertTrue(verifyProps(a, LIST_AB));
- assertTrue(!(a instanceof UnmodifiableProperties));
}
/**
* Tests {@link com.metamatrix.common.utils.PropertiesUtils#clone(Properties,
Properties, boolean, boolean)}
*/
- public void testCloneUnmodAndModAsUnmod(){
- Properties a = make(MAP_A, null, UNMODIFIABLE);
- Properties b = make(MAP_B, null, !UNMODIFIABLE);
- a = PropertiesUtils.clone(a, b, !DEEP_CLONE, UNMODIFIABLE);
- assertTrue(verifyProps(a, LIST_AB));
- assertTrue(a instanceof UnmodifiableProperties);
- }
-
- /**
- * Tests {@link com.metamatrix.common.utils.PropertiesUtils#clone(Properties,
Properties, boolean, boolean)}
- */
- public void testDeepcloneUnmodAndModAsUnmod(){
- Properties a = make(MAP_A, null, UNMODIFIABLE);
- Properties b = make(MAP_B, null, !UNMODIFIABLE);
- a = PropertiesUtils.clone(a, b, DEEP_CLONE, UNMODIFIABLE);
- assertTrue(verifyProps(a, LIST_AB));
- assertTrue(a instanceof UnmodifiableProperties);
- }
-
- /**
- * Tests {@link com.metamatrix.common.utils.PropertiesUtils#clone(Properties,
Properties, boolean, boolean)}
- */
public void testCloneUnmodAndUnmodAsMod(){
Properties a = make(MAP_A, null, UNMODIFIABLE);
Properties b = make(MAP_B, null, UNMODIFIABLE);
- a = PropertiesUtils.clone(a, b, !DEEP_CLONE, !UNMODIFIABLE);
+ a = PropertiesUtils.clone(a, b, !DEEP_CLONE);
assertTrue(verifyProps(a, LIST_AB));
- assertTrue(!(a instanceof UnmodifiableProperties));
}
/**
@@ -395,61 +253,12 @@
public void testDeepcloneUnmodAndUnmodAsMod(){
Properties a = make(MAP_A, null, UNMODIFIABLE);
Properties b = make(MAP_B, null, UNMODIFIABLE);
- a = PropertiesUtils.clone(a, b, DEEP_CLONE, !UNMODIFIABLE);
+ a = PropertiesUtils.clone(a, b, DEEP_CLONE);
assertTrue(verifyProps(a, LIST_AB));
- assertTrue(!(a instanceof UnmodifiableProperties));
}
- /**
- * Tests {@link com.metamatrix.common.utils.PropertiesUtils#clone(Properties,
Properties, boolean, boolean)}
- */
- public void testCloneUnmodAndUnmodAsUnmod(){
- Properties a = make(MAP_A, null, UNMODIFIABLE);
- Properties b = make(MAP_B, null, UNMODIFIABLE);
- a = PropertiesUtils.clone(a, b, !DEEP_CLONE, UNMODIFIABLE);
- assertTrue(verifyProps(a, LIST_AB));
- assertTrue(a instanceof UnmodifiableProperties);
- }
-
- /**
- * Tests {@link com.metamatrix.common.utils.PropertiesUtils#clone(Properties,
Properties, boolean, boolean)}
- */
- public void testDeepcloneUnmodAndUnmodAsUnmod(){
- Properties a = make(MAP_A, null, UNMODIFIABLE);
- Properties b = make(MAP_B, null, UNMODIFIABLE);
- a = PropertiesUtils.clone(a, b, DEEP_CLONE, UNMODIFIABLE);
- assertTrue(verifyProps(a, LIST_AB));
- assertTrue(a instanceof UnmodifiableProperties);
- }
-
-
// ########################## ADVANCED #######################################
- /**
- * Tests {@link com.metamatrix.common.utils.PropertiesUtils#clone(Properties,
Properties, boolean, boolean)}
- */
- public void testAdvanced(){
- Properties a = make(MAP_A, null, UNMODIFIABLE);
- Properties bc = make(MAP_B, make(MAP_C, null, UNMODIFIABLE), UNMODIFIABLE);
- a = PropertiesUtils.clone(a, bc, DEEP_CLONE, UNMODIFIABLE);
- assertTrue(verifyProps(a, LIST_ABC));
- assertTrue(a instanceof UnmodifiableProperties);
- }
-
- /**
- * Tests {@link com.metamatrix.common.utils.PropertiesUtils#clone(Properties,
Properties, boolean, boolean)}
- */
- public void testAdvanced2(){
- Properties ab = make(MAP_A, make(MAP_B, null, UNMODIFIABLE), UNMODIFIABLE);
- Properties c = make(MAP_C, null, UNMODIFIABLE);
- ab = PropertiesUtils.clone(ab, c, DEEP_CLONE, UNMODIFIABLE);
- assertTrue(verifyProps(ab, LIST_ABC));
- assertTrue(ab instanceof UnmodifiableProperties);
- }
-
-
-
-
//===================================================================
//TESTS HELPERS
//===================================================================
@@ -550,9 +359,6 @@
Map.Entry anEntry = (Map.Entry) i.next();
props.setProperty((String)anEntry.getKey(),(String)anEntry.getValue());
}
- if (makeUnmodifiable){
- props = new UnmodifiableProperties(props);
- }
return props;
}
Modified:
trunk/common-core/src/test/java/com/metamatrix/core/util/TestExternalizeUtil.java
===================================================================
---
trunk/common-core/src/test/java/com/metamatrix/core/util/TestExternalizeUtil.java 2010-04-16
21:45:46 UTC (rev 2062)
+++
trunk/common-core/src/test/java/com/metamatrix/core/util/TestExternalizeUtil.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -31,8 +31,6 @@
import junit.framework.TestCase;
-import com.metamatrix.core.MetaMatrixCoreException;
-
public class TestExternalizeUtil extends TestCase {
private ByteArrayOutputStream bout;
@@ -51,71 +49,6 @@
oout = new ObjectOutputStream(bout);
}
- /**
- * Test ExternalizeUtil writeThrowable() and readThrowable() on Throwables.
- * @throws Exception
- */
- public void testWriteThrowable() throws Exception {
- Throwable t3 = new Throwable("throwable level 3"); //$NON-NLS-1$
- Throwable t2 = new Throwable("throwable level 2", t3); //$NON-NLS-1$
- Throwable t1 = new Throwable("throwable level 1", t2); //$NON-NLS-1$
-
- ExternalizeUtil.writeThrowable(oout, t1);
- oout.flush();
- ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
- ObjectInputStream oin = new ObjectInputStream(bin);
-
- Throwable result1 = ExternalizeUtil.readThrowable(oin);
- assertEqualThrowables(t1, result1);
-
- Throwable result2 = result1.getCause();
- assertEqualThrowables(t2, result2);
-
- Throwable result3 = result2.getCause();
- assertEqualThrowables(t3, result3);
-
- }
-
- /**
- * Test ExternalizeUtil writeThrowable() and readThrowable() on
MetaMatrixCoreExceptions.
- * @throws Exception
- */
- public void testWriteThrowableMetaMatrixCoreException() throws Exception {
- MetaMatrixCoreException t3 = new MetaMatrixCoreException(new
Exception("test-externalizable")); //$NON-NLS-1$
- MetaMatrixCoreException t2 = new MetaMatrixCoreException(t3);
- MetaMatrixCoreException t1 = new MetaMatrixCoreException(t2);
-
-
- ExternalizeUtil.writeThrowable(oout, t1);
- oout.flush();
- ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
- ObjectInputStream oin = new ObjectInputStream(bin);
-
- MetaMatrixCoreException result1 = (MetaMatrixCoreException)
ExternalizeUtil.readThrowable(oin);
- assertEqualThrowables(t1, result1);
-
- MetaMatrixCoreException result2 = (MetaMatrixCoreException) result1.getCause();
- assertEqualThrowables(t2, result2);
-
- MetaMatrixCoreException result3 = (MetaMatrixCoreException) result2.getCause();
- assertEqualThrowables(t3, result3);
- }
-
- /**
- * Assert that the two exceptions have the same message and status.
- */
- public static void assertEqualThrowables(Throwable e1, Throwable e2) {
- assertEquals(e1.getClass(), e2.getClass());
- assertEquals(e1.getMessage(), e2.getMessage());
-
- StackTraceElement[] stack1 = e1.getStackTrace();
- StackTraceElement[] stack2 = e2.getStackTrace();
- assertEquals(stack1.length, stack2.length);
- for (int i=0; i<stack1.length; i++) {
- assertEquals(stack1[i], stack2[i]);
- }
- }
-
public void testEmptyCollection() throws Exception {
ExternalizeUtil.writeCollection(oout, Arrays.asList(new Object[0]));
oout.flush();
Modified: trunk/connector-api/src/main/java/org/teiid/connector/api/MetadataProvider.java
===================================================================
---
trunk/connector-api/src/main/java/org/teiid/connector/api/MetadataProvider.java 2010-04-16
21:45:46 UTC (rev 2062)
+++
trunk/connector-api/src/main/java/org/teiid/connector/api/MetadataProvider.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -1,3 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
package org.teiid.connector.api;
import org.teiid.connector.metadata.runtime.MetadataFactory;
Modified:
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/connection/impl/ConnectionImpl.java
===================================================================
---
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/connection/impl/ConnectionImpl.java 2010-04-16
21:45:46 UTC (rev 2062)
+++
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/connection/impl/ConnectionImpl.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -47,7 +47,6 @@
import com.sforce.soap.partner.InvalidIdFault;
import com.sforce.soap.partner.LoginFault;
import com.sforce.soap.partner.LoginResult;
-import com.sforce.soap.partner.LoginScopeHeader;
import com.sforce.soap.partner.MalformedQueryFault;
import com.sforce.soap.partner.MruHeader;
import com.sforce.soap.partner.ObjectFactory;
Copied:
trunk/engine/src/main/java/com/metamatrix/api/exception/query/CriteriaEvaluationException.java
(from rev 2059,
trunk/client/src/main/java/com/metamatrix/api/exception/query/CriteriaEvaluationException.java)
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/api/exception/query/CriteriaEvaluationException.java
(rev 0)
+++
trunk/engine/src/main/java/com/metamatrix/api/exception/query/CriteriaEvaluationException.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -0,0 +1,79 @@
+/*
+ * 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.api.exception.query;
+
+import com.metamatrix.api.exception.MetaMatrixProcessingException;
+
+/**
+ * This exception is thrown when an error occurs while evaluating a SQL criteria.
+ */
+public class CriteriaEvaluationException extends MetaMatrixProcessingException {
+
+ /**
+ * No-arg constructor required by Externalizable semantics.
+ */
+ public CriteriaEvaluationException() {
+ super();
+ }
+
+ /**
+ * Construct an instance with the message specified.
+ *
+ * @param message A message describing the exception
+ */
+ public CriteriaEvaluationException( String message ) {
+ super( message );
+ }
+
+ /**
+ * Construct an instance with the message and error code specified.
+ *
+ * @param message A message describing the exception
+ * @param code The error code
+ */
+ public CriteriaEvaluationException( String code, String message ) {
+ super( code, message );
+ }
+
+ /**
+ * Construct an instance from a message and an exception to chain to this one.
+ *
+ * @param message A message describing the exception
+ * @param e An exception to nest within this one
+ */
+ public CriteriaEvaluationException( Throwable e, String message ) {
+ super( e, message );
+ }
+
+ /**
+ * Construct an instance from a message and a code and an exception to
+ * chain to this one.
+ *
+ * @param e An exception to nest within this one
+ * @param message A message describing the exception
+ * @param code A code denoting the exception
+ */
+ public CriteriaEvaluationException( Throwable e, String code, String message ) {
+ super( e, code, message );
+ }
+}
Copied:
trunk/engine/src/main/java/com/metamatrix/api/exception/query/ExpressionEvaluationException.java
(from rev 2059,
trunk/client/src/main/java/com/metamatrix/api/exception/query/ExpressionEvaluationException.java)
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/api/exception/query/ExpressionEvaluationException.java
(rev 0)
+++
trunk/engine/src/main/java/com/metamatrix/api/exception/query/ExpressionEvaluationException.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -0,0 +1,79 @@
+/*
+ * 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.api.exception.query;
+
+import com.metamatrix.api.exception.MetaMatrixProcessingException;
+
+/**
+ * This exception is thrown when an error occurs while evaluating a SQL expression.
+ */
+public class ExpressionEvaluationException extends MetaMatrixProcessingException {
+
+ /**
+ * No-arg constructor required by Externalizable semantics.
+ */
+ public ExpressionEvaluationException() {
+ super();
+ }
+
+ /**
+ * Construct an instance with the message specified.
+ *
+ * @param message A message describing the exception
+ */
+ public ExpressionEvaluationException( String message ) {
+ super( message );
+ }
+
+ /**
+ * Construct an instance with the message and error code specified.
+ *
+ * @param message A message describing the exception
+ * @param code The error code
+ */
+ public ExpressionEvaluationException( String code, String message ) {
+ super( code, message );
+ }
+
+ /**
+ * Construct an instance from a message and an exception to chain to this one.
+ *
+ * @param message A message describing the exception
+ * @param e An exception to nest within this one
+ */
+ public ExpressionEvaluationException( Throwable e, String message ) {
+ super( e, message );
+ }
+
+ /**
+ * Construct an instance from a message and a code and an exception to
+ * chain to this one.
+ *
+ * @param e An exception to nest within this one
+ * @param message A message describing the exception
+ * @param code A code denoting the exception
+ */
+ public ExpressionEvaluationException( Throwable e, String code, String message ) {
+ super( e, code, message );
+ }
+}
Copied:
trunk/engine/src/main/java/com/metamatrix/api/exception/query/FunctionExecutionException.java
(from rev 2059,
trunk/client/src/main/java/com/metamatrix/api/exception/query/FunctionExecutionException.java)
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/api/exception/query/FunctionExecutionException.java
(rev 0)
+++
trunk/engine/src/main/java/com/metamatrix/api/exception/query/FunctionExecutionException.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -0,0 +1,77 @@
+/*
+ * 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.api.exception.query;
+
+/**
+ * During processing, an invalid function was detected.
+ */
+public class FunctionExecutionException extends ExpressionEvaluationException {
+
+ /**
+ * No-arg constructor required by Externalizable semantics.
+ */
+ public FunctionExecutionException() {
+ super();
+ }
+
+ /**
+ * Construct an instance with the message specified.
+ *
+ * @param message A message describing the exception
+ */
+ public FunctionExecutionException( String message ) {
+ super( message );
+ }
+
+ /**
+ * Construct an instance with the message and error code specified.
+ *
+ * @param message A message describing the exception
+ * @param code The error code
+ */
+ public FunctionExecutionException( String code, String message ) {
+ super( code, message );
+ }
+
+ /**
+ * Construct an instance from a message and an exception to chain to this one.
+ *
+ * @param message A message describing the exception
+ * @param e An exception to nest within this one
+ */
+ public FunctionExecutionException( Throwable e, String message ) {
+ super( e, message );
+ }
+
+ /**
+ * Construct an instance from a message and a code and an exception to
+ * chain to this one.
+ *
+ * @param e An exception to nest within this one
+ * @param message A message describing the exception
+ * @param code A code denoting the exception
+ */
+ public FunctionExecutionException( Throwable e, String code, String message ) {
+ super( e, code, message );
+ }
+}
Copied:
trunk/engine/src/main/java/com/metamatrix/api/exception/query/FunctionMetadataException.java
(from rev 2059,
trunk/client/src/main/java/com/metamatrix/api/exception/query/FunctionMetadataException.java)
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/api/exception/query/FunctionMetadataException.java
(rev 0)
+++
trunk/engine/src/main/java/com/metamatrix/api/exception/query/FunctionMetadataException.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -0,0 +1,77 @@
+/*
+ * 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.api.exception.query;
+
+/**
+ * Detected invalid function metadata during validation.
+ */
+public class FunctionMetadataException extends QueryProcessingException {
+
+ /**
+ * No-arg constructor required by Externalizable semantics.
+ */
+ public FunctionMetadataException() {
+ super();
+ }
+
+ /**
+ * Construct an instance with the message specified.
+ *
+ * @param message A message describing the exception
+ */
+ public FunctionMetadataException( String message ) {
+ super( message );
+ }
+
+ /**
+ * Construct an instance with the message and error code specified.
+ *
+ * @param message A message describing the exception
+ * @param code The error code
+ */
+ public FunctionMetadataException( String code, String message ) {
+ super( code, message );
+ }
+
+ /**
+ * Construct an instance from a message and an exception to chain to this one.
+ *
+ * @param message A message describing the exception
+ * @param e An exception to nest within this one
+ */
+ public FunctionMetadataException( Throwable e, String message ) {
+ super( e, message );
+ }
+
+ /**
+ * Construct an instance from a message and a code and an exception to
+ * chain to this one.
+ *
+ * @param e An exception to nest within this one
+ * @param message A message describing the exception
+ * @param code A code denoting the exception
+ */
+ public FunctionMetadataException( Throwable e, String code, String message ) {
+ super( e, code, message );
+ }
+}
Copied:
trunk/engine/src/main/java/com/metamatrix/api/exception/query/InvalidFunctionException.java
(from rev 2059,
trunk/client/src/main/java/com/metamatrix/api/exception/query/InvalidFunctionException.java)
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/api/exception/query/InvalidFunctionException.java
(rev 0)
+++
trunk/engine/src/main/java/com/metamatrix/api/exception/query/InvalidFunctionException.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -0,0 +1,77 @@
+/*
+ * 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.api.exception.query;
+
+/**
+ * During processing, an invalid function was detected.
+ */
+public class InvalidFunctionException extends ExpressionEvaluationException {
+
+ /**
+ * No-arg constructor required by Externalizable semantics.
+ */
+ public InvalidFunctionException() {
+ super();
+ }
+
+ /**
+ * Construct an instance with the message specified.
+ *
+ * @param message A message describing the exception
+ */
+ public InvalidFunctionException( String message ) {
+ super( message );
+ }
+
+ /**
+ * Construct an instance with the message and error code specified.
+ *
+ * @param message A message describing the exception
+ * @param code The error code
+ */
+ public InvalidFunctionException( String code, String message ) {
+ super( code, message );
+ }
+
+ /**
+ * Construct an instance from a message and an exception to chain to this one.
+ *
+ * @param message A message describing the exception
+ * @param e An exception to nest within this one
+ */
+ public InvalidFunctionException( Throwable e, String message ) {
+ super( e, message );
+ }
+
+ /**
+ * Construct an instance from a message and a code and an exception to
+ * chain to this one.
+ *
+ * @param e An exception to nest within this one
+ * @param message A message describing the exception
+ * @param code A code denoting the exception
+ */
+ public InvalidFunctionException( Throwable e, String code, String message ) {
+ super( e, code, message );
+ }
+}
Copied:
trunk/engine/src/main/java/com/metamatrix/api/exception/query/QueryMetadataException.java
(from rev 2059,
trunk/client/src/main/java/com/metamatrix/api/exception/query/QueryMetadataException.java)
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/api/exception/query/QueryMetadataException.java
(rev 0)
+++
trunk/engine/src/main/java/com/metamatrix/api/exception/query/QueryMetadataException.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -0,0 +1,82 @@
+/*
+ * 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.api.exception.query;
+
+import com.metamatrix.api.exception.MetaMatrixComponentException;
+
+/**
+ * This exception is thrown when an error occurs while retrieving metadata
+ * from a query component metadata facade.
+ *
+ * TODO: this isn't really a component exception all of the time. missing entries in
metadata are fine during resolving.
+ */
+public class QueryMetadataException extends MetaMatrixComponentException {
+
+ /**
+ * No-arg constructor required by Externalizable semantics.
+ */
+ public QueryMetadataException() {
+ super();
+ }
+
+ /**
+ * Construct an instance with the message specified.
+ *
+ * @param message A message describing the exception
+ */
+ public QueryMetadataException( String message ) {
+ super( message );
+ }
+
+ /**
+ * Construct an instance with the message and error code specified.
+ *
+ * @param message A message describing the exception
+ * @param code The error code
+ */
+ public QueryMetadataException( String code, String message ) {
+ super( code, message );
+ }
+
+ /**
+ * Construct an instance from a message and an exception to chain to this one.
+ *
+ * @param message A message describing the exception
+ * @param e An exception to nest within this one
+ */
+ public QueryMetadataException( Throwable e, String message ) {
+ super( e, message );
+ }
+
+ /**
+ * Construct an instance from a message and a code and an exception to
+ * chain to this one.
+ *
+ * @param e An exception to nest within this one
+ * @param message A message describing the exception
+ * @param code A code denoting the exception
+ */
+ public QueryMetadataException( Throwable e, String code, String message ) {
+ super( e, code, message );
+ }
+}
Copied:
trunk/engine/src/main/java/com/metamatrix/api/exception/query/QueryParserException.java
(from rev 2059,
trunk/client/src/main/java/com/metamatrix/api/exception/query/QueryParserException.java)
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/api/exception/query/QueryParserException.java
(rev 0)
+++
trunk/engine/src/main/java/com/metamatrix/api/exception/query/QueryParserException.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -0,0 +1,79 @@
+/*
+ * 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.api.exception.query;
+
+
+/**
+ * Thrown when a query cannot be parsed. This is most likely due to not
+ * following the Query Parser grammar, which defines how queries are parsed.
+ */
+public class QueryParserException extends QueryProcessingException {
+
+ /**
+ * No-arg constructor required by Externalizable semantics.
+ */
+ public QueryParserException() {
+ super();
+ }
+
+ /**
+ * Construct an instance with the message specified.
+ *
+ * @param message A message describing the exception
+ */
+ public QueryParserException( String message ) {
+ super( message );
+ }
+
+ /**
+ * Construct an instance with the message and error code specified.
+ *
+ * @param message A message describing the exception
+ * @param code The error code
+ */
+ public QueryParserException( String code, String message ) {
+ super( code, message );
+ }
+
+ /**
+ * Construct an instance from a message and an exception to chain to this one.
+ *
+ * @param message A message describing the exception
+ * @param e An exception to nest within this one
+ */
+ public QueryParserException( Throwable e, String message ) {
+ super( e, message );
+ }
+
+ /**
+ * Construct an instance from a message and a code and an exception to
+ * chain to this one.
+ *
+ * @param e An exception to nest within this one
+ * @param message A message describing the exception
+ * @param code A code denoting the exception
+ */
+ public QueryParserException( Throwable e, String code, String message ) {
+ super( e, code, message );
+ }
+}
Copied:
trunk/engine/src/main/java/com/metamatrix/api/exception/query/QueryPlannerException.java
(from rev 2059,
trunk/client/src/main/java/com/metamatrix/api/exception/query/QueryPlannerException.java)
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/api/exception/query/QueryPlannerException.java
(rev 0)
+++
trunk/engine/src/main/java/com/metamatrix/api/exception/query/QueryPlannerException.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -0,0 +1,79 @@
+/*
+ * 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.api.exception.query;
+
+/**
+ * This exception is thrown when an error occurs while planning the query. This
+ * probably indicates a problem with the query that could not be determined during
+ * query resolution or query validation.
+ */
+public class QueryPlannerException extends QueryProcessingException {
+
+ /**
+ * No-arg constructor required by Externalizable semantics.
+ */
+ public QueryPlannerException() {
+ super();
+ }
+
+ /**
+ * Construct an instance with the message specified.
+ *
+ * @param message A message describing the exception
+ */
+ public QueryPlannerException( String message ) {
+ super( message );
+ }
+
+ /**
+ * Construct an instance with the message and error code specified.
+ *
+ * @param message A message describing the exception
+ * @param code The error code
+ */
+ public QueryPlannerException( String code, String message ) {
+ super( code, message );
+ }
+
+ /**
+ * Construct an instance from a message and an exception to chain to this one.
+ *
+ * @param message A message describing the exception
+ * @param e An exception to nest within this one
+ */
+ public QueryPlannerException( Throwable e, String message ) {
+ super( e, message );
+ }
+
+ /**
+ * Construct an instance from a message and a code and an exception to
+ * chain to this one.
+ *
+ * @param e An exception to nest within this one
+ * @param message A message describing the exception
+ * @param code A code denoting the exception
+ */
+ public QueryPlannerException( Throwable e, String code, String message ) {
+ super( e, code, message );
+ }
+}
Copied:
trunk/engine/src/main/java/com/metamatrix/api/exception/query/QueryProcessingException.java
(from rev 2059,
trunk/client/src/main/java/com/metamatrix/api/exception/query/QueryProcessingException.java)
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/api/exception/query/QueryProcessingException.java
(rev 0)
+++
trunk/engine/src/main/java/com/metamatrix/api/exception/query/QueryProcessingException.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -0,0 +1,80 @@
+/*
+ * 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.api.exception.query;
+
+import com.metamatrix.api.exception.MetaMatrixProcessingException;
+
+/**
+ * This exception is thrown when an error occurs while retrieving metadata
+ * from a query component metadata facade.
+ */
+public class QueryProcessingException extends MetaMatrixProcessingException {
+
+ /**
+ * No-arg constructor required by Externalizable semantics.
+ */
+ public QueryProcessingException() {
+ super();
+ }
+
+ /**
+ * Construct an instance with the message specified.
+ *
+ * @param message A message describing the exception
+ */
+ public QueryProcessingException( String message ) {
+ super( message );
+ }
+
+ /**
+ * Construct an instance with the message and error code specified.
+ *
+ * @param message A message describing the exception
+ * @param code The error code
+ */
+ public QueryProcessingException( String code, String message ) {
+ super( code, message );
+ }
+
+ /**
+ * Construct an instance from a message and an exception to chain to this one.
+ *
+ * @param message A message describing the exception
+ * @param e An exception to nest within this one
+ */
+ public QueryProcessingException( Throwable e, String message ) {
+ super( e, message );
+ }
+
+ /**
+ * Construct an instance from a message and a code and an exception to
+ * chain to this one.
+ *
+ * @param e An exception to nest within this one
+ * @param message A message describing the exception
+ * @param code A code denoting the exception
+ */
+ public QueryProcessingException( Throwable e, String code, String message ) {
+ super( e, code, message );
+ }
+}
Copied:
trunk/engine/src/main/java/com/metamatrix/api/exception/query/QueryResolverException.java
(from rev 2059,
trunk/client/src/main/java/com/metamatrix/api/exception/query/QueryResolverException.java)
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/api/exception/query/QueryResolverException.java
(rev 0)
+++
trunk/engine/src/main/java/com/metamatrix/api/exception/query/QueryResolverException.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -0,0 +1,112 @@
+/*
+ * 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.api.exception.query;
+
+import java.util.*;
+
+/**
+ * This exception represents the case where the query submitted could not resolved
+ * when it is checked against the metadata
+ */
+public class QueryResolverException extends QueryProcessingException {
+
+ private transient List problems;
+
+ /**
+ * No-arg constructor required by Externalizable semantics.
+ */
+ public QueryResolverException() {
+ super();
+ }
+
+ /**
+ * Construct an instance with the message specified.
+ *
+ * @param message A message describing the exception
+ */
+ public QueryResolverException( String message ) {
+ super( message );
+ }
+
+ /**
+ * Construct an instance with the message and error code specified.
+ *
+ * @param message A message describing the exception
+ * @param code The error code
+ */
+ public QueryResolverException( String code, String message ) {
+ super( code, message );
+ }
+
+ /**
+ * Construct an instance from a message and an exception to chain to this one.
+ *
+ * @param message A message describing the exception
+ * @param e An exception to nest within this one
+ */
+ public QueryResolverException( Throwable e, String message ) {
+ super( e, message );
+ }
+
+ /**
+ * Construct an instance from a message and a code and an exception to
+ * chain to this one.
+ *
+ * @param e An exception to nest within this one
+ * @param message A message describing the exception
+ * @param code A code denoting the exception
+ */
+ public QueryResolverException( Throwable e, String code, String message ) {
+ super( e, code, message );
+ }
+
+ /**
+ * Set the list of unresolved symbols during QueryResolution
+ * @param unresolvedSymbols List of <UnresolvedSymbolDescription> objects
+ */
+ public void setUnresolvedSymbols(List unresolvedSymbols) {
+ this.problems = unresolvedSymbols;
+ }
+
+ /**
+ * Add an UnresolvedSymbolDescription to the list of unresolved symbols
+ * @param symbolDesc Single description
+ */
+ public void addUnresolvedSymbol(UnresolvedSymbolDescription symbolDesc) {
+ if(this.problems == null) {
+ this.problems = new ArrayList();
+ }
+ this.problems.add(symbolDesc);
+ }
+
+ /**
+ * Set the list of unresolved symbols during QueryResolution
+ * @return List of {@link UnresolvedSymbolDescription} objects
+ */
+ public List getUnresolvedSymbols() {
+ return this.problems;
+ }
+
+
+
+}
Copied:
trunk/engine/src/main/java/com/metamatrix/api/exception/query/QueryValidatorException.java
(from rev 2059,
trunk/client/src/main/java/com/metamatrix/api/exception/query/QueryValidatorException.java)
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/api/exception/query/QueryValidatorException.java
(rev 0)
+++
trunk/engine/src/main/java/com/metamatrix/api/exception/query/QueryValidatorException.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -0,0 +1,78 @@
+/*
+ * 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.api.exception.query;
+
+/**
+ * This exception is thrown if an error is discovered while validating the query.
Validation
+ * checks a number of aspects of a query to ensure that the query is semantically valid.
+ */
+public class QueryValidatorException extends QueryProcessingException {
+
+ /**
+ * No-arg constructor required by Externalizable semantics.
+ */
+ public QueryValidatorException() {
+ super();
+ }
+
+ /**
+ * Construct an instance with the message specified.
+ *
+ * @param message A message describing the exception
+ */
+ public QueryValidatorException( String message ) {
+ super( message );
+ }
+
+ /**
+ * Construct an instance with the message and error code specified.
+ *
+ * @param message A message describing the exception
+ * @param code The error code
+ */
+ public QueryValidatorException( String code, String message ) {
+ super( code, message );
+ }
+
+ /**
+ * Construct an instance from a message and an exception to chain to this one.
+ *
+ * @param message A message describing the exception
+ * @param e An exception to nest within this one
+ */
+ public QueryValidatorException( Throwable e, String message ) {
+ super( e, message );
+ }
+
+ /**
+ * Construct an instance from a message and a code and an exception to
+ * chain to this one.
+ *
+ * @param e An exception to nest within this one
+ * @param message A message describing the exception
+ * @param code A code denoting the exception
+ */
+ public QueryValidatorException( Throwable e, String code, String message ) {
+ super( e, code, message );
+ }
+}
Copied:
trunk/engine/src/main/java/com/metamatrix/api/exception/query/UnresolvedSymbolDescription.java
(from rev 2059,
trunk/client/src/main/java/com/metamatrix/api/exception/query/UnresolvedSymbolDescription.java)
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/api/exception/query/UnresolvedSymbolDescription.java
(rev 0)
+++
trunk/engine/src/main/java/com/metamatrix/api/exception/query/UnresolvedSymbolDescription.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -0,0 +1,81 @@
+/*
+ * 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.api.exception.query;
+
+import java.io.Serializable;
+
+/**
+ * This helper object describes an unresolved symbol found during
+ * query resolution.
+ */
+public class UnresolvedSymbolDescription implements Serializable {
+
+ private String symbol;
+ private String description;
+
+ /**
+ * Construct a description given the symbol and it's description.
+ * @param symbol Unresolved symbol
+ * @param description Description of error
+ */
+ public UnresolvedSymbolDescription(String symbol, String description) {
+ this.symbol = symbol;
+ this.description = description;
+ }
+
+ /**
+ * Get the symbol that was unresolved
+ * @return Unresolved symbol
+ */
+ public String getSymbol() {
+ return this.symbol;
+ }
+
+ /**
+ * Get the description of the problem
+ * @return Problem description
+ */
+ public String getDescription() {
+ return this.description;
+ }
+
+ /**
+ * Get string representation of the unresolved symbol description
+ * @return String representation
+ */
+ public String toString() {
+ StringBuffer str = new StringBuffer();
+ if(symbol != null) {
+ str.append("Unable to resolve '"); //$NON-NLS-1$
+ str.append(symbol);
+ str.append("': "); //$NON-NLS-1$
+ }
+ if(description != null) {
+ str.append(description);
+ } else {
+ str.append("Unknown reason"); //$NON-NLS-1$
+ }
+ return str.toString();
+ }
+
+}
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ErrorInstruction.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ErrorInstruction.java 2010-04-16
21:45:46 UTC (rev 2062)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/proc/ErrorInstruction.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -24,11 +24,11 @@
import static com.metamatrix.query.analysis.AnalysisRecord.*;
+import org.teiid.client.ProcedureErrorInstructionException;
import org.teiid.client.plan.PlanNode;
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
-import com.metamatrix.api.exception.query.ProcedureErrorInstructionException;
import com.metamatrix.common.log.LogManager;
import com.metamatrix.query.processor.program.ProgramInstruction;
import com.metamatrix.query.sql.symbol.Expression;
Modified: trunk/engine/src/main/java/org/teiid/metadata/TransformationMetadata.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/metadata/TransformationMetadata.java 2010-04-16
21:45:46 UTC (rev 2062)
+++ trunk/engine/src/main/java/org/teiid/metadata/TransformationMetadata.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -54,7 +54,6 @@
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.query.QueryMetadataException;
-import com.metamatrix.common.properties.UnmodifiableProperties;
import com.metamatrix.common.types.BlobImpl;
import com.metamatrix.common.types.ClobImpl;
import com.metamatrix.common.types.DataTypeManager;
@@ -105,7 +104,7 @@
// error message cached to avoid i18n lookup each time
public static String NOT_EXISTS_MESSAGE =
StringUtil.Constants.SPACE+DQPPlugin.Util.getString("TransformationMetadata.does_not_exist._1");
//$NON-NLS-1$
- private static UnmodifiableProperties EMPTY_PROPS = new UnmodifiableProperties(new
Properties());
+ private static Properties EMPTY_PROPS = new Properties();
private final CompositeMetadataStore store;
private Map<String, Resource> vdbEntries;
Modified: trunk/runtime/src/main/java/org/teiid/transport/ObjectDecoder.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/ObjectDecoder.java 2010-04-16 21:45:46
UTC (rev 2062)
+++ trunk/runtime/src/main/java/org/teiid/transport/ObjectDecoder.java 2010-04-20 19:13:08
UTC (rev 2063)
@@ -71,6 +71,8 @@
* @apiviz.landmark
*/
public class ObjectDecoder extends FrameDecoder {
+
+ public static final long MAX_LOB_SIZE = 1l << 32;
private final int maxObjectSize;
private final ClassLoader classLoader;
@@ -80,6 +82,7 @@
private OutputStream stream;
private List<StreamFactoryReference> streams;
private StorageManager storageManager;
+ private FileStore store;
/**
* Creates a new decoder with the specified maximum object size.
@@ -140,14 +143,14 @@
buffer.skipBytes(2);
if (stream == null) {
- final FileStore store =
storageManager.createFileStore("temp-stream"); //$NON-NLS-1$
+ store = storageManager.createFileStore("temp-stream"); //$NON-NLS-1$
StreamFactoryReference sfr = streams.get(streamIndex);
store.setCleanupReference(sfr);
sfr.setStreamFactory(new InputStreamFactory(Streamable.ENCODING) {
-
+ FileStore fs = store;
@Override
public InputStream getInputStream() throws IOException {
- return new BufferedInputStream(store.createInputStream(0));
+ return new BufferedInputStream(fs.createInputStream(0));
}
});
this.stream = new BufferedOutputStream(store.createOutputStream());
@@ -158,12 +161,17 @@
streamIndex++;
continue;
}
+ if (store.getLength() + dataLen > MAX_LOB_SIZE) {
+ throw new StreamCorruptedException(
+ "lob too big: " + store.getLength() + dataLen + "
(max: " + MAX_LOB_SIZE + ')');
+ }
buffer.readBytes(this.stream, dataLen);
}
Object toReturn = result;
result = null;
streams = null;
stream = null;
+ store = null;
return toReturn;
}
}
Modified: trunk/runtime/src/main/java/org/teiid/transport/ServerWorkItem.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/ServerWorkItem.java 2010-04-16
21:45:46 UTC (rev 2062)
+++ trunk/runtime/src/main/java/org/teiid/transport/ServerWorkItem.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -73,7 +73,7 @@
throw new AssertionError("unknown message contents"); //$NON-NLS-1$
}
final ServiceInvocationStruct serviceStruct =
(ServiceInvocationStruct)message.getContents();
- final ClientService clientService =
this.csr.getClientService(serviceStruct.targetClass);
+ final ClientService clientService =
this.csr.getClientService(serviceStruct.targetClass.getName());
loggingContext = clientService.getLoggingContext();
Method m =
clientService.getReflectionHelper().findBestMethodOnTarget(serviceStruct.methodName,
serviceStruct.args);
Object methodResult;
Modified:
trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestMMDatabaseMetaData.java
===================================================================
---
trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestMMDatabaseMetaData.java 2010-04-16
21:45:46 UTC (rev 2062)
+++
trunk/test-integration/common/src/test/java/org/teiid/jdbc/TestMMDatabaseMetaData.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -22,8 +22,7 @@
package org.teiid.jdbc;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.*;
import java.io.BufferedReader;
import java.io.File;
@@ -42,45 +41,16 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Properties;
-import org.jboss.deployers.spi.DeploymentException;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.mockito.Mockito;
-import org.teiid.adminapi.VDB;
-import org.teiid.adminapi.impl.ModelMetaData;
-import org.teiid.adminapi.impl.VDBMetaData;
-import org.teiid.client.DQP;
-import org.teiid.client.security.ILogon;
-import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.metadata.runtime.MetadataStore;
-import org.teiid.connector.metadata.runtime.Schema;
-import org.teiid.deployers.MetadataStoreGroup;
-import org.teiid.deployers.VDBRepository;
-import org.teiid.dqp.internal.datamgr.impl.ConnectorManager;
-import org.teiid.dqp.internal.datamgr.impl.ConnectorManagerRepository;
-import org.teiid.dqp.internal.datamgr.impl.FakeTransactionService;
-import org.teiid.dqp.internal.process.DQPConfiguration;
-import org.teiid.dqp.internal.process.DQPCore;
import org.teiid.jdbc.util.ResultSetUtil;
-import org.teiid.metadata.index.VDBMetadataFactory;
-import org.teiid.net.TeiidURL;
-import org.teiid.services.SessionServiceImpl;
-import org.teiid.transport.ClientServiceRegistry;
-import org.teiid.transport.ClientServiceRegistryImpl;
-import org.teiid.transport.LocalServerConnection;
-import org.teiid.transport.LogonImpl;
-import com.metamatrix.common.queue.FakeWorkManager;
import com.metamatrix.common.util.ApplicationInfo;
import com.metamatrix.core.CoreConstants;
import com.metamatrix.core.util.UnitTestUtil;
-import com.metamatrix.dqp.service.FakeBufferService;
-import com.metamatrix.query.optimizer.capabilities.BasicSourceCapabilities;
-import com.metamatrix.query.optimizer.capabilities.SourceCapabilities;
/**
*/
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/framework/ConfigPropertyLoader.java
===================================================================
---
trunk/test-integration/db/src/main/java/org/teiid/test/framework/ConfigPropertyLoader.java 2010-04-16
21:45:46 UTC (rev 2062)
+++
trunk/test-integration/db/src/main/java/org/teiid/test/framework/ConfigPropertyLoader.java 2010-04-20
19:13:08 UTC (rev 2063)
@@ -146,7 +146,7 @@
public Properties getProperties() {
- Properties p = PropertiesUtils.clone(System.getProperties(), false);
+ Properties p = PropertiesUtils.clone(System.getProperties());
if (props != null) {
p.putAll(props);
}