Vinod Kumar S | 6a33667 | 2016-02-09 20:12:31 +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 | |
| 18 | import org.onosproject.yangutils.datamodel.exceptions.DataModelException; |
| 19 | import org.onosproject.yangutils.parser.Parsable; |
| 20 | import org.onosproject.yangutils.parser.ParsableDataType; |
| 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 | */ |
| 36 | /** |
| 37 | * Maintains the information about the included sub-modules. |
| 38 | * |
| 39 | */ |
| 40 | public class YangInclude implements Parsable { |
| 41 | |
| 42 | /** |
| 43 | * Name of the sub-module that is being included. |
| 44 | */ |
| 45 | private String subModuleName; |
| 46 | |
| 47 | /** |
| 48 | * The include's "revision-date" statement is used to specify the exact |
| 49 | * version of the submodule to import. |
| 50 | */ |
| 51 | private String revision; |
| 52 | |
| 53 | /** |
| 54 | * Default constructor. |
| 55 | */ |
| 56 | public YangInclude() { |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * Get the name of included sub-module. |
| 61 | * |
| 62 | * @return the sub-module name |
| 63 | */ |
| 64 | public String getSubModuleName() { |
| 65 | return subModuleName; |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * Set the name of included sub-modules. |
| 70 | * |
| 71 | * @param subModuleName the sub-module name to set |
| 72 | */ |
| 73 | public void setSubModuleName(String subModuleName) { |
| 74 | this.subModuleName = subModuleName; |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Get the revision. |
| 79 | * |
| 80 | * @return the revision |
| 81 | */ |
| 82 | public String getRevision() { |
| 83 | return revision; |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * Set the revision. |
| 88 | * |
| 89 | * @param revision the revision to set |
| 90 | */ |
| 91 | public void setRevision(String revision) { |
| 92 | this.revision = revision; |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * Returns the type of parsed data. |
| 97 | * |
| 98 | * @return returns INCLUDE_DATA |
| 99 | */ |
| 100 | public ParsableDataType getParsableDataType() { |
| 101 | return ParsableDataType.INCLUDE_DATA; |
| 102 | } |
| 103 | |
| 104 | /** |
| 105 | * Validate the data on entering the corresponding parse tree node. |
| 106 | * |
| 107 | * @throws DataModelException a violation of data model rules |
| 108 | */ |
| 109 | public void validateDataOnEntry() throws DataModelException { |
| 110 | // TODO auto-generated method stub, to be implemented by parser |
| 111 | |
| 112 | } |
| 113 | |
| 114 | /** |
| 115 | * Validate the data on exiting the corresponding parse tree node. |
| 116 | * |
| 117 | * @throws DataModelException a violation of data model rules |
| 118 | */ |
| 119 | public void validateDataOnExit() throws DataModelException { |
| 120 | // TODO auto-generated method stub, to be implemented by parser |
| 121 | |
| 122 | } |
| 123 | |
| 124 | } |