[teiid-commits] teiid SVN: r1811 - 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
Wed Feb 10 10:17:59 EST 2010


Author: tejones
Date: 2010-02-10 10:17:58 -0500 (Wed, 10 Feb 2010)
New Revision: 1811

Added:
   trunk/console/src/main/java/org/teiid/rhq/plugin/util/DeploymentUtils.java
Modified:
   trunk/console/pom.xml
   trunk/console/src/main/java/org/teiid/rhq/plugin/Facet.java
   trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java
   trunk/console/src/main/java/org/teiid/rhq/plugin/VDBDiscoveryComponent.java
   trunk/console/src/main/java/org/teiid/rhq/plugin/util/ProfileServiceUtil.java
   trunk/console/src/resources/embedded/META-INF/rhq-plugin.xml
Log:
TEIID-807: Added VDB Deployment

Modified: trunk/console/pom.xml
===================================================================
--- trunk/console/pom.xml	2010-02-09 22:10:39 UTC (rev 1810)
+++ trunk/console/pom.xml	2010-02-10 15:17:58 UTC (rev 1811)
@@ -19,6 +19,7 @@
 			<org.jboss.jopr.as4.version>1.2.0.GA</org.jboss.jopr.as4.version>
 		-->
 		<org.jboss.jopr.as5.version>1.2.0.GA</org.jboss.jopr.as5.version>
+		<org.rhq.version>1.3.0.GA</org.rhq.version>
 
 		<org.jboss.jopr.version>1.2.0.GA</org.jboss.jopr.version>
 
@@ -211,7 +212,7 @@
 		<dependency>
 			<groupId>org.rhq</groupId>
 			<artifactId>rhq-core-domain</artifactId>
-			<version>${org.jboss.jopr.version}</version>
+			<version>${org.rhq.version}</version>
 			<scope>provided</scope>
 			<!--
 				provided by the agent/plugin-container
@@ -222,21 +223,21 @@
 		<dependency>
 			<groupId>org.rhq</groupId>
 			<artifactId>rhq-core-plugin-api</artifactId>
-			<version>${org.jboss.jopr.version}</version>
+			<version>${org.rhq.version}</version>
 			<scope>provided</scope> <!-- provided by the agent/plugin-container -->
 		</dependency>
 
 		<dependency>
 			<groupId>org.rhq</groupId>
 			<artifactId>rhq-core-native-system</artifactId>
-			<version>${org.jboss.jopr.version}</version>
+			<version>${org.rhq.version}</version>
 			<scope>provided</scope> <!-- provided by the agent/plugin-container -->
 		</dependency>
 
 		<dependency>
 			<groupId>org.rhq</groupId>
 			<artifactId>rhq-jmx-plugin</artifactId>
-			<version>${org.jboss.jopr.version}</version>
+			<version>${org.rhq.version}</version>
 		</dependency>
 
 		<dependency>
@@ -304,12 +305,13 @@
 			<artifactId>teiid-common-core</artifactId>
 			<type>test-jar</type>
 		</dependency>
+		<dependency>
+			<groupId>org.jboss.jopr</groupId>
+			<artifactId>jopr-embedded-jbas5</artifactId>
+			<type>war</type>
+			<version>${org.jboss.jopr.as5.version}</version>
+		</dependency>
 
-		<!--
-			<dependency> <groupId>org.jboss.jopr</groupId>
-			<artifactId>jopr-embedded-jbas4</artifactId> <type>war</type>
-			<version>${org.jboss.jopr.as4.version}</version> </dependency>
-		-->
 		<dependency>
 			<groupId>org.jboss.jopr</groupId>
 			<artifactId>jopr-embedded-jbas5</artifactId>
@@ -328,7 +330,17 @@
 			<artifactId>ant</artifactId>
 		</dependency>
 
+		<dependency>
+			<groupId>org.apache.commons</groupId>
+			<artifactId>commons-io</artifactId>
+			<version>1.3.2</version>
+		</dependency>
 
+		<dependency>
+			<groupId>org.jboss.on</groupId>
+			<artifactId>jopr-jboss-as-5-plugin</artifactId>
+			<version>2.3.0.EmbJopr.1.2.0-1</version>
+		</dependency>
 
 	</dependencies>
 

Modified: trunk/console/src/main/java/org/teiid/rhq/plugin/Facet.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/Facet.java	2010-02-09 22:10:39 UTC (rev 1810)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/Facet.java	2010-02-10 15:17:58 UTC (rev 1811)
@@ -21,17 +21,32 @@
  */
 package org.teiid.rhq.plugin;
 
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
 import java.io.InputStream;
+import java.io.OutputStream;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.commons.io.FileUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.jboss.deployers.spi.management.deploy.DeploymentManager;
+import org.jboss.deployers.spi.management.deploy.DeploymentProgress;
+import org.jboss.deployers.spi.management.deploy.DeploymentStatus;
 import org.rhq.core.domain.configuration.Configuration;
 import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
+import org.rhq.core.domain.content.PackageDetailsKey;
 import org.rhq.core.domain.content.PackageType;
+import org.rhq.core.domain.content.transfer.ContentResponseResult;
+import org.rhq.core.domain.content.transfer.DeployIndividualPackageResponse;
 import org.rhq.core.domain.content.transfer.DeployPackageStep;
 import org.rhq.core.domain.content.transfer.DeployPackagesResponse;
 import org.rhq.core.domain.content.transfer.RemovePackagesResponse;
@@ -39,10 +54,13 @@
 import org.rhq.core.domain.measurement.AvailabilityType;
 import org.rhq.core.domain.measurement.MeasurementReport;
 import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
+import org.rhq.core.domain.resource.CreateResourceStatus;
+import org.rhq.core.domain.resource.ResourceType;
 import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
 import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
 import org.rhq.core.pluginapi.content.ContentFacet;
 import org.rhq.core.pluginapi.content.ContentServices;
+import org.rhq.core.pluginapi.content.version.PackageVersions;
 import org.rhq.core.pluginapi.inventory.CreateChildResourceFacet;
 import org.rhq.core.pluginapi.inventory.CreateResourceReport;
 import org.rhq.core.pluginapi.inventory.DeleteResourceFacet;
