blob: 19fb709787ee682de1152bfaf7cfb2492817a3ba [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;
21
22/*-
23 * Reference RFC 6020.
24 *
25 * The "uses" statement is used to reference a "grouping" definition. It takes
26 * one argument, which is the name of the grouping.
27 *
28 * The effect of a "uses" reference to a grouping is that the nodes defined by
29 * the grouping are copied into the current schema tree, and then updated
30 * according to the "refine" and "augment" statements.
31 *
32 * The identifiers defined in the grouping are not bound to a namespace until
33 * the contents of the grouping are added to the schema tree via a "uses"
34 * statement that does not appear inside a "grouping" statement, at which point
35 * they are bound to the namespace of the current module.
36 *
37 * The uses's sub-statements
38 *
39 * +--------------+---------+-------------+------------------+
40 * | substatement | section | cardinality |data model mapping|
41 * +--------------+---------+-------------+------------------+
42 * | augment | 7.15 | 0..1 | -child nodes |
43 * | description | 7.19.3 | 0..1 | -string |
44 * | if-feature | 7.18.2 | 0..n | -TODO |
45 * | refine | 7.12.2 | 0..1 | -TODO |
46 * | reference | 7.19.4 | 0..1 | -string |
47 * | status | 7.19.2 | 0..1 | -YangStatus |
48 * | when | 7.19.5 | 0..1 | -TODO |
49 * +--------------+---------+-------------+------------------+
50 */
51/**
52 * Data model node to maintain information defined in YANG uses.
53 *
54 */
55public class YangUses extends YangNode implements YangCommonInfo, Parsable {
56
57 /**
58 * Name.
59 */
60 private String name;
61
62 /**
63 * referred group.
64 */
65 private YangGrouping refGroup;
66
67 /**
68 * description.
69 */
70 private String description;
71
72 /**
73 * YANG reference.
74 */
75 private String reference;
76
77 /**
78 * Status.
79 */
80 private YangStatusType status;
81
82 /**
83 * Create an YANG uses node.
84 */
85 public YangUses() {
86 super(YangNodeType.USES_NODE);
87 }
88
89 /**
90 * Get the name.
91 *
92 * @return the name.
93 */
94 public String getRefGroupingName() {
95 return name;
96 }
97
98 /**
99 * Set the name.
100 *
101 * @param refGroupingName the referred grouping name to set
102 */
103 public void setRefGroupingName(String refGroupingName) {
104 name = refGroupingName;
105 }
106
107 /**
108 * Get the referred group.
109 *
110 * @return the referred group.
111 */
112 public YangGrouping getRefGroup() {
113 return refGroup;
114 }
115
116 /**
117 * Set the referred group.
118 *
119 * @param refGroup the referred group.
120 */
121 public void setRefGroup(YangGrouping refGroup) {
122 this.refGroup = refGroup;
123 }
124
125 /**
126 * Get the description.
127 *
128 * @return the description.
129 */
130 public String getDescription() {
131 return description;
132 }
133
134 /**
135 * Set the description.
136 *
137 * @param description set the description.
138 */
139 public void setDescription(String description) {
140 this.description = description;
141 }
142
143 /**
144 * Get the textual reference.
145 *
146 * @return the reference.
147 */
148 public String getReference() {
149 return reference;
150 }
151
152 /**
153 * Set the textual reference.
154 *
155 * @param reference the reference to set.
156 */
157 public void setReference(String reference) {
158 this.reference = reference;
159 }
160
161 /**
162 * Get the status.
163 *
164 * @return the status.
165 */
166 public YangStatusType getStatus() {
167 return status;
168 }
169
170 /**
171 * Set the status.
172 *
173 * @param status the status to set.
174 */
175 public void setStatus(YangStatusType status) {
176 this.status = status;
177 }
178
179 /**
180 * Returns the type of the data.
181 *
182 * @return returns USES_DATA.
183 */
184 public ParsableDataType getParsableDataType() {
185 return ParsableDataType.USES_DATA;
186 }
187
188 /**
189 * Validate the data on entering the corresponding parse tree node.
190 *
191 * @throws DataModelException a violation of data model rules.
192 */
193 public void validateDataOnEntry() throws DataModelException {
194 // TODO auto-generated method stub, to be implemented by parser
195 }
196
197 /**
198 * Validate the data on exiting the corresponding parse tree node.
199 *
200 * @throws DataModelException a violation of data model rules.
201 */
202 public void validateDataOnExit() throws DataModelException {
203 // TODO auto-generated method stub, to be implemented by parser
204 }
205
206 /* (non-Javadoc)
207 * @see org.onosproject.yangutils.datamodel.YangNode#getName()
208 */
209 @Override
210 public String getName() {
211 // TODO Auto-generated method stub
212 return null;
213 }
214
215 /* (non-Javadoc)
216 * @see org.onosproject.yangutils.datamodel.YangNode#setName(java.lang.String)
217 */
218 @Override
219 public void setName(String name) {
220 // TODO Auto-generated method stub
221
222 }
223
224 /* (non-Javadoc)
225 * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeEntry()
226 */
227 public void generateJavaCodeEntry() {
228 // TODO Auto-generated method stub
229
230 }
231
232 /* (non-Javadoc)
233 * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeExit()
234 */
235 public void generateJavaCodeExit() {
236 // TODO Auto-generated method stub
237
238 }
239
240 /* (non-Javadoc)
241 * @see org.onosproject.yangutils.datamodel.YangNode#getPackage()
242 */
243 @Override
244 public String getPackage() {
245 // TODO Auto-generated method stub
246 return null;
247 }
248
249 /* (non-Javadoc)
250 * @see org.onosproject.yangutils.datamodel.YangNode#setPackage(java.lang.String)
251 */
252 @Override
253 public void setPackage(String pkg) {
254 // TODO Auto-generated method stub
255
256 }
257}