d14dfdf2641af41f405d7af44e3e418795c547ea
[netconf.git] / restconf / restconf-nb-rfc8040 / src / main / java / org / opendaylight / restconf / nb / rfc8040 / rests / services / impl / OperationsRestconfModule.java
1 /*
2  * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.restconf.nb.rfc8040.rests.services.impl;
9
10 import static java.util.Objects.requireNonNull;
11
12 import java.util.Collection;
13 import java.util.List;
14 import org.eclipse.jdt.annotation.NonNull;
15 import org.opendaylight.yangtools.yang.common.QName;
16 import org.opendaylight.yangtools.yang.common.QNameModule;
17 import org.opendaylight.yangtools.yang.common.XMLNamespace;
18 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
19 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
20
21 @Deprecated(forRemoval = true, since = "4.0.0")
22 final class OperationsRestconfModule extends AbstractOperationsModule {
23     // There is no need to intern this nor add a revision, as we are providing the corresponding context anyway
24     static final @NonNull QNameModule NAMESPACE =
25             QNameModule.create(XMLNamespace.of("urn:ietf:params:xml:ns:yang:ietf-restconf"));
26
27     private final OperationsContainerSchemaNode operations;
28
29     OperationsRestconfModule(final OperationsContainerSchemaNode operations) {
30         this.operations = requireNonNull(operations);
31     }
32
33     @Override
34     public String getName() {
35         return "ietf-restconf";
36     }
37
38     @Override
39     public QNameModule getQNameModule() {
40         return NAMESPACE;
41     }
42
43     @Override
44     public String getPrefix() {
45         return "rc";
46     }
47
48     @Override
49     public Collection<DataSchemaNode> getChildNodes() {
50         return List.of(operations);
51     }
52
53     @Override
54     public DataSchemaNode dataChildByName(final QName name) {
55         return operations.getQName().equals(requireNonNull(name)) ? operations : null;
56     }
57
58     @Override
59     public List<EffectiveStatement<?, ?>> effectiveSubstatements() {
60         // This is not accurate, but works for now
61         return List.of();
62     }
63 }