You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/10/18 23:30:24 UTC

[sling-maven-launchpad-plugin] 11/37: SLING-3401 : Support multiple bundles for jarWebSupport Implement toString and provide a way to get the contained artifact definitions

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

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-maven-launchpad-plugin.git

commit 2a7f05ad62024780473b6c5ad8a87add237cead5
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Thu Feb 20 13:12:19 2014 +0000

    SLING-3401 : Support multiple bundles for jarWebSupport
    Implement toString and provide a way to get the contained artifact definitions
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1570182 13f79535-47bb-0310-9956-ffa450edef68
---
 .../maven/projectsupport/ArtifactDefinition.java   | 36 +++++++++++++++++-----
 1 file changed, 29 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/apache/sling/maven/projectsupport/ArtifactDefinition.java b/src/main/java/org/apache/sling/maven/projectsupport/ArtifactDefinition.java
index 29930a5..f9f6ab3 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/ArtifactDefinition.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/ArtifactDefinition.java
@@ -19,6 +19,7 @@ package org.apache.sling.maven.projectsupport;
 import static org.apache.sling.maven.projectsupport.BundleListUtils.nodeValue;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 import org.apache.maven.model.Dependency;
@@ -137,12 +138,20 @@ public class ArtifactDefinition {
         this.version = version;
     }
 
+    public ArtifactDefinition[] getContainedArtifacts() {
+        return this.bundles;
+    }
+
     @Override
     public String toString() {
-        return "ArtifactDefinition [artifactId=" + artifactId + ", classifier="
-                + classifier + ", groupId=" + groupId + ", startLevel="
-                + startLevel + ", type=" + type + ", version=" + version
-                + ", runModes=" + runModes + "]";
+        if ( this.bundles == null ) {
+            return "ArtifactDefinition [artifactId=" + artifactId + ", classifier="
+                    + classifier + ", groupId=" + groupId + ", startLevel="
+                    + startLevel + ", type=" + type + ", version=" + version
+                    + ", runModes=" + runModes + "]";
+        } else {
+            return "ArtifactDefinition [artifacts=" + Arrays.toString(this.bundles) + "]";
+        }
     }
 
     /**
@@ -157,13 +166,26 @@ public class ArtifactDefinition {
      *            the comma-delimited list
      */
     public void initDefaults(String commaDelimitedList) {
-        String[] values = commaDelimitedList.split(",");
+        this.initDefaults(commaDelimitedList, ',');
+    }
+
+    /**
+     * Initialize this ArtifactDefinition with a set of default values from a
+     * delimited string. This string must have 6 items in it:
+     * [groupId],[artifactId],[version],[type],[classifier],[startLevel]
+     *
+     * @param valueList the delimited list
+     * @param delimiter the delimiter
+     */
+    public void initDefaults(final String valueList, final char delimiter) {
+        final String delString = "" + delimiter;
+        String[] values = valueList.split(delString);
         if (values.length == 0 || values.length % 6 != 0 ) {
             throw new IllegalArgumentException(
                     String
                             .format(
-                                    "The string %s does not have the correct number of items (a multiple of 6).",
-                                    commaDelimitedList));
+                                    "The string %s does not have the correct number of items (a multiple of 6) separated by %s",
+                                    valueList, delString));
         }
         if ( values.length == 6 ) {
             initDefaults(values[0], values[1], values[2], values[3], values[4],

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.