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; |
| 24 | |
| 25 | /** |
| 26 | * WorkflowContext Event Map Store. |
| 27 | */ |
| 28 | public interface ContextEventMapStore { |
| 29 | |
| 30 | /** |
| 31 | * Registers workflow context event mapping. |
| 32 | * @param eventType the class name of event |
| 33 | * @param eventHint event hint string value of the event |
| 34 | * @param contextName workflow context name |
jaegonkim | e0f45b5 | 2018-10-09 20:23:26 +0900 | [diff] [blame] | 35 | * @param programCounterString the program counter of workflow |
jaegonkim | 6a7b524 | 2018-09-12 23:09:42 +0900 | [diff] [blame] | 36 | * @throws WorkflowException workflow exception |
| 37 | */ |
| 38 | void registerEventMap(String eventType, String eventHint, |
jaegonkim | e0f45b5 | 2018-10-09 20:23:26 +0900 | [diff] [blame] | 39 | String contextName, String programCounterString) throws WorkflowException; |
jaegonkim | 6a7b524 | 2018-09-12 23:09:42 +0900 | [diff] [blame] | 40 | |
| 41 | /** |
| 42 | * Unregisters workflow context event mapping. |
| 43 | * @param eventType the class name of event |
| 44 | * @param eventHint event hint string value of the event |
| 45 | * @param contextName workflow context name |
| 46 | * @throws WorkflowException workflow exception |
| 47 | */ |
| 48 | void unregisterEventMap(String eventType, String eventHint, |
| 49 | String contextName) throws WorkflowException; |
| 50 | |
| 51 | /** |
| 52 | * Returns workflow context event mapping. |
| 53 | * @param eventType the class name of event |
| 54 | * @param eventHint event hint string value of the event |
| 55 | * @return workflow context event mapping |
| 56 | * @throws WorkflowException workflow exception |
| 57 | */ |
| 58 | Map<String, String> getEventMap(String eventType, String eventHint) throws WorkflowException; |
| 59 | |
| 60 | /** |
| 61 | * Returns child nodes on document tree path. |
| 62 | * @param path document tree path |
| 63 | * @return children under document tree path |
| 64 | * @throws WorkflowException workflow exception |
| 65 | */ |
| 66 | Map<String, Versioned<String>> getChildren(String path) throws WorkflowException; |
| 67 | |
| 68 | /** |
| 69 | * Returns document path. |
| 70 | * @param path document path string |
| 71 | * @return document tree |
| 72 | * @throws WorkflowException workflow exception |
| 73 | */ |
| 74 | DocumentPath getDocumentPath(String path) throws WorkflowException; |
| 75 | |
| 76 | /** |
| 77 | * Transforms document tree to json tree. |
| 78 | * @return json tree |
| 79 | * @throws WorkflowException workflow exception |
| 80 | */ |
| 81 | ObjectNode asJsonTree() throws WorkflowException; |
| 82 | } |
| 83 | |