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

Inheritance diagram for alma::acs::logging::io::IOLogsHelper:
Inheritance graph
[legend]
Collaboration diagram for alma::acs::logging::io::IOLogsHelper:
Collaboration graph
[legend]

List of all members.

Classes

class  LoadLogs
class  SaveLogs

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 ()
void bytesRead (long bytes)
void bytesWritten (long bytes)
void logsRead (int numOfLogs)
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

References loggingClient.


Member Function Documentation

void alma::acs::logging::io::IOLogsHelper::bytesRead ( long  bytes  )  [inline]
void alma::acs::logging::io::IOLogsHelper::bytesWritten ( long  bytes  )  [inline]
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

References alma::acs::logging::io::IOThread::stopThread(), and thread.

Referenced by alma::acs::logging::table::LogTableDataModel::close().

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

References thread.

Referenced by alma::acs::logging::table::LogTableDataModel::IOInProgress().

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)

References thread.

Referenced by alma::acs::logging::table::LogTableDataModel::loadFromFile(), and alma::acs::logging::table::LogTableDataModel::loadFromURL().

void alma::acs::logging::io::IOLogsHelper::logsRead ( int  numOfLogs  )  [inline]
void alma::acs::logging::io::IOLogsHelper::logsWritten ( int  numOfLogs  )  [inline]
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

References thread.

Referenced by alma::acs::logging::table::LogTableDataModel::saveFile().


Member Data Documentation

The bytes read during a load

Referenced by bytesRead(), and alma::acs::logging::io::IOLogsHelper::LoadLogs::run().

The number of logs read while loading

Referenced by logsRead(), and alma::acs::logging::io::IOLogsHelper::LoadLogs::run().

The number of logs read while saving

Referenced by logsWritten(), and alma::acs::logging::io::IOLogsHelper::SaveLogs::run().

The Thread executing I/O

Returns:

Referenced by done(), isPerformingIO(), loadLogs(), and saveLogs().


The documentation for this class was generated from the following file:

Generated by  doxygen 1.6.2