@ConfigurationDescription(properties={@Property(name="IsCritical",type=BOOLEAN,defaultValue="true",description="Whether the event handler is critical and problems handling the event should abort all handling of the current event."),,,,,,,,,}) public class FileMarkHandler extends AbstractEventHandler
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
ADD_FILE
Whether to add a lock file for files from file events.
|
static java.lang.String |
CONF_ADD_FILE
Configuration key for whether to add lock files for files from file events.
|
static java.lang.String |
CONF_DELETE_FILE
Configuration key for whether to delete files from file events.
|
static java.lang.String |
CONF_HANDLE_CONSUMED
Configuration key for whether this handler should also handle files of
which the corresponding file event has been consumed.
|
protected static java.lang.String |
CONF_IS_CRITICAL
Configuration key: Whether the event handler is critical and problems
handling the event should abort all handling of the current event.
|
static java.lang.String |
CONF_MARK_LOCK_FILE
Configuration key for whether to mark the lock file or the data file.
|
static java.lang.String |
CONF_MOVE_FILE
Configuration key for whether to move files from file events.
|
static java.lang.String |
CONF_RENAME_FILE
Configuration key for whether to rename files from file events.
|
static java.lang.String |
CONF_REPLACE_EXISTING
Configuration key for whether to replace an existing target file or a file in the target
folder.
|
static java.lang.String |
CONF_TARGET_FOLDER
Configuration key for the name of the target folder in case the files of
file events should be moved.
|
static java.lang.String |
CONF_TARGET_NAME
Configuration key for how to set the new name for files from file events.
|
protected boolean |
DELETE_FILE
Whether to delete the files from file events.
|
protected boolean |
HANDLE_CONSUMED
Whether this handler should also handle files of which the corresponding
file event has been consumed.
|
protected boolean |
MARK_LOCK_FILE
Whether the original file or the lock file should be marked.
|
protected boolean |
MOVE_FILE
Whether to move the files from file events.
|
protected boolean |
RENAME_FILE
Whether to rename the files from file events.
|
protected boolean |
REPLACE_EXISTING
Whether to replace an existing target file or a file in the target folder.
|
protected java.lang.String |
TARGET_FOLDER
The name of the target folder in case the files from file events should be
moved.
|
protected java.lang.String |
TARGET_NAME
The name or the pattern of the name the file should be renamed to or the
names of the lock files.
|
consuming, critical, exclusive, id, interruptible, logger| Constructor and Description |
|---|
FileMarkHandler(Configuration conf,
EventManager eventManager,
Registry registry)
Default constructor for a plugin of an
EventManager called by
a service registry. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
handleEvent(Event eve,
boolean consumed)
This method actually processes an event.
|
protected Triple<java.lang.Boolean,java.io.File,java.lang.Boolean> |
markFile(FileEvent eve,
boolean consumed)
Extracted from
handleEvent(Event, boolean) so that it could be extended with the
destination file, i.e. the file the source was renamed or moved to. |
getID, isConsuming, isCritical, isExclusive, isInterruptibleprotected static final java.lang.String CONF_IS_CRITICAL
public static final java.lang.String CONF_HANDLE_CONSUMED
protected final boolean HANDLE_CONSUMED
public static final java.lang.String CONF_DELETE_FILE
protected final boolean DELETE_FILE
public static final java.lang.String CONF_RENAME_FILE
public static final java.lang.String CONF_TARGET_NAME
protected final boolean RENAME_FILE
protected final java.lang.String TARGET_NAME
public static final java.lang.String CONF_ADD_FILE
protected final boolean ADD_FILE
public static final java.lang.String CONF_MOVE_FILE
public static final java.lang.String CONF_TARGET_FOLDER
protected final boolean MOVE_FILE
protected final java.lang.String TARGET_FOLDER
public static final java.lang.String CONF_REPLACE_EXISTING
protected final boolean REPLACE_EXISTING
public static final java.lang.String CONF_MARK_LOCK_FILE
protected final boolean MARK_LOCK_FILE
public FileMarkHandler(Configuration conf, EventManager eventManager, Registry registry) throws ConfigurationException
EventManager called by
a service registry. This constructor just reads the configuration values.conf - The configuration as provided from the registry.eventManager - The event manager this event handler is a plugin of.registry - The registry of this plugin.ConfigurationException - If there are problems with the configuration
a ConfigurationException will be thrown.public boolean handleEvent(Event eve, boolean consumed) throws EventHandlingException
EventHandlereve - The event that occurred and for which this event handler is
registered.consumed - Whether the event has been consumed by a previous event
handler.true).EventHandlingException - If there have been problems handling the
event, an EventHandlingException may be thrown. If
this is critical, the event handling for the current event will
stop. If it is non-critical, other event handlers will also get
the event for handling it. protected Triple<java.lang.Boolean,java.io.File,java.lang.Boolean> markFile(FileEvent eve, boolean consumed) throws EventHandlingException
handleEvent(Event, boolean) so that it could be extended with the
destination file, i.e. the file the source was renamed or moved to.eve - The event that occurred and for which this event handler is registered.consumed - Whether the event has been consumed by a previous event handler.null for a deleted file).
This new file could be used as input parameter for the instance start event handler.
The third element indicates whether the marked file is the lock file.EventHandlingException - If there have been problems handling the event, an
EventHandlingException may be thrown.