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

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

public class ServerLoadGauge
extends SienaGauge
implements IProbeConsumer

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


Field Summary
 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
ServerLoadGauge(GaugeID gaugeID, java.lang.String creatorID, StringPairVector setupParams, StringPairVector mappings)
          Creates new ServerLoadGauge
 
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)

gaugeType

public java.lang.String gaugeType
Constructor Detail

ServerLoadGauge

public ServerLoadGauge(GaugeID gaugeID,
                       java.lang.String creatorID,
                       StringPairVector setupParams,
                       StringPairVector mappings)
Creates new ServerLoadGauge
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 ServerLoadGauge, it is (reset, boolean)
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 be empty
mappings - The property that each gauge value is associated with. Will have an element for
load
.
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.

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.