]> git.argeo.org Git - gpl/argeo-suite.git/blob - org.argeo.app.core/src/org/argeo/app/core/SuiteContentTypes.java
Only external userAdmin can set userAdmin
[gpl/argeo-suite.git] / org.argeo.app.core / src / org / argeo / app / core / SuiteContentTypes.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 public enum SuiteContentTypes {
8 //
9 // ARGEO
10 //
11 ENTITY("entity", "http://www.argeo.org/ns/entity", "entity.xsd", null),
12 //
13 ARGEO_DBK("argeodbk", "http://www.argeo.org/ns/argeodbk", null, null),
14 //
15 // EXTERNAL
16 //
17 XCARD_4_0("xcard", "urn:ietf:params:xml:ns:vcard-4.0", "xCard-4.0.xsd", null),
18 //
19 XSL_FO_1999("fo", "http://www.w3.org/1999/XSL/Format", "fop.xsd",
20 "https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk/fop/src/foschema/fop.xsd"),
21 //
22 // XCAL_2_0("xcal", "urn:ietf:params:xml:ns:icalendar-2.0", "xCal-2.0.xsd", null),
23 //
24 XHTML_1_1("h", "http://www.w3.org/1999/xhtml", null, "https://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd"),
25 //
26 // ODK
27 //
28 JR("jr", "http://openrosa.org/javarosa", null, null),
29 //
30 ORX("orx", "http://openrosa.org/xforms", null, null),
31 //
32 ORX_LIST("orxList", "http://openrosa.org/xforms/xformsList", null, null),
33 //
34 ORX_MANIFEST("orxManifest", "http://openrosa.org/xforms/xformsManifest", null, null),
35 //
36 ODK("odk", "http://www.opendatakit.org/xforms", null, null),
37 //
38 WGS84("geo", "http://www.w3.org/2003/01/geo/wgs84_pos#", null, null),
39 //
40 ;
41
42 private final static String RESOURCE_BASE = "/org/argeo/app/core/schemas/";
43
44 private String defaultPrefix;
45 private String namespace;
46 private URL resource;
47 private URL publicUrl;
48
49 SuiteContentTypes(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);
57 }
58 if (publicUrl != null)
59 try {
60 this.publicUrl = new URL(publicUrl);
61 } catch (MalformedURLException e) {
62 throw new IllegalArgumentException("Cannot interpret public URL", e);
63 }
64 }
65
66 public String getDefaultPrefix() {
67 return defaultPrefix;
68 }
69
70 public String getNamespace() {
71 return namespace;
72 }
73
74 public URL getResource() {
75 return resource;
76 }
77
78 public URL getPublicUrl() {
79 return publicUrl;
80 }
81
82 }