[FELIX-4942] Introduce a Util.isReExport() method
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1690701 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/resolver/src/main/java/org/apache/felix/resolver/ResolverImpl.java b/resolver/src/main/java/org/apache/felix/resolver/ResolverImpl.java
index 7b08d04..00a8977 100644
--- a/resolver/src/main/java/org/apache/felix/resolver/ResolverImpl.java
+++ b/resolver/src/main/java/org/apache/felix/resolver/ResolverImpl.java
@@ -925,11 +925,7 @@
if (w.getRequirement().getNamespace()
.equals(BundleNamespace.BUNDLE_NAMESPACE))
{
- String value = w.getRequirement()
- .getDirectives()
- .get(BundleNamespace.REQUIREMENT_VISIBILITY_DIRECTIVE);
- if ((value != null)
- && value.equals(BundleNamespace.VISIBILITY_REEXPORT))
+ if (Util.isReexport(w.getRequirement()))
{
mergeCandidatePackages(
rc,
@@ -949,11 +945,7 @@
{
if (req.getNamespace().equals(BundleNamespace.BUNDLE_NAMESPACE))
{
- String value =
- req.getDirectives()
- .get(BundleNamespace.REQUIREMENT_VISIBILITY_DIRECTIVE);
- if ((value != null)
- && value.equals(BundleNamespace.VISIBILITY_REEXPORT))
+ if (Util.isReexport(req))
{
Capability cap = allCandidates.getFirstCandidate(req);
if (cap != null) {
diff --git a/resolver/src/main/java/org/apache/felix/resolver/Util.java b/resolver/src/main/java/org/apache/felix/resolver/Util.java
index 84de220..973cd5b 100644
--- a/resolver/src/main/java/org/apache/felix/resolver/Util.java
+++ b/resolver/src/main/java/org/apache/felix/resolver/Util.java
@@ -21,6 +21,7 @@
import java.util.ArrayList;
import java.util.List;
import org.osgi.framework.Version;
+import org.osgi.framework.namespace.BundleNamespace;
import org.osgi.framework.namespace.IdentityNamespace;
import org.osgi.framework.namespace.PackageNamespace;
import org.osgi.resource.Capability;
@@ -90,6 +91,12 @@
.get(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE));
}
+ public static boolean isReexport(Requirement req)
+ {
+ return BundleNamespace.VISIBILITY_REEXPORT.equals(req.getDirectives()
+ .get(BundleNamespace.REQUIREMENT_VISIBILITY_DIRECTIVE));
+ }
+
public static List<Requirement> getDynamicRequirements(List<Requirement> reqs)
{
List<Requirement> result = new ArrayList<Requirement>();