Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2017-02-16 19:43:36 +0000
committerThomas Watson2017-06-16 12:38:08 +0000
commit9616ef3b024f613d07ca7936751061f6cd473a9e (patch)
tree7703691c953b81817609b427ffd418ca2c671f81 /bundles/org.eclipse.osgi/felix
parent6b01d11c037e98842a9c3b18a6a8866813d63dab (diff)
downloadrt.equinox.framework-9616ef3b024f613d07ca7936751061f6cd473a9e.tar.gz
rt.equinox.framework-9616ef3b024f613d07ca7936751061f6cd473a9e.tar.xz
rt.equinox.framework-9616ef3b024f613d07ca7936751061f6cd473a9e.zip
resolver: add ResolveContext getSubstitutionWires method
Signed-off-by: Thomas Watson <tjwatson@us.ibm.com> Change-Id: I44f6400ec2b37603299bed60750383177f968ada
Diffstat (limited to 'bundles/org.eclipse.osgi/felix')
-rwxr-xr-xbundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/FelixResolveContext.java39
-rwxr-xr-xbundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/ResolverImpl.java55
2 files changed, 1 insertions, 93 deletions
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
deleted file mode 100755
index ddfb49bcf..000000000
--- a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/FelixResolveContext.java
+++ /dev/null
@@ -1,39 +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.framework.namespace.PackageNamespace;
-import org.osgi.resource.*;
-
-public interface FelixResolveContext {
- /**
- * 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<Wire> getSubstitutionWires(Wiring wiring);
-}
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 09f9ec56a..146a9c563 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
@@ -1646,17 +1646,7 @@ public class ResolverImpl implements Resolver
// map to determine which exports are substitutable.
if (wiring != null)
{
- Collection<Wire> substitutionWires;
- if (session.getContext() instanceof FelixResolveContext)
- {
- substitutionWires = ((FelixResolveContext) session.getContext()).getSubstitutionWires(
- wiring);
- }
- else
- {
- substitutionWires = getSubstitutionWires(wiring);
- }
- for (Wire wire : substitutionWires)
+ for (Wire wire : session.getContext().getSubstitutionWires(wiring))
{
Capability cap = wire.getCapability();
if (!cap.getResource().equals(wire.getProvider()))
@@ -1697,49 +1687,6 @@ public class ResolverImpl implements Resolver
return exports;
}
- private static Collection<Wire> getSubstitutionWires(Wiring wiring)
- {
- Set<String> exportNames = new HashSet<String>();
- for (Capability cap : wiring.getResource().getCapabilities(null))
- {
- if (PackageNamespace.PACKAGE_NAMESPACE.equals(cap.getNamespace()))
- {
- exportNames.add(
- (String) cap.getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE));
- }
- }
- // Add fragment exports
- for (Wire wire : wiring.getProvidedResourceWires(null))
- {
- if (HostNamespace.HOST_NAMESPACE.equals(wire.getCapability().getNamespace()))
- {
- for (Capability cap : wire.getRequirement().getResource().getCapabilities(
- null))
- {
- if (PackageNamespace.PACKAGE_NAMESPACE.equals(cap.getNamespace()))
- {
- exportNames.add((String) cap.getAttributes().get(
- PackageNamespace.PACKAGE_NAMESPACE));
- }
- }
- }
- }
- Collection<Wire> substitutionWires = new ArrayList<Wire>();
- for (Wire wire : wiring.getRequiredResourceWires(null))
- {
- if (PackageNamespace.PACKAGE_NAMESPACE.equals(
- wire.getCapability().getNamespace()))
- {
- if (exportNames.contains(wire.getCapability().getAttributes().get(
- PackageNamespace.PACKAGE_NAMESPACE)))
- {
- substitutionWires.add(wire);
- }
- }
- }
- return substitutionWires;
- }
-
private static boolean isCompatible(
Blame currentBlame, Capability candCap,
Map<Resource, Packages> resourcePkgMap)

Back to the top