sonu gupta | eff184b | 2016-11-24 12:43:49 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame^] | 2 | * Copyright 2016-present Open Networking Foundation |
sonu gupta | eff184b | 2016-11-24 12:43:49 +0530 | [diff] [blame] | 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.yms.app.ydt; |
| 18 | |
| 19 | import org.onosproject.yms.app.ydt.exceptions.YdtException; |
| 20 | |
| 21 | import static org.onosproject.yms.app.ydt.YdtConstants.FMT_DUP_ENTRY; |
| 22 | import static org.onosproject.yms.app.ydt.YdtConstants.errorMsg; |
| 23 | import static org.onosproject.yms.ydt.YdtType.LOGICAL_ROOT_NODE; |
| 24 | |
| 25 | /** |
| 26 | * Represents a logical YANG data tree node. |
| 27 | */ |
| 28 | class YdtLogicalNode extends YdtNode { |
| 29 | |
| 30 | private final String name; |
| 31 | private final String namespace; |
| 32 | |
| 33 | /** |
Bharat saraswal | 1f37198 | 2016-11-23 15:32:57 +0530 | [diff] [blame] | 34 | * Creates an instance of YANG logical node object. |
| 35 | * |
| 36 | * @param name logical root name |
| 37 | * @param namespace YANG namespace |
sonu gupta | eff184b | 2016-11-24 12:43:49 +0530 | [diff] [blame] | 38 | */ |
| 39 | public YdtLogicalNode(String name, String namespace) { |
| 40 | super(LOGICAL_ROOT_NODE); |
| 41 | this.name = name; |
| 42 | this.namespace = namespace; |
| 43 | } |
| 44 | |
| 45 | @Override |
| 46 | public String getName() { |
| 47 | return name; |
| 48 | } |
| 49 | |
| 50 | @Override |
| 51 | public String getNamespace() { |
| 52 | return namespace; |
| 53 | } |
| 54 | |
| 55 | @Override |
| 56 | public String getModuleNameAsNameSpace() { |
| 57 | return namespace; |
| 58 | } |
| 59 | |
| 60 | @Override |
| 61 | public void validDuplicateEntryProcessing() throws YdtException { |
| 62 | throw new YdtException(errorMsg(FMT_DUP_ENTRY, getName())); |
| 63 | } |
| 64 | } |