@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_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.
|
protected java.io.File |
fileStore
The configured file store path, used for providing the mail content as file
URI to the started process or
null in case no files should be
stored. |
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.
|
protected static java.lang.String |
URI_LIST_TYPE
The name of the UDT type for URI lists.
|
consuming, critical, exclusive, id, interruptible, logger| Constructor and Description |
|---|
InstanceStartEventHandler(Configuration conf,
DefaultEventManager eventManager,
Registry registry)
Creates a new handler for mail events that starts instances and
stores data from the mail 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 |
processMailEvent(MailEvent event,
java.util.Collection<? extends Parameter> inParams,
InstanceDataContainer dataContainer)
Processes the mail 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 URI_LIST_TYPE
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
protected final java.io.File fileStore
null in case no files should be
stored.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 mail 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 mail event, a
NoSuchParameterException will be thrown.protected void processMailEvent(MailEvent event, java.util.Collection<? extends Parameter> inParams, InstanceDataContainer dataContainer) throws InvalidDataTypeException, NoSuchParameterException, javax.mail.MessagingException, 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.javax.mail.MessagingException - If there are problems retrieving the message
content or other details of the message, a
MessagingException will be thrown.java.io.IOException - If creating the value for an UDT fails, an
IOException will be thrown.