Improve provisioning via OSGiBoot
authorMathieu Baudier <mbaudier@argeo.org>
Tue, 28 Jul 2009 11:55:34 +0000 (11:55 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Tue, 28 Jul 2009 11:55:34 +0000 (11:55 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@2819 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

runtime/org.argeo.slc.osgiboot/src/main/java/org/argeo/slc/osgiboot/OsgiBoot.java
runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/build/OsgiRuntimeModularDistribution.java

index 788c0babfdd04ff2c39fe7577ee1ab6ea862fe60..dbcb458f6ccab95902c6ad4d30538f8b7dfbb4d0 100644 (file)
@@ -193,6 +193,8 @@ public class OsgiBoot {
                if (modulesUrlStr == null)
                        return urls;
 
+               String baseUrl = getProperty(PROP_SLC_OSGI_BASE_URL);
+
                Map installedBundles = getBundles();
 
                BufferedReader reader = null;
@@ -207,6 +209,8 @@ public class OsgiBoot {
                                String moduleName = st.nextToken();
                                String moduleVersion = st.nextToken();
                                String url = st.nextToken();
+                               if (baseUrl != null)
+                                       url = baseUrl + url;
 
                                if (installedBundles.containsKey(moduleName)) {
                                        Bundle bundle = (Bundle) installedBundles.get(moduleName);
index 1c68cf5c356917a33a30109e8d6231d56f99e80f..7f3b49a381867914c9b35b0f2b3bbab2b789d7a4 100644 (file)
@@ -28,14 +28,20 @@ public class OsgiRuntimeModularDistribution extends
                for (Bundle bundle : getBundleContext().getBundles()) {
                        OsgiBundle osgiBundle = new OsgiBundle(bundle);
 
-                       String location = bundle.getLocation();
-                       if (location.startsWith("reference:file:"))
-                               location = location.substring("reference:".length());
+                       String originalLocation = bundle.getLocation();
+                       String location = originalLocation;
+                       if (originalLocation.startsWith("reference:file:"))
+                               location = originalLocation.substring("reference:".length());
+
                        try {
                                URL url = new URL(location);
                                Resource res = resourceLoader.getResource(url.toString());
                                distributions.put(osgiBundle,
                                                new VersionedResourceDistribution(osgiBundle, res));
+
+                               if (log.isTraceEnabled())
+                                       log.debug("Added url " + url + " from original location "
+                                                       + originalLocation);
                        } catch (Exception e) {
                                log.warn("Cannot interpret location " + location
                                                + " of bundle " + bundle + ": " + e);