edu.cmu.cs.able.gaugeInfrastructure
Class GaugeImpl

java.lang.Object
  |
  +--edu.cmu.cs.able.gaugeInfrastructure.GaugeImpl
All Implemented Interfaces:
java.lang.Runnable

public abstract class GaugeImpl
extends java.lang.Object
implements java.lang.Runnable

This class provides the root class for all gauge implementations. It should contain the processing and calculation part of the gauge. It is the part of the gauge that is completely independent of the transport mechanism used.


Field Summary
protected  boolean doReporting
          Indicates whether to do reporting or not.
protected  GaugeReportingBus gaugeBus
          The bus through which values are reported.
protected  GaugeID gaugeID
          The ID of the gauge.
static java.lang.String gaugeType
          The type of the gauge being implemented.
protected  java.util.Hashtable mappings
          The mappings of values to architectural properties.
protected  int reportingFrequency
          The frequency to report values (in milliseconds).
protected  java.lang.Thread reportingThread
          The thread that does periodic reporting of values.
protected  StringPairVector setupParams
          The setup parameters for the gauge instance.
 
Constructor Summary
GaugeImpl(GaugeID gid, StringPairVector setupParams, StringPairVector mappings, GaugeReportingBus bus)
          Creates a new instance of GaugeImpl
 
Method Summary
abstract  boolean configure(StringPairVector configParams)
          Is used to configure the gauge.
abstract  boolean consistentlyCreated()
          Used to check if the gauge has been successfully created.
abstract  boolean queryAllValues(GaugeValueVector values)
          Used to get the current value of all the values that the gauge reports.
abstract  boolean queryState(StringPairVector setupParams, StringPairVector configParams, StringPairVector mappings)
          Used to query the current state of the gauge.
abstract  java.lang.String queryValue(java.lang.String valueName)
          Queries the value of a particular gauge value.
abstract  void reportNewValue()
          Implemented by specific gauges to report a new value.
 void run()
          The method used to start the gauge reporting thread.
 void startReportingThread()
          Starts the gauge reporting thread.
 void stopReportingThread()
          Stops the gauge reporting thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

gaugeType

public static java.lang.String gaugeType
The type of the gauge being implemented.

gaugeID

protected GaugeID gaugeID
The ID of the gauge.

doReporting

protected boolean doReporting
Indicates whether to do reporting or not.

reportingThread

protected java.lang.Thread reportingThread
The thread that does periodic reporting of values.

reportingFrequency

protected int reportingFrequency
The frequency to report values (in milliseconds).

setupParams

protected StringPairVector setupParams
The setup parameters for the gauge instance.

mappings

protected java.util.Hashtable mappings
The mappings of values to architectural properties.

gaugeBus

protected GaugeReportingBus gaugeBus
The bus through which values are reported.
Constructor Detail

GaugeImpl

public GaugeImpl(GaugeID gid,
                 StringPairVector setupParams,
                 StringPairVector mappings,
                 GaugeReportingBus bus)
Creates a new instance of GaugeImpl
Parameters:
gid - The gauge ID of the new gauge.
setupParams - The setup parameters used to construct the gauge.
mappings - The mappings of values to architectural properties.
bus - The bus to be used for reporting.
Method Detail

run

public void run()
The method used to start the gauge reporting thread.
Specified by:
run in interface java.lang.Runnable

startReportingThread

public void startReportingThread()
Starts the gauge reporting thread.

stopReportingThread

public void stopReportingThread()
Stops the gauge reporting thread.

consistentlyCreated

public abstract boolean consistentlyCreated()
Used to check if the gauge has been successfully created. Typically, need to check that all setup parameters were valid and all probes have been deployed, installed, and activated successfully.
Returns:
true if the creation was successful, false otherwise.

reportNewValue

public abstract void reportNewValue()
Implemented by specific gauges to report a new value.

configure

public abstract boolean configure(StringPairVector configParams)
Is used to configure the gauge.
Parameters:
configParams - The configuration parameters
Returns:
true if the configuration was successful.

queryAllValues

public abstract boolean queryAllValues(GaugeValueVector values)
Used to get the current value of all the values that the gauge reports.
Parameters:
values - This is filled in with triples of value name, property name (what the value is mapped to), and value.
Returns:
true if the values could be queried.

queryState

public abstract boolean queryState(StringPairVector setupParams,
                                   StringPairVector configParams,
                                   StringPairVector mappings)
Used to query the current state of the gauge.
Parameters:
setupParams - Filled with the parameters that were used to setup the gauge.
configParams - Filled with parameters indicating how the gauge is currently configured.
mappings - Filled with the mappings between values and high-level properties.
Returns:
true if the query was successful.

queryValue

public abstract java.lang.String queryValue(java.lang.String valueName)
Queries the value of a particular gauge value.
Parameters:
valueName - The name of the value to be reported.
Returns:
The value indicated by valueName.