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:14 UTC
[sling-org-apache-sling-provisioning-model] 18/34: Cleanup methods
and constants
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 c58f1ab2d584dc9f8ff87df8296077c44cf567f9
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Sep 30 14:27:11 2014 +0000
Cleanup methods and constants
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/tooling/support/slingstart-model@1628455 13f79535-47bb-0310-9956-ffa450edef68
---
.../org/apache/sling/provisioning/model/Feature.java | 20 +++++++++-----------
.../sling/provisioning/model/ModelConstants.java | 4 ++--
.../sling/provisioning/model/io/ModelReader.java | 4 ++--
3 files changed, 13 insertions(+), 15 deletions(-)
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 0839703..fd16df7 100644
--- a/src/main/java/org/apache/sling/provisioning/model/Feature.java
+++ b/src/main/java/org/apache/sling/provisioning/model/Feature.java
@@ -58,6 +58,13 @@ public class Feature
}
/**
+ * Special feature?
+ */
+ public boolean isSpecial() {
+ return this.name.startsWith(":");
+ }
+
+ /**
* Get all variables
* @return The set of variables
*/
@@ -74,7 +81,7 @@ public class Feature
* @param runModes
* @return The feature or null.
*/
- public RunMode findRunMode(final String[] runModes) {
+ public RunMode getRunMode(final String[] runModes) {
final String[] sortedRunModes = RunMode.getSortedRunModesArray(runModes);
RunMode result = null;
for(final RunMode current : this.runModes) {
@@ -87,21 +94,12 @@ public class Feature
}
/**
- * Find the run mode if available
- * @param runModes
- * @return The feature or null.
- */
- public RunMode findRunMode(final String runMode) {
- return this.findRunMode(new String[] {runMode});
- }
-
- /**
* Get or create the run mode.
* @param runModes The run modes.
* @return The feature for the given run modes.
*/
public RunMode getOrCreateFeature(final String[] runModes) {
- RunMode result = findRunMode(runModes);
+ RunMode result = getRunMode(runModes);
if ( result == null ) {
result = new RunMode(runModes);
this.runModes.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 db101f7..744c71e 100644
--- a/src/main/java/org/apache/sling/provisioning/model/ModelConstants.java
+++ b/src/main/java/org/apache/sling/provisioning/model/ModelConstants.java
@@ -32,13 +32,13 @@ public abstract class ModelConstants {
* Name of the configuration containing the web.xml. This configuration
* is used by the launchpad feature.
*/
- public static final String CFG_WEB_XML = ":web.xml";
+ public static final String CFG_LAUNCHPAD_WEB_XML = ":web.xml";
/**
* Name of the configuration for the bootstrap contents. This
* configuration is used by the launchpad feature.
*/
- public static final String CFG_BOOTSTRAP = ":bootstrap";
+ public static final String CFG_LAUNCHPAD_BOOTSTRAP = ":bootstrap";
/** Unprocessed configuration values. */
public static final String CFG_UNPROCESSED = ":rawconfig";
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 59fa682..431fc42 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
@@ -184,7 +184,7 @@ public class ModelReader {
throw new IOException(exceptionPrefix + "Unknown run mode parameters in line " + this.lineNumberReader.getLineNumber() + ": " + line);
}
final String[] rm = names.split(",");
- if ( this.feature.findRunMode(rm) != null ) {
+ if ( this.feature.getRunMode(rm) != null ) {
throw new IOException(exceptionPrefix + "Duplicate run mode in line " + this.lineNumberReader.getLineNumber() + ": " + line);
}
this.runMode = this.feature.getOrCreateFeature(rm);
@@ -195,7 +195,7 @@ public class ModelReader {
if ( !parameters.isEmpty() ) {
throw new IOException(exceptionPrefix + "Unknown global parameters in line " + this.lineNumberReader.getLineNumber() + ": " + line);
}
- if ( this.feature.findRunMode((String)null) != null ) {
+ if ( this.feature.getRunMode(null) != null ) {
throw new IOException(exceptionPrefix + "Duplicate global run mode in line " + this.lineNumberReader.getLineNumber() + ": " + line);
}
this.runMode = this.feature.getOrCreateFeature(null);
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.