blob: 4b54cf3c644e421df3d33134cda773afb2b99418 [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
18
19import com.fasterxml.jackson.databind.node.ObjectNode;
20import org.onosproject.store.service.DocumentPath;
21import org.onosproject.store.service.Versioned;
22
23import java.util.Map;
nitinanandf3f94c62019-02-08 10:36:39 +053024import java.util.Set;
jaegonkim6a7b5242018-09-12 23:09:42 +090025
26/**
27 * WorkflowContext Event Map Store.
28 */
29public interface ContextEventMapStore {
30
31 /**
32 * Registers workflow context event mapping.
33 * @param eventType the class name of event
nitinanandf3f94c62019-02-08 10:36:39 +053034 * @param eventHintSet Set of event hint string value of the event
jaegonkim6a7b5242018-09-12 23:09:42 +090035 * @param contextName workflow context name
jaegonkimce75d3c2020-03-22 00:44:29 +090036 * @param programCounterString the program counter of workflow
jaegonkim6a7b5242018-09-12 23:09:42 +090037 * @throws WorkflowException workflow exception
38 */
nitinanandf3f94c62019-02-08 10:36:39 +053039 void registerEventMap(String eventType, Set<String> eventHintSet,
jaegonkimce75d3c2020-03-22 00:44:29 +090040 String contextName, String programCounterString) throws WorkflowException;
jaegonkim6a7b5242018-09-12 23:09:42 +090041
42 /**
43 * Unregisters workflow context event mapping.
44 * @param eventType the class name of event
jaegonkim6a7b5242018-09-12 23:09:42 +090045 * @param contextName workflow context name
46 * @throws WorkflowException workflow exception
47 */
nitinanandf3f94c62019-02-08 10:36:39 +053048 void unregisterEventMap(String eventType,
jaegonkim6a7b5242018-09-12 23:09:42 +090049 String contextName) throws WorkflowException;
50
51 /**
52 * Returns workflow context event mapping.
53 * @param eventType the class name of event
nitinanandf3f94c62019-02-08 10:36:39 +053054 * @param eventHint vent hint string value of the event
jaegonkimce75d3c2020-03-22 00:44:29 +090055 * @return Map of workflow context and value (program counter)
jaegonkim6a7b5242018-09-12 23:09:42 +090056 * @throws WorkflowException workflow exception
57 */
jaegonkimce75d3c2020-03-22 00:44:29 +090058 Map<String, String> getEventMapByHint(String eventType,
nitinanandf3f94c62019-02-08 10:36:39 +053059 String eventHint) throws WorkflowException;
60
61 /**
62 * Returns true or false depending on existence of eventMap of given context.
63 * @param contextName name of workflow context
64 * @return Boolean true or false depending on existence of eventMap of given context
65 */
66 boolean isEventMapPresent(String contextName);
jaegonkim6a7b5242018-09-12 23:09:42 +090067
68 /**
69 * Returns child nodes on document tree path.
nitinanandf3f94c62019-02-08 10:36:39 +053070 * @param path document tree path including eventType and Hint
jaegonkim6a7b5242018-09-12 23:09:42 +090071 * @return children under document tree path
72 * @throws WorkflowException workflow exception
73 */
jaegonkimce75d3c2020-03-22 00:44:29 +090074 Map<String, Versioned<String>> getChildren(String path) throws WorkflowException;
jaegonkim6a7b5242018-09-12 23:09:42 +090075
76 /**
77 * Returns document path.
78 * @param path document path string
79 * @return document tree
80 * @throws WorkflowException workflow exception
81 */
82 DocumentPath getDocumentPath(String path) throws WorkflowException;
83
84 /**
85 * Transforms document tree to json tree.
86 * @return json tree
87 * @throws WorkflowException workflow exception
88 */
89 ObjectNode asJsonTree() throws WorkflowException;
90}
91