org.ikasan.framework.flow.event.listener
Class JobAwareFlowEventListener

java.lang.Object
  extended by org.ikasan.framework.flow.event.listener.JobAwareFlowEventListener
All Implemented Interfaces:
FlowEventListener

public class JobAwareFlowEventListener
extends Object
implements FlowEventListener

The JobAwareFlowEventListener provides a FlowEventListener implementation that brokers the life-cycle callbacks that it receives through to locally registered FlowEventJob instances. Each FlowEventJob represents some sort of executable platform service Whether not a particular FlowEventJob need be called at a given life-cycle point will depend on the existence of Trigger bound to either before or after the flow or flow element

Author:
Ikasan Development Team

Constructor Summary
JobAwareFlowEventListener(Map<String,FlowEventJob> flowEventJobs, TriggerDao triggerDao)
          Constructor
 
Method Summary
 void addDynamicTrigger(Trigger trigger)
          Registers a dynamic trigger Dynamic triggers may be created and deleted at runtime.
 void addStaticTrigger(Trigger trigger)
          Registers a static triggers Static Triggers are usually set through configuration, and cannot be added to or deleted at runtime
 void addStaticTriggers(List<Trigger> staticTriggers)
          Registers a List of static triggers Static Triggers are usually set through configuration, and cannot be added to or deleted at runtime
 void afterFlow(String moduleName, String flowName, Event event)
          Callback method to be invoked subsequent to Flow execution
 void afterFlowElement(String moduleName, String flowName, FlowElement flowElement, Event event)
          Callback method to be called subsequent to FlowElement execution
 void beforeFlow(String moduleName, String flowName, Event event)
          Callback method to be invoked prior to Flow execution
 void beforeFlowElement(String moduleName, String flowName, FlowElement flowElement, Event event)
          Callback method to be invoked prior to FlowElement execution
 void deleteDynamicTrigger(Long triggerId)
          Deletes a dynamic trigger, specified by trigger id.
 Map<String,FlowEventJob> getRegisteredJobs()
          Returns a safe Map of all registered FlowEventJobs, keyed by jobName
 List<Trigger> getTriggers(String moduleName, String flowName, TriggerRelationship relationship, String flowElementName)
          Returns a safe List of all the triggers associated with a particular point in a particular flow
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JobAwareFlowEventListener

public JobAwareFlowEventListener(Map<String,FlowEventJob> flowEventJobs,
                                 TriggerDao triggerDao)
Constructor

Parameters:
flowEventJobs - - The list of flow event jobs
triggerDao - - The DAO for the trigger
Method Detail

addStaticTriggers

public void addStaticTriggers(List<Trigger> staticTriggers)
Registers a List of static triggers Static Triggers are usually set through configuration, and cannot be added to or deleted at runtime

Parameters:
staticTriggers - - List of Triggers

addStaticTrigger

public void addStaticTrigger(Trigger trigger)
Registers a static triggers Static Triggers are usually set through configuration, and cannot be added to or deleted at runtime

Parameters:
trigger - - The static Trigger to add

addDynamicTrigger

public void addDynamicTrigger(Trigger trigger)
Registers a dynamic trigger Dynamic triggers may be created and deleted at runtime. They are persised using the triggerDao

Parameters:
trigger - - The dynamic TRigger to add

beforeFlow

public void beforeFlow(String moduleName,
                       String flowName,
                       Event event)
Description copied from interface: FlowEventListener
Callback method to be invoked prior to Flow execution

Specified by:
beforeFlow in interface FlowEventListener
Parameters:
moduleName - - name of the module
flowName - - name of the flow
event - - event with which flow is to be invoked

afterFlow

public void afterFlow(String moduleName,
                      String flowName,
                      Event event)
Description copied from interface: FlowEventListener
Callback method to be invoked subsequent to Flow execution

Specified by:
afterFlow in interface FlowEventListener
Parameters:
moduleName - - name of the module
flowName - - name of the flow
event - - event with which flow was invoked

beforeFlowElement

public void beforeFlowElement(String moduleName,
                              String flowName,
                              FlowElement flowElement,
                              Event event)
Description copied from interface: FlowEventListener
Callback method to be invoked prior to FlowElement execution

Specified by:
beforeFlowElement in interface FlowEventListener
Parameters:
moduleName - - name of the module
flowName - - name of the flow
flowElement - - FlowElement about to be invoked
event - - event with which flow element is to be invoked

afterFlowElement

public void afterFlowElement(String moduleName,
                             String flowName,
                             FlowElement flowElement,
                             Event event)
Description copied from interface: FlowEventListener
Callback method to be called subsequent to FlowElement execution

Specified by:
afterFlowElement in interface FlowEventListener
Parameters:
moduleName - - name of the module
flowName - - name of the flow
flowElement - - FlowElement which was invoked
event - - event with which flow element was invoked

getTriggers

public List<Trigger> getTriggers(String moduleName,
                                 String flowName,
                                 TriggerRelationship relationship,
                                 String flowElementName)
Returns a safe List of all the triggers associated with a particular point in a particular flow

Parameters:
moduleName - - THe name of the module
flowName - - The name of the flow
relationship - - The Trigger relationship (before or after)
flowElementName - - The flow element name
Returns:
- List of triggers that apply at the point in flow specified by the parameters

deleteDynamicTrigger

public void deleteDynamicTrigger(Long triggerId)
Deletes a dynamic trigger, specified by trigger id. This has the effect of:

1) de-registering the trigger from the mapped triggers, so that it no longer takes effect 2) deleting the trigger so that it is not reloaded next time

Parameters:
triggerId - - The dynamic Trigger to deregister

getRegisteredJobs

public Map<String,FlowEventJob> getRegisteredJobs()
Returns a safe Map of all registered FlowEventJobs, keyed by jobName

Returns:
- Map of FlowEventJob keyed by jobName


Copyright © 2007-2012 Ikasan. All Rights Reserved.