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/11/07 09:57:05 UTC

[sling-org-apache-sling-provisioning-model] 09/34: Simplify model, move completely to getter/setter methods

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

rombert pushed a commit to annotated tag org.apache.sling.provisioning.model-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-provisioning-model.git

commit 75a411c2758b5d93ac20e331bf5b175c7cd2ffdb
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Thu Sep 25 06:09:08 2014 +0000

    Simplify model, move completely to getter/setter methods
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/tooling/support/slingstart-model@1627462 13f79535-47bb-0310-9956-ffa450edef68
---
 .../apache/sling/slingstart/model/SSMArtifact.java | 193 +++++++++++++++------
 .../sling/slingstart/model/SSMConfiguration.java   |  21 ++-
 .../sling/slingstart/model/SSMDeliverable.java     |  26 +--
 .../apache/sling/slingstart/model/SSMFeature.java  |  29 +---
 .../apache/sling/slingstart/model/SSMSettings.java |  53 ------
 .../sling/slingstart/model/SSMStartLevel.java      |  14 +-
 .../slingstart/model/txt/TXTSSMModelReader.java    |  10 +-
 .../slingstart/model/xml/XMLSSMModelReader.java    |  28 ++-
 .../slingstart/model/xml/XMLSSMModelWriter.java    |  38 ++--
 9 files changed, 231 insertions(+), 181 deletions(-)

