Index: src/com/metamatrix/dqp/internal/datamgr/impl/ConnectorStateManager.java =================================================================== RCS file: /cvs/dev/com.metamatrix.dqp/src/com/metamatrix/dqp/internal/datamgr/impl/ConnectorStateManager.java,v retrieving revision 1.16.22.1 diff -u -r1.16.22.1 ConnectorStateManager.java --- src/com/metamatrix/dqp/internal/datamgr/impl/ConnectorStateManager.java 2 May 2006 02:30:01 -0000 1.16.22.1 +++ src/com/metamatrix/dqp/internal/datamgr/impl/ConnectorStateManager.java 5 Apr 2007 18:24:36 -0000 @@ -18,6 +18,7 @@ import com.metamatrix.data.api.Connector; import com.metamatrix.data.api.ConnectorCapabilities; import com.metamatrix.data.api.Execution; +import com.metamatrix.data.api.ExecutionContext; import com.metamatrix.data.api.SecurityContext; import com.metamatrix.data.exception.ConnectorException; import com.metamatrix.data.language.IBatchedUpdates; @@ -257,6 +258,14 @@ return null; } + public ExecutionContext getExecutionContext(AtomicRequestMessage requestMsg) { + ConnectorRequestState cState = getState(requestMsg); + if ( cState != null ) { + return cState.getExecutionContext(); + } + return null; + } + public boolean startProcessing(AtomicRequestMessage requestMessage) { ConnectorRequestState cState = getState(requestMessage); if (cState == null) { @@ -514,5 +523,8 @@ return this.requestID.hashCode(); } + public ExecutionContext getExecutionContext() { + return this.securityContext; + } } } Index: src/com/metamatrix/dqp/internal/datamgr/impl/ConnectorWorker.java =================================================================== RCS file: /cvs/dev/com.metamatrix.dqp/src/com/metamatrix/dqp/internal/datamgr/impl/ConnectorWorker.java,v retrieving revision 1.32.4.4.2.1.6.1 diff -u -r1.32.4.4.2.1.6.1 ConnectorWorker.java --- src/com/metamatrix/dqp/internal/datamgr/impl/ConnectorWorker.java 11 Dec 2006 14:36:43 -0000 1.32.4.4.2.1.6.1 +++ src/com/metamatrix/dqp/internal/datamgr/impl/ConnectorWorker.java 5 Apr 2007 18:24:36 -0000 @@ -35,6 +35,7 @@ import com.metamatrix.data.api.Connection; import com.metamatrix.data.api.ConnectorCapabilities; import com.metamatrix.data.api.Execution; +import com.metamatrix.data.api.ExecutionContext; import com.metamatrix.data.api.ProcedureExecution; import com.metamatrix.data.api.SynchQueryExecution; import com.metamatrix.data.api.UpdateExecution; @@ -188,7 +189,6 @@ QueryMetadataInterface queryMetadata) throws ConnectorException, XATransactionException, MetaMatrixComponentException { RequestID requestID = atomicReq.getRequestID(); LogManager.logDetail(LogConstants.CTX_CONNECTOR, new Object[] {requestID, "Processing NEW request:", atomicReq.getCommand()}); //$NON-NLS-1$ - logSRCCommand(atomicReq, TransactionLogConstants.CMD_STATUS.NEW, -1); //$NON-NLS-1$ // Obtain execution Execution execution = stateMgr.createExecution(atomicReq, queryMetadata); @@ -198,6 +198,10 @@ ICommand translatedCommand = stateMgr.getTranslatedCommand(atomicReq); int executionMode = stateMgr.getExecutionMode(atomicReq); + //Log the Source Command (Must be after obtaining the execution context) + logSRCCommand(atomicReq, TransactionLogConstants.CMD_STATUS.NEW, -1); //$NON-NLS-1$ + + // If request is within the context of a transaction, // start a sub txn for the context of this thread. // THIS MUST HAPPEN AS CLOSE TO THE BEGINING OF THIS @@ -818,11 +822,12 @@ } String modelName = qr.getModelName(); - + ExecutionContext context = stateMgr.getExecutionContext(qr); + tracker.log(qr.getRequestID().toString(), qr.getNodeID(), transactionID == null ? null : transactionID.asString(), cmdStatus, modelName == null ? "null" : modelName, qr.getConnectorBindingID(), //$NON-NLS-1$ cmdStatus == TransactionLogConstants.CMD_STATUS.NEW ? TransactionLogConstants.CMD_POINT.BEGIN : TransactionLogConstants.CMD_POINT.END, - qr.getConnectionID(), userName == null ? "unknown" : userName, sqlCmd, finalRowCnt); //$NON-NLS-1$ + qr.getConnectionID(), userName == null ? "unknown" : userName, sqlCmd, finalRowCnt, context); //$NON-NLS-1$ } /** Index: src/com/metamatrix/dqp/internal/datamgr/impl/IConnectorStateManager.java =================================================================== RCS file: /cvs/dev/com.metamatrix.dqp/src/com/metamatrix/dqp/internal/datamgr/impl/IConnectorStateManager.java,v retrieving revision 1.5.22.1 diff -u -r1.5.22.1 IConnectorStateManager.java --- src/com/metamatrix/dqp/internal/datamgr/impl/IConnectorStateManager.java 2 May 2006 02:30:01 -0000 1.5.22.1 +++ src/com/metamatrix/dqp/internal/datamgr/impl/IConnectorStateManager.java 5 Apr 2007 18:24:36 -0000 @@ -8,6 +8,7 @@ import com.metamatrix.common.xa.TransactionContext; import com.metamatrix.data.api.Connection; import com.metamatrix.data.api.Execution; +import com.metamatrix.data.api.ExecutionContext; import com.metamatrix.data.exception.ConnectorException; import com.metamatrix.data.language.ICommand; import com.metamatrix.dqp.message.AtomicRequestMessage; @@ -79,6 +80,8 @@ public boolean hasValueReferences(AtomicRequestMessage requestMsg); public TransactionContext getTransactionContext(AtomicRequestMessage requestMsg); + + public ExecutionContext getExecutionContext(AtomicRequestMessage requestMsg); /** * Marks that a processing thread (for NEW or MORE requests) has begun processing the request Index: src/com/metamatrix/dqp/service/CustomizableTrackingMessage.java =================================================================== RCS file: /cvs/dev/com.metamatrix.dqp/src/com/metamatrix/dqp/service/Attic/CustomizableTrackingMessage.java,v retrieving revision 1.1.2.2 diff -u -r1.1.2.2 CustomizableTrackingMessage.java --- src/com/metamatrix/dqp/service/CustomizableTrackingMessage.java 8 May 2006 14:14:13 -0000 1.1.2.2 +++ src/com/metamatrix/dqp/service/CustomizableTrackingMessage.java 5 Apr 2007 18:24:36 -0000 @@ -4,6 +4,8 @@ */ package com.metamatrix.dqp.service; +import com.metamatrix.data.api.ExecutionContext; + class CustomizableTrackingMessage { @@ -39,6 +41,8 @@ String connectorBindingName; boolean isCancelled; boolean errorOccurred; + ExecutionContext executionContext; + CustomizableTrackingMessage(long timestamp, String requestID, @@ -92,7 +96,8 @@ String connectorBindingName, String sessionID, String principal, - String sql) { + String sql, + ExecutionContext context) { // dataSourceCommandStart this.type = DATASOURCE_COMMAND_START; this.timestamp = timestamp; @@ -104,6 +109,7 @@ this.sessionID = sessionID; this.principal = principal; this.sql = sql; + this.executionContext = context; } CustomizableTrackingMessage(long timestamp, String requestID, @@ -115,7 +121,8 @@ String principal, int finalRowCount, boolean isCancelled, - boolean errorOccurred) { + boolean errorOccurred, + ExecutionContext context) { // dataSourceCommandEnd this.type = DATASOURCE_COMMAND_END; this.timestamp = timestamp; @@ -129,6 +136,7 @@ this.rowCount = finalRowCount; this.isCancelled = isCancelled; this.errorOccurred = errorOccurred; + this.executionContext = context; } CustomizableTrackingMessage(long timestamp, String transactionID, Index: src/com/metamatrix/dqp/service/CustomizableTrackingService.java =================================================================== RCS file: /cvs/dev/com.metamatrix.dqp/src/com/metamatrix/dqp/service/CustomizableTrackingService.java,v retrieving revision 1.5.2.1 diff -u -r1.5.2.1 CustomizableTrackingService.java --- src/com/metamatrix/dqp/service/CustomizableTrackingService.java 27 Apr 2006 17:53:23 -0000 1.5.2.1 +++ src/com/metamatrix/dqp/service/CustomizableTrackingService.java 5 Apr 2007 18:24:36 -0000 @@ -16,6 +16,7 @@ import com.metamatrix.common.queue.WorkerPool; import com.metamatrix.common.util.LogCommonConstants; import com.metamatrix.common.xa.log.TransactionLogConstants; +import com.metamatrix.data.api.ExecutionContext; import com.metamatrix.dqp.DQPPlugin; import com.metamatrix.dqp.spi.CommandLoggerSPI; import com.metamatrix.query.sql.lang.Command; @@ -137,12 +138,13 @@ String sessionUid, String principal, Command sql, - int rowCount) { + int rowCount, + ExecutionContext context) { if (this.willRecordSrcCmd()) { CustomizableTrackingMessage message = null; if (cmdPoint == TransactionLogConstants.CMD_POINT.BEGIN) { - message = new CustomizableTrackingMessage(System.currentTimeMillis(), requestId, nodeID, subTxnUid, modelName, cbName, sessionUid, principal, (sql!=null)?sql.toString():null); + message = new CustomizableTrackingMessage(System.currentTimeMillis(), requestId, nodeID, subTxnUid, modelName, cbName, sessionUid, principal, (sql!=null)?sql.toString():null, context); } else { boolean isCancelled = false; @@ -153,7 +155,7 @@ } else if (status == TransactionLogConstants.CMD_STATUS.ERROR) { errorOccurred = true; } - message = new CustomizableTrackingMessage(System.currentTimeMillis(), requestId, nodeID, subTxnUid, modelName, cbName, sessionUid, principal, rowCount, isCancelled, errorOccurred); + message = new CustomizableTrackingMessage(System.currentTimeMillis(), requestId, nodeID, subTxnUid, modelName, cbName, sessionUid, principal, rowCount, isCancelled, errorOccurred, context); } addWork(message); } @@ -314,7 +316,9 @@ message.connectorBindingName, message.sessionID, message.principal, - message.sql); + message.sql, + message.executionContext); + break; case CustomizableTrackingMessage.DATASOURCE_COMMAND_END: commandLogger.dataSourceCommandEnd(message.timestamp, @@ -327,7 +331,8 @@ message.principal, message.rowCount, message.isCancelled, - message.errorOccurred); + message.errorOccurred, + message.executionContext); break; case CustomizableTrackingMessage.TRANSACTION_START: commandLogger.transactionStart(message.timestamp, Index: src/com/metamatrix/dqp/service/TrackingService.java =================================================================== RCS file: /cvs/dev/com.metamatrix.dqp/src/com/metamatrix/dqp/service/TrackingService.java,v retrieving revision 1.7 diff -u -r1.7 TrackingService.java --- src/com/metamatrix/dqp/service/TrackingService.java 14 Apr 2006 21:27:38 -0000 1.7 +++ src/com/metamatrix/dqp/service/TrackingService.java 5 Apr 2007 18:24:36 -0000 @@ -6,6 +6,7 @@ package com.metamatrix.dqp.service; import com.metamatrix.common.application.ApplicationService; +import com.metamatrix.data.api.ExecutionContext; import com.metamatrix.query.sql.lang.Command; /** @@ -68,7 +69,8 @@ */ public void log(String requestId, long nodeID, String subTxnUid, short status, String modelName, String cbName, short cmdPoint, - String sessionUid, String principal, Command sql, int rowCount); + String sessionUid, String principal, Command sql, int rowCount, + ExecutionContext context); /** * Returns whether the tracker will record transactions. Index: src/com/metamatrix/dqp/spi/CommandLoggerSPI.java =================================================================== RCS file: /cvs/dev/com.metamatrix.dqp/src/com/metamatrix/dqp/spi/CommandLoggerSPI.java,v retrieving revision 1.4 diff -u -r1.4 CommandLoggerSPI.java --- src/com/metamatrix/dqp/spi/CommandLoggerSPI.java 14 Apr 2006 21:27:38 -0000 1.4 +++ src/com/metamatrix/dqp/spi/CommandLoggerSPI.java 5 Apr 2007 18:24:36 -0000 @@ -5,6 +5,7 @@ import java.util.Properties; +import com.metamatrix.data.api.ExecutionContext; import com.metamatrix.dqp.service.TrackingService; /** @@ -78,7 +79,7 @@ * @param sql SQL for the command. */ public void dataSourceCommandStart(long timestamp, String requestID, long sourceCommandID, String subTransactionID, String modelName, - String connectorBindingName, String sessionID, String principal, String sql); + String connectorBindingName, String sessionID, String principal, String sql, ExecutionContext context); /** * Data source-specific command has ended. This method will be called as the @@ -98,7 +99,7 @@ */ public void dataSourceCommandEnd(long timestamp, String requestID, long sourceCommandID, String subTransactionID, String modelName, String connectorBindingName, String sessionID, String principal, int finalRowCount, - boolean isCancelled, boolean errorOccurred); + boolean isCancelled, boolean errorOccurred, ExecutionContext context); /** * Transaction has started. This method will be called once when Index: src/com/metamatrix/dqp/spi/basic/FileCommandLogger.java =================================================================== RCS file: /cvs/dev/com.metamatrix.dqp/src/com/metamatrix/dqp/spi/basic/FileCommandLogger.java,v retrieving revision 1.6 diff -u -r1.6 FileCommandLogger.java --- src/com/metamatrix/dqp/spi/basic/FileCommandLogger.java 14 Apr 2006 21:27:38 -0000 1.6 +++ src/com/metamatrix/dqp/spi/basic/FileCommandLogger.java 5 Apr 2007 18:24:36 -0000 @@ -12,6 +12,7 @@ import java.util.Date; import java.util.Properties; +import com.metamatrix.data.api.ExecutionContext; import com.metamatrix.dqp.spi.CommandLoggerSPI; /** @@ -137,7 +138,8 @@ String connectorBindingName, String sessionID, String principal, - String sql) { + String sql, + ExecutionContext context) { String outputString = getTimestampString(new Date()) + "\tSTART DATA SRC COMMAND:\tstartTime=" + getTimestampString(new Date(timestamp)) + "\trequestID=" + requestID + "\tsourceCommandID="+ sourceCommandID + "\tsubTxID=" + subTransactionID + "\tmodelName="+ modelName + "\tconnectorBindingName=" + connectorBindingName + "\tsessionID=" + sessionID + "\tprincipal=" + principal + "\tsql=" + sql; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ this.logMessage(outputString); } @@ -156,7 +158,8 @@ String principal, int finalRowCount, boolean isCancelled, - boolean errorOccurred) { + boolean errorOccurred, + ExecutionContext context) { String outputString = getTimestampString(new Date()) + "\tEND DATA SRC COMMAND:\tendTime=" + getTimestampString(new Date(timestamp)) + "\trequestID=" + requestID + "\tsourceCommandID="+ sourceCommandID + "\tsubTxID=" + subTransactionID + "\tmodelName="+ modelName + "\tconnectorBindingName=" + connectorBindingName + "\tsessionID=" + sessionID + "\tprincipal=" + principal + "\tfinalRowCount=" + finalRowCount + "\tisCancelled=" + isCancelled + "\terrorOccurred=" + errorOccurred; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ this.logMessage(outputString); } Index: testsrc/com/metamatrix/dqp/service/TestCustomizableTrackingService.java =================================================================== RCS file: /cvs/dev/com.metamatrix.dqp/testsrc/com/metamatrix/dqp/service/TestCustomizableTrackingService.java,v retrieving revision 1.5.2.2 diff -u -r1.5.2.2 TestCustomizableTrackingService.java --- testsrc/com/metamatrix/dqp/service/TestCustomizableTrackingService.java 8 May 2006 14:14:13 -0000 1.5.2.2 +++ testsrc/com/metamatrix/dqp/service/TestCustomizableTrackingService.java 5 Apr 2007 18:24:36 -0000 @@ -11,6 +11,9 @@ import com.metamatrix.common.application.exception.ApplicationLifecycleException; import com.metamatrix.common.xa.log.TransactionLogConstants; +import com.metamatrix.data.api.ExecutionContext; +import com.metamatrix.dqp.internal.datamgr.impl.AtomicRequestID; +import com.metamatrix.dqp.internal.datamgr.impl.ExecutionContextImpl; import com.metamatrix.dqp.spi.CommandLoggerSPI; import com.metamatrix.query.sql.lang.Command; import com.metamatrix.query.sql.lang.SQLQuery; @@ -190,8 +193,10 @@ short status = TransactionLogConstants.CMD_STATUS.NEW; int finalRowCount = 3; + ExecutionContext context = new ExecutionContextImpl("Test", "1", principal, null, null, sessionID, false, new AtomicRequestID(requestID, String.valueOf(sourceCommandID), "1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + trackingService.log(requestID, sourceCommandID, subTransactionID, status, modelName, connectorBindingName, - cmdPoint, sessionID, principal, sql, finalRowCount); + cmdPoint, sessionID, principal, sql, finalRowCount, context); List expectedLogEntry = new ArrayList(); expectedLogEntry.add(requestID); @@ -220,9 +225,10 @@ int finalRowCount = 3; boolean isCancelled = true; boolean errorOccurred = false; - + + ExecutionContext context = new ExecutionContextImpl("Test", "1", principal, null, null, sessionID, false, new AtomicRequestID(requestID, String.valueOf(sourceCommandID), "1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ trackingService.log(requestID, sourceCommandID, subTransactionID, status, modelName, connectorBindingName, - cmdPoint, sessionID, principal, sql, finalRowCount); + cmdPoint, sessionID, principal, sql, finalRowCount, context); List expectedLogEntry = new ArrayList(); expectedLogEntry.add(requestID); @@ -323,7 +329,8 @@ String connectorBindingName, String sessionID, String principal, - String sql) { + String sql, + ExecutionContext context) { List logEntry = new ArrayList(12); logEntry.add(requestID); @@ -347,7 +354,8 @@ String principal, int finalRowCount, boolean isCancelled, - boolean errorOccurred) { + boolean errorOccurred, + ExecutionContext context) { List logEntry = new ArrayList(12); logEntry.add(requestID); Index: testsrc/com/metamatrix/dqp/spi/basic/TestFileCommandLogger.java =================================================================== RCS file: /cvs/dev/com.metamatrix.dqp/testsrc/com/metamatrix/dqp/spi/basic/TestFileCommandLogger.java,v retrieving revision 1.4 diff -u -r1.4 TestFileCommandLogger.java --- testsrc/com/metamatrix/dqp/spi/basic/TestFileCommandLogger.java 14 Apr 2006 21:27:38 -0000 1.4 +++ testsrc/com/metamatrix/dqp/spi/basic/TestFileCommandLogger.java 5 Apr 2007 18:24:36 -0000 @@ -54,8 +54,8 @@ logger.transactionStart(System.currentTimeMillis(), "2112", "5150", "nuge", "myVDB", "2"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ logger.userCommandStart(System.currentTimeMillis(), "13", "2112", "5150", "myAppName", "nuge", "myVDB", "2", "SELECT * FROM MyModel.MyTable"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ - logger.dataSourceCommandStart(System.currentTimeMillis(), "13", 51l, "18", "MyPhyModel", "MyBinding", "2112", "nuge", "SELECT * FROM MyPhyModel.MyTable"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ - logger.dataSourceCommandEnd(System.currentTimeMillis(), "13", 51l, "18", "MyPhyModel", "MyBinding", "2112", "nuge", 777, false, false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ + logger.dataSourceCommandStart(System.currentTimeMillis(), "13", 51l, "18", "MyPhyModel", "MyBinding", "2112", "nuge", "SELECT * FROM MyPhyModel.MyTable", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ + logger.dataSourceCommandEnd(System.currentTimeMillis(), "13", 51l, "18", "MyPhyModel", "MyBinding", "2112", "nuge", 777, false, false, null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ logger.userCommandEnd(System.currentTimeMillis(), "13", "2112", "5150", "nuge", "myVDB", "2", 10000, false, false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ logger.transactionEnd(System.currentTimeMillis(), "2112", "5150", "nuge", "myVDB", "2", true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$