You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by da...@apache.org on 2018/04/27 09:44:05 UTC
[sling-slingfeature-maven-plugin] 06/14: Support variables in
converting from features to provisioning model
This is an automated email from the ASF dual-hosted git repository.
davidb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-slingfeature-maven-plugin.git
commit a1e954126b5f92a4a6e6df68c68bbe3ccdc31dd3
Author: David Bosschaert <da...@gmail.com>
AuthorDate: Tue Mar 20 10:46:52 2018 +0000
Support variables in converting from features to provisioning model
---
src/main/java/org/apache/sling/feature/maven/Preprocessor.java | 10 +++++-----
.../java/org/apache/sling/feature/maven/ProjectHelper.java | 6 +++---
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/main/java/org/apache/sling/feature/maven/Preprocessor.java b/src/main/java/org/apache/sling/feature/maven/Preprocessor.java
index 3799712..4e2f08b 100644
--- a/src/main/java/org/apache/sling/feature/maven/Preprocessor.java
+++ b/src/main/java/org/apache/sling/feature/maven/Preprocessor.java
@@ -28,7 +28,7 @@ import org.apache.sling.feature.process.FeatureBuilder;
import org.apache.sling.feature.process.FeatureProvider;
import org.apache.sling.feature.support.FeatureUtil;
import org.apache.sling.feature.support.json.FeatureJSONReader;
-import org.apache.sling.feature.support.json.FeatureJSONReader.Phase;
+import org.apache.sling.feature.support.json.FeatureJSONReader.SubstituteVariables;
import org.codehaus.plexus.logging.Logger;
import java.io.File;
@@ -194,7 +194,7 @@ public class Preprocessor {
// We should pass in an "id" to FeatureJSONReader.read and later on check the id (again, need to handle ref files)
try (final FileReader reader = new FileReader(file)) {
- final Feature feature = FeatureJSONReader.read(reader, id, file.getAbsolutePath(), Phase.RESOLVE);
+ final Feature feature = FeatureJSONReader.read(reader, id, file.getAbsolutePath(), SubstituteVariables.RESOLVE);
this.checkFeatureId(id, feature);
@@ -369,7 +369,7 @@ public class Preprocessor {
if ( config.getInlinedFeature() != null ) {
logger.debug("Reading inlined model from project " + project.getId());
try (final Reader reader = new StringReader(config.getInlinedFeature())) {
- feature = FeatureJSONReader.read(reader, id, null, Phase.RESOLVE);
+ feature = FeatureJSONReader.read(reader, id, null, SubstituteVariables.RESOLVE);
} catch ( final IOException io) {
throw new RuntimeException("Unable to read inlined feature", io);
}
@@ -380,7 +380,7 @@ public class Preprocessor {
}
logger.debug("Reading feature " + featureFile + " in project " + project.getId());
try (final FileReader reader = new FileReader(featureFile)) {
- feature = FeatureJSONReader.read(reader, id, featureFile.getAbsolutePath(), Phase.RESOLVE);
+ feature = FeatureJSONReader.read(reader, id, featureFile.getAbsolutePath(), SubstituteVariables.RESOLVE);
} catch ( final IOException io) {
throw new RuntimeException("Unable to read feature " + featureFile, io);
}
@@ -503,7 +503,7 @@ public class Preprocessor {
// "external" dependency, we can already resolve it
final File featureFile = ProjectHelper.getOrResolveArtifact(info.project, env.session, env.artifactHandlerManager, env.resolver, id).getFile();
try (final FileReader r = new FileReader(featureFile)) {
- return FeatureJSONReader.read(r, featureFile.getAbsolutePath(), Phase.RESOLVE);
+ return FeatureJSONReader.read(r, featureFile.getAbsolutePath(), SubstituteVariables.RESOLVE);
} catch ( final IOException ioe) {
env.logger.error("Unable to read feature file from " + featureFile, ioe);
}
diff --git a/src/main/java/org/apache/sling/feature/maven/ProjectHelper.java b/src/main/java/org/apache/sling/feature/maven/ProjectHelper.java
index 2efb69c..ce3314c 100644
--- a/src/main/java/org/apache/sling/feature/maven/ProjectHelper.java
+++ b/src/main/java/org/apache/sling/feature/maven/ProjectHelper.java
@@ -31,7 +31,7 @@ import org.apache.maven.project.MavenProject;
import org.apache.sling.feature.ArtifactId;
import org.apache.sling.feature.Feature;
import org.apache.sling.feature.support.json.FeatureJSONReader;
-import org.apache.sling.feature.support.json.FeatureJSONReader.Phase;
+import org.apache.sling.feature.support.json.FeatureJSONReader.SubstituteVariables;
import org.apache.sling.feature.support.json.FeatureJSONWriter;
import org.codehaus.plexus.util.xml.Xpp3Dom;
@@ -96,7 +96,7 @@ public abstract class ProjectHelper {
result = null;
} else {
try ( final StringReader r = new StringReader(text) ) {
- result = FeatureJSONReader.read(r, project.getId(), Phase.RESOLVE);
+ result = FeatureJSONReader.read(r, project.getId(), SubstituteVariables.RESOLVE);
project.setContextValue(cacheKey, result);
} catch ( final IOException ioe) {
throw new RuntimeException(ioe.getMessage(), ioe);
@@ -125,7 +125,7 @@ public abstract class ProjectHelper {
throw new RuntimeException("Unable to get feature from internal store.");
}
try ( final StringReader r = new StringReader(text) ) {
- final Feature feature = FeatureJSONReader.read(r, project.getId(), Phase.RESOLVE);
+ final Feature feature = FeatureJSONReader.read(r, project.getId(), SubstituteVariables.RESOLVE);
result.add(feature);
} catch ( final IOException ioe) {
throw new RuntimeException(ioe.getMessage(), ioe);
--
To stop receiving notification emails like this one, please contact
davidb@apache.org.