]> git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.cms/src/org/argeo/cms/acr/CmsContentTypes.java
Remove naming exceptions from DNS browser
[lgpl/argeo-commons.git] / org.argeo.cms / src / org / argeo / cms / acr / 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 import org.argeo.api.acr.CrName;
8
9 public enum CmsContentTypes {
10 //
11 // ARGEO
12 //
13 CR_2(CrName.CR_DEFAULT_PREFIX, CrName.CR_NAMESPACE_URI, "cr.xsd", null),
14 //
15 SLC("slc", "http://www.argeo.org/ns/slc", null, null),
16 //
17 ARGEO_LEGACY("argeo", "http://www.argeo.org/ns/argeo", null, null),
18 //
19 // EXTERNAL
20 //
21 XSD_2001("xs", "http://www.w3.org/2001/XMLSchema", "XMLSchema.xsd", "http://www.w3.org/2001/XMLSchema.xsd"),
22 //
23 XML_1998("xml", "http://www.w3.org/XML/1998/namespace", "xml.xsd", "http://www.w3.org/2001/xml.xsd"),
24 //
25 XLINK_1999("xlink", "http://www.w3.org/1999/xlink", "xlink.xsd", "http://www.w3.org/XML/2008/06/xlink.xsd"),
26 //
27 XSLT_2_0("xsl", "http://www.w3.org/1999/XSL/Transform", "schema-for-xslt20.xsd",
28 "https://www.w3.org/2007/schema-for-xslt20.xsd"),
29 //
30 SVG_1_1("svg", "http://www.w3.org/2000/svg", "SVG.xsd",
31 "https://raw.githubusercontent.com/oreillymedia/HTMLBook/master/schema/svg/SVG.xsd"),
32 //
33 DOCBOOK_5_0_1("dbk", "http://docbook.org/ns/docbook", "docbook.xsd",
34 "http://docbook.org/xml/5.0.1/xsd/docbook.xsd"),
35 //
36 XML_EVENTS_2001("ev", "http://www.w3.org/2001/xml-events", "xml-events-attribs-1.xsd",
37 "http://www.w3.org/MarkUp/SCHEMA/xml-events-attribs-1.xsd"),
38 //
39 XFORMS_2002("xforms", "http://www.w3.org/2002/xforms", "XForms-11-Schema.xsd",
40 "https://www.w3.org/MarkUp/Forms/2007/XForms-11-Schema.xsd"),
41 //
42 DSML_v2("dsml", "urn:oasis:names:tc:DSML:2:0:core", "DSMLv2.xsd",
43 "https://www.oasis-open.org/committees/dsml/docs/DSMLv2.xsd"),
44 //
45 // JCR (to be moved elsewhere)
46 //
47 JCR("jcr", "http://www.jcp.org/jcr/1.0", null,
48 "https://jackrabbit.apache.org/archive/wiki/JCR/NamespaceRegistry_115513459.html"),
49 //
50 JCR_MIX("mix", "http://www.jcp.org/jcr/mix/1.0", null,
51 "https://jackrabbit.apache.org/archive/wiki/JCR/NamespaceRegistry_115513459.html"),
52 //
53 JCR_NT("nt", "http://www.jcp.org/jcr/nt/1.0", null,
54 "https://jackrabbit.apache.org/archive/wiki/JCR/NamespaceRegistry_115513459.html"),
55 //
56 JACKRABBIT("rep", "internal", null,
57 "https://jackrabbit.apache.org/archive/wiki/JCR/NamespaceRegistry_115513459.html"),
58 //
59 JCRX("jcrx", "http://www.argeo.org/ns/jcrx", null, null),
60 //
61 ;
62
63 private final static String RESOURCE_BASE = "/org/argeo/cms/acr/schemas/";
64
65 private String defaultPrefix;
66 private String namespace;
67 private URL resource;
68 private URL publicUrl;
69
70 CmsContentTypes(String defaultPrefix, String namespace, String resourceFileName, String publicUrl) {
71 Objects.requireNonNull(namespace);
72 this.defaultPrefix = defaultPrefix;
73 Objects.requireNonNull(namespace);
74 this.namespace = namespace;
75 if (resourceFileName != null) {
76 resource = getClass().getResource(RESOURCE_BASE + resourceFileName);
77 Objects.requireNonNull(resource);
78 }
79 if (publicUrl != null)
80 try {
81 this.publicUrl = new URL(publicUrl);
82 } catch (MalformedURLException e) {
83 throw new IllegalArgumentException("Cannot interpret public URL", e);
84 }
85 }
86
87 public String getDefaultPrefix() {
88 return defaultPrefix;
89 }
90
91 public String getNamespace() {
92 return namespace;
93 }
94
95 public URL getResource() {
96 return resource;
97 }
98
99 public URL getPublicUrl() {
100 return publicUrl;
101 }
102
103 }