sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1628760 - in /sling/trunk/tooling/maven/slingstart-maven-plugin: ./ src/main/java/org/apache/sling/maven/slingstart/
Date Wed, 01 Oct 2014 16:38:22 GMT
Author: cziegeler
Date: Wed Oct  1 16:38:22 2014
New Revision: 1628760

URL: http://svn.apache.org/r1628760
Log:
Use provisioning model

Modified:
    sling/trunk/tooling/maven/slingstart-maven-plugin/pom.xml
    sling/trunk/tooling/maven/slingstart-maven-plugin/src/main/java/org/apache/sling/maven/slingstart/DependencyLifecycleParticipant.java
    sling/trunk/tooling/maven/slingstart-maven-plugin/src/main/java/org/apache/sling/maven/slingstart/ModelUtils.java
    sling/trunk/tooling/maven/slingstart-maven-plugin/src/main/java/org/apache/sling/maven/slingstart/PreparePackageMojo.java

Modified: sling/trunk/tooling/maven/slingstart-maven-plugin/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/maven/slingstart-maven-plugin/pom.xml?rev=1628760&r1=1628759&r2=1628760&view=diff
==============================================================================
--- sling/trunk/tooling/maven/slingstart-maven-plugin/pom.xml (original)
+++ sling/trunk/tooling/maven/slingstart-maven-plugin/pom.xml Wed Oct  1 16:38:22 2014
@@ -85,7 +85,7 @@
     <dependencies>
        <dependency>
            <groupId>org.apache.sling</groupId>
-           <artifactId>org.apache.sling.slingstart.model</artifactId>
+           <artifactId>org.apache.sling.provisioning.model</artifactId>
            <version>0.1.0-SNAPSHOT</version>
        </dependency>
        <dependency>

