@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 InstanceStartEventHandler extends AbstractEventHandler
| Modifier and Type | Field and Description |
|---|---|
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.
|
protected static java.lang.String |
CONF_PROCESS_TYPE
Configuration key: The process type of which to start the
"latest" template in case the appropriate event occurs.
|
protected DefaultEventManager |
eventManager
The event manager for communicating with the runtime service.
|
static java.lang.String |
PARAM_FILE
Process parameter name for the file.
|
static java.lang.String |
PARAM_FILENAME
Process parameter name for the file name.
|
static java.lang.String |
PARAM_LOCK_FILE
Process parameter name for the lock file.
|
static java.lang.String |
PARAM_MODIFIED_DATE
Process parameter name for the file name.
|
protected java.lang.String |
processType
The process type of which to start the "latest" template in case
the appropriate event occurs.
|
protected TemplateReference |
template
The template which to instantiate in case an appropriate mail event occurs.
|
consuming, critical, exclusive, id, interruptible, logger| Constructor and Description |
|---|
InstanceStartEventHandler(Configuration conf,
DefaultEventManager eventManager,
Registry registry)
Creates a new handler for file events that starts instances and
stores data from the file in the instance input parameters.
|
| Modifier and Type | Method and Description |
|---|---|
protected TemplateReference |
getAndCheckTemplate(SessionToken session)
Retrieves the "latest" template of the configured process type
and checks for whether it has the right input parameter.
|
boolean |
handleEvent(Event eve,
boolean consumed)
This method actually processes an event.
|
protected void |
processFileEvent(FileEvent event,
java.util.Collection<? extends Parameter> inParams,
InstanceDataContainer dataContainer)
Processes the file of the designated event and sets the values of the input
parameters in the designated data container.
|
getID, isConsuming, isCritical, isExclusive, isInterruptibleprotected static final java.lang.String CONF_IS_CRITICAL
protected static final java.lang.String CONF_PROCESS_TYPE
protected final java.lang.String processType
protected TemplateReference template
null if there are problems
instantiating it.protected final DefaultEventManager eventManager
public static final java.lang.String PARAM_FILENAME
public static final java.lang.String PARAM_MODIFIED_DATE
public static final java.lang.String PARAM_FILE
public static final java.lang.String PARAM_LOCK_FILE
public InstanceStartEventHandler(Configuration conf, DefaultEventManager eventManager, Registry registry) throws ConfigurationException
conf - The configuration for this plugin instance.eventManager - The event manager for starting the process instance.registry - The registry for retrieving the plugin instance name
(handler ID).ConfigurationException - If there are problems creating the
configured file store or writing to it or the template cannot be
retrieved or has the wrong input parameter, 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 TemplateReference getAndCheckTemplate(SessionToken session) throws InvalidDataTypeException, NoSuchParameterException
session - The session token used to retrieve the "latest"
template.null in case the process type does not have a
template.InvalidDataTypeException - If the template has an input parameter
mapping to a file event (due to its name) but has the wrong type,
an InvalidDataTypeException will be thrown.NoSuchParameterException - If the template has a mandatory input
parameter that does not map to a file event, a
NoSuchParameterException will be thrown.protected void processFileEvent(FileEvent event, java.util.Collection<? extends Parameter> inParams, InstanceDataContainer dataContainer) throws InvalidDataTypeException, NoSuchParameterException, java.io.IOException
event - The event which to process and which provides the values for
the input parameters.inParams - The input parameters of the template.dataContainer - The data container of the template in which to set the
values.InvalidDataTypeException - If writing to the data container fails due
to a provided input parameter having another type in the data
container or a parameter has a wrong user-defined type, an
InvalidDataTypeException will be thrown.NoSuchParameterException - If writing to the data container fails due
to a provided input parameter not being in the data container, a
NoSuchParameterException will be thrown.java.io.IOException - If creating the value for an UDT fails, an
IOException will be thrown.