public class FilesManager
extends java.lang.Object
FilesManager organizes the files for the zooming:
The folder to access files in this version is read from a java property. In future releases it could be read out of the CDB.
Implementation note: To reduce memory usage, objects of this class
do not read the list of files in the folder until a request of loading
is issued.
File names have the following format: logOutput<StartDate>--<EndDate>.xml
ARCHIVE does not ensure that the logs in a file are only those having the timestamp between the start and the end date in the name of the file. This means that
This has been agreed with ARCHIVE. They claim that there is a constant to tune in the CDB that should avoid this problem. See http://almasw.hq.eso.org/almasw/bin/view/Archive/ArchiveEightDotZero for further details.
| Modifier and Type | Class and Description |
|---|---|
class |
FilesManager.FileNameFilter
The filter for the file names.
|
| Modifier and Type | Field and Description |
|---|---|
java.lang.String |
filesFolder
The folder containing XML files of logs written by ARCHIVE
|
| Constructor and Description |
|---|
FilesManager(java.lang.String folder)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
java.io.File[] |
getFileList(long start,
long end)
Get the XML files of logs between the start and the end date
(in msec as defined in
Date). |
boolean |
getLogs(java.lang.String startDate,
java.lang.String endDate,
ACSRemoteLogListener logListener,
LogTypeHelper minLevel,
LogTypeHelper maxLevel,
ZoomProgressListener zoomListener,
ACSRemoteErrorListener errorListener)
Get logs from files.
|
boolean |
isOperational()
Return
true if the file manager is operative i.e. |
void |
stopLoading()
Stop loading logs.
|
public final java.lang.String filesFolder
public FilesManager(java.lang.String folder)
throws ZoomException
folder - The folder containing files of logsZoomExceptionpublic boolean getLogs(java.lang.String startDate,
java.lang.String endDate,
ACSRemoteLogListener logListener,
LogTypeHelper minLevel,
LogTypeHelper maxLevel,
ZoomProgressListener zoomListener,
ACSRemoteErrorListener errorListener)
throws java.io.FileNotFoundException,
ZoomException
startDate - The start date of the loading (ISO format);
if null the start date is not limited (i.e.
the start date will be that of the first available log in the files)endDate - The end date of the loading (ISO format);
if null the current time is usedlogListener - The listener to send logs tominLevel - The min log level of logs to read from files (inclusive);
if null, the lowest level (TRACE) is usedmaxLevel - The max log level of logs to read from files (inclusive);
if null, the highest log level (EMERGENCY) is usedzoomListener - The listener for monitoring the activity of the zoom engine.
It can be null.errorListener - The listener to be notified about logs that was not possible to parsefalse in case of errors, false otherwise.java.io.FileNotFoundExceptionZoomExceptionACSRemoteLogListener},
ZoomProgressListener}public java.io.File[] getFileList(long start,
long end)
Date).
TODO: use a better heuristic here instead of plain starts/end dates
start - The start date of the XML file (0 means unbounded)end - The end date of the filenull means that an error happened during I/Opublic boolean isOperational()
true if the file manager is operative i.e. if:
The folder of files is checked when the object is created too. However someone from outside could have deleted, renamed or changed the accessing properties of the folder.
Note: this method could be slow if the folder contains a big number of files.
true if the file manager is operativepublic void stopLoading()
stopLoading does nothing if no load is in progress.