[teiid-commits] teiid SVN: r1891 - in branches/JCA: client/src/main/java/com/metamatrix/common/comm/platform/socket/client and 18 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Wed Mar 3 13:56:41 EST 2010


Author: shawkins
Date: 2010-03-03 13:56:39 -0500 (Wed, 03 Mar 2010)
New Revision: 1891

Added:
   branches/JCA/engine/src/main/java/com/metamatrix/dqp/message/RequestID.java
Removed:
   branches/JCA/client/src/main/java/com/metamatrix/dqp/message/RequestID.java
Modified:
   branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDatabaseMetaData.java
   branches/JCA/client/src/main/java/com/metamatrix/common/comm/platform/socket/Handshake.java
   branches/JCA/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/ServiceInvocationStruct.java
   branches/JCA/client/src/main/java/com/metamatrix/dqp/client/MetadataResult.java
   branches/JCA/client/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java
   branches/JCA/common-core/src/main/java/com/metamatrix/core/CoreConstants.java
   branches/JCA/common-core/src/main/java/com/metamatrix/core/util/ExternalizeUtil.java
   branches/JCA/documentation/reference/src/main/docbook/en-US/content/datatypes.xml
   branches/JCA/documentation/reference/src/main/docbook/en-US/content/procedures.xml
   branches/JCA/engine/src/main/java/com/metamatrix/query/processor/proc/ExecDynamicSqlInstruction.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/DynamicCommandResolver.java
   branches/JCA/engine/src/main/java/com/metamatrix/query/sql/ProcedureReservedWords.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
   branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/validator/AuthorizationValidationVisitor.java
   branches/JCA/engine/src/main/javacc/com/metamatrix/query/parser/SQLParser.jj
   branches/JCA/engine/src/test/java/com/metamatrix/query/validator/TestValidator.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCoreRequestHandling.java
   branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/validator/TestAuthorizationValidationVisitor.java
   branches/JCA/metadata/src/main/resources/System.vdb
Log:
TEIID-1005 changing system schema to sys and adding DVARS as the using clause group for dynamic sql

Modified: branches/JCA/client/src/main/java/com/metamatrix/common/comm/platform/socket/Handshake.java
===================================================================
--- branches/JCA/client/src/main/java/com/metamatrix/common/comm/platform/socket/Handshake.java	2010-03-03 18:45:43 UTC (rev 1890)
+++ branches/JCA/client/src/main/java/com/metamatrix/common/comm/platform/socket/Handshake.java	2010-03-03 18:56:39 UTC (rev 1891)
@@ -22,14 +22,17 @@
 
 package com.metamatrix.common.comm.platform.socket;
 
-import java.io.Serializable;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 
 import com.metamatrix.common.util.ApplicationInfo;
 
 /**
  * Represents the information needed in a socket connection handshake  
  */
-public class Handshake implements Serializable {
+public class Handshake implements Externalizable {
     
 	private static final long serialVersionUID = 7839271224736355515L;
     
@@ -63,6 +66,18 @@
     public void setPublicKey(byte[] key) {
         this.publicKey = key;
     }
-
     
+    @Override
+    public void readExternal(ObjectInput in) throws IOException,
+    		ClassNotFoundException {
+    	version = (String)in.readObject();
+    	publicKey = (byte[])in.readObject();
+    }
+    
+    @Override
+    public void writeExternal(ObjectOutput out) throws IOException {
+    	out.writeObject(version);
+    	out.writeObject(publicKey);
+    }
+    
 }

Modified: branches/JCA/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/ServiceInvocationStruct.java
===================================================================
--- branches/JCA/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/ServiceInvocationStruct.java	2010-03-03 18:45:43 UTC (rev 1890)
+++ branches/JCA/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/ServiceInvocationStruct.java	2010-03-03 18:56:39 UTC (rev 1891)
@@ -31,6 +31,7 @@
 import java.io.ObjectOutput;
 
 import com.metamatrix.core.util.ArgCheck;
+import com.metamatrix.core.util.ExternalizeUtil;
 
 public final class ServiceInvocationStruct implements Externalizable {
 	private static final long serialVersionUID = 1207674062670068350L;
@@ -43,7 +44,7 @@
 	}
 
 	public ServiceInvocationStruct(Object[] args, String methodName,
-			Class targetClass) {
+			Class<?> targetClass) {
 		ArgCheck.isNotNull(methodName);
 		ArgCheck.isNotNull(targetClass);
 		this.args = args;
@@ -55,12 +56,12 @@
 			ClassNotFoundException {
 		this.targetClass = (String)in.readObject();
 		this.methodName = (String)in.readObject();
-		this.args = (Object[])in.readObject();
+		this.args = ExternalizeUtil.readArray(in, Object.class);
 	}
 
 	public void writeExternal(ObjectOutput out) throws IOException {
 		out.writeObject(targetClass);
 		out.writeObject(methodName);
-		out.writeObject(args);
+		ExternalizeUtil.writeArray(out, args);
 	}
 }
\ No newline at end of file

Modified: branches/JCA/client/src/main/java/com/metamatrix/dqp/client/MetadataResult.java
===================================================================
--- branches/JCA/client/src/main/java/com/metamatrix/dqp/client/MetadataResult.java	2010-03-03 18:45:43 UTC (rev 1890)
+++ branches/JCA/client/src/main/java/com/metamatrix/dqp/client/MetadataResult.java	2010-03-03 18:56:39 UTC (rev 1891)
@@ -22,10 +22,15 @@
 
 package com.metamatrix.dqp.client;
 
-import java.io.Serializable;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import java.util.Map;
 
-public class MetadataResult implements Serializable {
+import com.metamatrix.core.util.ExternalizeUtil;
+
+public class MetadataResult implements Externalizable {
 	private static final long serialVersionUID = -1520482281079030324L;
 	private Map[] columnMetadata;
 	private int parameterCount;
@@ -42,6 +47,17 @@
 		return parameterCount;
 	}
 	
+	@Override
+	public void readExternal(ObjectInput in) throws IOException,
+			ClassNotFoundException {
+		columnMetadata = ExternalizeUtil.readArray(in, Map.class);
+		parameterCount = in.readInt();
+	}
 	
+	@Override
+	public void writeExternal(ObjectOutput out) throws IOException {
+		ExternalizeUtil.writeArray(out, columnMetadata);
+		out.writeInt(parameterCount);
+	}
 	
 }

Deleted: branches/JCA/client/src/main/java/com/metamatrix/dqp/message/RequestID.java
===================================================================
--- branches/JCA/client/src/main/java/com/metamatrix/dqp/message/RequestID.java	2010-03-03 18:45:43 UTC (rev 1890)
+++ branches/JCA/client/src/main/java/com/metamatrix/dqp/message/RequestID.java	2010-03-03 18:56:39 UTC (rev 1891)
@@ -1,175 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.dqp.message;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-
-/**
- * <p>This class represents an identifier for a request.  However, there are some
- * differences in what constitutes "uniqueness" for a given RequestID that 
- * is based on context (where the id is used).  The RequestID has 2 parts:
- * connectionID, and executionIDFor the purposes of the RequestID, the combined 
- * representation is "connectionID.executionID" - this implies a scoping
- * for the name parts.  The connectionID specifies a particular connection that 
- * is making requests.  Each connection generates a unique executionID for each 
- * request execution, so the executionID is only unique in the context of a 
- * connectionID.  </p>
- * 
- * <p>When this class is used between client and server, the connectionID is implied
- * and thus only the executionID part will be used.  The server will qualify the 
- * executionID with a connectionID when it reaches the server.  </p>
- * 
- * <p>RequestIDs are immutable so no setters exist.  This allows hashcodes to be 
- * pre-computed for faster comparison in equals.</p>  
- */
-public class RequestID implements Externalizable {
-
-    static final long serialVersionUID = -2888539138291776071L;
-    
-    public static final String NO_CONNECTION_STR = "C"; //$NON-NLS-1$
-    private static final String SEPARATOR = "."; //$NON-NLS-1$
-
-    // Basic state
-    private String connectionID;
-    private long executionID;
-    
-    // Derived state
-    private String combinedID;
-    private int hash;
-
-    /**
-     * Necessary for implementing Externalizable 
-     */
-    public RequestID() {        
-    }
-    
-    /**
-     * Create a RequestID using all of the ID parts.
-     * @param connectionID Identifies a connection, may be null
-     * @param executionID Identifies an execution, cannot be null
-     */
-    public RequestID(String connectionID, long executionID) {
-        this.connectionID = connectionID;
-        this.executionID = executionID;
-        
-        createCombinedID();
-        computeHashCode();
-    }
-    
-    public RequestID(long connectionID, long executionID) {
-        this.connectionID = String.valueOf(connectionID);
-        this.executionID = executionID;
-        
-        createCombinedID();
-        computeHashCode();
-    }    
-    
-    /**
-     * Create a RequestID for an execution where the connection is 
-     * not specified.
-     * @param executionID Identifies an execution, cannot be null
-     */
-    public RequestID(long executionID) {
-        this(null, executionID);
-    }
-
-    
-    /**
-     * Return connectionID, may be null if connection has not been specified.
-     * @return Connection ID, may be null
-     */
-    public String getConnectionID() {
-        return this.connectionID;
-    }
-    
-    /**
-     * Return executionID, which identifies a per-connection execution.
-     * @return Execution ID
-     */
-    public long getExecutionID() {
-        return this.executionID;
-    }
-
-    /**
-     * Create a unique combined ID string from the RequestID parts. 
-     */
-    private void createCombinedID() {
-        StringBuffer combinedStr = new StringBuffer();
-        if(this.connectionID != null) {
-            combinedStr.append(this.connectionID);
-        } else {
-            combinedStr.append(NO_CONNECTION_STR);
-        }
-        combinedStr.append(SEPARATOR);               
-        combinedStr.append(this.executionID);
-                
-        this.combinedID = combinedStr.toString();
-    }
-    
-    private void computeHashCode() {
-        this.hash = combinedID.hashCode();
-    }
-    
-    public int hashCode() {
-        return this.hash;
-    }
-    
-    public boolean equals(Object obj) {
-        if(obj == this) {
-            return true;
-        } else if(obj == null || !(obj instanceof RequestID) || obj.hashCode() != this.hashCode()) {
-            return false;
-        } else {
-            return this.toString().equals(obj.toString());
-        }
-    }
-    
-    /**
-     * Return a combined string for the ID.
-     */
-    public String toString() {
-        return this.combinedID;
-    }
-
-    /**
-     * @see java.io.Externalizable#readExternal(java.io.ObjectInput)
-     */
-    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        connectionID = (String)in.readObject();
-        executionID = in.readLong();
-
-        createCombinedID();
-        computeHashCode();
-    }
-
-    /**
-     * @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
-     */
-    public void writeExternal(ObjectOutput out) throws IOException {
-        out.writeObject(connectionID);
-        out.writeLong(executionID);
-    }
-}

