diff options
Diffstat (limited to 'bundles')
7 files changed, 68 insertions, 21 deletions
diff --git a/bundles/org.eclipse.osgi/CDC-1.0_Foundation-1.0.profile b/bundles/org.eclipse.osgi/CDC-1.0_Foundation-1.0.profile index c77a5027f..0ba6b43ea 100644 --- a/bundles/org.eclipse.osgi/CDC-1.0_Foundation-1.0.profile +++ b/bundles/org.eclipse.osgi/CDC-1.0_Foundation-1.0.profile @@ -10,3 +10,5 @@ ############################################################################### org.osgi.framework.system.packages = \ javax.microedition.io +org.osgi.framework.bootdelegation = \ + javax.microedition.io diff --git a/bundles/org.eclipse.osgi/J2SE-1.3.profile b/bundles/org.eclipse.osgi/J2SE-1.3.profile index de9ed2795..4615644ab 100644 --- a/bundles/org.eclipse.osgi/J2SE-1.3.profile +++ b/bundles/org.eclipse.osgi/J2SE-1.3.profile @@ -49,3 +49,8 @@ org.osgi.framework.system.packages = \ org.omg.CosNaming.NamingContextPackage,\ org.omg.SendingContext,\ org.omg.stub.java.rmi +org.osgi.framework.bootdelegation = \ + javax.,\ + org.omg.,\ + sun.,\ + com.sun diff --git a/bundles/org.eclipse.osgi/J2SE-1.4.profile b/bundles/org.eclipse.osgi/J2SE-1.4.profile index 500b35900..eb8de5a9e 100644 --- a/bundles/org.eclipse.osgi/J2SE-1.4.profile +++ b/bundles/org.eclipse.osgi/J2SE-1.4.profile @@ -100,3 +100,11 @@ org.osgi.framework.system.packages = \ org.xml.sax,\ org.xml.sax.ext,\ org.xml.sax.helpers +org.osgi.framework.bootdelegation = \ + javax.,\ + org.ietf,\ + org.omg.,\ + org.w3c.,\ + org.xml.,\ + sun.,\ + com.sun diff --git a/bundles/org.eclipse.osgi/J2SE-1.5.profile b/bundles/org.eclipse.osgi/J2SE-1.5.profile index e6b066b7e..0664b4447 100644 --- a/bundles/org.eclipse.osgi/J2SE-1.5.profile +++ b/bundles/org.eclipse.osgi/J2SE-1.5.profile @@ -125,3 +125,11 @@ org.osgi.framework.system.packages = \ org.xml.sax,\ org.xml.sax.ext,\ org.xml.sax.helpers +org.osgi.framework.bootdelegation = \ + javax.,\ + org.ietf,\ + org.omg.,\ + org.w3c.,\ + org.xml.,\ + sun.,\ + com.sun diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Constants.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Constants.java index 89580da18..54d91e8d8 100644 --- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Constants.java +++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Constants.java @@ -113,6 +113,17 @@ public class Constants implements org.osgi.framework.Constants { public static final String OSGI_IMPL_VERSION_KEY = "osgi.framework.version"; //$NON-NLS-1$ /** OSGi java profile; used to give a URL to a java profile */ public static final String OSGI_JAVA_PROFILE = "osgi.java.profile"; //$NON-NLS-1$ + /** + * OSGi java profile bootdelegation; used to indicate how the org.osgi.framework.bootdelegation + * property defined in the java profile should be processed, (ingnore, override, none). default is ignore + */ + public static final String OSGI_JAVA_PROFILE_BOOTDELEGATION = "osgi.java.profile.bootdelegation"; //$NON-NLS-1$ + /** indicates that the org.osgi.framework.bootdelegation in the java profile should be ingored */ + public static final String OSGI_BOOTDELEGATION_IGNORE = "ignore"; //$NON-NLS-1$ + /** indicates that the org.osgi.framework.bootdelegation in the java profile should override the system property */ + public static final String OSGI_BOOTDELEGATION_OVERRIDE = "override"; //$NON-NLS-1$ + /** indicates that the org.osgi.framework.bootdelegation in the java profile AND the system properties should be ignored */ + public static final String OSGI_BOOTDELEGATION_NONE = "none"; //$NON-NLS-1$ /** OSGi strict delegation **/ public static final String OSGI_RESOLVER_MODE = "osgi.resolverMode"; //$NON-NLS-1$ public static final String STRICT_MODE = "strict"; //$NON-NLS-1$ diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Framework.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Framework.java index f4cef3ac4..b542d329a 100644 --- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Framework.java +++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Framework.java @@ -176,6 +176,8 @@ public class Framework implements EventDispatcher, EventPublisher { installLock = new Hashtable(10); /* create the system bundle */ createSystemBundle(); + loadVMProfile(); // load VM profile after the system bundle has been created + setBootDelegation(); //set boot delegation property after system exports have been set if (Profile.PROFILE && Profile.STARTUP) Profile.logTime("Framework.initialze()", "done createSystemBundle"); //$NON-NLS-1$ //$NON-NLS-2$ /* install URLStreamHandlerFactory */ @@ -213,7 +215,6 @@ public class Framework implements EventDispatcher, EventPublisher { e.printStackTrace(); throw new RuntimeException(NLS.bind(Msg.OSGI_SYSTEMBUNDLE_CREATE_EXCEPTION, e.getMessage())); } - setSystemExports(); } /** @@ -294,7 +295,6 @@ public class Framework implements EventDispatcher, EventPublisher { } } setExecutionEnvironment(); - setBootDelegation(); } private void setExecutionEnvironment() { @@ -338,8 +338,6 @@ public class Framework implements EventDispatcher, EventPublisher { } private void setBootDelegation() { - // TODO see bug 87780. for now always delegate to the boot loader. - bootDelegateAll = true; String bootDelegationProp = properties.getProperty(Constants.OSGI_BOOTDELEGATION); if (bootDelegationProp == null) return; @@ -352,28 +350,39 @@ public class Framework implements EventDispatcher, EventPublisher { bootDelegateAll = true; } - private void setSystemExports() { - String systemExports = properties.getProperty(Constants.OSGI_FRAMEWORK_SYSTEM_PACKAGES); - if (systemExports != null) - return; + private void loadVMProfile() { InputStream in = findVMProfile(); - if (in == null) - return; - Properties vmPackages = new Properties(); - try { - vmPackages.load(new BufferedInputStream(in)); - } catch (IOException e) { - // do nothing - } finally { + Properties profileProps = new Properties(); + if (in != null) { try { - in.close(); - } catch (IOException ee) { + profileProps.load(new BufferedInputStream(in)); + } catch (IOException e) { // do nothing + } finally { + try { + in.close(); + } catch (IOException ee) { + // do nothing + } } } - systemExports = vmPackages.getProperty(Constants.OSGI_FRAMEWORK_SYSTEM_PACKAGES); - if (systemExports != null) - properties.put(Constants.OSGI_FRAMEWORK_SYSTEM_PACKAGES, systemExports); + String systemExports = properties.getProperty(Constants.OSGI_FRAMEWORK_SYSTEM_PACKAGES); + // set the system exports property using the vm profile; only if the property is not already set + if (systemExports == null) { + systemExports = profileProps.getProperty(Constants.OSGI_FRAMEWORK_SYSTEM_PACKAGES); + if (systemExports != null) + properties.put(Constants.OSGI_FRAMEWORK_SYSTEM_PACKAGES, systemExports); + } + // set the org.osgi.framework.bootdelegation property according to the java profile + String type = properties.getProperty(Constants.OSGI_JAVA_PROFILE_BOOTDELEGATION); // a null value means ignore + String profileBootDelegation = profileProps.getProperty(Constants.OSGI_BOOTDELEGATION); + if (Constants.OSGI_BOOTDELEGATION_OVERRIDE.equals(type)) { + if (profileBootDelegation == null) + properties.remove(Constants.OSGI_BOOTDELEGATION); // override with a null value + else + properties.put(Constants.OSGI_BOOTDELEGATION, profileBootDelegation); // override with the profile value + } else if (Constants.OSGI_BOOTDELEGATION_NONE.equals(type)) + properties.remove(Constants.OSGI_BOOTDELEGATION); // remove the bootdelegation property in case it was set } private InputStream findVMProfile() { diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseAdaptor.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseAdaptor.java index 94e9a9a5c..1fa108529 100644 --- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseAdaptor.java +++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseAdaptor.java @@ -125,6 +125,10 @@ public class EclipseAdaptor extends AbstractFrameworkAdaptor { fileManager = initFileManager(LocationManager.getOSGiConfigurationDir(), readOnlyConfiguration ? "none" : null, readOnlyConfiguration); //$NON-NLS-1$ readHeaders(); super.initialize(publisher); + // default the bootdelegation to all packages + if (System.getProperty(Constants.OSGI_BOOTDELEGATION) == null && !Constants.OSGI_BOOTDELEGATION_NONE.equals(System.getProperty(Constants.OSGI_JAVA_PROFILE_BOOTDELEGATION))) + System.getProperties().put(Constants.OSGI_BOOTDELEGATION, ""); //$NON-NLS-1$ + } public void initializeMetadata() { |