|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectutil.PropertyContainer
util.PropertyResources
util.PropertyBundles
stella.sensor.AbstractDataCollector
stella.sensor.FileCurrent
public class FileCurrent
A simple class that writes out the data it obtained from the
SensorRepository to a file. If the KEY_MAPLIST
property is given, only sensors present in this list are writtn. The file
(KEY_CURRENT) is writtn
whenever data is available.
Depending on the KEY_APPEND property,
the file is either newly writtn at each call or appended to.
A typical file may look as
# Date nsolz solz 30.09.02 18:10:07* +35.08866* +35.27701*The values given are the physical averages, if available. Otherwise the raw values are given.
KEY_BADFLAG
string added to the value, while for good weather data this string is
replaced with an empty string of equal length.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class util.PropertyResources |
|---|
PropertyResources.URLResource |
| Field Summary | |
|---|---|
private DateFormat |
date
The date formatter to use for output. |
private static boolean |
DEFAPPEND
The default appending behaviour. |
private static String |
DEFBADFLAG
The default setting of the bad-weather indicator. |
private static String |
DEFCURRENT
The default name of the output file. |
private static String |
DEFDATE
The date/time formatter. |
private static long |
DEFINTERVAL
The default notification period in ms. |
private static boolean |
DEFSTRICT
The default adding to file behaviour on incomplete sets. |
private static String |
DEFUNIT
The default unit string. |
private static String |
DEFVALIDFLAG
The default setting of the non-valid-reading indicator. |
private static String |
DEFWEATHER
The default binding name of the weather trigger. |
static String |
KEY_APPEND
The key defining if appending should be enabled. |
static String |
KEY_BADFLAG
The key to the bad-weather indicator. |
static String |
KEY_CURRENT
The key to the file where the current data should be writtn to. |
static String |
KEY_DATE
The key to the date-format string. |
static String |
KEY_MAPLIST
The key to a list of sensor that should be mapped. |
static String |
KEY_STRICT
If true, only data sets containing all sensors are writtn. |
static String |
KEY_UNIT
The key to the default unit string. |
static String |
KEY_VALIDFLAG
The key to the non-valid reading indicator. |
static String |
KEY_WEATHER
The key to the bindname of the weather parameter. |
private List |
map
The list of all sensor names that should be mapped in the output file. |
private Map |
validread
A mapping of sensor names to last valid readings. |
| Fields inherited from class stella.sensor.AbstractDataCollector |
|---|
KEY_CLASS, KEY_INTERVAL, KEY_RMIDATACOLLECT |
| 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.ResourceSupplying |
|---|
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME |
| Fields inherited from interface util.PropertySupplying |
|---|
CONFIG |
| Constructor Summary | |
|---|---|
FileCurrent(Map prop)
Constructs a new file collector. |
|
| Method Summary | |
|---|---|
long |
getInterval()
Returns the notification interval. |
private static boolean |
isValidReading(DataEvent de)
Defines if the handed-over data event consists of valid readings. |
void |
processData(Map sensor,
boolean weather)
The file collector writes out all the data it received in a single file. |
String |
toString()
A short description of the current data collector. |
private void |
writeData(Writer out,
Map data,
boolean weather)
Writes the sensor data to the given stream. |
private void |
writeHeader(Writer out,
Map data)
Writes a header to the specified stream. |
| Methods inherited from class stella.sensor.AbstractDataCollector |
|---|
createDataCollector |
| 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, init, 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.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 |
| Methods inherited from interface util.Initializable |
|---|
init |
| Field Detail |
|---|
public static final String KEY_CURRENT
public static final String KEY_APPEND
public static final String KEY_WEATHER
public static final String KEY_BADFLAG
public static final String KEY_VALIDFLAG
public static final String KEY_MAPLIST
public static final String KEY_STRICT
public static final String KEY_UNIT
public static final String KEY_DATE
private static final long DEFINTERVAL
private static final String DEFCURRENT
private static final boolean DEFAPPEND
private static final String DEFWEATHER
private static final String DEFBADFLAG
private static final String DEFVALIDFLAG
private static final boolean DEFSTRICT
private static final String DEFUNIT
private static final String DEFDATE
private List map
private Map validread
private DateFormat date
| Constructor Detail |
|---|
public FileCurrent(Map prop)
KEY_CURRENT, the
KEY_APPEND, the KEY_STRICT, the KEY_WEATHER
and the two flags,
KEY_BADFLAG and KEY_VALIDFLAG obtain their default
values if not present. If
the KEY_MAPLIST property is set, the look-up list for
the sensors to output is initialized.
| Method Detail |
|---|
public long getInterval()
public void processData(Map sensor,
boolean weather)
sensor - Mapping sensor names to data events.weather - True if current weather is good.
private void writeHeader(Writer out,
Map data)
throws IOException
map look-up
list is defined, only matching sensor names are considered.
IOException
private void writeData(Writer out,
Map data,
boolean weather)
throws IOException
map exists, only sensors given in this list are writtn out.
IOExceptionpublic String toString()
toString in class PropertyContainerprivate static boolean isValidReading(DataEvent de)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||