You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2014/09/25 08:09:08 UTC
svn commit: r1627462 - in
/sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model:
./ txt/ xml/
Author: cziegeler
Date: Thu Sep 25 06:09:08 2014
New Revision: 1627462
URL: http://svn.apache.org/r1627462
Log:
Simplify model, move completely to getter/setter methods
Removed:
sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/SSMSettings.java
Modified:
sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/SSMArtifact.java
sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/SSMConfiguration.java
sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/SSMDeliverable.java
sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/SSMFeature.java
sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/SSMStartLevel.java
sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/txt/TXTSSMModelReader.java
sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/xml/XMLSSMModelReader.java
sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/xml/XMLSSMModelWriter.java
Modified: sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/SSMArtifact.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/SSMArtifact.java?rev=1627462&r1=1627461&r2=1627462&view=diff
==============================================================================
--- sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/SSMArtifact.java (original)
+++ sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/SSMArtifact.java Thu Sep 25 06:09:08 2014
@@ -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
Modified: sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/SSMConfiguration.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/SSMConfiguration.java?rev=1627462&r1=1627461&r2=1627462&view=diff
==============================================================================
--- sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/SSMConfiguration.java (original)
+++ sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/SSMConfiguration.java Thu Sep 25 06:09:08 2014
@@ -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
Modified: sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/SSMDeliverable.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/SSMDeliverable.java?rev=1627462&r1=1627461&r2=1627462&view=diff
==============================================================================
--- sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/SSMDeliverable.java (original)
+++ sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/SSMDeliverable.java Thu Sep 25 06:09:08 2014
@@ -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 + "]";
}
}
Modified: sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/SSMFeature.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/SSMFeature.java?rev=1627462&r1=1627461&r2=1627462&view=diff
==============================================================================
--- sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/SSMFeature.java (original)
+++ sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/SSMFeature.java Thu Sep 25 06:09:08 2014
@@ -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 Compa
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 Compa
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 Compa
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 Compa
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 Compa
return this.configurations;
}
- public SSMSettings getSettings() {
+ public Map<String, String> getSettings() {
return this.settings;
}
@@ -273,8 +264,4 @@ public class SSMFeature implements Compa
+ ", startLevels=" + startLevels + ", configurations="
+ configurations + ", settings=" + settings + "]";
}
-
- public void setSettings(final SSMSettings ssmSettings) {
- this.settings = ssmSettings;
- }
}
Modified: sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/SSMStartLevel.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/SSMStartLevel.java?rev=1627462&r1=1627461&r2=1627462&view=diff
==============================================================================
--- sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/SSMStartLevel.java (original)
+++ sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/SSMStartLevel.java Thu Sep 25 06:09:08 2014
@@ -27,7 +27,7 @@ public class SSMStartLevel implements Co
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 Co
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 Co
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;
}
Modified: sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/txt/TXTSSMModelReader.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/txt/TXTSSMModelReader.java?rev=1627462&r1=1627461&r2=1627462&view=diff
==============================================================================
--- sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/txt/TXTSSMModelReader.java (original)
+++ sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/txt/TXTSSMModelReader.java Thu Sep 25 06:09:08 2014
@@ -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));
}
}
}
Modified: sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/xml/XMLSSMModelReader.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/xml/XMLSSMModelReader.java?rev=1627462&r1=1627461&r2=1627462&view=diff
==============================================================================
--- sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/xml/XMLSSMModelReader.java (original)
+++ sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/xml/XMLSSMModelReader.java Thu Sep 25 06:09:08 2014
@@ -34,7 +34,6 @@ import org.apache.sling.slingstart.model
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);
Modified: sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/xml/XMLSSMModelWriter.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/xml/XMLSSMModelWriter.java?rev=1627462&r1=1627461&r2=1627462&view=diff
==============================================================================
--- sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/xml/XMLSSMModelWriter.java (original)
+++ sling/trunk/tooling/support/slingstart-model/src/main/java/org/apache/sling/slingstart/model/xml/XMLSSMModelWriter.java Thu Sep 25 06:09:08 2014
@@ -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>");
}