X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=runtime%2Forg.argeo.slc.osgiboot%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fosgiboot%2FOsgiBoot.java;h=788c0babfdd04ff2c39fe7577ee1ab6ea862fe60;hb=af874b12bcb864e1ee2b48e8d6e1fea3a584c53d;hp=dd2b1b691930f011d3a8f329f1d764a9d7e75b33;hpb=b98bef7b2e743103c93e719ac5c18bf41858ec3a;p=gpl%2Fargeo-slc.git diff --git a/runtime/org.argeo.slc.osgiboot/src/main/java/org/argeo/slc/osgiboot/OsgiBoot.java b/runtime/org.argeo.slc.osgiboot/src/main/java/org/argeo/slc/osgiboot/OsgiBoot.java index dd2b1b691..788c0babf 100644 --- a/runtime/org.argeo.slc.osgiboot/src/main/java/org/argeo/slc/osgiboot/OsgiBoot.java +++ b/runtime/org.argeo.slc.osgiboot/src/main/java/org/argeo/slc/osgiboot/OsgiBoot.java @@ -37,7 +37,7 @@ public class OsgiBoot { .booleanValue(); private boolean excludeSvn = true; - private String modulesUrlSeparator = ";"; + private String modulesUrlSeparator = ","; private final BundleContext bundleContext; @@ -45,6 +45,15 @@ public class OsgiBoot { this.bundleContext = bundleContext; } + public void bootstrap() { + info("SLC OSGi bootstrap starting..."); + installUrls(getBundlesUrls()); + installUrls(getLocationsUrls()); + installUrls(getModulesUrls()); + startBundles(); + info("SLC OSGi bootstrap completed"); + } + public void installUrls(List urls) { Map installedBundles = getInstalledBundles(); for (int i = 0; i < urls.size(); i++) { @@ -109,12 +118,12 @@ public class OsgiBoot { } - public void startBundles() throws Exception { + public void startBundles() { String bundlesToStart = getProperty(PROP_SLC_OSGI_START); startBundles(bundlesToStart); } - public void startBundles(String bundlesToStartStr) throws Exception { + public void startBundles(String bundlesToStartStr) { if (bundlesToStartStr == null) return; @@ -127,7 +136,7 @@ public class OsgiBoot { startBundles(bundlesToStart); } - public void startBundles(List bundlesToStart) throws Exception { + public void startBundles(List bundlesToStart) { if (bundlesToStart.size() == 0) return; @@ -299,7 +308,7 @@ public class OsgiBoot { StringTokenizer st = new StringTokenizer(bundleLocations, File.pathSeparator); while (st.hasMoreTokens()) { - urls.add(baseUrl + st.nextToken().trim()); + urls.add(locationToUrl(baseUrl, st.nextToken().trim())); } return urls; } @@ -349,7 +358,7 @@ public class OsgiBoot { for (int i = 0; i < included.size(); i++) { String fullPath = (String) included.get(i); if (!excluded.contains(fullPath)) - urls.add(baseUrl + fullPath); + urls.add(locationToUrl(baseUrl, fullPath)); } return urls; @@ -419,6 +428,18 @@ public class OsgiBoot { } } + protected String locationToUrl(String baseUrl, String location) { + int extInd = location.lastIndexOf('.'); + String ext = null; + if (extInd > 0) + ext = location.substring(extInd); + + if (baseUrl.startsWith("reference:") && ".jar".equals(ext)) + return "file:" + location; + else + return baseUrl + location; + } + /** Transforms a relative path in a full system path. */ protected String relativeToFullPath(String basePath, String relativePath) { return (basePath + '/' + relativePath).replace('/', File.separatorChar);