blob: 5dcd6573ad7a0a2605571c7e904ba93b4fbd2bb1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
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;
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 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
}
}
|