X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=runtime%2Forg.argeo.slc.support.osgi%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fosgi%2Fbuild%2FOsgiRuntimeModularDistribution.java;h=cb6353c35de812b8a9a2810737c818390dcf80b5;hb=3779f02dcb5f24beee8fc08b5f5876af446dab41;hp=7f3b49a381867914c9b35b0f2b3bbab2b789d7a4;hpb=60b5c14f8a0c092e40090b23647fa15601b0c822;p=gpl%2Fargeo-slc.git diff --git a/runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/build/OsgiRuntimeModularDistribution.java b/runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/build/OsgiRuntimeModularDistribution.java index 7f3b49a38..cb6353c35 100644 --- a/runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/build/OsgiRuntimeModularDistribution.java +++ b/runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/build/OsgiRuntimeModularDistribution.java @@ -13,6 +13,7 @@ import org.osgi.framework.Bundle; import org.springframework.context.ResourceLoaderAware; import org.springframework.core.io.Resource; import org.springframework.core.io.ResourceLoader; +import org.springframework.osgi.util.OsgiBundleUtils; public class OsgiRuntimeModularDistribution extends AbstractOsgiModularDistribution implements ResourceLoaderAware { @@ -25,14 +26,32 @@ public class OsgiRuntimeModularDistribution extends SortedMap distributions) throws Exception { - for (Bundle bundle : getBundleContext().getBundles()) { + String frameworkUrl = System.getProperty("osgi.framework"); + String frameworkBaseUrl = null; + if (frameworkUrl != null) + frameworkBaseUrl = frameworkUrl.substring(0, frameworkUrl + .lastIndexOf('/')); + bundles: for (Bundle bundle : getBundleContext().getBundles()) { OsgiBundle osgiBundle = new OsgiBundle(bundle); String originalLocation = bundle.getLocation(); + + if (OsgiBundleUtils.isSystemBundle(bundle)) { + continue bundles; + } + String location = originalLocation; if (originalLocation.startsWith("reference:file:")) location = originalLocation.substring("reference:".length()); + if (frameworkBaseUrl != null + && originalLocation.startsWith("initial@reference:file:")) { + location = frameworkBaseUrl + + '/' + + originalLocation.substring("initial@reference:file:" + .length()); + } + try { URL url = new URL(location); Resource res = resourceLoader.getResource(url.toString());