Shankara-Huawei | df7b9ca | 2016-07-14 11:35:34 +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 | package org.onosproject.yangutils.datamodel; |
| 17 | |
| 18 | import org.onosproject.yangutils.datamodel.exceptions.DataModelException; |
| 19 | import org.onosproject.yangutils.datamodel.utils.ResolvableStatus; |
| 20 | |
| 21 | import java.io.Serializable; |
| 22 | |
| 23 | /** |
| 24 | * Reference RFC 6020. |
| 25 | * |
| 26 | * Represents data model node to maintain information defined in YANG base. |
| 27 | * The "base" statement, which is optional, takes as an argument a |
| 28 | * string that is the name of an existing identity, from which the new |
| 29 | * identity is derived. If no "base" statement is present, the identity |
| 30 | * is defined from scratch. |
| 31 | * |
| 32 | * If a prefix is present on the base name, it refers to an identity |
| 33 | * defined in the module that was imported with that prefix, or the |
| 34 | * local module if the prefix matches the local module's prefix. |
| 35 | * Otherwise, an identity with the matching name MUST be defined in the |
| 36 | * current module or an included submodule. |
| 37 | */ |
| 38 | |
| 39 | /** |
| 40 | * Represents data model node to maintain information defined in YANG base. |
| 41 | */ |
| 42 | public class YangBase implements Resolvable, Serializable { |
| 43 | |
| 44 | private static final long serialVersionUID = 806201693L; |
| 45 | |
| 46 | // YANG node identifier. |
| 47 | private YangNodeIdentifier baseIdentifier; |
| 48 | |
| 49 | // Referred identity parent information. |
| 50 | private YangIdentity referredIdentity; |
| 51 | |
| 52 | /** |
| 53 | * Status of resolution. If completely resolved enum value is "RESOLVED", |
| 54 | * if not enum value is "UNRESOLVED", in case reference of grouping/typedef/base/identityref |
| 55 | * is added to uses/type/base/identityref but it's not resolved value of enum should be |
| 56 | * "INTRA_FILE_RESOLVED". |
| 57 | */ |
| 58 | private ResolvableStatus resolvableStatus; |
| 59 | |
| 60 | // Creates a base type of node. |
| 61 | public YangBase() { |
| 62 | resolvableStatus = ResolvableStatus.UNRESOLVED; |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Returns the YANG node identifier. |
| 67 | * |
| 68 | * @return the YANG node identifier |
| 69 | */ |
| 70 | public YangNodeIdentifier getBaseIdentifier() { |
| 71 | return baseIdentifier; |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * Sets the YANG node identifier. |
| 76 | * |
| 77 | * @param baseIdentifier the YANG node identifier to set |
| 78 | */ |
| 79 | public void setBaseIdentifier(YangNodeIdentifier baseIdentifier) { |
| 80 | this.baseIdentifier = baseIdentifier; |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * Returns the parent identity node. |
| 85 | * |
| 86 | * @return the parent identity node |
| 87 | */ |
| 88 | public YangIdentity getReferredIdentity() { |
| 89 | return referredIdentity; |
| 90 | } |
| 91 | |
| 92 | /** |
| 93 | * Sets the parent identity node. |
| 94 | * |
| 95 | * @param referredIdentity the parent identity node to set |
| 96 | */ |
| 97 | public void setReferredIdentity(YangIdentity referredIdentity) { |
| 98 | this.referredIdentity = referredIdentity; |
| 99 | } |
| 100 | |
| 101 | @Override |
| 102 | public ResolvableStatus getResolvableStatus() { |
| 103 | return resolvableStatus; |
| 104 | } |
| 105 | |
| 106 | @Override |
| 107 | public void setResolvableStatus(ResolvableStatus resolvableStatus) { |
| 108 | this.resolvableStatus = resolvableStatus; |
| 109 | } |
| 110 | |
| 111 | @Override |
| 112 | public void resolve() throws DataModelException { |
| 113 | } |
| 114 | } |