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-modelconverter] 05/40: SLING-7512 Order features based on their dependencies.
Date Fri, 27 Apr 2018 10:01:23 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-modelconverter.git

commit 6f0cf99e2b3145603b6304255814350a01896c10
Author: David Bosschaert <bosschae@adobe.com>
AuthorDate: Fri Feb 23 13:42:28 2018 +0000

    SLING-7512 Order features based on their dependencies.
    
    Very initial implementation which contains the refactoring of
    Requirements and Capabilities to use the OSGi ones.
---
 pom.xml                                                     |  6 ++++++
 .../org/apache/sling/feature/modelconverter/impl/Main.java  | 13 +++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 64dbec0..93d619b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -102,6 +102,12 @@
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.feature.resolver</artifactId>
+            <version>0.0.1-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.feature.support</artifactId>
             <version>0.0.1-SNAPSHOT</version>
             <scope>provided</scope>
diff --git a/src/main/java/org/apache/sling/feature/modelconverter/impl/Main.java b/src/main/java/org/apache/sling/feature/modelconverter/impl/Main.java
index 9f5aaf9..ccc3f85 100644
--- a/src/main/java/org/apache/sling/feature/modelconverter/impl/Main.java
+++ b/src/main/java/org/apache/sling/feature/modelconverter/impl/Main.java
@@ -43,6 +43,8 @@ import org.apache.sling.feature.Extension;
 import org.apache.sling.feature.ExtensionType;
 import org.apache.sling.feature.Extensions;
 import org.apache.sling.feature.KeyValueMap;
+import org.apache.sling.feature.process.FeatureResolver;
+import org.apache.sling.feature.resolver.FrameworkResolver;
 import org.apache.sling.feature.support.ArtifactHandler;
 import org.apache.sling.feature.support.ArtifactManager;
 import org.apache.sling.feature.support.ArtifactManagerConfig;
@@ -165,6 +167,10 @@ public class Main {
         return null;
     }
 
+    private static FeatureResolver getFeatureResolver(ArtifactManager am) {
+        return new FrameworkResolver(am, Collections.emptyMap());
+    }
+
     public static void main(final String[] args) {
         // setup logging
         System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "info");
@@ -241,7 +247,7 @@ public class Main {
             if ( output == null ) {
                 output = createApp ? "application.txt" : "feature.txt";
             }
-            try {
+            try (FeatureResolver fr = getFeatureResolver(am)) {
                 if ( createApp ) {
                     // each file is an application
                     int index = 1;
@@ -253,7 +259,7 @@ public class Main {
                         index++;
                     }
                 } else {
-                    final Application app = FeatureUtil.assembleApplication(null, am, files.stream()
+                    final Application app = FeatureUtil.assembleApplication(null, am, fr,
files.stream()
                             .map(File::getAbsolutePath)
                             .toArray(String[]::new));
                     convert(app, 0);
@@ -261,6 +267,9 @@ public class Main {
             } catch ( final IOException ioe) {
                 LOGGER.error("Unable to read feature/application files " + ioe.getMessage(),
ioe);
                 System.exit(1);
+            } catch ( final Exception e) {
+                LOGGER.error("Problem generating application", e);
+                System.exit(1);
             }
         }
     }

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

Mime
View raw message