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.
-
-
Field Summary
Fields Modifier and Type Field Description static StringPARAM_FILEProcess parameter name for the file.static StringPARAM_FILENAMEProcess parameter name for the file name.static StringPARAM_LOCK_FILEProcess parameter name for the lock file.static StringPARAM_MODIFIED_DATEProcess parameter name for the file name.-
Fields inherited from class de.aristaflow.adept2.core.eventmanager.common.AbstractInstanceStartEventHandler
CONF_CHECK_TEMPLATE_ON_STARTUP, CONF_IS_CRITICAL, CONF_PROCESS_TYPE, eventManager, eventType, processType, template
-
Fields inherited from class de.aristaflow.adept2.core.eventmanager.common.AbstractEventHandler
consuming, critical, exclusive, id, interruptible, logger
-
-
Constructor Summary
Constructors Constructor Description InstanceStartEventHandler(org.apache.commons.configuration2.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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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, handleEvent
-
Methods inherited from class de.aristaflow.adept2.core.eventmanager.common.AbstractEventHandler
getID, isConsuming, isCritical, isExclusive, isInterruptible
-
-
-
-
Field Detail
-
PARAM_FILENAME
public static final String PARAM_FILENAME
Process parameter name for the file name.- See Also:
- Constant Field Values
-
PARAM_MODIFIED_DATE
public static final String PARAM_MODIFIED_DATE
Process parameter name for the file name.- See Also:
- Constant Field Values
-
PARAM_FILE
public static final String PARAM_FILE
Process parameter name for the file.- See Also:
- Constant Field Values
-
PARAM_LOCK_FILE
public static final String PARAM_LOCK_FILE
Process parameter name for the lock file.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
InstanceStartEventHandler
public InstanceStartEventHandler(org.apache.commons.configuration2.Configuration conf, AbstractEventManager eventManager, Registry registry) throws ConfigurationExceptionCreates 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 Detail
-
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
-
-