|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectutil.PropertyContainer
util.PropertyResources
util.PropertyBundles
util.rmi.RmiPropertyContainer
util.rmi.AbstractRmiCaster
stella.sensor.SensorRepository
public class SensorRepository
This class acts as a repository for a whole bundle of sensor values. It has to have local access to the sensors, thus it must be started within the same virtual machine as the sensors it monitors, thus it will be started from within a weather station.
| Nested Class Summary | |
|---|---|
protected class |
SensorRepository.Averager
This class collects all data events generated during the averaging interval. |
| Nested classes/interfaces inherited from class util.PropertyResources |
|---|
PropertyResources.URLResource |
| Field Summary | |
|---|---|
private Map<String,List<DataEvent>> |
average
The hash map used for buffering the data events. |
private SensorRepository.Averager |
averagethread
The average thread for notification of data listeners. |
private List<Object> |
collect
The data-collector classes to use for processing the averages. |
private static boolean |
DEFBIND
The default auto-binding. |
static String |
DEFBINDNAME
The default binding name. |
static long |
DEFTIMERINTERVAL
The default sampling intervall. |
private boolean |
isScheduled
Averager scheduling may not start before the first data event. |
static String |
KEY_BIND
The referring to auto-binding of the sensor repository. |
static String |
KEY_DATACOLLECTOR
The key linked to the properties of the data collector class. |
static String |
KEY_IGNORE
The key linked to the sensor that should not be monitored. |
static String |
KEY_TIMERINTERVAL
The key linked to the scheduling intervall of the timer, in ms. |
private Shelf<Map<String,DataEvent>> |
longterm
Stores a number of averaged data events mappings. |
private Map<String,DataEvent> |
lookup
The look-up table matching sensor names to actual data events. |
private Timer |
schedule
The timer class used for scheduling the data collector. |
private WeatherSurveying |
station
A reference to the weather station for deregistering on exit. |
private Map<String,Boolean> |
valid
The last data event received was valid. |
| Fields inherited from class util.rmi.AbstractRmiCaster |
|---|
ALTERNATEHOST, ALTERNATEPORT, KEY_BINDNAME, KEY_EXPORTPORT, KEY_REGISTRYHOST, KEY_REGISTRYPORT |
| Fields inherited from class util.PropertyBundles |
|---|
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES |
| Fields inherited from class util.PropertyResources |
|---|
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset |
| Fields inherited from class util.PropertyContainer |
|---|
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR |
| Fields inherited from interface stella.rmi.RmiDataDepositing |
|---|
NAMING_EXTENSION |
| Fields inherited from interface util.ResourceSupplying |
|---|
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME |
| Fields inherited from interface util.PropertySupplying |
|---|
CONFIG, KEY_CLASS |
| Constructor Summary | |
|---|---|
SensorRepository(Map<String,String> prop)
Constructs a new readout-repository. |
|
| Method Summary | |
|---|---|
boolean |
addRmiDataCollector(RmiDataCollecting rmicollect)
Registers late-comming rmi data-collectors. |
void |
dataAvailable(DataEvent de)
Receives an incoming DataEvent. |
void |
exit()
Exits the read-out repository. |
DataEvent |
getActualData(String name)
Returns the last data event received from the sensor with the given name. |
long |
getBaseInterval()
For convenience, return the base timer interval. |
void |
init()
Initializes the read-out repository. |
protected void |
initTimer(List<String> files)
Initializes the timer class scheduler and the DataCollecting
classes for use with this short-average repository. |
boolean |
isValidData(String name)
Returns true, if the last data event received for the given sensor name was a valid one. |
void |
registerSensors(WeatherSurveying caller)
Initalizes the repository sensors. |
boolean |
removeRmiDataCollector(RmiDataCollecting rmicollect)
Deregisters an rmi data-collector. |
void |
rmiAddParameter(URL info)
Throws an unsupported operation exception-sensors are read-only. |
Object |
rmiGet(String name)
Returns the actual value of the stated sensor. |
Set<String> |
rmiGetAllParameterNames()
Returns the names of all sensors observed by this repository as a set. |
void |
rmiRemoveParameter(String info)
Throws an unsupported operation exception-sensors are read-only. |
Object |
rmiSet(String name,
Object to)
Throws an unsupported operation exception-sensors are read-only. |
String |
toString()
Returns the list of served sensor names. |
| Methods inherited from class util.rmi.AbstractRmiCaster |
|---|
bindAlternate, bindToRegistry, bindToRegistry, bindToRegistry, casterExit, casterExit, getBindName, getBindName, isValid, unbindFromRegistry, unbindFromRegistry |
| Methods inherited from class util.rmi.RmiPropertyContainer |
|---|
containsRemoteProperty, getRemoteProperties, getRemoteProperty, setRemoteProperty |
| Methods inherited from class util.PropertyBundles |
|---|
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource |
| Methods inherited from class util.PropertyResources |
|---|
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, keyCreate, keyCreate, reload, setApplet |
| Methods inherited from class util.PropertyContainer |
|---|
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, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface util.rmi.RmiCaster |
|---|
bindToRegistry, isValid, unbindFromRegistry |
| Methods inherited from interface util.ResourceSupplying |
|---|
getResource, getResourceAsStream, getResources |
| Methods inherited from interface util.PropertySupplying |
|---|
defaultBoolean, 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, stringProperties |
| Field Detail |
|---|
public static final String KEY_IGNORE
public static final String KEY_BIND
public static final String KEY_DATACOLLECTOR
public static final String KEY_TIMERINTERVAL
private static final boolean DEFBIND
public static final String DEFBINDNAME
public static final long DEFTIMERINTERVAL
private WeatherSurveying station
private Map<String,DataEvent> lookup
private Map<String,Boolean> valid
private Map<String,List<DataEvent>> average
private Shelf<Map<String,DataEvent>> longterm
private Timer schedule
private SensorRepository.Averager averagethread
private boolean isScheduled
private List<Object> collect
| Constructor Detail |
|---|
public SensorRepository(Map<String,String> prop)
throws RemoteException
#KEY_LIST or the #KEY_FILE keys
are given. registerSensors(stella.sensor.WeatherSurveying) method must
be called.
RemoteException| Method Detail |
|---|
public void init()
KEY_BIND key.
init in interface Initializableinit in class PropertyResourcespublic void exit()
KEY_BIND key.
exit in interface ExitCleaningexit in class AbstractRmiCasterpublic void registerSensors(WeatherSurveying caller)
WeatherSurveying for its list of sensors and registers to all of
them that are not explicetly forbidden in the KEY_IGNORE list.
public void dataAvailable(DataEvent de)
DataEvent. This data event is stored in
the lookup-table, using its RmiEvent.getSourceName() method
as a key.
dataAvailable in interface DataListenerpublic DataEvent getActualData(String name)
public boolean isValidData(String name)
public long getBaseInterval()
public Object rmiGet(String name)
throws RemoteException
RawDataEvent.getPhysical(), the sensor's raw data,
as returned
by the RawDataEvent.getRaw() method is returned.
rmiGet in interface RmiParameterClusteringRemoteException
public Object rmiSet(String name,
Object to)
throws RemoteException
rmiSet in interface RmiParameterClusteringRemoteException
public void rmiAddParameter(URL info)
throws RemoteException
rmiAddParameter in interface RmiParameterClusteringRemoteException
public void rmiRemoveParameter(String info)
throws RemoteException
rmiRemoveParameter in interface RmiParameterClusteringRemoteException
public Set<String> rmiGetAllParameterNames()
throws RemoteException
rmiGetAllParameterNames in interface RmiParameterClusteringRemoteException
public boolean addRmiDataCollector(RmiDataCollecting rmicollect)
throws RemoteException
addRmiDataCollector in interface RmiDataDepositingRemoteException
public boolean removeRmiDataCollector(RmiDataCollecting rmicollect)
throws RemoteException
removeRmiDataCollector in interface RmiDataDepositingRemoteExceptionpublic String toString()
toString in class PropertyContainerprotected void initTimer(List<String> files)
DataCollecting
classes for use with this short-average repository. All valid
data collectors (non-null returns from
AbstractDataCollector.createDataCollector(java.util.Map)) are than servered
within one timer task. Note that it is not possible to use one
short-average repository with different averaging intervalls, but the
registered listeners can define different multiples of the base
interval.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||