Author: thomas.diesler(a)jboss.com
Date: 2010-02-02 00:01:18 -0500 (Tue, 02 Feb 2010)
New Revision: 100234
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderDomain.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderSystem.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/internal/SystemPackagesPluginImpl.java
Log:
Filter org.osgi.core packages in CLSystem
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderDomain.java
===================================================================
---
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderDomain.java 2010-02-02
05:00:14 UTC (rev 100233)
+++
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderDomain.java 2010-02-02
05:01:18 UTC (rev 100234)
@@ -29,12 +29,12 @@
import java.util.List;
import org.jboss.classloader.plugins.filter.CombiningClassFilter;
-import org.jboss.classloader.plugins.filter.PatternClassFilter;
import org.jboss.classloader.spi.ClassLoaderDomain;
import org.jboss.classloader.spi.ClassLoaderPolicy;
import org.jboss.classloader.spi.ClassLoaderSystem;
import org.jboss.classloader.spi.ParentPolicy;
import org.jboss.classloader.spi.base.BaseClassLoader;
+import org.jboss.classloader.spi.filter.ClassFilter;
import org.jboss.classloader.spi.filter.ClassFilterUtils;
import org.jboss.classloader.spi.filter.PackageClassFilter;
import org.jboss.classloader.spi.filter.RecursivePackageClassFilter;
@@ -57,6 +57,29 @@
private List<URL> classPath = new ArrayList<URL>();
/**
+ * Return a filter for all packages defined in the org.osgi.core.jar
+ * and java.* but not javax.*
+ */
+ static ClassFilter getClassLoaderDomainFilter()
+ {
+ // Filter the list of org.osgi.core packages
+ ArrayList<String> corePackages = new ArrayList<String>();
+ corePackages.add("org.osgi.framework");
+ corePackages.add("org.osgi.framework.hooks");
+ corePackages.add("org.osgi.framework.hooks.service");
+ corePackages.add("org.osgi.framework.launch");
+ corePackages.add("org.osgi.service.condpermadmin");
+ corePackages.add("org.osgi.service.packageadmin");
+ corePackages.add("org.osgi.service.permissionadmin");
+ corePackages.add("org.osgi.service.startlevel");
+ corePackages.add("org.osgi.service.url");
+ ClassFilter osgiFilter =
PackageClassFilter.createPackageClassFilter(corePackages);
+ // Filter java.* but not javax.*
+ ClassFilter javaFilter =
RecursivePackageClassFilter.createRecursivePackageClassFilter("java");
+ return CombiningClassFilter.create(javaFilter, osgiFilter);
+ }
+
+ /**
* Create a new OSGiClassLoaderDomain.
* @param domainName the domain name
* @throws IllegalArgumentException for a null bundle manager
@@ -100,10 +123,8 @@
classLoaderSystem.registerDomain(this);
// Initialize the configured system packages
- String filteredPackages = getSystemPackagesAsString();
- PackageClassFilter systemFilter =
PackageClassFilter.createPackageClassFilterFromString(filteredPackages);
- PatternClassFilter javaFilter =
RecursivePackageClassFilter.createRecursivePackageClassFilter("java");
- CombiningClassFilter filter = CombiningClassFilter.create(javaFilter,
systemFilter);
+ ClassFilter systemFilter =
PackageClassFilter.createPackageClassFilterFromString(getSystemPackagesAsString());
+ ClassFilter filter = CombiningClassFilter.create(getClassLoaderDomainFilter(),
systemFilter);
// Setup the domain's parent policy
setParentPolicy(new ParentPolicy(filter, ClassFilterUtils.NOTHING));
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderSystem.java
===================================================================
---
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderSystem.java 2010-02-02
05:00:14 UTC (rev 100233)
+++
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderSystem.java 2010-02-02
05:01:18 UTC (rev 100234)
@@ -21,15 +21,15 @@
*/
package org.jboss.osgi.framework.classloading;
-import org.jboss.classloader.plugins.filter.PatternClassFilter;
+
import org.jboss.classloader.plugins.jdk.AbstractJDKChecker;
import org.jboss.classloader.spi.ClassLoaderDomain;
import org.jboss.classloader.spi.ClassLoaderPolicy;
import org.jboss.classloader.spi.ClassLoaderSystem;
import org.jboss.classloader.spi.ParentPolicy;
import org.jboss.classloader.spi.base.BaseClassLoader;
+import org.jboss.classloader.spi.filter.ClassFilter;
import org.jboss.classloader.spi.filter.ClassFilterUtils;
-import org.jboss.classloader.spi.filter.RecursivePackageClassFilter;
import org.jboss.osgi.framework.bundle.AbstractBundleState;
import org.jboss.osgi.framework.bundle.OSGiBundleState;
@@ -49,8 +49,8 @@
{
ClassLoaderDomain domain = getDefaultDomain();
- PatternClassFilter javaFilter =
RecursivePackageClassFilter.createRecursivePackageClassFilter("java");
- domain.setParentPolicy(new ParentPolicy(javaFilter, ClassFilterUtils.NOTHING));
+ ClassFilter domainFilter = OSGiClassLoaderDomain.getClassLoaderDomainFilter();
+ domain.setParentPolicy(new ParentPolicy(domainFilter, ClassFilterUtils.NOTHING));
AbstractJDKChecker.getExcluded().add(AbstractBundleState.class);
AbstractJDKChecker.getExcluded().add(OSGiBundleState.class);
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/internal/SystemPackagesPluginImpl.java
===================================================================
---
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/internal/SystemPackagesPluginImpl.java 2010-02-02
05:00:14 UTC (rev 100233)
+++
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/plugins/internal/SystemPackagesPluginImpl.java 2010-02-02
05:01:18 UTC (rev 100234)
@@ -92,16 +92,6 @@
allPackages.add("org.jboss.virtual");
- allPackages.add("org.osgi.framework");
- allPackages.add("org.osgi.framework.hooks");
- allPackages.add("org.osgi.framework.hooks.service");
- allPackages.add("org.osgi.framework.launch");
- allPackages.add("org.osgi.service.condpermadmin");
- allPackages.add("org.osgi.service.packageadmin");
- allPackages.add("org.osgi.service.permissionadmin");
- allPackages.add("org.osgi.service.startlevel");
- allPackages.add("org.osgi.service.url");
-
allPackages.add("org.w3c.dom");
allPackages.add("org.w3c.dom.bootstrap");
allPackages.add("org.w3c.dom.ls");