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 | * Interface for data model tree. |
| 20 | */ |
| 21 | public interface DataModelTree { |
| 22 | |
| 23 | /** |
| 24 | * Data model tree node type (map or array). |
| 25 | */ |
| 26 | enum Nodetype { |
| 27 | |
| 28 | /** |
| 29 | * Map type data model tree node. |
| 30 | */ |
| 31 | MAP, |
| 32 | |
| 33 | /** |
| 34 | * Array type data model tree node. |
| 35 | */ |
| 36 | ARRAY |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Returns subtree on the path. |
| 41 | * @param path data model tree path |
| 42 | * @return subtree on the path |
| 43 | */ |
| 44 | DataModelTree subtree(String path); |
| 45 | |
| 46 | /** |
| 47 | * Attaches subtree on the path. |
| 48 | * @param path data model tree path where subtree will be attached |
| 49 | * @param tree subtree to be attached |
| 50 | * @throws WorkflowException workflow exception |
| 51 | */ |
| 52 | void attach(String path, DataModelTree tree) throws WorkflowException; |
| 53 | |
| 54 | /** |
| 55 | * Allocates leaf node on the path. |
| 56 | * @param path data model tree path where new leaf node will be allocated |
| 57 | * @param leaftype leaf node type |
| 58 | * @return data model tree |
| 59 | * @throws WorkflowException workflow exception |
| 60 | */ |
| 61 | DataModelTree alloc(String path, Nodetype leaftype) throws WorkflowException; |
| 62 | } |
| 63 | |