Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2015-12-04 16:46:12 +0000
committerThomas Watson2015-12-04 16:46:12 +0000
commit0f8805c61ad64f8af27d5c5dee050460726b2f94 (patch)
tree30f2b7de3c516117f97e9e49dbba534bf74ee014 /bundles
parent18ce78ca78bcf8239b3325c850e75de5d32353d5 (diff)
downloadrt.equinox.framework-0f8805c61ad64f8af27d5c5dee050460726b2f94.tar.gz
rt.equinox.framework-0f8805c61ad64f8af27d5c5dee050460726b2f94.tar.xz
rt.equinox.framework-0f8805c61ad64f8af27d5c5dee050460726b2f94.zip
Bug 483665 - Bundle.getHeader("Export-Package) implementation returnsI20151207-0800I20151206-2000
system.packages.extra list as well as manifest value
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java32
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxBundle.java11
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxConfiguration.java2
3 files changed, 41 insertions, 4 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 eeadf323e..cacd202e6 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
@@ -2513,6 +2513,38 @@ public class SystemBundleTests extends AbstractBundleTests {
equinox.stop();
}
+ public void testExtraSystemBundleHeaders() throws BundleException, InterruptedException {
+ File config = OSGiTestsActivator.getContext().getDataFile(getName());
+ 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");
+
+ 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.extra"));
+ assertTrue("Unexpected Export-Package header: " + exportPackage, exportPackage.contains("some.extra.pkg"));
+ equinox.stop();
+
+ equinox.waitForStop(5000);
+
+ configuration.put(EquinoxConfiguration.PROP_SYSTEM_ORIGINAL_HEADERS, "true");
+ 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.extra"));
+ assertFalse("Unexpected Export-Package header: " + exportPackage, exportPackage.contains("some.extra.pkg"));
+ equinox.stop();
+
+ equinox.waitForStop(5000);
+ }
+
private static File[] createBundles(File outputDir, int bundleCount) throws IOException {
outputDir.mkdirs();
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 39dd41208..8d6d2b15a 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,10 +60,13 @@ public class EquinoxBundle implements Bundle, BundleReference {
public String get(Object key) {
if (!(key instanceof String))
return null;
- 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);
+ 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);
+ }
}
return headers.get(key);
}
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 f8fb4ec04..8e1ff6142 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,6 +196,8 @@ 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_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