]>
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 static java
.lang
.System
.Logger
.Level
.ERROR
;
5 import java
.net
.MalformedURLException
;
8 import java
.util
.Objects
;
10 import org
.argeo
.api
.acr
.spi
.ContentNamespace
;
11 import org
.argeo
.cms
.acr
.CmsContentNamespace
;
13 public enum SuiteContentNamespace
implements ContentNamespace
{
17 ENTITY("entity", "http://www.argeo.org/ns/entity",
18 "platform:/plugin/org.argeo.app.api/org/argeo/api/app/entity.xsd", null),
20 ARGEO_DBK("argeodbk", "http://www.argeo.org/ns/argeodbk", null, null),
24 DOCBOOK5("dbk", "http://docbook.org/ns/docbook", "docbook.xsd", "http://docbook.org/xml/5.0.1/xsd/docbook.xsd"),
26 XML_EVENTS("ev", "http://www.w3.org/2001/xml-events", "xml-events-attribs-1.xsd",
27 "http://www.w3.org/MarkUp/SCHEMA/xml-events-attribs-1.xsd"),
29 XFORMS("xforms", "http://www.w3.org/2002/xforms", "XForms-11-Schema.xsd",
30 "https://www.w3.org/MarkUp/Forms/2007/XForms-11-Schema.xsd"),
32 XCARD("xcard", "urn:ietf:params:xml:ns:vcard-4.0", "xCard-4.0.xsd", null),
34 XSL_FO("fo", "http://www.w3.org/1999/XSL/Format", "fop.xsd",
35 "https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk/fop/src/foschema/fop.xsd"),
37 // XCAL_2_0("xcal", "urn:ietf:params:xml:ns:icalendar-2.0", "xCal-2.0.xsd", null),
39 XHTML("h", "http://www.w3.org/1999/xhtml", null, "https://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd"),
43 JR("jr", "http://openrosa.org/javarosa", null, null),
45 ORX("orx", "http://openrosa.org/xforms", null, null),
47 ORX_LIST("orxList", "http://openrosa.org/xforms/xformsList", null, null),
49 ORX_MANIFEST("orxManifest", "http://openrosa.org/xforms/xformsManifest", null, null),
51 ODK("odk", "http://www.opendatakit.org/xforms", null, null),
53 WGS84("geo", "http://www.w3.org/2003/01/geo/wgs84_pos#", null, null),
54 // Re-add XML in order to solve import issue with xlink
55 XML("xml", "http://www.w3.org/XML/1998/namespace", "xml.xsd", "http://www.w3.org/2001/xml.xsd"),
60 private final static String RESOURCE_BASE
= "/org/argeo/app/core/schemas/";
62 private String defaultPrefix
;
63 private String namespace
;
65 private URL publicUrl
;
67 SuiteContentNamespace(String defaultPrefix
, String namespace
, String resourceFileName
, String publicUrl
) {
68 Objects
.requireNonNull(namespace
);
69 this.defaultPrefix
= defaultPrefix
;
70 Objects
.requireNonNull(namespace
);
71 this.namespace
= namespace
;
72 if (resourceFileName
!= null) {
74 // FIXME workaround when in nested OSGi frameworks
75 // we should use class path, as before
76 if (!resourceFileName
.startsWith("platform:")) {
77 resource
= URI
.create("platform:/plugin/org.argeo.app.core" + RESOURCE_BASE
+ resourceFileName
)
80 resource
= URI
.create(resourceFileName
).toURL();
82 } catch (MalformedURLException e
) {
84 System
.getLogger(CmsContentNamespace
.class.getName()).log(ERROR
,
85 "Cannot load " + resourceFileName
+ ": " + e
.getMessage());
86 // throw new IllegalArgumentException("Cannot convert " + resourceFileName + "
89 // Objects.requireNonNull(resource);
91 if (publicUrl
!= null)
93 this.publicUrl
= new URL(publicUrl
);
94 } catch (MalformedURLException e
) {
95 throw new IllegalArgumentException("Cannot interpret public URL", e
);
100 public String
getDefaultPrefix() {
101 return defaultPrefix
;
105 public String
getNamespaceURI() {
110 public URL
getSchemaResource() {
114 public URL
getPublicUrl() {