Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

alma::acs::logging::io::IOLogsHelper Class Reference

Collaboration diagram for alma::acs::logging::io::IOLogsHelper:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 IOLogsHelper (LoggingClient client)
void loadLogs (BufferedReader br, ACSRemoteLogListener logListener, ACSRemoteErrorListener errorListener, int progressRange)
void saveLogs (String fileName, boolean compress, int level, LogCache cache) throws IOException
void done ()
Override void bytesRead (long bytes)
Override void bytesWritten (long bytes)
Override void logsRead (int numOfLogs)
Override void logsWritten (int numOfLogs)
boolean isPerformingIO ()

Private Member Functions

String formatErrorMsg (String msg)

Private Attributes

IOThread thread = null
ProgressMonitor progressMonitor
IOHelper ioHelper = new IOHelper()
LoggingClient loggingClient = null
long bytesRead
int logsRead
int logsWritten

Detailed Description

This class is intended to support the commons IO operations aiming to keep the LogTableDataModel class shorter and more readable.

This class instantiate a new thread for each load/save. To cleanly close, the done() must be called.

This class allows only one load/save at a time. If an I/O is requested while another one is in progress, an exception is thrown.

This class is not thread safe!

Author:
acaproni


Constructor & Destructor Documentation

alma::acs::logging::io::IOLogsHelper::IOLogsHelper LoggingClient  client  )  [inline]
 

Build an IOCacheHelper object


Member Function Documentation

Override void alma::acs::logging::io::IOLogsHelper::bytesRead long  bytes  )  [inline]
 

Moves the progress bar of the progress monitor

See also:
alma.acs.logging.engine.io.IOPorgressListener::bytesRead(long)

Override void alma::acs::logging::io::IOLogsHelper::bytesWritten long  bytes  )  [inline]
 

See also:
alma.acs.logging.engine.io.IOPorgressListener::bytesWritten(long)

void alma::acs::logging::io::IOLogsHelper::done  )  [inline]
 

Release the resource acquired by this object It terminates the thread so the object can be deleted by the JVM

NOTE: when the thread is terminate it is not possible to request asynchronous services

String alma::acs::logging::io::IOLogsHelper::formatErrorMsg String  msg  )  [inline, private]
 

Return a string formatted for JOptionPane making a word wrap

Parameters:
error The error i.e. the exception
msg The message to show
Returns:
A formatted string

boolean alma::acs::logging::io::IOLogsHelper::isPerformingIO  )  [inline]
 

Check if a load/save is in progress

Returns:
true if a load/save is in progress

void alma::acs::logging::io::IOLogsHelper::loadLogs BufferedReader  br,
ACSRemoteLogListener  logListener,
ACSRemoteErrorListener  errorListener,
int  progressRange
[inline]
 

Load the logs from the given file in the Cache appending their starting positions in the index vector.

The logs are appended at the end of the cache as well as the new positions are appended at the end of the index vector. The load is performed in a thread as it might be very slow

The filter, discard level and audience of the engine are applied while loading. This is done by applying to ioHelper the same constraints defined in the LCEngine.

Parameters:
br The the file to read
logListener The callback for each new log read from the IO
errorListener The listener of errors
progressRange The range of the progress bar (if <=0 the progress bar is undetermined)

Override void alma::acs::logging::io::IOLogsHelper::logsRead int  numOfLogs  )  [inline]
 

Change the label of the progress monitor

See also:
alma.acs.logging.engine.io.IOPorgressListener::logsRead(int)

Override void alma::acs::logging::io::IOLogsHelper::logsWritten int  numOfLogs  )  [inline]
 

See also:
alma.acs.logging.engine.io.IOPorgressListener::logsWritten(int)

void alma::acs::logging::io::IOLogsHelper::saveLogs String  fileName,
boolean  compress,
int  level,
LogCache  cache
throws IOException [inline]
 

Save the logs in a file.

Parameters:
fileName The name of the file to save
compress true if the file must be compressed (GZIP)
level The level of compression (ignored if compress is false)
cache The cache that contains the logs
Exceptions:
IOException 
See also:
saveLogsFromThread


Member Data Documentation

long alma::acs::logging::io::IOLogsHelper::bytesRead [private]
 

The bytes read during a load

IOHelper alma::acs::logging::io::IOLogsHelper::ioHelper = new IOHelper() [private]
 

The IOHelper performing load and save

LoggingClient alma::acs::logging::io::IOLogsHelper::loggingClient = null [private]
 

The logging client

int alma::acs::logging::io::IOLogsHelper::logsRead [private]
 

The number of logs read while loading

int alma::acs::logging::io::IOLogsHelper::logsWritten [private]
 

The number of logs read while saving

ProgressMonitor alma::acs::logging::io::IOLogsHelper::progressMonitor [private]
 

The dialog

IOThread alma::acs::logging::io::IOLogsHelper::thread = null [private]
 

The Thread executing I/O

Returns:


The documentation for this class was generated from the following file:
Generated on Thu Apr 30 02:53:54 2009 for ACS Java API by doxygen 1.3.8