Vinod Kumar S | 6a33667 | 2016-02-09 20:12:31 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | 0f7908b | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Laboratory |
Vinod Kumar S | 6a33667 | 2016-02-09 20:12:31 +0530 | [diff] [blame] | 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 | |
| 18 | import org.onosproject.yangutils.datamodel.exceptions.DataModelException; |
| 19 | import org.onosproject.yangutils.parser.Parsable; |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 20 | import org.onosproject.yangutils.utils.YangConstructType; |
Vinod Kumar S | 6a33667 | 2016-02-09 20:12:31 +0530 | [diff] [blame] | 21 | |
| 22 | /* |
| 23 | * Reference:RFC 6020. |
| 24 | * The "include" statement is used to make content from a submodule |
| 25 | * available to that submodule's parent module, or to another submodule |
| 26 | * of that parent module. The argument is an identifier that is the |
| 27 | * name of the submodule to include. |
| 28 | * The includes's Substatements |
| 29 | * |
| 30 | * +---------------+---------+-------------+------------------+ |
| 31 | * | substatement | section | cardinality |data model mapping| |
| 32 | * +---------------+---------+-------------+------------------+ |
| 33 | * | revision-date | 7.1.5.1 | 0..1 | string | |
| 34 | * +---------------+---------+-------------+------------------+ |
| 35 | */ |
Vinod Kumar S | f677daf | 2016-04-15 18:08:57 +0530 | [diff] [blame] | 36 | |
Vinod Kumar S | 6a33667 | 2016-02-09 20:12:31 +0530 | [diff] [blame] | 37 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 38 | * Represents the information about the included sub-modules. |
Vinod Kumar S | 6a33667 | 2016-02-09 20:12:31 +0530 | [diff] [blame] | 39 | */ |
Vinod Kumar S | f677daf | 2016-04-15 18:08:57 +0530 | [diff] [blame] | 40 | public class YangInclude |
| 41 | implements Parsable { |
Vinod Kumar S | 6a33667 | 2016-02-09 20:12:31 +0530 | [diff] [blame] | 42 | |
| 43 | /** |
| 44 | * Name of the sub-module that is being included. |
| 45 | */ |
| 46 | private String subModuleName; |
| 47 | |
| 48 | /** |
| 49 | * The include's "revision-date" statement is used to specify the exact |
| 50 | * version of the submodule to import. |
| 51 | */ |
| 52 | private String revision; |
| 53 | |
| 54 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 55 | * Creates a YANG include. |
Vinod Kumar S | 6a33667 | 2016-02-09 20:12:31 +0530 | [diff] [blame] | 56 | */ |
| 57 | public YangInclude() { |
| 58 | } |
| 59 | |
| 60 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 61 | * Returns the name of included sub-module. |
Vinod Kumar S | 6a33667 | 2016-02-09 20:12:31 +0530 | [diff] [blame] | 62 | * |
| 63 | * @return the sub-module name |
| 64 | */ |
| 65 | public String getSubModuleName() { |
| 66 | return subModuleName; |
| 67 | } |
| 68 | |
| 69 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 70 | * Sets the name of included sub-modules. |
Vinod Kumar S | 6a33667 | 2016-02-09 20:12:31 +0530 | [diff] [blame] | 71 | * |
| 72 | * @param subModuleName the sub-module name to set |
| 73 | */ |
| 74 | public void setSubModuleName(String subModuleName) { |
| 75 | this.subModuleName = subModuleName; |
| 76 | } |
| 77 | |
| 78 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 79 | * Returns the revision. |
Vinod Kumar S | 6a33667 | 2016-02-09 20:12:31 +0530 | [diff] [blame] | 80 | * |
| 81 | * @return the revision |
| 82 | */ |
| 83 | public String getRevision() { |
| 84 | return revision; |
| 85 | } |
| 86 | |
| 87 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 88 | * Sets the revision. |
Vinod Kumar S | 6a33667 | 2016-02-09 20:12:31 +0530 | [diff] [blame] | 89 | * |
| 90 | * @param revision the revision to set |
| 91 | */ |
| 92 | public void setRevision(String revision) { |
| 93 | this.revision = revision; |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * Returns the type of parsed data. |
| 98 | * |
| 99 | * @return returns INCLUDE_DATA |
| 100 | */ |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 101 | @Override |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 102 | public YangConstructType getYangConstructType() { |
| 103 | return YangConstructType.INCLUDE_DATA; |
Vinod Kumar S | 6a33667 | 2016-02-09 20:12:31 +0530 | [diff] [blame] | 104 | } |
| 105 | |
| 106 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 107 | * Validates the data on entering the corresponding parse tree node. |
Vinod Kumar S | 6a33667 | 2016-02-09 20:12:31 +0530 | [diff] [blame] | 108 | * |
| 109 | * @throws DataModelException a violation of data model rules |
| 110 | */ |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 111 | @Override |
Vinod Kumar S | f677daf | 2016-04-15 18:08:57 +0530 | [diff] [blame] | 112 | public void validateDataOnEntry() |
| 113 | throws DataModelException { |
Vinod Kumar S | 6a33667 | 2016-02-09 20:12:31 +0530 | [diff] [blame] | 114 | // TODO auto-generated method stub, to be implemented by parser |
| 115 | |
| 116 | } |
| 117 | |
| 118 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 119 | * Validates the data on exiting the corresponding parse tree node. |
Vinod Kumar S | 6a33667 | 2016-02-09 20:12:31 +0530 | [diff] [blame] | 120 | * |
| 121 | * @throws DataModelException a violation of data model rules |
| 122 | */ |
Vinod Kumar S | c26bf19 | 2016-02-23 22:36:57 +0530 | [diff] [blame] | 123 | @Override |
Vinod Kumar S | f677daf | 2016-04-15 18:08:57 +0530 | [diff] [blame] | 124 | public void validateDataOnExit() |
| 125 | throws DataModelException { |
Vinod Kumar S | 6a33667 | 2016-02-09 20:12:31 +0530 | [diff] [blame] | 126 | // TODO auto-generated method stub, to be implemented by parser |
| 127 | |
| 128 | } |
| 129 | |
Vinod Kumar S | 6a33667 | 2016-02-09 20:12:31 +0530 | [diff] [blame] | 130 | } |