1 package org.smartcomps.twister.engine.priv.core.definition;
2
3 import org.smartcomps.twister.engine.priv.core.definition.Activity;
4 import org.smartcomps.twister.engine.priv.core.definition.AlarmEvent;
5 import org.smartcomps.twister.engine.priv.core.definition.MessageEvent;
6 import org.smartcomps.twister.engine.priv.core.dynamic.ExecutionContext;
7 import org.smartcomps.twister.engine.exception.EngineException;
8
9 import java.util.Map;
10 import java.util.List;
11
12 /***
13 * A pick is a structured activity that allows you to block and wait for a suitable
14 * message to arrive or for a time-out alarm to go off. When one of these triggers
15 * occurs, the associated activity is performed and the pick completes.<br>
16 * Each Pick activty must include at least one MessageEvent.
17 * @see org.smartcomps.twister.engine.priv.core.definition.MessageEvent, AlarmEvent
18 */
19 public interface Pick extends StructuredActivity {
20
21 public boolean isCreateInstance();
22 public void setCreateInstance(boolean createInstance);
23
24 /***
25 * Adds a message event to this Pick activity that triggers the provided
26 * activity when fired. Message events must be added in the same order as
27 * activities have been created and registered in this container and before
28 * any alarm event.
29 * @param event the message event to wait for to fire the activity
30 * @param activity to start when the message event occurs
31 */
32 public void addMessageEvent(MessageEvent event, Activity activity);
33
34 /***
35 * Builds a Map containing activities as keys and corresponding message events
36 * as values.
37 * @return Map of activity / message event pairs
38 */
39 public Map getActivityMessageEvents();
40
41 /***
42 * Returns the message event associated with the provided activity.
43 * @param activity associated with the wanted message event
44 * @return MessageEvent
45 */
46 public MessageEvent getMessageEvent(Activity activity);
47
48 /***
49 * Returns the list of MessageEvent in the Pick structured activity. The
50 * MessageEvent objects in this list have the same positions as their
51 * corresponding activity in the Pick container.
52 * @return
53 */
54 public List getMessageEvents();
55
56 /***
57 * Adds an alarm event to this Pick activity that triggers the provided
58 * activity when fired. Alarm events must be added in the same order as
59 * activities have been created and registered in this container and after
60 * any message event.
61 * @param event the alarm event to wait for to fire the activity
62 * @param activity to start when the message event occurs
63 */
64 public void addAlarmEvent(AlarmEvent event, Activity activity);
65
66 /***
67 * Builds a Map containing activities as keys and corresponding alarm events
68 * as values.
69 * @return Map of activity / alarm event pairs
70 */
71 public Map getActivityAlarmEvents();
72
73 /***
74 * Returns the alarm event associated with the provided activity.
75 * @param activity associated with the wanted alarm event
76 * @return AlarmEvent
77 */
78 public AlarmEvent getAlarmEvent(Activity activity);
79
80 /***
81 * Pick is one of the rare structured activity that can be directly
82 * executed. Actually it's only one of its activity that will be
83 * executed but this execution is done in the scope of the Pick.
84 * @param correlationSetName
85 * @param correlation
86 * @return
87 * @throws EngineException
88 */
89 public ExecutionContext execute(String correlationSetName, Map correlation) throws EngineException;
90
91 }
This page was automatically generated by Maven