Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.osgi/resolver')
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/GroupingChecker.java18
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java16
2 files changed, 29 insertions, 5 deletions
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/GroupingChecker.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/GroupingChecker.java
index 30c59635c..f31b34f26 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/GroupingChecker.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/GroupingChecker.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2010 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2004, 2011 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 http://www.eclipse.org/legal/epl-v10.html
@@ -28,7 +28,9 @@ public class GroupingChecker {
* roots to do proper uses constraint verification on a dynamic import supplier.
*/
public void populateRoots(ResolverBundle bundle) {
- bundles.remove(bundle);
+ if (bundles.containsKey(bundle))
+ // only do the full populate the first time (bug 337272)
+ return;
// process all requires
BundleConstraint[] requires = bundle.getRequires();
for (int j = 0; j < requires.length; j++) {
@@ -51,6 +53,18 @@ public class GroupingChecker {
}
/*
+ * Re-populates the package roots or an importing bundle with the given export
+ * This is done after wiring a package from a dynamic import (bug 337272)
+ */
+ public void populateRoots(ResolverBundle importingBundle, ResolverExport export) {
+ Map packageRoots = (Map) bundles.get(importingBundle);
+ if (packageRoots != null)
+ packageRoots.remove(export.getName());
+ PackageRoots roots = getPackageRoots(export.getExporter(), export.getName(), null);
+ packageRoots.put(export.getName(), roots);
+ }
+
+ /*
* Verifies the uses constraint consistency for the requiringBundle with the possible matching bundle.
* If an inconsistency is found the export inconsistency is returned; otherwise null is returned
*/
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 24b650ab9..a292fe718 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2010 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2004, 2011 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 http://www.eclipse.org/legal/epl-v10.html
@@ -1584,11 +1584,14 @@ public class ResolverImpl implements org.eclipse.osgi.service.resolver.Resolver
// If the import resolved then return it's matching export
if (DEBUG_IMPORTS)
ResolverImpl.log("Resolved dynamic import: " + rb + ":" + resolverImports[j].getName() + " -> " + ((ResolverExport) resolverImports[j].getSelectedSupplier()).getExporter() + ":" + requestedPackage); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ExportPackageDescription matchingExport = ((ResolverExport) resolverImports[j].getSelectedSupplier()).getExportPackageDescription();
+ ResolverExport export = (ResolverExport) resolverImports[j].getSelectedSupplier();
+ ExportPackageDescription matchingExport = export.getExportPackageDescription();
// If it is a wildcard import then clear the wire, so other
// exported packages can be found for it
if (importName.endsWith("*")) //$NON-NLS-1$
resolverImports[j].clearPossibleSuppliers();
+ // now that we have an export to wire to; populate the roots for that package for the bundle
+ groupingChecker.populateRoots(rb, export);
return matchingExport;
}
}
@@ -1602,13 +1605,20 @@ public class ResolverImpl implements org.eclipse.osgi.service.resolver.Resolver
ImportPackageSpecification packageSpec = state.getFactory().createImportPackageSpecification(requestedPackage, null, null, null, directives, null, importingBundle);
ResolverImport newImport = new ResolverImport(rb, packageSpec);
if (resolveImport(newImport, new ArrayList())) {
+ // populate the grouping checker with current imports
+ groupingChecker.populateRoots(rb);
while (newImport.getSelectedSupplier() != null) {
if (groupingChecker.isDynamicConsistent(rb, (ResolverExport) newImport.getSelectedSupplier()) != null)
newImport.selectNextSupplier();
else
break;
}
- return ((ResolverExport) newImport.getSelectedSupplier()).getExportPackageDescription();
+ ResolverExport export = (ResolverExport) newImport.getSelectedSupplier();
+ if (export != null) {
+ // now that we have an export to wire to; populate the roots for that package for the bundle
+ groupingChecker.populateRoots(rb, export);
+ return export.getExportPackageDescription();
+ }
}
}
if (DEBUG || DEBUG_IMPORTS)

Back to the top