net.logAnalyzer.handlers
Class EmptyLogHandler

java.lang.Object
  extended bynet.logAnalyzer.handlers.EmptyLogHandler
All Implemented Interfaces:
LALogHandler, java.lang.Runnable

public class EmptyLogHandler
extends java.lang.Object
implements LALogHandler

Author:
Karim REFEYTON

Constructor Summary
EmptyLogHandler()
          Creates a new empty log handler.
 
Method Summary
 void addLogHandlerListener(LALogHandlerListener listener)
          Adds a listener.
 void fireEndParsing()
          Fires an end parsing event.
 void fireStartParsing()
          Fires a start parsing event.
 LAAnalyzer[] getAnalyzers()
          Returns log analyzers added to the handler with setAnalyzers(LAAnalyzer[]).
 LAConverter getConverter(int index)
          Returns the converter at the specified index.
 LAConverter getConverter(java.lang.String literal)
          Returns the converter identified by the specified literal (for example, "%m" generally returns the messageLabel converter).
 int getConverterIndex(java.lang.String literal)
          Returns the index of the identified by the specified literal.
 LAConverter[] getConverters()
          Returns pattern converters.
 java.lang.Exception getLastException()
          Returns the last exception thrown by the parsing process.
 int getMaxRecords()
          Returns the number of records to parse; 0 for no limitation.
 LAMessage getMessage(int index)
          Returns the messageLabel at the specified position.
 LAConverter getMessageConverter()
          Returns the current messageLabel converter used to extend messageLabel text with unparsed lines.
 LAMessage[] getMessages(int start, int end)
          Returns the messages between specified positions.
 int getPercentDone()
          Returns the done percentage of the parsed file.
 int getSize()
          Returns the real number of messages in the log, not only in cache in case of a load on demand parsed log.
 boolean isParsing()
          Returns true if the handler is currently parsing the log.
 void parse()
          Do nothing expected sending LALogHandlerListener.startParsing(LALogHandler) and LALogHandlerListener.endParsing(LALogHandler) events.
 void removeLogHandlerListener(LALogHandlerListener listener)
          Removes a listener.
 void run()
           
 void setAnalyzers(LAAnalyzer[] newAnalyzers)
          Adds new analyzers to the log handler.
 void setMaxRecords(int maxRecords)
          Number of records to parse; 0 for no limitation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmptyLogHandler

public EmptyLogHandler()
Creates a new empty log handler.

Method Detail

addLogHandlerListener

public void addLogHandlerListener(LALogHandlerListener listener)
Description copied from interface: LALogHandler
Adds a listener.

Specified by:
addLogHandlerListener in interface LALogHandler
Parameters:
listener - Lister to add.

fireEndParsing

public void fireEndParsing()
Description copied from interface: LALogHandler
Fires an end parsing event.

Specified by:
fireEndParsing in interface LALogHandler

fireStartParsing

public void fireStartParsing()
Description copied from interface: LALogHandler
Fires a start parsing event.

Specified by:
fireStartParsing in interface LALogHandler

getAnalyzers

public LAAnalyzer[] getAnalyzers()
Description copied from interface: LALogHandler
Returns log analyzers added to the handler with LALogHandler.setAnalyzers(LAAnalyzer[]).

Specified by:
getAnalyzers in interface LALogHandler
Returns:
Log analyzers.

getConverter

public LAConverter getConverter(int index)
Description copied from interface: LALogHandler
Returns the converter at the specified index.

Specified by:
getConverter in interface LALogHandler
Parameters:
index - Converter index.
Returns:
Converter or null if unknown.

getConverter

public LAConverter getConverter(java.lang.String literal)
                         throws UnknownOrLiteralConverterException
Description copied from interface: LALogHandler
Returns the converter identified by the specified literal (for example, "%m" generally returns the messageLabel converter).

Specified by:
getConverter in interface LALogHandler
Parameters:
literal - Converter literal as %m" or %"p" or "%H{CLIENTIP}".
Returns:
Converter or null if unknown.
Throws:
UnknownOrLiteralConverterException - If the literal does not identify a non literal column.

