alma::acs::logging::tools::LogFileExtractor Class Reference

Inheritance diagram for alma::acs::logging::tools::LogFileExtractor:
Inheritance graph
[legend]
Collaboration diagram for alma::acs::logging::tools::LogFileExtractor:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 LogFileExtractor (String inputFiles[], String outputFile, Date startDate, Date endDate, String filterName, LogConverter converter) throws Exception
void extract () throws Exception
void bytesRead (long bytes)
void bytesWritten (long bytes)
void logsRead (int numOfLogs)
void logsWritten (int numOfLogs)
void errorReceived (String xml)
void logEntryReceived (ILogEntry logEntry)

Private Member Functions

void openDestFile ()
boolean checkDate (ILogEntry log)

Private Attributes

long start = -1
long end = -1
String filterFileName = null
FiltersVector filters = null
String[] inFileNames
String destFileName
final int OUTPUT_BUFFER_SIZE = 8192
BufferedWriter outF = null
final LogConverter converter

Detailed Description

An object to extract the logs that matches the given criteria. It reads the input file and parse each log and writes in the output all the logs matching the criteria. It is possible to specify a start and/or end date or pass the name of a filter to load. The filters are the same used by jlog so jlog can be used to edit and save such file.

Author:
acaproni

Constructor & Destructor Documentation

alma::acs::logging::tools::LogFileExtractor::LogFileExtractor ( String  inputFiles[],
String  outputFile,
Date  startDate,
Date  endDate,
String  filterName,
LogConverter  converter 
) throws Exception [inline]

Constructor The parameters defines the criteria. They can be null (but not all null of course). All the criteria are applied in AND. If the start/end date are not present, the dates are not checked.

Parameters:
inputFiles The name of the files of logs for input
outputFile The name of the file with the selected logs
startDate The start date of logs (can be null)
endDate The end date of the logs (can be null)
filterName The name of a file of filters to apply to select logs (can be null)
converter The convert to save logs in different output formats
Exceptions:
<code>Exception</code> In case of error

References converter, destFileName, end, filterFileName, filters, inFileNames, com::cosylab::logging::engine::FiltersVector::loadFilters(), and start.


Member Function Documentation

void alma::acs::logging::tools::LogFileExtractor::bytesRead ( long  bytes  )  [inline]
void alma::acs::logging::tools::LogFileExtractor::bytesWritten ( long  bytes  )  [inline]
boolean alma::acs::logging::tools::LogFileExtractor::checkDate ( ILogEntry  log  )  [inline, private]

Check if the date of the log is between the requested start and end date

Parameters:
log The log to check
Returns:
true if the time stamp of the log is between the start and the end date (inclusive)

References end, com::cosylab::logging::engine::log::ILogEntry::getField(), and start.

Referenced by logEntryReceived().

void alma::acs::logging::tools::LogFileExtractor::errorReceived ( String  xml  )  [inline]

The method is executed when an error happened building a log from a string.

The parameter is the string that caused the error and it can be

  • the XML that was not possible to parse
  • a cache string if the binary format of logs is in use

The cache string is a string used in the cache whose format might change with different implementation of of the cache.

Parameters:
xml That string that caused the error

Implements com::cosylab::logging::engine::ACS::ACSRemoteErrorListener.

void alma::acs::logging::tools::LogFileExtractor::extract (  )  throws Exception [inline]

Extract the logs from the source to the destination applying the selection criteria given in the constructor

References inFileNames, alma::acs::logging::engine::io::IOHelper::loadLogs(), openDestFile(), and outF.

Referenced by alma::acs::logging::tools::LogAssistant::extractLogs().

void alma::acs::logging::tools::LogFileExtractor::logEntryReceived ( ILogEntry  logEntry  )  [inline]
void alma::acs::logging::tools::LogFileExtractor::logsRead ( int  numOfLogs  )  [inline]
void alma::acs::logging::tools::LogFileExtractor::logsWritten ( int  numOfLogs  )  [inline]
void alma::acs::logging::tools::LogFileExtractor::openDestFile (  )  [inline, private]

Create the BufferedWriter and the IOHelper for writing logs.

This method uses a new IOHelper to open a new file where the logs are saved into. It sets up:

  • the outHelper
  • the outF

References destFileName, and outF.

Referenced by extract().


Member Data Documentation

The converter to format the log before saving

Referenced by logEntryReceived(), and LogFileExtractor().

The name of the output file

Referenced by LogFileExtractor(), and openDestFile().

The name of the file of filter

Referenced by LogFileExtractor().

The filters

Referenced by logEntryReceived(), and LogFileExtractor().

The name of the files for reading

Referenced by extract(), and LogFileExtractor().

BufferedWriter alma::acs::logging::tools::LogFileExtractor::outF = null [private]

The writer to write the destination files

Referenced by extract(), logEntryReceived(), and openDestFile().

The size of the buffer for writing


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

Generated by  doxygen 1.6.2