org.isam.exehda.services.primos
Class MetaSensor

java.lang.Object
  |
  +--org.isam.exehda.services.primos.MetaSensor

class MetaSensor
extends java.lang.Object

Facility to manipulate sensors. Each sensor is broken in a public version and another private one. The private version is used to interact with the underlaying monitor (actual sensor's provider). The public sensor is made publically available to applications and may be used with no risk of opening security flaws or having unwanted side-effects.

Version:
$Date: 2004/11/02 01:48:05 $ $Revision: 1.2 $
Author:
last modified by $Author: lucc $

Constructor Summary
MetaSensor(Collector.Sensor pvtSensor, Collector.Monitor provider)
          Creates a new MetaSensor instance for the given private Sensor and monitor.
 
Method Summary
 void addConsumer(Collector.ConsumerId c)
          Register a new consumer for the sensor.
 boolean checkStateChanged()
          Returns whether the sensor value has significantly changed since last publication.
 java.lang.Object getKey()
          Returns the public key os this sensor.
 java.lang.Object getParameter(Collector.SensorParameter p)
          Returns the current value assigned to the given parameter.
 Collector.SensorParameter[] getParameters()
          Returns the list of parameters supported by this sensor.
 Collector.Monitor getProvider()
          Returns the underlaying monitor who actually provides this sensor.
 Collector.Sensor getPublicSensor()
          Returns the public sensor object associated with this sensor.
 boolean isEnabled()
          Returns whether this sensor is currently enabled or not.
 Collector.MonitoringData probe(Collector.MonitoringData d)
          Probes the current value of the sensor.
 void removeConsumer(Collector.ConsumerId c)
          Unregisters the given object as a consumer of the data produced by this sensor.
 void setEnabled(boolean enable)
          Enables/disables this sensor.
 void setParameter(Collector.ConsumerId c, Collector.SensorParameter p, java.lang.Object v)
          Assigns a new value to the given parameter.
 java.lang.String toString()
          Returns a string representation of this MetaSensor object (mostly for debugging purpouses).
 void update(long timeStamp)
          Updates last published state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MetaSensor

public MetaSensor(Collector.Sensor pvtSensor,
                  Collector.Monitor provider)
Creates a new MetaSensor instance for the given private Sensor and monitor.

Parameters:
pvtSensor - an internal Sensor
provider - the underlaying sensor provider
Method Detail

getPublicSensor

public Collector.Sensor getPublicSensor()
Returns the public sensor object associated with this sensor.

Returns:
the public Sensor object

getKey

public java.lang.Object getKey()
Returns the public key os this sensor.

Returns:
the public Key.

update

public void update(long timeStamp)
Updates last published state.


checkStateChanged

public boolean checkStateChanged()
Returns whether the sensor value has significantly changed since last publication.

Returns:
a boolean value

addConsumer

public void addConsumer(Collector.ConsumerId c)
Register a new consumer for the sensor.

Parameters:
c - a new Consumer
To do:
review synchronized

removeConsumer

public void removeConsumer(Collector.ConsumerId c)
Unregisters the given object as a consumer of the data produced by this sensor. Any parameter configurations made by the consumer are also canceled.

Parameters:
c - a ConsumerId value
To do:
review synchronized

setEnabled

public void setEnabled(boolean enable)
Enables/disables this sensor.

Parameters:
enable - a boolean value

isEnabled

public boolean isEnabled()
Returns whether this sensor is currently enabled or not.

Returns:
true if enabled, false otherwise.

getParameters

public Collector.SensorParameter[] getParameters()
Returns the list of parameters supported by this sensor. Such a list includes the original sensor parameters and also meta-parameters implemented on top of those ones by the MetaSensor class itself..

Returns:
a SensorParameter[] value

getParameter

public java.lang.Object getParameter(Collector.SensorParameter p)
Returns the current value assigned to the given parameter.

Parameters:
p - a SensorParameter value
Returns:
an Object value

setParameter

public void setParameter(Collector.ConsumerId c,
                         Collector.SensorParameter p,
                         java.lang.Object v)
Assigns a new value to the given parameter.

Parameters:
c - a ConsumerId value
p - a SensorParameter value
v - an Object value

probe

public Collector.MonitoringData probe(Collector.MonitoringData d)
Probes the current value of the sensor.

Parameters:
d - a MonitoringData value
Returns:
a MonitoringData value

getProvider

public Collector.Monitor getProvider()
Returns the underlaying monitor who actually provides this sensor.

Returns:
the sensor provider

toString

public java.lang.String toString()
Returns a string representation of this MetaSensor object (mostly for debugging purpouses).

Overrides:
toString in class java.lang.Object
Returns:
a String value