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

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

public class BandwidthGauge
extends SienaGauge
implements IProbeConsumer

Implementation of the BandwidthGauge, conforming to gauge type:
ServerLoadGauge = [
  type = edu.cmu.cs.able.gauges.Siena.Demo.BandwidthGauge
  setup = [where : String]
  config = []
  values = [bandwidth : float]


Field Summary
static double ALPHA
           
 java.lang.String gaugeType
           
protected  java.lang.String where
          Where (the component or connector) the gauge is attached.
 
Fields inherited from class edu.cmu.cs.able.gaugeInfrastructure.Siena.SienaGauge
doReporting, gaugeBus, mappings, myManagerID, setupParams, sleepTime
 
Constructor Summary
BandwidthGauge(GaugeID gaugeID, java.lang.String creatorID, StringPairVector setupParams, StringPairVector mappings)
          Creates new BandwidthGauge
 
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)
          The callback invoked when a probe reports a single event.
 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
Where (the component or connector) the gauge is attached. (maps to the probe shell name)

ALPHA

public static final double ALPHA

gaugeType

public java.lang.String gaugeType
Constructor Detail

BandwidthGauge

public BandwidthGauge(GaugeID gaugeID,
                      java.lang.String creatorID,
                      StringPairVector setupParams,
                      StringPairVector mappings)
Creates new BandwidthGauge
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 : String
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 BandwidthGauge, there are no valid configuration parameters for this gauge.
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 be empty.
mappings - The property that each gauge value is associated with. Will have an element for
bandwidth
.
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).

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]

onProbeEvent

public void onProbeEvent(IProbeEvent event)
The callback invoked when a probe reports a single event.
Specified by:
onProbeEvent in interface IProbeConsumer
Parameters:
e. - The event that was reported.

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.

reportNewValue

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