edu.cmu.cs.able.gauges.Siena.Demo
Class LatencyGauge

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

public class LatencyGauge
extends SienaGauge
implements IProbeConsumer

Implementation of the LatencyGauge, conforming to gauge type:
LatencyGauge = [
  type = edu.cmu.cs.able.gauges.Siena.Demo.LatencyGauge
  setup = [where : String]
  config = [reset : boolean]
  values = [latency : float]


Field Summary
 java.lang.String gaugeType
           
protected  java.lang.String where
           
static java.lang.Double ZERO
           
 
Fields inherited from class edu.cmu.cs.able.gaugeInfrastructure.Siena.SienaGauge
doReporting, gaugeBus, mappings, myManagerID, setupParams, sleepTime
 
Constructor Summary
LatencyGauge(GaugeID gaugeID, java.lang.String creatorID, StringPairVector setupParams, StringPairVector mappings)
          Creates new SienaLatencyGauge
 
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.
 void onProbeEvent(IProbeEvent event)
          This method is called when a probe senses a value.
 void processDelete(java.lang.String gaugeMgrID)
          Processes a delete message from the gauge manager.
 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()
          Reports a new value.
 
Methods inherited from class edu.cmu.cs.able.gaugeInfrastructure.Siena.SienaGauge
finalizeCreation, finalizeDeletion, getGaugeID, run, setGaugeID, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

where

protected java.lang.String where

ZERO

public static final java.lang.Double ZERO

gaugeType

public java.lang.String gaugeType
Constructor Detail

LatencyGauge

public LatencyGauge(GaugeID gaugeID,
                    java.lang.String creatorID,
                    StringPairVector setupParams,
                    StringPairVector mappings)
Creates new SienaLatencyGauge
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:
  where : int
mappings - The property that the
latency
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 LatencyGauge, it will be [reset : boolean].
Returns:
Whether the gauge was successfully configured. Will always return false.

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).

onProbeEvent

public void onProbeEvent(IProbeEvent event)
This method is called when a probe senses a value. It will generate a report when this is called.
Specified by:
onProbeEvent in interface IProbeConsumer
Parameters:
latency - the latency reported by the gauge

reportNewValue

public void reportNewValue()
Reports a new value. This should be overridden by extenders of this gauge.
Overrides:
reportNewValue in class SienaGauge

processDelete

public void processDelete(java.lang.String gaugeMgrID)
Description copied from class: SienaGauge
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)
Overrides:
processDelete in class SienaGauge
Following copied from class: edu.cmu.cs.able.gaugeInfrastructure.Siena.SienaGauge
Parameters:
gaugeMgrID - The ID of the gauge manager requesting deletion.

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]