2 * Copyright (c) 2020 PANTHEON.tech, s.r.o. 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.common.util;
10 import static java.util.Objects.requireNonNull;
13 import java.util.Collection;
14 import java.util.Collections;
15 import java.util.Optional;
16 import org.opendaylight.yangtools.yang.common.QName;
17 import org.opendaylight.yangtools.yang.common.QNameModule;
18 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
20 final class OperationsRestconfModule extends AbstractOperationsModule {
21 // There is no need to intern this nor add a revision, as we are providing the corresponding context anyway
22 static final QNameModule NAMESPACE = QNameModule.create(URI.create("urn:ietf:params:xml:ns:yang:ietf-restconf"));
24 private final OperationsContainerSchemaNode operations;
26 OperationsRestconfModule(final OperationsContainerSchemaNode operations) {
27 this.operations = requireNonNull(operations);
31 public String getName() {
32 return "ietf-restconf";
36 public QNameModule getQNameModule() {
41 public Collection<DataSchemaNode> getChildNodes() {
42 return Collections.singleton(operations);
46 public Optional<DataSchemaNode> findDataChildByName(final QName name) {
47 return operations.getQName().equals(requireNonNull(name)) ? Optional.of(operations) : Optional.empty();
51 public String getPrefix() {