Fix YangConstants.RFC6020_YIN_MEDIA_TYPE
[yangtools.git] / yang / yang-common / src / main / java / org / opendaylight / yangtools / yang / common / YangConstants.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. 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.yangtools.yang.common;
9
10 import java.net.URI;
11 import org.eclipse.jdt.annotation.NonNullByDefault;
12
13 /**
14  * Constant definitions present in RFC documents related to the YANG language.
15  */
16 @NonNullByDefault
17 public final class YangConstants {
18     /**
19      * YANG File Extension, as defined in <a href="https://tools.ietf.org/html/rfc6020#section-14.1">RFC6020</a>.
20      */
21     public static final String RFC6020_YANG_FILE_EXTENSION = ".yang";
22
23     /**
24      * YANG Media Type, as defined in <a href="https://tools.ietf.org/html/rfc6020#section-14.1">RFC6020</a>.
25      */
26     public static final String RFC6020_YANG_MAC_FILE_TYPE = "TEXT";
27
28
29     /**
30      * YANG Media Type, as defined in h<a href="https://tools.ietf.org/html/rfc6020#section-14.1">RFC6020</a>.
31      */
32     public static final String RFC6020_YANG_MEDIA_TYPE = "application/yang";
33
34     /**
35      * YANG namespace, as defined in https://tools.ietf.org/html/rfc6020#section-14, in String format.
36      */
37     public static final String RFC6020_YANG_NAMESPACE_STRING = "urn:ietf:params:xml:ns:yang:1";
38
39     /**
40      * YANG namespace, as defined in https://tools.ietf.org/html/rfc6020#section-14, in URI format.
41      */
42     public static final URI RFC6020_YANG_NAMESPACE = URI.create(RFC6020_YANG_NAMESPACE_STRING);
43
44     /**
45      * Base QNameModule for all YANG statements.
46      */
47     public static final QNameModule RFC6020_YANG_MODULE = QNameModule.create(RFC6020_YANG_NAMESPACE).intern();
48
49     /**
50      * YIN File Extension, as defined in <a href="https://tools.ietf.org/html/rfc6020#section-14.2">RFC6020</a>.
51      */
52     public static final String RFC6020_YIN_FILE_EXTENSION = ".yin";
53
54     /**
55      * YANG Media Type, as defined in <a href="https://tools.ietf.org/html/rfc6020#section-14.1">RFC6020</a>.
56      */
57     public static final String RFC6020_MAC_FILE_TYPE = "TEXT";
58
59     /**
60      * YANG Media Type, as defined in <a href="https://tools.ietf.org/html/rfc6020#section-14.2">RFC6020</a>.
61      */
62     public static final String RFC6020_YIN_MEDIA_TYPE = "application/yin+xml";
63
64     /**
65      * YIN namespace, as defined in https://tools.ietf.org/html/rfc6020#section-14, in String format.
66      */
67     public static final String RFC6020_YIN_NAMESPACE_STRING = "urn:ietf:params:xml:ns:yang:yin:1";
68
69     /**
70      * YIN namespace, as defined in https://tools.ietf.org/html/rfc6020#section-14, in URI format.
71      */
72     public static final URI RFC6020_YIN_NAMESPACE = URI.create(RFC6020_YIN_NAMESPACE_STRING);
73
74     /**
75      * Base QNameModule for all YIN statements.
76      */
77     public static final QNameModule RFC6020_YIN_MODULE = QNameModule.create(RFC6020_YIN_NAMESPACE).intern();
78
79     /**
80      * YANG Library NETCONF Capability, as defined in https://tools.ietf.org/html/rfc7950#section-16.
81      */
82     public static final URI RFC7950_YANG_LIBRARY_CAPABILITY =
83         URI.create("urn:ietf:params:netconf:capability:yang-library:1.0");
84
85     /**
86      * Prefix for YANG-specific XPath functions.
87      */
88     public static final String YANG_XPATH_FUNCTIONS_PREFIX = "yang";
89
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");
94
95     private YangConstants() {
96         // Hidden on purpose
97     }
98
99     /**
100      * Create a {@link QName} representing the 'input' statement of an operation (RPC or action) within specified
101      * {@link QNameModule}.
102      *
103      * @param module Desired module
104      * @return A QName representing action or RPC input.
105      * @throws NullPointerException if {@code module} is null
106      */
107     public static QName operationInputQName(final QNameModule module) {
108         return DUMMY_OPERATION_INPUT.bindTo(module);
109     }
110
111     /**
112      * Create a {@link QName} representing the 'output' statement of an operation (RPC or action) within specified
113      * {@link QNameModule}.
114      *
115      * @param module Desired module
116      * @return A QName representing action or RPC output.
117      * @throws NullPointerException if {@code module} is null
118      */
119     public static QName operationOutputQName(final QNameModule module) {
120         return DUMMY_OPERATION_OUTPUT.bindTo(module);
121     }
122 }