X-Git-Url: https://git.hedgecode.org/?p=hespiff.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fhedgecode%2Fxml%2Fxspf%2FXSPFConstants.java;fp=src%2Fmain%2Fjava%2Forg%2Fhedgecode%2Fxml%2Fxspf%2FXSPFConstants.java;h=158281bdc514e44e8e6e7327ba1af25de67be737;hp=0000000000000000000000000000000000000000;hb=6310cd885e1db660feb7dc222c2e86cccb5c1fce;hpb=13dba5ab997fc65d1da26de66a49b9a930b81f12 diff --git a/src/main/java/org/hedgecode/xml/xspf/XSPFConstants.java b/src/main/java/org/hedgecode/xml/xspf/XSPFConstants.java new file mode 100644 index 0000000..158281b --- /dev/null +++ b/src/main/java/org/hedgecode/xml/xspf/XSPFConstants.java @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2015. Developed by Hedgecode. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.hedgecode.xml.xspf; + +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import javax.xml.namespace.QName; + +/** + * Store of library constants. + * + * @author Dmitry Samoshin aka gotty + */ +public final class XSPFConstants { + + public static final Charset DEF_CHARSET = StandardCharsets.UTF_8; + + public static final String XSD_FORMAT = "xsd"; + public static final String RNG_FORMAT = "rng"; + + public static enum Format { + + XSD ( XSD_FORMAT ), + RELAX_NG ( RNG_FORMAT ); + + private String formatName; + + Format(String name) { + this.formatName = name; + } + + public String getName() { + return formatName; + } + + public static Format byName(String formatName) { + for (Format format : Format.values()) { + if (format.getName().equals(formatName)) + return format; + } + return null; + } + } + + public static final String VER_1_0_2 = "1_0.2"; + public static final String VER_1_0_7 = "1_0.7"; + + public static enum Version { + + V1_2 ( VER_1_0_2 ), + V1_7 ( VER_1_0_7 ); + + private String versionName; + + Version(String name) { + this.versionName = name; + } + + public String getName() { + return versionName; + } + + public static Version byName(String versionName) { + for (Version version : Version.values()) { + if (version.getName().equals(versionName)) + return version; + } + return null; + } + } + + public static final String XSPF_VERSION = "1"; + + public static final QName PLAYLIST_QNAME = new QName("http://xspf.org/ns/0/", "playlist"); + + public static final String XML_HEADER_NAME = "com.sun.xml.internal.bind.xmlHeaders"; + public static final String XML_HEADER_VALUE = ""; + + + public static interface Errors { + public static final int NULL_PLAYLIST = 101; + public static final int VALIDATE_ERROR = 201; + public static final int BINDING_ERROR = 301; + public static final int ENCODING_ERROR = 401; + } + + private XSPFConstants() { + throw new AssertionError( + "No org.hedgecode.xml.xspf.XSPFConstants instances!" + ); + } + +}