blob: 307675dbd4652e5e0ab2a30d5bb2082d8412eb1c [file] [log] [blame]
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +05301/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +05303 *
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
VinodKumarS-Huawei2ee9e7e2016-06-01 14:30:22 +053017package org.onosproject.yangutils.linker;
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +053018
19import java.util.List;
Gaurav Agrawal0d43bb52016-05-17 18:06:38 +053020import java.util.Set;
VinodKumarS-Huawei2ee9e7e2016-06-01 14:30:22 +053021
Gaurav Agrawal0d43bb52016-05-17 18:06:38 +053022import org.onosproject.yangutils.datamodel.YangImport;
23import org.onosproject.yangutils.datamodel.YangInclude;
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +053024import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
Gaurav Agrawal0d43bb52016-05-17 18:06:38 +053025import org.onosproject.yangutils.linker.exceptions.LinkerException;
VinodKumarS-Huawei2ee9e7e2016-06-01 14:30:22 +053026import org.onosproject.yangutils.linker.impl.YangResolutionInfo;
Gaurav Agrawal0d43bb52016-05-17 18:06:38 +053027import org.onosproject.yangutils.plugin.manager.YangFileInfo;
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +053028
29/**
30 * Abstraction of YANG dependency resolution information. Abstracted to obtain the
31 * resolution information.
32 */
Vinod Kumar Se4b9b0c2016-04-30 21:09:15 +053033public interface YangReferenceResolver {
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +053034
35 /**
36 * Returns unresolved resolution list.
37 *
VinodKumarS-Huawei2ee9e7e2016-06-01 14:30:22 +053038 * @param type resolvable type
39 * @return list of resolution information objects
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +053040 */
VinodKumarS-Huawei2ee9e7e2016-06-01 14:30:22 +053041 List<YangResolutionInfo> getUnresolvedResolutionList(ResolvableType type);
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +053042
43 /**
Gaurav Agrawal0d43bb52016-05-17 18:06:38 +053044 * Adds to the resolution list.
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +053045 *
46 * @param resolutionInfo resolution information
VinodKumarS-Huawei2ee9e7e2016-06-01 14:30:22 +053047 * @param type resolvable type
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +053048 */
VinodKumarS-Huawei2ee9e7e2016-06-01 14:30:22 +053049 void addToResolutionList(YangResolutionInfo resolutionInfo, ResolvableType type);
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +053050
51 /**
52 * Creates resolution list.
53 *
54 * @param resolutionList resolution list
VinodKumarS-Huawei2ee9e7e2016-06-01 14:30:22 +053055 * @param type resolvable type
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +053056 */
VinodKumarS-Huawei2ee9e7e2016-06-01 14:30:22 +053057 void setResolutionList(List<YangResolutionInfo> resolutionList, ResolvableType type);
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +053058
59 /**
60 * Returns unresolved imported list.
61 *
62 * @return unresolved imported list
63 */
64 List<YangImport> getImportList();
65
66 /**
Gaurav Agrawal0d43bb52016-05-17 18:06:38 +053067 * Adds to the import list.
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +053068 *
69 * @param yangImport import to be added
70 */
71 void addToImportList(YangImport yangImport);
72
73 /**
74 * Create import list.
75 *
76 * @param importList import list
77 */
78 void setImportList(List<YangImport> importList);
79
80 /**
81 * Returns unresolved include list.
82 *
83 * @return unresolved include list
84 */
85 List<YangInclude> getIncludeList();
86
87 /**
Gaurav Agrawal0d43bb52016-05-17 18:06:38 +053088 * Adds to the include list.
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +053089 *
90 * @param yangInclude include to be added
91 */
92 void addToIncludeList(YangInclude yangInclude);
93
94 /**
Gaurav Agrawal0d43bb52016-05-17 18:06:38 +053095 * Creates include list.
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +053096 *
97 * @param includeList include list
98 */
99 void setIncludeList(List<YangInclude> includeList);
100
101 /**
102 * Returns prefix of resolution root node.
103 *
104 * @return prefix resolution root node prefix
105 */
106 String getPrefix();
107
108 /**
Gaurav Agrawal0d43bb52016-05-17 18:06:38 +0530109 * Sets prefix of resolution list root node.
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +0530110 *
111 * @param prefix resolution root node prefix
112 */
113 void setPrefix(String prefix);
114
115 /**
Gaurav Agrawal0d43bb52016-05-17 18:06:38 +0530116 * Resolves self file linking.
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +0530117 *
VinodKumarS-Huawei2ee9e7e2016-06-01 14:30:22 +0530118 * @param type resolvable type
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +0530119 * @throws DataModelException a violation in data model rule
120 */
VinodKumarS-Huawei2ee9e7e2016-06-01 14:30:22 +0530121 void resolveSelfFileLinking(ResolvableType type)
122 throws DataModelException;
Gaurav Agrawal0d43bb52016-05-17 18:06:38 +0530123
124 /**
125 * Resolves inter file linking.
126 *
VinodKumarS-Huawei2ee9e7e2016-06-01 14:30:22 +0530127 * @param type resolvable type
Gaurav Agrawal0d43bb52016-05-17 18:06:38 +0530128 * @throws DataModelException a violation in data model rule
129 */
VinodKumarS-Huawei2ee9e7e2016-06-01 14:30:22 +0530130 void resolveInterFileLinking(ResolvableType type)
131 throws DataModelException;
Gaurav Agrawal0d43bb52016-05-17 18:06:38 +0530132
133 /**
134 * Adds references to include.
135 *
136 * @param yangFileInfoSet YANG file info set
137 * @throws LinkerException a violation of linker rules
138 */
VinodKumarS-Huawei2ee9e7e2016-06-01 14:30:22 +0530139 void addReferencesToIncludeList(Set<YangFileInfo> yangFileInfoSet)
140 throws LinkerException;
Gaurav Agrawal0d43bb52016-05-17 18:06:38 +0530141
142 /**
143 * Adds references to import.
144 *
145 * @param yangFileInfoSet YANG file info set
146 * @throws LinkerException a violation of linker rules
147 */
VinodKumarS-Huawei2ee9e7e2016-06-01 14:30:22 +0530148 void addReferencesToImportList(Set<YangFileInfo> yangFileInfoSet)
149 throws LinkerException;
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +0530150}