Use provisioning model

git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1628760 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/pom.xml b/pom.xml
index 1e898ec..8abaf1d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -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>
diff --git a/src/main/java/org/apache/sling/maven/slingstart/DependencyLifecycleParticipant.java b/src/main/java/org/apache/sling/maven/slingstart/DependencyLifecycleParticipant.java
index da31e74..3d16ab3 100644
--- a/src/main/java/org/apache/sling/maven/slingstart/DependencyLifecycleParticipant.java
+++ b/src/main/java/org/apache/sling/maven/slingstart/DependencyLifecycleParticipant.java
@@ -146,8 +146,8 @@
                 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());
diff --git a/src/main/java/org/apache/sling/maven/slingstart/ModelUtils.java b/src/main/java/org/apache/sling/maven/slingstart/ModelUtils.java
index bfc51e7..b364785 100644
--- a/src/main/java/org/apache/sling/maven/slingstart/ModelUtils.java
+++ b/src/main/java/org/apache/sling/maven/slingstart/ModelUtils.java
@@ -145,7 +145,7 @@
     }
 
     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 @@
         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;
     }
 
     /**
diff --git a/src/main/java/org/apache/sling/maven/slingstart/PreparePackageMojo.java b/src/main/java/org/apache/sling/maven/slingstart/PreparePackageMojo.java
index 6145b8d..1da050e 100644
--- a/src/main/java/org/apache/sling/maven/slingstart/PreparePackageMojo.java
+++ b/src/main/java/org/apache/sling/maven/slingstart/PreparePackageMojo.java
@@ -125,7 +125,7 @@
             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 @@
      */
     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 @@
     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 @@
     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 @@
      */
     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 @@
      */
     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);
             }
         }