edu.cmu.cs.able.gauges.Siena
Class SienaTimeGauge

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

public class SienaTimeGauge
extends SienaGauge

This gauge provides an example that periodically reports the date and time to the gauge bus. Its type is:
TimeGauge = [
  type = edu.cmu.cs.able.gauges.Siena.SienaTimeGauge,
  setup = []
  config = [frequency : int; report : boolean [default = false;]]
  values = [date : String]


Field Summary
protected  java.lang.String gaugeType
           
 
Fields inherited from class edu.cmu.cs.able.gaugeInfrastructure.Siena.SienaGauge
doReporting, gaugeBus, mappings, myManagerID, setupParams, sleepTime
 
Constructor Summary
SienaTimeGauge(GaugeID gaugeID, java.lang.String creatorID, StringPairVector setupParams, StringPairVector mappings)
          Creates new SienaTimeGauge
 
Method Summary
 boolean configure(StringPairVector configParams)
          This method is used to configure the gauge.
static void main(java.lang.String[] args)
          A command-line interface to start the gauge.
 boolean queryAllValues(GaugeValueVector values)
          Returns the current date.
 boolean queryState(StringPairVector setupParams, StringPairVector configParams, StringPairVector mappings)
          Returns the state of the gauge.
 java.lang.String queryValue(java.lang.String valueName)
          The method called to query the value of the gauge.
 void reportNewValue()
          This method is called periodically by the reporting thread to generate a new value and report it.
 
Methods inherited from class edu.cmu.cs.able.gaugeInfrastructure.Siena.SienaGauge
finalizeCreation, finalizeDeletion, getGaugeID, processDelete, run, setGaugeID, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

gaugeType

protected java.lang.String gaugeType
Constructor Detail

SienaTimeGauge

public SienaTimeGauge(GaugeID gaugeID,
                      java.lang.String creatorID,
                      StringPairVector setupParams,
                      StringPairVector mappings)
Creates new SienaTimeGauge
Parameters:
gaugeID - The ID of the new gauge.
creatorID - The ID of the gauge manager that created the gauge.
setupParams - The parameters that the gauge uses to set itself up. The valid setup parameters for this gauge are:
  frequency : int
mappings - The property that the
date
value is associated with.
Method Detail

configure

public boolean configure(StringPairVector configParams)
This method is used to configure the gauge.
Overrides:
configure in class SienaGauge
Parameters:
configParams - The parameters used to configure the gauge. For the SienaTimeGauge, the valid configuration parameters are:
  frequency : int (millisecond period of reporting)
  report : true (whether the gauge should report a value)
Returns:
Whether the gauge was successfully configured.

queryAllValues

public boolean queryAllValues(GaugeValueVector values)
Returns the current date.
Overrides:
queryAllValues in class SienaGauge
Parameters:
values - The vector into which to place the date.
Returns:
Whether the gauge could report it's current value.

queryState

public boolean queryState(StringPairVector setupParams,
                          StringPairVector configParams,
                          StringPairVector mappings)
Returns the state of the gauge.
Overrides:
queryState in class SienaGauge
Parameters:
setupParams - The vector into which the setup parameters are copied. Will be empty for this gauge.
configParams - The configuration parameters for this gauge. Will have an element for
frequency
and
report
.
mappings - The property that each gauge value is associated with. Will have an element for
date
.
Returns:
Whether the state of the gauge could be queried.

queryValue

public java.lang.String queryValue(java.lang.String valueName)
The method called to query the value of the gauge. This provides a direct query for the gauge, as opposed to the gauge reporting to value on the bus.
Overrides:
queryValue in class SienaGauge
Parameters:
valueName - The name of the value to query.
Returns:
The corresponding value of the gauge. (Note: it is assumed that the querier know the property associated with this value).

reportNewValue

public void reportNewValue()
This method is called periodically by the reporting thread to generate a new value and report it. It is inherited from Siena gauge.
Overrides:
reportNewValue in class SienaGauge

main

public static void main(java.lang.String[] args)
A command-line interface to start the gauge.
Parameters:
args - -gt gauge type
-gn gauge name
-mt model type
-mn model name
[-setup name=value]
[-mappings name=property]
-creator creator ID
-senp siena port
[-debug]