]> git.argeo.org Git - gpl/argeo-slc.git/commitdiff
Add includes and excludes
authorMathieu Baudier <mbaudier@argeo.org>
Mon, 27 Jul 2009 08:38:47 +0000 (08:38 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Mon, 27 Jul 2009 08:38:47 +0000 (08:38 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@2775 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

runtime/org.argeo.slc.lib.detached/src/main/java/org/argeo/slc/lib/detached/DetachedLauncher.java

index 12085491495b3797056e6f2852c916895c4509d1..d9ff2f6be118c7f2fbd84e01fae688f1fb2d1ad5 100644 (file)
@@ -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<String> excludeBundleNames = new ArrayList<String>();
+       private List<String> includeBundleUrls = new ArrayList<String>();
+
        /**
         * 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<String> excludeBundleNames) {
+               this.excludeBundleNames = excludeBundleNames;
+       }
+
+       public void setIncludeBundleUrls(List<String> includeBundleUrls) {
+               this.includeBundleUrls = includeBundleUrls;
+       }
+
 }