summaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorJohn Mazzitelli <mazz@redhat.com>2009-10-02 11:30:51 -0400
committerJohn Mazzitelli <mazz@redhat.com>2009-10-02 11:30:51 -0400
commit160e56ab98b1c630bead95d0800ab4b9cc59e311 (patch)
tree1a8a0e5ce9b0952274e1953e903821e4d288edf2 /src/main/java
parent389a8916a5501152f08c6ff6d1846fbda47b923e (diff)
downloadpuppet-plugin-160e56ab98b1c630bead95d0800ab4b9cc59e311.tar.gz
puppet-plugin-160e56ab98b1c630bead95d0800ab4b9cc59e311.tar.xz
puppet-plugin-160e56ab98b1c630bead95d0800ab4b9cc59e311.zip
initial skeleton as generated by pluginGen
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/rhq/plugins/puppet/puppet/PuppetComponent.java115
-rw-r--r--src/main/java/org/rhq/plugins/puppet/puppet/PuppetDiscovery.java50
2 files changed, 165 insertions, 0 deletions
diff --git a/src/main/java/org/rhq/plugins/puppet/puppet/PuppetComponent.java b/src/main/java/org/rhq/plugins/puppet/puppet/PuppetComponent.java
new file mode 100644
index 0000000..05993e2
--- /dev/null
+++ b/src/main/java/org/rhq/plugins/puppet/puppet/PuppetComponent.java
@@ -0,0 +1,115 @@
+
+package org.rhq.plugins.puppet.puppet;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+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.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;
+
+
+public class PuppetComponent 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 org.rhq.core.pluginapi.inventory.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() {
+
+
+ }
+
+
+
+
+
+ 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 {
+
+ 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
+
+ return null; // TODO change this
+ }
+
+ /**
+ * Delete a child resource
+ * @see org.rhq.core.pluginapi.inventory.DeleteResourceFacet
+ */
+ public void deleteResource() throws Exception
+ {
+ // TODO supply code to delete a child resource
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/org/rhq/plugins/puppet/puppet/PuppetDiscovery.java b/src/main/java/org/rhq/plugins/puppet/puppet/PuppetDiscovery.java
new file mode 100644
index 0000000..5d2255e
--- /dev/null
+++ b/src/main/java/org/rhq/plugins/puppet/puppet/PuppetDiscovery.java
@@ -0,0 +1,50 @@
+package org.rhq.plugins.puppet.puppet;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.Property;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
+import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import org.rhq.core.pluginapi.inventory.ProcessScanResult;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+
+
+/**
+ * Discovery class
+ */
+public class PuppetDiscovery implements ResourceDiscoveryComponent {
+
+
+ private final Log log = LogFactory.getLog(this.getClass());
+
+
+ /**
+ * Run the discovery
+ */
+ public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext discoveryContext) throws Exception {
+
+ Set<DiscoveredResourceDetails> discoveredResources = new HashSet<DiscoveredResourceDetails>();
+
+ /**
+ * TODO : do your discovery here
+ * A discovered resource must have a unique key, that must
+ * stay the same when the resource is discovered the next
+ * time
+ */
+ DiscoveredResourceDetails detail = null; // new DiscoveredResourceDetails( );
+
+
+ // Add to return values
+ discoveredResources.add(detail);
+ log.info("Discovered new ... TODO "); // TODO change
+
+ return discoveredResources;
+
+ }
+} \ No newline at end of file