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 https://tools.ietf.org/html/rfc6020#section-14.1.
21 public static final String RFC6020_YANG_FILE_EXTENSION = ".yang";
24 * YANG Media Type, as defined in https://tools.ietf.org/html/rfc6020#section-14.1.
26 public static final String RFC6020_YANG_MAC_FILE_TYPE = "TEXT";
30 * YANG Media Type, as defined in https://tools.ietf.org/html/rfc6020#section-14.1.
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 https://tools.ietf.org/html/rfc6020#section-14.2.
52 public static final String RFC6020_YIN_FILE_EXTENSION = ".yin";
55 * YANG Media Type, as defined in https://tools.ietf.org/html/rfc6020#section-14.1.
57 public static final String RFC6020_MAC_FILE_TYPE = "TEXT";
60 * YANG Media Type, as defined in https://tools.ietf.org/html/rfc6020#section-14.1.
62 public static final String RFC6020_YIN_MEDIA_TYPE = "application/xml+yin";
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 QNames. These are never leaked, but are used for efficient instantiation via QName#withModule()
91 private static final QName DUMMY_OPERATION_INPUT = QName.create("DUMMY", "input");
92 private static final QName DUMMY_OPERATION_OUTPUT = QName.create("DUMMY", "output");
94 private YangConstants() {
99 * Create a {@link QName} representing the 'input' statement of an operation (RPC or action) within specified
100 * {@link QNameModule}.
102 * @param module Desired module
103 * @return A QName representing action or RPC input.
104 * @throws NullPointerException if {@code module} is null
106 public static QName operationInputQName(final QNameModule module) {
107 return DUMMY_OPERATION_INPUT.withModule(module);
111 * Create a {@link QName} representing the 'output' statement of an operation (RPC or action) within specified
112 * {@link QNameModule}.
114 * @param module Desired module
115 * @return A QName representing action or RPC output.
116 * @throws NullPointerException if {@code module} is null
118 public static QName operationOutputQName(final QNameModule module) {
119 return DUMMY_OPERATION_OUTPUT.withModule(module);