]> git.argeo.org Git - gpl/argeo-suite.git/blob - org.argeo.app.core/src/org/argeo/app/core/SuiteContentNamespace.java
Experiment with GML
[gpl/argeo-suite.git] / org.argeo.app.core / src / org / argeo / app / core / SuiteContentNamespace.java
1 package org.argeo.app.core;
2
3 import java.net.MalformedURLException;
4 import java.net.URL;
5 import java.util.Objects;
6
7 import org.argeo.api.acr.spi.ContentNamespace;
8
9 public enum SuiteContentNamespace implements ContentNamespace {
10 //
11 // ARGEO
12 //
13 ENTITY("entity", "http://www.argeo.org/ns/entity", "entity.xsd", null),
14 //
15 ARGEO_DBK("argeodbk", "http://www.argeo.org/ns/argeodbk", null, null),
16 //
17 // EXTERNAL
18 //
19 DOCBOOK5("dbk", "http://docbook.org/ns/docbook", "docbook.xsd", "http://docbook.org/xml/5.0.1/xsd/docbook.xsd"),
20 //
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"),
23 //
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"),
26 //
27 XCARD("xcard", "urn:ietf:params:xml:ns:vcard-4.0", "xCard-4.0.xsd", null),
28 //
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"),
31 //
32 // XCAL_2_0("xcal", "urn:ietf:params:xml:ns:icalendar-2.0", "xCal-2.0.xsd", null),
33 //
34 XHTML("h", "http://www.w3.org/1999/xhtml", null, "https://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd"),
35 //
36 // ODK
37 //
38 JR("jr", "http://openrosa.org/javarosa", null, null),
39 //
40 ORX("orx", "http://openrosa.org/xforms", null, null),
41 //
42 ORX_LIST("orxList", "http://openrosa.org/xforms/xformsList", null, null),
43 //
44 ORX_MANIFEST("orxManifest", "http://openrosa.org/xforms/xformsManifest", null, null),
45 //
46 ODK("odk", "http://www.opendatakit.org/xforms", null, null),
47 //
48 WGS84("geo", "http://www.w3.org/2003/01/geo/wgs84_pos#", null, null),
49 //
50 ;
51
52 private final static String RESOURCE_BASE = "/org/argeo/app/core/schemas/";
53
54 private String defaultPrefix;
55 private String namespace;
56 private URL resource;
57 private URL publicUrl;
58
59 SuiteContentNamespace(String defaultPrefix, String namespace, String resourceFileName, String publicUrl) {
60 Objects.requireNonNull(namespace);
61 this.defaultPrefix = defaultPrefix;
62 Objects.requireNonNull(namespace);
63 this.namespace = namespace;
64 if (resourceFileName != null) {
65 resource = getClass().getResource(RESOURCE_BASE + resourceFileName);
66 Objects.requireNonNull(resource);
67 }
68 if (publicUrl != null)
69 try {
70 this.publicUrl = new URL(publicUrl);
71 } catch (MalformedURLException e) {
72 throw new IllegalArgumentException("Cannot interpret public URL", e);
73 }
74 }
75
76 @Override
77 public String getDefaultPrefix() {
78 return defaultPrefix;
79 }
80
81 @Override
82 public String getNamespaceURI() {
83 return namespace;
84 }
85
86 @Override
87 public URL getSchemaResource() {
88 return resource;
89 }
90
91 public URL getPublicUrl() {
92 return publicUrl;
93 }
94
95 }