[teiid-commits] teiid SVN: r4063 - in branches/7.7.x/console/src/main: java/org/teiid/rhq/plugin and 1 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Mon May 7 13:50:58 EDT 2012


Author: tejones
Date: 2012-05-07 13:50:58 -0400 (Mon, 07 May 2012)
New Revision: 4063

Modified:
   branches/7.7.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
   branches/7.7.x/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java
   branches/7.7.x/console/src/main/resources/META-INF/rhq-plugin.xml
Log:
TEIID-1996: Added new operation to get query plan for an in-flight session/request.

Modified: branches/7.7.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
===================================================================
--- branches/7.7.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java	2012-05-07 17:49:58 UTC (rev 4062)
+++ branches/7.7.x/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java	2012-05-07 17:50:58 UTC (rev 4063)
@@ -188,6 +188,7 @@
 			ExecutedResult operationResult, final String operationName,
 			final Map<String, Object> valueMap) throws Exception {
 		Collection<RequestMetadata> resultObject = new ArrayList<RequestMetadata>();
+		String value = new String();
 		Collection<SessionMetadata> activeSessionsCollection = new ArrayList<SessionMetadata>();
 		Collection<TransactionMetadata> transactionsCollection = new ArrayList<TransactionMetadata>();
 
@@ -210,6 +211,15 @@
 			MetaValue transactionMetaValue = getTransactions(connection);
 			getTransactionCollectionValue(transactionMetaValue,transactionsCollection);
 			operationResult.setContent(createReportResultList(fieldNameList,	resultObject.iterator()));
+		} else if (operationName.equals(Platform.Operations.VIEW_QUERY_PLAN)) {
+			Long requestID = (Long) valueMap.get(Operation.Value.REQUEST_ID);
+			String sessionID = (String) valueMap.get(Operation.Value.SESSION_ID);
+			MetaValue[] args = new MetaValue[] {
+					SimpleValueSupport.wrap(sessionID),
+					SimpleValueSupport.wrap(requestID) };
+			MetaValue planMetaValue = getPlan(connection, args);
+			value = ProfileServiceUtil.stringValue(planMetaValue);
+			operationResult.setContent(value);
 		} else if (operationName.equals(Platform.Operations.KILL_TRANSACTION)) {
 			String transactionID = (String) valueMap.get(Operation.Value.TRANSACTION_ID);
 			MetaValue[] args = new MetaValue[] { SimpleValueSupport.wrap(transactionID) };
@@ -470,7 +480,24 @@
 		return transactionsCollection;
 
 	}
+	
+	protected MetaValue getPlan(ProfileServiceConnection connection, MetaValue[] args) {
 
+		MetaValue planString = null;
+		
+		try {
+			planString = executeManagedOperation(connection,
+					getRuntimeEngineDeployer(connection, mc),
+					Platform.Operations.VIEW_QUERY_PLAN, args);
+		} catch (Exception e) {
+			final String msg = "Exception executing operation: " + Platform.Operations.VIEW_QUERY_PLAN; //$NON-NLS-1$
+			LOG.error(msg, e);
+		}
+
+		return planString;
+
+	}
+
 	public MetaValue getSessions(ProfileServiceConnection connection) {
 
 		MetaValue sessionCollection = null;

Modified: branches/7.7.x/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java
===================================================================
--- branches/7.7.x/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java	2012-05-07 17:49:58 UTC (rev 4062)
+++ branches/7.7.x/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java	2012-05-07 17:50:58 UTC (rev 4063)
@@ -94,10 +94,10 @@
 	protected void setOperationArguments(String name,
 			Configuration configuration, Map<String, Object> valueMap) {
 		// Parameter logic for System Operations
-		if (name.equals(Platform.Operations.KILL_REQUEST)) {
+		if (name.equals(Platform.Operations.KILL_REQUEST) || name.equals(Platform.Operations.VIEW_QUERY_PLAN)) {
 			valueMap.put(Operation.Value.REQUEST_ID, configuration.getSimple(Operation.Value.REQUEST_ID).getLongValue());
 			valueMap.put(Operation.Value.SESSION_ID, configuration.getSimple(Operation.Value.SESSION_ID).getStringValue());
-		} else if (name.equals(Platform.Operations.KILL_REQUEST)) {
+		} else if (name.equals(Platform.Operations.KILL_TRANSACTION)) {
 			valueMap.put(Operation.Value.TRANSACTION_ID, configuration.getSimple(Operation.Value.TRANSACTION_ID).getStringValue());
 		} else if (name.equals(Platform.Operations.KILL_SESSION)) {
 			valueMap.put(Operation.Value.SESSION_ID, configuration.getSimple(Operation.Value.SESSION_ID).getStringValue());

Modified: branches/7.7.x/console/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- branches/7.7.x/console/src/main/resources/META-INF/rhq-plugin.xml	2012-05-07 17:49:58 UTC (rev 4062)
+++ branches/7.7.x/console/src/main/resources/META-INF/rhq-plugin.xml	2012-05-07 17:50:58 UTC (rev 4063)
@@ -164,15 +164,6 @@
 		</operation>
 
 
-		<operation name="terminateSession" displayName="Terminate Session"
-			description="Terminate a specified session">
-			<parameters>
-				<c:simple-property displayName="SessionID" name="sessionID"
-					type="string" required="true" description="The ID of the session to terminate" />
-			</parameters>
-		</operation>
-
-
 		<operation name="getRequests" displayName="View current requests"
 			description="Get current requests executing against this Teiid instance">
 			<results>
@@ -212,6 +203,21 @@
 					type="long" required="true" description="The ID of the request to cancel" />
 			</parameters>
 		</operation>
+		
+		<operation name="getPlan" displayName="View query plan"
+			description="Retrieves the query plan for an in-flight request">
+			<parameters>
+				<c:simple-property displayName="Session ID" name="sessionID"
+					type="string" required="true"
+					description="The ID of the session that the request to cancel is associated with" />
+				<c:simple-property displayName="Request ID" name="requestID"
+					type="long" required="true" description="The ID of the request to retrieve the query plan for" />
+			</parameters>
+			<results>
+					<c:simple-property displayName="Query Plan"
+						name="operationResults" type="longString" description="The query execution plan for the specified session/request." />
+			</results>
+		</operation>
 
 		<operation name="getTransactions" displayName="View current transactions"
 			description="Get current transactions executing against this VDB">
@@ -244,6 +250,14 @@
 					description="The ID of the transaction to terminate" />
 			</parameters>
 		</operation>
+		
+		<operation name="terminateSession" displayName="Terminate Session"
+			description="Terminate a specified session">
+			<parameters>
+				<c:simple-property displayName="SessionID" name="sessionID"
+					type="string" required="true" description="The ID of the session to terminate" />
+			</parameters>
+		</operation>
 
 		<metric displayName="Query Count" defaultOn="true" displayType="detail"
 			category="throughput" property="queryCount"



More information about the teiid-commits mailing list