sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject [sling-org-apache-sling-feature-analyser] 19/28: Pick up CapabilityMatcher functionality from Felix Utils
Date Fri, 27 Apr 2018 09:53:35 GMT
This is an automated email from the ASF dual-hosted git repository.

davidb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-analyser.git

commit 5b8bdd647e382c769250c518cb583b7362c8e3c4
Author: David Bosschaert <david.bosschaert@gmail.com>
AuthorDate: Mon Apr 23 16:07:23 2018 +0100

    Pick up CapabilityMatcher functionality from Felix Utils
---
 pom.xml                                               | 16 ++++++++--------
 .../task/impl/CheckRequirementsCapabilities.java      | 19 ++++++++++---------
 2 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/pom.xml b/pom.xml
index 28bb660..3179891 100644
--- a/pom.xml
+++ b/pom.xml
@@ -133,8 +133,8 @@
         </dependency>
         <dependency>
             <groupId>org.apache.felix</groupId>
-		    <artifactId>org.apache.felix.converter</artifactId>
-		    <version>0.1.0-SNAPSHOT</version>
+	    <artifactId>org.apache.felix.converter</artifactId>
+	    <version>0.1.0-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
@@ -143,6 +143,12 @@
             <version>0.0.1-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.utils</artifactId>
+            <version>1.11.0-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
         
         <!-- Testing -->
         <dependency>
@@ -150,11 +156,5 @@
             <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.apache.felix</groupId>
-            <artifactId>org.apache.felix.utils</artifactId>
-            <version>1.11.0-SNAPSHOT</version>
-            <scope>test</scope>
-        </dependency>
     </dependencies>
 </project>
diff --git a/src/main/java/org/apache/sling/feature/analyser/task/impl/CheckRequirementsCapabilities.java
b/src/main/java/org/apache/sling/feature/analyser/task/impl/CheckRequirementsCapabilities.java
index 77e270b..daa0a91 100644
--- a/src/main/java/org/apache/sling/feature/analyser/task/impl/CheckRequirementsCapabilities.java
+++ b/src/main/java/org/apache/sling/feature/analyser/task/impl/CheckRequirementsCapabilities.java
@@ -16,6 +16,14 @@
  */
 package org.apache.sling.feature.analyser.task.impl;
 
+import org.apache.felix.utils.resource.CapabilitySet;
+import org.apache.felix.utils.resource.RequirementImpl;
+import org.apache.sling.feature.analyser.task.AnalyserTask;
+import org.apache.sling.feature.analyser.task.AnalyserTaskContext;
+import org.apache.sling.feature.scanner.ArtifactDescriptor;
+import org.apache.sling.feature.scanner.BundleDescriptor;
+import org.osgi.resource.Requirement;
+
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -23,13 +31,6 @@ import java.util.SortedMap;
 import java.util.TreeMap;
 import java.util.stream.Collectors;
 
-import org.apache.sling.feature.analyser.task.AnalyserTask;
-import org.apache.sling.feature.analyser.task.AnalyserTaskContext;
-import org.apache.sling.feature.scanner.ArtifactDescriptor;
-import org.apache.sling.feature.scanner.BundleDescriptor;
-import org.apache.sling.feature.support.util.CapabilityMatcher;
-import org.osgi.resource.Requirement;
-
 public class CheckRequirementsCapabilities implements AnalyserTask {
     private final String format = "Artifact %s:%s requires %s in start level %d but %s";
 
@@ -75,7 +76,7 @@ public class CheckRequirementsCapabilities implements AnalyserTask {
                                 // osgi.service is special - we don't provide errors or warnings
in this case
                                 continue;
                             }
-                            if (!CapabilityMatcher.isOptional(requirement)) {
+                            if (!RequirementImpl.isOptional(requirement)) {
                                 ctx.reportError(String.format(format, info.getArtifact().getId().getArtifactId(),
info.getArtifact().getId().getVersion(), requirement.toString(), entry.getKey(), "no artifact
is providing a matching capability in this start level."));
                             }
                             else {
@@ -94,7 +95,7 @@ public class CheckRequirementsCapabilities implements AnalyserTask {
     private List<ArtifactDescriptor> getCandidates(List<ArtifactDescriptor> artifactDescriptors,
Requirement requirement) {
         return artifactDescriptors.stream()
                 .filter(artifactDescriptor -> artifactDescriptor.getCapabilities() !=
null)
-                .filter(artifactDescriptor -> artifactDescriptor.getCapabilities().stream().anyMatch(capability
-> CapabilityMatcher.matches(capability, requirement)))
+                .filter(artifactDescriptor -> artifactDescriptor.getCapabilities().stream().anyMatch(capability
-> CapabilitySet.matches(capability, requirement)))
                 .collect(Collectors.toList());
     }
 }

-- 
To stop receiving notification emails like this one, please contact
davidb@apache.org.

Mime
View raw message