org.rhq.modules.plugins.script2
Class ScriptComponent

java.lang.Object
  extended by org.rhq.modules.plugins.script2.ScriptComponent
All Implemented Interfaces:
AvailabilityFacet, ResourceComponent, MeasurementFacet, OperationFacet

public class ScriptComponent
extends Object
implements ResourceComponent, MeasurementFacet, OperationFacet

Run the show for the script2 plugin. We eval() the script for each call to getAvailability and getValues , as otherwise we may see failures, when evaluated script was evaluated on a different thread than the execution of invokeFunction.

Author:
Heiko W. Rupp

Constructor Summary
ScriptComponent()
           
 
Method Summary
 org.rhq.core.domain.measurement.AvailabilityType getAvailability()
          Return availability of this resource
 void getValues(org.rhq.core.domain.measurement.MeasurementReport report, Set<org.rhq.core.domain.measurement.MeasurementScheduleRequest> metrics)
          Gather measurement data
 OperationResult invokeOperation(String name, org.rhq.core.domain.configuration.Configuration params)
          Invokes the passed operation on the managed resource
 void start(ResourceContext context)
          Start the resource connection
 void startOperationFacet(OperationContext context)
           
 void stop()
          Tear down the rescource connection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptComponent

public ScriptComponent()
Method Detail

getAvailability

public org.rhq.core.domain.measurement.AvailabilityType getAvailability()
Return availability of this resource

Specified by:
getAvailability in interface AvailabilityFacet
See Also:
AvailabilityFacet.getAvailability()

start

public void start(ResourceContext context)
           throws InvalidPluginConfigurationException,
                  Exception
Start the resource connection

Specified by:
start in interface ResourceComponent
Throws:
InvalidPluginConfigurationException
Exception
See Also:
ResourceComponent.start(org.rhq.core.pluginapi.inventory.ResourceContext)

stop

public void stop()
Tear down the rescource connection

Specified by:
stop in interface ResourceComponent
See Also:
ResourceComponent.stop()

getValues

public void getValues(org.rhq.core.domain.measurement.MeasurementReport report,
                      Set<org.rhq.core.domain.measurement.MeasurementScheduleRequest> metrics)
               throws Exception
Gather measurement data

Specified by:
getValues in interface MeasurementFacet
Throws:
Exception
See Also:
MeasurementFacet.getValues(org.rhq.core.domain.measurement.MeasurementReport, java.util.Set)

startOperationFacet

public void startOperationFacet(OperationContext context)

invokeOperation

public OperationResult invokeOperation(String name,
                                       org.rhq.core.domain.configuration.Configuration params)
                                throws Exception
Invokes the passed operation on the managed resource

Specified by:
invokeOperation in interface OperationFacet
Parameters:
name - Name of the operation
params - The method parameters
Returns:
An operation result
Throws:
Exception
See Also:
OperationFacet


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.