diff options
Diffstat (limited to 'src/main/java/org/rhq/plugins/puppet/PuppetComponent.java')
-rw-r--r-- | src/main/java/org/rhq/plugins/puppet/PuppetComponent.java | 95 |
1 files changed, 15 insertions, 80 deletions
diff --git a/src/main/java/org/rhq/plugins/puppet/PuppetComponent.java b/src/main/java/org/rhq/plugins/puppet/PuppetComponent.java index 5dcd657..b311f98 100644 --- a/src/main/java/org/rhq/plugins/puppet/PuppetComponent.java +++ b/src/main/java/org/rhq/plugins/puppet/PuppetComponent.java @@ -1,112 +1,47 @@ - package org.rhq.plugins.puppet; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.rhq.core.domain.configuration.Configuration; -import org.rhq.core.domain.measurement.AvailabilityType; import org.rhq.core.pluginapi.inventory.CreateChildResourceFacet; import org.rhq.core.pluginapi.inventory.CreateResourceReport; import org.rhq.core.pluginapi.inventory.DeleteResourceFacet; import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException; import org.rhq.core.pluginapi.inventory.ResourceComponent; -import org.rhq.core.pluginapi.inventory.ResourceContext; -import org.rhq.core.pluginapi.operation.OperationContext; import org.rhq.core.pluginapi.operation.OperationFacet; import org.rhq.core.pluginapi.operation.OperationResult; +import org.rhq.core.system.ProcessExecutionResults; +import org.rhq.core.system.SystemInfo; +import org.rhq.plugins.script.ScriptServerComponent; - -public class PuppetComponent implements ResourceComponent -, OperationFacet -, CreateChildResourceFacet -, DeleteResourceFacet -{ +public class PuppetComponent extends ScriptServerComponent implements ResourceComponent, OperationFacet, CreateChildResourceFacet, + DeleteResourceFacet { + private final Log log = LogFactory.getLog(this.getClass()); - private static final int CHANGEME = 1; // TODO remove or change this - - - - - /** - * Return availability of this resource - * @see ResourceComponent#getAvailability() - */ - public AvailabilityType getAvailability() { - // TODO supply real implementation - return AvailabilityType.UP; - } - - - /** - * Start the resource connection - * @see org.rhq.core.pluginapi.inventory.ResourceComponent#start(org.rhq.core.pluginapi.inventory.ResourceContext) - */ - public void start(ResourceContext context) throws InvalidPluginConfigurationException, Exception { - - Configuration conf = context.getPluginConfiguration(); - // TODO add code to start the resource / connection to it - - - } - - - /** - * Tear down the rescource connection - * @see org.rhq.core.pluginapi.inventory.ResourceComponent#stop() - */ - public void stop() { - + // these are reused from our generic script plugin + protected static final String PLUGINCONFIG_EXECUTABLE = ScriptServerComponent.PLUGINCONFIG_EXECUTABLE; - } - - - - - - public void startOperationFacet(OperationContext context) { - - } - - - /** - * Invokes the passed operation on the managed resource - * @param name Name of the operation - * @param params The method parameters - * @return An operation result - * @see org.rhq.core.pluginapi.operation.OperationFacet - */ public OperationResult invokeOperation(String name, Configuration params) throws Exception { + // TODO OperationResult res = new OperationResult(); if ("dummyOperation".equals(name)) { - // TODO implement me - } return res; } - - - /** - * Create a child resource - * @see org.rhq.core.pluginapi.inventory.CreateChildResourceFacet - */ - public CreateResourceReport createResource(CreateResourceReport report) - { - // TODO supply code to create a child resource - + public CreateResourceReport createResource(CreateResourceReport report) { return null; // TODO change this } - /** - * Delete a child resource - * @see org.rhq.core.pluginapi.inventory.DeleteResourceFacet - */ - public void deleteResource() throws Exception - { + public void deleteResource() throws Exception { // TODO supply code to delete a child resource } + protected static ProcessExecutionResults executeExecutable(SystemInfo sysInfo, Configuration pluginConfig, + String args, long wait, boolean captureOutput) throws InvalidPluginConfigurationException { + return ScriptServerComponent.executeExecutable(sysInfo, pluginConfig, args, wait, captureOutput); + } } |