geronimo-xbean-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1067587 - in /geronimo/xbean/trunk/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util: ./ equinox/
Date Sun, 06 Feb 2011 05:15:23 GMT
Author: gawor
Date: Sun Feb  6 05:15:22 2011
New Revision: 1067587

URL: http://svn.apache.org/viewvc?rev=1067587&view=rev
Log:
XBEAN-164: Override defaults for convertResourceUrls or searchWiredBundles settings

Modified:
    geronimo/xbean/trunk/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/BundleClassLoader.java
    geronimo/xbean/trunk/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/BundleResourceClassLoader.java
    geronimo/xbean/trunk/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/BundleResourceHelper.java
    geronimo/xbean/trunk/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/equinox/EquinoxBundleClassLoader.java
    geronimo/xbean/trunk/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/equinox/EquinoxBundleResourceHelper.java

Modified: geronimo/xbean/trunk/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/BundleClassLoader.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/BundleClassLoader.java?rev=1067587&r1=1067586&r2=1067587&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/BundleClassLoader.java
(original)
+++ geronimo/xbean/trunk/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/BundleClassLoader.java
Sun Feb  6 05:15:22 2011
@@ -49,18 +49,20 @@ public class BundleClassLoader extends C
     protected final BundleResourceHelper resourceHelper;
 
     public BundleClassLoader(Bundle bundle) {
-        this(bundle, true, false);
+        this(bundle, 
+             BundleResourceHelper.getSearchWiredBundles(true), 
+             BundleResourceHelper.getConvertResourceUrls(false));
     }
         
     public BundleClassLoader(Bundle bundle, boolean searchWiredBundles) {
-        this(bundle, searchWiredBundles, false);
+        this(bundle, 
+             searchWiredBundles, 
+             BundleResourceHelper.getConvertResourceUrls(false));
     }
     
     public BundleClassLoader(Bundle bundle, boolean searchWiredBundles, boolean convertResourceUrls)
{
         this.bundle = bundle;
-        this.resourceHelper = new BundleResourceHelper(getBundle());
-        this.resourceHelper.setSearchWiredBundles(searchWiredBundles);
-        this.resourceHelper.setConvertResourceUrls(convertResourceUrls);
+        this.resourceHelper = new BundleResourceHelper(getBundle(), searchWiredBundles, convertResourceUrls);
     }
 
     @Override

Modified: geronimo/xbean/trunk/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/BundleResourceClassLoader.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/BundleResourceClassLoader.java?rev=1067587&r1=1067586&r2=1067587&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/BundleResourceClassLoader.java
(original)
+++ geronimo/xbean/trunk/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/BundleResourceClassLoader.java
Sun Feb  6 05:15:22 2011
@@ -32,7 +32,9 @@ import org.osgi.framework.Bundle;
 public class BundleResourceClassLoader extends BundleClassLoader {
 
     public BundleResourceClassLoader(Bundle bundle) {
-        super(bundle, true, true);
+        super(bundle, 
+              BundleResourceHelper.getSearchWiredBundles(true), 
+              BundleResourceHelper.getConvertResourceUrls(true));
     }
 
     @Override

Modified: geronimo/xbean/trunk/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/BundleResourceHelper.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/BundleResourceHelper.java?rev=1067587&r1=1067586&r2=1067587&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/BundleResourceHelper.java
(original)
+++ geronimo/xbean/trunk/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/BundleResourceHelper.java
Sun Feb  6 05:15:22 2011
@@ -51,6 +51,9 @@ import org.osgi.service.packageadmin.Pac
  */
 public class BundleResourceHelper {
 
+    public static final String SEARCH_WIRED_BUNDLES = BundleResourceHelper.class.getName()
+ ".searchWiredBundles";
+    public static final String CONVERT_RESOURCE_URLS = BundleResourceHelper.class.getName()
+ ".convertResourceUrls";
+    
     private final static String META_INF_1 = "META-INF/";
     private final static String META_INF_2 = "/META-INF/";
     
@@ -60,7 +63,15 @@ public class BundleResourceHelper {
     protected boolean convertResourceUrls;
   
     public BundleResourceHelper(Bundle bundle) {
+        this(bundle,      
+             BundleResourceHelper.getSearchWiredBundles(false), 
+             BundleResourceHelper.getConvertResourceUrls(false));
+    }
+    
+    public BundleResourceHelper(Bundle bundle, boolean searchWiredBundles, boolean convertResourceUrls)
{
         this.bundle = bundle;
+        this.searchWiredBundles = searchWiredBundles;
+        this.convertResourceUrls = convertResourceUrls;
     }
 
     public void setSearchWiredBundles(boolean search) {
@@ -241,4 +252,14 @@ public class BundleResourceHelper {
         });                   
         return resources;           
     }
+    
+    public static boolean getSearchWiredBundles(boolean defaultValue) {
+        String value = System.getProperty(SEARCH_WIRED_BUNDLES);
+        return (value == null) ? defaultValue : Boolean.parseBoolean(value);        
+    }
+    
+    public static boolean getConvertResourceUrls(boolean defaultValue) {
+        String value = System.getProperty(CONVERT_RESOURCE_URLS);
+        return (value == null) ? defaultValue : Boolean.parseBoolean(value);        
+    }
 }

Modified: geronimo/xbean/trunk/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/equinox/EquinoxBundleClassLoader.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/equinox/EquinoxBundleClassLoader.java?rev=1067587&r1=1067586&r2=1067587&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/equinox/EquinoxBundleClassLoader.java
(original)
+++ geronimo/xbean/trunk/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/equinox/EquinoxBundleClassLoader.java
Sun Feb  6 05:15:22 2011
@@ -43,12 +43,16 @@ public class EquinoxBundleClassLoader ex
     private final Bundle bundle;
     private final BundleResourceHelper resourceHelper;
     
-    public EquinoxBundleClassLoader(Bundle bundle) {
+    public EquinoxBundleClassLoader(Bundle bundle) {      
+        this(bundle, 
+             BundleResourceHelper.getSearchWiredBundles(true), 
+             BundleResourceHelper.getConvertResourceUrls(true));
+    }
+    
+    public EquinoxBundleClassLoader(Bundle bundle, boolean searchWiredBundles, boolean convertResourceUrls)
{
         super(new URL[] {});
         this.bundle = bundle;
-        this.resourceHelper = new EquinoxBundleResourceHelper(getBundle());
-        this.resourceHelper.setSearchWiredBundles(true);
-        this.resourceHelper.setConvertResourceUrls(true);
+        this.resourceHelper = new EquinoxBundleResourceHelper(getBundle(), searchWiredBundles,
convertResourceUrls);
     }
     
     @Override

Modified: geronimo/xbean/trunk/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/equinox/EquinoxBundleResourceHelper.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/equinox/EquinoxBundleResourceHelper.java?rev=1067587&r1=1067586&r2=1067587&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/equinox/EquinoxBundleResourceHelper.java
(original)
+++ geronimo/xbean/trunk/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/equinox/EquinoxBundleResourceHelper.java
Sun Feb  6 05:15:22 2011
@@ -42,8 +42,8 @@ public class EquinoxBundleResourceHelper
 
     private URLConverter converter;
     
-    public EquinoxBundleResourceHelper(Bundle bundle) {
-        super(bundle);
+    public EquinoxBundleResourceHelper(Bundle bundle, boolean searchWiredBundles, boolean
convertResourceUrls) {
+        super(bundle, searchWiredBundles, convertResourceUrls);
         init();
     }
 



Mime
View raw message