sonu gupta | 1bb37b8 | 2016-11-11 16:51:18 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
sonu gupta | 1bb37b8 | 2016-11-11 16:51:18 +0530 | [diff] [blame] | 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 | |
| 17 | package org.onosproject.yms.app.ydt; |
| 18 | |
| 19 | import org.onosproject.yangutils.datamodel.YangSchemaNode; |
| 20 | import org.onosproject.yms.ydt.YdtBuilder; |
| 21 | import org.onosproject.yms.ydt.YdtContextOperationType; |
| 22 | |
| 23 | import java.util.Set; |
| 24 | |
| 25 | /** |
| 26 | * Abstraction of an entity which represents extension of YDT builder |
| 27 | * required by internal sub modules. |
| 28 | */ |
| 29 | public interface YdtExtendedBuilder extends YdtBuilder { |
| 30 | |
| 31 | /** |
| 32 | * Adds a last child to YANG data tree; this method is to be used by |
| 33 | * YANG object builder. |
| 34 | * |
| 35 | * @param yangSchemaNode schema node from YANG metadata |
| 36 | * @param opType type of requested operation over a node |
| 37 | * @return YDT context |
| 38 | */ |
| 39 | YdtExtendedContext addChild(YdtContextOperationType opType, |
| 40 | YangSchemaNode yangSchemaNode); |
| 41 | |
| 42 | /** |
| 43 | * Adds a last leaf list to YANG data tree; this method is to be used by |
| 44 | * YANG object builder. |
| 45 | * |
| 46 | * @param valueSet list of value of the child |
| 47 | * @param yangSchemaNode schema node from YANG metadata |
| 48 | * @return YDT context |
| 49 | */ |
| 50 | YdtExtendedContext addLeafList(Set<String> valueSet, |
| 51 | YangSchemaNode yangSchemaNode); |
| 52 | |
| 53 | /** |
| 54 | * Adds a last leaf to YANG data tree; this method is to be used by |
| 55 | * YANG object builder. |
| 56 | * |
| 57 | * @param value value of the child |
| 58 | * @param yangSchemaNode schema node from YANG metadata |
| 59 | * @return YDT context |
| 60 | */ |
| 61 | YdtExtendedContext addLeaf(String value, YangSchemaNode yangSchemaNode); |
| 62 | |
| 63 | /** |
| 64 | * Traverses up in YANG data tree to the parent node, it is to be used when |
| 65 | * protocol is using extended context type and wanted to traverse |
| 66 | * up the tree without doing any validation. |
sonu gupta | eff184b | 2016-11-24 12:43:49 +0530 | [diff] [blame] | 67 | * |
| 68 | * @throws IllegalStateException when user request for traverse to logical |
| 69 | * root node parent |
sonu gupta | 1bb37b8 | 2016-11-11 16:51:18 +0530 | [diff] [blame] | 70 | */ |
sonu gupta | eff184b | 2016-11-24 12:43:49 +0530 | [diff] [blame] | 71 | void traverseToParentWithoutValidation() throws IllegalStateException; |
sonu gupta | 1bb37b8 | 2016-11-11 16:51:18 +0530 | [diff] [blame] | 72 | |
| 73 | @Override |
| 74 | YdtExtendedContext getRootNode(); |
janani b | 9069eb4 | 2016-11-24 17:50:08 +0530 | [diff] [blame] | 75 | |
| 76 | @Override |
| 77 | YdtExtendedContext getCurNode(); |
sonu gupta | 1bb37b8 | 2016-11-11 16:51:18 +0530 | [diff] [blame] | 78 | } |