blob: 05de8b3e4f0b864ff4f66e21824401614e5a22ed [file] [log] [blame]
sonu guptaeff184b2016-11-24 12:43:49 +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.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 /**
34 * Creates a YANG logical node object.
35 */
36 public YdtLogicalNode(String name, String namespace) {
37 super(LOGICAL_ROOT_NODE);
38 this.name = name;
39 this.namespace = namespace;
40 }
41
42 @Override
43 public String getName() {
44 return name;
45 }
46
47 @Override
48 public String getNamespace() {
49 return namespace;
50 }
51
52 @Override
53 public String getModuleNameAsNameSpace() {
54 return namespace;
55 }
56
57 @Override
58 public void validDuplicateEntryProcessing() throws YdtException {
59 throw new YdtException(errorMsg(FMT_DUP_ENTRY, getName()));
60 }
61}