Vidyashree Rama | 1db1556 | 2016-05-17 16:16:15 +0530 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package org.onosproject.yangutils.plugin.manager; |
| 18 | |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 19 | import java.util.Objects; |
Bharat saraswal | 96dfef0 | 2016-06-16 00:29:12 +0530 | [diff] [blame] | 20 | |
Vidyashree Rama | 1db1556 | 2016-05-17 16:16:15 +0530 | [diff] [blame] | 21 | import org.onosproject.yangutils.datamodel.YangNode; |
Bharat saraswal | 96dfef0 | 2016-06-16 00:29:12 +0530 | [diff] [blame] | 22 | import org.onosproject.yangutils.datamodel.utils.ResolvableStatus; |
Vidyashree Rama | 1db1556 | 2016-05-17 16:16:15 +0530 | [diff] [blame] | 23 | |
| 24 | /** |
| 25 | * Represents YANG file information. |
| 26 | */ |
| 27 | public class YangFileInfo { |
| 28 | |
| 29 | /** |
| 30 | * YANG file name. |
| 31 | */ |
| 32 | private String yangFileName; |
| 33 | |
| 34 | /** |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 35 | * YANG file revision. |
| 36 | */ |
| 37 | private String revision; |
| 38 | |
| 39 | /** |
Vidyashree Rama | 1db1556 | 2016-05-17 16:16:15 +0530 | [diff] [blame] | 40 | * Data model node after parsing YANG file. |
| 41 | */ |
| 42 | private YangNode rootNode; |
| 43 | |
| 44 | /** |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 45 | * Resolution status of YANG file. |
| 46 | */ |
| 47 | private ResolvableStatus resolvableStatus; |
| 48 | |
| 49 | /** |
Bharat saraswal | 96dfef0 | 2016-06-16 00:29:12 +0530 | [diff] [blame] | 50 | * 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 Rama | 1db1556 | 2016-05-17 16:16:15 +0530 | [diff] [blame] | 60 | * 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 | */ |
| 82 | public String getYangFileName() { |
| 83 | return yangFileName; |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * Sets YANG file name. |
| 88 | * |
| 89 | * @param yangFileName YANG file name |
| 90 | */ |
| 91 | public void setYangFileName(String yangFileName) { |
| 92 | this.yangFileName = yangFileName; |
| 93 | } |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 94 | |
| 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 saraswal | 96dfef0 | 2016-06-16 00:29:12 +0530 | [diff] [blame] | 131 | /** |
| 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 | */ |
| 154 | public boolean isForTranslator() { |
| 155 | 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 | */ |
| 163 | public void setForTranslator(boolean isForTranslator) { |
| 164 | this.isForTranslator = isForTranslator; |
| 165 | } |
| 166 | |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 167 | @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 saraswal | 96dfef0 | 2016-06-16 00:29:12 +0530 | [diff] [blame] | 175 | return Objects.equals(yangFileName, other.yangFileName); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 176 | } |
| 177 | return false; |
| 178 | } |
| 179 | |
| 180 | @Override |
| 181 | public int hashCode() { |
Bharat saraswal | 96dfef0 | 2016-06-16 00:29:12 +0530 | [diff] [blame] | 182 | return Objects.hashCode(yangFileName); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 183 | } |
Vidyashree Rama | 1db1556 | 2016-05-17 16:16:15 +0530 | [diff] [blame] | 184 | } |