Author: tejones
Date: 2010-04-22 17:17:22 -0400 (Thu, 22 Apr 2010)
New Revision: 2074
Modified:
trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
Log:
Added filter for VDBs when getting sessions and request
Modified: trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java 2010-04-22
18:55:02 UTC (rev 2073)
+++ trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java 2010-04-22
21:17:22 UTC (rev 2074)
@@ -14,22 +14,14 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.managed.api.ManagedComponent;
-import org.jboss.managed.api.ManagedObject;
import org.jboss.managed.api.ManagedOperation;
import org.jboss.managed.api.ManagedProperty;
import org.jboss.managed.plugins.ManagedObjectImpl;
import org.jboss.metatype.api.types.MetaType;
import org.jboss.metatype.api.values.CollectionValueSupport;
-import org.jboss.metatype.api.values.EnumValueSupport;
import org.jboss.metatype.api.values.GenericValueSupport;
import org.jboss.metatype.api.values.MetaValue;
import org.jboss.metatype.api.values.MetaValueFactory;
-import org.jboss.metatype.api.values.SimpleValue;
-import org.jboss.metatype.api.values.SimpleValueSupport;
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.PropertyList;
-import org.rhq.core.domain.configuration.PropertyMap;
-import org.rhq.core.domain.configuration.PropertySimple;
import org.teiid.adminapi.Request;
import org.teiid.adminapi.Session;
import org.teiid.adminapi.Transaction;
@@ -225,14 +217,14 @@
} else if (operationName.equals(VDB.Operations.GET_SESSIONS)) {
List<String> fieldNameList = operationResult.getFieldNameList();
MetaValue sessionMetaValue = getSessions();
- getSessionCollectionValue(sessionMetaValue,
- activeSessionsCollection);
+ getSessionCollectionValueForVDB(sessionMetaValue,
+ activeSessionsCollection,
(String)valueMap.get(PluginConstants.ComponentType.VDB.NAME));
operationResult.setContent(createReportResultList(fieldNameList,
activeSessionsCollection.iterator()));
} else if (operationName.equals(VDB.Operations.GET_REQUESTS)) {
List<String> fieldNameList = operationResult.getFieldNameList();
MetaValue requestMetaValue = getRequests();
- getRequestCollectionValue(requestMetaValue, resultObject);
+ getRequestCollectionValueForVDB(requestMetaValue, resultObject,
(String)valueMap.get(PluginConstants.ComponentType.VDB.NAME));
operationResult.setContent(createReportResultList(fieldNameList,
resultObject.iterator()));
}
@@ -507,6 +499,26 @@
}
}
+ public static <T> 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()) {
+ Request request = (Request) MetaValueFactory.getInstance()
+ .unwrap(value);
+ if (request.getName().equals(vdbName)){
+ list.add(request);
+ }
+ } else {
+ throw new IllegalStateException(pValue
+ + " is not a Composite type");
+ }
+ }
+ }
+ }
+
public static <T> void getTransactionCollectionValue(MetaValue pValue,
Collection<Transaction> list) {
MetaType metaType = pValue.getMetaType();
@@ -543,6 +555,26 @@
}
}
}
+
+ public static <T> void getSessionCollectionValueForVDB(MetaValue pValue,
+ Collection<Session> list, String vdbName) {
+ MetaType metaType = pValue.getMetaType();
+ if (metaType.isCollection()) {
+ for (MetaValue value : ((CollectionValueSupport) pValue)
+ .getElements()) {
+ if (value.getMetaType().isComposite()) {
+ Session session = (Session) MetaValueFactory.getInstance()
+ .unwrap(value);
+ if (session.getName().equals(vdbName)){
+ list.add(session);
+ }
+ } else {
+ throw new IllegalStateException(pValue
+ + " is not a Composite type");
+ }
+ }
+ }
+ }
private Collection createReportResultList(List fieldNameList,
Iterator objectIter) {
Show replies by date