public abstract class CachingLocalDataBuilder extends Object implements LocalDataBuilder, ProgressListener
Map, and reuses it
build(Engine, TemplateEnvironment)is invoked again during the same processing session. This is useful when the building of the local data is an expensive operation, and the builder is used for multiple source files.
Map will be deleted at the end of the processing
|Constructor and Description|
|Modifier and Type||Method and Description|
Override this method in your local data builder class.
Takes care of caching, and calls
Discards the cached result on
public final Map build(Engine eng, TemplateEnvironment env) throws Exception
build(Engine)if no cached result is available.
public void notifyProgressEvent(Engine engine, int event, File src, int pMode, Throwable error, Object param) throws Exception
TemplateEnvironment is not passed, to ensure that the
Map doesn't depend on the source file the builder
is used for, so reusing the result for other source files is safe.
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
eventthe source file or null.
pMode- Depending on
eventthe proccessing mode (
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_WARNINGit is a
Stringthat describles the reason of warning.