public abstract class AbstractSensor extends AbstractRmiCaster implements Telemetering, RmiErrorCaster, Initializable, ExitCleaning
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,
CumulativeSensorPropertyResources.Load, PropertyResources.URLResource| Modifier and Type | Field and Description |
|---|---|
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.
|
ALTERNATEHOST, ALTERNATEPORT, KEY_EXPORTPORT, KEY_REGISTRYHOST, KEY_REGISTRYPORTKEY_NOINITONCREATE, POSTFIX_ALPHABET, POSTFIX_BYTES, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_MODTIME, POSTFIX_URLKEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATORCONFIG, KEY_CLASSKEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME| Modifier | Constructor and Description |
|---|---|
protected |
AbstractSensor(Map<String,String> qualify)
Constructs a fully-qualified sensor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addRmiErrorListener(RmiErrorListener ear)
Adds an
RmiErrorListener to the registered listeners. |
static Telemetering |
createSensor(Map<String,String> 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.
|
bindToRegistry, bindToRegistry, bindToRegistry, bindToRegistry, bindToRegistry, bindToRegistry, casterExit, casterExit, getBindName, isValid, unbindFromRegistry, unbindFromRegistrycontainsRemoteProperty, getRemoteProperties, getRemoteProperty, setRemotePropertyclone, createFrom, createFrom, createFrom, createInstance, getApplet, getAsResources, getLocate, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, hasLocalURLs, initProperties, keyCreate, keyCreate, reload, setAppletaugment, augment, augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, parseObject, reload, removeProperty, requires, rescanned, setObject, setProperties, setProperty, stringPropertiesequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcancel, getReading, getTimeOfRead, validReadingdefaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringPropertiesbindToRegistry, isValid, unbindFromRegistrypublic 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
protected AbstractSensor(Map<String,String> qualify)
group - The ThreadGroup this thread belongs to.name - The name of this thread (sensor).qualify - The Map object describing this sensor.public void init()
throws InitException
init in interface InitializableInitExceptionpublic 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<String,String> 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 Telemeteringpublic 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.RemoteExceptionpublic 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.