[teiid-commits] teiid SVN: r2180 - in trunk/console/src/main/java/org/teiid/rhq: plugin and 1 other directory.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Fri Jun 4 17:35:07 EDT 2010


Author: tejones
Date: 2010-06-04 17:35:06 -0400 (Fri, 04 Jun 2010)
New Revision: 2180

Modified:
   trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
   trunk/console/src/main/java/org/teiid/rhq/plugin/VDBComponent.java
Log:
TEIID-1113: Changed Get Requests for VDB to use method on Runtime Engine

Modified: trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java	2010-06-04 21:00:20 UTC (rev 2179)
+++ trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java	2010-06-04 21:35:06 UTC (rev 2180)
@@ -213,6 +213,8 @@
 		Collection<Session> activeSessionsCollection = new ArrayList<Session>();
 		String vdbName = (String) valueMap
 				.get(PluginConstants.ComponentType.VDB.NAME);
+		String vdbVersion = (String) valueMap
+		.get(PluginConstants.ComponentType.VDB.VERSION);
 
 		if (operationName.equals(VDB.Operations.GET_PROPERTIES)) {
 			List<String> fieldNameList = operationResult.getFieldNameList();
@@ -228,8 +230,8 @@
 					activeSessionsCollection.iterator()));
 		} else if (operationName.equals(VDB.Operations.GET_REQUESTS)) {
 			List<String> fieldNameList = operationResult.getFieldNameList();
-			MetaValue requestMetaValue = getRequests();
-			getRequestCollectionValueForVDB(requestMetaValue, resultObject, vdbName);
+			MetaValue requestMetaValue = getRequestsForVDB(vdbName, Integer.parseInt(vdbVersion));
+			getRequestCollectionValue(requestMetaValue, resultObject);
 			operationResult.setContent(createReportResultList(fieldNameList,
 					resultObject.iterator()));
 		}
@@ -274,6 +276,26 @@
 
 	}
 
+	protected MetaValue getRequestsForVDB(String vdbName, int vdbVersion) {
+
+		MetaValue requestsCollection = null;
+		MetaValue[] args = new MetaValue[] {
+				MetaValueFactory.getInstance().create(vdbName),
+				MetaValueFactory.getInstance().create(vdbVersion)};
+
+		try {
+			requestsCollection = executeManagedOperation(mc,
+					PluginConstants.ComponentType.VDB.Operations.GET_REQUESTS,
+					args);
+		} catch (Exception e) {
+			final String msg = "Exception executing operation: " + Platform.Operations.GET_REQUESTS; //$NON-NLS-1$
+			LOG.error(msg, e);
+		}
+
+		return requestsCollection;
+
+	}
+
 	protected MetaValue getTransactions() {
 
 		MetaValue transactionsCollection = null;
@@ -472,35 +494,17 @@
 		return requestsCollection;
 	}
 
-	public static <T> void getRequestCollectionValue(MetaValue pValue,
+	private void getRequestCollectionValue(MetaValue pValue,
 			Collection<Request> list) {
 		MetaType metaType = pValue.getMetaType();
 		if (metaType.isCollection()) {
 			for (MetaValue value : ((CollectionValueSupport) pValue)
 					.getElements()) {
 				if (value.getMetaType().isComposite()) {
-					Request Request = (Request) MetaValueFactory.getInstance()
-							.unwrap(value);
-					list.add(Request);
-				} else {
-					throw new IllegalStateException(pValue
-							+ " is not a Composite type");
-				}
-			}
-		}
-	}
-
-	private void getRequestCollectionValueForVDB(MetaValue pValue,
-			Collection<Request> list, String vdbName) {
-		MetaType metaType = pValue.getMetaType();
-		if (metaType.isCollection()) {
-			for (MetaValue value : ((CollectionValueSupport) pValue)
-					.getElements()) {
-				if (value.getMetaType().isComposite()) {
 					RequestMetadataMapper rmm = new RequestMetadataMapper();
 					RequestMetadata request = (RequestMetadata) rmm
 							.unwrapMetaValue(value);
-						list.add(request);
+					list.add(request);
 				} else {
 					throw new IllegalStateException(pValue
 							+ " is not a Composite type");

Modified: trunk/console/src/main/java/org/teiid/rhq/plugin/VDBComponent.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/VDBComponent.java	2010-06-04 21:00:20 UTC (rev 2179)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/VDBComponent.java	2010-06-04 21:35:06 UTC (rev 2180)
@@ -101,6 +101,9 @@
 		String key = VDB.NAME; 
 		valueMap.put(key, this.resourceConfiguration.getSimpleValue("name",
 				null));
+		String version = VDB.VERSION; 
+		valueMap.put(version, this.resourceConfiguration.getSimpleValue("version",
+				null));
 		
 		// Parameter logic for VDB Operations
 		if (name.equals(VDB.Operations.KILL_REQUEST)) {



More information about the teiid-commits mailing list