6e4453e89aaf1b1a225244825b80456e3fc24b17
[smo/teiv.git] /
1 /*
2  *  ============LICENSE_START=======================================================
3  *  Copyright (C) 2024 Ericsson
4  *  Modifications Copyright (C) 2024 OpenInfra Foundation Europe
5  *  ================================================================================
6  *  Licensed under the Apache License, Version 2.0 (the "License");
7  *  you may not use this file except in compliance with the License.
8  *  You may obtain a copy of the License at
9  *
10  *        http://www.apache.org/licenses/LICENSE-2.0
11  *
12  *  Unless required by applicable law or agreed to in writing, software
13  *  distributed under the License is distributed on an "AS IS" BASIS,
14  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  *  See the License for the specific language governing permissions and
16  *  limitations under the License.
17  *
18  *  SPDX-License-Identifier: Apache-2.0
19  *  ============LICENSE_END=========================================================
20  */
21 package org.oran.smo.yangtools.parser.yanglibrary;
22
23 import org.oran.smo.yangtools.parser.ParserExecutionContext;
24 import org.oran.smo.yangtools.parser.data.dom.YangDataDomNode;
25
26 /**
27  * Implementations of this interface will extract Yang Library-related data from data DOM nodes and
28  * populate various objects relating to yang library, eg. modules. Implementations are expected to
29  * not throw exceptions, but to add findings to the supplied context if errors are encountered.
30  * <p/>
31  * Clients will typically implement this interface if the Yang Library contains data in addition to
32  * what is defined in RFC 8525; for example, vendor-proprietary data relating to modules.
33  * <p/>
34  * A default implementation is provided in {@link RFC8525Populator} which handles all the data nodes
35  * as defined in RFC 8525.
36  *
37  * @author Mark Hollmann
38  */
39 public interface YangLibraryPopulator {
40
41     /**
42      * Callback for population of the ModulesState object.
43      */
44     default void populateModulesState(final ParserExecutionContext context, final ModulesState modulesState,
45             final YangDataDomNode modulesStateDomNode) {
46     }
47
48     /**
49      * Callback for populating the Module object, from modules-state branch.
50      */
51     default void populateModuleInModulesState(final ParserExecutionContext context, final Module module,
52             final YangDataDomNode moduleDomNode) {
53     }
54
55     /**
56      * Callback for populating the Submodule object, from modules-state branch.
57      */
58     default void populateSubmoduleInModulesState(final ParserExecutionContext context, final Submodule submodule,
59             final YangDataDomNode submoduleDomNode) {
60     }
61
62     /**
63      * Callback for population of the YangLibrary object.
64      */
65     default void populateYangLibrary(final ParserExecutionContext context, final YangLibrary yangLibrary,
66             final YangDataDomNode yangLibraryDomNode) {
67     }
68
69     /**
70      * Callback for population of the ModuleSet object.
71      */
72     default void populateModuleSet(final ParserExecutionContext context, final ModuleSet moduleSet,
73             final YangDataDomNode moduleSetDomNode) {
74     }
75
76     /**
77      * Callback for populating the Module object, from yang-library branch.
78      */
79     default void populateModuleInYangLibrary(final ParserExecutionContext context, final Module module,
80             final YangDataDomNode moduleDomNode, final String conformanceType) {
81     }
82
83     /**
84      * Callback for populating the Submodule object, from yang-library branch.
85      */
86     default void populateSubmoduleInYangLibrary(final ParserExecutionContext context, final Submodule submodule,
87             final YangDataDomNode submoduleDomNode) {
88     }
89 }