org.isam.exehda.services
Interface Monitor


public interface Monitor

The interface Monitor is a facade (design pattern) for accessing underlying monitoring sensors. The main concerns which lead us to follow this organization were: - The monitor would, eventually, be accessed from a remote node; whereas - raw sensor implementations should not ever be individually accessed. The adoption of the facade design pattern allows the monitor to enforce sensor configuration policies which are consistent for all the monitoring consumers. In order to reduce memory consumption, the flyweight design pattern is used for managing Sensor and SensorParameter objects.

Version:
$Date: 2004/04/29 14:22:57 $ $Revision: 1.5 $
Author:
last modified by $Author: lucc $

Nested Class Summary
static class Monitor.Sensor
          Describes a sensor supported by this monitor.
static class Monitor.SensorParameter
          Describes a sensor parameter.
 
Method Summary
 java.lang.Object getSensorParameter(Monitor.SensorParameter p)
          Returns the current value of the given sensor parameter.
 Monitor.SensorParameter[] getSensorParameters(Monitor.Sensor s)
          Lists the parameters supported by the given sensor.
 Monitor.Sensor[] getSensors()
          Lists sensors made available by this monitor.
 boolean isSensorEnabled(Monitor.Sensor s)
          Returns the enable state of the given sensor.
 java.lang.Object probeSensor(Monitor.Sensor s)
          Gets the current value of the given sensor.
 void setSensorEnabled(Monitor.Sensor s, boolean enable)
          Enable/disables the given sensor.
 void setSensorParameter(Monitor.SensorParameter p, java.lang.Object v)
          Configures the given sensor parameter to have the value v.
 

Method Detail

getSensors

public Monitor.Sensor[] getSensors()
Lists sensors made available by this monitor. TO DO: consider using Enumeration for return type. How does it reflect in remote accesses?

Returns:
the currently available sensors.

setSensorEnabled

public void setSensorEnabled(Monitor.Sensor s,
                             boolean enable)
Enable/disables the given sensor.

Parameters:
s - a Sensor
enable - true for enabling the sensor, false otherwise.

isSensorEnabled

public boolean isSensorEnabled(Monitor.Sensor s)
Returns the enable state of the given sensor.

Parameters:
s - a sensor
Returns:
true if the sensor is enabled, false otherwise.

setSensorParameter

public void setSensorParameter(Monitor.SensorParameter p,
                               java.lang.Object v)
Configures the given sensor parameter to have the value v. This operation may be vetoed by the monitor if the sensor is already configured to operate in a finner grain mode. In that case, the effect of calling this method is void. No error condition is signed.

Parameters:
p - a SensorParameter value
v - new value to be assigned to the parameter

getSensorParameter

public java.lang.Object getSensorParameter(Monitor.SensorParameter p)
Returns the current value of the given sensor parameter.

Parameters:
p - a sensor parameter
Returns:
the current value of the given parameter

getSensorParameters

public Monitor.SensorParameter[] getSensorParameters(Monitor.Sensor s)
Lists the parameters supported by the given sensor. TO DO: consider using enumeration for return type. How does it reflect in remote accesses?

Parameters:
s - a sensor
Returns:
an array describing the supported parameters

probeSensor

public java.lang.Object probeSensor(Monitor.Sensor s)
Gets the current value of the given sensor. If the sensor is not currently enabled, null is returned meaning the sensor state is unknown. The returned value may be safely cast to the type returned by the getType() method of the given sensor.

Parameters:
s - an enabled sensor
Returns:
an Object representing the current value of the sensor or null if the given sensor is not enabled.