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