X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=yang%2Fyang-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Fyang%2Fcommon%2FYangConstants.java;h=eefd658750a134d094d07054357c56fa42c17da3;hb=203f67e3a89275e4aea8686aafc1b96d71bf6bcd;hp=5adc588e0f04a0fb51c23894350b78209aa6bd80;hpb=fd6ee99fd61d0c9eea0f6f4f809d967f0ee0fcd3;p=yangtools.git diff --git a/yang/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/YangConstants.java b/yang/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/YangConstants.java index 5adc588e0f..eefd658750 100644 --- a/yang/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/YangConstants.java +++ b/yang/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/YangConstants.java @@ -14,27 +14,104 @@ import java.net.URI; */ public final class YangConstants { /** - * YANG namespace, as defined in RFC 6020. + * YANG File Extension, as defined in https://tools.ietf.org/html/rfc6020#section-14.1. */ - public static final URI RFC6020_YANG_NAMESPACE = URI.create("urn:ietf:params:xml:ns:yang:1"); + public static final String RFC6020_YANG_FILE_EXTENSION = ".yang"; /** - * YIN namespace, as defined in RFC 6020. + * YANG Media Type, as defined in https://tools.ietf.org/html/rfc6020#section-14.1. */ - public static final URI RFC6020_YIN_NAMESPACE = URI.create("urn:ietf:params:xml:ns:yang:yin:1"); + public static final String RFC6020_YANG_MAC_FILE_TYPE = "TEXT"; + + + /** + * YANG Media Type, as defined in https://tools.ietf.org/html/rfc6020#section-14.1. + */ + public static final String RFC6020_YANG_MEDIA_TYPE = "application/yang"; + + /** + * YANG namespace, as defined in https://tools.ietf.org/html/rfc6020#section-14, in String format. + */ + public static final String RFC6020_YANG_NAMESPACE_STRING = "urn:ietf:params:xml:ns:yang:1"; + + /** + * YANG namespace, as defined in https://tools.ietf.org/html/rfc6020#section-14, in URI format. + */ + public static final URI RFC6020_YANG_NAMESPACE = URI.create(RFC6020_YANG_NAMESPACE_STRING); /** * Base QNameModule for all YANG statements. */ - public static final QNameModule RFC6020_YANG_MODULE = QNameModule.create(RFC6020_YANG_NAMESPACE, null).intern(); + public static final QNameModule RFC6020_YANG_MODULE = QNameModule.create(RFC6020_YANG_NAMESPACE).intern(); + + /** + * YIN File Extension, as defined in https://tools.ietf.org/html/rfc6020#section-14.2. + */ + public static final String RFC6020_YIN_FILE_EXTENSION = ".yin"; + + /** + * YANG Media Type, as defined in https://tools.ietf.org/html/rfc6020#section-14.1. + */ + public static final String RFC6020_MAC_FILE_TYPE = "TEXT"; + + /** + * YANG Media Type, as defined in https://tools.ietf.org/html/rfc6020#section-14.1. + */ + public static final String RFC6020_YIN_MEDIA_TYPE = "application/xml+yin"; + + /** + * YIN namespace, as defined in https://tools.ietf.org/html/rfc6020#section-14, in String format. + */ + public static final String RFC6020_YIN_NAMESPACE_STRING = "urn:ietf:params:xml:ns:yang:yin:1"; + + /** + * YIN namespace, as defined in https://tools.ietf.org/html/rfc6020#section-14, in URI format. + */ + public static final URI RFC6020_YIN_NAMESPACE = URI.create(RFC6020_YIN_NAMESPACE_STRING); /** * Base QNameModule for all YIN statements. */ - public static final QNameModule RFC6020_YIN_MODULE = QNameModule.create(RFC6020_YIN_NAMESPACE, null).intern(); + public static final QNameModule RFC6020_YIN_MODULE = QNameModule.create(RFC6020_YIN_NAMESPACE).intern(); + + /** + * YANG Library NETCONF Capability, as defined in https://tools.ietf.org/html/rfc7950#section-16. + */ + public static final URI RFC7950_YANG_LIBRARY_CAPABILITY = + URI.create("urn:ietf:params:netconf:capability:yang-library:1.0"); + + /** + * Prefix for YANG-specific XPath functions. + */ + public static final String YANG_XPATH_FUNCTIONS_PREFIX = "yang"; + + // Dummy template QNames. These are never leaked, but are used for efficient instantiation via QName#withModule() + private static final QName DUMMY_OPERATION_INPUT = QName.create("DUMMY", "input"); + private static final QName DUMMY_OPERATION_OUTPUT = QName.create("DUMMY", "output"); private YangConstants() { throw new UnsupportedOperationException("Utility class"); } + /** + * Create a {@link QName} representing the 'input' statement of an operation (RPC or action) within specified + * {@link QNameModule}. + * + * @param module Desired module + * @return A QName representing action or RPC input. + */ + public static QName operationInputQName(final QNameModule module) { + return DUMMY_OPERATION_INPUT.withModule(module); + } + + /** + * Create a {@link QName} representing the 'output' statement of an operation (RPC or action) within specified + * {@link QNameModule}. + * + * @param module Desired module + * @return A QName representing action or RPC output. + */ + public static QName operationOutputQName(final QNameModule module) { + return DUMMY_OPERATION_OUTPUT.withModule(module); + } }