|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.rhq.plugins.script.ScriptServerComponent
public class ScriptServerComponent
Represents a managed resource whose management interface is a command line executable or script, sometimes referred to as the "CLI" (command line interface).
| Constructor Summary | |
|---|---|
ScriptServerComponent()
|
|
| Method Summary | |
|---|---|
protected ProcessExecutionResults |
executeExecutable(String args,
long wait,
boolean captureOutput)
Executes the CLI executable with the given arguments. |
protected ProcessExecutionResults |
executeExecutable(String args,
long wait,
boolean captureOutput,
boolean killOnTimeout)
Executes the CLI executable with the given arguments. |
protected static ProcessExecutionResults |
executeExecutable(SystemInfo sysInfo,
org.rhq.core.domain.configuration.Configuration pluginConfig,
String args,
long wait,
boolean captureOutput)
|
org.rhq.core.domain.measurement.AvailabilityType |
getAvailability()
|
protected ResourceContext |
getResourcContext()
|
void |
getValues(org.rhq.core.domain.measurement.MeasurementReport report,
Set<org.rhq.core.domain.measurement.MeasurementScheduleRequest> requests)
Executes the CLI and based on the measurement property, collects the appropriate measurement value. |
OperationResult |
invokeOperation(String name,
org.rhq.core.domain.configuration.Configuration configuration)
Invokes the CLI executable. |
protected Map<String,String> |
parseMetricProperty(String metricPropertyName)
Given a metric property name, this parses it into its different pieces and returns a map of the different tokens. |
void |
start(ResourceContext context)
|
void |
stop()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final String PLUGINCONFIG_EXECUTABLE
protected static final String PLUGINCONFIG_WORKINGDIR
protected static final String PLUGINCONFIG_ENVVARS
protected static final String PLUGINCONFIG_ENVVAR_NAME
protected static final String PLUGINCONFIG_ENVVAR_VALUE
protected static final String PLUGINCONFIG_AVAIL_EXECUTE_CHECK
protected static final String PLUGINCONFIG_AVAIL_EXITCODE_REGEX
protected static final String PLUGINCONFIG_AVAIL_OUTPUT_REGEX
protected static final String PLUGINCONFIG_AVAIL_ARGS
protected static final String PLUGINCONFIG_VERSION_ARGS
protected static final String PLUGINCONFIG_VERSION_REGEX
protected static final String PLUGINCONFIG_FIXED_VERSION
protected static final String PLUGINCONFIG_DESC_ARGS
protected static final String PLUGINCONFIG_DESC_REGEX
protected static final String PLUGINCONFIG_FIXED_DESC
protected static final String OPERATION_PARAM_ARGUMENTS
protected static final String OPERATION_PARAM_WAIT_TIME
protected static final String OPERATION_PARAM_CAPTURE_OUTPUT
protected static final String OPERATION_PARAM_KILL_ON_TIMEOUT
protected static final String OPERATION_RESULT_EXITCODE
protected static final String OPERATION_RESULT_OUTPUT
protected static final String METRIC_PROPERTY_ARGUMENTS
protected static final String METRIC_PROPERTY_REGEX
protected static final String METRIC_PROPERTY_EXITCODE
| Constructor Detail |
|---|
public ScriptServerComponent()
| Method Detail |
|---|
public void start(ResourceContext context)
start in interface ResourceComponentpublic void stop()
stop in interface ResourceComponentpublic org.rhq.core.domain.measurement.AvailabilityType getAvailability()
getAvailability in interface AvailabilityFacet
public void getValues(org.rhq.core.domain.measurement.MeasurementReport report,
Set<org.rhq.core.domain.measurement.MeasurementScheduleRequest> requests)
getValues in interface MeasurementFacetMeasurementFacet.getValues(MeasurementReport, Set)protected Map<String,String> parseMetricProperty(String metricPropertyName)
arguments
{arguments}|regex
{arguments}|exitcode
where "arguments" is the empty or non-empty string of the arguments to pass to the CLI executable,
regex is a empty or non-empty regular expresssion string to match the output (if there is a matching
group in the regex, its value will be used as the metric value, not the full output of the executable),
exitcode is the literal string "exitcode" to indicate that the exit code value is to be used as the metric value.
metricPropertyName - the name of the property in the metric descriptor
METRIC_PROPERTY_ARGUMENTS or METRIC_PROPERTY_REGEX.
The map will be null if the property name is invalid for some reason.
A map entry will not exist if it was not specified in the property name.
public OperationResult invokeOperation(String name,
org.rhq.core.domain.configuration.Configuration configuration)
throws Exception
invokeOperation in interface OperationFacetExceptionOperationFacet.invokeOperation(String, Configuration)protected ResourceContext getResourcContext()
protected ProcessExecutionResults executeExecutable(String args,
long wait,
boolean captureOutput)
executeExecutable(String, long, boolean, boolean) with 'killOnTimeout' being true.
InvalidPluginConfigurationException
protected ProcessExecutionResults executeExecutable(String args,
long wait,
boolean captureOutput,
boolean killOnTimeout)
throws InvalidPluginConfigurationException
args - the arguments to send to the executable (may be null)wait - the maximum time in milliseconds to wait for the process to execute; 0 means do not waitcaptureOutput - if true, the executables output will be captured and returnedkillOnTimeout - if true and if 'wait' is greater than 0, the process will be killed if it times out
InvalidPluginConfigurationException
protected static ProcessExecutionResults executeExecutable(SystemInfo sysInfo,
org.rhq.core.domain.configuration.Configuration pluginConfig,
String args,
long wait,
boolean captureOutput)
throws InvalidPluginConfigurationException
InvalidPluginConfigurationException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||