blob: 9086f9a9ff7bf0db304455e619058b503777c515 [file] [log] [blame]
Vinod Kumar S2ff139c2016-02-16 01:37:16 +05301/*
2 * Copyright 2016 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 */
16package org.onosproject.yangutils.datamodel;
17
18import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
19import org.onosproject.yangutils.parser.Parsable;
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +053020import org.onosproject.yangutils.utils.YangConstructType;
Bharat saraswal594bc6d2016-02-22 22:15:21 +053021import org.onosproject.yangutils.translator.CachedFileHandle;
Vinod Kumar S2ff139c2016-02-16 01:37:16 +053022
23/*-
24 * Reference RFC 6020.
25 *
26 * The "uses" statement is used to reference a "grouping" definition. It takes
27 * one argument, which is the name of the grouping.
28 *
29 * The effect of a "uses" reference to a grouping is that the nodes defined by
30 * the grouping are copied into the current schema tree, and then updated
31 * according to the "refine" and "augment" statements.
32 *
33 * The identifiers defined in the grouping are not bound to a namespace until
34 * the contents of the grouping are added to the schema tree via a "uses"
35 * statement that does not appear inside a "grouping" statement, at which point
36 * they are bound to the namespace of the current module.
37 *
38 * The uses's sub-statements
39 *
40 * +--------------+---------+-------------+------------------+
41 * | substatement | section | cardinality |data model mapping|
42 * +--------------+---------+-------------+------------------+
43 * | augment | 7.15 | 0..1 | -child nodes |
44 * | description | 7.19.3 | 0..1 | -string |
45 * | if-feature | 7.18.2 | 0..n | -TODO |
46 * | refine | 7.12.2 | 0..1 | -TODO |
47 * | reference | 7.19.4 | 0..1 | -string |
48 * | status | 7.19.2 | 0..1 | -YangStatus |
49 * | when | 7.19.5 | 0..1 | -TODO |
50 * +--------------+---------+-------------+------------------+
51 */
52/**
53 * Data model node to maintain information defined in YANG uses.
54 *
55 */
56public class YangUses extends YangNode implements YangCommonInfo, Parsable {
57
58 /**
59 * Name.
60 */
61 private String name;
62
63 /**
64 * referred group.
65 */
66 private YangGrouping refGroup;
67
68 /**
69 * description.
70 */
71 private String description;
72
73 /**
74 * YANG reference.
75 */
76 private String reference;
77
78 /**
79 * Status.
80 */
81 private YangStatusType status;
82
83 /**
84 * Create an YANG uses node.
85 */
86 public YangUses() {
87 super(YangNodeType.USES_NODE);
88 }
89
90 /**
91 * Get the name.
92 *
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +053093 * @return the name
Vinod Kumar S2ff139c2016-02-16 01:37:16 +053094 */
95 public String getRefGroupingName() {
96 return name;
97 }
98
99 /**
100 * Set the name.
101 *
102 * @param refGroupingName the referred grouping name to set
103 */
104 public void setRefGroupingName(String refGroupingName) {
105 name = refGroupingName;
106 }
107
108 /**
109 * Get the referred group.
110 *
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530111 * @return the referred group
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530112 */
113 public YangGrouping getRefGroup() {
114 return refGroup;
115 }
116
117 /**
118 * Set the referred group.
119 *
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530120 * @param refGroup the referred group
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530121 */
122 public void setRefGroup(YangGrouping refGroup) {
123 this.refGroup = refGroup;
124 }
125
126 /**
127 * Get the description.
128 *
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530129 * @return the description
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530130 */
Bharat saraswal594bc6d2016-02-22 22:15:21 +0530131 @Override
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530132 public String getDescription() {
133 return description;
134 }
135
136 /**
137 * Set the description.
138 *
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530139 * @param description set the description
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530140 */
Bharat saraswal594bc6d2016-02-22 22:15:21 +0530141 @Override
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530142 public void setDescription(String description) {
143 this.description = description;
144 }
145
146 /**
147 * Get the textual reference.
148 *
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530149 * @return the reference
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530150 */
Bharat saraswal594bc6d2016-02-22 22:15:21 +0530151 @Override
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530152 public String getReference() {
153 return reference;
154 }
155
156 /**
157 * Set the textual reference.
158 *
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530159 * @param reference the reference to set
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530160 */
Bharat saraswal594bc6d2016-02-22 22:15:21 +0530161 @Override
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530162 public void setReference(String reference) {
163 this.reference = reference;
164 }
165
166 /**
167 * Get the status.
168 *
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530169 * @return the status
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530170 */
Bharat saraswal594bc6d2016-02-22 22:15:21 +0530171 @Override
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530172 public YangStatusType getStatus() {
173 return status;
174 }
175
176 /**
177 * Set the status.
178 *
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530179 * @param status the status to set
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530180 */
Bharat saraswal594bc6d2016-02-22 22:15:21 +0530181 @Override
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530182 public void setStatus(YangStatusType status) {
183 this.status = status;
184 }
185
186 /**
187 * Returns the type of the data.
188 *
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530189 * @return returns USES_DATA
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530190 */
Bharat saraswal594bc6d2016-02-22 22:15:21 +0530191 @Override
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530192 public YangConstructType getYangConstructType() {
193 return YangConstructType.USES_DATA;
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530194 }
195
196 /**
197 * Validate the data on entering the corresponding parse tree node.
198 *
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530199 * @throws DataModelException a violation of data model rules
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530200 */
Bharat saraswal594bc6d2016-02-22 22:15:21 +0530201 @Override
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530202 public void validateDataOnEntry() throws DataModelException {
203 // TODO auto-generated method stub, to be implemented by parser
204 }
205
206 /**
207 * Validate the data on exiting the corresponding parse tree node.
208 *
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530209 * @throws DataModelException a violation of data model rules
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530210 */
Bharat saraswal594bc6d2016-02-22 22:15:21 +0530211 @Override
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530212 public void validateDataOnExit() throws DataModelException {
213 // TODO auto-generated method stub, to be implemented by parser
214 }
215
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530216 @Override
217 public String getName() {
218 // TODO Auto-generated method stub
219 return null;
220 }
221
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530222 @Override
223 public void setName(String name) {
224 // TODO Auto-generated method stub
225
226 }
227
Bharat saraswal594bc6d2016-02-22 22:15:21 +0530228 @Override
Bharat saraswal2f00b4b2016-03-04 20:08:09 +0530229 public void generateJavaCodeEntry(String codeGenDir) {
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530230 // TODO Auto-generated method stub
231
232 }
233
Bharat saraswal594bc6d2016-02-22 22:15:21 +0530234 @Override
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530235 public void generateJavaCodeExit() {
236 // TODO Auto-generated method stub
237
238 }
239
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530240 @Override
241 public String getPackage() {
242 // TODO Auto-generated method stub
243 return null;
244 }
245
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530246 @Override
247 public void setPackage(String pkg) {
248 // TODO Auto-generated method stub
249
250 }
Bharat saraswal594bc6d2016-02-22 22:15:21 +0530251
252 @Override
253 public CachedFileHandle getFileHandle() {
254 // TODO Auto-generated method stub
255 return null;
256 }
257
258 @Override
259 public void setFileHandle(CachedFileHandle fileHandle) {
260 // TODO Auto-generated method stub
261
262 }
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530263}