jaegonkim | 6a7b524 | 2018-09-12 23:09:42 +0900 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 16 | package org.onosproject.workflow.api; |
| 17 | |
| 18 | |
| 19 | import com.fasterxml.jackson.databind.node.ObjectNode; |
| 20 | import org.onosproject.store.service.DocumentPath; |
| 21 | import org.onosproject.store.service.Versioned; |
| 22 | |
| 23 | import java.util.Map; |
nitinanand | f3f94c6 | 2019-02-08 10:36:39 +0530 | [diff] [blame] | 24 | import java.util.Set; |
jaegonkim | 6a7b524 | 2018-09-12 23:09:42 +0900 | [diff] [blame] | 25 | |
| 26 | /** |
| 27 | * WorkflowContext Event Map Store. |
| 28 | */ |
| 29 | public interface ContextEventMapStore { |
| 30 | |
| 31 | /** |
| 32 | * Registers workflow context event mapping. |
| 33 | * @param eventType the class name of event |
nitinanand | f3f94c6 | 2019-02-08 10:36:39 +0530 | [diff] [blame] | 34 | * @param eventHintSet Set of event hint string value of the event |
jaegonkim | 6a7b524 | 2018-09-12 23:09:42 +0900 | [diff] [blame] | 35 | * @param contextName workflow context name |
jaegonkim | e0f45b5 | 2018-10-09 20:23:26 +0900 | [diff] [blame] | 36 | * @param programCounterString the program counter of workflow |
jaegonkim | 6a7b524 | 2018-09-12 23:09:42 +0900 | [diff] [blame] | 37 | * @throws WorkflowException workflow exception |
| 38 | */ |
nitinanand | f3f94c6 | 2019-02-08 10:36:39 +0530 | [diff] [blame] | 39 | void registerEventMap(String eventType, Set<String> eventHintSet, |
jaegonkim | e0f45b5 | 2018-10-09 20:23:26 +0900 | [diff] [blame] | 40 | String contextName, String programCounterString) throws WorkflowException; |
jaegonkim | 6a7b524 | 2018-09-12 23:09:42 +0900 | [diff] [blame] | 41 | |
| 42 | /** |
| 43 | * Unregisters workflow context event mapping. |
| 44 | * @param eventType the class name of event |
jaegonkim | 6a7b524 | 2018-09-12 23:09:42 +0900 | [diff] [blame] | 45 | * @param contextName workflow context name |
| 46 | * @throws WorkflowException workflow exception |
| 47 | */ |
nitinanand | f3f94c6 | 2019-02-08 10:36:39 +0530 | [diff] [blame] | 48 | void unregisterEventMap(String eventType, |
jaegonkim | 6a7b524 | 2018-09-12 23:09:42 +0900 | [diff] [blame] | 49 | String contextName) throws WorkflowException; |
| 50 | |
| 51 | /** |
| 52 | * Returns workflow context event mapping. |
| 53 | * @param eventType the class name of event |
nitinanand | f3f94c6 | 2019-02-08 10:36:39 +0530 | [diff] [blame] | 54 | * @param eventHint vent hint string value of the event |
| 55 | * @return Map of workflow context and value (program counter) |
jaegonkim | 6a7b524 | 2018-09-12 23:09:42 +0900 | [diff] [blame] | 56 | * @throws WorkflowException workflow exception |
| 57 | */ |
nitinanand | f3f94c6 | 2019-02-08 10:36:39 +0530 | [diff] [blame] | 58 | Map<String, String> getEventMapByHint(String eventType, |
| 59 | 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); |
jaegonkim | 6a7b524 | 2018-09-12 23:09:42 +0900 | [diff] [blame] | 67 | |
| 68 | /** |
| 69 | * Returns child nodes on document tree path. |
nitinanand | f3f94c6 | 2019-02-08 10:36:39 +0530 | [diff] [blame] | 70 | * @param path document tree path including eventType and Hint |
jaegonkim | 6a7b524 | 2018-09-12 23:09:42 +0900 | [diff] [blame] | 71 | * @return children under document tree path |
| 72 | * @throws WorkflowException workflow exception |
| 73 | */ |
| 74 | Map<String, Versioned<String>> getChildren(String path) throws WorkflowException; |
| 75 | |
| 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 | |