public interface ProgressListener
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:
Modifier and Type | Field and Description |
---|---|
static int |
EVENT_BEGIN_FILE_PROCESSING
The processing of a single file has been started.
|
static int |
EVENT_BEGIN_PROCESSING_SESSION
Engine.process has started the work. |
static int |
EVENT_CREATED_EMPTY_DIR
An empty directory was created due to the copyEmptyDirs setting.
|
static int |
EVENT_END_FILE_PROCESSING
The processing of a single file has been finished.
|
static int |
EVENT_END_PROCESSING_SESSION
Engine.process has finished the work. |
static int |
EVENT_IGNORING_DIR
A source directory has been ignored (skipped.)
|
static int |
EVENT_SOURCE_NOT_MODIFIED
The processing of source was skipped because the output was generated
after the last modification of the source file.
|
static int |
EVENT_WARNING
A warning message has been received from a template or from the
engine.
|
Modifier and Type | Method and Description |
---|---|
void |
notifyProgressEvent(Engine engine,
int event,
java.io.File src,
int pMode,
java.lang.Throwable error,
java.lang.Object param)
Method called be the engine to notify events.
|
static final int EVENT_BEGIN_PROCESSING_SESSION
Engine.process
has started the work.static final int EVENT_END_PROCESSING_SESSION
Engine.process
has finished the work.static final int EVENT_BEGIN_FILE_PROCESSING
static final int EVENT_END_FILE_PROCESSING
static final int EVENT_IGNORING_DIR
static final int EVENT_CREATED_EMPTY_DIR
static final int EVENT_WARNING
static final int EVENT_SOURCE_NOT_MODIFIED
void notifyProgressEvent(Engine engine, int event, java.io.File src, int pMode, java.lang.Throwable error, java.lang.Object param) throws java.lang.Exception
It is guaranteed that this method will not be called concurrently
as far as the listener is added to a single Engine
instance
only.
engine
- The engine instance where the event has occurred.event
- The code of the event: an EVENT_...
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 on event
the source file or null.pMode
- Depending on event
the proccessing mode
(Engine.PMODE_...
constant) or
Engine.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:
EVENT_WARNING
it is a String
that
describles the reason of warning.
java.lang.Exception