|
||||||||||
| 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.AbstractRmiListener
stella.sensor.DatabaseNow
public class DatabaseNow
A class that registers as an rmi-data listener to the stated list of sources Whenever a data event is received, the physical value is passed to a database, that only caches the most recent values.
| Nested Class Summary | |
|---|---|
static class |
DatabaseNow.Run
A class to create a a database now instance and run it. |
| Nested classes/interfaces inherited from class util.PropertyResources |
|---|
PropertyResources.URLResource |
| Field Summary | |
|---|---|
private static String |
DEFHOST
The default host. |
private static String |
DEFMAPPING
All sensors that provide a key here have an sql-field value. |
private static String |
DEFSENSORS
The default list of sensors. |
private static String |
DEFWHERE
|
private Map |
fields
The mapping of sensor names as in the dataevents to sql fields. |
static String |
KEY_HOST
The host where the data events are generated. |
static String |
KEY_MAPPING
A look-up table linking sensor names to sql fields. |
static String |
KEY_SENSORS
The list of binding names of the sensors. |
static String |
KEY_WHERE
The key to the where clause for database replacements. |
private GenericSql |
sql
The sql-interface. |
private boolean |
virginfail
False if a propbaly recurrent error has occured. |
| Fields inherited from class util.rmi.AbstractRmiListener |
|---|
KEY_ALIVE, KEY_EXPORTPORT, KEY_INIT, KEY_LISTENERNAME, KEY_RETRY, KEY_RETRYSLEEP, KEY_SHUTDOWNDELAY |
| 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 util.PropertySupplying |
|---|
CONFIG, KEY_CLASS |
| Fields inherited from interface util.ResourceSupplying |
|---|
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME |
| Constructor Summary | |
|---|---|
DatabaseNow(Map props)
Constructs a new databaseNow! object. |
|
| Method Summary | |
|---|---|
protected boolean |
deregisterAtCaster(RmiCaster test,
Class single)
Unregisters from an rmi-data caster. |
boolean |
deregisterCaster(Caster dummy)
This weather database never needs external casters, it only registers at weather sensors. |
Thread |
getLoggerThread(ThreadGroup grp)
This logger is a pure listener, it has now run method. |
void |
init()
Initializes the database-now object. |
protected boolean |
registerAtCaster(RmiCaster test,
Class single)
Registers the database now to this caster, if it is an rmi-data caster. |
boolean |
registerCaster(Caster dummy)
This weather database never needs external casters, it only registers at weather sensors. |
void |
rmiDataAvailable(DataEvent de)
Receives a data event. |
| Methods inherited from class util.rmi.AbstractRmiListener |
|---|
allBound, blockBinding, blockBinding, disconnect, exit, getIP, getListenerName, isConnected, listenerName, releaseBinding, releaseBinding, rescanned, startBinding, startBinding |
| 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, setObject, setProperties, setProperty, stringProperties, toString |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface util.rmi.RmiEventListener |
|---|
getListenerName |
| Methods inherited from interface util.rmi.RmiListener |
|---|
disconnect, isConnected |
| Methods inherited from interface util.ExitCleaning |
|---|
exit |
| 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 |
| Methods inherited from interface util.ResourceSupplying |
|---|
getResource, getResourceAsStream, getResources |
| Field Detail |
|---|
public static final String KEY_HOST
public static final String KEY_SENSORS
public static final String KEY_MAPPING
public static final String KEY_WHERE
private static final String DEFHOST
private static final String DEFSENSORS
private static final String DEFMAPPING
private static final String DEFWHERE
private GenericSql sql
private Map fields
private boolean virginfail
| Constructor Detail |
|---|
public DatabaseNow(Map props)
| Method Detail |
|---|
public void init()
AbstractRmiListener.exit() method
is called.KEY_SENSORS
points to the list of binding names of the sensor. Each entry found
here is combined with the sensor's host to yield a binding name.
Entries in the KEY_MAPPING link the sensor name as provided
in the sensor data event to the appropriate SQL field. To allow data
collection from sensors on different host, the KEY_HOST
property is actually a list of hosts, while the KEY_SENSORS
is a double-list (see StringTool.doubleTokenize(java.lang.String)). It is
within the responsibility of the user to provide equal-size lists in
the KEY_HOST and the outer KEY_SENSORS double list.
init in interface Initializableinit in class PropertyResources
protected boolean registerAtCaster(RmiCaster test,
Class single)
registerAtCaster in class AbstractRmiListener
protected boolean deregisterAtCaster(RmiCaster test,
Class single)
deregisterAtCaster in class AbstractRmiListenerpublic void rmiDataAvailable(DataEvent de)
RawDataEvent,
first the data events source is matched to the appropriate
KEY_MAPPING sql-field. If the sql-connection is open,
the data is then updated in the database using the
GenericSql.replace(java.util.Map, java.lang.String) method with the KEY_WHERE clause
and using a mapping of the sql-name of the sensor to its value.
rmiDataAvailable in interface RmiDataListenerpublic boolean registerCaster(Caster dummy)
registerCaster in interface Loggingpublic boolean deregisterCaster(Caster dummy)
deregisterCaster in interface Loggingpublic Thread getLoggerThread(ThreadGroup grp)
getLoggerThread in interface Logginggrp - The thread group the logger must run in.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||