public class DailyDump extends AbstractRmiListener implements RmiDataListener
KEY_FILE
and the KEY_BIND. The latter one points to the binding name of
the remote caster.
If the file key is not present it is constructed from the binding
name by stripping the host information from the binding name and
adding the DEFEXTENSION to it.
This class listens to a single sensor and dumps only its raw data. If the
data event received is a subclass of DataEvent and the main
value of the data event links to a weather indicator, the current status of
the weather as defined by this single sensor is added after the
raw data using the KEY_GOOD and KEY_BAD keys. Note that
it may not be a good idea to set one of these two strings to a whitespace
string because some plot-programs may have difficulties reading varying
number of columns.
| Modifier and Type | Class and Description |
|---|---|
private class |
DailyDump.WriterCloseThread
A shutdown hook that closes the argumental writer.
|
PropertyResources.Load, PropertyResources.URLResource| Modifier and Type | Field and Description |
|---|---|
private static String |
DEFBAD
The default good-weather indicator.
|
private static String |
DEFEXTENSION
The default dump file name.
|
private static String |
DEFGOOD
The default good-weather indicator.
|
private BufferedWriter |
dump
The stream the data is writtn to.
|
private DailyDump.WriterCloseThread |
hook
A thread devoted to closing the actually open file on interupts.
|
static String |
KEY_BAD
The key pointing to the string added for good weather.
|
static String |
KEY_BIND
The key pointing to the binding name of the rmi-data caster.
|
static String |
KEY_FILE
The key pointing to the output file.
|
static String |
KEY_GOOD
The key pointing to the string added for good weather.
|
static String |
KEY_PATH
The key pointing to the output dir.
|
private int |
lastmjd
A flag indicating the last dump mjd.
|
KEY_ALIVE, KEY_EXPORTPORT, KEY_INIT, KEY_LISTENERNAME, KEY_RETRY, KEY_RETRYSLEEP, KEY_SHUTDOWNDELAYKEY_NOINITONCREATE, POSTFIX_ALPHABET, POSTFIX_BYTES, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_MODTIME, POSTFIX_URLKEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATORKEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOMECONFIG, KEY_CLASS| Constructor and Description |
|---|
DailyDump(Map prop)
Constructs a new file dump instance.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
deregisterAtCaster(RmiCaster caster,
Class ignored)
Deregisters at the appropriate caster.
|
static void |
main(String[] arg)
Adds the first command line argument as the binding name.
|
private void |
openStream(int mjd)
Opens the file as a stream for writing.
|
protected boolean |
registerAtCaster(RmiCaster caster,
Class ignored)
Registers at the appropriate caster.
|
void |
rmiDataAvailable(DataEvent de)
The data receiving edge.
|
private void |
writeHead()
Writes some header information.
|
allBound, blockBinding, blockBinding, disconnect, exit, getIP, getListenerName, isConnected, listenerName, releaseBinding, releaseBinding, rescanned, startBinding, startBindingcontainsRemoteProperty, 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, setObject, setProperties, setProperty, stringProperties, toStringequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetListenerNamedisconnect, isConnecteddefaultBoolean, 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, stringPropertiespublic static final String KEY_PATH
public static final String KEY_FILE
public static final String KEY_BIND
public static final String KEY_GOOD
public static final String KEY_BAD
private static final String DEFGOOD
private static final String DEFBAD
private static final String DEFEXTENSION
private BufferedWriter dump
private int lastmjd
private DailyDump.WriterCloseThread hook
public DailyDump(Map prop) throws IOException
DEFEXTENSION is asumed.IllegalArgumentException - If no binding-to property is given.IOExceptionpublic void rmiDataAvailable(DataEvent de) throws RemoteException
rmiDataAvailable in interface RmiDataListenerRemoteExceptionprotected boolean registerAtCaster(RmiCaster caster, Class ignored)
registerAtCaster in class AbstractRmiListenerprotected boolean deregisterAtCaster(RmiCaster caster, Class ignored)
deregisterAtCaster in class AbstractRmiListenerprivate void openStream(int mjd)
throws IOException
writeHead() is called.
To ensure proper closing of the file, a shutdown-hook is added to the system.
IOExceptionprivate void writeHead()
throws IOException
IOException - If the stream could not be writtn.public static void main(String[] arg) throws IOException
IOException