Class InstanceStartEventHandler
java.lang.Object
de.aristaflow.adept2.core.eventmanager.common.AbstractEventHandler
de.aristaflow.adept2.core.eventmanager.common.AbstractInstanceStartEventHandler<MailEvent>
de.aristaflow.adept2.core.eventmanager.mailevents.InstanceStartEventHandler
- All Implemented Interfaces:
EventHandler
@ConfigurationDescription(properties={@Property(name="FileStorePath",defaultNull=true,description="File system path for storing mails, e.g. in case URI parameters are used for storing the message. If this is not set, temporary files will be created."),})
public class InstanceStartEventHandler
extends AbstractInstanceStartEventHandler<MailEvent>
An event handler for mail events, that stores data from an occurred mail
event as input parameters in the data container of an instance and starts
this instance afterwards.
The input parameters need to have specific names to allow for setting the values according to the mail. This handler allows for lists and subtables of mail addresses and attachments (indirectly via file).
The input parameters need to have specific names to allow for setting the values according to the mail. This handler allows for lists and subtables of mail addresses and attachments (indirectly via file).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final FileThe configured file store path, used for providing the mail content as file URI to the started process ornullin case no files should be stored.protected static final StringThe name of the UDT type for URI lists.Fields inherited from class de.aristaflow.adept2.core.eventmanager.common.AbstractInstanceStartEventHandler
conf, CONF_CHECK_TEMPLATE_ON_STARTUP, CONF_IS_CRITICAL, CONF_PROCESS_TYPE, eventManager, eventType, processType, templateFields inherited from class de.aristaflow.adept2.core.eventmanager.common.AbstractEventHandler
consuming, critical, exclusive, id, interruptible, logger -
Constructor Summary
ConstructorsConstructorDescriptionInstanceStartEventHandler(Configuration conf, AbstractEventManager eventManager, Registry registry) Creates a new handler for mail events that starts instances and stores data from the mail in the instance input parameters. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckInputParameter(TemplateReference templ, Collection<ProcessModelParameter> inParams) Checks for whether the designated template has the right input parameters.protected voidprocessEvent(MailEvent event, Collection<ProcessModelParameter> inParams, InstanceDataContainer dataContainer) Processes the designated event and sets the values of the input parameters in the designated data container.Methods inherited from class de.aristaflow.adept2.core.eventmanager.common.AbstractInstanceStartEventHandler
getAndCheckTemplate, handleEventMethods inherited from class de.aristaflow.adept2.core.eventmanager.common.AbstractEventHandler
getID, isConsuming, isCritical, isExclusive, isInterruptible
-
Field Details
-
URI_LIST_TYPE
The name of the UDT type for URI lists. -
fileStore
The configured file store path, used for providing the mail content as file URI to the started process ornullin case no files should be stored.
-
-
Constructor Details
-
InstanceStartEventHandler
public InstanceStartEventHandler(Configuration conf, AbstractEventManager eventManager, Registry registry) throws ConfigurationException Creates a new handler for mail events that starts instances and stores data from the mail in the instance input parameters.- Parameters:
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).- Throws:
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, aConfigurationExceptionwill be thrown.
-
-
Method Details
-
checkInputParameter
protected void checkInputParameter(TemplateReference templ, Collection<ProcessModelParameter> inParams) throws InvalidDataTypeException, NoSuchParameterException Description copied from class:AbstractInstanceStartEventHandlerChecks for whether the designated template has the right input parameters. An input parameter having the right name for a file event must be of the right data type and there must not be any mandatory input parameter that do not have an appropriate file event name.
This method is called by the constructor! Overriding subclasses must not access their own instance fields but the instance fields of this parent class.- Specified by:
checkInputParameterin classAbstractInstanceStartEventHandler<MailEvent>- Parameters:
templ- The template reference found as "latest" template of the configured process type.inParams- The input parameters of the designated template.- Throws:
InvalidDataTypeException- If the template has an input parameter mapping to a wrong type with respect to the event type, anInvalidDataTypeExceptionwill be thrown.NoSuchParameterException- If the template is missing an input parameter that is required for event handling or it has a mandatory input parameter that cannot be supplied by the event type, aNoSuchParameterExceptionwill be thrown.
-
processEvent
protected void processEvent(MailEvent event, Collection<ProcessModelParameter> inParams, InstanceDataContainer dataContainer) throws Exception Description copied from class:AbstractInstanceStartEventHandlerProcesses the designated event and sets the values of the input parameters in the designated data container.- Specified by:
processEventin classAbstractInstanceStartEventHandler<MailEvent>- Parameters:
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.- Throws:
Exception- If there are problems handling the event, an arbitrary exception will be thrown leading to appropriate exception handling. This is usually aborting event handling and removing the loaded template so that it gets re-loaded.
-