Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2010-05-17 10:42:50 -0400
committerThomas Watson2010-05-17 10:42:50 -0400
commite03e6e21214fbc7c956b819c8bd33915a2167319 (patch)
treedd7fff4baa2487fe3f9b2148d765221bb6707854
parentb07b8ba7ead3eb15ec59a97433b728fac7da5e03 (diff)
downloadrt.equinox.framework-e03e6e21214fbc7c956b819c8bd33915a2167319.tar.gz
rt.equinox.framework-e03e6e21214fbc7c956b819c8bd33915a2167319.tar.xz
rt.equinox.framework-e03e6e21214fbc7c956b819c8bd33915a2167319.zip
Bug 312731 - Resolver should be configurable to allow bundles to supply packages that are supplied by the JDK
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java2
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/VersionHashMap.java16
2 files changed, 11 insertions, 7 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 64ff1dfe9..92864544b 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
@@ -46,7 +46,7 @@ public class ResolverImpl implements org.eclipse.osgi.service.resolver.Resolver
private static int MAX_MULTIPLE_SUPPLIERS_MERGE = 10;
private static int MAX_USES_TIME_BASE = 30000; // 30 seconds
private static int MAX_USES_TIME_LIMIT = 90000; // 90 seconds
- private static final SecureAction secureAction = (SecureAction) AccessController.doPrivileged(SecureAction.createSecureAction());
+ static final SecureAction secureAction = (SecureAction) AccessController.doPrivileged(SecureAction.createSecureAction());
private String[][] CURRENT_EES;
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 908bf866a..05f18f3dc 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
@@ -14,10 +14,12 @@ package org.eclipse.osgi.internal.module;
import java.util.*;
public class VersionHashMap extends MappedList implements Comparator {
- private ResolverImpl resolver;
+ private final ResolverImpl resolver;
+ private final boolean preferSystemPackages;
public VersionHashMap(ResolverImpl resolver) {
this.resolver = resolver;
+ preferSystemPackages = Boolean.valueOf(ResolverImpl.secureAction.getProperty("osgi.resolver.preferSystemPackages", "true")).booleanValue(); //$NON-NLS-1$//$NON-NLS-2$
}
// assumes existing array is sorted
@@ -104,11 +106,13 @@ 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()))
- return 1;
+ if (preferSystemPackages) {
+ 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()))
+ return 1;
+ }
if (vs1.getBundle().isResolved() != vs2.getBundle().isResolved())
return vs1.getBundle().isResolved() ? -1 : 1;
int versionCompare = -(vs1.getVersion().compareTo(vs2.getVersion()));

Back to the top