janani b | 05614f1 | 2016-10-04 12:55:43 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
janani b | 05614f1 | 2016-10-04 12:55:43 +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.ytb; |
| 18 | |
janani b | 05614f1 | 2016-10-04 12:55:43 +0530 | [diff] [blame] | 19 | import org.onosproject.yms.app.ydt.YdtExtendedBuilder; |
janani b | 9069eb4 | 2016-11-24 17:50:08 +0530 | [diff] [blame] | 20 | import org.onosproject.yms.app.ydt.YdtExtendedContext; |
janani b | 05614f1 | 2016-10-04 12:55:43 +0530 | [diff] [blame] | 21 | import org.onosproject.yms.app.ysr.YangSchemaRegistry; |
janani b | 05614f1 | 2016-10-04 12:55:43 +0530 | [diff] [blame] | 22 | import org.onosproject.yms.ydt.YmsOperationType; |
| 23 | |
| 24 | import java.util.List; |
| 25 | |
| 26 | /** |
| 27 | * Abstraction of an entity which provides interfaces to build YANG data tree |
| 28 | * from the object received from YNH, YAB or YCH. |
| 29 | */ |
| 30 | public interface YangTreeBuilder { |
| 31 | |
| 32 | /** |
| 33 | * Returns the YDT builder after building the tree corresponding to the |
| 34 | * response YANG object received from any of the protocol such as YAB or |
| 35 | * YCH. |
| 36 | * |
| 37 | * @param moduleObj application module object |
janani b | 9069eb4 | 2016-11-24 17:50:08 +0530 | [diff] [blame] | 38 | * @param rootName logical root node name |
| 39 | * @param rootNameSpace logical root node namespace |
janani b | 05614f1 | 2016-10-04 12:55:43 +0530 | [diff] [blame] | 40 | * @param opType root node operation type |
| 41 | * @param registry application schema registry |
| 42 | * @return YDT builder from the tree |
| 43 | */ |
| 44 | YdtExtendedBuilder getYdtBuilderForYo(List<Object> moduleObj, |
| 45 | String rootName, |
| 46 | String rootNameSpace, |
| 47 | YmsOperationType opType, |
| 48 | YangSchemaRegistry registry); |
| 49 | |
| 50 | /** |
| 51 | * Returns the YDT context after building the tree received from the |
| 52 | * protocol YNH. |
| 53 | * |
| 54 | * @param object application notification object |
janani b | 9069eb4 | 2016-11-24 17:50:08 +0530 | [diff] [blame] | 55 | * @param rootName logical root node name |
janani b | 05614f1 | 2016-10-04 12:55:43 +0530 | [diff] [blame] | 56 | * @param registry application schema registry |
| 57 | * @return YDT context from the tree |
| 58 | */ |
janani b | 9069eb4 | 2016-11-24 17:50:08 +0530 | [diff] [blame] | 59 | YdtExtendedContext getYdtForNotification(Object object, String rootName, |
| 60 | YangSchemaRegistry registry); |
janani b | 05614f1 | 2016-10-04 12:55:43 +0530 | [diff] [blame] | 61 | |
| 62 | /** |
| 63 | * Returns the YDT context after building the RPC response tree. The input |
janani b | 9069eb4 | 2016-11-24 17:50:08 +0530 | [diff] [blame] | 64 | * for building the tree is RPC request builder, RPC output java object. |
janani b | 05614f1 | 2016-10-04 12:55:43 +0530 | [diff] [blame] | 65 | * These are received from the YSB protocol. |
| 66 | * |
janani b | 9069eb4 | 2016-11-24 17:50:08 +0530 | [diff] [blame] | 67 | * @param outputObj application output object |
| 68 | * @param reqBuilder RPC request builder from YDT |
janani b | 05614f1 | 2016-10-04 12:55:43 +0530 | [diff] [blame] | 69 | * @return YDT builder where RPC response tree is created |
| 70 | */ |
| 71 | YdtExtendedBuilder getYdtForRpcResponse(Object outputObj, |
janani b | 9069eb4 | 2016-11-24 17:50:08 +0530 | [diff] [blame] | 72 | YdtExtendedBuilder reqBuilder); |
janani b | 05614f1 | 2016-10-04 12:55:43 +0530 | [diff] [blame] | 73 | } |