getConverterIndex

public int getConverterIndex(java.lang.String literal)
                      throws UnknownOrLiteralConverterException
Description copied from interface: LALogHandler
Returns the index of the identified by the specified literal.

Specified by:
getConverterIndex in interface LALogHandler
Parameters:
literal - Converter literal as %m" or %"p" or "%H{CLIENTIP}".
Returns:
Index of the converter.
Throws:
UnknownOrLiteralConverterException - If the literal does not identify a non literal column.

getConverters

public LAConverter[] getConverters()
Description copied from interface: LALogHandler
Returns pattern converters.

Specified by:
getConverters in interface LALogHandler
Returns:
Pattern converters.

getLastException

public java.lang.Exception getLastException()
Description copied from interface: LALogHandler
Returns the last exception thrown by the parsing process.

Specified by:
getLastException in interface LALogHandler
Returns:
Last exception or null parsing was succesfull.

getMaxRecords

public int getMaxRecords()
Description copied from interface: LALogHandler
Returns the number of records to parse; 0 for no limitation.

Specified by:
getMaxRecords in interface LALogHandler
Returns:
maxRecords Number of records.

getMessage

public LAMessage getMessage(int index)
Description copied from interface: LALogHandler
Returns the messageLabel at the specified position.

Specified by:
getMessage in interface LALogHandler
Parameters:
index - Physical index of the messageLabel in the log file.
Returns:
Message.

getMessageConverter

public LAConverter getMessageConverter()
Description copied from interface: LALogHandler
Returns the current messageLabel converter used to extend messageLabel text with unparsed lines.

Specified by:
getMessageConverter in interface LALogHandler
Returns:
Message converter.
See Also:
LAMessage.extendsMessage(String)

getMessages

public LAMessage[] getMessages(int start,
                               int end)
Description copied from interface: LALogHandler
Returns the messages between specified positions. Uses LALogHandler.getMessage(int)to read messageLabel from the log file.

Specified by:
getMessages in interface LALogHandler
Parameters:
start - start physicial index (included in the result).
end - end physical index (included in the result).
Returns:
messages.

getPercentDone

public int getPercentDone()
Description copied from interface: LALogHandler
Returns the done percentage of the parsed file. If the handler is not parsing, returns 0.

Specified by:
getPercentDone in interface LALogHandler
Returns:
Done percentage.

getSize

public int getSize()
Description copied from interface: LALogHandler
Returns the real number of messages in the log, not only in cache in case of a load on demand parsed log.

Specified by:
getSize in interface LALogHandler
Returns:
physical number of messages.

isParsing

public boolean isParsing()
Description copied from interface: LALogHandler
Returns true if the handler is currently parsing the log.

Specified by:
isParsing in interface LALogHandler
Returns:
true if parsing; false otherwise.

parse

public void parse()
           throws ParsingException
Do nothing expected sending LALogHandlerListener.startParsing(LALogHandler) and LALogHandlerListener.endParsing(LALogHandler) events.

Specified by:
parse in interface LALogHandler
Throws:
ParsingException - If can't parse messageLabel.
See Also:
LALogHandler.parse()

removeLogHandlerListener

public void removeLogHandlerListener(LALogHandlerListener listener)
Description copied from interface: LALogHandler
Removes a listener.

Specified by:
removeLogHandlerListener in interface LALogHandler
Parameters:
listener - Lister to remove.

setAnalyzers

public void setAnalyzers(LAAnalyzer[] newAnalyzers)
Description copied from interface: LALogHandler
Adds new analyzers to the log handler.

Specified by:
setAnalyzers in interface LALogHandler
Parameters:
newAnalyzers - Analyzers to add.

setMaxRecords

public void setMaxRecords(int maxRecords)
Description copied from interface: LALogHandler
Number of records to parse; 0 for no limitation.

Specified by:
setMaxRecords in interface LALogHandler
Parameters:
maxRecords - Number of records.

run

public void run()
Specified by:
run in interface java.lang.Runnable


Copyright © 2006 null. All Rights Reserved.