X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.app.core%2Fsrc%2Forg%2Fargeo%2Fapp%2Fcore%2FSuiteContentNamespace.java;h=46456493b115a81f682a14bb2b3d17e27c42b568;hb=HEAD;hp=ecb07c92e6639fd4d671f1d5160e74af1c8c6012;hpb=616a062e9d061ce91589556624ed622298a21ac7;p=gpl%2Fargeo-suite.git diff --git a/org.argeo.app.core/src/org/argeo/app/core/SuiteContentNamespace.java b/org.argeo.app.core/src/org/argeo/app/core/SuiteContentNamespace.java index ecb07c9..be4238f 100644 --- a/org.argeo.app.core/src/org/argeo/app/core/SuiteContentNamespace.java +++ b/org.argeo.app.core/src/org/argeo/app/core/SuiteContentNamespace.java @@ -1,7 +1,6 @@ package org.argeo.app.core; import java.net.MalformedURLException; -import java.net.URI; import java.net.URL; import java.util.Objects; @@ -11,8 +10,7 @@ public enum SuiteContentNamespace implements ContentNamespace { // // ARGEO // - ENTITY("entity", "http://www.argeo.org/ns/entity", - "platform:/plugin/org.argeo.app.api/org/argeo/api/app/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), // @@ -51,7 +49,7 @@ public enum SuiteContentNamespace implements ContentNamespace { // 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/"; @@ -67,20 +65,29 @@ public enum SuiteContentNamespace implements ContentNamespace { Objects.requireNonNull(namespace); this.namespace = namespace; if (resourceFileName != null) { - 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) { - throw new IllegalArgumentException("Cannot convert " + resourceFileName + " to URL"); - } + if (!resourceFileName.startsWith("/")) + resource = getClass().getResource(RESOURCE_BASE + resourceFileName); + else + resource = getClass().getResource(resourceFileName); +// Objects.requireNonNull(resource); - 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 {