sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1570178 - /sling/trunk/tooling/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/ArtifactDefinition.java
Date Thu, 20 Feb 2014 12:58:47 GMT
Author: cziegeler
Date: Thu Feb 20 12:58:47 2014
New Revision: 1570178

URL: http://svn.apache.org/r1570178
Log:
SLING-3401 : Support multiple bundles for jarWebSupport
Add support for reading multiple bundles when directly reading the maven xml (lifecycle participant)
and add support to define several bundles in the dependencies.properties file

Modified:
    sling/trunk/tooling/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/ArtifactDefinition.java

Modified: sling/trunk/tooling/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/ArtifactDefinition.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/ArtifactDefinition.java?rev=1570178&r1=1570177&r2=1570178&view=diff
==============================================================================
--- sling/trunk/tooling/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/ArtifactDefinition.java
(original)
+++ sling/trunk/tooling/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/ArtifactDefinition.java
Thu Feb 20 12:58:47 2014
@@ -67,14 +67,22 @@ public class ArtifactDefinition {
         this.runModes = bundle.getRunModes();
     }
 
-    public ArtifactDefinition(Xpp3Dom config) {
-        this.groupId = nodeValue(config, "groupId", null);
-        this.artifactId = nodeValue(config, "artifactId", null);
-        this.type = nodeValue(config, "type", null);
-        this.version = nodeValue(config, "version", null);
-        this.classifier = nodeValue(config, "classifier", null);
-        this.startLevel = nodeValue(config, "startLevel", 0);
-        this.runModes = nodeValue(config, "runModes", null);
+    public ArtifactDefinition(final Xpp3Dom config) {
+        if ( config.getChild("bundles") != null ) {
+            final Xpp3Dom[] children = config.getChild("bundles").getChildren("bundle");
+            this.bundles = new ArtifactDefinition[children.length];
+            for(int i=0; i<this.bundles.length; i++) {
+                this.bundles[i] = new ArtifactDefinition(children[i]);
+            }
+        } else {
+            this.groupId = nodeValue(config, "groupId", null);
+            this.artifactId = nodeValue(config, "artifactId", null);
+            this.type = nodeValue(config, "type", null);
+            this.version = nodeValue(config, "version", null);
+            this.classifier = nodeValue(config, "classifier", null);
+            this.startLevel = nodeValue(config, "startLevel", 0);
+            this.runModes = nodeValue(config, "runModes", null);
+        }
     }
 
     public String getArtifactId() {
@@ -150,15 +158,23 @@ public class ArtifactDefinition {
      */
     public void initDefaults(String commaDelimitedList) {
         String[] values = commaDelimitedList.split(",");
-        if (values.length != 6) {
+        if (values.length == 0 || values.length % 6 != 0 ) {
             throw new IllegalArgumentException(
                     String
                             .format(
-                                    "The string %s does not have the correct number of items
(6).",
+                                    "The string %s does not have the correct number of items
(a multiple of 6).",
                                     commaDelimitedList));
         }
-        initDefaults(values[0], values[1], values[2], values[3], values[4],
-                Integer.valueOf(values[5]));
+        if ( values.length == 6 ) {
+            initDefaults(values[0], values[1], values[2], values[3], values[4],
+                    Integer.valueOf(values[5]));
+        }
+        this.bundles = new ArtifactDefinition[values.length / 6];
+        for(int i=0; i<values.length / 6; i++) {
+            this.bundles[i] = new ArtifactDefinition();
+            this.bundles[i].initDefaults(values[i*6 + 0], values[i*6 + 1], values[i*6 + 2],
values[i*6 + 3], values[i*6 + 4],
+                    Integer.valueOf(values[i*6 + 5]));
+        }
     }
 
     /**



Mime
View raw message