blob: 6a45cad2e2b07d566ce3320d37550a7183c475dd [file] [log] [blame]
sonu gupta1bb37b82016-11-11 16:51:18 +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.yangutils.datamodel.YangNode;
20import org.onosproject.yangutils.datamodel.YangSchemaNode;
21import org.onosproject.yms.app.ydt.exceptions.YdtException;
22import org.onosproject.yms.ydt.YdtContext;
23
24import java.util.List;
25
26/**
27 * Manages the application information required for schema nodes defined in
28 * the module (sub-module).
29 */
30public class AugmentedSchemaData implements AppData {
31
32 private static final String E_NOT_ROOTAPP =
33 "Augmented application depends on root app.";
34 private static final String E_NOT_EXIST =
35 "Augmented nodes are not part of the schema.";
36 private static final String E_NOT_MAINTAINED =
37 "Module context is not maintained.";
38
39 /*
40 * Reference for schema node of augmenting application.
41 */
42 private YangSchemaNode augModSchema;
43
44 @Override
45 public List<YdtContext> getDeleteNodes() {
46 throw new YdtException(E_NOT_ROOTAPP);
47 }
48
49 @Override
50 public void addDeleteNodes(YdtContext deletedNode) {
51 }
52
53 @Override
54 public YdtContext getModuleContext() {
55 throw new YdtException(E_NOT_EXIST);
56 }
57
58 @Override
59 public void setModuleContext(YdtContext moduleContext) {
60 throw new YdtException(E_NOT_MAINTAINED);
61 }
62
63 @Override
64 public YangSchemaNode getAugmentingSchemaNode() {
65 return augModSchema;
66 }
67
68 @Override
69 public void setAugmentingSchemaNode(YangSchemaNode schemaNode) {
70 augModSchema = schemaNode;
71 }
72
73 @Override
74 public YangSchemaNode getSchemaNode() {
75 return augModSchema;
76 }
77
78 @Override
79 public YangSchemaNode getRootSchemaNode() {
80 return ((YangNode) getSchemaNode()).getParent();
81 }
82}