[teiid-commits] teiid SVN: r1964 - in trunk/console/src: main/java/org/teiid/rhq/plugin and 2 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Mon Mar 15 17:00:08 EDT 2010


Author: tejones
Date: 2010-03-15 17:00:07 -0400 (Mon, 15 Mar 2010)
New Revision: 1964

Modified:
   trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
   trunk/console/src/main/java/org/teiid/rhq/plugin/Facet.java
   trunk/console/src/main/java/org/teiid/rhq/plugin/VDBComponent.java
   trunk/console/src/main/java/org/teiid/rhq/plugin/VDBDiscoveryComponent.java
   trunk/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java
   trunk/console/src/resources/embedded/META-INF/rhq-plugin.xml
Log:
- Removed required fields for VDB
- Change "Connector Binding" to "Source Name"
- Added VDB Status as metric and summary trait
- Added type to logical model in VDB configuration
- Split models into separate sections in one table
- Add Connector Binding to JNDI name in source models table
- Changed DS Runtime Engine to Data Services


Modified: trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java	2010-03-15 18:24:28 UTC (rev 1963)
+++ trunk/console/src/main/java/org/teiid/rhq/admin/DQPManagementView.java	2010-03-15 21:00:07 UTC (rev 1964)
@@ -90,9 +90,27 @@
 
 		Object resultObject = new Object();
 
-		// if (metric.equals(ComponentType.Metric.HIGH_WATER_MARK)) {
-		// resultObject = new Double(getHighWatermark(identifier));
-		// }
+		if (metric
+				.equals(PluginConstants.ComponentType.VDB.Metrics.STATUS)) {
+			//TODO remove version parameter after AdminAPI is changed
+			resultObject = getVDBStatus((String)valueMap.get(VDB.NAME), 1);
+		} else if (metric
+				.equals(PluginConstants.ComponentType.VDB.Metrics.QUERY_COUNT)) {
+			resultObject = new Double(getQueryCount().doubleValue());
+		} else {
+			if (metric
+					.equals(PluginConstants.ComponentType.VDB.Metrics.SESSION_COUNT)) {
+				resultObject = new Double(getSessionCount().doubleValue());
+			} else {
+				if (metric
+						.equals(PluginConstants.ComponentType.VDB.Metrics.LONG_RUNNING_QUERIES)) {
+					Integer longRunningQueryLimit = (Integer) valueMap
+							.get(PluginConstants.Operation.Value.LONG_RUNNING_QUERY_LIMIT);
+					Collection<RequestMetadata> longRunningQueries = getLongRunningQueries(longRunningQueryLimit);
+					resultObject = new Double(longRunningQueries.size());
+				}
+			}
+		}
 
 		return resultObject;
 	}
