From d2f1498d82864a131a6e2e589c115d04af32b4f6 Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Mon, 27 Jul 2009 08:38:47 +0000 Subject: [PATCH] Add includes and excludes git-svn-id: https://svn.argeo.org/slc/trunk@2775 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- .../slc/lib/detached/DetachedLauncher.java | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/runtime/org.argeo.slc.lib.detached/src/main/java/org/argeo/slc/lib/detached/DetachedLauncher.java b/runtime/org.argeo.slc.lib.detached/src/main/java/org/argeo/slc/lib/detached/DetachedLauncher.java index 120854914..d9ff2f6be 100644 --- a/runtime/org.argeo.slc.lib.detached/src/main/java/org/argeo/slc/lib/detached/DetachedLauncher.java +++ b/runtime/org.argeo.slc.lib.detached/src/main/java/org/argeo/slc/lib/detached/DetachedLauncher.java @@ -2,6 +2,8 @@ package org.argeo.slc.lib.detached; import java.io.File; import java.io.IOException; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -29,6 +31,9 @@ public class DetachedLauncher extends JvmProcess implements BundleContextAware, private String xmlapisBundleName = "com.springsource.org.apache.xmlcommons"; private String xercesBundleName = "com.springsource.org.apache.xerces"; + private List excludeBundleNames = new ArrayList(); + private List includeBundleUrls = new ArrayList(); + /** * Required by Spring for JDK 1.4. see * http://forum.springsource.org/showthread.php?t=74555 @@ -56,6 +61,10 @@ public class DetachedLauncher extends JvmProcess implements BundleContextAware, StringBuffer osgiLocations = new StringBuffer(""); bundles: for (Bundle bundle : bundleContext.getBundles()) { String name = bundle.getSymbolicName(); + + if (excludeBundleNames.contains(name)) + continue bundles;// skip excluded + String location = bundle.getLocation(); location = removeInitialReference(location); @@ -82,13 +91,19 @@ public class DetachedLauncher extends JvmProcess implements BundleContextAware, } } + for (String url : includeBundleUrls) { + if (osgiBundles.length() != 0) + osgiBundles.append(','); + osgiBundles.append(url); + } + getSystemProperties().setProperty("osgi.bundles", osgiBundles.toString()); getSystemProperties().setProperty("slc.osgi.locations", osgiLocations.toString()); } - protected String removeInitialReference(String location){ + protected String removeInitialReference(String location) { if (location.startsWith("initial@reference:file:")) location = System.getProperty("osgi.install.area") + location.substring("initial@reference:file:".length()); @@ -152,4 +167,12 @@ public class DetachedLauncher extends JvmProcess implements BundleContextAware, this.prependXmlJars = prependXmlJars; } + public void setExcludeBundleNames(List excludeBundleNames) { + this.excludeBundleNames = excludeBundleNames; + } + + public void setIncludeBundleUrls(List includeBundleUrls) { + this.includeBundleUrls = includeBundleUrls; + } + } -- 2.39.2