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 com.google.common.collect.ImmutableList;
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.LeafSchemaNode;
22 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
23 import org.opendaylight.yangtools.yang.model.api.Status;
24 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
25 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
26 import org.opendaylight.yangtools.yang.model.api.UsesNode;
29 * Special case only use by GET restconf/operations (since moment of old Yang
30 * parser and old yang model API removal) to build and use fake container for
33 class FakeContainerSchemaNode implements ContainerSchemaNode {
34 static final SchemaPath PATH =
35 SchemaPath.create(true, QName.create(FakeRestconfModule.QNAME, "operations").intern());
37 private final Collection<DataSchemaNode> children;
39 FakeContainerSchemaNode(final Collection<LeafSchemaNode> children) {
40 this.children = ImmutableList.copyOf(children);
44 public Set<TypeDefinition<?>> getTypeDefinitions() {
45 throw new UnsupportedOperationException("Not supported.");
49 public Collection<DataSchemaNode> getChildNodes() {
54 public Set<GroupingDefinition> getGroupings() {
55 throw new UnsupportedOperationException("Not supported.");
59 public DataSchemaNode getDataChildByName(final QName name) {
60 for (final DataSchemaNode node : this.children) {
61 if (node.getQName().equals(name)) {
65 throw new RestconfDocumentedException(name + " is not in child of " + PATH.getLastComponent());
69 public Set<UsesNode> getUses() {
70 throw new UnsupportedOperationException("Not supported.");
74 public Set<AugmentationSchema> getAvailableAugmentations() {
75 return new HashSet<>();
79 public boolean isAugmenting() {
84 public boolean isAddedByUses() {
89 public boolean isConfiguration() {
94 public ConstraintDefinition getConstraints() {
95 throw new UnsupportedOperationException("Not supported.");
99 public QName getQName() {
100 return PATH.getLastComponent();
104 public SchemaPath getPath() {
109 public List<UnknownSchemaNode> getUnknownSchemaNodes() {
110 throw new UnsupportedOperationException("Not supported.");
114 public String getDescription() {
115 throw new UnsupportedOperationException("Not supported.");
119 public String getReference() {
120 throw new UnsupportedOperationException("Not supported.");
124 public Status getStatus() {
125 throw new UnsupportedOperationException("Not supported.");
129 public boolean isPresenceContainer() {
130 throw new UnsupportedOperationException("Not supported.");