Improve subframework launch
[lgpl/argeo-commons.git] / org.argeo.cms / src / org / argeo / cms / acr / CmsContentNamespace.java
index a36a70aa0a1b40f2e6696cd776d0ca4c452678c8..fe334cb5b9d5430aa7c28fddc6e438b2c120cc65 100644 (file)
@@ -1,6 +1,7 @@
 package org.argeo.cms.acr;
 
 import java.net.MalformedURLException;
+import java.net.URI;
 import java.net.URL;
 import java.util.Objects;
 
@@ -24,7 +25,7 @@ public enum CmsContentNamespace implements ContentNamespace {
        //
        XML("xml", "http://www.w3.org/XML/1998/namespace", "xml.xsd", "http://www.w3.org/2001/xml.xsd"),
        //
-       XLINK("xlink", "http://www.w3.org/1999/xlink", "xlink.xsd", "http://www.w3.org/XML/2008/06/xlink.xsd"),
+       XLINK("xlink", "http://www.w3.org/1999/xlink", "xlink.xsd", "https://www.w3.org/1999/xlink.xsd"),
        //
        WEBDAV("D", "DAV:", null, "https://raw.githubusercontent.com/lookfirst/sardine/master/webdav.xsd"),
        //
@@ -52,7 +53,13 @@ public enum CmsContentNamespace implements ContentNamespace {
                Objects.requireNonNull(namespace);
                this.namespace = namespace;
                if (resourceFileName != null) {
-                       resource = getClass().getResource(RESOURCE_BASE + resourceFileName);
+                       // resource = getClass().getResource(RESOURCE_BASE + resourceFileName);
+                       try {
+                               // FIXME workaround when in nested OSGi frameworks
+                               resource = URI.create("platform:/plugin/org.argeo.cms" + RESOURCE_BASE + resourceFileName).toURL();
+                       } catch (MalformedURLException e) {
+                               throw new IllegalArgumentException("Cannot convert " + resourceFileName + " to URL");
+                       }
                        Objects.requireNonNull(resource);
                }
                if (publicUrl != null)