blob: 70e7016ea4ff876851e5cf856cbf12f421e1eacc [file] [log] [blame]
Vinod Kumar S19f39c72016-02-09 20:12:31 +05301/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
Vinod Kumar S19f39c72016-02-09 20:12:31 +05303 *
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;
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +053020import org.onosproject.yangutils.utils.YangConstructType;
Vinod Kumar S19f39c72016-02-09 20:12:31 +053021
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 */
40public 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 /**
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +053054 * Resolution information root node which is also the data model root node.
55 */
56 private HasResolutionInfo resolutionInfoNode;
57
58 /**
Vinod Kumar S19f39c72016-02-09 20:12:31 +053059 * Default constructor.
60 */
61 public YangInclude() {
62 }
63
64 /**
65 * Get the name of included sub-module.
66 *
67 * @return the sub-module name
68 */
69 public String getSubModuleName() {
70 return subModuleName;
71 }
72
73 /**
74 * Set the name of included sub-modules.
75 *
76 * @param subModuleName the sub-module name to set
77 */
78 public void setSubModuleName(String subModuleName) {
79 this.subModuleName = subModuleName;
80 }
81
82 /**
83 * Get the revision.
84 *
85 * @return the revision
86 */
87 public String getRevision() {
88 return revision;
89 }
90
91 /**
92 * Set the revision.
93 *
94 * @param revision the revision to set
95 */
96 public void setRevision(String revision) {
97 this.revision = revision;
98 }
99
100 /**
101 * Returns the type of parsed data.
102 *
103 * @return returns INCLUDE_DATA
104 */
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530105 @Override
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530106 public YangConstructType getYangConstructType() {
107 return YangConstructType.INCLUDE_DATA;
Vinod Kumar S19f39c72016-02-09 20:12:31 +0530108 }
109
110 /**
111 * Validate the data on entering the corresponding parse tree node.
112 *
113 * @throws DataModelException a violation of data model rules
114 */
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530115 @Override
Vinod Kumar S19f39c72016-02-09 20:12:31 +0530116 public void validateDataOnEntry() throws DataModelException {
117 // TODO auto-generated method stub, to be implemented by parser
118
119 }
120
121 /**
122 * Validate the data on exiting the corresponding parse tree node.
123 *
124 * @throws DataModelException a violation of data model rules
125 */
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530126 @Override
Vinod Kumar S19f39c72016-02-09 20:12:31 +0530127 public void validateDataOnExit() throws DataModelException {
128 // TODO auto-generated method stub, to be implemented by parser
129
130 }
131
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +0530132 /**
133 * Returns the resolution information node.
134 *
135 * @return the resolution information node
136 */
137 public HasResolutionInfo getResolutionInfoNode() {
138 return resolutionInfoNode;
139 }
140
141 /**
142 * Set the dresolution information node.
143 *
144 * @param resolutionInfoNode the resolution information node
145 */
146 public void setResolutionInfoNode(HasResolutionInfo resolutionInfoNode) {
147 this.resolutionInfoNode = resolutionInfoNode;
148 }
Vinod Kumar S19f39c72016-02-09 20:12:31 +0530149}