Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 16 | package org.onosproject.yangutils.datamodel; |
| 17 | |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 18 | import org.onosproject.yangutils.datamodel.exceptions.DataModelException; |
| 19 | import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil; |
| 20 | import org.onosproject.yangutils.parser.Parsable; |
| 21 | import org.onosproject.yangutils.translator.CachedFileHandle; |
| 22 | import org.onosproject.yangutils.utils.YangConstructType; |
| 23 | |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 24 | import java.util.LinkedList; |
| 25 | import java.util.List; |
| 26 | |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 27 | /* |
| 28 | * Reference RFC 6020. |
| 29 | * |
| 30 | * While the primary unit in YANG is a module, a YANG module can itself |
| 31 | * be constructed out of several submodules. Submodules allow a module |
| 32 | * designer to split a complex model into several pieces where all the |
| 33 | * submodules contribute to a single namespace, which is defined by the |
| 34 | * module that includes the submodules. |
| 35 | * |
| 36 | * The "submodule" statement defines the submodule's name, and groups |
| 37 | * all statements that belong to the submodule together. The |
| 38 | * "submodule" statement's argument is the name of the submodule, |
| 39 | * followed by a block of sub-statements that hold detailed submodule |
| 40 | * information. |
| 41 | * |
| 42 | * The submodule's sub-statements |
| 43 | * |
| 44 | * +--------------+---------+-------------+------------------+ |
| 45 | * | substatement | section | cardinality |data model mapping| |
| 46 | * +--------------+---------+-------------+------------------+ |
| 47 | * | anyxml | 7.10 | 0..n | - not supported | |
| 48 | * | augment | 7.15 | 0..n | - child nodes | |
| 49 | * | belongs-to | 7.2.2 | 1 | - YangBelongsTo | |
| 50 | * | choice | 7.9 | 0..n | - child nodes | |
| 51 | * | contact | 7.1.8 | 0..1 | - string | |
| 52 | * | container | 7.5 | 0..n | - child nodes | |
| 53 | * | description | 7.19.3 | 0..1 | - string | |
| 54 | * | deviation | 7.18.3 | 0..n | - TODO | |
| 55 | * | extension | 7.17 | 0..n | - TODO | |
| 56 | * | feature | 7.18.1 | 0..n | - TODO | |
| 57 | * | grouping | 7.11 | 0..n | - child nodes | |
| 58 | * | identity | 7.16 | 0..n | - TODO | |
| 59 | * | import | 7.1.5 | 0..n | - YangImport | |
| 60 | * | include | 7.1.6 | 0..n | - YangInclude | |
| 61 | * | leaf | 7.6 | 0..n | - YangLeaf | |
| 62 | * | leaf-list | 7.7 | 0..n | - YangLeafList | |
| 63 | * | list | 7.8 | 0..n | - child nodes | |
| 64 | * | notification | 7.14 | 0..n | - TODO | |
| 65 | * | organization | 7.1.7 | 0..1 | - string | |
| 66 | * | reference | 7.19.4 | 0..1 | - string | |
| 67 | * | revision | 7.1.9 | 0..n | - string | |
| 68 | * | rpc | 7.13 | 0..n | - TODO | |
| 69 | * | typedef | 7.3 | 0..n | - child nodes | |
| 70 | * | uses | 7.12 | 0..n | - child nodes | |
| 71 | * | YANG-version | 7.1.2 | 0..1 | - int | |
| 72 | * +--------------+---------+-------------+------------------+ |
| 73 | */ |
| 74 | /** |
| 75 | * Data model node to maintain information defined in YANG sub-module. |
| 76 | */ |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 77 | public class YangSubModule extends YangNode |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 78 | implements YangLeavesHolder, YangDesc, YangReference, Parsable, CollisionDetector { |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 79 | |
| 80 | /** |
| 81 | * Name of sub module. |
| 82 | */ |
| 83 | private String name; |
| 84 | |
| 85 | /** |
| 86 | * Module to which it belongs to. |
| 87 | */ |
| 88 | private YangBelongsTo belongsTo; |
| 89 | |
| 90 | /** |
| 91 | * Reference RFC 6020. |
| 92 | * |
| 93 | * The "contact" statement provides contact information for the module. The |
| 94 | * argument is a string that is used to specify contact information for the |
| 95 | * person or persons to whom technical queries concerning this module should |
| 96 | * be sent, such as their name, postal address, telephone number, and |
| 97 | * electronic mail address. |
| 98 | */ |
| 99 | private String contact; |
| 100 | |
| 101 | /** |
| 102 | * Description. |
| 103 | */ |
| 104 | private String description; |
| 105 | |
| 106 | /** |
| 107 | * List of YANG modules imported. |
| 108 | */ |
| 109 | private List<YangImport> importList; |
| 110 | |
| 111 | /** |
| 112 | * List of YANG sub-modules included. |
| 113 | */ |
| 114 | private List<YangInclude> includeList; |
| 115 | |
| 116 | /** |
| 117 | * List of leaves at root level in the sub-module. |
| 118 | */ |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 119 | private List<YangLeaf> listOfLeaf; |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 120 | |
| 121 | /** |
| 122 | * List of leaf-lists at root level in the sub-module. |
| 123 | */ |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 124 | private List<YangLeafList> listOfLeafList; |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 125 | |
| 126 | /** |
| 127 | * organization owner of the sub-module. |
| 128 | */ |
| 129 | private String organization; |
| 130 | |
| 131 | /** |
| 132 | * reference of the sub-module. |
| 133 | */ |
| 134 | private String reference; |
| 135 | |
| 136 | /** |
| 137 | * revision info of the sub-module. |
| 138 | */ |
| 139 | private YangRevision revision; |
| 140 | |
| 141 | /** |
| 142 | * YANG version. |
| 143 | */ |
| 144 | private byte version; |
| 145 | |
| 146 | /** |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 147 | * package of the generated java code. |
| 148 | */ |
| 149 | private String pkg; |
| 150 | |
| 151 | /** |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 152 | * Create a sub module node. |
| 153 | */ |
| 154 | public YangSubModule() { |
| 155 | super(YangNodeType.SUB_MODULE_NODE); |
| 156 | } |
| 157 | |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 158 | /** |
| 159 | * Get the YANG name of the sub module. |
| 160 | * |
| 161 | * @return YANG name of the sub module |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 162 | */ |
| 163 | @Override |
| 164 | public String getName() { |
| 165 | return name; |
| 166 | } |
| 167 | |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 168 | /** |
| 169 | * Set YANG name of the sub module. |
| 170 | * |
| 171 | * @param subModuleName YANG name of the sub module |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 172 | */ |
| 173 | @Override |
| 174 | public void setName(String subModuleName) { |
| 175 | name = subModuleName; |
| 176 | } |
| 177 | |
| 178 | /** |
| 179 | * Get the module info. |
| 180 | * |
| 181 | * @return the belongs to info |
| 182 | */ |
| 183 | public YangBelongsTo getBelongsTo() { |
| 184 | return belongsTo; |
| 185 | } |
| 186 | |
| 187 | /** |
| 188 | * Set the module info. |
| 189 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 190 | * @param belongsTo module info to set |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 191 | */ |
| 192 | public void setBelongsTo(YangBelongsTo belongsTo) { |
| 193 | this.belongsTo = belongsTo; |
| 194 | } |
| 195 | |
| 196 | /** |
| 197 | * Get the contact. |
| 198 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 199 | * @return the contact |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 200 | */ |
| 201 | public String getContact() { |
| 202 | return contact; |
| 203 | } |
| 204 | |
| 205 | /** |
| 206 | * Set the contact. |
| 207 | * |
| 208 | * @param contact the contact to set |
| 209 | */ |
| 210 | public void setContact(String contact) { |
| 211 | this.contact = contact; |
| 212 | } |
| 213 | |
| 214 | /** |
| 215 | * Get the description. |
| 216 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 217 | * @return the description |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 218 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 219 | @Override |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 220 | public String getDescription() { |
| 221 | return description; |
| 222 | } |
| 223 | |
| 224 | /** |
| 225 | * Set the description. |
| 226 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 227 | * @param description set the description |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 228 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 229 | @Override |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 230 | public void setDescription(String description) { |
| 231 | this.description = description; |
| 232 | } |
| 233 | |
| 234 | /** |
| 235 | * Get the list of imported modules. |
| 236 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 237 | * @return the list of imported modules |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 238 | */ |
| 239 | public List<YangImport> getImportList() { |
| 240 | return importList; |
| 241 | } |
| 242 | |
| 243 | /** |
| 244 | * prevent setting the import list from outside. |
| 245 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 246 | * @param importList the import list to set |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 247 | */ |
| 248 | private void setImportList(List<YangImport> importList) { |
| 249 | this.importList = importList; |
| 250 | } |
| 251 | |
| 252 | /** |
| 253 | * Add the imported module information to the import list. |
| 254 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 255 | * @param importedModule module being imported |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 256 | */ |
| 257 | public void addImportedInfo(YangImport importedModule) { |
| 258 | |
| 259 | if (getImportList() == null) { |
| 260 | setImportList(new LinkedList<YangImport>()); |
| 261 | } |
| 262 | |
| 263 | getImportList().add(importedModule); |
| 264 | |
| 265 | return; |
| 266 | } |
| 267 | |
| 268 | /** |
| 269 | * Get the list of included sub modules. |
| 270 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 271 | * @return the included list of sub modules |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 272 | */ |
| 273 | public List<YangInclude> getIncludeList() { |
| 274 | return includeList; |
| 275 | } |
| 276 | |
| 277 | /** |
| 278 | * Set the list of included sub modules. |
| 279 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 280 | * @param includeList the included list to set |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 281 | */ |
| 282 | private void setIncludeList(List<YangInclude> includeList) { |
| 283 | this.includeList = includeList; |
| 284 | } |
| 285 | |
| 286 | /** |
| 287 | * Add the included sub module information to the include list. |
| 288 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 289 | * @param includeModule submodule being included |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 290 | */ |
| 291 | public void addIncludedInfo(YangInclude includeModule) { |
| 292 | |
| 293 | if (getIncludeList() == null) { |
| 294 | setIncludeList(new LinkedList<YangInclude>()); |
| 295 | } |
| 296 | |
| 297 | getIncludeList().add(includeModule); |
| 298 | return; |
| 299 | } |
| 300 | |
| 301 | /** |
| 302 | * Get the list of leaves. |
| 303 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 304 | * @return the list of leaves |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 305 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 306 | @Override |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 307 | public List<YangLeaf> getListOfLeaf() { |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 308 | return listOfLeaf; |
| 309 | } |
| 310 | |
| 311 | /** |
| 312 | * Set the list of leaves. |
| 313 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 314 | * @param leafsList the list of leaf to set |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 315 | */ |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 316 | private void setListOfLeaf(List<YangLeaf> leafsList) { |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 317 | listOfLeaf = leafsList; |
| 318 | } |
| 319 | |
| 320 | /** |
| 321 | * Add a leaf. |
| 322 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 323 | * @param leaf the leaf to be added |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 324 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 325 | @Override |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 326 | public void addLeaf(YangLeaf leaf) { |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 327 | if (getListOfLeaf() == null) { |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 328 | setListOfLeaf(new LinkedList<YangLeaf>()); |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 329 | } |
| 330 | |
| 331 | getListOfLeaf().add(leaf); |
| 332 | } |
| 333 | |
| 334 | /** |
| 335 | * Get the list of leaf-list. |
| 336 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 337 | * @return the list of leaf-list |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 338 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 339 | @Override |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 340 | public List<YangLeafList> getListOfLeafList() { |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 341 | return listOfLeafList; |
| 342 | } |
| 343 | |
| 344 | /** |
| 345 | * Set the list of leaf-list. |
| 346 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 347 | * @param listOfLeafList the list of leaf-list to set |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 348 | */ |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 349 | private void setListOfLeafList(List<YangLeafList> listOfLeafList) { |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 350 | this.listOfLeafList = listOfLeafList; |
| 351 | } |
| 352 | |
| 353 | /** |
| 354 | * Add a leaf-list. |
| 355 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 356 | * @param leafList the leaf-list to be added |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 357 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 358 | @Override |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 359 | public void addLeafList(YangLeafList leafList) { |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 360 | if (getListOfLeafList() == null) { |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 361 | setListOfLeafList(new LinkedList<YangLeafList>()); |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 362 | } |
| 363 | |
| 364 | getListOfLeafList().add(leafList); |
| 365 | } |
| 366 | |
| 367 | /** |
| 368 | * Get the sub-modules organization. |
| 369 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 370 | * @return the organization |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 371 | */ |
| 372 | public String getOrganization() { |
| 373 | return organization; |
| 374 | } |
| 375 | |
| 376 | /** |
| 377 | * Set the sub-modules organization. |
| 378 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 379 | * @param org the organization to set |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 380 | */ |
| 381 | public void setOrganization(String org) { |
| 382 | organization = org; |
| 383 | } |
| 384 | |
| 385 | /** |
| 386 | * Get the textual reference. |
| 387 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 388 | * @return the reference |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 389 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 390 | @Override |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 391 | public String getReference() { |
| 392 | return reference; |
| 393 | } |
| 394 | |
| 395 | /** |
| 396 | * Set the textual reference. |
| 397 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 398 | * @param reference the reference to set |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 399 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 400 | @Override |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 401 | public void setReference(String reference) { |
| 402 | this.reference = reference; |
| 403 | } |
| 404 | |
| 405 | /** |
| 406 | * Get the revision. |
| 407 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 408 | * @return the revision |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 409 | */ |
| 410 | public YangRevision getRevision() { |
| 411 | return revision; |
| 412 | } |
| 413 | |
| 414 | /** |
| 415 | * Set the revision. |
| 416 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 417 | * @param revision the revision to set |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 418 | */ |
| 419 | public void setRevision(YangRevision revision) { |
| 420 | this.revision = revision; |
| 421 | } |
| 422 | |
| 423 | /** |
| 424 | * Get the version. |
| 425 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 426 | * @return the version |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 427 | */ |
| 428 | public byte getVersion() { |
| 429 | return version; |
| 430 | } |
| 431 | |
| 432 | /** |
| 433 | * Set the version. |
| 434 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 435 | * @param version the version to set |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 436 | */ |
| 437 | public void setVersion(byte version) { |
| 438 | this.version = version; |
| 439 | } |
| 440 | |
| 441 | /** |
| 442 | * Returns the type of the parsed data. |
| 443 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 444 | * @return returns SUB_MODULE_DATA |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 445 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 446 | @Override |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 447 | public YangConstructType getYangConstructType() { |
| 448 | return YangConstructType.SUB_MODULE_DATA; |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 449 | } |
| 450 | |
| 451 | /** |
| 452 | * Validate the data on entering the corresponding parse tree node. |
| 453 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 454 | * @throws DataModelException a violation of data model rules |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 455 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 456 | @Override |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 457 | public void validateDataOnEntry() throws DataModelException { |
| 458 | // TODO auto-generated method stub, to be implemented by parser |
| 459 | } |
| 460 | |
| 461 | /** |
| 462 | * Validate the data on exiting the corresponding parse tree node. |
| 463 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 464 | * @throws DataModelException a violation of data model rules |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 465 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 466 | @Override |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 467 | public void validateDataOnExit() throws DataModelException { |
| 468 | // TODO auto-generated method stub, to be implemented by parser |
| 469 | } |
| 470 | |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 471 | /** |
| 472 | * Generates java code for sub-module. |
Bharat saraswal | 022dae9 | 2016-03-04 20:08:09 +0530 | [diff] [blame] | 473 | * |
| 474 | * @param codeGenDir code generation directory. |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 475 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 476 | @Override |
Bharat saraswal | 022dae9 | 2016-03-04 20:08:09 +0530 | [diff] [blame] | 477 | public void generateJavaCodeEntry(String codeGenDir) { |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 478 | // TODO Auto-generated method stub |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 479 | } |
| 480 | |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 481 | /** |
| 482 | * Free resources used to generate code. |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 483 | */ |
Bharat saraswal | 9745996 | 2016-02-20 21:57:16 +0530 | [diff] [blame] | 484 | @Override |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 485 | public void generateJavaCodeExit() { |
| 486 | // TODO Auto-generated method stub |
| 487 | |
| 488 | } |
| 489 | |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 490 | /** |
| 491 | * Get the mapped java package. |
| 492 | * |
| 493 | * @return the java package |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 494 | */ |
| 495 | @Override |
| 496 | public String getPackage() { |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 497 | return pkg; |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 498 | } |
| 499 | |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 500 | /** |
| 501 | * Set the mapped java package. |
| 502 | * |
| 503 | * @param pakg the package to set |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 504 | */ |
| 505 | @Override |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 506 | public void setPackage(String pakg) { |
| 507 | pkg = pakg; |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 508 | } |
Bharat saraswal | 5e3c45c | 2016-02-22 22:15:21 +0530 | [diff] [blame] | 509 | |
| 510 | @Override |
| 511 | public CachedFileHandle getFileHandle() { |
| 512 | // TODO Auto-generated method stub |
| 513 | return null; |
| 514 | } |
| 515 | |
| 516 | @Override |
| 517 | public void setFileHandle(CachedFileHandle fileHandle) { |
| 518 | // TODO Auto-generated method stub |
| 519 | |
| 520 | } |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 521 | |
| 522 | @Override |
| 523 | public void detectCollidingChild(String identifierName, YangConstructType dataType) throws DataModelException { |
| 524 | // Asks helper to detect colliding child. |
| 525 | detectCollidingChildUtil(identifierName, dataType, this); |
| 526 | } |
| 527 | |
| 528 | @Override |
| 529 | public void detectSelfCollision(String identifierName, YangConstructType dataType) throws DataModelException { |
| 530 | // Not required as module doesn't have any parent. |
| 531 | } |
Vinod Kumar S | 6a6ce4c | 2016-02-11 20:13:28 +0530 | [diff] [blame] | 532 | } |