@@ -102,7 +120,7 @@
 	 */
 
 	public void executeOperation(ExecutedResult operationResult,
-			final Map valueMap) {
+			final Map<String, Object> valueMap) {
 
 		if (operationResult.getComponentType().equals(
 				PluginConstants.ComponentType.Platform.NAME)) {
@@ -245,7 +263,27 @@
 		return sessionCollection;
 
 	}
+	
+	public String getVDBStatus(String vdbName, int version) {
+		
+		ManagedComponent mcVdb = null;
+		try {
+			mcVdb = ProfileServiceUtil
+			.getManagedComponent(new org.jboss.managed.api.ComponentType(
+					PluginConstants.ComponentType.VDB.TYPE,
+					PluginConstants.ComponentType.VDB.SUBTYPE), vdbName);
+		} catch (NamingException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
 
+		return ProfileServiceUtil.getSimpleValue(mcVdb,
+				"status", String.class);
+	}
+
 	public static MetaValue executeManagedOperation(ManagedComponent mc,
 			String operation, MetaValue... args) throws Exception {
 

Modified: trunk/console/src/main/java/org/teiid/rhq/plugin/Facet.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/Facet.java	2010-03-15 18:24:28 UTC (rev 1963)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/Facet.java	2010-03-15 21:00:07 UTC (rev 1964)
@@ -179,7 +179,16 @@
 						+ " named " + this.getComponentName());
 
 	}
+	
+	protected void setMetricArguments(String name,
+			Configuration configuration, Map<String, Object> argumentMap) {
+		// moved this logic up to the associated implemented class
+		throw new InvalidPluginConfigurationException(
+				"Not implemented on component type " + this.getComponentType()
+						+ " named " + this.getComponentName());
 
+	}
+
 	protected void execute(final ExecutedResult result, final Map valueMap) {
 		DQPManagementView dqp = new DQPManagementView();
 			

Modified: trunk/console/src/main/java/org/teiid/rhq/plugin/VDBComponent.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/VDBComponent.java	2010-03-15 18:24:28 UTC (rev 1963)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/VDBComponent.java	2010-03-15 21:00:07 UTC (rev 1964)
@@ -27,12 +27,11 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.hyperic.sigar.test.GetPass;
 import org.rhq.core.domain.configuration.Configuration;
 import org.rhq.core.domain.measurement.MeasurementDataNumeric;
+import org.rhq.core.domain.measurement.MeasurementDataTrait;
 import org.rhq.core.domain.measurement.MeasurementReport;
 import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
-import org.rhq.core.pluginapi.measurement.MeasurementFacet;
 import org.teiid.rhq.admin.DQPManagementView;
 import org.teiid.rhq.comm.ConnectionConstants;
 import org.teiid.rhq.plugin.util.PluginConstants;
@@ -46,11 +45,11 @@
  * 
  */
 public class VDBComponent extends Facet {
-	private final Log LOG = LogFactory
-			.getLog(VDBComponent.class);
+	private final Log LOG = LogFactory.getLog(VDBComponent.class);
 
-	
-	/* (non-Javadoc)
+	/*
+	 * (non-Javadoc)
+	 * 
 	 * @see org.teiid.rhq.plugin.Facet#getComponentName()
 	 */
 	@Override
@@ -73,9 +72,20 @@
 		} else if (name.equals(Platform.Operations.GET_PROPERTIES)) {
 			String key = ConnectionConstants.IDENTIFIER;
 			valueMap.put(key, getComponentIdentifier());
+		} else if (name.equals(Platform.Operations.KILL_SESSION)) {
+			valueMap.put(Operation.Value.SESSION_ID, configuration.getSimple(
+					Operation.Value.SESSION_ID).getLongValue());
 		}
 
 	}
+	
+	@Override
+	protected void setMetricArguments(String name,
+			Configuration configuration, Map<String, Object> valueMap) {
+		// Parameter logic for VDB Metrics
+		String key = VDB.NAME;
+		valueMap.put(key, this.resourceConfiguration.getSimpleValue("name", null));
+	}
 
 	@Override
 	public void getValues(MeasurementReport report,
@@ -84,6 +94,7 @@
 		DQPManagementView view = new DQPManagementView();
 
 		Map<String, Object> valueMap = new HashMap<String, Object>();
+		setMetricArguments(VDB.NAME, null, valueMap);
 
 		for (MeasurementScheduleRequest request : requests) {
 			String name = request.getName();
@@ -96,23 +107,30 @@
 				if (request
 						.getName()
 						.equals(
-								PluginConstants.ComponentType.Platform.Metrics.QUERY_COUNT)) {
-					report.addData(new MeasurementDataNumeric(request,
-							(Double) metricReturnObject));
+								PluginConstants.ComponentType.VDB.Metrics.QUERY_COUNT)) {
+					report.addData(new MeasurementDataTrait(request, (String)metricReturnObject));
 				} else {
 					if (request
 							.getName()
 							.equals(
-									PluginConstants.ComponentType.Platform.Metrics.SESSION_COUNT)) {
+									PluginConstants.ComponentType.VDB.Metrics.SESSION_COUNT)) {
 						report.addData(new MeasurementDataNumeric(request,
 								(Double) metricReturnObject));
 					} else {
 						if (request
 								.getName()
 								.equals(
-										PluginConstants.ComponentType.Platform.Metrics.LONG_RUNNING_QUERIES)) {
-							report.addData(new MeasurementDataNumeric(request,
-									(Double) metricReturnObject));
+										PluginConstants.ComponentType.VDB.Metrics.STATUS)) {
+							report.addData(new MeasurementDataTrait(request,
+									 (String) metricReturnObject));
+						} else {
+							if (request
+									.getName()
+									.equals(
+											PluginConstants.ComponentType.VDB.Metrics.LONG_RUNNING_QUERIES)) {
+								report.addData(new MeasurementDataNumeric(
+										request, (Double) metricReturnObject));
+							}
 						}
 
 					}

Modified: trunk/console/src/main/java/org/teiid/rhq/plugin/VDBDiscoveryComponent.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/VDBDiscoveryComponent.java	2010-03-15 18:24:28 UTC (rev 1963)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/VDBDiscoveryComponent.java	2010-03-15 21:00:07 UTC (rev 1964)
@@ -37,11 +37,9 @@
 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.CompositeValueSupport;
-import org.jboss.metatype.api.values.EnumValue;
+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;
@@ -144,7 +142,7 @@
 		PropertyList sourceModelsList = new PropertyList("sourceModels");
 		configuration.put(sourceModelsList);
 
-		PropertyList logicalModelsList = new PropertyList("virtualModels");
+		PropertyList logicalModelsList = new PropertyList("logicalModels");
 		configuration.put(logicalModelsList);
 
 		PropertyList errorList = new PropertyList("errorList");
@@ -179,7 +177,10 @@
 			getSourceMappingValue(connectorBinding.getValue(), sourceList);
 			String visibility = ((SimpleValueSupport) managedObject
 					.getProperty("visible").getValue()).getValue().toString();
+			String type = ((EnumValueSupport) managedObject
+					.getProperty("modelType").getValue()).getValue().toString();
 
+			
 			// Get any model errors/warnings
 			MetaValue errors = managedObject.getProperty("errors").getValue();
 			if (errors != null) {
@@ -218,6 +219,7 @@
 				} else {
 					PropertyMap model = new PropertyMap("model",
 							new PropertySimple("name", modelName),
+							new PropertySimple("type", type),
 							new PropertySimple("visibility", visibility));
 
 					logicalModelsList.add(model);

Modified: trunk/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java	2010-03-15 18:24:28 UTC (rev 1963)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/util/PluginConstants.java	2010-03-15 21:00:07 UTC (rev 1964)
@@ -64,7 +64,7 @@
 			public final static String TYPE = "ConnectionFactory"; //$NON-NLS-1$
 			public final static String SUBTYPE = "NoTx"; //$NON-NLS-1$
 			public final static String TEIID_RUNTIME_ENGINE = "org.teiid.jboss.deployers.RuntimeEngineDeployer"; //$NON-NLS-1$
-			public final static String TEIID_ENGINE_RESOURCE_NAME = "Data Service Runtime Engine"; //$NON-NLS-1$
+			public final static String TEIID_ENGINE_RESOURCE_NAME = "Data Services"; //$NON-NLS-1$
 			public final static String TEIID_ENGINE_RESOURCE_DESCRIPTION = "JBoss Enterprise Data Service Runtime Engine"; //$NON-NLS-1$
 
 			public static interface Operations {
@@ -106,7 +106,16 @@
 				public final static String GET_SESSIONS = "getSessions"; //$NON-NLS-1$
 
 			}
+			
+			public static interface Metrics {
 
+				public final static String STATUS = "status"; //$NON-NLS-1$ 
+				public final static String QUERY_COUNT = "queryCount"; //$NON-NLS-1$            
+				public final static String SESSION_COUNT = "sessionCount"; //$NON-NLS-1$
+				public final static String LONG_RUNNING_QUERIES = "longRunningQueries"; //$NON-NLS-1$     
+
+			}
+
 		}
 
 		public interface Model {

Modified: trunk/console/src/resources/embedded/META-INF/rhq-plugin.xml
===================================================================
--- trunk/console/src/resources/embedded/META-INF/rhq-plugin.xml	2010-03-15 18:24:28 UTC (rev 1963)
+++ trunk/console/src/resources/embedded/META-INF/rhq-plugin.xml	2010-03-15 21:00:07 UTC (rev 1964)
@@ -251,38 +251,42 @@
 				</results>
 			</operation>
 
+			<metric displayName="Status" defaultOn="true" dataType="trait" displayType="summary"
+			category="availability" property="status" 
+			description="The status of this VDB" />
+			
 			<content name="vdb" displayName="VDB Archive" category="deployable"
 				isCreationType="true">
 			</content>
-
+			
 			<resource-configuration>
 				<c:group name="general" displayName="General"
 					hiddenByDefault="false">
 					<c:simple-property name="name" type="string"
-						description="The Virtual Database Name" />
+						description="The Virtual Database Name" required="false"/>
 					<c:simple-property name="version" type="string"
-						description="The Virtual Database Version" />
+						description="The Virtual Database Version" required="false"/>
 					<c:simple-property name="description" type="string"
-						description="The Virtual Database Description" />
+						description="The Virtual Database Description" required="false"/>
 					<c:simple-property name="status" type="string"
-						description="The Virtual Database Status">
+						description="The Virtual Database Status" required="false" summary="true">
 						<c:property-options>
 									<c:option value="ACTIVE" name="ACTIVE" />
 									<c:option value="INACTIVE" name="INACTIVE" default="true"/>
 						</c:property-options>					
 					</c:simple-property>	
 					<c:simple-property name="url" type="string"
-						description="The Virtual Database URL" />
+						description="The Virtual Database URL" required="false"/>
 				</c:group>
-				<c:group name="sourceModels" displayName="Source Models"
+				<c:group name="Models" displayName="Models"
 					hiddenByDefault="false">
 					<c:list-property name="sourceModels" description="The source models for this VDB">
 						<c:map-property name="model">
 							<c:simple-property name="name" displayName="Name"
 								description="Name of the model" required="true" readOnly="true"/>
-							<c:simple-property name="sourceName" displayName="Connector Binding"
-								description="Connector binding for this model" required="false" readOnly="true"/>
-							<c:simple-property name="jndiName" displayName="JNDI Name"
+							<c:simple-property name="sourceName" displayName="Source Name"
+								description="Source name for this model" required="false" readOnly="true"/>
+							<c:simple-property name="jndiName" displayName="Connector Binding JNDI Name"
 								description="JNDI name for this connector binding" required="false"/>	
 							<c:simple-property name="visibility"
 								displayName="Visible" description="Visibility of the model"
@@ -304,13 +308,12 @@
 							</c:simple-property>
 						</c:map-property>
 					</c:list-property>
-				</c:group>
-				<c:group name="virtualModels" displayName="Logical Models"
-					hiddenByDefault="false">
-					<c:list-property name="virtualModels" description="The logical models for this VDB">
+					<c:list-property name="logicalModels" description="The logical models for this VDB">
 						<c:map-property name="model">
 							<c:simple-property name="name" displayName="Name"
 								description="Name of the model" required="true" />
+							<c:simple-property name="type" displayName="Type"
+								description="type of logical model" required="true" />
 							<c:simple-property name="visibility"
 								displayName="Visible" description="Visbility of the model"
 								required="true">
@@ -335,7 +338,8 @@
 					</c:list-property>
 				</c:group>
 			</resource-configuration>
-
+			
+		
 			<!--
 				<operation name="getProperties" displayName="View VDB properties"
 				description="List the properties of this VDB"> <results>



More information about the teiid-commits mailing list