ca.macewan.lmsreporter.api
Interface Analyzer

All Superinterfaces:
Runnable
All Known Implementing Classes:
AbstractAnalyzer

public interface Analyzer
extends Runnable

This is the interface every Analyzer class has to implement. It is more likely you'll want to extend the AbstractAnalyzer class instead.

Version:
0.1
Author:
Erwin Veugelers

Method Summary
 void addAnalysisListener(AnalysisListener al)
          The Analyzer object needs to keep a list of AnalysisListeners and notify them of analysis start, progress, finish and errors.
 void analyze()
          The method called by the application to start the analysis process.
 String getCopyright()
          If this method returns anything, it will be included in the application's user interface for this Analyzer's settings.
 String getDescription()
          The application will read a description for this Analyzer object which will be used in the analyzer selection list.
 Component getSettingsUI()
          Called when the implementing class is selected by the user.
 boolean isRunning()
          Returns true if the analysis is currently running.
 boolean isWaitingForUI()
          Returns true if the analysis is currently suspended, waiting for some user interface action to complete.
 void postProcess()
          Called immediately after the analyze method.
 void preProcess()
          Called immediately before the analyze method.
 void removeAnalysisListener(AnalysisListener al)
          The Analyzer object needs to keep a list of AnalysisListeners and notify them of analysis start, progress, finish and errors.
 void setDescription(String desc)
          The application may set an alternate description for this Analyzer object which will be used in the analyzer selection list.
 void setSources(File snapshotFile, File globalDBFile, File outFile)
          Accepts (and probably stores) the two input files and the output file used by the analysis.
 void setWaitingForUI(boolean waitForUI)
          This method will be called after an AnalysisEvent.TYPE_REQUEST_UI_DISPLAY request by this Analyzer object has completed.
 void stopAnalysis(String info)
          Called when the application wants to interrupt the analysis.
 
Methods inherited from interface java.lang.Runnable
run
 

Method Detail

setSources

public void setSources(File snapshotFile,
                       File globalDBFile,
                       File outFile)
Accepts (and probably stores) the two input files and the output file used by the analysis.

Parameters:
snapshotFile - The WebCT IMS Enterprise snapshot export file.
globalDBFile - The WebCT Global Database CVS export file.
outFile - The output file.

analyze

public void analyze()
The method called by the application to start the analysis process. Note that this method must return before the user interface can show any progress information. The best way to do this is to start a new thread in this method which calls the run method to perform the actual analysis. (This interface extends Runnable after all.)


preProcess

public void preProcess()
                throws AnalysisException
Called immediately before the analyze method. Any last-minute prep work that didn't fit in the settings user interface produced by getSettingsUI should be done here.

Throws:
AnalysisException - Most checked exceptions that may occur in this method should be wrapped inside an AnalysisException for proper notification to the user.

postProcess

public void postProcess()
                 throws AnalysisException
Called immediately after the analyze method. Any cleanup work that couldn't be done in the analysis itself should be done here.

Throws:
AnalysisException - Most checked exceptions that may occur in this method should be wrapped inside an AnalysisException for proper notification to the user.

getSettingsUI

public Component getSettingsUI()
Called when the implementing class is selected by the user. Should return a component, probably a javax.swing.JPanel or something, that gives the user the opprtunity to set options on the Analyzer object before the analysis starts.

Returns:
The component to be used for user input.

isRunning

public boolean isRunning()
Returns true if the analysis is currently running.

Returns:
Whether or not the analysis is currently running.

isWaitingForUI

public boolean isWaitingForUI()
Returns true if the analysis is currently suspended, waiting for some user interface action to complete.

Returns:
Whether or not the analysis is currently waiting for the user interface.

setWaitingForUI

public void setWaitingForUI(boolean waitForUI)
This method will be called after an AnalysisEvent.TYPE_REQUEST_UI_DISPLAY request by this Analyzer object has completed.

Parameters:
waitForUI - Whether or not to wait for the user interface to complete.

stopAnalysis

public void stopAnalysis(String info)
Called when the application wants to interrupt the analysis. Most likely the user canceled the analysis. You are responsible for terminating the analysis gracefully and thread safe, as quickly as possible.

Parameters:
info - Some information as to why the analysis was stopped. You can pass this on to the user by using the AnalysisEvent.setInfo method and then firing the event with type AnalysisEvent.TYPE_FINISHED.

addAnalysisListener

public void addAnalysisListener(AnalysisListener al)
The Analyzer object needs to keep a list of AnalysisListeners and notify them of analysis start, progress, finish and errors.

Parameters:
al - The listener to add to the list.

removeAnalysisListener

public void removeAnalysisListener(AnalysisListener al)
The Analyzer object needs to keep a list of AnalysisListeners and notify them of analysis start, progress, finish and errors.

Parameters:
al - The listener to remove to the list.

setDescription

public void setDescription(String desc)
The application may set an alternate description for this Analyzer object which will be used in the analyzer selection list.

Parameters:
desc - The description of this Analyzer.

getDescription

public String getDescription()
The application will read a description for this Analyzer object which will be used in the analyzer selection list. For proper application integration, your implementation should also override toString to return getDescription().

Returns:
The description of this Analyzer.

getCopyright

public String getCopyright()
If this method returns anything, it will be included in the application's user interface for this Analyzer's settings.

Returns:
The copyright information for this Analyzer.