Package fmpp
Interface ProgressListener
- All Known Implementing Classes:
AntProgressListener,CachingLocalDataBuilder,ConsoleProgressListener,LoggerProgressListener,StatisticsProgressListener,TddHashLocalDataBuilder,TerseConsoleProgressListener
public interface ProgressListener
Interface to monitor the events of an
Engine.
The object that implements this interface need to be plugged into the
Engine to receive notifications about its events. For example, if you
add an object as engine attribute or as local data loader to the engine, it
will be notified about the events. Object that has no role other than
listening to events can to be plugged with
Engine.addProgressListener(fmpp.ProgressListener).
Examples of the usage of progress listeners:
- Displaying visually the progress of the processing session for the user.
- Creating statistics about the processing session.
- Implementing a poor man's logging (until no logging support added to FMPP)
- Releasing the resources held by local data loaders and engine attributes when the session is finished.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe processing of a single file has been started.static final intEngine.processhas started the work.static final intAn empty directory was created due to the copyEmptyDirs setting.static final intThe processing of a single file has been finished.static final intEngine.processhas finished the work.static final intA source directory has been ignored (skipped.)static final intThe processing of source was skipped because the output was generated after the last modification of the source file.static final intA warning message has been received from a template or from the engine. -
Method Summary
Modifier and TypeMethodDescriptionvoidnotifyProgressEvent(Engine engine, int event, File src, int pMode, Throwable error, Object param) Method called be the engine to notify events.
-
Field Details
-
EVENT_BEGIN_PROCESSING_SESSION
static final int EVENT_BEGIN_PROCESSING_SESSIONEngine.processhas started the work.- See Also:
-
EVENT_END_PROCESSING_SESSION
static final int EVENT_END_PROCESSING_SESSIONEngine.processhas finished the work.- See Also:
-
EVENT_BEGIN_FILE_PROCESSING
static final int EVENT_BEGIN_FILE_PROCESSINGThe processing of a single file has been started.- See Also:
-
EVENT_END_FILE_PROCESSING
static final int EVENT_END_FILE_PROCESSINGThe processing of a single file has been finished.- See Also:
-
EVENT_IGNORING_DIR
static final int EVENT_IGNORING_DIRA source directory has been ignored (skipped.)- See Also:
-
EVENT_CREATED_EMPTY_DIR
static final int EVENT_CREATED_EMPTY_DIRAn empty directory was created due to the copyEmptyDirs setting.- See Also:
-
EVENT_WARNING
static final int EVENT_WARNINGA warning message has been received from a template or from the engine.- See Also:
-
EVENT_SOURCE_NOT_MODIFIED
static final int EVENT_SOURCE_NOT_MODIFIEDThe processing of source was skipped because the output was generated after the last modification of the source file.- See Also:
-
-
Method Details
-
notifyProgressEvent
void notifyProgressEvent(Engine engine, int event, File src, int pMode, Throwable error, Object param) throws Exception Method called be the engine to notify events.It is guaranteed that this method will not be called concurrently as far as the listener is added to a single
Engineinstance only.- Parameters:
engine- The engine instance where the event has occurred.event- The code of the event: anEVENT_...constant. As new event types can be introduced with new FMPP versions (even if it happens very seldom), a progress listener implementation should survive events that it does not understand. That is, it must not stop with an error, but it should silently ignore the event.src- Depending oneventthe source file or null.pMode- Depending oneventthe proccessing mode (Engine.PMODE_...constant) orEngine.PMODE_NONE. Note that new processing modes may be added as FMPP evolvers, so values that are not known be the progress listener should be handler nicely, and never cause error.error- The error, or null if there was no error.param- Extra information about the event. The class and meaning of object depends on the concrete event:- For
EVENT_WARNINGit is aStringthat describles the reason of warning.
- For
- Throws:
Exception
-