]> git.argeo.org Git - gpl/argeo-suite.git/blobdiff - org.argeo.app.core/src/org/argeo/app/core/SuiteContentNamespace.java
Revert loading of XSD
[gpl/argeo-suite.git] / org.argeo.app.core / src / org / argeo / app / core / SuiteContentNamespace.java
index 48c508b45c54c6697ad84569d7335578a5e30fec..be4238f6fa77b2f8128c7d83c20defab5075e239 100644 (file)
@@ -10,7 +10,7 @@ public enum SuiteContentNamespace implements ContentNamespace {
        //
        // ARGEO
        //
-       ENTITY("entity", "http://www.argeo.org/ns/entity", "entity.xsd", null),
+       ENTITY("entity", "http://www.argeo.org/ns/entity", "/org/argeo/app/api/entity.xsd", null),
        //
        ARGEO_DBK("argeodbk", "http://www.argeo.org/ns/argeodbk", null, null),
        //
@@ -46,7 +46,10 @@ public enum SuiteContentNamespace implements ContentNamespace {
        ODK("odk", "http://www.opendatakit.org/xforms", null, null),
        //
        WGS84("geo", "http://www.w3.org/2003/01/geo/wgs84_pos#", null, null),
+       // Re-add XML in order to solve import issue with xlink
+       XML("xml", "http://www.w3.org/XML/1998/namespace", "xml.xsd", "http://www.w3.org/2001/xml.xsd"),
        //
+
        ;
 
        private final static String RESOURCE_BASE = "/org/argeo/app/core/schemas/";
@@ -62,8 +65,29 @@ public enum SuiteContentNamespace implements ContentNamespace {
                Objects.requireNonNull(namespace);
                this.namespace = namespace;
                if (resourceFileName != null) {
-                       resource = getClass().getResource(RESOURCE_BASE + resourceFileName);
-                       Objects.requireNonNull(resource);
+                       if (!resourceFileName.startsWith("/"))
+                               resource = getClass().getResource(RESOURCE_BASE + resourceFileName);
+                       else
+                               resource = getClass().getResource(resourceFileName);
+//                     Objects.requireNonNull(resource);
+
+//                     try {
+//                             // FIXME workaround when in nested OSGi frameworks
+//                             // we should use class path, as before
+//                             if (!resourceFileName.startsWith("platform:")) {
+//                                     resource = URI.create("platform:/plugin/org.argeo.app.core" + RESOURCE_BASE + resourceFileName)
+//                                                     .toURL();
+//                             } else {
+//                                     resource = URI.create(resourceFileName).toURL();
+//                             }
+//                     } catch (MalformedURLException e) {
+//                             resource = null;
+//                             System.getLogger(CmsContentNamespace.class.getName()).log(ERROR,
+//                                             "Cannot load " + resourceFileName + ": " + e.getMessage());
+//                             // throw new IllegalArgumentException("Cannot convert " + resourceFileName + "
+//                             // to URL");
+//                     }
+                       // Objects.requireNonNull(resource);
                }
                if (publicUrl != null)
                        try {