Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2008-02-12 09:35:49 -0500
committerThomas Watson2008-02-12 09:35:49 -0500
commiteb54dfb7672451f66f32166a0cf5643aef2d6586 (patch)
tree7f6c69109222bf0b184549c7b200cfedb5c3b0e5 /bundles/org.eclipse.osgi/resolver
parent02ccc612b52ab2872bceafd1f34ad03c1423c1f8 (diff)
downloadrt.equinox.framework-eb54dfb7672451f66f32166a0cf5643aef2d6586.tar.gz
rt.equinox.framework-eb54dfb7672451f66f32166a0cf5643aef2d6586.tar.xz
rt.equinox.framework-eb54dfb7672451f66f32166a0cf5643aef2d6586.zip
Bug 218625 [resolver] support for other system.bundle vendors
Diffstat (limited to 'bundles/org.eclipse.osgi/resolver')
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java12
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/VersionHashMap.java5
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java8
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/ImportPackageSpecificationImpl.java16
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java3
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java25
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/VersionConstraintImpl.java6
7 files changed, 47 insertions, 28 deletions
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java
index 217a7351d..a5d212812 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java
@@ -13,6 +13,7 @@ import java.util.*;
import org.eclipse.osgi.framework.adaptor.FrameworkAdaptor;
import org.eclipse.osgi.framework.debug.Debug;
import org.eclipse.osgi.framework.debug.FrameworkDebugOptions;
+import org.eclipse.osgi.framework.internal.core.Constants;
import org.eclipse.osgi.framework.util.SecureAction;
import org.eclipse.osgi.internal.module.GroupingChecker.PackageRoots;
import org.eclipse.osgi.internal.resolver.BundleDescriptionImpl;
@@ -363,6 +364,7 @@ public class ResolverImpl implements org.eclipse.osgi.service.resolver.Resolver
if (!initialized)
initialize();
+ // set developmentMode each resolution
developmentMode = platformProperties.length == 0 ? false : org.eclipse.osgi.framework.internal.core.Constants.DEVELOPMENT_MODE.equals(platformProperties[0].get(org.eclipse.osgi.framework.internal.core.Constants.OSGI_RESOLVER_MODE));
reRefresh = addDevConstraints(reRefresh);
// Unresolve all the supplied bundles and their dependents
@@ -802,7 +804,7 @@ public class ResolverImpl implements org.eclipse.osgi.service.resolver.Resolver
Integer ee = (Integer) ((ResolverExport) suppliers[suppliersIndex]).getExportPackageDescription().getDirective(ExportPackageDescriptionImpl.EQUINOX_EE);
if (ee.intValue() >= 0)
continue;
- if (((ResolverExport) suppliers[suppliersIndex]).getExporter().getRequire(FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME) == null)
+ if (((ResolverExport) suppliers[suppliersIndex]).getExporter().getRequire(getSystemBundle()) == null)
if (((ResolverExport) suppliers[suppliersIndex]).getExporter().getRequire(Constants.SYSTEM_BUNDLE_SYMBOLICNAME) == null) {
multipleImportSupplierList.add(imports[j]);
break;
@@ -851,6 +853,14 @@ public class ResolverImpl implements org.eclipse.osgi.service.resolver.Resolver
return (ResolverConstraint[][]) results.toArray(new ResolverConstraint[results.size()][]);
}
+ String getSystemBundle() {
+ Dictionary[] platformProperties = state.getPlatformProperties();
+ String systemBundle = (String) (platformProperties.length == 0 ? null : platformProperties[0].get(Constants.STATE_SYSTEM_BUNDLE));
+ if (systemBundle == null)
+ systemBundle = Constants.getInternalSymbolicName();
+ return systemBundle;
+ }
+
private void addMergedSuppliers(ArrayList mergedSuppliers, HashMap constraints) {
for (Iterator iConstraints = constraints.values().iterator(); iConstraints.hasNext();) {
ArrayList mergedConstraintLists = (ArrayList) iConstraints.next();
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/VersionHashMap.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/VersionHashMap.java
index 7e457f8a4..f465e76b6 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/VersionHashMap.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/VersionHashMap.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 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
@@ -11,10 +11,8 @@
package org.eclipse.osgi.internal.module;
import java.util.*;
-import org.eclipse.osgi.framework.internal.core.Constants;
public class VersionHashMap extends MappedList implements Comparator {
- private final String systemBundle = Constants.getInternalSymbolicName();
private ResolverImpl resolver;
public VersionHashMap(ResolverImpl resolver) {
@@ -103,6 +101,7 @@ public class VersionHashMap extends MappedList implements Comparator {
// if the selection policy is set then use that
if (resolver.getSelectionPolicy() != null)
return resolver.getSelectionPolicy().compare(vs1.getBaseDescription(), vs2.getBaseDescription());
+ String systemBundle = resolver.getSystemBundle();
if (systemBundle.equals(vs1.getBundle().getSymbolicName()) && !systemBundle.equals(vs2.getBundle().getSymbolicName()))
return -1;
else if (!systemBundle.equals(vs1.getBundle().getSymbolicName()) && systemBundle.equals(vs2.getBundle().getSymbolicName()))
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java
index 35383922e..4c4bc87db 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 2008 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
@@ -223,8 +223,6 @@ public class BundleDescriptionImpl extends BaseDescriptionImpl implements Bundle
lazyData.importPackages = importPackages;
if (importPackages != null) {
for (int i = 0; i < importPackages.length; i++) {
- if (Constants.OSGI_SYSTEM_BUNDLE.equals(importPackages[i].getBundleSymbolicName()))
- ((ImportPackageSpecificationImpl) importPackages[i]).setBundleSymbolicName(Constants.getInternalSymbolicName());
((ImportPackageSpecificationImpl) importPackages[i]).setBundle(this);
if (ImportPackageSpecification.RESOLUTION_DYNAMIC.equals(importPackages[i].getDirective(Constants.RESOLUTION_DIRECTIVE)))
stateBits |= HAS_DYNAMICIMPORT;
@@ -237,8 +235,6 @@ public class BundleDescriptionImpl extends BaseDescriptionImpl implements Bundle
lazyData.requiredBundles = requiredBundles;
if (requiredBundles != null)
for (int i = 0; i < requiredBundles.length; i++) {
- if (Constants.OSGI_SYSTEM_BUNDLE.equals(requiredBundles[i].getName()))
- ((VersionConstraintImpl) requiredBundles[i]).setName(Constants.getInternalSymbolicName());
((VersionConstraintImpl) requiredBundles[i]).setBundle(this);
}
}
@@ -298,8 +294,6 @@ public class BundleDescriptionImpl extends BaseDescriptionImpl implements Bundle
protected void setHost(HostSpecification host) {
this.host = host;
if (host != null) {
- if (Constants.OSGI_SYSTEM_BUNDLE.equals(host.getName()))
- ((VersionConstraintImpl) host).setName(Constants.getInternalSymbolicName());
((VersionConstraintImpl) host).setBundle(this);
}
}
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/ImportPackageSpecificationImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/ImportPackageSpecificationImpl.java
index 63a7c855f..cce84e0b6 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/ImportPackageSpecificationImpl.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/ImportPackageSpecificationImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
+ * Copyright (c) 2003, 2008 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
@@ -46,6 +46,8 @@ public class ImportPackageSpecificationImpl extends VersionConstraintImpl implem
}
public String getBundleSymbolicName() {
+ if (Constants.SYSTEM_BUNDLE_SYMBOLICNAME.equals(symbolicName))
+ return ((StateImpl) getBundle().getContainingState()).getSystemBundle();
return symbolicName;
}
@@ -82,10 +84,10 @@ public class ImportPackageSpecificationImpl extends VersionConstraintImpl implem
return false;
}
}
-
- if (symbolicName != null) {
+ String exporterSymbolicName = getBundleSymbolicName();
+ if (exporterSymbolicName != null) {
BundleDescription exporter = pkgDes.getExporter();
- if (!symbolicName.equals(exporter.getSymbolicName()))
+ if (!exporterSymbolicName.equals(exporter.getSymbolicName()))
return false;
if (getBundleVersionRange() != null && !getBundleVersionRange().isIncluded(exporter.getVersion()))
return false;
@@ -116,7 +118,7 @@ public class ImportPackageSpecificationImpl extends VersionConstraintImpl implem
if (mandatory != null) {
for (int i = 0; i < mandatory.length; i++) {
if (Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE.equals(mandatory[i])) {
- if (symbolicName == null)
+ if (exporterSymbolicName == null)
return false;
} else if (Constants.BUNDLE_VERSION_ATTRIBUTE.equals(mandatory[i])) {
if (bundleVersionRange == null)
@@ -133,10 +135,10 @@ public class ImportPackageSpecificationImpl extends VersionConstraintImpl implem
}
}
// finally check the ee index
- if (((BundleDescriptionImpl)getBundle()).getEquinoxEE() < 0)
+ if (((BundleDescriptionImpl) getBundle()).getEquinoxEE() < 0)
return true;
int eeIndex = ((Integer) pkgDes.getDirective(ExportPackageDescriptionImpl.EQUINOX_EE)).intValue();
- return eeIndex < 0 || eeIndex == ((BundleDescriptionImpl)getBundle()).getEquinoxEE();
+ return eeIndex < 0 || eeIndex == ((BundleDescriptionImpl) getBundle()).getEquinoxEE();
}
protected void setBundleSymbolicName(String symbolicName) {
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 ced98ad13..1581c709e 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, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 2008 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
@@ -586,6 +586,7 @@ class StateBuilder {
if (elements.length == 0 || elements[0].getDirective(Constants.EXTENSION_DIRECTIVE) == null)
return;
String hostName = elements[0].getValue();
+ // XXX: The extension bundle check is done against system.bundle and org.eclipse.osgi
if (!hostName.equals(Constants.SYSTEM_BUNDLE_SYMBOLICNAME) && !hostName.equals(Constants.getInternalSymbolicName()))
throw new BundleException(NLS.bind(StateMsg.HEADER_EXTENSION_ERROR, hostName));
}
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java
index 9ac6e28e2..1dfd4ff69 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java
@@ -27,7 +27,7 @@ public abstract class StateImpl implements State {
private static final String OSGI_WS = "osgi.ws"; //$NON-NLS-1$
private static final String OSGI_NL = "osgi.nl"; //$NON-NLS-1$
private static final String OSGI_ARCH = "osgi.arch"; //$NON-NLS-1$
- public static final String[] PROPS = {OSGI_OS, OSGI_WS, OSGI_NL, OSGI_ARCH, Constants.OSGI_FRAMEWORK_SYSTEM_PACKAGES, Constants.OSGI_RESOLVER_MODE, Constants.FRAMEWORK_EXECUTIONENVIRONMENT, "osgi.resolveOptional", "osgi.genericAliases", Constants.FRAMEWORK_OS_NAME, Constants.FRAMEWORK_OS_VERSION, Constants.FRAMEWORK_PROCESSOR, Constants.FRAMEWORK_LANGUAGE}; //$NON-NLS-1$ //$NON-NLS-2$
+ public static final String[] PROPS = {OSGI_OS, OSGI_WS, OSGI_NL, OSGI_ARCH, Constants.OSGI_FRAMEWORK_SYSTEM_PACKAGES, Constants.OSGI_RESOLVER_MODE, Constants.FRAMEWORK_EXECUTIONENVIRONMENT, "osgi.resolveOptional", "osgi.genericAliases", Constants.FRAMEWORK_OS_NAME, Constants.FRAMEWORK_OS_VERSION, Constants.FRAMEWORK_PROCESSOR, Constants.FRAMEWORK_LANGUAGE, Constants.STATE_SYSTEM_BUNDLE}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
private static final DisabledInfo[] EMPTY_DISABLEDINFOS = new DisabledInfo[0];
transient private Resolver resolver;
transient private StateDeltaImpl changes;
@@ -80,7 +80,7 @@ public abstract class StateImpl implements State {
}
resolved = false;
getDelta().recordBundleAdded((BundleDescriptionImpl) description);
- if (Constants.getInternalSymbolicName().equals(description.getSymbolicName()))
+ if (getSystemBundle().equals(description.getSymbolicName()))
resetSystemExports();
if (resolver != null)
resolver.bundleAdded(description);
@@ -111,7 +111,7 @@ public abstract class StateImpl implements State {
return false;
resolved = false;
getDelta().recordBundleUpdated((BundleDescriptionImpl) newDescription);
- if (Constants.getInternalSymbolicName().equals(newDescription.getSymbolicName()))
+ if (getSystemBundle().equals(newDescription.getSymbolicName()))
resetSystemExports();
if (resolver != null) {
boolean pending = existing.getDependents().length > 0;
@@ -187,8 +187,8 @@ public abstract class StateImpl implements State {
}
public BundleDescription[] getBundles(String symbolicName) {
- if (Constants.OSGI_SYSTEM_BUNDLE.equals(symbolicName))
- symbolicName = Constants.getInternalSymbolicName();
+ if (Constants.SYSTEM_BUNDLE_SYMBOLICNAME.equals(symbolicName))
+ symbolicName = getSystemBundle();
final List bundles = new ArrayList();
for (Iterator iter = bundleDescriptions.iterator(); iter.hasNext();) {
BundleDescription bundle = (BundleDescription) iter.next();
@@ -620,8 +620,10 @@ public abstract class StateImpl implements State {
String[] keys = getPlatformPropertyKeys();
for (int i = 0; i < newPlatformProperties.length && !result; i++) {
result |= changedProps(this.platformProperties[i], newPlatformProperties[i], keys);
- if (resetSystemExports)
+ if (resetSystemExports) {
performResetSystemExports |= checkProp(this.platformProperties[i].get(Constants.FRAMEWORK_SYSTEMPACKAGES), newPlatformProperties[i].get(Constants.FRAMEWORK_SYSTEMPACKAGES));
+ performResetSystemExports |= checkProp(this.platformProperties[i].get(Constants.SYSTEM_BUNDLE_SYMBOLICNAME), newPlatformProperties[i].get(Constants.SYSTEM_BUNDLE_SYMBOLICNAME));
+ }
}
}
// always do a complete replacement of the properties in case new bundles are added that uses new filter props
@@ -632,7 +634,7 @@ public abstract class StateImpl implements State {
}
private void resetSystemExports() {
- BundleDescription[] systemBundles = getBundles(Constants.getInternalSymbolicName());
+ BundleDescription[] systemBundles = getBundles(Constants.SYSTEM_BUNDLE_SYMBOLICNAME);
if (systemBundles.length > 0) {
BundleDescriptionImpl systemBundle = (BundleDescriptionImpl) systemBundles[0];
ExportPackageDescription[] exports = systemBundle.getExportPackages();
@@ -698,6 +700,13 @@ public abstract class StateImpl implements State {
return false;
}
+ public String getSystemBundle() {
+ String symbolicName = null;
+ if (platformProperties != null && platformProperties.length > 0)
+ symbolicName = (String) platformProperties[0].get(Constants.STATE_SYSTEM_BUNDLE); //$NON-NLS-1$
+ return symbolicName != null ? symbolicName : Constants.getInternalSymbolicName();
+ }
+
public BundleDescription[] getRemovalPendings() {
return (BundleDescription[]) removalPendings.toArray(new BundleDescription[removalPendings.size()]);
}
@@ -763,7 +772,7 @@ public abstract class StateImpl implements State {
public ExportPackageDescription[] getSystemPackages() {
ArrayList result = new ArrayList();
- BundleDescription[] systemBundles = getBundles(Constants.getInternalSymbolicName());
+ BundleDescription[] systemBundles = getBundles(Constants.SYSTEM_BUNDLE_SYMBOLICNAME);
if (systemBundles.length > 0) {
BundleDescriptionImpl systemBundle = (BundleDescriptionImpl) systemBundles[0];
ExportPackageDescription[] exports = systemBundle.getExportPackages();
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/VersionConstraintImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/VersionConstraintImpl.java
index c3dba39f0..2e81114e6 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/VersionConstraintImpl.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/VersionConstraintImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
+ * Copyright (c) 2003, 2008 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
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osgi.internal.resolver;
+import org.eclipse.osgi.framework.internal.core.Constants;
import org.eclipse.osgi.service.resolver.*;
public abstract class VersionConstraintImpl implements VersionConstraint {
@@ -19,6 +20,8 @@ public abstract class VersionConstraintImpl implements VersionConstraint {
private BaseDescription supplier;
public String getName() {
+ if (Constants.SYSTEM_BUNDLE_SYMBOLICNAME.equals(name))
+ return ((StateImpl) bundle.getContainingState()).getSystemBundle();
return name;
}
@@ -43,6 +46,7 @@ public abstract class VersionConstraintImpl implements VersionConstraint {
public boolean isSatisfiedBy(BaseDescription supplier) {
return false;
}
+
protected void setName(String name) {
this.name = name;
}

Back to the top