diff --git a/src/main/java/org/apache/sling/slingstart/model/SSMArtifact.java b/src/main/java/org/apache/sling/slingstart/model/SSMArtifact.java
index e84485b..d05e8ff 100644
--- a/src/main/java/org/apache/sling/slingstart/model/SSMArtifact.java
+++ b/src/main/java/org/apache/sling/slingstart/model/SSMArtifact.java
@@ -16,19 +16,38 @@
  */
 package org.apache.sling.slingstart.model;
 
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * Description of an artifact.
+ * An artifact is described by it's Apache Maven coordinates consisting of group id, artifact id, and version.
+ * In addition, the classifier and type can be specified as well.
+ * An artifact can have any metadata.
  */
 public class SSMArtifact {
 
-    public final String groupId;
-    public final String artifactId;
-    public final String version;
-    public final String classifier;
-    public final String type;
+    private final String groupId;
+    private final String artifactId;
+    private final String version;
+    private final String classifier;
+    private final String type;
+
+    private final Map<String, String> metadata = new HashMap<String, String>();
 
-    public SSMArtifact(final String gId, final String aId, final String version,
-            final String classifier, final String type) {
+    /**
+     * Create a new artifact object
+     * @param gId   The group id (required)
+     * @param aId   The artifact id (required)
+     * @param version The version (required)
+     * @param classifier The classifier (optional)
+     * @param type The type/extension (optional, defaults to jar)
+     */
+    public SSMArtifact(final String gId,
+            final String aId,
+            final String version,
+            final String classifier,
+            final String type) {
         this.groupId = (gId != null ? gId.trim() : null);
         this.artifactId = (aId != null ? aId.trim() : null);
         this.version = (version != null ? version.trim() : null);
@@ -46,59 +65,23 @@ public class SSMArtifact {
         }
     }
 
-    public String getRepositoryPath() {
-        final StringBuilder sb = new StringBuilder();
-        sb.append(groupId.replace('.', '/'));
-        sb.append('/');
-        sb.append(artifactId);
-        sb.append('/');
-        sb.append(version);
-        sb.append('/');
-        sb.append(artifactId);
-        sb.append('-');
-        sb.append(version);
-        if ( classifier != null ) {
-            sb.append('-');
-            sb.append(classifier);
-        }
-        sb.append('.');
-        sb.append(type);
-        return sb.toString();
-    }
-
     /**
-     * validates the object and throws an IllegalStateException
-     * This object needs:
-     * - groupId
-     * - artifactId
-     * - version
-     * If type is null, it's set to "jar"
-     * If type is "bundle", it's set to "jar"
-     * - classifier is optional
-     *
-     * @throws IllegalStateException
+     * Create a new artifact from a maven url,
+     * 'mvn:' [ repository-url '!' ] group-id '/' artifact-id [ '/' [version] [ '/' [type] [ '/' classifier ] ] ] ]
+     * @param url The url
+     * @return A new artifact
+     * @throws IllegalArgumentException If the url is not valid
      */
-    public void validate() {
-        // check/correct values
-        if ( groupId == null || groupId.isEmpty() ) {
-            throw new IllegalStateException(this + " : groupId");
-        }
-        if ( artifactId == null || artifactId.isEmpty() ) {
-            throw new IllegalStateException(this + " : artifactId");
-        }
-        if ( version == null || version.isEmpty() ) {
-            throw new IllegalStateException(this + " : version");
-        }
-        if ( type == null || type.isEmpty() ) {
-            throw new IllegalStateException(this + " : type");
-        }
-    }
-
     public static SSMArtifact fromMvnUrl(final String url) {
-        // 'mvn:' [ repository-url '!' ] group-id '/' artifact-id [ '/' [version] [ '/' [type] [ '/' classifier ] ] ] ]
+        if ( url == null || !url.startsWith("mvn:") ) {
+            throw new IllegalArgumentException("Invalid mvn url: " + url);
+        }
         final String content = url.substring(4);
         // ignore repository url
         int pos = content.indexOf('!');
+        if ( pos != -1 ) {
+            throw new IllegalArgumentException("Repository url is not supported for Maven artifacts at the moment.");
+        }
         final String coordinates = (pos == -1 ? content : content.substring(pos + 1));
         String gId = null;
         String aId = null;
@@ -139,8 +122,106 @@ public class SSMArtifact {
         if ( version == null ) {
             version = "LATEST";
         }
-        final SSMArtifact ad = new SSMArtifact(gId, aId, version, classifier, type);
-        return ad;
+        return new SSMArtifact(gId, aId, version, classifier, type);
+    }
+
+    /**
+     * Return the group id.
+     * @return The group id.
+     */
+    public String getGroupId() {
+        return groupId;
+    }
+
+    /**
+     * Return the artifact id.
+     * @return The artifact id.
+     */
+    public String getArtifactId() {
+        return artifactId;
+    }
+
+    /**
+     * Return the version.
+     * @return The version.
+     */
+    public String getVersion() {
+        return version;
+    }
+
+    /**
+     * Return the optional classifier.
+     * @return The classifier or null.
+     */
+    public String getClassifier() {
+        return classifier;
+    }
+
+    /**
+     * Return the type.
+     * @return The type.
+     */
+    public String getType() {
+        return type;
+    }
+
+    /**
+     * Get the metadata of the artifact.
+     * @return The metadata.
+     */
+    public Map<String, String> getMetadata() {
+        return this.metadata;
+    }
+
+    /**
+     * Create a Maven like relative repository path.
+     */
+    public String getRepositoryPath() {
+        final StringBuilder sb = new StringBuilder();
+        sb.append(groupId.replace('.', '/'));
+        sb.append('/');
+        sb.append(artifactId);
+        sb.append('/');
+        sb.append(version);
+        sb.append('/');
+        sb.append(artifactId);
+        sb.append('-');
+        sb.append(version);
+        if ( classifier != null ) {
+            sb.append('-');
+            sb.append(classifier);
+        }
+        sb.append('.');
+        sb.append(type);
+        return sb.toString();
+    }
+
+    /**
+     * Validates the object and throws an IllegalStateException
+     * This object needs:
+     * - groupId
+     * - artifactId
+     * - version
+     * If type is null, it's set to "jar"
+     * If type is "bundle", it's set to "jar"
+     * - classifier is optional
+     *
+     * @throws IllegalStateException
+     */
+    public void validate() {
+        // check/correct values
+        if ( groupId == null || groupId.isEmpty() ) {
+            throw new IllegalStateException(this + " : groupId");
+        }
+        if ( artifactId == null || artifactId.isEmpty() ) {
+            throw new IllegalStateException(this + " : artifactId");
+        }
+        if ( version == null || version.isEmpty() ) {
+            throw new IllegalStateException(this + " : version");
+        }
+        if ( type == null || type.isEmpty() ) {
+            throw new IllegalStateException(this + " : type");
+        }
     }
 
     @Override
diff --git a/src/main/java/org/apache/sling/slingstart/model/SSMConfiguration.java b/src/main/java/org/apache/sling/slingstart/model/SSMConfiguration.java
index 1539c35..3a3f0a0 100644
--- a/src/main/java/org/apache/sling/slingstart/model/SSMConfiguration.java
+++ b/src/main/java/org/apache/sling/slingstart/model/SSMConfiguration.java
@@ -36,10 +36,19 @@ public class SSMConfiguration {
         this.factoryPid = (factoryPid != null ? factoryPid.trim() : null);
     }
 
+    /**
+     * Get the pid.
+     * If this is a factory configuration, it returns the alias for the configuration
+     * @return The pid.
+     */
     public String getPid() {
         return this.pid;
     }
 
+    /**
+     * Return the factory pid
+     * @return The factory pid or null.
+     */
     public String getFactoryPid() {
         return this.factoryPid;
     }
@@ -63,6 +72,10 @@ public class SSMConfiguration {
         }
     }
 
+    /**
+     * Is this a special configuration?
+     * @return Special config
+     */
     public boolean isSpecial() {
         if ( pid != null && pid.startsWith(":") ) {
             return true;
@@ -70,14 +83,14 @@ public class SSMConfiguration {
         return false;
     }
 
+    /**
+     * Get all properties of the configuration.
+     * @return The properties
+     */
     public Dictionary<String, Object> getProperties() {
         return this.properties;
     }
 
-    public void addProperty(final String key, final Object value) {
-        this.properties.put(key, value);
-    }
-
     @Override
     public String toString() {
         return "SSMConfiguration [pid=" + pid + ", factoryPid=" + factoryPid
diff --git a/src/main/java/org/apache/sling/slingstart/model/SSMDeliverable.java b/src/main/java/org/apache/sling/slingstart/model/SSMDeliverable.java
index e7b28bc..1960d24 100644
--- a/src/main/java/org/apache/sling/slingstart/model/SSMDeliverable.java
+++ b/src/main/java/org/apache/sling/slingstart/model/SSMDeliverable.java
@@ -26,8 +26,8 @@ import java.util.Map;
 /**
  * A deliverable is the central object.
  * It consists of a set of features and properties.
- * The properties can be used for specifying artifact versions, referencing them
- * with ${propertyName}
+ * The variables can be used for specifying artifact versions, referencing them
+ * with ${variableName}
  *
  * At least it has a "global" feature which contains artifacts that are always installed..
  */
@@ -35,7 +35,7 @@ public class SSMDeliverable {
 
     private final List<SSMFeature> features = new ArrayList<SSMFeature>();
 
-    private Map<String, String> properties = new HashMap<String, String>();
+    private final Map<String, String> variables = new HashMap<String, String>();
 
     public SSMDeliverable() {
         this.features.add(new SSMFeature(null)); // global features
@@ -111,7 +111,7 @@ public class SSMDeliverable {
                     start = pos + 1;
                 } else {
                     final String name = msg.substring(pos + 2, endPos);
-                    final String value = this.properties.get(name);
+                    final String value = this.variables.get(name);
                     if ( value == null ) {
                         throw new IllegalArgumentException("Unknown variable: " + name);
                     }
@@ -132,20 +132,20 @@ public class SSMDeliverable {
             final SSMFeature mergeFeature = this.getOrCreateFeature(mode.getRunModes());
             mergeFeature.merge(mode);
         }
-        this.properties.putAll(other.properties);
+        this.variables.putAll(other.variables);
     }
 
-    public Map<String, String> getProperties() {
-        return this.properties;
-    }
-
-    public void addProperty(final String key, final String value) {
-        this.properties.put(key, value);
+    /**
+     * Get all variables
+     * @return The set of variables
+     */
+    public Map<String, String> getVariables() {
+        return this.variables;
     }
 
     @Override
     public String toString() {
-        return "SSMDeliverable [features=" + features + ", properties="
-                + properties + "]";
+        return "SSMDeliverable [features=" + features + ", variables="
+                + variables + "]";
     }
 }
diff --git a/src/main/java/org/apache/sling/slingstart/model/SSMFeature.java b/src/main/java/org/apache/sling/slingstart/model/SSMFeature.java
index 26f0bcb..86f7a81 100644
--- a/src/main/java/org/apache/sling/slingstart/model/SSMFeature.java
+++ b/src/main/java/org/apache/sling/slingstart/model/SSMFeature.java
@@ -20,7 +20,9 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.Enumeration;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 /**
@@ -50,7 +52,7 @@ public class SSMFeature implements Comparable<SSMFeature> {
 
     private final List<SSMConfiguration> configurations = new ArrayList<SSMConfiguration>();
 
-    private SSMSettings settings;
+    private final Map<String, String> settings = new HashMap<String, String>();
 
     public SSMFeature(final String[] runModes) {
         this.runModes = getSortedRunModesArray(runModes);
@@ -102,12 +104,6 @@ public class SSMFeature implements Comparable<SSMFeature> {
         for(final SSMConfiguration c : this.configurations) {
             c.validate();
         }
-        if( settings != null ) {
-            if (!this.isSpecial() ) {
-                throw new IllegalStateException("Settings not allowed for custom run modes");
-            }
-            settings.validate();
-        }
     }
 
     /**
@@ -173,14 +169,14 @@ public class SSMFeature implements Comparable<SSMFeature> {
     public void merge(final SSMFeature mode) {
         for(final SSMStartLevel sl : mode.startLevels) {
             // search for duplicates in other start levels
-            for(final SSMArtifact artifact : sl.artifacts) {
+            for(final SSMArtifact artifact : sl.getArtifacts()) {
                 for(final SSMStartLevel mySL : this.startLevels) {
                     if ( mySL.getLevel() == sl.getLevel() ) {
                         continue;
                     }
                     final SSMArtifact myArtifact = mySL.search(artifact);
                     if ( myArtifact != null ) {
-                        mySL.artifacts.remove(myArtifact);
+                        mySL.getArtifacts().remove(myArtifact);
                     }
                 }
             }
@@ -193,15 +189,10 @@ public class SSMFeature implements Comparable<SSMFeature> {
             final Enumeration<String> e = config.getProperties().keys();
             while ( e.hasMoreElements() ) {
                 final String key = e.nextElement();
-                found.addProperty(key, config.getProperties().get(key));
+                found.getProperties().put(key, config.getProperties().get(key));
             }
         }
-        if ( this.settings == null && mode.settings != null ) {
-            this.settings = new SSMSettings();
-        }
-        if ( mode.settings != null ) {
-            this.settings.merge(mode.settings);
-        }
+        this.settings.putAll(mode.settings);
     }
 
     /**
@@ -246,7 +237,7 @@ public class SSMFeature implements Comparable<SSMFeature> {
         return this.configurations;
     }
 
-    public SSMSettings getSettings() {
+    public Map<String, String> getSettings() {
         return this.settings;
     }
 
@@ -273,8 +264,4 @@ public class SSMFeature implements Comparable<SSMFeature> {
                 + ", startLevels=" + startLevels + ", configurations="
                 + configurations + ", settings=" + settings + "]";
     }
-
-    public void setSettings(final SSMSettings ssmSettings) {
-        this.settings = ssmSettings;
-    }
 }
diff --git a/src/main/java/org/apache/sling/slingstart/model/SSMSettings.java b/src/main/java/org/apache/sling/slingstart/model/SSMSettings.java
deleted file mode 100644
index 69b6185..0000000
--- a/src/main/java/org/apache/sling/slingstart/model/SSMSettings.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.sling.slingstart.model;
-
-
-/**
- * The settings of a feature.
- */
-public class SSMSettings {
-
-    public String properties;
-
-    /**
-     * validates the object and throws an IllegalStateException
-     * This object needs:
-     * - properties (non empty)
-     *
-     * @throws IllegalStateException
-     */
-    public void validate() {
-        // check/correct values
-        if ( properties == null || properties.isEmpty() ) {
-            throw new IllegalStateException("settings");
-        }
-    }
-
-    public void merge(final SSMSettings other) {
-        if ( this.properties == null ) {
-            this.properties = other.properties;
-        } else {
-            this.properties = this.properties + "\n" + other.properties;
-        }
-    }
-
-    @Override
-    public String toString() {
-        return "SSMSettings [properties=" + properties + "]";
-    }
-}
diff --git a/src/main/java/org/apache/sling/slingstart/model/SSMStartLevel.java b/src/main/java/org/apache/sling/slingstart/model/SSMStartLevel.java
index 57f0de1..ce2e08b 100644
--- a/src/main/java/org/apache/sling/slingstart/model/SSMStartLevel.java
+++ b/src/main/java/org/apache/sling/slingstart/model/SSMStartLevel.java
@@ -27,7 +27,7 @@ public class SSMStartLevel implements Comparable<SSMStartLevel> {
 
     private final int level;
 
-    public final List<SSMArtifact> artifacts = new ArrayList<SSMArtifact>();
+    private final List<SSMArtifact> artifacts = new ArrayList<SSMArtifact>();
 
     public SSMStartLevel(final int level) {
         this.level = level;
@@ -37,6 +37,10 @@ public class SSMStartLevel implements Comparable<SSMStartLevel> {
         return this.level;
     }
 
+    public List<SSMArtifact> getArtifacts() {
+        return this.artifacts;
+    }
+
     /**
      * validates the object and throws an IllegalStateException
      *
@@ -58,10 +62,10 @@ public class SSMStartLevel implements Comparable<SSMStartLevel> {
     public SSMArtifact search(final SSMArtifact template) {
         SSMArtifact found = null;
         for(final SSMArtifact current : this.artifacts) {
-            if ( current.groupId.equals(template.groupId)
-              && current.artifactId.equals(template.artifactId)
-              && current.classifier.equals(template.classifier)
-              && current.type.equals(template.type) ) {
+            if ( current.getGroupId().equals(template.getGroupId())
+              && current.getArtifactId().equals(template.getArtifactId())
+              && current.getClassifier().equals(template.getClassifier())
+              && current.getType().equals(template.getType()) ) {
                 found = current;
                 break;
             }
diff --git a/src/main/java/org/apache/sling/slingstart/model/txt/TXTSSMModelReader.java b/src/main/java/org/apache/sling/slingstart/model/txt/TXTSSMModelReader.java
index 41b8eb6..9c2f9c0 100644
--- a/src/main/java/org/apache/sling/slingstart/model/txt/TXTSSMModelReader.java
+++ b/src/main/java/org/apache/sling/slingstart/model/txt/TXTSSMModelReader.java
@@ -85,11 +85,11 @@ public class TXTSSMModelReader {
             if ( "classpath".equals("verb") ) {
                 final SSMFeature boot = model.getOrCreateFeature(new String[] {SSMFeature.RUN_MODE_BOOT});
                 final SSMArtifact artifact = SSMArtifact.fromMvnUrl(qualifier);
-                boot.getOrCreateStartLevel(0).artifacts.add(artifact);
+                boot.getOrCreateStartLevel(0).getArtifacts().add(artifact);
             } else if ( "bundle".equals(verb) ) {
                 final SSMFeature feature = model.getOrCreateFeature(null);
                 final SSMArtifact artifact = SSMArtifact.fromMvnUrl(qualifier);
-                feature.getOrCreateStartLevel(0).artifacts.add(artifact);
+                feature.getOrCreateStartLevel(0).getArtifacts().add(artifact);
             } else if ( "config".equals(verb) ) {
                 final SSMFeature feature = model.getOrCreateFeature(null);
                 boolean felixFormat = false;
@@ -137,7 +137,7 @@ public class TXTSSMModelReader {
                 final Enumeration<String> e = props.keys();
                 while ( e.hasMoreElements() ) {
                     final String key = e.nextElement();
-                    config.addProperty(key, props.get(key));
+                    config.getProperties().put(key, props.get(key));
                 }
             } finally {
                 if ( bais != null ) {
@@ -149,13 +149,13 @@ public class TXTSSMModelReader {
                 }
             }
         } else if ( config.isSpecial() ) {
-            config.addProperty(config.getPid(), textValue);
+            config.getProperties().put(config.getPid(), textValue);
         } else {
             final LineNumberReader lnr = new LineNumberReader(new StringReader(textValue));
             String line;
             while ( (line = lnr.readLine()) != null ) {
                 final int pos = line.indexOf('=');
-                config.addProperty(line.substring(0, pos), line.substring(pos + 1));
+                config.getProperties().put(line.substring(0, pos), line.substring(pos + 1));
             }
         }
     }
diff --git a/src/main/java/org/apache/sling/slingstart/model/xml/XMLSSMModelReader.java b/src/main/java/org/apache/sling/slingstart/model/xml/XMLSSMModelReader.java
index 3045e50..08b975a 100644
--- a/src/main/java/org/apache/sling/slingstart/model/xml/XMLSSMModelReader.java
+++ b/src/main/java/org/apache/sling/slingstart/model/xml/XMLSSMModelReader.java
@@ -34,7 +34,6 @@ import org.apache.sling.slingstart.model.SSMArtifact;
 import org.apache.sling.slingstart.model.SSMConfiguration;
 import org.apache.sling.slingstart.model.SSMDeliverable;
 import org.apache.sling.slingstart.model.SSMFeature;
-import org.apache.sling.slingstart.model.SSMSettings;
 import org.xml.sax.Attributes;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.InputSource;
@@ -52,7 +51,7 @@ public class XMLSSMModelReader {
         INIT(null, null),
         DELIVERABLE(INIT, "deliverable"),
 
-        PROPERTIES(DELIVERABLE, "properties"),
+        VARIABKES(DELIVERABLE, "variables"),
 
         STARTLEVEL(DELIVERABLE, "startLevel"),
         ARTIFACT(DELIVERABLE, "artifact"),
@@ -157,7 +156,7 @@ public class XMLSSMModelReader {
                                         atts.getValue("version"),
                                         atts.getValue("classifier"),
                                         atts.getValue("type"));
-                                this.feature.getOrCreateStartLevel(this.startLevel).artifacts.add(artifact);
+                                this.feature.getOrCreateStartLevel(this.startLevel).getArtifacts().add(artifact);
                             } else if ( this.mode == MODE.CONFIGURATION || this.mode == MODE.FEATURE_CONFIGURATION) {
                                 this.configuration = this.feature.getOrCreateConfiguration(atts.getValue("pid"), atts.getValue("factory"));
                                 this.text = new StringBuilder();
@@ -165,7 +164,6 @@ public class XMLSSMModelReader {
                                 if ( this.feature.getSettings() != null ) {
                                     throw new SAXException("Duplicate settings section");
                                 }
-                                this.feature.setSettings(new SSMSettings());
                                 this.text = new StringBuilder();
 
                             } else if ( this.mode == MODE.FEATURE ) {
@@ -216,7 +214,7 @@ public class XMLSSMModelReader {
                             this.startLevel = 0;
                         } else if ( prevMode == MODE.CONFIGURATION || prevMode == MODE.FEATURE_CONFIGURATION ) {
                             if ( this.configuration.isSpecial() ) {
-                                this.configuration.addProperty(this.configuration.getPid(), textValue);
+                                this.configuration.getProperties().put(this.configuration.getPid(), textValue);
                             } else {
                                 ByteArrayInputStream bais = null;
                                 try {
@@ -226,7 +224,7 @@ public class XMLSSMModelReader {
                                     final Enumeration<String> e = props.keys();
                                     while ( e.hasMoreElements() ) {
                                         final String key = e.nextElement();
-                                        this.configuration.addProperty(key, props.get(key));
+                                        this.configuration.getProperties().put(key, props.get(key));
                                     }
                                 } catch ( final IOException ioe ) {
                                     throw new SAXException(ioe);
@@ -242,11 +240,23 @@ public class XMLSSMModelReader {
                             }
                             this.configuration = null;
                         } else if ( prevMode == MODE.SETTINGS || prevMode == MODE.FEATURE_SETTINGS) {
-                            this.feature.getSettings().properties = textValue;
+                            final LineNumberReader reader = new LineNumberReader(new StringReader(textValue));
+                            String line = null;
+                            try {
+                                while ( (line = reader.readLine()) != null ) {
+                                    final int pos = line.indexOf("=");
+                                    if ( pos == -1 || line.indexOf("=", pos + 1 ) != -1 ) {
+                                        throw new SAXException("Invalid property definition: " + line);
+                                    }
+                                    feature.getSettings().put(line.substring(0, pos), line.substring(pos + 1));
+                                }
+                            } catch (final IOException io) {
+                                throw new SAXException(io);
+                            }
                         } else if ( prevMode == MODE.FEATURE ) {
                             this.feature = result.getOrCreateFeature(null);
                             this.startLevel = 0;
-                        } else if ( prevMode == MODE.PROPERTIES ) {
+                        } else if ( prevMode == MODE.VARIABKES ) {
                             final LineNumberReader reader = new LineNumberReader(new StringReader(textValue));
                             String line = null;
                             try {
@@ -255,7 +265,7 @@ public class XMLSSMModelReader {
                                     if ( pos == -1 || line.indexOf("=", pos + 1 ) != -1 ) {
                                         throw new SAXException("Invalid property definition: " + line);
                                     }
-                                    result.addProperty(line.substring(0, pos), line.substring(pos + 1));
+                                    result.getVariables().put(line.substring(0, pos), line.substring(pos + 1));
                                 }
                             } catch (final IOException io) {
                                 throw new SAXException(io);
diff --git a/src/main/java/org/apache/sling/slingstart/model/xml/XMLSSMModelWriter.java b/src/main/java/org/apache/sling/slingstart/model/xml/XMLSSMModelWriter.java
index 2881527..5d13094 100644
--- a/src/main/java/org/apache/sling/slingstart/model/xml/XMLSSMModelWriter.java
+++ b/src/main/java/org/apache/sling/slingstart/model/xml/XMLSSMModelWriter.java
@@ -68,10 +68,10 @@ public class XMLSSMModelWriter {
         pw.println("<deliverable>");
 
         // properties
-        if ( subsystem.getProperties().size() > 0 ) {
+        if ( subsystem.getVariables().size() > 0 ) {
             pw.print(INDENT);
-            pw.println("<properties><![CDATA[");
-            for(final Map.Entry<String, String> entry : subsystem.getProperties().entrySet()) {
+            pw.println("<variables><![CDATA[");
+            for(final Map.Entry<String, String> entry : subsystem.getVariables().entrySet()) {
                 pw.print(INDENT);
                 pw.print(INDENT);
                 pw.print(entry.getKey());
@@ -79,7 +79,7 @@ public class XMLSSMModelWriter {
                 pw.println(entry.getValue());
             }
             pw.print(INDENT);
-            pw.println("]]></properties>");
+            pw.println("]]></variables>");
         }
         for(final SSMFeature feature : subsystem.getFeatures()) {
             // TODO - don't write out empty features
@@ -93,7 +93,7 @@ public class XMLSSMModelWriter {
             }
 
             for(final SSMStartLevel startLevel : feature.getStartLevels()) {
-                if ( startLevel.artifacts.size() == 0 ) {
+                if ( startLevel.getArtifacts().size() == 0 ) {
                     continue;
                 }
                 if ( startLevel.getLevel() != 0 ) {
@@ -105,23 +105,23 @@ public class XMLSSMModelWriter {
                     pw.println(">");
                     indent += INDENT;
                 }
-                for(final SSMArtifact ad : startLevel.artifacts) {
+                for(final SSMArtifact ad : startLevel.getArtifacts()) {
                     pw.print(indent);
                     pw.print("<artifact groupId=\"");
-                    pw.print(escapeXml(ad.groupId));
+                    pw.print(escapeXml(ad.getGroupId()));
                     pw.print("\" artifactId=\"");
-                    pw.print(escapeXml(ad.artifactId));
+                    pw.print(escapeXml(ad.getArtifactId()));
                     pw.print("\" version=\"");
-                    pw.print(escapeXml(ad.version));
+                    pw.print(escapeXml(ad.getVersion()));
                     pw.print("\"");
-                    if ( !"jar".equals(ad.type) ) {
+                    if ( !"jar".equals(ad.getType()) ) {
                         pw.print(" type=\"");
-                        pw.print(escapeXml(ad.type));
+                        pw.print(escapeXml(ad.getType()));
                         pw.print("\"");
                     }
-                    if ( ad.classifier != null ) {
+                    if ( ad.getClassifier() != null ) {
                         pw.print(" classifier=\"");
-                        pw.print(escapeXml(ad.classifier));
+                        pw.print(escapeXml(ad.getClassifier()));
                         pw.print("\"");
                     }
                     pw.println("/>");
@@ -160,10 +160,18 @@ public class XMLSSMModelWriter {
                 pw.println("]]></configuration>");
             }
 
-            if ( feature.getSettings() != null ) {
+            if ( feature.getSettings().size() > 0 ) {
                 pw.print(indent);
                 pw.println("<settings><![CDATA[");
-                pw.println(feature.getSettings().properties);
+
+                for(final Map.Entry<String, String> entry :feature.getSettings().entrySet()) {
+                    pw.print(INDENT);
+                    pw.print(INDENT);
+                    pw.print(entry.getKey());
+                    pw.print("=");
+                    pw.println(entry.getValue());
+                }
+
                 pw.print(indent);
                 pw.println("]]></settings>");
             }

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