blob: f980bfda6ce76c736b21515d3da92a255afc64af [file] [log] [blame]
sonu gupta1bb37b82016-11-11 16:51:18 +05301/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
sonu gupta1bb37b82016-11-11 16:51:18 +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.yangutils.datamodel.YangSchemaNode;
sonu gupta1bb37b82016-11-11 16:51:18 +053020import org.onosproject.yms.ydt.YdtContext;
21
22import java.util.ArrayList;
23import java.util.List;
24
25/**
26 * Manages the application information required for schema nodes defined in
27 * the module (sub-module).
28 */
sonu guptaeff184b2016-11-24 12:43:49 +053029public class ModuleSchemaData implements ModuleAppData {
sonu gupta1bb37b82016-11-11 16:51:18 +053030
31 /*
32 * Reference for application's root ydtContext.
33 */
sonu guptaeff184b2016-11-24 12:43:49 +053034 private YdtExtendedContext moduleContext;
sonu gupta1bb37b82016-11-11 16:51:18 +053035
36 /*
37 * Reference for list of nodes with operation type delete.
38 */
sonu guptaeff184b2016-11-24 12:43:49 +053039 private final List<YdtContext> deleteNodes = new ArrayList<>();
sonu gupta1bb37b82016-11-11 16:51:18 +053040
41 @Override
42 public List<YdtContext> getDeleteNodes() {
43 // This suppose to be mutable for YAB
44 return deleteNodes;
45 }
46
47 @Override
48 public void addDeleteNodes(YdtContext deletedNode) {
49 deleteNodes.add(deletedNode);
50 }
51
52 @Override
53 public YdtContext getModuleContext() {
54 return moduleContext;
55 }
56
57 @Override
sonu guptaeff184b2016-11-24 12:43:49 +053058 public void setModuleContext(YdtExtendedContext moduleContext) {
sonu gupta1bb37b82016-11-11 16:51:18 +053059 this.moduleContext = moduleContext;
60 }
61
62 @Override
sonu gupta1bb37b82016-11-11 16:51:18 +053063 public YangSchemaNode getSchemaNode() {
sonu guptaeff184b2016-11-24 12:43:49 +053064 return moduleContext.getYangSchemaNode();
sonu gupta1bb37b82016-11-11 16:51:18 +053065 }
66
67 @Override
68 public YangSchemaNode getRootSchemaNode() {
sonu guptaeff184b2016-11-24 12:43:49 +053069 return moduleContext.getYangSchemaNode();
sonu gupta1bb37b82016-11-11 16:51:18 +053070 }
71}