@@ -52,36 +70,35 @@
 import org.rhq.core.pluginapi.measurement.MeasurementFacet;
 import org.rhq.core.pluginapi.operation.OperationFacet;
 import org.rhq.core.pluginapi.operation.OperationResult;
+import org.rhq.core.util.ZipUtil;
+import org.rhq.core.util.exception.ThrowableUtil;
 import org.teiid.rhq.admin.utils.SingletonConnectionManager;
-import org.teiid.rhq.comm.Component;
 import org.teiid.rhq.comm.Connection;
 import org.teiid.rhq.comm.ConnectionException;
 import org.teiid.rhq.comm.ExecutedResult;
-import org.teiid.rhq.comm.VMComponent;
 import org.teiid.rhq.plugin.objects.ExecutedOperationResultImpl;
+import org.teiid.rhq.plugin.util.DeploymentUtils;
+import org.teiid.rhq.plugin.util.ProfileServiceUtil;
 
-
 /**
  * This class implements required RHQ interfaces and provides common logic used
  * by all MetaMatrix components.
  */
-public abstract class Facet implements ResourceComponent,
-		MeasurementFacet, OperationFacet, ConfigurationFacet, ContentFacet,
-		DeleteResourceFacet, CreateChildResourceFacet {
+public abstract class Facet implements ResourceComponent, MeasurementFacet,
+		OperationFacet, ConfigurationFacet, ContentFacet, DeleteResourceFacet,
+		CreateChildResourceFacet {
 
 	protected static SingletonConnectionManager connMgr = SingletonConnectionManager
 			.getInstance();
 
-	protected final Log LOG = LogFactory
-			.getLog(Facet.class);
-	
+	protected final Log LOG = LogFactory.getLog(Facet.class);
+
 	/**
 	 * Represents the resource configuration of the custom product being
 	 * managed.
 	 */
 	protected Configuration resourceConfiguration;
 
-
 	/**
 	 * All AMPS plugins are stateful - this context contains information that
 	 * your resource component can use when performing its processing.
@@ -99,6 +116,40 @@
 
 	protected boolean isAvailable = false;
 
+	/**
+	 * Name of the backing package type that will be used when discovering
+	 * packages. This corresponds to the name of the package type defined in the
+	 * plugin descriptor.
+	 */
+	private static final String PKG_TYPE_FILE = "vdb";
+
+	/**
+	 * Architecture string used in describing discovered packages.
+	 */
+	private static final String ARCHITECTURE = "noarch";
+
+	private static final String BACKUP_FILE_EXTENSION = ".rej";
+
+	private final Log log = LogFactory.getLog(this.getClass());
+
+	private PackageVersions versions;
+
+	/**
+	 * The name of the ManagedDeployment (e.g.:
+	 * vfszip:/C:/opt/jboss-5.0.0.GA/server/default/deploy/foo.vdb).
+	 */
+	protected String deploymentName;
+
+	/**
+	 * The type of the ManagedDeployment.
+	 */
+	// protected KnownDeploymentTypes deploymentType;
+	/**
+	 * The absolute path of the deployment file (e.g.:
+	 * C:/opt/jboss-5.0.0.GA/server/default/deploy/foo.vdb).
+	 */
+	protected File deploymentFile;
+
 	abstract String getComponentType();
 
 	/**
@@ -122,7 +173,7 @@
 	public void stop() {
 		this.isAvailable = false;
 	}
-	
+
 	/**
 	 * @return the resourceConfiguration
 	 */
@@ -131,7 +182,8 @@
 	}
 
 	/**
-	 * @param resourceConfiguration the resourceConfiguration to set
+	 * @param resourceConfiguration
+	 *            the resourceConfiguration to set
 	 */
 	public void setResourceConfiguration(Configuration resourceConfiguration) {
 		this.resourceConfiguration = resourceConfiguration;
@@ -161,16 +213,16 @@
 		this.identifier = identifier;
 	}
 
-	protected void setOperationArguments(String name, Configuration configuration,
-			Map 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 setOperationArguments(String name,
+			Configuration configuration, Map 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) {
+	protected void execute(final ExecutedResult result, final Map valueMap) {
 		Connection conn = null;
 		try {
 			conn = getConnection();
@@ -210,15 +262,15 @@
 	}
 
 	/*
-	 * (non-Javadoc)
-	 * This method is called by JON to check the availability of the inventoried component on a time scheduled basis
+	 * (non-Javadoc) This method is called by JON to check the availability of
+	 * the inventoried component on a time scheduled basis
 	 * 
 	 * @see org.rhq.core.pluginapi.inventory.ResourceComponent#getAvailability()
 	 */
 	public AvailabilityType getAvailability() {
 
 		LOG.debug("Checking availability of  " + identifier); //$NON-NLS-1$
-		
+
 		return AvailabilityType.UP;
 	}
 
@@ -259,16 +311,13 @@
 		Set operationDefinitionSet = this.resourceContext.getResourceType()
 				.getOperationDefinitions();
 
+		ExecutedResult result = new ExecutedOperationResultImpl(this
+				.getComponentType(), name, operationDefinitionSet);
 
-		ExecutedResult result = new ExecutedOperationResultImpl(
-				this.getComponentType(),
-				name, 
-				operationDefinitionSet);
-			
 		setOperationArguments(name, configuration, valueMap);
-		
+
 		execute(result, valueMap);
-		
+
 		return ((ExecutedOperationResultImpl) result).getOperationResult();
 
 	}
@@ -290,9 +339,10 @@
 			// start with.
 			// note that it is empty, so we're assuming there are no required
 			// configs in the plugin descriptor.
-			resourceConfiguration = this.resourceContext.getPluginConfiguration();
+			resourceConfiguration = this.resourceContext
+					.getPluginConfiguration();
 		}
-		
+
 		Configuration config = resourceConfiguration;
 
 		return config;
@@ -314,81 +364,400 @@
 		report.setStatus(ConfigurationUpdateStatus.SUCCESS);
 	}
 
-	/**
-	 * When this is called, the plugin is responsible for scanning its managed
-	 * resource and look for content that need to be managed for that resource.
-	 * This method should only discover packages of the given package type.
-	 * 
-	 * @see ContentFacet#discoverDeployedPackages(PackageType)
-	 */
-	public Set<ResourcePackageDetails> discoverDeployedPackages(PackageType type) {
-		return null;
+	@Override
+	public void deleteResource() throws Exception {
+		// TODO Auto-generated method stub
+
 	}
 
-	/**
-	 * The plugin container calls this method when new packages need to be
-	 * deployed/installed on resources.
-	 * 
-	 * @see ContentFacet#deployPackages(Set, ContentServices)
-	 */
+	@Override
 	public DeployPackagesResponse deployPackages(
 			Set<ResourcePackageDetails> packages,
 			ContentServices contentServices) {
-		return null;
+		String resourceTypeName = this.resourceContext.getResourceType()
+				.getName();
+
+		// You can only update the one application file referenced by this
+		// resource, so punch out if multiple are
+		// specified.
+		if (packages.size() != 1) {
+			log.warn("Request to update " + resourceTypeName
+					+ " file contained multiple packages: " + packages);
+			DeployPackagesResponse response = new DeployPackagesResponse(
+					ContentResponseResult.FAILURE);
+			response.setOverallRequestErrorMessage("Only one "
+					+ resourceTypeName + " can be updated at a time.");
+			return response;
+		}
+
+		ResourcePackageDetails packageDetails = packages.iterator().next();
+
+		log.debug("Updating VDB file '" + this.deploymentFile + "' using ["
+				+ packageDetails + "]...");
+		// Find location of existing application.
+		if (!this.deploymentFile.exists()) {
+			return failApplicationDeployment(
+					"Could not find application to update at location: "
+							+ this.deploymentFile, packageDetails);
+		}
+
+		log.debug("Writing new EAR/WAR bits to temporary file...");
+		File tempFile;
+		try {
+			tempFile = writeNewAppBitsToTempFile(contentServices,
+					packageDetails);
+		} catch (Exception e) {
+			return failApplicationDeployment(
+					"Error writing new application bits to temporary file - cause: "
+							+ e, packageDetails);
+		}
+		log.debug("Wrote new EAR/WAR bits to temporary file '" + tempFile
+				+ "'.");
+
+		boolean deployExploded = this.deploymentFile.isDirectory();
+
+		// Backup the original app file/dir.
+		File tempDir = resourceContext.getTemporaryDirectory();
+		File backupDir = new File(tempDir, "deployBackup");
+		File backupOfOriginalFile = new File(backupDir, this.deploymentFile
+				.getName());
+		log.debug("Backing up existing EAR/WAR '" + this.deploymentFile
+				+ "' to '" + backupOfOriginalFile + "'...");
+		try {
+			if (backupOfOriginalFile.exists()) {
+				FileUtils.forceDelete(backupOfOriginalFile);
+			}
+			if (this.deploymentFile.isDirectory()) {
+				FileUtils.copyDirectory(this.deploymentFile,
+						backupOfOriginalFile, true);
+			} else {
+				FileUtils.copyFile(this.deploymentFile, backupOfOriginalFile,
+						true);
+			}
+		} catch (Exception e) {
+			throw new RuntimeException("Failed to backup existing "
+					+ resourceTypeName + "'" + this.deploymentFile + "' to '"
+					+ backupOfOriginalFile + "'.");
+		}
+
+		// Now stop the original app.
+		try {
+			DeploymentManager deploymentManager = ProfileServiceUtil
+					.getDeploymentManager();
+			DeploymentProgress progress = deploymentManager
+					.stop(this.deploymentName);
+			DeploymentUtils.run(progress);
+		} catch (Exception e) {
+			throw new RuntimeException("Failed to stop deployment ["
+					+ this.deploymentName + "].", e);
+		}
+
+		// And then remove it (this will delete the physical file/dir from the
+		// deploy dir).
+		try {
+			DeploymentManager deploymentManager = ProfileServiceUtil
+					.getDeploymentManager();
+			DeploymentProgress progress = deploymentManager
+					.remove(this.deploymentName);
+			DeploymentUtils.run(progress);
+		} catch (Exception e) {
+			throw new RuntimeException("Failed to remove deployment ["
+					+ this.deploymentName + "].", e);
+		}
+
+		// Deploy away!
+		log.debug("Deploying '" + tempFile + "'...");
+		DeploymentManager deploymentManager = null;
+		try {
+			deploymentManager = ProfileServiceUtil.getDeploymentManager();
+			DeploymentUtils.deployArchive(deploymentManager, tempFile,
+					deployExploded);
+		} catch (Exception e) {
+			// Deploy failed - rollback to the original app file...
+			log.debug("Redeploy failed - rolling back to original archive...",
+					e);
+			String errorMessage = ThrowableUtil.getAllMessages(e);
+			try {
+				// Try to delete the new app file, which failed to deploy, if it
+				// still exists.
+				if (this.deploymentFile.exists()) {
+					try {
+						FileUtils.forceDelete(this.deploymentFile);
+					} catch (IOException e1) {
+						log.debug("Failed to delete application file '"
+								+ this.deploymentFile
+								+ "' that failed to deploy.", e1);
+					}
+				}
+				// Now redeploy the original file - this generally should
+				// succeed.
+				DeploymentUtils.deployArchive(deploymentManager,
+						backupOfOriginalFile, deployExploded);
+				errorMessage += " ***** ROLLED BACK TO ORIGINAL APPLICATION FILE. *****";
+			} catch (Exception e1) {
+				log.debug("Rollback failed!", e1);
+				errorMessage += " ***** FAILED TO ROLLBACK TO ORIGINAL APPLICATION FILE. *****: "
+						+ ThrowableUtil.getAllMessages(e1);
+			}
+			log
+					.info("Failed to update " + resourceTypeName + " file '"
+							+ this.deploymentFile + "' using ["
+							+ packageDetails + "].");
+			return failApplicationDeployment(errorMessage, packageDetails);
+		}
+
+		// Deploy was successful!
+		deleteBackupOfOriginalFile(backupOfOriginalFile);
+		persistApplicationVersion(packageDetails, this.deploymentFile);
+
+		DeployPackagesResponse response = new DeployPackagesResponse(
+				ContentResponseResult.SUCCESS);
+		DeployIndividualPackageResponse packageResponse = new DeployIndividualPackageResponse(
+				packageDetails.getKey(), ContentResponseResult.SUCCESS);
+		response.addPackageResponse(packageResponse);
+
+		log.debug("Updated " + resourceTypeName + " file '"
+				+ this.deploymentFile + "' successfully - returning response ["
+				+ response + "]...");
+
+		return response;
 	}
 
-	/**
-	 * When a remote client wants to see the actual data content for an
-	 * installed package, this method will be called. This method must return a
-	 * stream of data containing the full content of the package.
-	 * 
-	 * @see ContentFacet#retrievePackageBits(ResourcePackageDetails)
-	 */
-	public InputStream retrievePackageBits(ResourcePackageDetails packageDetails) {
-		return null;
+	@Override
+	public Set<ResourcePackageDetails> discoverDeployedPackages(PackageType arg0) {
+		if (!this.deploymentFile.exists())
+			throw new IllegalStateException("Deployment file '"
+					+ this.deploymentFile + "' for " + "VDB Archive"
+					+ " does not exist.");
+
+		String fileName = this.deploymentFile.getName();
+		PackageVersions packageVersions = loadPackageVersions();
+		String version = packageVersions.getVersion(fileName);
+		if (version == null) {
+			// This is either the first time we've discovered this VDB, or
+			// someone purged the PC's data dir.
+			version = "1.0";
+			packageVersions.putVersion(fileName, version);
+			packageVersions.saveToDisk();
+		}
+
+		// Package name is the deployment's file name (e.g. foo.ear).
+		PackageDetailsKey key = new PackageDetailsKey(fileName, version,
+				PKG_TYPE_FILE, ARCHITECTURE);
+		ResourcePackageDetails packageDetails = new ResourcePackageDetails(key);
+		packageDetails.setFileName(fileName);
+		packageDetails.setLocation(this.deploymentFile.getPath());
+		if (!this.deploymentFile.isDirectory())
+			packageDetails.setFileSize(this.deploymentFile.length());
+		packageDetails.setFileCreatedDate(null); // TODO: get created date via
+		// SIGAR
+		Set<ResourcePackageDetails> packages = new HashSet<ResourcePackageDetails>();
+		packages.add(packageDetails);
+
+		return packages;
 	}
 
-	/**
-	 * This is the method that is used when the component has to create the
-	 * installation steps and their results.
-	 * 
-	 * @see ContentFacet#generateInstallationSteps(ResourcePackageDetails)
-	 */
+	@Override
 	public List<DeployPackageStep> generateInstallationSteps(
-			ResourcePackageDetails packageDetails) {
+			ResourcePackageDetails arg0) {
 		return null;
 	}
 
+	public RemovePackagesResponse removePackages(
+			Set<ResourcePackageDetails> packages) {
+		throw new UnsupportedOperationException(
+				"Cannot remove the package backing an VDB resource.");
+	}
+
+	@Override
+	public InputStream retrievePackageBits(ResourcePackageDetails packageDetails) {
+		File packageFile = new File(packageDetails.getName());
+		File fileToSend;
+		try {
+			if (packageFile.isDirectory()) {
+				fileToSend = File.createTempFile("rhq", ".zip");
+				ZipUtil.zipFileOrDirectory(packageFile, fileToSend);
+			} else
+				fileToSend = packageFile;
+			return new BufferedInputStream(new FileInputStream(fileToSend));
+		} catch (IOException e) {
+			throw new RuntimeException("Failed to retrieve package bits for "
+					+ packageDetails, e);
+		}
+	}
+
 	/**
-	 * This is called when the actual content of packages should be deleted from
-	 * the managed resource.
+	 * Returns an instantiated and loaded versions store access point.
 	 * 
-	 * @see ContentFacet#removePackages(Set)
+	 * @return will not be <code>null</code>
 	 */
-	public RemovePackagesResponse removePackages(
-			Set<ResourcePackageDetails> packages) {
-		return null;
+	private PackageVersions loadPackageVersions() {
+		if (this.versions == null) {
+			ResourceType resourceType = this.resourceContext.getResourceType();
+			String pluginName = resourceType.getPlugin();
+			File dataDirectoryFile = this.resourceContext.getDataDirectory();
+			dataDirectoryFile.mkdirs();
+			String dataDirectory = dataDirectoryFile.getAbsolutePath();
+			log.trace("Creating application versions store with plugin name ["
+					+ pluginName + "] and data directory [" + dataDirectory
+					+ "]");
+			this.versions = new PackageVersions(pluginName, dataDirectory);
+			this.versions.loadFromDisk();
+		}
+
+		return this.versions;
 	}
 
 	/**
-	 * When called, the plugin container is asking the plugin to create a new
-	 * managed resource. The new resource's details need to be added to the
-	 * given report.
+	 * Creates the necessary transfer objects to report a failed application
+	 * deployment (update).
 	 * 
-	 * @see CreateChildResourceFacet#createResource(CreateResourceReport)
+	 * @param errorMessage
+	 *            reason the deploy failed
+	 * @param packageDetails
+	 *            describes the update being made
+	 * 
+	 * @return response populated to reflect a failure
 	 */
-	public CreateResourceReport createResource(CreateResourceReport report) {
-		return null;
+	private DeployPackagesResponse failApplicationDeployment(
+			String errorMessage, ResourcePackageDetails packageDetails) {
+		DeployPackagesResponse response = new DeployPackagesResponse(
+				ContentResponseResult.FAILURE);
+
+		DeployIndividualPackageResponse packageResponse = new DeployIndividualPackageResponse(
+				packageDetails.getKey(), ContentResponseResult.FAILURE);
+		packageResponse.setErrorMessage(errorMessage);
+
+		response.addPackageResponse(packageResponse);
+
+		return response;
 	}
 
+	private File writeNewAppBitsToTempFile(ContentServices contentServices,
+			ResourcePackageDetails packageDetails) throws Exception {
+		File tempDir = resourceContext.getTemporaryDirectory();
+		File tempFile = new File(tempDir, this.deploymentFile.getName());
+
+		OutputStream tempOutputStream = null;
+		try {
+			tempOutputStream = new BufferedOutputStream(new FileOutputStream(
+					tempFile));
+			long bytesWritten = contentServices.downloadPackageBits(
+					resourceContext.getContentContext(), packageDetails
+							.getKey(), tempOutputStream, true);
+			log
+					.debug("Wrote " + bytesWritten + " bytes to '" + tempFile
+							+ "'.");
+		} catch (IOException e) {
+			log.error(
+					"Error writing updated application bits to temporary location: "
+							+ tempFile, e);
+			throw e;
+		} finally {
+			if (tempOutputStream != null) {
+				try {
+					tempOutputStream.close();
+				} catch (IOException e) {
+					log.error("Error closing temporary output stream", e);
+				}
+			}
+		}
+		if (!tempFile.exists()) {
+			log.error("Temporary file for application update not written to: "
+					+ tempFile);
+			throw new Exception();
+		}
+		return tempFile;
+	}
+
+	private void persistApplicationVersion(
+			ResourcePackageDetails packageDetails, File appFile) {
+		String packageName = appFile.getName();
+		PackageVersions versions = loadApplicationVersions();
+		versions.putVersion(packageName, packageDetails.getVersion());
+	}
+
+	private void deleteBackupOfOriginalFile(File backupOfOriginalFile) {
+		try {
+			FileUtils.forceDelete(backupOfOriginalFile);
+		} catch (Exception e) {
+			// not critical.
+			log.warn("Failed to delete backup of original file: "
+					+ backupOfOriginalFile);
+		}
+	}
+
 	/**
-	 * When called, the plugin container is asking the plugin to delete a
-	 * managed resource.
+	 * Returns an instantiated and loaded versions store access point.
 	 * 
-	 * @see DeleteResourceFacet#deleteResource()
+	 * @return will not be <code>null</code>
 	 */
-	public void deleteResource() {
+	private PackageVersions loadApplicationVersions() {
+		if (versions == null) {
+			ResourceType resourceType = resourceContext.getResourceType();
+			String pluginName = resourceType.getPlugin();
+
+			File dataDirectoryFile = resourceContext.getDataDirectory();
+
+			if (!dataDirectoryFile.exists()) {
+				dataDirectoryFile.mkdir();
+			}
+
+			String dataDirectory = dataDirectoryFile.getAbsolutePath();
+
+			log.debug("Creating application versions store with plugin name ["
+					+ pluginName + "] and data directory [" + dataDirectory
+					+ "]");
+
+			versions = new PackageVersions(pluginName, dataDirectory);
+			versions.loadFromDisk();
+		}
+
+		return versions;
 	}
-	
-	
+
+	@Override
+	public CreateResourceReport createResource(CreateResourceReport createResourceReport) {
+		ResourcePackageDetails details = createResourceReport
+				.getPackageDetails();
+		PackageDetailsKey key = details.getKey();
+		// This is the full path to a temporary file which was written by the UI
+		// layer.
+		String archivePath = key.getName();
+
+		try {
+			File archiveFile = new File(archivePath);
+
+			if (!DeploymentUtils.hasCorrectExtension(archiveFile.getName(), resourceContext.getResourceType())) {
+				createResourceReport.setStatus(CreateResourceStatus.FAILURE);
+				createResourceReport
+						.setErrorMessage("Incorrect extension specified on filename ["
+								+ archivePath + "]");
+				return createResourceReport;
+			}
+
+			Configuration deployTimeConfig = details
+					.getDeploymentTimeConfiguration();
+			@SuppressWarnings( { "ConstantConditions" })
+		//	boolean deployExploded = deployTimeConfig.getSimple(
+		//			"deployExploded").getBooleanValue();
+
+			DeploymentManager deploymentManager = ProfileServiceUtil.getDeploymentManager();
+			DeploymentUtils.deployArchive(deploymentManager, archiveFile, false);
+
+			createResourceReport.setResourceName(archivePath);
+			createResourceReport.setResourceKey(archivePath);
+			createResourceReport.setStatus(CreateResourceStatus.SUCCESS);
+			
+		} catch (Throwable t) {
+			log.error("Error deploying application for report: "
+					+ createResourceReport, t);
+			createResourceReport.setStatus(CreateResourceStatus.FAILURE);
+			createResourceReport.setException(t);
+		}
+		
+		return createResourceReport;
+		
+	}
+
 }

Modified: trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java	2010-02-09 22:10:39 UTC (rev 1810)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/PlatformComponent.java	2010-02-10 15:17:58 UTC (rev 1811)
@@ -27,8 +27,13 @@
 import java.util.Properties;
 import java.util.Set;
 
+import javax.naming.NamingException;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.jboss.managed.api.ComponentType;
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.RunState;
 import org.rhq.core.domain.configuration.Configuration;
 import org.rhq.core.domain.configuration.PropertySimple;
 import org.rhq.core.domain.measurement.AvailabilityType;
@@ -36,11 +41,17 @@
 import org.rhq.core.domain.measurement.MeasurementReport;
 import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
 import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
-import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
 import org.teiid.rhq.admin.utils.SingletonConnectionManager;
 import org.teiid.rhq.comm.Connection;
 import org.teiid.rhq.comm.ConnectionConstants;
-import org.teiid.rhq.comm.ConnectionConstants.ComponentType;
+//import org.teiid.rhq.comm.ConnectionConstants;
+//import org.teiid.rhq.comm.Connection;
+//import org.teiid.rhq.comm.ConnectionConstants;
+//import org.teiid.rhq.comm.ConnectionConstants.ComponentType.Runtime.System.Metrics;
+import org.teiid.rhq.plugin.util.PluginConstants;
+import org.teiid.rhq.plugin.util.ProfileServiceUtil;
+import org.teiid.rhq.plugin.util.PluginConstants.Operation;
+import org.teiid.rhq.plugin.util.PluginConstants.ComponentType.Runtime.Metrics;
 
 
 /**
@@ -60,12 +71,27 @@
 	
 	@Override
 	public AvailabilityType getAvailability() {
+		RunState runState = null;
+		ManagedComponent mc;
+		try {
+			mc = ProfileServiceUtil.getManagedComponent(
+					new ComponentType(PluginConstants.ComponentType.Runtime.TYPE,
+							PluginConstants.ComponentType.Runtime.SUBTYPE),
+					PluginConstants.ComponentType.Runtime.TEIID_RUNTIME_ENGINE);
+			runState = mc.getRunState();
+		} catch (NamingException e) {
+			LOG.error("Naming exception getting: " + PluginConstants.ComponentType.Runtime.TEIID_RUNTIME_ENGINE);
+	        return AvailabilityType.DOWN;
+		} catch (Exception e) {
+			LOG.error("Exception getting: " + PluginConstants.ComponentType.Runtime.TEIID_RUNTIME_ENGINE);
+			return AvailabilityType.DOWN;
+		}
+		
+		return (runState == RunState.RUNNING) ? AvailabilityType.UP : AvailabilityType.DOWN;
+		
+	}
 
-		return AvailabilityType.UP;
-	}
 	
-	
-	
 	protected void setOperationArguments(String name, Configuration configuration,
 			Map valueMap) {
  		

Modified: trunk/console/src/main/java/org/teiid/rhq/plugin/VDBDiscoveryComponent.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/VDBDiscoveryComponent.java	2010-02-09 22:10:39 UTC (rev 1810)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/VDBDiscoveryComponent.java	2010-02-10 15:17:58 UTC (rev 1811)
@@ -26,8 +26,10 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.jboss.deployers.spi.management.ManagementView;
 import org.jboss.managed.api.ComponentType;
 import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.ManagedDeployment;
 import org.jboss.managed.api.ManagedProperty;
 import org.jboss.managed.plugins.ManagedObjectImpl;
 import org.jboss.metatype.api.values.CollectionValueSupport;
@@ -67,13 +69,27 @@
 
 			String vdbName = ((SimpleValueSupport) mcVdb.getProperty("name")
 					.getValue()).getValue().toString();
-			String vdbVersion = ((SimpleValueSupport) mcVdb.getProperty("version")
-					.getValue()).getValue().toString();
-			//TODO: Correct this after deploying proper VDB/Metadata
+//			ManagementView managementView = ProfileServiceUtil
+//			.getManagementView(ProfileServiceUtil.getProfileService(),
+//					false);
+			//ManagedDeployment managedDeployment = managementView.getDeploymentNamesForType(arg0)(vdbName);
+			//Set deploymentNames = null;
+			
+//			try
+//	        {
+//	            deploymentNames = managementView.getDeploymentNames();
+//	        }
+//	        catch (Exception e)
+//	        {
+//	            log.error("Unable to get deployment for type " , e);
+//	        }
+			String vdbVersion = ((SimpleValueSupport) mcVdb.getProperty(
+					"version").getValue()).getValue().toString();
+			// TODO: Correct this after deploying proper VDB/Metadata
 			String vdbDescription = "description"; // mcVdb.getProperty("description");
 			String vdbStatus = "active"; // mcVdb.getProperty("status");
 			String vdbURL = "url"; // mcVdb.getProperty("url");
-			
+
 			/**
 			 * 
 			 * A discovered resource must have a unique key, that must stay the
@@ -85,23 +101,25 @@
 					vdbName, // Resource Name
 					vdbVersion, // Version
 					PluginConstants.ComponentType.VDB.DESCRIPTION, // Description
-					discoveryContext.getDefaultPluginConfiguration(), // Plugin Config
+					discoveryContext.getDefaultPluginConfiguration(), // Plugin
+																		// Config
 					null // Process info from a process scan
 			);
-			
-			//Get plugin config map for models
+
+			// Get plugin config map for models
 			Configuration configuration = detail.getPluginConfiguration();
 
 			configuration.put(new PropertySimple("name", vdbName));
 			configuration.put(new PropertySimple("version", vdbVersion));
-			configuration.put(new PropertySimple("description", vdbDescription));
+			configuration
+					.put(new PropertySimple("description", vdbDescription));
 			configuration.put(new PropertySimple("status", vdbStatus));
-			configuration.put(new PropertySimple("url", vdbURL));			
-			
+			configuration.put(new PropertySimple("url", vdbURL));
+
 			getModels(mcVdb, configuration);
 
 			detail.setPluginConfiguration(configuration);
-			
+
 			// Add to return values
 			discoveredResources.add(detail);
 			log.info("Discovered Teiid VDB: " + vdbName);
@@ -115,28 +133,33 @@
 	 * @param configuration
 	 */
 	private void getModels(ManagedComponent mcVdb, Configuration configuration) {
-		//Get models from VDB
+		// Get models from VDB
 		ManagedProperty property = mcVdb.getProperty("models");
-		CollectionValueSupport valueSupport = (CollectionValueSupport) property.getValue();
+		CollectionValueSupport valueSupport = (CollectionValueSupport) property
+				.getValue();
 		MetaValue[] metaValues = valueSupport.getElements();
- 
+
 		PropertyList modelsList = new PropertyList("models");
 		configuration.put(modelsList);
-				
+
 		for (MetaValue value : metaValues) {
 			GenericValueSupport genValueSupport = (GenericValueSupport) value;
-			ManagedObjectImpl managedObject = (ManagedObjectImpl)genValueSupport.getValue();
+			ManagedObjectImpl managedObject = (ManagedObjectImpl) genValueSupport
+					.getValue();
 			String modelName = managedObject.getName();
-			String type = ((SimpleValueSupport) managedObject.getProperty("modelType").getValue()).getValue().toString();
-			String visibility = ((SimpleValueSupport) managedObject.getProperty("visible").getValue()).getValue().toString();
-			String path = ((SimpleValueSupport) managedObject.getProperty("path").getValue()).getValue().toString();
-			
-			PropertyMap model = new PropertyMap("model", new PropertySimple("name", modelName),
-					new PropertySimple("type", type), new PropertySimple("path", path), 
-					new PropertySimple("visibility", visibility));
+			String type = ((SimpleValueSupport) managedObject.getProperty(
+					"modelType").getValue()).getValue().toString();
+			String visibility = ((SimpleValueSupport) managedObject
+					.getProperty("visible").getValue()).getValue().toString();
+			String path = ((SimpleValueSupport) managedObject.getProperty(
+					"path").getValue()).getValue().toString();
+
+			PropertyMap model = new PropertyMap("model", new PropertySimple(
+					"name", modelName), new PropertySimple("type", type),
+					new PropertySimple("path", path), new PropertySimple(
+							"visibility", visibility));
 			modelsList.add(model);
 		}
-	}	
-	
+	}
 
 }

Added: trunk/console/src/main/java/org/teiid/rhq/plugin/util/DeploymentUtils.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/util/DeploymentUtils.java	                        (rev 0)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/util/DeploymentUtils.java	2010-02-10 15:17:58 UTC (rev 1811)
@@ -0,0 +1,148 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+package org.teiid.rhq.plugin.util;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Arrays;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.deployers.spi.management.deploy.DeploymentManager;
+import org.jboss.deployers.spi.management.deploy.DeploymentProgress;
+import org.jboss.deployers.spi.management.deploy.DeploymentStatus;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.util.exception.ThrowableUtil;
+import org.rhq.plugins.jbossas5.util.ResourceTypeUtils;
+
+/**
+ * A set of utility methods for deploying applications.
+ *
+ */
+public class DeploymentUtils {
+    private static final Log LOG = LogFactory.getLog(DeploymentUtils.class);
+
+    public static boolean hasCorrectExtension(String archiveFileName, ResourceType resourceType) {
+        Configuration defaultPluginConfig = ResourceTypeUtils.getDefaultPluginConfiguration(resourceType);
+        String expectedExtension = "vdb";
+        int lastPeriod = archiveFileName.lastIndexOf(".");
+        String extension = (lastPeriod != -1) ? archiveFileName.substring(lastPeriod + 1) : null;
+        // Use File.equals() to compare the extensions so case-sensitivity is correct for this platform.
+        return (extension != null && new File(extension).equals(new File(expectedExtension)));
+    }
+
+    /**
+     * Deploys (i.e. distributes then starts) the specified archive file.
+     *
+     * @param deploymentManager
+     * @param archiveFile
+     * @param deployExploded
+     * 
+     * @return
+     *
+     * @throws Exception if the deployment fails for any reason
+     */
+    public static void deployArchive(DeploymentManager deploymentManager, File archiveFile, boolean deployExploded)
+        throws Exception {
+        String archiveFileName = archiveFile.getName();
+        LOG.debug("Deploying '" + archiveFileName + "' (deployExploded=" + deployExploded + ")...");
+        URL contentURL;
+        try {
+            contentURL = archiveFile.toURI().toURL();
+        }
+        catch (MalformedURLException e) {
+            throw new IllegalArgumentException("Failed to convert archive file path '" + archiveFile + "' to URL.", e);
+        }
+        
+        DeploymentProgress progress = null;
+        DeploymentStatus distributeStatus;
+        Exception distributeFailure = null;
+        try {
+            progress = deploymentManager.distribute(archiveFileName, contentURL, false);
+            distributeStatus = run(progress);
+            if (distributeStatus.isFailed()) {
+                distributeFailure = (distributeStatus.getFailure() != null) ? distributeStatus.getFailure() :
+                        new Exception("Distribute failed for unknown reason.");
+            }
+        }
+        catch (Exception e) {
+            distributeFailure = e;
+        }
+        if (distributeFailure != null) {
+            throw new Exception("Failed to distribute '" + contentURL + "' to '" + archiveFileName + "' - cause: "
+                    + ThrowableUtil.getAllMessages(distributeFailure));
+        }
+
+        // Now that we've successfully distributed the deployment, we need to start it.
+        String[] deploymentNames = progress.getDeploymentID().getRepositoryNames();
+        DeploymentStatus startStatus;
+        Exception startFailure = null;
+        try {
+            progress = deploymentManager.start(deploymentNames);
+            startStatus = run(progress);
+            if (startStatus.isFailed()) {
+                startFailure = (startStatus.getFailure() != null) ? startStatus.getFailure() :
+                        new Exception("Start failed for unknown reason.");
+            }
+        }
+        catch (Exception e) {
+            startFailure = e;
+        }
+        if (startFailure != null) {
+            LOG.error("Failed to start deployment " + Arrays.asList(deploymentNames)
+                + " during deployment of '" + archiveFileName + "'. Backing out the deployment...", startFailure);
+            // If start failed, the app is invalid, so back out the deployment.
+            DeploymentStatus removeStatus;
+            Exception removeFailure = null;
+            try {
+                progress = deploymentManager.remove(deploymentNames);
+                removeStatus = run(progress);
+                if (removeStatus.isFailed()) {
+                    removeFailure = (removeStatus.getFailure() != null) ? removeStatus.getFailure() :
+                        new Exception("Remove failed for unknown reason.");
+                }
+            }
+            catch (Exception e) {
+                removeFailure = e;
+            }
+            if (removeFailure != null) {
+                LOG.error("Failed to remove deployment " + Arrays.asList(deploymentNames)
+                    + " after start failure.", removeFailure);
+            }
+            throw new Exception("Failed to start deployment " + Arrays.asList(deploymentNames)
+                + " during deployment of '" + archiveFileName + "' - cause: " +
+                    ThrowableUtil.getAllMessages(startFailure));
+        }
+        // If we made it this far, the deployment (distribution+start) was successful.
+        return;
+    }
+
+    public static DeploymentStatus run(DeploymentProgress progress) {
+        progress.run();
+        return progress.getDeploymentStatus();
+    }
+
+    private DeploymentUtils() {
+    }
+}

Modified: trunk/console/src/main/java/org/teiid/rhq/plugin/util/ProfileServiceUtil.java
===================================================================
--- trunk/console/src/main/java/org/teiid/rhq/plugin/util/ProfileServiceUtil.java	2010-02-09 22:10:39 UTC (rev 1810)
+++ trunk/console/src/main/java/org/teiid/rhq/plugin/util/ProfileServiceUtil.java	2010-02-10 15:17:58 UTC (rev 1811)
@@ -1,17 +1,27 @@
 package org.teiid.rhq.plugin.util;
 
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
 import java.util.Set;
 
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.deployers.spi.management.KnownDeploymentTypes;
 import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.deployers.spi.management.deploy.DeploymentManager;
 import org.jboss.managed.api.ComponentType;
 import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.ManagedDeployment;
 import org.jboss.profileservice.spi.ProfileService;
 
 public class ProfileServiceUtil {
 
+	protected final Log LOG = LogFactory.getLog(ProfileServiceUtil.class);
+
 	/**
 	 * Get the passed in {@link ManagedComponent}
 	 * 
@@ -23,7 +33,7 @@
 			ComponentType componentType, String componentName)
 			throws NamingException, Exception {
 		ProfileService ps = getProfileService();
-		ManagementView mv = getManagementView(ps);
+		ManagementView mv = getManagementView(ps, true);
 
 		ManagedComponent mc = mv.getComponent(componentName, componentType);
 		return mc;
@@ -34,13 +44,13 @@
 	 * type.
 	 * 
 	 * @return Set of {@link ManagedComponent}s
-	 * @throws NamingException
+	 * @throws NamingException, Exception
 	 * @throws Exception
 	 */
 	public static Set<ManagedComponent> getManagedComponents(
 			ComponentType componentType) throws NamingException, Exception {
 		ProfileService ps = getProfileService();
-		ManagementView mv = getManagementView(ps);
+		ManagementView mv = getManagementView(ps, true);
 
 		Set<ManagedComponent> mcSet = mv.getComponentsForType(componentType);
 
@@ -51,21 +61,75 @@
 	 * @param {@link ManagementView}
 	 * @return
 	 */
-	private static ManagementView getManagementView(ProfileService ps) {
+	public static ManagementView getManagementView(ProfileService ps, boolean load) {
 		ManagementView mv = ps.getViewManager();
-		mv.load();
+		if (load) {
+			mv.load();
+		}
 		return mv;
 	}
 
 	/**
-	 * @return {@link ProfileService}
+	 * Get the {@link DeploymentManager} from the ProfileService
+	 * 
+	 * @return DeploymentManager
 	 * @throws NamingException
+	 * @throws Exception
 	 */
-	private static ProfileService getProfileService() throws NamingException {
+	public static DeploymentManager getDeploymentManager()
+			throws NamingException, Exception {
+		ProfileService ps = getProfileService();
+		DeploymentManager deploymentManager = ps.getDeploymentManager();
+
+		return deploymentManager;
+	}
+
+	/**
+	 * @return {@link ProfileService}
+	 * @throws NamingException, Exception
+	 */
+	public static ProfileService getProfileService() throws NamingException {
 		InitialContext ic = new InitialContext();
 		ProfileService ps = (ProfileService) ic
 				.lookup(PluginConstants.PROFILE_SERVICE);
 		return ps;
 	}
 
+	/**
+	 * @return {@link File}
+	 * @throws NamingException, Exception
+	 */
+	public static File getDeployDirectory() throws NamingException, Exception {
+		ProfileService ps = getProfileService();
+		ManagementView mv = getManagementView(ps, false);
+		Set<ManagedDeployment> warDeployments;
+		try {
+			warDeployments = mv
+					.getDeploymentsForType(KnownDeploymentTypes.JavaEEWebApplication
+							.getType());
+		} catch (Exception e) {
+			throw new IllegalStateException(e);
+		}
+		ManagedDeployment standaloneWarDeployment = null;
+		for (ManagedDeployment warDeployment : warDeployments) {
+			if (warDeployment.getParent() == null) {
+				standaloneWarDeployment = warDeployment;
+				break;
+			}
+		}
+		if (standaloneWarDeployment == null)
+			// This could happen if no standalone WARs, including the admin
+			// console WAR, have been fully deployed yet.
+			return null;
+		URL warUrl;
+		try {
+			warUrl = new URL(standaloneWarDeployment.getName());
+		} catch (MalformedURLException e) {
+			throw new IllegalStateException(e);
+		}
+		File warFile = new File(warUrl.getPath());
+		File deployDir = warFile.getParentFile();
+		return deployDir;
+	}
+
 }

Modified: trunk/console/src/resources/embedded/META-INF/rhq-plugin.xml
===================================================================
--- trunk/console/src/resources/embedded/META-INF/rhq-plugin.xml	2010-02-09 22:10:39 UTC (rev 1810)
+++ trunk/console/src/resources/embedded/META-INF/rhq-plugin.xml	2010-02-10 15:17:58 UTC (rev 1811)
@@ -26,21 +26,52 @@
 	<depends plugin="JMX" />
 	<depends plugin="JBossAS5" useClasses="true" />
 
-
 	<server name="Data Services" description="JBoss Enterprise Data Services"
-		class="PlatformComponent" discovery="PlatformDiscoveryComponent"
-		createDeletePolicy="both">
+		class="PlatformComponent" discovery="PlatformDiscoveryComponent">
 
-
 		<runs-inside>
 			<parent-resource-type name="JBossAS Server"
 				plugin="JBossAS5" />
 		</runs-inside>
 
-		<service name="Virtual Database VDB(s)"
+	<!--	<metric displayName="Query Count" defaultOn="true" displayType="summary"
+			category="throughput" property="queryCount"
+			description="The number of queries for a given point in time" />
+
+		<metric displayName="Long Running Queries" defaultOn="true"
+			displayType="summary" category="performance" property="longRunningQueries"
+			description="The number of queries that have been running longer than the limit set for queries." />
+
+		<metric displayName="Session Count" defaultOn="true"
+			displayType="summary" category="throughput" property="sessionCount"
+			description="The number of user connections for a given point in time" />
+
+		<resource-configuration>
+			<c:group name="general" displayName="General"
+				hiddenByDefault="false">
+				<c:description>Query Configuration</c:description>
+				<c:simple-property name="longRunningQueryLimit"
+					type="integer" activationPolicy="immediate" units="seconds"
+					default="600" displayName="Long Running Query limit"
+					description="The value (in seconds) to use to determine if a query is to be considered 'long running'.">
+					<c:constraint>
+						<c:integer-constraint minimum="0" maximum="999999" />
+					</c:constraint>
+				</c:simple-property>
+			</c:group>
+		</resource-configuration>
+       -->
+		<service name="Virtual Database (VDB)s"
 			description="JBoss Enterprise Data Services Virtual Databases" class="VDBComponent"
-			discovery="VDBDiscoveryComponent" createDeletePolicy="both">
+			discovery="VDBDiscoveryComponent" createDeletePolicy="both"
+			creationDataType="content">
 
+			<content name="vdb" displayName="VDB Archive" category="deployable"
+				isCreationType="true">
+
+			</content>
+
+
 			<resource-configuration>
 				<c:group name="general" displayName="General"
 					hiddenByDefault="false">
@@ -72,6 +103,7 @@
 				</c:group>
 			</resource-configuration>
 
+
 			<service name="Models" description="Models that map to a datasource"
 				class="ModelComponent" discovery="ModelDiscoveryComponent"
 				createDeletePolicy="both">



More information about the teiid-commits mailing list