[jboss-dev-forums] [JBoss OSGi Development] - OSGi classloader system
thomas.diesler@jboss.com
do-not-reply at jboss.com
Thu Aug 27 04:51:03 EDT 2009
Folks,
I'd like to better understand how the classloader system works. Could you please talk me through the code below and explain what is being done here.
Eventually, I'd like to be able to setup a Framework Classloader with the configured packages in 'org.osgi.framework.system.packages' and 'org.osgi.framework.system.packages.extra'
| /**
| * Create a new OSGiClassLoaderSystem.
| * @param bundleManager the bundleManager
| * @throws IllegalArgumentException for a null bundle manager
| */
| public OSGiClassLoaderSystem(OSGiBundleManager bundleManager)
| {
| if (bundleManager == null)
| throw new IllegalArgumentException("Null bundle manager");
|
| ClassLoaderDomain domain = getDefaultDomain();
|
| // Initialize the configured system packages
| String sysPackageString = getSystemPackagesAsString(bundleManager);
| PatternClassFilter filter = PackageClassFilter.createPackageClassFilterFromString(sysPackageString);
| filter.setIncludeJava(true);
|
| domain.setParentPolicy(new ParentPolicy(filter, ClassFilter.NOTHING));
| AbstractJDKChecker.getExcluded().add(AbstractBundleState.class);
| AbstractJDKChecker.getExcluded().add(OSGiBundleState.class);
| }
|
| @Override
| protected ClassLoaderDomain createDomain(String name)
| {
| return new ClassLoaderDomain(name);
| }
|
| protected BaseClassLoader createClassLoader(ClassLoaderPolicy policy)
| {
| return new OSGiBundleClassLoader(policy);
| }
|
when done, I could probably remove this hack
| // [TODO] Should system packages be added as capabilities?
| boolean isSystemPackage = syspackPlugin.isSystemPackage(packageName);
| if (isSystemPackage == false)
| {
| OSGiPackageRequirement requirement = OSGiPackageRequirement.create(packageAttribute);
| requirements.addRequirement(requirement);
| }
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4251995#4251995
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4251995
More information about the jboss-dev-forums
mailing list