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:19 UTC
[sling-org-apache-sling-provisioning-model] 23/34: Consistent
method naming and javadocs
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 98736d5714c8389b3a0ee1e587ef97db8a2e194a
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Oct 1 16:26:14 2014 +0000
Consistent method naming and javadocs
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/tooling/support/slingstart-model@1628753 13f79535-47bb-0310-9956-ffa450edef68
---
.../apache/sling/provisioning/model/Artifact.java | 9 +-
.../sling/provisioning/model/ArtifactGroup.java | 18 +++-
.../sling/provisioning/model/Commentable.java | 2 +-
.../sling/provisioning/model/Configuration.java | 15 ++-
.../apache/sling/provisioning/model/Feature.java | 23 +++--
.../apache/sling/provisioning/model/ItemList.java | 16 +++
.../sling/provisioning/model/KeyValueMap.java | 22 +++++
.../org/apache/sling/provisioning/model/Model.java | 4 +-
.../sling/provisioning/model/ModelConstants.java | 3 +-
.../sling/provisioning/model/ModelUtility.java | 40 +++++---
.../apache/sling/provisioning/model/RunMode.java | 109 +++++++++++++++------
.../sling/provisioning/model/io/ModelReader.java | 4 +-
.../sling/provisioning/model/io/ModelWriter.java | 6 +-
13 files changed, 202 insertions(+), 69 deletions(-)
diff --git a/src/main/java/org/apache/sling/provisioning/model/Artifact.java b/src/main/java/org/apache/sling/provisioning/model/Artifact.java
index 432c4bf..371ce2b 100644
--- a/src/main/java/org/apache/sling/provisioning/model/Artifact.java
+++ b/src/main/java/org/apache/sling/provisioning/model/Artifact.java
@@ -22,17 +22,23 @@ 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.
+ * In addition, the classifier and type can be specified as well. If no type is specified, "jar" is assumed.
* An artifact can have any metadata.
*/
public class Artifact extends Commentable {
+ /** The required group id. */
private final String groupId;
+ /** The required artifact id. */
private final String artifactId;
+ /** The required version. */
private final String version;
+ /** The optional classifier. */
private final String classifier;
+ /** The optional type. */
private final String type;
+ /** Artifact metadata. */
private final Map<String, String> metadata = new HashMap<String, String>();
/**
@@ -198,6 +204,7 @@ public class Artifact extends Commentable {
/**
* Create a Maven like relative repository path.
+ * @return A relative repository path.
*/
public String getRepositoryPath() {
final StringBuilder sb = new StringBuilder();
diff --git a/src/main/java/org/apache/sling/provisioning/model/ArtifactGroup.java b/src/main/java/org/apache/sling/provisioning/model/ArtifactGroup.java
index 8cb3550..04a3815 100644
--- a/src/main/java/org/apache/sling/provisioning/model/ArtifactGroup.java
+++ b/src/main/java/org/apache/sling/provisioning/model/ArtifactGroup.java
@@ -19,24 +19,36 @@ package org.apache.sling.provisioning.model;
/**
* A artifact group holds a set of artifacts.
+ *
* A valid start level is positive, start level 0 means the default OSGi start level.
*/
public class ArtifactGroup extends ItemList<Artifact>
implements Comparable<ArtifactGroup> {
+ /** The start level. */
private final int level;
- public ArtifactGroup(final int level) {
- this.level = level;
+ /**
+ * Create a new artifact group with the level.
+ * @param startLevel The start level.
+ */
+ public ArtifactGroup(final int startLevel) {
+ this.level = startLevel;
}
- public int getLevel() {
+ /**
+ * Get the start level.
+ * @return The start level.
+ */
+ public int getStartLevel() {
return this.level;
}
/**
* Search an artifact with the same groupId, artifactId, version, type and classifier.
* Version is not considered.
+ * @param template A template artifact
+ * @return The artifact or {@code null}.
*/
public Artifact search(final Artifact template) {
Artifact found = null;
diff --git a/src/main/java/org/apache/sling/provisioning/model/Commentable.java b/src/main/java/org/apache/sling/provisioning/model/Commentable.java
index b966a91..7b10651 100644
--- a/src/main/java/org/apache/sling/provisioning/model/Commentable.java
+++ b/src/main/java/org/apache/sling/provisioning/model/Commentable.java
@@ -17,7 +17,7 @@
package org.apache.sling.provisioning.model;
/**
- * A traceable has a comment and a location.
+ * A commentable has a comment and a location.
* Both are optional.
*/
public abstract class Commentable extends Traceable {
diff --git a/src/main/java/org/apache/sling/provisioning/model/Configuration.java b/src/main/java/org/apache/sling/provisioning/model/Configuration.java
index b317a14..5cf98c8 100644
--- a/src/main/java/org/apache/sling/provisioning/model/Configuration.java
+++ b/src/main/java/org/apache/sling/provisioning/model/Configuration.java
@@ -21,16 +21,25 @@ import java.util.Hashtable;
/**
- * Configuration
+ * A configuration has either
+ * - a pid
+ * - or a factory pid and an alias (pid)
+ * and properties.
*/
public class Configuration extends Commentable {
+ /** The pid. */
private final String pid;
-
+ /** The factory pid. */
private final String factoryPid;
-
+ /** The properties. */
private final Dictionary<String, Object> properties = new Hashtable<String, Object>();
+ /**
+ * Create a new configuration
+ * @param pid The pid or alias for a factory pid
+ * @param factoryPid The factory pid
+ */
public Configuration(final String pid, final String factoryPid) {
this.pid = (pid != null ? pid.trim() : null);
this.factoryPid = (factoryPid != null ? factoryPid.trim() : null);
diff --git a/src/main/java/org/apache/sling/provisioning/model/Feature.java b/src/main/java/org/apache/sling/provisioning/model/Feature.java
index f333888..d04b1d0 100644
--- a/src/main/java/org/apache/sling/provisioning/model/Feature.java
+++ b/src/main/java/org/apache/sling/provisioning/model/Feature.java
@@ -24,6 +24,7 @@ import java.util.List;
/**
* A feature is a collection of
+ * - a name
* - variables
* - run modes
*/
@@ -37,6 +38,7 @@ public class Feature
/** Variables. */
private final KeyValueMap<String> variables = new KeyValueMap<String>();
+ /** Feature name. */
private final String name;
/**
@@ -57,6 +59,7 @@ public class Feature
/**
* Special feature?
+ * @return true if the feature is special
*/
public boolean isSpecial() {
return this.name.startsWith(":");
@@ -70,20 +73,24 @@ public class Feature
return this.variables;
}
+ /**
+ * Get all run modes.
+ * @return The list of run modes.
+ */
public List<RunMode> getRunModes() {
return this.runModes;
}
/**
* Find the run mode if available
- * @param runModes
- * @return The feature or null.
+ * @param runModes The run modes or {@code null}
+ * @return The feature or {@code null}.
*/
public RunMode getRunMode(final String[] runModes) {
final String[] sortedRunModes = RunMode.getSortedRunModesArray(runModes);
RunMode result = null;
for(final RunMode current : this.runModes) {
- if ( Arrays.equals(sortedRunModes, current.getRunModes()) ) {
+ if ( Arrays.equals(sortedRunModes, current.getNames()) ) {
result = current;
break;
}
@@ -93,13 +100,13 @@ public class Feature
/**
* Get or create the run mode.
- * @param runModes The run modes.
- * @return The feature for the given run modes.
+ * @param names The run modes.
+ * @return The run mode for the given run modes names.
*/
- public RunMode getOrCreateRunMode(final String[] runModes) {
- RunMode result = getRunMode(runModes);
+ public RunMode getOrCreateRunMode(final String[] names) {
+ RunMode result = getRunMode(names);
if ( result == null ) {
- result = new RunMode(runModes);
+ result = new RunMode(names);
this.runModes.add(result);
Collections.sort(this.runModes);
}
diff --git a/src/main/java/org/apache/sling/provisioning/model/ItemList.java b/src/main/java/org/apache/sling/provisioning/model/ItemList.java
index 85ea138..8aa2a0a 100644
--- a/src/main/java/org/apache/sling/provisioning/model/ItemList.java
+++ b/src/main/java/org/apache/sling/provisioning/model/ItemList.java
@@ -20,16 +20,28 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+/**
+ * Helper class to hold a list of items.
+ */
public class ItemList<T>
extends Commentable
implements Iterable<T> {
+ /** The list holding the items. */
protected final List<T> items = new ArrayList<T>();
+ /**
+ * Add a new item
+ * @param item The new item
+ */
public void add(final T item) {
this.items.add(item);
}
+ /**
+ * Remove an item.
+ * @param item The item to remove.
+ */
public void remove(final T item) {
this.items.remove(item);
}
@@ -39,6 +51,10 @@ public class ItemList<T>
return this.items.iterator();
}
+ /**
+ * Check if the list is empty.
+ * @return {@code true} if the list is empty.
+ */
public boolean isEmpty() {
return this.items.isEmpty();
}
diff --git a/src/main/java/org/apache/sling/provisioning/model/KeyValueMap.java b/src/main/java/org/apache/sling/provisioning/model/KeyValueMap.java
index aa6598c..7e64732 100644
--- a/src/main/java/org/apache/sling/provisioning/model/KeyValueMap.java
+++ b/src/main/java/org/apache/sling/provisioning/model/KeyValueMap.java
@@ -21,20 +21,38 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
+/**
+ * Helper class to hold key value pairs.
+ */
public class KeyValueMap<T>
extends Commentable
implements Iterable<Map.Entry<String, T>> {
+ /** The map holding the actual key value pairs. */
private final Map<String, T> properties = new HashMap<String, T>();
+ /**
+ * Get an item from the map.
+ * @param key The key of the item.
+ * @return The item or {@code null}.
+ */
public T get(final String key) {
return this.properties.get(key);
}
+ /**
+ * Put an item in the map
+ * @param key The key of the item.
+ * @param value The value
+ */
public void put(final String key, final T value) {
this.properties.put(key, value);
}
+ /**
+ * Put all items from the other map in this map
+ * @param map The other map
+ */
public void putAll(final KeyValueMap<T> map) {
this.properties.putAll(map.properties);
}
@@ -44,6 +62,10 @@ public class KeyValueMap<T>
return this.properties.entrySet().iterator();
}
+ /**
+ * Check whether this map is empty.
+ * @return {@code true} if the map is empty.
+ */
public boolean isEmpty() {
return this.properties.isEmpty();
}
diff --git a/src/main/java/org/apache/sling/provisioning/model/Model.java b/src/main/java/org/apache/sling/provisioning/model/Model.java
index ee80611..a9aed51 100644
--- a/src/main/java/org/apache/sling/provisioning/model/Model.java
+++ b/src/main/java/org/apache/sling/provisioning/model/Model.java
@@ -34,7 +34,7 @@ public class Model extends Traceable {
* @param name The feature name
* @return The feature or {@code null}.
*/
- public Feature findFeature(final String name) {
+ public Feature getFeature(final String name) {
for(final Feature f : this.features) {
if ( name.equals(f.getName()) ) {
return f;
@@ -49,7 +49,7 @@ public class Model extends Traceable {
* @return The feature for the given run modes.
*/
public Feature getOrCreateFeature(final String name) {
- Feature result = findFeature(name);
+ Feature result = getFeature(name);
if ( result == null ) {
result = new Feature(name);
this.features.add(result);
diff --git a/src/main/java/org/apache/sling/provisioning/model/ModelConstants.java b/src/main/java/org/apache/sling/provisioning/model/ModelConstants.java
index 744c71e..e5f8301 100644
--- a/src/main/java/org/apache/sling/provisioning/model/ModelConstants.java
+++ b/src/main/java/org/apache/sling/provisioning/model/ModelConstants.java
@@ -27,7 +27,6 @@ public abstract class ModelConstants {
/** Name of the boot feature */
public static final String FEATURE_BOOT = ":boot";
-
/**
* Name of the configuration containing the web.xml. This configuration
* is used by the launchpad feature.
@@ -46,8 +45,10 @@ public abstract class ModelConstants {
/** Format of the unprocessed configuration values. */
public static final String CFG_UNPROCESSED_FORMAT = ":rawconfig.format";
+ /** Format of the Apache Felix Config Admin. */
public static final String CFG_FORMAT_FELIX_CA = "felixca";
+ /** Property file format. */
public static final String CFG_FORMAT_PROPERTIES = "properties";
/** Name of the webapp run mode. */
diff --git a/src/main/java/org/apache/sling/provisioning/model/ModelUtility.java b/src/main/java/org/apache/sling/provisioning/model/ModelUtility.java
index d42f727..c97f92e 100644
--- a/src/main/java/org/apache/sling/provisioning/model/ModelUtility.java
+++ b/src/main/java/org/apache/sling/provisioning/model/ModelUtility.java
@@ -49,11 +49,11 @@ public abstract class ModelUtility {
// run modes
for(final RunMode runMode : feature.getRunModes()) {
- final RunMode baseRunMode = baseFeature.getOrCreateRunMode(runMode.getRunModes());
+ final RunMode baseRunMode = baseFeature.getOrCreateRunMode(runMode.getNames());
// artifact groups
for(final ArtifactGroup group : runMode.getArtifactGroups()) {
- final ArtifactGroup baseGroup = baseRunMode.getOrCreateArtifactGroup(group.getLevel());
+ final ArtifactGroup baseGroup = baseRunMode.getOrCreateArtifactGroup(group.getStartLevel());
for(final Artifact artifact : group) {
final Artifact found = baseGroup.search(artifact);
@@ -92,12 +92,12 @@ public abstract class ModelUtility {
* Resolve the variable.
* An implementation might get the value of a variable from the system properties,
* or the environment etc.
- * As a fallback, the resolver should check the variables of the model.
- * @param model The model
+ * As a fallback, the resolver should check the variables of the feature.
+ * @param feature The feature
* @param name The variable name
* @return The variable value or null.
*/
- String resolve(final Feature model, final String name);
+ String resolve(final Feature feature, final String name);
}
/**
@@ -109,19 +109,23 @@ public abstract class ModelUtility {
*/
public static Model getEffectiveModel(final Model model, final VariableResolver resolver) {
final Model result = new Model();
+ result.setLocation(model.getLocation());
for(final Feature feature : model.getFeatures()) {
final Feature newFeature = result.getOrCreateFeature(feature.getName());
newFeature.setComment(feature.getComment());
newFeature.setLocation(feature.getLocation());
+ newFeature.getVariables().setComment(feature.getVariables().getComment());
+ newFeature.getVariables().setLocation(feature.getVariables().getLocation());
newFeature.getVariables().putAll(feature.getVariables());
for(final RunMode runMode : feature.getRunModes()) {
- final RunMode newRunMode = newFeature.getOrCreateRunMode(runMode.getRunModes());
+ final RunMode newRunMode = newFeature.getOrCreateRunMode(runMode.getNames());
+ newRunMode.setLocation(runMode.getLocation());
for(final ArtifactGroup group : runMode.getArtifactGroups()) {
- final ArtifactGroup newGroup = newRunMode.getOrCreateArtifactGroup(group.getLevel());
+ final ArtifactGroup newGroup = newRunMode.getOrCreateArtifactGroup(group.getStartLevel());
newGroup.setComment(group.getComment());
newGroup.setLocation(group.getLocation());
@@ -138,6 +142,8 @@ public abstract class ModelUtility {
}
}
+ newRunMode.getConfigurations().setComment(runMode.getConfigurations().getComment());
+ newRunMode.getConfigurations().setLocation(runMode.getConfigurations().getLocation());
for(final Configuration config : runMode.getConfigurations()) {
final Configuration newConfig = new Configuration(config.getPid(), config.getFactoryPid());
newConfig.setComment(config.getComment());
@@ -197,6 +203,8 @@ public abstract class ModelUtility {
newRunMode.getConfigurations().add(newConfig);
}
+ newRunMode.getSettings().setComment(runMode.getSettings().getComment());
+ newRunMode.getSettings().setLocation(runMode.getSettings().getLocation());
for(final Map.Entry<String, String> entry : runMode.getSettings() ) {
newRunMode.getSettings().put(entry.getKey(), replace(feature, entry.getValue(), resolver));
}
@@ -209,13 +217,13 @@ public abstract class ModelUtility {
/**
* Replace properties in the string.
*
- * @param model The model
+ * @param feature The feature
* @param v The variable name
* @param resolver Optional resolver
* @result The value of the variable
- * @throws IllegalArgumentException
+ * @throws IllegalArgumentException If variable can't be found.
*/
- private static String replace(final Feature model, final String v, final VariableResolver resolver) {
+ private static String replace(final Feature feature, final String v, final VariableResolver resolver) {
if ( v == null ) {
return null;
}
@@ -232,9 +240,9 @@ public abstract class ModelUtility {
final String name = msg.substring(pos + 2, endPos);
final String value;
if ( resolver != null ) {
- value = resolver.resolve(model, name);
+ value = resolver.resolve(feature, name);
} else {
- value = model.getVariables().get(name);
+ value = feature.getVariables().get(name);
}
if ( value == null ) {
throw new IllegalArgumentException("Unknown variable: " + name);
@@ -250,7 +258,7 @@ public abstract class ModelUtility {
/**
* Validates the model.
- * @param model
+ * @param model The model to validate
* @return A map with errors or {@code null}.
*/
public static Map<Traceable, String> validate(final Model model) {
@@ -262,7 +270,7 @@ public abstract class ModelUtility {
errors.put(feature, "Name is required for a feature.");
}
for(final RunMode runMode : feature.getRunModes()) {
- final String[] rm = runMode.getRunModes();
+ final String[] rm = runMode.getNames();
if ( rm != null ) {
boolean hasSpecial = false;
for(final String m : rm) {
@@ -277,8 +285,8 @@ public abstract class ModelUtility {
}
for(final ArtifactGroup sl : runMode.getArtifactGroups()) {
- if ( sl.getLevel() < 0 ) {
- errors.put(sl, "Invalid start level " + sl.getLevel());
+ if ( sl.getStartLevel() < 0 ) {
+ errors.put(sl, "Invalid start level " + sl.getStartLevel());
}
for(final Artifact a : sl) {
String error = null;
diff --git a/src/main/java/org/apache/sling/provisioning/model/RunMode.java b/src/main/java/org/apache/sling/provisioning/model/RunMode.java
index 72a8b23..66a9240 100644
--- a/src/main/java/org/apache/sling/provisioning/model/RunMode.java
+++ b/src/main/java/org/apache/sling/provisioning/model/RunMode.java
@@ -23,13 +23,12 @@ import java.util.List;
import java.util.Set;
/**
- * A feature is a collection of
+ * A run mode is a collection of
* - artifacts (through start levels)
* - configurations
* - settings
*
- * A feature might be tied to run modes. Only if all run modes are active,
- * this feature is active.
+ * Only if all run modes are active, this run mode is active.
* In addition to custom, user defined run modes, special run modes exists.
* A special run mode name starts with a colon.
*/
@@ -37,23 +36,36 @@ public class RunMode
extends Traceable
implements Comparable<RunMode> {
- private final String[] runModes;
+ /** The array of run mode names. */
+ private final String[] names;
+ /** The artifact groups. */
private final List<ArtifactGroup> groups = new ArrayList<ArtifactGroup>();
+ /** The configurations. */
private final ItemList<Configuration> configurations = new ItemList<Configuration>();
+ /** The settings. */
private final KeyValueMap<String> settings = new KeyValueMap<String>();
- public RunMode(final String[] runModes) {
- this.runModes = getSortedRunModesArray(runModes);
+ /**
+ * Create a new run mode
+ * @param names The run mode names
+ */
+ public RunMode(final String[] names) {
+ this.names = getSortedRunModesArray(names);
}
- public static String[] getSortedRunModesArray(final String[] runModes) {
+ /**
+ * Get an alphabetical sorted array of the run mode names.
+ * @param names The run mode names
+ * @return The sorted run mode names
+ */
+ public static String[] getSortedRunModesArray(final String[] names) {
// sort run modes
- if ( runModes != null ) {
+ if ( names != null ) {
final List<String> list = new ArrayList<String>();
- for(final String m : runModes) {
+ for(final String m : names) {
if ( m != null ) {
if ( !m.trim().isEmpty() ) {
list.add(m.trim());
@@ -68,17 +80,23 @@ public class RunMode
return null;
}
- public String[] getRunModes() {
- return this.runModes;
+ /**
+ * Return the run mode names.
+ * @return The array of run mode names or {@code null}.
+ */
+ public String[] getNames() {
+ return this.names;
}
/**
- * Check if this feature is active wrt the given set of active run modes.
+ * Check if this run mode is active wrt the given set of active run modes.
+ * @param activeRunModes The set of active run modes.
+ * @return {@code true} if the run mode is active.
*/
public boolean isActive(final Set<String> activeRunModes) {
boolean active = true;
- if ( runModes != null ) {
- for(final String mode : runModes) {
+ if ( names != null ) {
+ for(final String mode : names) {
if ( !activeRunModes.contains(mode) ) {
active = false;
break;
@@ -89,26 +107,29 @@ public class RunMode
}
/**
- * Check whether this feature is a special one
+ * Check whether this run mode is a special one
+ * @return {@code true} if it is special
*/
public boolean isSpecial() {
- if ( runModes != null && runModes.length == 1 && runModes[0].startsWith(":") ) {
+ if ( names != null && names.length == 1 && names[0].startsWith(":") ) {
return true;
}
return false;
}
/**
- * Check if this feature is tied to a single specific run mode.
+ * Check if this run mode is tied to a single specific run mode name.
+ * @param mode The name of the run mode
+ * @return {@code true} if this run mode is tied to exactly the single one.
*/
public boolean isRunMode(final String mode) {
- if ( mode == null && this.runModes == null ) {
+ if ( mode == null && this.names == null ) {
return true;
}
if ( mode != null
- && this.runModes != null
- && this.runModes.length == 1
- && this.runModes[0].equals(mode) ) {
+ && this.names != null
+ && this.names.length == 1
+ && this.names[0].equals(mode) ) {
return true;
}
return false;
@@ -116,10 +137,12 @@ public class RunMode
/**
* Find the artifact group.
+ * @param startLevel the start level
+ * @return The artifact group for that level or {@code null}.
*/
- public ArtifactGroup findArtifactGroup(final int startLevel) {
+ public ArtifactGroup getArtifactGroup(final int startLevel) {
for(final ArtifactGroup g : this.groups) {
- if ( g.getLevel() == startLevel ) {
+ if ( g.getStartLevel() == startLevel ) {
return g;
}
}
@@ -128,9 +151,11 @@ public class RunMode
/**
* Get or create an artifact group
+ * @param startLevel The start level
+ * @return The artifact group.
*/
public ArtifactGroup getOrCreateArtifactGroup(final int startLevel) {
- ArtifactGroup result = this.findArtifactGroup(startLevel);
+ ArtifactGroup result = this.getArtifactGroup(startLevel);
if ( result == null ) {
result = new ArtifactGroup(startLevel);
this.groups.add(result);
@@ -141,6 +166,8 @@ public class RunMode
/**
* Search a configuration with a pid
+ * @param pid The configuration pid
+ * @return The configuration or {@code null}
*/
public Configuration getConfiguration(final String pid) {
for(final Configuration c : this.configurations) {
@@ -151,6 +178,12 @@ public class RunMode
return null;
}
+ /**
+ * Search a configuration with pid and factory pid
+ * @param pid The pid
+ * @param factoryPid The optional factory pid
+ * @return The configuration or {@code null}.
+ */
public Configuration getConfiguration(final String pid, final String factoryPid) {
Configuration found = null;
for(final Configuration current : this.configurations) {
@@ -169,6 +202,12 @@ public class RunMode
return found;
}
+ /**
+ * Get or create the configuration
+ * @param pid The pid
+ * @param factoryPid The optional factory pid
+ * @return The configuration
+ */
public Configuration getOrCreateConfiguration(final String pid, final String factoryPid) {
Configuration found = getConfiguration(pid, factoryPid);
if ( found == null ) {
@@ -178,14 +217,26 @@ public class RunMode
return found;
}
+ /**
+ * Get all artifact groups
+ * @return List of artifact groups
+ */
public List<ArtifactGroup> getArtifactGroups() {
return this.groups;
}
+ /**
+ * Get all configurations
+ * @return List of configurations
+ */
public ItemList<Configuration> getConfigurations() {
return this.configurations;
}
+ /**
+ * Get the settings
+ * @return Map with the settings.
+ */
public KeyValueMap<String> getSettings() {
return this.settings;
}
@@ -195,21 +246,21 @@ public class RunMode
*/
@Override
public int compareTo( RunMode o2) {
- if ( this.runModes == null ) {
- if ( o2.runModes == null ) {
+ if ( this.names == null ) {
+ if ( o2.names == null ) {
return 0;
}
return -1;
}
- if ( o2.runModes == null ) {
+ if ( o2.names == null ) {
return 1;
}
- return Arrays.toString(this.runModes).compareTo(Arrays.toString(o2.runModes));
+ return Arrays.toString(this.names).compareTo(Arrays.toString(o2.names));
}
@Override
public String toString() {
- return "RunMode [runModes=" + Arrays.toString(runModes) + ", groups="
+ return "RunMode [names=" + Arrays.toString(names) + ", groups="
+ groups + ", configurations=" + configurations + ", settings="
+ settings
+ "]";
diff --git a/src/main/java/org/apache/sling/provisioning/model/io/ModelReader.java b/src/main/java/org/apache/sling/provisioning/model/io/ModelReader.java
index 948f3e6..15bf545 100644
--- a/src/main/java/org/apache/sling/provisioning/model/io/ModelReader.java
+++ b/src/main/java/org/apache/sling/provisioning/model/io/ModelReader.java
@@ -160,7 +160,7 @@ public class ModelReader {
if ( name == null ) {
throw new IOException(exceptionPrefix + "Feature name missing in line " + this.lineNumberReader.getLineNumber() + ": " + line);
}
- if ( model.findFeature(name) != null ) {
+ if ( model.getFeature(name) != null ) {
throw new IOException(exceptionPrefix + "Duplicate feature in line " + this.lineNumberReader.getLineNumber() + ": " + line);
}
this.feature = model.getOrCreateFeature(name);
@@ -186,7 +186,7 @@ public class ModelReader {
throw new IOException(exceptionPrefix + "Invalid start level in line " + this.lineNumberReader.getLineNumber() + ": " + line + ":" + level);
}
}
- if ( this.runMode.findArtifactGroup(startLevel) != null ) {
+ if ( this.runMode.getArtifactGroup(startLevel) != null ) {
throw new IOException(exceptionPrefix + "Duplicate artifact group in line " + this.lineNumberReader.getLineNumber() + ": " + line);
}
this.artifactGroup = this.runMode.getOrCreateArtifactGroup(startLevel);
diff --git a/src/main/java/org/apache/sling/provisioning/model/io/ModelWriter.java b/src/main/java/org/apache/sling/provisioning/model/io/ModelWriter.java
index 09c8423..3f371c6 100644
--- a/src/main/java/org/apache/sling/provisioning/model/io/ModelWriter.java
+++ b/src/main/java/org/apache/sling/provisioning/model/io/ModelWriter.java
@@ -56,7 +56,7 @@ public class ModelWriter {
}
private static void writeRunMode(final PrintWriter pw, final RunMode runMode) {
- final String[] rm = runMode.getRunModes();
+ final String[] rm = runMode.getNames();
if ( rm != null && rm.length > 0 ) {
pw.print(" runModes=");
boolean first = true;
@@ -129,9 +129,9 @@ public class ModelWriter {
}
writeComment(pw, group);
pw.print("[artifacts");
- if ( group.getLevel() > 0 ) {
+ if ( group.getStartLevel() > 0 ) {
pw.print(" startLevel=");
- pw.print(String.valueOf(group.getLevel()));
+ pw.print(String.valueOf(group.getStartLevel()));
}
writeRunMode(pw, runMode);
pw.println("]");
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.