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 2020/06/12 11:25:00 UTC
[sling-org-apache-sling-feature-launcher] branch master updated:
SLING-9516 : Allow to specify execution environment as part of the feature
model
This is an automated email from the ASF dual-hosted git repository.
cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-launcher.git
The following commit(s) were added to refs/heads/master by this push:
new 91f9d8b SLING-9516 : Allow to specify execution environment as part of the feature model
91f9d8b is described below
commit 91f9d8b9a3b9bd9bd9ae4955c97b3ebb2fb3c706
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Jun 12 13:24:48 2020 +0200
SLING-9516 : Allow to specify execution environment as part of the feature model
---
.../sling/feature/launcher/impl/Bootstrap.java | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/sling/feature/launcher/impl/Bootstrap.java b/src/main/java/org/apache/sling/feature/launcher/impl/Bootstrap.java
index e736d8d..a910bf1 100644
--- a/src/main/java/org/apache/sling/feature/launcher/impl/Bootstrap.java
+++ b/src/main/java/org/apache/sling/feature/launcher/impl/Bootstrap.java
@@ -29,6 +29,7 @@ import java.util.Map;
import java.util.ServiceLoader;
import org.apache.sling.feature.ArtifactId;
+import org.apache.sling.feature.ExecutionEnvironmentExtension;
import org.apache.sling.feature.Feature;
import org.apache.sling.feature.io.artifacts.ArtifactHandler;
import org.apache.sling.feature.io.artifacts.ArtifactManager;
@@ -151,9 +152,7 @@ public class Bootstrap {
}
};
- launcher.prepare(ctx, this.config.getFrameworkArtifact() != null ?
- ArtifactId.fromMvnId(this.config.getFrameworkArtifact()) :
- getFelixFrameworkId(this.config.getFrameworkVersion()), app);
+ launcher.prepare(ctx, this.getFrameworkArtifactId(app), app);
FeatureProcessor.prepareLauncher(ctx, this.config, app, loadedFeatures);
@@ -184,6 +183,21 @@ public class Bootstrap {
}
}
+ private ArtifactId getFrameworkArtifactId(final Feature app) {
+ if ( this.config.getFrameworkArtifact() != null ) {
+ return ArtifactId.parse(this.config.getFrameworkArtifact());
+ }
+ if ( this.config.getFrameworkVersion() != null ) {
+ return getFelixFrameworkId(this.config.getFrameworkVersion());
+ }
+
+ final ExecutionEnvironmentExtension env = ExecutionEnvironmentExtension.getExecutionEnvironmentExtension(app);
+ if ( env != null && env.getFramework() != null ) {
+ return env.getFramework().getId();
+ }
+ return null;
+ }
+
private Feature assemble(final ArtifactManager artifactManager,
Map<ArtifactId, Feature> loadedFeatures) throws IOException
{