2 * Copyright (c) 2015 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.yangtools.yang.common;
11 import org.eclipse.jdt.annotation.NonNullByDefault;
14 * Constant definitions present in RFC documents related to the YANG language.
17 public final class YangConstants {
19 * YANG File Extension, as defined in <a href="https://tools.ietf.org/html/rfc6020#section-14.1">RFC6020</a>.
21 public static final String RFC6020_YANG_FILE_EXTENSION = ".yang";
24 * YANG Media Type, as defined in <a href="https://tools.ietf.org/html/rfc6020#section-14.1">RFC6020</a>.
26 public static final String RFC6020_YANG_MAC_FILE_TYPE = "TEXT";
30 * YANG Media Type, as defined in h<a href="https://tools.ietf.org/html/rfc6020#section-14.1">RFC6020</a>.
32 public static final String RFC6020_YANG_MEDIA_TYPE = "application/yang";
35 * YANG namespace, as defined in https://tools.ietf.org/html/rfc6020#section-14, in String format.
37 public static final String RFC6020_YANG_NAMESPACE_STRING = "urn:ietf:params:xml:ns:yang:1";
40 * YANG namespace, as defined in https://tools.ietf.org/html/rfc6020#section-14, in URI format.
42 public static final URI RFC6020_YANG_NAMESPACE = URI.create(RFC6020_YANG_NAMESPACE_STRING);
45 * Base QNameModule for all YANG statements.
47 public static final QNameModule RFC6020_YANG_MODULE = QNameModule.create(RFC6020_YANG_NAMESPACE).intern();
50 * YIN File Extension, as defined in <a href="https://tools.ietf.org/html/rfc6020#section-14.2">RFC6020</a>.
52 public static final String RFC6020_YIN_FILE_EXTENSION = ".yin";
55 * YANG Media Type, as defined in <a href="https://tools.ietf.org/html/rfc6020#section-14.1">RFC6020</a>.
57 public static final String RFC6020_MAC_FILE_TYPE = "TEXT";
60 * YANG Media Type, as defined in <a href="https://tools.ietf.org/html/rfc6020#section-14.2">RFC6020</a>.
62 public static final String RFC6020_YIN_MEDIA_TYPE = "application/yin+xml";
65 * YIN namespace, as defined in https://tools.ietf.org/html/rfc6020#section-14, in String format.
67 public static final String RFC6020_YIN_NAMESPACE_STRING = "urn:ietf:params:xml:ns:yang:yin:1";
70 * YIN namespace, as defined in https://tools.ietf.org/html/rfc6020#section-14, in URI format.
72 public static final URI RFC6020_YIN_NAMESPACE = URI.create(RFC6020_YIN_NAMESPACE_STRING);
75 * Base QNameModule for all YIN statements.
77 public static final QNameModule RFC6020_YIN_MODULE = QNameModule.create(RFC6020_YIN_NAMESPACE).intern();
80 * YANG Library NETCONF Capability, as defined in https://tools.ietf.org/html/rfc7950#section-16.
82 public static final URI RFC7950_YANG_LIBRARY_CAPABILITY =
83 URI.create("urn:ietf:params:netconf:capability:yang-library:1.0");
86 * Prefix for YANG-specific XPath functions.
88 public static final String YANG_XPATH_FUNCTIONS_PREFIX = "yang";
90 // Dummy template UnqualifiedQName. These are never leaked, but are used for efficient instantiation via
91 // UnqualifiedQName#bindTo()
92 private static final UnqualifiedQName DUMMY_OPERATION_INPUT = UnqualifiedQName.of("input");
93 private static final UnqualifiedQName DUMMY_OPERATION_OUTPUT = UnqualifiedQName.of("output");
95 private YangConstants() {
100 * Create a {@link QName} representing the 'input' statement of an operation (RPC or action) within specified
101 * {@link QNameModule}.
103 * @param module Desired module
104 * @return A QName representing action or RPC input.
105 * @throws NullPointerException if {@code module} is null
107 public static QName operationInputQName(final QNameModule module) {
108 return DUMMY_OPERATION_INPUT.bindTo(module);
112 * Create a {@link QName} representing the 'output' statement of an operation (RPC or action) within specified
113 * {@link QNameModule}.
115 * @param module Desired module
116 * @return A QName representing action or RPC output.
117 * @throws NullPointerException if {@code module} is null
119 public static QName operationOutputQName(final QNameModule module) {
120 return DUMMY_OPERATION_OUTPUT.bindTo(module);