]> git.argeo.org Git - lgpl/argeo-commons.git/blob - CmsContentTypes.java
4c1f82a257fb1021cc34b50284325ba19130a786
[lgpl/argeo-commons.git] / CmsContentTypes.java
1 package org.argeo.cms.acr;
2
3 import java.net.MalformedURLException;
4 import java.net.URL;
5 import java.util.Objects;
6
7 public enum CmsContentTypes {
8 CR_2("cr", "http://argeo.org/ns/cr", "cr.xsd", null),
9 //
10 XSD_2001("xs", "http://www.w3.org/2001/XMLSchema", "XMLSchema.xsd", "http://www.w3.org/2001/XMLSchema.xsd"),
11 //
12 XML_1998("xml", "http://www.w3.org/XML/1998/namespace", "xml.xsd", "http://www.w3.org/2001/xml.xsd"),
13 //
14 XLINK_1999("xlink", "http://www.w3.org/1999/xlink", "xlink.xsd", "http://www.w3.org/XML/2008/06/xlink.xsd"),
15 //
16 XSLT_2_0("xsl", "http://www.w3.org/1999/XSL/Transform", "schema-for-xslt20.xsd", "https://www.w3.org/2007/schema-for-xslt20.xsd"),
17 //
18 SVG_1_1("svg", "http://www.w3.org/2000/svg", "SVG.xsd",
19 "https://raw.githubusercontent.com/oreillymedia/HTMLBook/master/schema/svg/SVG.xsd"),
20 //
21 DOCBOOK_5_0_1("dbk","http://docbook.org/ns/docbook","docbook.xsd","http://docbook.org/xml/5.0.1/xsd/docbook.xsd"),
22 //
23 XML_EVENTS_2001("ev", "http://www.w3.org/2001/xml-events", "xml-events-attribs-1.xsd",
24 "http://www.w3.org/MarkUp/SCHEMA/xml-events-attribs-1.xsd"),
25 //
26 XFORMS_2002("xforms", "http://www.w3.org/2002/xforms", "XForms-11-Schema.xsd",
27 "https://www.w3.org/MarkUp/Forms/2007/XForms-11-Schema.xsd"),
28 //
29 DSML_v2("dsml", "urn:oasis:names:tc:DSML:2:0:core", "DSMLv2.xsd",
30 "https://www.oasis-open.org/committees/dsml/docs/DSMLv2.xsd"),
31 //
32 ;
33
34 private final static String RESOURCE_BASE = "/org/argeo/cms/acr/schemas/";
35
36 private String defaultPrefix;
37 private String namespace;
38 private URL resource;
39 private URL publicUrl;
40
41 CmsContentTypes(String defaultPrefix, String namespace, String resourceFileName, String publicUrl) {
42 Objects.requireNonNull(namespace);
43 this.defaultPrefix = defaultPrefix;
44 Objects.requireNonNull(namespace);
45 this.namespace = namespace;
46 resource = getClass().getResource(RESOURCE_BASE + resourceFileName);
47 Objects.requireNonNull(resource);
48 if (publicUrl != null)
49 try {
50 this.publicUrl = new URL(publicUrl);
51 } catch (MalformedURLException e) {
52 throw new IllegalArgumentException("Cannot interpret public URL", e);
53 }
54 }
55
56 public String getDefaultPrefix() {
57 return defaultPrefix;
58 }
59
60 public String getNamespace() {
61 return namespace;
62 }
63
64 public URL getResource() {
65 return resource;
66 }
67
68 public URL getPublicUrl() {
69 return publicUrl;
70 }
71
72 }