2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.netconf.sal.restconf.impl;
10 import java.util.ArrayList;
11 import java.util.Collection;
12 import java.util.HashSet;
13 import java.util.List;
15 import org.opendaylight.yangtools.yang.common.QName;
16 import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
17 import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
18 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
19 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
20 import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
21 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
22 import org.opendaylight.yangtools.yang.model.api.Status;
23 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
24 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
25 import org.opendaylight.yangtools.yang.model.api.UsesNode;
28 * Special case only use by GET restconf/operations (since moment of pre-Beryllium Yang
29 * parser and yang model API removal) to build and use fake container for module
31 class ContainerSchemaNodeImpl implements ContainerSchemaNode {
33 List<DataSchemaNode> child = new ArrayList<>();
34 private final QName qname = QName.create(ModuleImpl.moduleQName, "operations");
35 private final SchemaPath path = SchemaPath.create(true, this.qname);
38 public Set<TypeDefinition<?>> getTypeDefinitions() {
39 throw new UnsupportedOperationException("Not supported.");
43 public Collection<DataSchemaNode> getChildNodes() {
48 public Set<GroupingDefinition> getGroupings() {
49 throw new UnsupportedOperationException("Not supported.");
53 public DataSchemaNode getDataChildByName(final QName name) {
54 for (final DataSchemaNode node : this.child) {
55 if (node.getQName().equals(name)) {
59 throw new RestconfDocumentedException(name + " is not in child of " + this.qname);
63 public Set<UsesNode> getUses() {
64 throw new UnsupportedOperationException("Not supported.");
68 public Set<AugmentationSchema> getAvailableAugmentations() {
69 return new HashSet<>();
73 public boolean isAugmenting() {
78 public boolean isAddedByUses() {
83 public boolean isConfiguration() {
88 public ConstraintDefinition getConstraints() {
89 throw new UnsupportedOperationException("Not supported.");
93 public QName getQName() {
98 public SchemaPath getPath() {
103 public List<UnknownSchemaNode> getUnknownSchemaNodes() {
104 throw new UnsupportedOperationException("Not supported.");
108 public String getDescription() {
109 throw new UnsupportedOperationException("Not supported.");
113 public String getReference() {
114 throw new UnsupportedOperationException("Not supported.");
118 public Status getStatus() {
119 throw new UnsupportedOperationException("Not supported.");
123 public boolean isPresenceContainer() {
124 throw new UnsupportedOperationException("Not supported.");
128 * Adding new schema node to this container
131 * - fake schema leaf node
133 public void addNodeChild(final DataSchemaNode fakeLeaf) {
134 this.child.add(fakeLeaf);