blob: 1456887035aef39e056fe0d671372f40f8b830f5 [file] [log] [blame]
sonu guptaeff184b2016-11-24 12:43:49 +05301/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
sonu guptaeff184b2016-11-24 12:43:49 +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 */
16
17package org.onosproject.yms.app.ydt;
18
19import org.onosproject.yms.app.ydt.exceptions.YdtException;
20
21import static org.onosproject.yms.app.ydt.YdtConstants.FMT_DUP_ENTRY;
22import static org.onosproject.yms.app.ydt.YdtConstants.errorMsg;
23import static org.onosproject.yms.ydt.YdtType.LOGICAL_ROOT_NODE;
24
25/**
26 * Represents a logical YANG data tree node.
27 */
28class YdtLogicalNode extends YdtNode {
29
30 private final String name;
31 private final String namespace;
32
33 /**
Bharat saraswal1f371982016-11-23 15:32:57 +053034 * Creates an instance of YANG logical node object.
35 *
36 * @param name logical root name
37 * @param namespace YANG namespace
sonu guptaeff184b2016-11-24 12:43:49 +053038 */
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}