Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2009-05-05 10:25:39 -0400
committerThomas Watson2009-05-05 10:25:39 -0400
commit0c7e49ef89e93a56b0b6f33e10a6b07db5cef87b (patch)
tree8bc17147c4472766b4331c5b7df2a30ec0496123 /bundles/org.eclipse.osgi/resolver
parentb7eb6ab4ca13c07490240689611a4d50e016a7ec (diff)
downloadrt.equinox.framework-0c7e49ef89e93a56b0b6f33e10a6b07db5cef87b.tar.gz
rt.equinox.framework-0c7e49ef89e93a56b0b6f33e10a6b07db5cef87b.tar.xz
rt.equinox.framework-0c7e49ef89e93a56b0b6f33e10a6b07db5cef87b.zip
Bug 274908 Add an option to allow multiple host fragments
Diffstat (limited to 'bundles/org.eclipse.osgi/resolver')
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java19
1 files changed, 13 insertions, 6 deletions
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java
index 14af31833..4ad1f6883 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2008 IBM Corporation and others.
+ * Copyright (c) 2003, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -88,7 +88,7 @@ class StateBuilder {
result.setExecutionEnvironments(ManifestElement.getArrayFromList((String) manifest.get(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT)));
ManifestElement[] host = ManifestElement.parseHeader(Constants.FRAGMENT_HOST, (String) manifest.get(Constants.FRAGMENT_HOST));
if (host != null)
- result.setHost(createHostSpecification(host[0]));
+ result.setHost(createHostSpecification(host[0], state));
ManifestElement[] exports = ManifestElement.parseHeader(Constants.EXPORT_PACKAGE, (String) manifest.get(Constants.EXPORT_PACKAGE));
ManifestElement[] provides = ManifestElement.parseHeader(Constants.PROVIDE_PACKAGE, (String) manifest.get(Constants.PROVIDE_PACKAGE)); // TODO this is null for now until the framwork is updated to handle the new re-export semantics
boolean strict = state != null && state.inStrictMode();
@@ -167,8 +167,7 @@ class StateBuilder {
}
private static String[][] getGenericAliases(StateImpl state) {
- Dictionary[] platformProps = state == null ? null : state.getPlatformProperties();
- String genericAliasesProp = platformProps == null || platformProps.length == 0 ? null : (String) platformProps[0].get("osgi.genericAliases"); //$NON-NLS-1$
+ String genericAliasesProp = getPlatformProperty(state, "osgi.genericAliases"); //$NON-NLS-1$
if (genericAliasesProp == null)
return new String[0][0];
String[] aliases = ManifestElement.getArrayFromList(genericAliasesProp, ","); //$NON-NLS-1$
@@ -178,6 +177,11 @@ class StateBuilder {
return result;
}
+ private static String getPlatformProperty(StateImpl state, String key) {
+ Dictionary[] platformProps = state == null ? null : state.getPlatformProperties();
+ return platformProps == null || platformProps.length == 0 ? null : (String) platformProps[0].get(key);
+ }
+
private static void validateHeaders(Dictionary manifest, boolean jreBundle) throws BundleException {
for (int i = 0; i < DEFINED_OSGI_VALIDATE_HEADERS.length; i++) {
String header = (String) manifest.get(DEFINED_OSGI_VALIDATE_HEADERS[i]);
@@ -396,13 +400,16 @@ class StateBuilder {
return arbitraryAttrs;
}
- private static HostSpecification createHostSpecification(ManifestElement spec) {
+ private static HostSpecification createHostSpecification(ManifestElement spec, StateImpl state) {
if (spec == null)
return null;
HostSpecificationImpl result = new HostSpecificationImpl();
result.setName(spec.getValue());
result.setVersionRange(getVersionRange(spec.getAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE)));
- result.setIsMultiHost("true".equals(spec.getDirective("multiple-hosts"))); //$NON-NLS-1$ //$NON-NLS-2$
+ String multiple = spec.getDirective("multiple-hosts"); //$NON-NLS-1$
+ if (multiple == null)
+ multiple = getPlatformProperty(state, "osgi.support.multipleHosts"); //$NON-NLS-1$
+ result.setIsMultiHost("true".equals(multiple)); //$NON-NLS-1$
return result;
}

Back to the top