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

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

Collaboration diagram for alma::acs::logging::tools::LogFileExtractor:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 LogFileExtractor (String inputFile, String outputFile, Date startDate, Date endDate, String filterName, boolean csvFormat, String cols) throws Exception
Override void xmlEntryReceived (String xmlLogString)
void extract () throws Exception
Override void bytesRead (long bytes)
Override void bytesWritten (long bytes)
Override void logsRead (int numOfLogs)
Override void logsWritten (int numOfLogs)
Override void errorReceived (String xml)

Private Member Functions

void openDestFile ()
boolean checkDate (ILogEntry log)

Private Attributes

long start = -1
long end = -1
String filterFileName = null
FiltersVector filters = null
String inFileName
String destFileName
ACSLogParser parser = null
final int OUTPUT_BUFFER_SIZE = 8192
BufferedWriter outF = null
boolean writeAsCSV = false
CSVConverter csv
IOHelper outHelper

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  inputFile,
String  outputFile,
Date  startDate,
Date  endDate,
String  filterName,
boolean  csvFormat,
String  cols
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:
inputFile The name of the file 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)
csvFormat if true the output is written as CSV instead of XML
cols The fields to write in the CSV
Exceptions:
<code>Exception</code> In case of error


Member Function Documentation

Override void alma::acs::logging::tools::LogFileExtractor::bytesRead long  bytes  )  [inline]
 

Override 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)

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

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

Override void alma::acs::logging::tools::LogFileExtractor::logsRead int  numOfLogs  )  [inline]
 

Override 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

Override void alma::acs::logging::tools::LogFileExtractor::xmlEntryReceived String  xmlLogString  )  [inline]
 

Exceuted when a new log has been read

Parameters:
xmlLogString The XML log read


Member Data Documentation

CSVConverter alma::acs::logging::tools::LogFileExtractor::csv [private]
 

String alma::acs::logging::tools::LogFileExtractor::destFileName [private]
 

long alma::acs::logging::tools::LogFileExtractor::end = -1 [private]
 

String alma::acs::logging::tools::LogFileExtractor::filterFileName = null [private]
 

FiltersVector alma::acs::logging::tools::LogFileExtractor::filters = null [private]
 

String alma::acs::logging::tools::LogFileExtractor::inFileName [private]
 

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

IOHelper alma::acs::logging::tools::LogFileExtractor::outHelper [private]
 

The helper to write log into

final int alma::acs::logging::tools::LogFileExtractor::OUTPUT_BUFFER_SIZE = 8192 [private]
 

ACSLogParser alma::acs::logging::tools::LogFileExtractor::parser = null [private]
 

long alma::acs::logging::tools::LogFileExtractor::start = -1 [private]
 

boolean alma::acs::logging::tools::LogFileExtractor::writeAsCSV = false [private]
 


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