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

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

public class SienaGauge
extends java.lang.Object
implements GaugeControl, java.lang.Runnable


Field Summary
protected  boolean doReporting
          Indicates whether the reporting thread should report values.
protected  GaugeReportingBus gaugeBus
          The bus to report to.
protected  java.lang.String gaugeType
          The type of the gauge (should be overridden by extending gauges)
protected  java.util.Hashtable mappings
          The mappings of values to properties.
protected  java.lang.String myManagerID
          The ID of the gauge manager controlling this gauge.
protected  StringPairVector setupParams
          The parameters used to setup the gauge.
protected  int sleepTime
          How long (milliseconds) to sleep before reporting another value.
 
Constructor Summary
SienaGauge(GaugeID gaugeID, java.lang.String creatorID, StringPairVector setupParams, StringPairVector mappings)
          Creates a new gauge if all information is known.
SienaGauge(java.lang.String modelName, java.lang.String modelType, java.lang.String gaugeName, java.lang.String creatorID)
          Creates new SienaGauge
 
Method Summary
 boolean configure(StringPairVector configParams)
          Configures the gauge.
 void finalizeCreation(java.lang.String gaugeMgrID, boolean successful)
           
protected  void finalizeDeletion(java.lang.String gaugeMgrID)
           
 GaugeID getGaugeID()
          Returns the gauge ID of this gauge.
 void processDelete(java.lang.String gaugeMgrID)
          Processes a delete message from the gauge manager.
 boolean queryAllValues(GaugeValueVector values)
          Returns all the values that this gauge reports.
 boolean queryState(StringPairVector setupParams, StringPairVector configParams, StringPairVector mappings)
          Returns the state of this gauge.
 java.lang.String queryValue(java.lang.String valueName)
          Returns the value of a particular value name
 void reportNewValue()
          Reports a new value.
 void run()
          This is the reporting thread.
 void setGaugeID(GaugeID id)
          Sets the GaugeID of this gauge.
 void start()
          Creates and starts the reporting thread.
 void stop()
          Stops gauge reporting.
 
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.

gaugeType

protected java.lang.String gaugeType
The type of the gauge (should be overridden by extending gauges)

myManagerID

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

doReporting

protected boolean doReporting
Indicates whether the reporting thread should report values.

sleepTime

protected int sleepTime
How long (milliseconds) to sleep before reporting another value.

setupParams

protected StringPairVector setupParams
The parameters used to setup the gauge.

mappings

protected java.util.Hashtable mappings
The mappings of values to properties.
Constructor Detail

SienaGauge

public SienaGauge(java.lang.String modelName,
                  java.lang.String modelType,
                  java.lang.String gaugeName,
                  java.lang.String creatorID)
Creates new SienaGauge
Parameters:
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 a new gauge if all information is known.
Parameters:
gaugeID - The ID of the new gauge.
creatorID - The ID of the gauge manager creating the gauge.
setupParams - The parameters with which to setup the gauge.
mappings - The value->property mappings within the model the gauge is attached to.
Method Detail

start

public void start()
Creates and starts the reporting thread.

run

public void run()
This is the reporting thread. It calls reportNewValue which should be overridden by extenders of this gauge.
Specified by:
run in interface java.lang.Runnable

stop

public void stop()
Stops gauge reporting.

getGaugeID

public GaugeID getGaugeID()
Returns the gauge ID of this gauge.
Specified by:
getGaugeID in interface GaugeControl
Returns:
 

setGaugeID

public void setGaugeID(GaugeID id)
Sets the GaugeID of this gauge.

reportNewValue

public void reportNewValue()
Reports a new value. This should be overridden by extenders of this gauge.

configure

public boolean configure(StringPairVector configParams)
Configures the gauge.
Specified by:
configure in interface GaugeControl
Parameters:
configParams - The configuration parameters for this gauge.
Returns:
 

queryAllValues

public boolean queryAllValues(GaugeValueVector values)
Returns all the values that this gauge reports.
Specified by:
queryAllValues in interface GaugeControl
Parameters:
values -  
Returns:
 

queryState

public boolean queryState(StringPairVector setupParams,
                          StringPairVector configParams,
                          StringPairVector mappings)
Returns the state of this gauge.
Specified by:
queryState in interface GaugeControl
Parameters:
setupParams -  
configParams -  
mappings -  
Returns:
 

queryValue

public java.lang.String queryValue(java.lang.String valueName)
Returns the value of a particular value name
Specified by:
queryValue in interface GaugeControl
Parameters:
valueName -  
Returns:
 

processDelete

public void processDelete(java.lang.String gaugeMgrID)
Processes a delete message from the gauge manager. 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

protected void finalizeDeletion(java.lang.String gaugeMgrID)

finalizeCreation

public void finalizeCreation(java.lang.String gaugeMgrID,
                             boolean successful)