Modified: branches/JCA/client/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java
===================================================================
--- branches/JCA/client/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java	2010-03-03 18:45:43 UTC (rev 1890)
+++ branches/JCA/client/src/main/java/org/teiid/adminapi/impl/RequestMetadata.java	2010-03-03 18:56:39 UTC (rev 1891)
@@ -28,7 +28,7 @@
 import org.jboss.metatype.api.annotations.MetaMapping;
 import org.teiid.adminapi.Request;
 
-import com.metamatrix.dqp.message.RequestID;
+import com.metamatrix.core.util.HashCodeUtil;
 
 
 @MetaMapping(RequestMetadataMapper.class)
@@ -45,9 +45,6 @@
 	private int nodeID = Integer.MIN_VALUE;
     private String transactionId;
     
-    // Derived state
-    private RequestID requestId;
-    
     @Override
     @ManagementProperty(description="Unique Identifier for Request", readOnly=true)
     public long getExecutionId() {
@@ -118,13 +115,6 @@
 		this.transactionId = id;
 	}
 	
-	public RequestID getRequestId() {
-		if (this.requestId == null) {
-			this.requestId = new RequestID(this.sessionId, this.executionId);
-		}
-		return this.requestId;
-	}
-	
     @Override
 	public boolean equals(Object obj) {
     	if (!(obj instanceof RequestMetadata)) {
@@ -138,7 +128,7 @@
 	}
     
     public int hashCode() {
-    	return getRequestId().hashCode();
+    	return HashCodeUtil.hashCode((int)executionId, (int)sessionId);
     }    
     
     public String toString() {

Modified: branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDatabaseMetaData.java
===================================================================
--- branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDatabaseMetaData.java	2010-03-03 18:45:43 UTC (rev 1890)
+++ branches/JCA/client-jdbc/src/main/java/com/metamatrix/jdbc/MMDatabaseMetaData.java	2010-03-03 18:56:39 UTC (rev 1891)
@@ -46,6 +46,7 @@
 import com.metamatrix.common.types.DataTypeManager;
 import com.metamatrix.common.types.MMJDBCSQLTypeInfo;
 import com.metamatrix.common.util.SqlUtil;
+import com.metamatrix.core.CoreConstants;
 import com.metamatrix.core.MetaMatrixRuntimeException;
 import com.metamatrix.dqp.message.ResultsMessage;
 import com.metamatrix.dqp.metadata.ResultsMetadataConstants;
@@ -63,6 +64,8 @@
  */
 
 public class MMDatabaseMetaData extends WrapperImpl implements com.metamatrix.jdbc.api.DatabaseMetaData {
+	private static final String DATA_TYPES = "DataTypes"; //$NON-NLS-1$
+
 	private static Logger logger = Logger.getLogger("org.teiid.jdbc"); //$NON-NLS-1$
         
     /** CONSTANTS */
@@ -122,7 +125,7 @@
     private final static String LIKE_ESCAPE = " LIKE ? ESCAPE '" + ESCAPE_SEARCH_STRING + "' ";//$NON-NLS-1$//$NON-NLS-2$
     
     final private static class RUNTIME_MODEL{
-        public final static String VIRTUAL_MODEL_NAME = "System"; //$NON-NLS-1$
+        public final static String VIRTUAL_MODEL_NAME = CoreConstants.SYSTEM_MODEL;
     }
 
     private static final String TYPE_MAPPING;
@@ -1786,24 +1789,24 @@
 
         Map[] metadataList = new Map[18];
 
-        metadataList[0] = getColumnMetadata("System.DataTypes", JDBCColumnNames.TYPE_INFO.TYPE_NAME, MMJDBCSQLTypeInfo.STRING,  ResultsMetadataConstants.NULL_TYPES.NOT_NULL, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE);//$NON-NLS-1$ 
-        metadataList[1] = getColumnMetadata("System.DataTypes", JDBCColumnNames.TYPE_INFO.DATA_TYPE, MMJDBCSQLTypeInfo.INTEGER,  ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$ 
-        metadataList[2] = getColumnMetadata("System.DataTypes", JDBCColumnNames.TYPE_INFO.PRECISION, MMJDBCSQLTypeInfo.INTEGER,  ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$ 
-        metadataList[3] = getColumnMetadata("System.DataTypes", JDBCColumnNames.TYPE_INFO.LITERAL_PREFIX, MMJDBCSQLTypeInfo.STRING,  ResultsMetadataConstants.NULL_TYPES.NULLABLE,  ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$ 
-        metadataList[4] = getColumnMetadata("System.DataTypes", JDBCColumnNames.TYPE_INFO.LITERAL_SUFFIX, MMJDBCSQLTypeInfo.STRING,  ResultsMetadataConstants.NULL_TYPES.NULLABLE,  ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$ 
-        metadataList[5] = getColumnMetadata("System.DataTypes", JDBCColumnNames.TYPE_INFO.CREATE_PARAMS, MMJDBCSQLTypeInfo.STRING,  ResultsMetadataConstants.NULL_TYPES.NULLABLE,  ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$ 
-        metadataList[6] = getColumnMetadata("System.DataTypes", JDBCColumnNames.TYPE_INFO.NULLABLE, MMJDBCSQLTypeInfo.SHORT,  ResultsMetadataConstants.NULL_TYPES.NULLABLE,  ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$ 
-        metadataList[7] = getColumnMetadata("System.DataTypes", JDBCColumnNames.TYPE_INFO.CASE_SENSITIVE, MMJDBCSQLTypeInfo.BOOLEAN,  ResultsMetadataConstants.NULL_TYPES.NOT_NULL, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.FALSE, Boolean.FALSE, Boolean.TRUE);//$NON-NLS-1$ 
-        metadataList[8] = getColumnMetadata("System.DataTypes", JDBCColumnNames.TYPE_INFO.SEARCHABLE, MMJDBCSQLTypeInfo.SHORT,  ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$ 
-        metadataList[9] = getColumnMetadata("System.DataTypes", JDBCColumnNames.TYPE_INFO.UNSIGNED_ATTRIBUTE, MMJDBCSQLTypeInfo.BOOLEAN,  ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$ 
-        metadataList[10] = getColumnMetadata("System.DataTypes", JDBCColumnNames.TYPE_INFO.FIXED_PREC_SCALE, MMJDBCSQLTypeInfo.BOOLEAN,  ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$
-        metadataList[11] = getColumnMetadata("System.DataTypes", JDBCColumnNames.TYPE_INFO.AUTOINCREMENT, MMJDBCSQLTypeInfo.BOOLEAN,  ResultsMetadataConstants.NULL_TYPES.NOT_NULL, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.FALSE, Boolean.TRUE, Boolean.TRUE);//$NON-NLS-1$ 
-        metadataList[12] = getColumnMetadata("System.DataTypes", JDBCColumnNames.TYPE_INFO.LOCAL_TYPE_NAME, MMJDBCSQLTypeInfo.STRING,  ResultsMetadataConstants.NULL_TYPES.NOT_NULL, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE);//$NON-NLS-1$ 
-        metadataList[13] = getColumnMetadata("System.DataTypes", JDBCColumnNames.TYPE_INFO.MINIMUM_SCALE, MMJDBCSQLTypeInfo.SHORT,  ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$ 
-        metadataList[14] = getColumnMetadata("System.DataTypes", JDBCColumnNames.TYPE_INFO.MAXIMUM_SCALE, MMJDBCSQLTypeInfo.SHORT,  ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$ 
-        metadataList[15] = getColumnMetadata("System.DataTypes", JDBCColumnNames.TYPE_INFO.SQL_DATA_TYPE, MMJDBCSQLTypeInfo.INTEGER,  ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$ 
-        metadataList[16] = getColumnMetadata("System.DataTypes", JDBCColumnNames.TYPE_INFO.SQL_DATETIME_SUB, MMJDBCSQLTypeInfo.INTEGER,  ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$ 
-        metadataList[17] = getColumnMetadata("System.DataTypes", JDBCColumnNames.TYPE_INFO.NUM_PREC_RADIX, MMJDBCSQLTypeInfo.INTEGER,  ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE);//$NON-NLS-1$ 
+        metadataList[0] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.TYPE_NAME, MMJDBCSQLTypeInfo.STRING,  ResultsMetadataConstants.NULL_TYPES.NOT_NULL, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE);//$NON-NLS-1$ 
+        metadataList[1] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.DATA_TYPE, MMJDBCSQLTypeInfo.INTEGER,  ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$ 
+        metadataList[2] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.PRECISION, MMJDBCSQLTypeInfo.INTEGER,  ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$ 
+        metadataList[3] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.LITERAL_PREFIX, MMJDBCSQLTypeInfo.STRING,  ResultsMetadataConstants.NULL_TYPES.NULLABLE,  ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$ 
+        metadataList[4] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.LITERAL_SUFFIX, MMJDBCSQLTypeInfo.STRING,  ResultsMetadataConstants.NULL_TYPES.NULLABLE,  ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$ 
+        metadataList[5] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.CREATE_PARAMS, MMJDBCSQLTypeInfo.STRING,  ResultsMetadataConstants.NULL_TYPES.NULLABLE,  ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$ 
+        metadataList[6] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.NULLABLE, MMJDBCSQLTypeInfo.SHORT,  ResultsMetadataConstants.NULL_TYPES.NULLABLE,  ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$ 
+        metadataList[7] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.CASE_SENSITIVE, MMJDBCSQLTypeInfo.BOOLEAN,  ResultsMetadataConstants.NULL_TYPES.NOT_NULL, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.FALSE, Boolean.FALSE, Boolean.TRUE);//$NON-NLS-1$ 
+        metadataList[8] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.SEARCHABLE, MMJDBCSQLTypeInfo.SHORT,  ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$ 
+        metadataList[9] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.UNSIGNED_ATTRIBUTE, MMJDBCSQLTypeInfo.BOOLEAN,  ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$ 
+        metadataList[10] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.FIXED_PREC_SCALE, MMJDBCSQLTypeInfo.BOOLEAN,  ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$
+        metadataList[11] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.AUTOINCREMENT, MMJDBCSQLTypeInfo.BOOLEAN,  ResultsMetadataConstants.NULL_TYPES.NOT_NULL, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.FALSE, Boolean.TRUE, Boolean.TRUE);//$NON-NLS-1$ 
+        metadataList[12] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.LOCAL_TYPE_NAME, MMJDBCSQLTypeInfo.STRING,  ResultsMetadataConstants.NULL_TYPES.NOT_NULL, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE);//$NON-NLS-1$ 
+        metadataList[13] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.MINIMUM_SCALE, MMJDBCSQLTypeInfo.SHORT,  ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$ 
+        metadataList[14] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.MAXIMUM_SCALE, MMJDBCSQLTypeInfo.SHORT,  ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$ 
+        metadataList[15] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.SQL_DATA_TYPE, MMJDBCSQLTypeInfo.INTEGER,  ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$ 
+        metadataList[16] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.SQL_DATETIME_SUB, MMJDBCSQLTypeInfo.INTEGER,  ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE);//$NON-NLS-1$ 
+        metadataList[17] = getColumnMetadata(CoreConstants.SYSTEM_MODEL + "." + DATA_TYPES, JDBCColumnNames.TYPE_INFO.NUM_PREC_RADIX, MMJDBCSQLTypeInfo.INTEGER,  ResultsMetadataConstants.NULL_TYPES.NULLABLE, ResultsMetadataConstants.SEARCH_TYPES.SEARCHABLE, Boolean.FALSE, Boolean.FALSE, Boolean.FALSE);//$NON-NLS-1$ 
 
         ResultSetMetaData rmetadata = ResultsMetadataWithProvider.newInstance(StaticMetadataProvider.createWithData(metadataList, 0));
 

Modified: branches/JCA/common-core/src/main/java/com/metamatrix/core/CoreConstants.java
===================================================================
--- branches/JCA/common-core/src/main/java/com/metamatrix/core/CoreConstants.java	2010-03-03 18:45:43 UTC (rev 1890)
+++ branches/JCA/common-core/src/main/java/com/metamatrix/core/CoreConstants.java	2010-03-03 18:56:39 UTC (rev 1891)
@@ -51,17 +51,10 @@
         String PROXIES = "proxies"; //$NON-NLS-1$
     }
 
-    public static final String SYSTEM_MODEL = "System"; //$NON-NLS-1$
+    public static final String SYSTEM_MODEL = "SYS"; //$NON-NLS-1$
     
     public static final String SYSTEM_VDB = "System.vdb"; //$NON-NLS-1$
 
-    public static final String SYSTEM_PHYSICAL_MODEL_NAME = "SystemPhysical"; //$NON-NLS-1$
-
-    public static final String SYSTEM_ADMIN_MODEL_NAME = "SystemAdmin"; //$NON-NLS-1$
-
-    public static final String SYSTEM_ADMIN_PHYSICAL_MODEL_NAME = "SystemAdminPhysical"; //$NON-NLS-1$
-
-    
     public static final String EXPORTED_VDB_FILE_EXTENSION = VdbConstants.VDB_DEF_FILE_EXTENSION; 
     
     public static final String VDB_ARCHIVE_EXTENSION = VdbConstants.VDB_ARCHIVE_EXTENSION; 

Modified: branches/JCA/common-core/src/main/java/com/metamatrix/core/util/ExternalizeUtil.java
===================================================================
--- branches/JCA/common-core/src/main/java/com/metamatrix/core/util/ExternalizeUtil.java	2010-03-03 18:45:43 UTC (rev 1890)
+++ branches/JCA/common-core/src/main/java/com/metamatrix/core/util/ExternalizeUtil.java	2010-03-03 18:56:39 UTC (rev 1891)
@@ -25,10 +25,10 @@
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
+import java.lang.reflect.Array;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -66,36 +66,22 @@
      * @param coll reference to a Collection. Can be null.
      * @throws IOException
      */
-    public static void writeCollection(ObjectOutput out, Collection coll) throws IOException {
+    public static void writeCollection(ObjectOutput out, Collection<?> coll) throws IOException {
         if (coll == null) {
             out.writeInt(0);
         } else {
             final int size = coll.size();
             if (size > 0) {
                 out.writeInt(coll.size());
-                for (Iterator i = coll.iterator(); i.hasNext();) {
-                    out.writeObject(i.next());
+                for (Object object : coll) {
+                    out.writeObject(object);
                 }
             }
         }
     }
     
-    /**
-     * Writes a List to the output using its indexes.
-     * @param out the output instance
-     * @param list reference to a List. Can be null.
-     * @throws IOException
-     */
-    public static void writeList(ObjectOutput out, List list) throws IOException {
-        if (list == null) {
-            out.writeInt(0);
-        } else {
-            final int size = list.size();
-            out.writeInt(size);
-            for (int i = 0; i < size; i++) {
-                out.writeObject(list.get(i));
-            }
-        }
+    public static void writeList(ObjectOutput out, List<?> coll) throws IOException {
+    	writeCollection(out, coll);
     }
     
     /**
@@ -104,14 +90,12 @@
      * @param list reference to a Map. Can be null.
      * @throws IOException
      */
-    public static void writeMap(ObjectOutput out, Map map) throws IOException {
+    public static void writeMap(ObjectOutput out, Map<?, ?> map) throws IOException {
         if (map == null) {
             out.writeInt(0);
         } else {
             out.writeInt(map.size());
-            Map.Entry entry = null;
-            for (Iterator i = map.entrySet().iterator(); i.hasNext();) {
-                entry = (Map.Entry)i.next();
+            for (Map.Entry<?, ?> entry : map.entrySet()) {
                 out.writeObject(entry.getKey());
                 out.writeObject(entry.getValue());
             }
@@ -119,21 +103,26 @@
     }
     
     /**
-     * Reads an array of String that was written to the ouput by this utility class
+     * Reads an array of String that was written to the output by this utility class
      * @param in
      * @return a non-null String[]
      * @throws IOException
      * @throws ClassNotFoundException
      */
-    public static String[] readStringArray(ObjectInput in) throws IOException, ClassNotFoundException {
+    @SuppressWarnings("unchecked")
+	public static <T> T[] readArray(ObjectInput in, Class<T> type) throws IOException, ClassNotFoundException {
         final int length = in.readInt();
-        String[] strings = new String[length];
+        T[] result = (T[])Array.newInstance(type, length);
         for (int i = 0; i < length; i++) {
-            strings[i] = (String)in.readObject();
+        	result[i] = type.cast(in.readObject());
         }
-        return strings;
+        return result;
     }
     
+    public static String[] readStringArray(ObjectInput in) throws IOException, ClassNotFoundException {
+    	return readArray(in, String.class);
+    }
+    
     /**
      * Reads a List that was written by this utility class.
      * @param in
@@ -141,15 +130,14 @@
      * @throws IOException
      * @throws ClassNotFoundException
      */
-    public static List readList(ObjectInput in) throws IOException, ClassNotFoundException {
-        final int size = in.readInt();
-        Object [] array = new Object[size];
-        for (int i = 0; i < size; i++) {
-            array[i] = in.readObject();
-        }
-        return Arrays.asList(array);
+    public static <T> List<T> readList(ObjectInput in, Class<T> type) throws IOException, ClassNotFoundException {
+        return Arrays.asList(readArray(in, type));
     }
     
+    public static List<?> readList(ObjectInput in) throws IOException, ClassNotFoundException {
+    	return readList(in, Object.class);
+    }
+    
     /**
      * Reads a Map that was written by this utility class
      * @param in
@@ -157,11 +145,12 @@
      * @throws IOException
      * @throws ClassNotFoundException
      */
-    public static Map readMap(ObjectInput in) throws IOException, ClassNotFoundException {
+    @SuppressWarnings("unchecked")
+	public static <K, V> Map<K, V> readMap(ObjectInput in) throws IOException, ClassNotFoundException {
         final int size = in.readInt();
-        HashMap map = new HashMap(size + 1, 1);
+        HashMap<K, V> map = new HashMap<K, V>(size);
         for (int i = 0; i < size; i++) {
-            map.put(in.readObject(), in.readObject());
+            map.put((K)in.readObject(), (V)in.readObject());
         }
         return map;
     }

Modified: branches/JCA/documentation/reference/src/main/docbook/en-US/content/datatypes.xml
===================================================================
--- branches/JCA/documentation/reference/src/main/docbook/en-US/content/datatypes.xml	2010-03-03 18:45:43 UTC (rev 1890)
+++ branches/JCA/documentation/reference/src/main/docbook/en-US/content/datatypes.xml	2010-03-03 18:56:39 UTC (rev 1891)
@@ -28,9 +28,9 @@
         </thead>
         <tbody>
           <row>
-            <entry>string</entry>
+            <entry>string or varchar</entry>
             <entry>variable length character string with a
-              maximum length of 4000</entry>
+              maximum length of 4000.  Note that the length cannot be explicitly set with the type literal, e.g. varchar(100).</entry>
             <entry>java.lang.String</entry>
             <entry>VARCHAR</entry>
             <entry>VARCHAR</entry>
@@ -51,14 +51,14 @@
             <entry>SMALLINT</entry>
           </row>
           <row>
-            <entry>byte</entry>
+            <entry>byte or tinyint</entry>
             <entry>numeric, integral type, signed 8-bit</entry>
             <entry>java.lang.Byte</entry>
             <entry>TINYINT</entry>
             <entry>SMALLINT</entry>
           </row>
           <row>
-            <entry>short</entry>
+            <entry>short or smallint</entry>
             <entry>numeric, integral type, signed 16-bit</entry>
             <entry>java.lang.Short</entry>
             <entry>SMALLINT</entry>
@@ -72,7 +72,7 @@
             <entry>INTEGER</entry>
           </row>
           <row>
-            <entry>long</entry>
+            <entry>long or bigint</entry>
             <entry>numeric, integral type, signed 64-bit</entry>
             <entry>java.lang.Long</entry>
             <entry>BIGINT</entry>
@@ -87,7 +87,7 @@
             <entry>NUMERIC</entry>
           </row>
           <row>
-            <entry>float</entry>
+            <entry>float or real</entry>
             <entry>numeric, floating point type, 32-bit IEEE 754
               floating-point numbers</entry>
             <entry>java.lang.Float</entry>
@@ -103,9 +103,9 @@
             <entry>DOUBLE</entry>
           </row>
           <row>
-            <entry>bigdecimal</entry>
+            <entry>bigdecimal or decimal</entry>
             <entry>numeric, floating point type, arbitrary
-              precision of up to 1000 digits</entry>
+              precision of up to 1000 digits.  Note that the precision and scale cannot be explicitly set with the type literal, e.g. decimal(38, 2).</entry>
             <entry>java.math.BigDecimal</entry>
             <entry>NUMERIC</entry>
             <entry>NUMERIC</entry>

Modified: branches/JCA/documentation/reference/src/main/docbook/en-US/content/procedures.xml
===================================================================
--- branches/JCA/documentation/reference/src/main/docbook/en-US/content/procedures.xml	2010-03-03 18:45:43 UTC (rev 1890)
+++ branches/JCA/documentation/reference/src/main/docbook/en-US/content/procedures.xml	2010-03-03 18:56:39 UTC (rev 1891)
@@ -49,7 +49,7 @@
           </para>
         </listitem>
         <listitem>
-          <para>The "USING" clause allows the dynamic SQL string to contain variable references that are bound at runtime to specified values. This allows for some independence of the SQL string from the surrounding procedure variable names and input names. In the dynamic command "USING" clause, each variable is specified by short name only. However in the dynamic SQL the "USING" variable must be fully qualified to "USING.". The "USING" clause is only for values that will be used in the dynamic SQL as legal expressions. It is not possible to use the "USING" clause to replace table names, keywords, etc. This makes using symbols equivalent in power to normal bind (?) expressions in prepared statements. The "USING" clause helps reduce the amount of string manipulation needed. If a reference is made to a USING symbol in the SQL string that is not bound to a value in the "USING" clause, an exception will occur.
+          <para>The "USING" clause allows the dynamic SQL string to contain variable references that are bound at runtime to specified values. This allows for some independence of the SQL string from the surrounding procedure variable names and input names. In the dynamic command "USING" clause, each variable is specified by short name only. However in the dynamic SQL the "USING" variable must be fully qualified to "UVAR.". The "USING" clause is only for values that will be used in the dynamic SQL as legal expressions. It is not possible to use the "USING" clause to replace table names, keywords, etc. This makes using symbols equivalent in power to normal bind (?) expressions in prepared statements. The "USING" clause helps reduce the amount of string manipulation needed. If a reference is made to a USING symbol in the SQL string that is not bound to a value in the "USING" clause, an exception will occur.
           </para>
         </listitem>
         <listitem>
@@ -63,7 +63,7 @@
 /* Typically complex criteria would be formed based upon inputs to the procedure. 
  In this simple example the criteria is references the using clause to isolate 
  the SQL string from referencing a value from the procedure directly */ 
-DECLARE string criteria = 'Customer.Accounts.Last = USING.LastName'; 
+DECLARE string criteria = 'Customer.Accounts.Last = DVARS.LastName'; 
 /* Now we create the desired SQL string */ 
 DECLARE string sql_string = 'SELECT ID, First || ‘‘ ‘‘ || Last AS Name, Birthdate FROM Customer.Accounts WHERE ' || criteria; 
 /* The execution of the SQL string will create the #temp table with the columns (ID, Name, Birthdate). 
@@ -81,17 +81,17 @@
         <programlisting>...
 DECLARE string crit = null; 
 IF (AccountAccess.GetAccounts.ID IS NOT NULL) 
- crit = ‘(Customer.Accounts.ID = using.ID)’; 
+ crit = ‘(Customer.Accounts.ID = DVARS.ID)’; 
 ELSE IF (AccountAccess.GetAccounts.LastName IS NOT NULL) 
 BEGIN 
  IF (AccountAccess.GetAccounts.LastName == ‘%’) 
    ERROR "Last name cannot be %"; 
  ELSE IF (LOCATE(‘%’, AccountAccess.GetAccounts.LastName) &lt; 0) 
-   crit = ‘(Customer.Accounts.Last = using.LastName)’; 
+   crit = ‘(Customer.Accounts.Last = DVARS.LastName)’; 
  ELSE 
-   crit = ‘(Customer.Accounts.Last LIKE using.LastName)’; 
+   crit = ‘(Customer.Accounts.Last LIKE DVARS.LastName)’; 
  IF (AccountAccess.GetAccounts.bday IS NOT NULL) 
-   crit = ‘(‘ || crit || ‘ and (Customer.Accounts.Birthdate = using.BirthDay))’; 
+   crit = ‘(‘ || crit || ‘ and (Customer.Accounts.Birthdate = DVARS.BirthDay))’; 
 END 
 ELSE 
  ERROR "ID or LastName must be specified."; 
@@ -118,7 +118,7 @@
             <title>Example Dangerous NULL handling
             </title>
             <programlisting>...
-criteria = ‘(‘ || criteria || ‘ and (Customer.Accounts.Birthdate = using.BirthDay))’;</programlisting>
+criteria = ‘(‘ || criteria || ‘ and (Customer.Accounts.Birthdate = DVARS.BirthDay))’;</programlisting>
           </example>
           <para>The preferred approach is for the user to ensure the criteria is not NULL prior its usage. If this is not possible, a good approach is to specify a default as shown in the following example.
           </para>
@@ -126,7 +126,7 @@
             <title>Example NULL handling
             </title>
             <programlisting>...
-criteria = ‘(‘ || nvl(criteria, ‘(1 = 1)’) || ‘ and (Customer.Accounts.Birthdate = using.BirthDay))’;</programlisting>
+criteria = ‘(‘ || nvl(criteria, ‘(1 = 1)’) || ‘ and (Customer.Accounts.Birthdate = DVARS.BirthDay))’;</programlisting>
           </example>
         </listitem>
         <listitem>

Copied: branches/JCA/engine/src/main/java/com/metamatrix/dqp/message/RequestID.java (from rev 1884, branches/JCA/client/src/main/java/com/metamatrix/dqp/message/RequestID.java)
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/dqp/message/RequestID.java	                        (rev 0)
+++ branches/JCA/engine/src/main/java/com/metamatrix/dqp/message/RequestID.java	2010-03-03 18:56:39 UTC (rev 1891)
@@ -0,0 +1,175 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.dqp.message;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+/**
+ * <p>This class represents an identifier for a request.  However, there are some
+ * differences in what constitutes "uniqueness" for a given RequestID that 
+ * is based on context (where the id is used).  The RequestID has 2 parts:
+ * connectionID, and executionIDFor the purposes of the RequestID, the combined 
+ * representation is "connectionID.executionID" - this implies a scoping
+ * for the name parts.  The connectionID specifies a particular connection that 
+ * is making requests.  Each connection generates a unique executionID for each 
+ * request execution, so the executionID is only unique in the context of a 
+ * connectionID.  </p>
+ * 
+ * <p>When this class is used between client and server, the connectionID is implied
+ * and thus only the executionID part will be used.  The server will qualify the 
+ * executionID with a connectionID when it reaches the server.  </p>
+ * 
+ * <p>RequestIDs are immutable so no setters exist.  This allows hashcodes to be 
+ * pre-computed for faster comparison in equals.</p>  
+ */
+public class RequestID implements Externalizable {
+
+    static final long serialVersionUID = -2888539138291776071L;
+    
+    public static final String NO_CONNECTION_STR = "C"; //$NON-NLS-1$
+    private static final String SEPARATOR = "."; //$NON-NLS-1$
+
+    // Basic state
+    private String connectionID;
+    private long executionID;
+    
+    // Derived state
+    private String combinedID;
+    private int hash;
+
+    /**
+     * Necessary for implementing Externalizable 
+     */
+    public RequestID() {        
+    }
+    
+    /**
+     * Create a RequestID using all of the ID parts.
+     * @param connectionID Identifies a connection, may be null
+     * @param executionID Identifies an execution, cannot be null
+     */
+    public RequestID(String connectionID, long executionID) {
+        this.connectionID = connectionID;
+        this.executionID = executionID;
+        
+        createCombinedID();
+        computeHashCode();
+    }
+    
+    public RequestID(long connectionID, long executionID) {
+        this.connectionID = String.valueOf(connectionID);
+        this.executionID = executionID;
+        
+        createCombinedID();
+        computeHashCode();
+    }    
+    
+    /**
+     * Create a RequestID for an execution where the connection is 
+     * not specified.
+     * @param executionID Identifies an execution, cannot be null
+     */
+    public RequestID(long executionID) {
+        this(null, executionID);
+    }
+
+    
+    /**
+     * Return connectionID, may be null if connection has not been specified.
+     * @return Connection ID, may be null
+     */
+    public String getConnectionID() {
+        return this.connectionID;
+    }
+    
+    /**
+     * Return executionID, which identifies a per-connection execution.
+     * @return Execution ID
+     */
+    public long getExecutionID() {
+        return this.executionID;
+    }
+
+    /**
+     * Create a unique combined ID string from the RequestID parts. 
+     */
+    private void createCombinedID() {
+        StringBuffer combinedStr = new StringBuffer();
+        if(this.connectionID != null) {
+            combinedStr.append(this.connectionID);
+        } else {
+            combinedStr.append(NO_CONNECTION_STR);
+        }
+        combinedStr.append(SEPARATOR);               
+        combinedStr.append(this.executionID);
+                
+        this.combinedID = combinedStr.toString();
+    }
+    
+    private void computeHashCode() {
+        this.hash = combinedID.hashCode();
+    }
+    
+    public int hashCode() {
+        return this.hash;
+    }
+    
+    public boolean equals(Object obj) {
+        if(obj == this) {
+            return true;
+        } else if(obj == null || !(obj instanceof RequestID) || obj.hashCode() != this.hashCode()) {
+            return false;
+        } else {
+            return this.toString().equals(obj.toString());
+        }
+    }
+    
+    /**
+     * Return a combined string for the ID.
+     */
+    public String toString() {
+        return this.combinedID;
+    }
+
+    /**
+     * @see java.io.Externalizable#readExternal(java.io.ObjectInput)
+     */
+    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        connectionID = (String)in.readObject();
+        executionID = in.readLong();
+
+        createCombinedID();
+        computeHashCode();
+    }
+
+    /**
+     * @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
+     */
+    public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeObject(connectionID);
+        out.writeLong(executionID);
+    }
+}

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/processor/proc/ExecDynamicSqlInstruction.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/processor/proc/ExecDynamicSqlInstruction.java	2010-03-03 18:45:43 UTC (rev 1890)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/processor/proc/ExecDynamicSqlInstruction.java	2010-03-03 18:56:39 UTC (rev 1891)
@@ -159,10 +159,14 @@
             
             if (dynamicCommand.getUsing() != null
                             && !dynamicCommand.getUsing().isEmpty()) {
-                metadataStore.addTempGroup(ProcedureReservedWords.USING, new LinkedList(dynamicCommand.getUsing().getClauseMap().keySet()));
-                GroupSymbol using = new GroupSymbol(ProcedureReservedWords.USING);
-                using.setMetadataID(metadataStore.getTempGroupID(ProcedureReservedWords.USING));
+                metadataStore.addTempGroup(SQLReservedWords.USING, new LinkedList(dynamicCommand.getUsing().getClauseMap().keySet()));
+                GroupSymbol using = new GroupSymbol(SQLReservedWords.USING);
+                using.setMetadataID(metadataStore.getTempGroupID(SQLReservedWords.USING));
                 command.addExternalGroupToContext(using);
+                metadataStore.addTempGroup(ProcedureReservedWords.DVARS, new LinkedList(dynamicCommand.getUsing().getClauseMap().keySet()));
+                using = new GroupSymbol(ProcedureReservedWords.DVARS);
+                using.setMetadataID(metadataStore.getTempGroupID(ProcedureReservedWords.DVARS));
+                command.addExternalGroupToContext(using);
             }
 
 			// Resolve any groups
@@ -235,8 +239,8 @@
 				LogManager.logTrace(LogConstants.CTX_DQP,
 						new Object[] { this, " The using variable ", //$NON-NLS-1$
 						setClause.getSymbol(), " has value :", assignment }); //$NON-NLS-1$
-				localContext.setValue(setClause.getSymbol(),
-						assignment);
+				localContext.setValue(setClause.getSymbol(), assignment);
+				localContext.setValue(new ElementSymbol(SQLReservedWords.USING + ElementSymbol.SEPARATOR + setClause.getSymbol().getShortName()), assignment);
 			}
 		}
 	}

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/DynamicCommandResolver.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/DynamicCommandResolver.java	2010-03-03 18:45:43 UTC (rev 1890)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/resolver/command/DynamicCommandResolver.java	2010-03-03 18:56:39 UTC (rev 1891)
@@ -27,8 +27,6 @@
 import java.util.List;
 import java.util.Set;
 
-import org.teiid.connector.language.SQLReservedWords;
-
 import com.metamatrix.api.exception.MetaMatrixComponentException;
 import com.metamatrix.api.exception.query.QueryMetadataException;
 import com.metamatrix.api.exception.query.QueryResolverException;
@@ -87,8 +85,8 @@
         if (dynamicCmd.getUsing() != null && !dynamicCmd.getUsing().isEmpty()) {
             for (SetClause clause : dynamicCmd.getUsing().getClauses()) {
                 ElementSymbol id = clause.getSymbol();
-                id.setName(ProcedureReservedWords.USING + SingleElementSymbol.SEPARATOR + id.getShortName());
-                id.setGroupSymbol(new GroupSymbol(ProcedureReservedWords.USING));
+                id.setName(ProcedureReservedWords.DVARS + SingleElementSymbol.SEPARATOR + id.getShortName());
+                id.setGroupSymbol(new GroupSymbol(ProcedureReservedWords.DVARS));
                 id.setType(clause.getValue().getType());
                 id.setMetadataID(new TempMetadataID(id.getCanonicalName(), id.getType()));
             }

Modified: branches/JCA/engine/src/main/java/com/metamatrix/query/sql/ProcedureReservedWords.java
===================================================================
--- branches/JCA/engine/src/main/java/com/metamatrix/query/sql/ProcedureReservedWords.java	2010-03-03 18:45:43 UTC (rev 1890)
+++ branches/JCA/engine/src/main/java/com/metamatrix/query/sql/ProcedureReservedWords.java	2010-03-03 18:56:39 UTC (rev 1891)
@@ -44,7 +44,7 @@
 
     public static final String VARIABLES = "VARIABLES"; //$NON-NLS-1$
     
-    public static final String USING = SQLReservedWords.USING;
+    public static final String DVARS = "DVARS"; //$NON-NLS-1$
     
     /**
  	 * Set of CAPITALIZED reserved words for checking whether a string is a reserved word.

Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/Request.java	2010-03-03 18:45:43 UTC (rev 1890)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/Request.java	2010-03-03 18:56:39 UTC (rev 1891)
@@ -573,7 +573,7 @@
 
 	protected void validateAccess(Command command) throws QueryValidatorException, MetaMatrixComponentException {
 		// See if entitlement checking is turned on
-		AuthorizationValidationVisitor visitor = new AuthorizationValidationVisitor(this.authService);
+		AuthorizationValidationVisitor visitor = new AuthorizationValidationVisitor(this.authService, this.workContext.getVDB());
 		validateWithVisitor(visitor, this.metadata, command);
 	}
 }

Modified: branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/validator/AuthorizationValidationVisitor.java
===================================================================
--- branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/validator/AuthorizationValidationVisitor.java	2010-03-03 18:45:43 UTC (rev 1890)
+++ branches/JCA/engine/src/main/java/org/teiid/dqp/internal/process/validator/AuthorizationValidationVisitor.java	2010-03-03 18:56:39 UTC (rev 1891)
@@ -33,6 +33,7 @@
 
 import org.teiid.adminapi.Visibility;
 import org.teiid.adminapi.impl.ModelMetaData;
+import org.teiid.adminapi.impl.VDBMetaData;
 import org.teiid.dqp.internal.process.DQPWorkContext;
 import org.teiid.dqp.internal.process.multisource.MultiSourceElement;
 
@@ -61,9 +62,11 @@
 public class AuthorizationValidationVisitor extends AbstractValidationVisitor {
 
     private AuthorizationService authInterface;
+    private VDBMetaData vdb;
 
-    public AuthorizationValidationVisitor(AuthorizationService authInterface) {
+    public AuthorizationValidationVisitor(AuthorizationService authInterface, VDBMetaData vdb) {
         this.authInterface = authInterface;
+        this.vdb = vdb;
     }
 
     // ############### Visitor methods for language objects ##################
@@ -298,7 +301,7 @@
         }
         try {
 		    String modelName = getMetadata().getFullName(modelID);
-		    ModelMetaData model = DQPWorkContext.getWorkContext().getVDB().getModel(modelName);
+		    ModelMetaData model = vdb.getModel(modelName);
 		    if(model.getVisibility() != Visibility.PUBLIC) {
 		        handleValidationError(DQPPlugin.Util.getString("ERR.018.005.0088", getMetadata().getFullName(group.getMetadataID()))); //$NON-NLS-1$
 		    }

Modified: branches/JCA/engine/src/main/javacc/com/metamatrix/query/parser/SQLParser.jj
===================================================================
--- branches/JCA/engine/src/main/javacc/com/metamatrix/query/parser/SQLParser.jj	2010-03-03 18:45:43 UTC (rev 1890)
+++ branches/JCA/engine/src/main/javacc/com/metamatrix/query/parser/SQLParser.jj	2010-03-03 18:56:39 UTC (rev 1891)
@@ -302,6 +302,39 @@
 |   <YEAR: "year">
 }
 
+TOKEN : /* SQL/XML Reserved words */
+{
+    <XMLAGG: "xmlagg">
+|   <XMLATTRIBUTES: "xmlattributes">
+|   <XMLBINARY: "xmlbinary">
+|   <XMLCONCAT: "xmlconcat">
+|   <XMLCOMMENT: "xmlcomment">
+|   <XMLELEMENT: "xmlelement">
+|   <XMLFOREST: "xmlforest">
+|   <XMLNAMESPACES: "xmlnamespaces">
+|   <XMLPARSE: "xmlparse">
+|   <XMLPI: "xmlpi">
+|   <XMLROOT: "xmlroot">
+|   <XMLSERIALIZE: "xmlserialize">
+}
+
+TOKEN : /* SQL/MED Reserved words */
+{
+    <DATALINK: "datalink">
+|   <DLNEWCOPY: "dlnewcopy">
+|   <DLPREVIOUSCOPY: "dlpreviouscopy">
+|   <DLURLCOMPLETE: "dlurlcomplete">
+|   <DLURLCOMPLETEWRITE: "dlurlcompletewrite">
+|   <DLURLCOMPLETEONLY: "dlurlcompleteonly">
+|   <DLURLPATH: "dlurlpath">
+|   <DLURLPATHWRITE: "dlurlpathwrite">
+|   <DLURLPATHONLY: "dlurlpathonly">
+|   <DLURLSCHEME: "dlurlscheme">
+|   <DLURLSERVER: "dlurlserver">
+|   <DLVALUE: "dlvalue">
+|   <IMPORT: "import">
+}
+
 TOKEN : /* Special function words */
 {
 	<SQL_TSI_FRAC_SECOND: "SQL_TSI_FRAC_SECOND"> 

Modified: branches/JCA/engine/src/test/java/com/metamatrix/query/validator/TestValidator.java
===================================================================
--- branches/JCA/engine/src/test/java/com/metamatrix/query/validator/TestValidator.java	2010-03-03 18:45:43 UTC (rev 1890)
+++ branches/JCA/engine/src/test/java/com/metamatrix/query/validator/TestValidator.java	2010-03-03 18:56:39 UTC (rev 1891)
@@ -1716,7 +1716,7 @@
         // Validate
         ValidatorReport report = helpValidateInModeler("pm1.vsp36", sql, metadata);  //$NON-NLS-1$
         assertEquals(1, report.getItems().size());
-        assertEquals("Elements cannot appear more than once in a SET or USING clause.  The following elements are duplicated: [\"USING\".id]", report.toString()); //$NON-NLS-1$
+        assertEquals("Elements cannot appear more than once in a SET or USING clause.  The following elements are duplicated: [DVARS.id]", report.toString()); //$NON-NLS-1$
     }    
     
     @Test public void testValidateAssignmentWithFunctionOnParameter_InModeler() throws Exception{

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCoreRequestHandling.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCoreRequestHandling.java	2010-03-03 18:45:43 UTC (rev 1890)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCoreRequestHandling.java	2010-03-03 18:56:39 UTC (rev 1891)
@@ -53,7 +53,7 @@
     private void compareReqInfos(Collection<RequestID> reqs1, Collection<RequestMetadata> reqs2) {
         Set reqIDs2 = new HashSet();
         for (RequestMetadata requestInfo : reqs2) {
-            reqIDs2.add(requestInfo.getRequestId());
+            reqIDs2.add(new RequestID(requestInfo.getSessionId(), requestInfo.getExecutionId()));
         }
         
         assertEquals("Collections of request infos are not the same: ", new HashSet(reqs1), reqIDs2); //$NON-NLS-1$

Modified: branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/validator/TestAuthorizationValidationVisitor.java
===================================================================
--- branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/validator/TestAuthorizationValidationVisitor.java	2010-03-03 18:45:43 UTC (rev 1890)
+++ branches/JCA/engine/src/test/java/org/teiid/dqp/internal/process/validator/TestAuthorizationValidationVisitor.java	2010-03-03 18:56:39 UTC (rev 1891)
@@ -32,7 +32,6 @@
 import org.mockito.Mockito;
 import org.teiid.adminapi.Visibility;
 import org.teiid.adminapi.impl.VDBMetaData;
-import org.teiid.dqp.internal.process.DQPWorkContext;
 import org.teiid.dqp.internal.process.Request;
 
 import com.metamatrix.api.exception.MetaMatrixComponentException;
@@ -126,11 +125,7 @@
         
         vdb.addAttchment(QueryMetadataInterface.class, metadata);
         
-        DQPWorkContext context = new DQPWorkContext();
-        context.setVdb(vdb);
-        DQPWorkContext.setWorkContext(context);
-        
-        AuthorizationValidationVisitor visitor = new AuthorizationValidationVisitor(svc); //$NON-NLS-1$ //$NON-NLS-2$
+        AuthorizationValidationVisitor visitor = new AuthorizationValidationVisitor(svc, vdb); 
         ValidatorReport report = Validator.validate(command, metadata, visitor);
         if(report.hasItems()) {
             ValidatorFailure firstFailure = (ValidatorFailure) report.getItems().iterator().next();
@@ -247,13 +242,11 @@
     }
     
 	private void helpTestLookupVisibility(boolean visible) throws QueryParserException, QueryValidatorException, MetaMatrixComponentException {
-		AuthorizationValidationVisitor mvvv = new AuthorizationValidationVisitor(Mockito.mock(AuthorizationService.class));
-		
-		DQPWorkContext workContext = FakeMetadataFactory.buildWorkContext(FakeMetadataFactory.example1Cached(), FakeMetadataFactory.example1VDB());
+		VDBMetaData vdb = FakeMetadataFactory.example1VDB();
 		if (!visible) {
-			workContext.getVDB().getModel("pm1").setVisibility(Visibility.PRIVATE);
+			vdb.getModel("pm1").setVisibility(Visibility.PRIVATE); //$NON-NLS-1$
 		}
-		
+		AuthorizationValidationVisitor mvvv = new AuthorizationValidationVisitor(Mockito.mock(AuthorizationService.class), vdb);
 		String sql = "select lookup('pm1.g1', 'e1', 'e2', 1)"; //$NON-NLS-1$
 		Command command = QueryParser.getQueryParser().parseCommand(sql);
 		Request.validateWithVisitor(mvvv, FakeMetadataFactory.example1Cached(), command);

Modified: branches/JCA/metadata/src/main/resources/System.vdb
===================================================================
(Binary files differ)



More information about the teiid-commits mailing list