You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2020/03/20 06:39:07 UTC

[sling-org-apache-sling-feature-modelconverter] branch master updated: SLING-8842 : CP Converter creates packaging slingfeature instead of slingosgifeature

This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new 177f82f  SLING-8842 : CP Converter creates packaging slingfeature instead of slingosgifeature
177f82f is described below

commit 177f82f4e9061d0da4cb95b77e88ffc378c361b0
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Mar 20 07:38:46 2020 +0100

    SLING-8842 : CP Converter creates packaging slingfeature instead of slingosgifeature
---
 .../java/org/apache/sling/feature/modelconverter/Main.java     |  6 ++++--
 .../sling/feature/modelconverter/ProvisioningToFeature.java    | 10 +++++-----
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/apache/sling/feature/modelconverter/Main.java b/src/main/java/org/apache/sling/feature/modelconverter/Main.java
index 4475089..fbbee9a 100644
--- a/src/main/java/org/apache/sling/feature/modelconverter/Main.java
+++ b/src/main/java/org/apache/sling/feature/modelconverter/Main.java
@@ -19,7 +19,6 @@ package org.apache.sling.feature.modelconverter;
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -28,6 +27,7 @@ import java.util.regex.Pattern;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+
 import picocli.CommandLine;
 import picocli.CommandLine.Command;
 import picocli.CommandLine.Option;
@@ -35,10 +35,12 @@ import picocli.CommandLine.Option;
 @Command(
     name = "pm2fm",
     description = "Apache Sling Provisioning Model to Sling Feature Model converter",
-    footer = "Copyright(c) 2019 The Apache Software Foundation."
+    footer = "Copyright(c) 2019-2020 The Apache Software Foundation."
 )
 public class Main implements Runnable {
 
+    public static final String PACKAGING_FEATURE = "slingosgifeature";
+
     private static final Logger LOGGER = LoggerFactory.getLogger(Main.class);
 
     @Option(names = { "-h", "--help" }, usageHelp = true, description = "Display the usage message")
diff --git a/src/main/java/org/apache/sling/feature/modelconverter/ProvisioningToFeature.java b/src/main/java/org/apache/sling/feature/modelconverter/ProvisioningToFeature.java
index 896e970..770dda9 100644
--- a/src/main/java/org/apache/sling/feature/modelconverter/ProvisioningToFeature.java
+++ b/src/main/java/org/apache/sling/feature/modelconverter/ProvisioningToFeature.java
@@ -17,7 +17,6 @@
 package org.apache.sling.feature.modelconverter;
 
 import java.io.File;
-import java.io.FileReader;
 import java.io.FileWriter;
 import java.io.IOException;
 import java.io.InputStreamReader;
@@ -204,6 +203,7 @@ public class ProvisioningToFeature {
                 for(final ArtifactGroup group : runMode.getArtifactGroups()) {
                     final List<org.apache.sling.provisioning.model.Artifact> removeList = new ArrayList<>();
                     for(final org.apache.sling.provisioning.model.Artifact a : group) {
+                        // slingstart and slingfeature are extensions owned by the slingstart maven plugin
                         if ( "slingstart".equals(a.getType())
                              || "slingfeature".equals(a.getType())) {
 
@@ -213,7 +213,7 @@ public class ProvisioningToFeature {
                             final ArtifactId correctedId = new ArtifactId(a.getGroupId(),
                                     a.getArtifactId(),
                                     a.getVersion(),
-                                    "slingstart".equals(a.getType()) ? "slingfeature" : a.getClassifier(),
+                                    "slingstart".equals(a.getType()) ? Main.PACKAGING_FEATURE : a.getClassifier(),
                                     "txt");
 
                             final ArtifactHandler handler = mgr.getArtifactHandler(correctedId.toMvnUrl());
@@ -449,7 +449,7 @@ public class ProvisioningToFeature {
             Extension repoExtension = extensions.getByName(Extension.EXTENSION_NAME_REPOINIT);
 
             if ( repoExtension == null ) {
-                // TODO: As of now only TEXT is accepted for Repoinit -> verify and adjust 
+                // TODO: As of now only TEXT is accepted for Repoinit -> verify and adjust
 //                repoExtension = new Extension(ExtensionType.JSON, Extension.EXTENSION_NAME_REPOINIT, true);
                 repoExtension = new Extension(ExtensionType.TEXT, Extension.EXTENSION_NAME_REPOINIT, true);
                 extensions.add(repoExtension);
@@ -510,13 +510,13 @@ public class ProvisioningToFeature {
                 version = feature.getVersion();
             }
 
-            // When providing a classifier a type must be provided and so we set it to 'slingfeature'
+            // When providing a classifier a type must be provided and so we set it to 'slingosgifeature'
             idString =
                 groupId + "/" +
                 (nameOption.isEmpty() ? name : nameOption) + "/" +
                 version +
                 (nameOption.isEmpty() ? "" :
-                    "/slingfeature/" + name );
+                    "/" + Main.PACKAGING_FEATURE + "/" + name );
             final org.apache.sling.feature.Feature f = new org.apache.sling.feature.Feature(ArtifactId.parse(idString));
             features.add(f);