Class InstanceStartEventHandler
java.lang.Object
de.aristaflow.adept2.core.eventmanager.common.AbstractEventHandler
de.aristaflow.adept2.core.eventmanager.common.AbstractInstanceStartEventHandler<FileEvent>
de.aristaflow.adept2.core.eventmanager.fileevents.InstanceStartEventHandler
- All Implemented Interfaces:
EventHandler
@ConfigurationDescription(properties=)
public class InstanceStartEventHandler
extends AbstractInstanceStartEventHandler<FileEvent>
An event handler for file events, that stores data from an occurred file
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 file.
The input parameters need to have specific names to allow for setting the values according to the file.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringProcess parameter name for the file.static final StringProcess parameter name for the file name.static final StringProcess parameter name for the lock file.static final StringProcess parameter name for the file name.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 file events that starts instances and stores data from the file 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(FileEvent 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
-
PARAM_FILENAME
Process parameter name for the file name.- See Also:
-
PARAM_MODIFIED_DATE
Process parameter name for the file name.- See Also:
-
PARAM_FILE
Process parameter name for the file.- See Also:
-
PARAM_LOCK_FILE
Process parameter name for the lock file.- See Also:
-
-
Constructor Details
-
InstanceStartEventHandler
public InstanceStartEventHandler(Configuration conf, AbstractEventManager eventManager, Registry registry) throws ConfigurationException Creates a new handler for file events that starts instances and stores data from the file 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 Checks 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.- Specified by:
checkInputParameterin classAbstractInstanceStartEventHandler<FileEvent>- 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 file event (due to its name) but has the wrong type, anInvalidDataTypeExceptionwill be thrown.NoSuchParameterException- If the template has a mandatory input parameter that does not map to a file event, aNoSuchParameterExceptionwill be thrown.
-
processEvent
protected void processEvent(FileEvent event, Collection<ProcessModelParameter> inParams, InstanceDataContainer dataContainer) throws InvalidDataTypeException, NoSuchParameterException, IOException 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<FileEvent>- 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:
InvalidDataTypeExceptionNoSuchParameterExceptionIOException
-