]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.cms/src/org/argeo/cms/acr/CmsContentNamespace.java
1 package org
.argeo
.cms
.acr
;
3 import java
.net
.MalformedURLException
;
5 import java
.util
.Objects
;
7 import org
.argeo
.api
.acr
.ArgeoNamespace
;
8 import org
.argeo
.api
.acr
.spi
.ContentNamespace
;
10 /** Content namespaces supported by CMS. */
11 public enum CmsContentNamespace
implements ContentNamespace
{
15 CR(ArgeoNamespace
.CR_DEFAULT_PREFIX
, ArgeoNamespace
.CR_NAMESPACE_URI
, "cr.xsd", null),
17 SLC("slc", "http://www.argeo.org/ns/slc", null, null),
19 ARGEO("argeo", "http://www.argeo.org/ns/argeo", null, null),
23 XSD("xs", "http://www.w3.org/2001/XMLSchema", "XMLSchema.xsd", "http://www.w3.org/2001/XMLSchema.xsd"),
25 XML("xml", "http://www.w3.org/XML/1998/namespace", "xml.xsd", "http://www.w3.org/2001/xml.xsd"),
27 XLINK("xlink", "http://www.w3.org/1999/xlink", "xlink.xsd", "https://www.w3.org/1999/xlink.xsd"),
29 WEBDAV("D", "DAV:", null, "https://raw.githubusercontent.com/lookfirst/sardine/master/webdav.xsd"),
31 XSLT("xsl", "http://www.w3.org/1999/XSL/Transform", "schema-for-xslt20.xsd",
32 "https://www.w3.org/2007/schema-for-xslt20.xsd"),
34 SVG("svg", "http://www.w3.org/2000/svg", "SVG.xsd",
35 "https://raw.githubusercontent.com/oreillymedia/HTMLBook/master/schema/svg/SVG.xsd"),
37 DSML("dsml", "urn:oasis:names:tc:DSML:2:0:core", "DSMLv2.xsd",
38 "https://www.oasis-open.org/committees/dsml/docs/DSMLv2.xsd"),
42 private final static String RESOURCE_BASE
= "/org/argeo/cms/acr/schemas/";
44 private String defaultPrefix
;
45 private String namespace
;
47 private URL publicUrl
;
49 CmsContentNamespace(String defaultPrefix
, String namespace
, String resourceFileName
, String publicUrl
) {
50 Objects
.requireNonNull(namespace
);
51 this.defaultPrefix
= defaultPrefix
;
52 Objects
.requireNonNull(namespace
);
53 this.namespace
= namespace
;
54 if (resourceFileName
!= null) {
55 resource
= getClass().getResource(RESOURCE_BASE
+ resourceFileName
);
56 Objects
.requireNonNull(resource
);
58 if (publicUrl
!= null)
60 this.publicUrl
= new URL(publicUrl
);
61 } catch (MalformedURLException e
) {
62 throw new IllegalArgumentException("Cannot interpret public URL", e
);
67 public String
getDefaultPrefix() {
72 public String
getNamespaceURI() {
77 public URL
getSchemaResource() {
81 public URL
getPublicUrl() {