Modified: sling/trunk/tooling/maven/slingstart-maven-plugin/src/main/java/org/apache/sling/maven/slingstart/DependencyLifecycleParticipant.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/maven/slingstart-maven-plugin/src/main/java/org/apache/sling/maven/slingstart/DependencyLifecycleParticipant.java?rev=1628760&r1=1628759&r2=1628760&view=diff
==============================================================================
--- sling/trunk/tooling/maven/slingstart-maven-plugin/src/main/java/org/apache/sling/maven/slingstart/DependencyLifecycleParticipant.java
(original)
+++ sling/trunk/tooling/maven/slingstart-maven-plugin/src/main/java/org/apache/sling/maven/slingstart/DependencyLifecycleParticipant.java
Wed Oct  1 16:38:22 2014
@@ -146,8 +146,8 @@ public class DependencyLifecycleParticip
                 continue;
             }
             for(final RunMode runMode : feature.getRunModes()) {
-                for(final ArtifactGroup sl : runMode.getArtifactGroups()) {
-                    for(final org.apache.sling.provisioning.model.Artifact a : sl.getArtifacts())
{
+                for(final ArtifactGroup group : runMode.getArtifactGroups()) {
+                    for(final org.apache.sling.provisioning.model.Artifact a : group) {
                         final Dependency dep = new Dependency();
                         dep.setGroupId(a.getGroupId());
                         dep.setArtifactId(a.getArtifactId());

Modified: sling/trunk/tooling/maven/slingstart-maven-plugin/src/main/java/org/apache/sling/maven/slingstart/ModelUtils.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/maven/slingstart-maven-plugin/src/main/java/org/apache/sling/maven/slingstart/ModelUtils.java?rev=1628760&r1=1628759&r2=1628760&view=diff
==============================================================================
--- sling/trunk/tooling/maven/slingstart-maven-plugin/src/main/java/org/apache/sling/maven/slingstart/ModelUtils.java
(original)
+++ sling/trunk/tooling/maven/slingstart-maven-plugin/src/main/java/org/apache/sling/maven/slingstart/ModelUtils.java
Wed Oct  1 16:38:22 2014
@@ -145,7 +145,7 @@ public abstract class ModelUtils {
     }
 
     public static org.apache.sling.provisioning.model.Artifact getBaseArtifact(final Model
model) throws MojoExecutionException {
-        final Feature base = model.findFeature(ModelConstants.FEATURE_LAUNCHPAD);
+        final Feature base = model.getFeature(ModelConstants.FEATURE_LAUNCHPAD);
         if ( base == null ) {
             throw new MojoExecutionException("No launchpad feature found.");
         }
@@ -160,10 +160,15 @@ public abstract class ModelUtils {
         if ( runMode.getArtifactGroups().size() > 1 ) {
             throw new MojoExecutionException("Base run mode should only have a single start
level.");
         }
-        if ( runMode.getArtifactGroups().get(0).getArtifacts().size() != 1 ) {
-            throw new MojoExecutionException("Base run mode should contain exactly one artifact.");
+        org.apache.sling.provisioning.model.Artifact firstArtifact = null;
+        for(final org.apache.sling.provisioning.model.Artifact a : runMode.getArtifactGroups().get(0))
{
+            if ( firstArtifact == null ) {
+                firstArtifact = a;
+            } else {
+                throw new MojoExecutionException("Base run mode should contain exactly one
artifact.");
+            }
         }
-        return runMode.getArtifactGroups().get(0).getArtifacts().get(0);
+        return firstArtifact;
     }
 
     /**

Modified: sling/trunk/tooling/maven/slingstart-maven-plugin/src/main/java/org/apache/sling/maven/slingstart/PreparePackageMojo.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/maven/slingstart-maven-plugin/src/main/java/org/apache/sling/maven/slingstart/PreparePackageMojo.java?rev=1628760&r1=1628759&r2=1628760&view=diff
==============================================================================
--- sling/trunk/tooling/maven/slingstart-maven-plugin/src/main/java/org/apache/sling/maven/slingstart/PreparePackageMojo.java
(original)
+++ sling/trunk/tooling/maven/slingstart-maven-plugin/src/main/java/org/apache/sling/maven/slingstart/PreparePackageMojo.java
Wed Oct  1 16:38:22 2014
@@ -125,7 +125,7 @@ public class PreparePackageMojo extends 
             unpackBaseArtifact(model, outputDir, ModelConstants.RUN_MODE_WEBAPP);
 
             // check for web.xml
-            final Feature webappF = model.findFeature(ModelConstants.FEATURE_LAUNCHPAD);
+            final Feature webappF = model.getFeature(ModelConstants.FEATURE_LAUNCHPAD);
             if ( webappF != null ) {
                 final RunMode webappRM = webappF.getRunMode(null);
                 if ( webappRM != null ) {
@@ -181,11 +181,11 @@ public class PreparePackageMojo extends 
      */
     private void buildContentsMap(final Model model, final RunMode runMode, final Map<String,
File> contentsMap, final boolean isBoot)
     throws MojoExecutionException{
-        for(final ArtifactGroup sl : runMode.getArtifactGroups()) {
-            for(final org.apache.sling.provisioning.model.Artifact a : sl.getArtifacts())
{
+        for(final ArtifactGroup group : runMode.getArtifactGroups()) {
+            for(final org.apache.sling.provisioning.model.Artifact a : group) {
                 final Artifact artifact = ModelUtils.getArtifact(this.project, a.getGroupId(),
a.getArtifactId(), a.getVersion(), a.getType(), a.getClassifier());
                 final File artifactFile = artifact.getFile();
-                contentsMap.put(getPathForArtifact(sl.getLevel(), artifactFile.getName(),
runMode, isBoot), artifactFile);
+                contentsMap.put(getPathForArtifact(group.getStartLevel(), artifactFile.getName(),
runMode, isBoot), artifactFile);
             }
         }
 
@@ -223,24 +223,30 @@ public class PreparePackageMojo extends 
     private void buildSettings(final Model model, final String packageRunMode, final File
outputDir)
     throws MojoExecutionException {
         final Properties settings = new Properties();
-        final Feature launchpadFeature = model.findFeature(ModelConstants.FEATURE_LAUNCHPAD);
+        final Feature launchpadFeature = model.getFeature(ModelConstants.FEATURE_LAUNCHPAD);
         if ( launchpadFeature != null ) {
             final RunMode launchpadRunMode = launchpadFeature.getRunMode(null);
             if ( launchpadRunMode != null ) {
-                settings.putAll(launchpadRunMode.getSettings());
+                for(final Map.Entry<String, String> entry : launchpadRunMode.getSettings())
{
+                    settings.put(entry.getKey(), entry.getValue());
+                }
             }
         }
-        final Feature bootFeature = model.findFeature(ModelConstants.FEATURE_BOOT);
+        final Feature bootFeature = model.getFeature(ModelConstants.FEATURE_BOOT);
         if ( bootFeature != null ) {
             final RunMode bootRunMode = bootFeature.getRunMode(null);
             if ( bootRunMode != null ) {
-                settings.putAll(bootRunMode.getSettings());
+                for(final Map.Entry<String, String> entry : bootRunMode.getSettings())
{
+                    settings.put(entry.getKey(), entry.getValue());
+                }
             }
         }
         for(final Feature f : model.getFeatures()) {
             final RunMode packageRM = f.getRunMode(new String[] {packageRunMode});
             if ( packageRM != null ) {
-                settings.putAll(packageRM.getSettings());
+                for(final Map.Entry<String, String> entry : packageRM.getSettings())
{
+                    settings.put(entry.getKey(), entry.getValue());
+                }
             }
         }
 
@@ -266,7 +272,7 @@ public class PreparePackageMojo extends 
     throws MojoExecutionException {
         final StringBuilder sb = new StringBuilder();
 
-        final Feature launchpadFeature = model.findFeature(ModelConstants.FEATURE_LAUNCHPAD);
+        final Feature launchpadFeature = model.getFeature(ModelConstants.FEATURE_LAUNCHPAD);
         if ( launchpadFeature != null ) {
             final RunMode launchpadRunMode = launchpadFeature.getRunMode(null);
             if ( launchpadRunMode != null ) {
@@ -361,8 +367,8 @@ public class PreparePackageMojo extends 
      */
     private String getPathForArtifact(final int startLevel, final String artifactName, final
RunMode rm, final boolean isBoot) {
         final Set<String> runModesList = new TreeSet<String>();
-        if (rm.getRunModes() != null ) {
-            for(final String mode : rm.getRunModes()) {
+        if (rm.getNames() != null ) {
+            for(final String mode : rm.getNames()) {
                 runModesList.add(mode);
             }
         }
@@ -393,8 +399,8 @@ public class PreparePackageMojo extends 
      */
     private String getPathForConfiguration(final Configuration config, final RunMode rm)
{
         final Set<String> runModesList = new TreeSet<String>();
-        if (rm.getRunModes() != null ) {
-            for(final String mode : rm.getRunModes()) {
+        if (rm.getNames() != null ) {
+            for(final String mode : rm.getNames()) {
                 runModesList.add(mode);
             }
         }



Mime
View raw message