blob: 5326764082d65afabd9d42328f967fc878f94de8 [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;
20import org.onosproject.yangutils.parser.ParsableDataType;
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 *
93 * @return the name.
94 */
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 *
111 * @return the referred group.
112 */
113 public YangGrouping getRefGroup() {
114 return refGroup;
115 }
116
117 /**
118 * Set the referred group.
119 *
120 * @param refGroup the referred group.
121 */
122 public void setRefGroup(YangGrouping refGroup) {
123 this.refGroup = refGroup;
124 }
125
126 /**
127 * Get the description.
128 *
129 * @return the description.
130 */
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 *
139 * @param description set the description.
140 */
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 *
149 * @return the reference.
150 */
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 *
159 * @param reference the reference to set.
160 */
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 *
169 * @return the status.
170 */
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 *
179 * @param status the status to set.
180 */
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 *
189 * @return returns USES_DATA.
190 */
Bharat saraswal594bc6d2016-02-22 22:15:21 +0530191 @Override
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530192 public ParsableDataType getParsableDataType() {
193 return ParsableDataType.USES_DATA;
194 }
195
196 /**
197 * Validate the data on entering the corresponding parse tree node.
198 *
199 * @throws DataModelException a violation of data model rules.
200 */
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 *
209 * @throws DataModelException a violation of data model rules.
210 */
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
216 /* (non-Javadoc)
217 * @see org.onosproject.yangutils.datamodel.YangNode#getName()
218 */
219 @Override
220 public String getName() {
221 // TODO Auto-generated method stub
222 return null;
223 }
224
225 /* (non-Javadoc)
226 * @see org.onosproject.yangutils.datamodel.YangNode#setName(java.lang.String)
227 */
228 @Override
229 public void setName(String name) {
230 // TODO Auto-generated method stub
231
232 }
233
234 /* (non-Javadoc)
235 * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeEntry()
236 */
Bharat saraswal594bc6d2016-02-22 22:15:21 +0530237 @Override
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530238 public void generateJavaCodeEntry() {
239 // TODO Auto-generated method stub
240
241 }
242
243 /* (non-Javadoc)
244 * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeExit()
245 */
Bharat saraswal594bc6d2016-02-22 22:15:21 +0530246 @Override
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530247 public void generateJavaCodeExit() {
248 // TODO Auto-generated method stub
249
250 }
251
252 /* (non-Javadoc)
253 * @see org.onosproject.yangutils.datamodel.YangNode#getPackage()
254 */
255 @Override
256 public String getPackage() {
257 // TODO Auto-generated method stub
258 return null;
259 }
260
261 /* (non-Javadoc)
262 * @see org.onosproject.yangutils.datamodel.YangNode#setPackage(java.lang.String)
263 */
264 @Override
265 public void setPackage(String pkg) {
266 // TODO Auto-generated method stub
267
268 }
Bharat saraswal594bc6d2016-02-22 22:15:21 +0530269
270 @Override
271 public CachedFileHandle getFileHandle() {
272 // TODO Auto-generated method stub
273 return null;
274 }
275
276 @Override
277 public void setFileHandle(CachedFileHandle fileHandle) {
278 // TODO Auto-generated method stub
279
280 }
Vinod Kumar S2ff139c2016-02-16 01:37:16 +0530281}