blob: 4eb22e564248774af9686c3afa6f386a43a9c9fd [file] [log] [blame]
Vidyashree Rama1db15562016-05-17 16:16:15 +05301/*
2 * Copyright 2016-present 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
17package org.onosproject.yangutils.plugin.manager;
18
Gaurav Agrawal0d43bb52016-05-17 18:06:38 +053019import java.util.Objects;
Bharat saraswal96dfef02016-06-16 00:29:12 +053020
Vidyashree Rama1db15562016-05-17 16:16:15 +053021import org.onosproject.yangutils.datamodel.YangNode;
Bharat saraswal96dfef02016-06-16 00:29:12 +053022import org.onosproject.yangutils.datamodel.utils.ResolvableStatus;
Vidyashree Rama1db15562016-05-17 16:16:15 +053023
24/**
25 * Represents YANG file information.
26 */
Bharat saraswal2d90b0c2016-08-04 02:00:03 +053027class YangFileInfo {
Vidyashree Rama1db15562016-05-17 16:16:15 +053028
29 /**
30 * YANG file name.
31 */
32 private String yangFileName;
33
34 /**
Gaurav Agrawal0d43bb52016-05-17 18:06:38 +053035 * YANG file revision.
36 */
37 private String revision;
38
39 /**
Vidyashree Rama1db15562016-05-17 16:16:15 +053040 * Data model node after parsing YANG file.
41 */
42 private YangNode rootNode;
43
44 /**
Gaurav Agrawal0d43bb52016-05-17 18:06:38 +053045 * Resolution status of YANG file.
46 */
47 private ResolvableStatus resolvableStatus;
48
49 /**
Bharat saraswal96dfef02016-06-16 00:29:12 +053050 * Location for serialized files in case of inter-jar dependencies.
51 */
52 private String serializedFile;
53
54 /**
55 * Flag to know if the root node require to be translated.
56 */
57 private boolean isForTranslator = true;
58
59 /**
Vidyashree Rama1db15562016-05-17 16:16:15 +053060 * Returns data model node for YANG file.
61 *
62 * @return data model node for YANG file
63 */
64 public YangNode getRootNode() {
65 return rootNode;
66 }
67
68 /**
69 * Sets data model node for YANG file.
70 *
71 * @param rootNode of the Yang file
72 */
73 public void setRootNode(YangNode rootNode) {
74 this.rootNode = rootNode;
75 }
76
77 /**
78 * Returns YANG file name.
79 *
80 * @return yangFileName YANG file name
81 */
Bharat saraswal2d90b0c2016-08-04 02:00:03 +053082 String getYangFileName() {
Vidyashree Rama1db15562016-05-17 16:16:15 +053083 return yangFileName;
84 }
85
86 /**
87 * Sets YANG file name.
88 *
89 * @param yangFileName YANG file name
90 */
Bharat saraswal2d90b0c2016-08-04 02:00:03 +053091 void setYangFileName(String yangFileName) {
Vidyashree Rama1db15562016-05-17 16:16:15 +053092 this.yangFileName = yangFileName;
93 }
Gaurav Agrawal0d43bb52016-05-17 18:06:38 +053094
95 /**
96 * Returns the revision of YANG file.
97 *
98 * @return revision of YANG file
99 */
100 public String getRevision() {
101 return revision;
102 }
103
104 /**
105 * Sets the revision of YANG file.
106 *
107 * @param revision revision of YANG file
108 */
109 public void setRevision(String revision) {
110 this.revision = revision;
111 }
112
113 /**
114 * Returns the resolution status of YANG file.
115 *
116 * @return resolution status of YANG file
117 */
118 public ResolvableStatus getResolvableStatus() {
119 return resolvableStatus;
120 }
121
122 /**
123 * Sets the resolution status of YANG file.
124 *
125 * @param resolvableStatus resolution status of YANG file
126 */
127 public void setResolvableStatus(ResolvableStatus resolvableStatus) {
128 this.resolvableStatus = resolvableStatus;
129 }
130
Bharat saraswal96dfef02016-06-16 00:29:12 +0530131 /**
132 * Returns serialized file of datamodel.
133 *
134 * @return the serialized file of datamodel
135 */
136 public String getSerializedFile() {
137 return serializedFile;
138 }
139
140 /**
141 * Sets serialized file of datamodel.
142 *
143 * @param serializedFile serialized file of datamodel
144 */
145 public void setSerializedFile(String serializedFile) {
146 this.serializedFile = serializedFile;
147 }
148
149 /**
150 * Returns true if node need to be translated.
151 *
152 * @return isForTranslator true if node need to be translated
153 */
Bharat saraswal2d90b0c2016-08-04 02:00:03 +0530154 boolean isForTranslator() {
Bharat saraswal96dfef02016-06-16 00:29:12 +0530155 return isForTranslator;
156 }
157
158 /**
159 * Sets true if node need to be translated.
160 *
161 * @param isForTranslator true if node need to be translated
162 */
Bharat saraswal2d90b0c2016-08-04 02:00:03 +0530163 void setForTranslator(boolean isForTranslator) {
Bharat saraswal96dfef02016-06-16 00:29:12 +0530164 this.isForTranslator = isForTranslator;
165 }
166
Gaurav Agrawal0d43bb52016-05-17 18:06:38 +0530167 @Override
168 public boolean equals(Object obj) {
169
170 if (this == obj) {
171 return true;
172 }
173 if (obj instanceof YangFileInfo) {
174 final YangFileInfo other = (YangFileInfo) obj;
Bharat saraswal96dfef02016-06-16 00:29:12 +0530175 return Objects.equals(yangFileName, other.yangFileName);
Gaurav Agrawal0d43bb52016-05-17 18:06:38 +0530176 }
177 return false;
178 }
179
180 @Override
181 public int hashCode() {
Bharat saraswal96dfef02016-06-16 00:29:12 +0530182 return Objects.hashCode(yangFileName);
Gaurav Agrawal0d43bb52016-05-17 18:06:38 +0530183 }
Vidyashree Rama1db15562016-05-17 16:16:15 +0530184}