net.logAnalyzer.analysis
Class LAAnalyzer

java.lang.Object
  extended bynet.logAnalyzer.analysis.LAAnalyzer
Direct Known Subclasses:
LAPeriodicAnalyzer

public abstract class LAAnalyzer
extends java.lang.Object

This class defines a template for log analyzers. A log analyzer analysis a messageLabel and generate an LAAnalysis.

Version:
0.1
Author:
Karim REFEYTON

Constructor Summary
LAAnalyzer(AnalyzerDefinition definition)
          Constructs a new analyzer from an analyzer definition.
LAAnalyzer(AnalyzerDefinition definition, java.text.SimpleDateFormat dateFormat)
          Constructs a new analyzer from an analyzer definition and a date format.
 
Method Summary
 void analyze(LAMessage message, LALogHandler handler)
          Analyzes the current message.
protected abstract  void analyzeMessage(LAMessage message)
          Analyze the current messageLabel.
abstract  boolean canAnalyze(LALogHandler handler)
          Returns true if the handler messages can be analyzed.
 LAAnalysis getAnalysis()
          Returns the result of the analysis.
 java.text.SimpleDateFormat getDateFormat()
          Returns the date format.
 java.lang.String getLabel()
          Returns the label of the analyzer.
 java.lang.String getName()
          Returns the name of the analyzer.
 java.text.NumberFormat getPercentFormat()
          Returns the percent format.
abstract  void init(LALogHandler handler)
          Make all initializations to prepare analysis.
 void initAnalyze(LALogHandler handler)
          Make all initializations to prepare analysis.
abstract  void release(LALogHandler handler)
          Make all releases after the analysis.
 void releaseAnalyze(LALogHandler handler)
          Make all releases after the analysis.
protected  void setAnalysis(LAAnalysis analysis)
          Sets the result of the analysis.
protected  void skipMessage(LAMessage message, java.lang.Exception exception)
          Skips the specified message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LAAnalyzer

public LAAnalyzer(AnalyzerDefinition definition)
Constructs a new analyzer from an analyzer definition.

Parameters:
definition - Definition of the analyzer.

LAAnalyzer

public LAAnalyzer(AnalyzerDefinition definition,
                  java.text.SimpleDateFormat dateFormat)
Constructs a new analyzer from an analyzer definition and a date format.

Parameters:
definition - Definition of the analyzer.
dateFormat - Date format.
Method Detail

getAnalysis

public final LAAnalysis getAnalysis()
Returns the result of the analysis.

Returns:
Result of the analysis.

setAnalysis

protected final void setAnalysis(LAAnalysis analysis)
Sets the result of the analysis.

Parameters:
analysis - Result of the analysis.

getDateFormat

public final java.text.SimpleDateFormat getDateFormat()
Returns the date format.

Returns:
Date format.

getPercentFormat

public final java.text.NumberFormat getPercentFormat()
Returns the percent format.

Returns:
Percent format.

getLabel

public final java.lang.String getLabel()
Returns the label of the analyzer.

Returns:
LAAnalyzer label.

getName

public final java.lang.String getName()
Returns the name of the analyzer.

Returns:
LAAnalyzer name.

canAnalyze

public abstract boolean canAnalyze(LALogHandler handler)
                            throws UnknownOrLiteralConverterException
Returns true if the handler messages can be analyzed. For example, it controls if all needed converters are presents.

Parameters:
handler - Log handler using the analyzer.
Returns:
true if the handler messages can be analyzed.
Throws:
UnknownOrLiteralConverterException - If a column is missing.

initAnalyze

public final void initAnalyze(LALogHandler handler)
Make all initializations to prepare analysis. Call canAnalyze(LALogHandler) and init(LALogHandler);

Parameters:
handler - Log handler using the analyzer.

init

public abstract void init(LALogHandler handler)
Make all initializations to prepare analysis. Specific analyzer implementation.

Parameters:
handler - Log handler using the analyzer.

analyze

public final void analyze(LAMessage message,
                          LALogHandler handler)
Analyzes the current message. Call analyzeMessage(LAMessage), the analyzer specific implementation. If an exception is thrown, call skipMessage(LAMessage, Exception).

Parameters:
message - messageLabel to analysis.
handler - Log handler using the analyzer.

analyzeMessage

protected abstract void analyzeMessage(LAMessage message)
                                throws UnknownOrLiteralConverterException
Analyze the current messageLabel. Specific analyzer implementation.

Parameters:
message - messageLabel to analyze.
Throws:
UnknownOrLiteralConverterException - If a converter or a literal can't be handled by the analyzer.

skipMessage

protected void skipMessage(LAMessage message,
                           java.lang.Exception exception)
Skips the specified message. Called by analyze(LAMessage, LALogHandler) when the previous call to analyzeMessage(LAMessage) has thrown an UnknownOrLiteralConverterException. This implementation do nothing.

Parameters:
message - messageLabel to skip.
exception - Exception thrown during analysis.

releaseAnalyze

public final void releaseAnalyze(LALogHandler handler)
Make all releases after the analysis. Call release(LALogHandler).

Parameters:
handler - Log handler using the analyzer.

release

public abstract void release(LALogHandler handler)
Make all releases after the analysis. Specific analyzer implementation.

Parameters:
handler - Log handler using the analyzer.


Copyright © 2006 null. All Rights Reserved.