From 71394a2cbca386ea5b4a2acc3d807be51336baca Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Thu, 9 Feb 2017 11:41:03 -0600 Subject: Bug 511593 - Issue resolving split packages Change solution to avoid introducing new API on ModuleWiring. Change-Id: I1de1dd5ce55c05b04f9eaa699606ce70ba22ec89 Signed-off-by: Thomas Watson --- .../apache/felix/resolver/FelixResolveContext.java | 19 ++++++++++++++++ .../src/org/apache/felix/resolver/FelixWiring.java | 26 ---------------------- .../org/apache/felix/resolver/ResolverImpl.java | 5 +++-- 3 files changed, 22 insertions(+), 28 deletions(-) delete mode 100644 bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/FelixWiring.java (limited to 'bundles/org.eclipse.osgi/felix') diff --git a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/FelixResolveContext.java b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/FelixResolveContext.java index 502a7e459..9782d0a02 100755 --- a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/FelixResolveContext.java +++ b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/FelixResolveContext.java @@ -18,7 +18,11 @@ */package org.apache.felix.resolver; import java.util.Collection; + +import org.osgi.framework.namespace.PackageNamespace; import org.osgi.resource.Resource; +import org.osgi.resource.Wire; +import org.osgi.resource.Wiring; public interface FelixResolveContext { @@ -41,4 +45,19 @@ public interface FelixResolveContext * resources. The returned collection may be unmodifiable. */ public Collection getOndemandResources(Resource host); + + /** + * Returns the subset of {@link Wiring#getRequiredResourceWires(String) require wires} + * that provide wires to {@link Capability capabilities} which substitute capabilities + * of the given wiring. For example, when a {@link PackageNamespace package} name is both + * provided and required by the same resource. If the package requirement is resolved + * to a capability hosted by a different wiring then the package capability is + * considered to be substituted. + * + * @param wiring the wiring to get the substitution wires from + * @return A collection containing a snapshot of the substitution {@link Wire}s + * for the {@link Requirement requirements} of this wiring, or an empty list + * if this wiring has no substitution wires. + */ + public Collection getSubstitutionWires(Wiring wiring); } diff --git a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/FelixWiring.java b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/FelixWiring.java deleted file mode 100644 index ce453b029..000000000 --- a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/FelixWiring.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */package org.apache.felix.resolver; - -import java.util.Collection; -import org.osgi.resource.Wire; - -public interface FelixWiring -{ - Collection getSubstitutionWires(); -} diff --git a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/ResolverImpl.java b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/ResolverImpl.java index 897b9698f..60beca879 100755 --- a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/ResolverImpl.java +++ b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/ResolverImpl.java @@ -1608,9 +1608,10 @@ public class ResolverImpl implements Resolver if (wiring != null) { Collection substitutionWires; - if (wiring instanceof FelixWiring) + if (session.getContext() instanceof FelixResolveContext) { - substitutionWires = ((FelixWiring) wiring).getSubstitutionWires(); + substitutionWires = ((FelixResolveContext) session.getContext()).getSubstitutionWires( + wiring); } else { -- cgit v1.2.3