]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - CmsContentNamespace.java
fe334cb5b9d5430aa7c28fddc6e438b2c120cc65
1 package org
.argeo
.cms
.acr
;
3 import java
.net
.MalformedURLException
;
6 import java
.util
.Objects
;
8 import org
.argeo
.api
.acr
.ArgeoNamespace
;
9 import org
.argeo
.api
.acr
.spi
.ContentNamespace
;
11 /** Content namespaces supported by CMS. */
12 public enum CmsContentNamespace
implements ContentNamespace
{
16 CR(ArgeoNamespace
.CR_DEFAULT_PREFIX
, ArgeoNamespace
.CR_NAMESPACE_URI
, "cr.xsd", null),
18 SLC("slc", "http://www.argeo.org/ns/slc", null, null),
20 ARGEO("argeo", "http://www.argeo.org/ns/argeo", null, null),
24 XSD("xs", "http://www.w3.org/2001/XMLSchema", "XMLSchema.xsd", "http://www.w3.org/2001/XMLSchema.xsd"),
26 XML("xml", "http://www.w3.org/XML/1998/namespace", "xml.xsd", "http://www.w3.org/2001/xml.xsd"),
28 XLINK("xlink", "http://www.w3.org/1999/xlink", "xlink.xsd", "https://www.w3.org/1999/xlink.xsd"),
30 WEBDAV("D", "DAV:", null, "https://raw.githubusercontent.com/lookfirst/sardine/master/webdav.xsd"),
32 XSLT("xsl", "http://www.w3.org/1999/XSL/Transform", "schema-for-xslt20.xsd",
33 "https://www.w3.org/2007/schema-for-xslt20.xsd"),
35 SVG("svg", "http://www.w3.org/2000/svg", "SVG.xsd",
36 "https://raw.githubusercontent.com/oreillymedia/HTMLBook/master/schema/svg/SVG.xsd"),
38 DSML("dsml", "urn:oasis:names:tc:DSML:2:0:core", "DSMLv2.xsd",
39 "https://www.oasis-open.org/committees/dsml/docs/DSMLv2.xsd"),
43 private final static String RESOURCE_BASE
= "/org/argeo/cms/acr/schemas/";
45 private String defaultPrefix
;
46 private String namespace
;
48 private URL publicUrl
;
50 CmsContentNamespace(String defaultPrefix
, String namespace
, String resourceFileName
, String publicUrl
) {
51 Objects
.requireNonNull(namespace
);
52 this.defaultPrefix
= defaultPrefix
;
53 Objects
.requireNonNull(namespace
);
54 this.namespace
= namespace
;
55 if (resourceFileName
!= null) {
56 // resource = getClass().getResource(RESOURCE_BASE + resourceFileName);
58 // FIXME workaround when in nested OSGi frameworks
59 resource
= URI
.create("platform:/plugin/org.argeo.cms" + RESOURCE_BASE
+ resourceFileName
).toURL();
60 } catch (MalformedURLException e
) {
61 throw new IllegalArgumentException("Cannot convert " + resourceFileName
+ " to URL");
63 Objects
.requireNonNull(resource
);
65 if (publicUrl
!= null)
67 this.publicUrl
= new URL(publicUrl
);
68 } catch (MalformedURLException e
) {
69 throw new IllegalArgumentException("Cannot interpret public URL", e
);
74 public String
getDefaultPrefix() {
79 public String
getNamespaceURI() {
84 public URL
getSchemaResource() {
88 public URL
getPublicUrl() {