|
||||||||||
| 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.rmi.FileDump
public class FileDump
A rmi-based data listener. The data received is dumped into a ascii-file.
In the basic version, the only properties used are the 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.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class util.PropertyResources |
|---|
PropertyResources.URLResource |
| Field Summary | |
|---|---|
private static String |
DEFEXTENSION
The default dump file name. |
private BufferedWriter |
dump
The stream the data is writtn to. |
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_PATH
The key pointing to the output dir. |
private static DecimalFormat |
MJD
A formatter for the mjd. |
private double |
nan
A double that replaces NaN's from the data event. |
private boolean |
virgin
A flag indicating that the dump file is new. |
| 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.ResourceSupplying |
|---|
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME |
| Fields inherited from interface util.PropertySupplying |
|---|
CONFIG, KEY_CLASS |
| Constructor Summary | |
|---|---|
FileDump(Map prop)
Constructs a new file dump instance. |
|
| Method Summary | |
|---|---|
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 boolean |
openStream()
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(DataEvent de)
Writes some header information. |
| 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, 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, 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.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_PATH
public static final String KEY_FILE
public static final String KEY_BIND
private static final String DEFEXTENSION
private BufferedWriter dump
private boolean virgin
private double nan
private static final DecimalFormat MJD
| Constructor Detail |
|---|
public FileDump(Map prop)
throws IOException
DEFEXTENSION is asumed.
IllegalArgumentException - If no binding-to property is given.
IOException| Method Detail |
|---|
public void rmiDataAvailable(DataEvent de)
throws RemoteException
rmiDataAvailable in interface RmiDataListenerRemoteException
protected boolean registerAtCaster(RmiCaster caster,
Class ignored)
registerAtCaster in class AbstractRmiListener
protected boolean deregisterAtCaster(RmiCaster caster,
Class ignored)
deregisterAtCaster in class AbstractRmiListener
private boolean openStream()
throws IOException
writeHead(stella.DataEvent) is called.To ensure proper closing of the file, a shutdown-hook is added to the system.
IOException
private void writeHead(DataEvent de)
throws IOException
IOException - If the stream could not be writtn.
public static void main(String[] arg)
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||