edu.cmu.cs.able.gaugeInfrastructure.Siena
Class SienaGauge

java.lang.Object
  |
  +--edu.cmu.cs.able.gaugeInfrastructure.Siena.SienaGauge
All Implemented Interfaces:
GaugeControl

public abstract class SienaGauge
extends java.lang.Object
implements GaugeControl

This is the root class for all Siena gauges. It creates a default Siena gauge bus, and has default implementations for managing deletion and creation of the gauges.


Field Summary
protected  GaugeReportingBus gaugeBus
          The bus to report to.
protected  StringPairVector mappings
          The mappings of this gauge.
 java.lang.String myManagerID
          The ID of the gauge manager controlling this gauge.
protected  StringPairVector setupParams
          The parameters used to setup this gauge.
 
Constructor Summary
SienaGauge(GaugeID gaugeID, java.lang.String creatorID, StringPairVector setupParams, StringPairVector mappings)
          Creates new SienaGauge.
SienaGauge(java.lang.String modelName, java.lang.String modelType, java.lang.String gaugeName, java.lang.String gaugeType, java.lang.String creatorID)
          Creates new SienaGauge.
 
Method Summary
abstract  boolean configure(StringPairVector configParams)
          The method called when configuring a gauge.
 void finalizeCreation(java.lang.String gaugeMgrID, boolean successful)
          Finalizes the creation of the gauge.
 void finalizeDeletion(java.lang.String gaugeMgrID)
          Implements the deletion process for gauges.
 GaugeID getGaugeID()
          Each gauge implementation must have an ID
 void processDelete(java.lang.String gaugeMgrID)
          Processes a delete message from the gauge manager.
abstract  boolean queryAllValues(GaugeValueVector values)
          Returns all the gauge values that the gauge reports.
abstract  boolean queryState(StringPairVector setupParams, StringPairVector configParams, StringPairVector mappings)
          The method called to query the state of the gauge
abstract  java.lang.String queryValue(java.lang.String valueName)
          Called when a gauge is queried for a value.
 void setGaugeID(GaugeID gid)
          Sets the gauge ID for this gauge.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

gaugeBus

protected GaugeReportingBus gaugeBus
The bus to report to.

myManagerID

public java.lang.String myManagerID
The ID of the gauge manager controlling this gauge.

setupParams

protected StringPairVector setupParams
The parameters used to setup this gauge.

mappings

protected StringPairVector mappings
The mappings of this gauge.
Constructor Detail

SienaGauge

public SienaGauge(java.lang.String modelName,
                  java.lang.String modelType,
                  java.lang.String gaugeName,
                  java.lang.String gaugeType,
                  java.lang.String creatorID)
Creates new SienaGauge. Used when the mappings and setup parameters are unknown -- the gauge infrastructure queries the gauge manager to find these values.
Parameters:
gaugeType - The type of the gauge to be created.
modelName - The name of the model that the gauge is attached to.
modelType - The type of the model that the gauge is attached to.
gaugeName - The name of the new gauge.
creatorID - The gauge manager that created the gauge.

SienaGauge

public SienaGauge(GaugeID gaugeID,
                  java.lang.String creatorID,
                  StringPairVector setupParams,
                  StringPairVector mappings)
Creates new SienaGauge. Used when the setup parameters and mappings are known.
Parameters:
gaugeID - The ID of the gauge
creatorID - The gauge manager that created the gauge
setupParams - The setup parameters used to create the gauge
mappings - The mappings for values to high-level properties
Method Detail

processDelete

public void processDelete(java.lang.String gaugeMgrID)
Processes a delete message from the gauge manager. This is called by the gauge infrastructure when a delete message is sent to the gauge. This method follows the process for deleting a gauge, i.e.:
report the fact that the gauge was deleted to the gauge bus
stop reporting values
don't listen to any more events
It should be assumed by the gauge that it will be destroyed after this method is called (destroyed could mean that the JVM running this gauge is stopped)
Parameters:
gaugeMgrID - The ID of the gauge manager requesting deletion.

finalizeDeletion

public void finalizeDeletion(java.lang.String gaugeMgrID)
Implements the deletion process for gauges. Can be overridden by implementations.
Parameters:
gaugeMgrID - The ID of the gauge manager requesting deletion.

finalizeCreation

public void finalizeCreation(java.lang.String gaugeMgrID,
                             boolean successful)
Finalizes the creation of the gauge. Sends a created event to the bus, and a creation finished event to the gauge manager.
Parameters:
gaugeMgrID - The ID of the gauge manager that attempted to create the gauge.
successful - Whether the creation was successful.

configure

public abstract boolean configure(StringPairVector configParams)
The method called when configuring a gauge.
Specified by:
configure in interface GaugeControl
Parameters:
configParams - The configuration parameters for the gauge as (name, value) pairs.
Returns:
true if the gauge could be configured successfully; false otherwise

getGaugeID

public GaugeID getGaugeID()
Each gauge implementation must have an ID
Specified by:
getGaugeID in interface GaugeControl
Returns:
The ID of the gauge

setGaugeID

public void setGaugeID(GaugeID gid)
Sets the gauge ID for this gauge.
Parameters:
gid - The ID of the gauge.

queryAllValues

public abstract boolean queryAllValues(GaugeValueVector values)
Returns all the gauge values that the gauge reports.
Specified by:
queryAllValues in interface GaugeControl
Parameters:
values - This is filled with all the values as a (valueName, propertyName, value) tuple
Returns:
true if the values were successfully determined; false otherwise.

queryState

public abstract boolean queryState(StringPairVector setupParams,
                                   StringPairVector configParams,
                                   StringPairVector mappings)
The method called to query the state of the gauge
Specified by:
queryState in interface GaugeControl
Parameters:
setupParams - Will be filled with the parameters with which the gauge was setup, as (name, value) pairs.
configParams - Will be filled with the current configuration of the gauge, as (name, value) pairs
mappings - Will be filled with the mappings for the gauge, as (name, propertyName) pairs.
Returns:
true if the gauge successfully returns its state; false otherwise

queryValue

public abstract java.lang.String queryValue(java.lang.String valueName)
Called when a gauge is queried for a value. This provides an alternative to the gauge reporting events.
Specified by:
queryValue in interface GaugeControl
Parameters:
valueName - The name of the value to be queried.
Returns:
The value corresponding to the name passed in; null indicates that the gauge value could not be determined.