blob: 9010368a5c9a4c21407062267db19ddf695d51e1 [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/**
Bharat saraswald9822e92016-04-05 15:13:44 +053037 * Represents the information about the included sub-modules.
Vinod Kumar S19f39c72016-02-09 20:12:31 +053038 */
39public class YangInclude implements Parsable {
40
41 /**
42 * Name of the sub-module that is being included.
43 */
44 private String subModuleName;
45
46 /**
47 * The include's "revision-date" statement is used to specify the exact
48 * version of the submodule to import.
49 */
50 private String revision;
51
52 /**
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +053053 * Resolution information root node which is also the data model root node.
54 */
55 private HasResolutionInfo resolutionInfoNode;
56
57 /**
Bharat saraswald9822e92016-04-05 15:13:44 +053058 * Creates a YANG include.
Vinod Kumar S19f39c72016-02-09 20:12:31 +053059 */
60 public YangInclude() {
61 }
62
63 /**
Bharat saraswald9822e92016-04-05 15:13:44 +053064 * Returns the name of included sub-module.
Vinod Kumar S19f39c72016-02-09 20:12:31 +053065 *
66 * @return the sub-module name
67 */
68 public String getSubModuleName() {
69 return subModuleName;
70 }
71
72 /**
Bharat saraswald9822e92016-04-05 15:13:44 +053073 * Sets the name of included sub-modules.
Vinod Kumar S19f39c72016-02-09 20:12:31 +053074 *
75 * @param subModuleName the sub-module name to set
76 */
77 public void setSubModuleName(String subModuleName) {
78 this.subModuleName = subModuleName;
79 }
80
81 /**
Bharat saraswald9822e92016-04-05 15:13:44 +053082 * Returns the revision.
Vinod Kumar S19f39c72016-02-09 20:12:31 +053083 *
84 * @return the revision
85 */
86 public String getRevision() {
87 return revision;
88 }
89
90 /**
Bharat saraswald9822e92016-04-05 15:13:44 +053091 * Sets the revision.
Vinod Kumar S19f39c72016-02-09 20:12:31 +053092 *
93 * @param revision the revision to set
94 */
95 public void setRevision(String revision) {
96 this.revision = revision;
97 }
98
99 /**
100 * Returns the type of parsed data.
101 *
102 * @return returns INCLUDE_DATA
103 */
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530104 @Override
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530105 public YangConstructType getYangConstructType() {
106 return YangConstructType.INCLUDE_DATA;
Vinod Kumar S19f39c72016-02-09 20:12:31 +0530107 }
108
109 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530110 * Validates the data on entering the corresponding parse tree node.
Vinod Kumar S19f39c72016-02-09 20:12:31 +0530111 *
112 * @throws DataModelException a violation of data model rules
113 */
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530114 @Override
Vinod Kumar S19f39c72016-02-09 20:12:31 +0530115 public void validateDataOnEntry() throws DataModelException {
116 // TODO auto-generated method stub, to be implemented by parser
117
118 }
119
120 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530121 * Validates the data on exiting the corresponding parse tree node.
Vinod Kumar S19f39c72016-02-09 20:12:31 +0530122 *
123 * @throws DataModelException a violation of data model rules
124 */
Vinod Kumar S0c330cd2016-02-23 22:36:57 +0530125 @Override
Vinod Kumar S19f39c72016-02-09 20:12:31 +0530126 public void validateDataOnExit() throws DataModelException {
127 // TODO auto-generated method stub, to be implemented by parser
128
129 }
130
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +0530131 /**
132 * Returns the resolution information node.
133 *
134 * @return the resolution information node
135 */
136 public HasResolutionInfo getResolutionInfoNode() {
137 return resolutionInfoNode;
138 }
139
140 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530141 * Sets the dresolution information node.
Gaurav Agrawald9d6cc82016-03-29 02:17:23 +0530142 *
143 * @param resolutionInfoNode the resolution information node
144 */
145 public void setResolutionInfoNode(HasResolutionInfo resolutionInfoNode) {
146 this.resolutionInfoNode = resolutionInfoNode;
147 }
Vinod Kumar S19f39c72016-02-09 20:12:31 +0530148}