Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java44
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxBundle.java21
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxConfiguration.java5
3 files changed, 55 insertions, 15 deletions
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java
index cacd202e6..f0b4aaa71 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java
@@ -2518,28 +2518,62 @@ public class SystemBundleTests extends AbstractBundleTests {
config.mkdirs();
Map<String, Object> configuration = new HashMap<String, Object>();
configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath());
- configuration.put(Constants.FRAMEWORK_SYSTEMCAPABILITIES_EXTRA, "something.extra; attr1=value2");
- configuration.put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, "some.extra.pkg");
+ configuration.put(Constants.FRAMEWORK_SYSTEMCAPABILITIES, "osgi.ee; osgi.ee=JavaSE; version:Version=1.6, something.system");
+ configuration.put(Constants.FRAMEWORK_SYSTEMPACKAGES, "something.system");
+ configuration.put(Constants.FRAMEWORK_SYSTEMCAPABILITIES_EXTRA, "something.extra");
+ configuration.put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, "something.extra");
Equinox equinox = new Equinox(configuration);
equinox.start();
Dictionary<String, String> headers = equinox.getHeaders();
String provideCapability = headers.get(Constants.PROVIDE_CAPABILITY);
String exportPackage = headers.get(Constants.EXPORT_PACKAGE);
+ assertTrue("Unexpected Provide-Capability header: " + provideCapability, provideCapability.contains("something.system"));
+ assertTrue("Unexpected Export-Package header: " + exportPackage, exportPackage.contains("something.system"));
assertTrue("Unexpected Provide-Capability header: " + provideCapability, provideCapability.contains("something.extra"));
- assertTrue("Unexpected Export-Package header: " + exportPackage, exportPackage.contains("some.extra.pkg"));
+ assertTrue("Unexpected Export-Package header: " + exportPackage, exportPackage.contains("something.extra"));
equinox.stop();
equinox.waitForStop(5000);
- configuration.put(EquinoxConfiguration.PROP_SYSTEM_ORIGINAL_HEADERS, "true");
+ configuration.put(EquinoxConfiguration.PROP_SYSTEM_PROVIDE_HEADER, EquinoxConfiguration.SYSTEM_PROVIDE_HEADER_ORIGINAL);
equinox = new Equinox(configuration);
equinox.start();
headers = equinox.getHeaders();
provideCapability = headers.get(Constants.PROVIDE_CAPABILITY);
exportPackage = headers.get(Constants.EXPORT_PACKAGE);
+ assertFalse("Unexpected Provide-Capability header: " + provideCapability, provideCapability.contains("something.system"));
+ assertFalse("Unexpected Export-Package header: " + exportPackage, exportPackage.contains("something.system"));
assertFalse("Unexpected Provide-Capability header: " + provideCapability, provideCapability.contains("something.extra"));
- assertFalse("Unexpected Export-Package header: " + exportPackage, exportPackage.contains("some.extra.pkg"));
+ assertFalse("Unexpected Export-Package header: " + exportPackage, exportPackage.contains("something.extra"));
+ equinox.stop();
+
+ equinox.waitForStop(5000);
+
+ configuration.put(EquinoxConfiguration.PROP_SYSTEM_PROVIDE_HEADER, EquinoxConfiguration.SYSTEM_PROVIDE_HEADER_SYSTEM);
+ equinox = new Equinox(configuration);
+ equinox.start();
+ headers = equinox.getHeaders();
+ provideCapability = headers.get(Constants.PROVIDE_CAPABILITY);
+ exportPackage = headers.get(Constants.EXPORT_PACKAGE);
+ assertTrue("Unexpected Provide-Capability header: " + provideCapability, provideCapability.contains("something.system"));
+ assertTrue("Unexpected Export-Package header: " + exportPackage, exportPackage.contains("something.system"));
+ assertFalse("Unexpected Provide-Capability header: " + provideCapability, provideCapability.contains("something.extra"));
+ assertFalse("Unexpected Export-Package header: " + exportPackage, exportPackage.contains("something.extra"));
+ equinox.stop();
+
+ equinox.waitForStop(5000);
+
+ configuration.put(EquinoxConfiguration.PROP_SYSTEM_PROVIDE_HEADER, EquinoxConfiguration.SYSTEM_PROVIDE_HEADER_SYSTEM_EXTRA);
+ equinox = new Equinox(configuration);
+ equinox.start();
+ headers = equinox.getHeaders();
+ provideCapability = headers.get(Constants.PROVIDE_CAPABILITY);
+ exportPackage = headers.get(Constants.EXPORT_PACKAGE);
+ assertTrue("Unexpected Provide-Capability header: " + provideCapability, provideCapability.contains("something.system"));
+ assertTrue("Unexpected Export-Package header: " + exportPackage, exportPackage.contains("something.system"));
+ assertTrue("Unexpected Provide-Capability header: " + provideCapability, provideCapability.contains("something.extra"));
+ assertTrue("Unexpected Export-Package header: " + exportPackage, exportPackage.contains("something.extra"));
equinox.stop();
equinox.waitForStop(5000);
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxBundle.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxBundle.java
index 8d6d2b15a..91ded445d 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxBundle.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxBundle.java
@@ -60,20 +60,23 @@ public class EquinoxBundle implements Bundle, BundleReference {
public String get(Object key) {
if (!(key instanceof String))
return null;
- if (!Boolean.valueOf(getEquinoxContainer().getConfiguration().getConfiguration(EquinoxConfiguration.PROP_SYSTEM_ORIGINAL_HEADERS, "false"))) { //$NON-NLS-1$
- // by default we append the extra capabilities to the Export-Package and Provide-Capability headers
- if (org.osgi.framework.Constants.EXPORT_PACKAGE.equalsIgnoreCase((String) key)) {
- return getExtra(org.osgi.framework.Constants.EXPORT_PACKAGE, org.osgi.framework.Constants.FRAMEWORK_SYSTEMPACKAGES, org.osgi.framework.Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA);
- } else if (org.osgi.framework.Constants.PROVIDE_CAPABILITY.equalsIgnoreCase((String) key)) {
- return getExtra(org.osgi.framework.Constants.PROVIDE_CAPABILITY, org.osgi.framework.Constants.FRAMEWORK_SYSTEMCAPABILITIES, org.osgi.framework.Constants.FRAMEWORK_SYSTEMCAPABILITIES_EXTRA);
- }
+
+ String sKey = (String) key;
+ if (Constants.EXPORT_PACKAGE.equalsIgnoreCase(sKey) || Constants.PROVIDE_CAPABILITY.equalsIgnoreCase(sKey)) {
+ String systemProvideHeader = getEquinoxContainer().getConfiguration().getConfiguration(EquinoxConfiguration.PROP_SYSTEM_PROVIDE_HEADER, EquinoxConfiguration.SYSTEM_PROVIDE_HEADER_SYSTEM_EXTRA);
+ boolean useSystemExtra = systemProvideHeader.equals(EquinoxConfiguration.SYSTEM_PROVIDE_HEADER_SYSTEM_EXTRA);
+ boolean useSystem = systemProvideHeader.equals(EquinoxConfiguration.SYSTEM_PROVIDE_HEADER_SYSTEM) || useSystemExtra;
+ String systemProp = useSystem ? (Constants.EXPORT_PACKAGE.equalsIgnoreCase(sKey) ? Constants.FRAMEWORK_SYSTEMPACKAGES : Constants.FRAMEWORK_SYSTEMCAPABILITIES) : null;
+ String systemExtraProp = useSystemExtra ? (Constants.EXPORT_PACKAGE.equalsIgnoreCase(sKey) ? Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA : Constants.FRAMEWORK_SYSTEMCAPABILITIES_EXTRA) : null;
+ return getExtra(sKey, systemProp, systemExtraProp);
}
+
return headers.get(key);
}
private String getExtra(String header, String systemProp, String systemExtraProp) {
- String systemValue = getEquinoxContainer().getConfiguration().getConfiguration(systemProp);
- String systemExtraValue = getEquinoxContainer().getConfiguration().getConfiguration(systemExtraProp);
+ String systemValue = systemProp != null ? getEquinoxContainer().getConfiguration().getConfiguration(systemProp) : null;
+ String systemExtraValue = systemExtraProp != null ? getEquinoxContainer().getConfiguration().getConfiguration(systemExtraProp) : null;
if (systemValue == null)
systemValue = systemExtraValue;
else if (systemExtraValue != null && systemExtraValue.trim().length() > 0)
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxConfiguration.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxConfiguration.java
index 8e1ff6142..33bfcd6e6 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxConfiguration.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxConfiguration.java
@@ -196,7 +196,10 @@ public class EquinoxConfiguration implements EnvironmentInfo {
public static final String PROP_RESOLVER_REVISION_BATCH_SIZE = "equinox.resolver.revision.batch.size"; //$NON-NLS-1$
- public static final String PROP_SYSTEM_ORIGINAL_HEADERS = "equinox.system.bundle.headers.original"; //$NON-NLS-1$
+ public static final String PROP_SYSTEM_PROVIDE_HEADER = "equinox.system.provide.header"; //$NON-NLS-1$
+ public static final String SYSTEM_PROVIDE_HEADER_ORIGINAL = "original"; //$NON-NLS-1$
+ public static final String SYSTEM_PROVIDE_HEADER_SYSTEM = "system"; //$NON-NLS-1$
+ public static final String SYSTEM_PROVIDE_HEADER_SYSTEM_EXTRA = "system.extra"; //$NON-NLS-1$
public static final String PROP_DEFAULT_SUFFIX = ".default"; //$NON-NLS-1$
public static final Collection<String> PROP_WITH_ECLIPSE_STARTER_DEFAULTS = Collections.singletonList(PROP_COMPATIBILITY_BOOTDELEGATION);

Back to the top