blob: 058d050b93240b3a5ff718446d7ed98f5549502f [file] [log] [blame]
jaegonkim6a7b5242018-09-12 23:09:42 +09001/*
2 * Copyright 2018-present Open Networking Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.workflow.api;
17
18import org.onosproject.event.Event;
19import org.onosproject.event.ListenerService;
20
nitinanandf3f94c62019-02-08 10:36:39 +053021import java.util.Set;
22
jaegonkim6a7b5242018-09-12 23:09:42 +090023/**
24 * Interface for workflow execution service.
25 */
26public interface WorkflowExecutionService extends ListenerService<WorkflowDataEvent, WorkflowDataListener> {
27
28 /**
29 * Executes init worklet.
30 * @param context workflow context
31 */
32 void execInitWorklet(WorkflowContext context);
33
34 /**
jaegonkime0f45b52018-10-09 20:23:26 +090035 * Evals workflow context.
36 * @param contextName the name of workflow context
37 */
38 void eval(String contextName);
39
40 /**
jaegonkim6a7b5242018-09-12 23:09:42 +090041 * Triggers workflow event map.
42 * @param event triggering event
43 * @param generator event hint generation method reference
44 */
45 void eventMapTrigger(Event event, EventHintSupplier generator);
46
47 /**
48 * Registers workflow event map.
49 * @param eventType event type (class name of event)
nitinanandf3f94c62019-02-08 10:36:39 +053050 * @param eventHintSet Set of event hint value
jaegonkim6a7b5242018-09-12 23:09:42 +090051 * @param contextName workflow context name to be called by this event map
jaegonkimce75d3c2020-03-22 00:44:29 +090052 * @param programCounterString worklet type to be called by this event map
jaegonkim6a7b5242018-09-12 23:09:42 +090053 * @throws WorkflowException workflow exception
54 */
nitinanandf3f94c62019-02-08 10:36:39 +053055 void registerEventMap(Class<? extends Event> eventType, Set<String> eventHintSet,
jaegonkimce75d3c2020-03-22 00:44:29 +090056 String contextName, String programCounterString) throws WorkflowException;
senthil692758b2024-02-16 12:02:30 +090057
58 /**
59 * Unregister workflow event map.
60 * @param contextName workflow context name
61 * @throws WorkflowException workflow exception
62 */
63 default void unregisterEventMap(String contextName) throws WorkflowException {
64 return;
65 }
66
67 /**
68 * Schedule handler task to be executed after some milli-seconds.
69 * @param afterMs the milli-second to execute handler task.
70 * @param task handler task to be executed after some milli-seconds.
71 */
72 default void scheduleHandlerTask(long afterMs, HandlerTask task) {
73 return;
74 }
75
76
jaegonkim6a7b5242018-09-12 23:09:42 +090077}