]>
git.argeo.org Git - gpl/argeo-suite.git/blob - org.argeo.app.core/src/org/argeo/app/core/SuiteContentNamespace.java
1 package org
.argeo
.app
.core
;
3 import java
.net
.MalformedURLException
;
5 import java
.util
.Objects
;
7 import org
.argeo
.api
.acr
.spi
.ContentNamespace
;
9 public enum SuiteContentNamespace
implements ContentNamespace
{
13 ENTITY("entity", "http://www.argeo.org/ns/entity", "/org/argeo/app/api/entity.xsd", null),
15 ARGEO_DBK("argeodbk", "http://www.argeo.org/ns/argeodbk", null, null),
19 DOCBOOK5("dbk", "http://docbook.org/ns/docbook", "docbook.xsd", "http://docbook.org/xml/5.0.1/xsd/docbook.xsd"),
21 XML_EVENTS("ev", "http://www.w3.org/2001/xml-events", "xml-events-attribs-1.xsd",
22 "http://www.w3.org/MarkUp/SCHEMA/xml-events-attribs-1.xsd"),
24 XFORMS("xforms", "http://www.w3.org/2002/xforms", "XForms-11-Schema.xsd",
25 "https://www.w3.org/MarkUp/Forms/2007/XForms-11-Schema.xsd"),
27 XCARD("xcard", "urn:ietf:params:xml:ns:vcard-4.0", "xCard-4.0.xsd", null),
29 XSL_FO("fo", "http://www.w3.org/1999/XSL/Format", "fop.xsd",
30 "https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk/fop/src/foschema/fop.xsd"),
32 // XCAL_2_0("xcal", "urn:ietf:params:xml:ns:icalendar-2.0", "xCal-2.0.xsd", null),
34 XHTML("h", "http://www.w3.org/1999/xhtml", null, "https://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd"),
38 JR("jr", "http://openrosa.org/javarosa", null, null),
40 ORX("orx", "http://openrosa.org/xforms", null, null),
42 ORX_LIST("orxList", "http://openrosa.org/xforms/xformsList", null, null),
44 ORX_MANIFEST("orxManifest", "http://openrosa.org/xforms/xformsManifest", null, null),
46 ODK("odk", "http://www.opendatakit.org/xforms", null, null),
48 WGS84("geo", "http://www.w3.org/2003/01/geo/wgs84_pos#", null, null),
49 // Re-add XML in order to solve import issue with xlink
50 XML("xml", "http://www.w3.org/XML/1998/namespace", "xml.xsd", "http://www.w3.org/2001/xml.xsd"),
55 private final static String RESOURCE_BASE
= "/org/argeo/app/core/schemas/";
57 private String defaultPrefix
;
58 private String namespace
;
60 private URL publicUrl
;
62 SuiteContentNamespace(String defaultPrefix
, String namespace
, String resourceFileName
, String publicUrl
) {
63 Objects
.requireNonNull(namespace
);
64 this.defaultPrefix
= defaultPrefix
;
65 Objects
.requireNonNull(namespace
);
66 this.namespace
= namespace
;
67 if (resourceFileName
!= null) {
68 if (!resourceFileName
.startsWith("/"))
69 resource
= getClass().getResource(RESOURCE_BASE
+ resourceFileName
);
71 resource
= getClass().getResource(resourceFileName
);
72 // Objects.requireNonNull(resource);
75 // // FIXME workaround when in nested OSGi frameworks
76 // // we should use class path, as before
77 // if (!resourceFileName.startsWith("platform:")) {
78 // resource = URI.create("platform:/plugin/org.argeo.app.core" + RESOURCE_BASE + resourceFileName)
81 // resource = URI.create(resourceFileName).toURL();
83 // } catch (MalformedURLException e) {
85 // System.getLogger(CmsContentNamespace.class.getName()).log(ERROR,
86 // "Cannot load " + resourceFileName + ": " + e.getMessage());
87 // // throw new IllegalArgumentException("Cannot convert " + resourceFileName + "
90 // Objects.requireNonNull(resource);
92 if (publicUrl
!= null)
94 this.publicUrl
= new URL(publicUrl
);
95 } catch (MalformedURLException e
) {
96 throw new IllegalArgumentException("Cannot interpret public URL", e
);
101 public String
getDefaultPrefix() {
102 return defaultPrefix
;
106 public String
getNamespaceURI() {
111 public URL
getSchemaResource() {
115 public URL
getPublicUrl() {