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.restconf.base.services.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.restconf.common.errors.RestconfDocumentedException;
16 import org.opendaylight.yangtools.yang.common.QName;
17 import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
18 import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
19 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
20 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
21 import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
22 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
23 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
24 import org.opendaylight.yangtools.yang.model.api.Status;
25 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
26 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
27 import org.opendaylight.yangtools.yang.model.api.UsesNode;
30 * Special case only use by GET restconf/operations (since moment of old Yang parser and old yang model API
31 * removal) to build and use fake container for module.
33 * @deprecated move to splitted module restconf-nb-rfc8040
36 class FakeContainerSchemaNode implements ContainerSchemaNode {
37 static final SchemaPath PATH =
38 SchemaPath.create(true, QName.create(FakeRestconfModule.QNAME, "operations").intern());
40 private final Collection<DataSchemaNode> children;
42 FakeContainerSchemaNode(final Collection<LeafSchemaNode> children) {
43 this.children = ImmutableList.copyOf(children);
47 public Set<TypeDefinition<?>> getTypeDefinitions() {
48 throw new UnsupportedOperationException("Not supported.");
52 public Collection<DataSchemaNode> getChildNodes() {
57 public Set<GroupingDefinition> getGroupings() {
58 throw new UnsupportedOperationException("Not supported.");
62 public DataSchemaNode getDataChildByName(final QName name) {
63 for (final DataSchemaNode node : this.children) {
64 if (node.getQName().equals(name)) {
68 throw new RestconfDocumentedException(name + " is not in child of " + PATH.getLastComponent());
72 public Set<UsesNode> getUses() {
73 throw new UnsupportedOperationException("Not supported.");
77 public Set<AugmentationSchema> getAvailableAugmentations() {
78 return new HashSet<>();
82 public boolean isAugmenting() {
87 public boolean isAddedByUses() {
92 public boolean isConfiguration() {
97 public ConstraintDefinition getConstraints() {
98 throw new UnsupportedOperationException("Not supported.");
102 public QName getQName() {
103 return PATH.getLastComponent();
107 public SchemaPath getPath() {
112 public List<UnknownSchemaNode> getUnknownSchemaNodes() {
113 throw new UnsupportedOperationException("Not supported.");
117 public String getDescription() {
118 throw new UnsupportedOperationException("Not supported.");
122 public String getReference() {
123 throw new UnsupportedOperationException("Not supported.");
127 public Status getStatus() {
128 throw new UnsupportedOperationException("Not supported.");
132 public boolean isPresenceContainer() {
133 throw new UnsupportedOperationException("Not supported.");