|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectutil.PropertyContainer
util.rmi.RmiPropertyContainer
util.rmi.AbstractRmiCaster
stella.sensor.AbstractSensor
public abstract class AbstractSensor
The abstract base class used for reading abstract sensors. It is
implemented as a demon thread, which, once started,
keeps reading the sensor values at fixed time intervalls, until the
method cancel() is called. The stop() method of Thread
is deprecated and should not be used.
To work for different kind of sensors, it is assumed that any
sensor has the following properties.
stella.rmi.RmiPropertyBearing are automatically bound.RmiErrorCaster functionality is automatically bound.RmiErrorListener.
This class and therefore all its subclasses support RMI access.
In the basic version a sensor exports its properties to rmi
clients via the stella.rmi.RmiPropertyBearing interface and allows
rmi error listeners to register via the RmiErrorListener
interface. Methods for registering this services to the rmi-registry
are provided but must be called seperately. If the appropriate
property is set the binding is done at construct.
ConvertToPhysical,
SmoothingSensor,
CumulativeSensor| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class util.PropertyContainer |
|---|
PropertyContainer.URLResource |
| Field Summary | |
|---|---|
private ConvertToPhysical |
convert
The conversion tool to render physical quantities from raw readings. |
private static boolean |
DEFBIND
The default auto-binding. |
private Vector |
errlist
The list of ErrorListeners. |
static String |
KEY_BIND
The key in the Map referring to auto-binding of the sensor. |
static String |
KEY_BINDNAME
The key in the Map referring to the bind name of the sensor. |
static String |
KEY_CONVERT
The key pointing to the properties file of the conversion object. |
static String |
KEY_DESCRIPTION
The key in the Map list referring to the name of the sensor. |
static String |
KEY_SENSORNAME
The key in the Map list referring to the name of the sensor. |
| Fields inherited from class util.rmi.AbstractRmiCaster |
|---|
ALTERNATEHOST, ALTERNATEPORT, KEY_EXPORTPORT, KEY_REGISTRYHOST, KEY_REGISTRYPORT |
| Fields inherited from class util.PropertyContainer |
|---|
KEY_LISTSEPARATOR, KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR, KEY_NOINITONCREATE, KEY_RESOURCEBUNDLES |
| Fields inherited from interface util.PropertyBearing |
|---|
CONFIG, KEY_CLASS, KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME |
| Constructor Summary | |
|---|---|
protected |
AbstractSensor(Map qualify)
Constructs a fully-qualified sensor. |
| Method Summary | |
|---|---|
void |
addRmiErrorListener(RmiErrorListener ear)
Adds an RmiErrorListener to the registered listeners. |
static Telemetering |
createSensor(Map qualify)
Creates a sensor using the class name found in the properties file. |
void |
exit()
Unbind from registry, if bound. |
String |
getBindName()
Returns the name of this sensor used for binding. |
ConvertToPhysical |
getConvert()
Returns the ConvertToPhysical instance used by this data sensor
or null if not defined. |
long |
getRespawn()
Returns zero to indicate a threadless sensor. |
String |
getSensorDescription()
Returns a lengthy description of this sensor by parsing through the properties for the KEY_DESCRIPTION entry. |
String |
getSensorInitInfo()
After initialization, we know if we have a conversion object, if we are bound and our name. |
String |
getSensorName()
Returns the name of this sensor. |
void |
init()
Does some initialization immediately after the construction phase. |
TimerTask |
initSensorTimerTask()
Returns null, meaning a thread-less sensor. |
protected void |
notifyErrorListener(ErrorEvent ee)
Notifies all registered ErrorListeners. |
void |
removeRmiErrorListener(RmiErrorListener ear)
Removes an RmiErrorListener from the registered listeners. |
void |
setConvert(ConvertToPhysical ctp)
Sets the ConvertToPhysical instance used by this data sensor. |
String |
status()
A String description of this sensor. |
String |
toString()
A String description of this sensor. |
| Methods inherited from class util.rmi.AbstractRmiCaster |
|---|
bindAlternate, bindToRegistry, bindToRegistry, bindToRegistry, casterExit, casterExit, getBindName, isValid, unbindFromRegistry, unbindFromRegistry |
| Methods inherited from class util.rmi.RmiPropertyContainer |
|---|
containsRemoteProperty, getRemoteProperties, getRemoteProperty, setRemoteProperty |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface stella.sensor.Telemetering |
|---|
cancel, getReading, getTimeOfRead, validReading |
| Methods inherited from interface util.PropertyBearing |
|---|
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getLocalized, getProperties, getProperty, getResource, getResourceAsStream, getResources, has, parseObject, removeProperty, setObject, setProperty, stringProperties |
| Methods inherited from interface util.rmi.RmiCaster |
|---|
bindToRegistry, isValid, unbindFromRegistry |
| Field Detail |
|---|
public static final String KEY_SENSORNAME
public static final String KEY_DESCRIPTION
public static final String KEY_BIND
public static final String KEY_BINDNAME
public static final String KEY_CONVERT
private static final boolean DEFBIND
private transient Vector errlist
private ConvertToPhysical convert
| Constructor Detail |
|---|
protected AbstractSensor(Map qualify)
group - The ThreadGroup this thread belongs to.name - The name of this thread (sensor).qualify - The Map object describing this sensor.| Method Detail |
|---|
public void init()
init in interface Initializableinit in class PropertyContainerpublic void exit()
exit in interface ExitCleaningexit in class AbstractRmiCasterpublic ConvertToPhysical getConvert()
ConvertToPhysical instance used by this data sensor
or null if not defined.
getConvert in interface Telemeteringpublic void setConvert(ConvertToPhysical ctp)
ConvertToPhysical instance used by this data sensor.
setConvert in interface Telemeteringpublic TimerTask initSensorTimerTask()
initSensorTimerTask in interface TelemeteringTelemetering.getRespawn()public long getRespawn()
getRespawn in interface Telemeteringpublic static Telemetering createSensor(Map qualify)
RmiErrorListeners is not possible prior to
sensor construction.
qualify - The properties of the new sensor.public String getSensorName()
getSensorName in interface Telemeteringpublic String getBindName()
getBindName in class AbstractRmiCasterpublic String getSensorDescription()
KEY_DESCRIPTION entry. If this property is
not set, we return the sensor name.
getSensorDescription in interface Telemeteringpublic String getSensorInitInfo()
getSensorInitInfo in interface Telemetering
public void addRmiErrorListener(RmiErrorListener ear)
throws RemoteException
RmiErrorListener to the registered listeners. If the
argument is null, nothing is changed.
addRmiErrorListener in interface RmiErrorCasterear - The listener to add.
RemoteException
public void removeRmiErrorListener(RmiErrorListener ear)
throws RemoteException
RmiErrorListener from the registered listeners.
If the
argument is null, nothing is changed.
removeRmiErrorListener in interface RmiErrorCasterear - The listener to remove.
RemoteExceptionpublic String toString()
toString in class PropertyContainerpublic String status()
status in interface Telemeteringprotected void notifyErrorListener(ErrorEvent ee)
ee - The ErrorEvent to pass to the Listeners.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||