You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by pa...@apache.org on 2018/09/06 08:00:15 UTC

[sling-org-apache-sling-feature-launcher] branch variables created (now 8789b48)

This is an automated email from the ASF dual-hosted git repository.

pauls pushed a change to branch variables
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-launcher.git.


      at 8789b48  Change variable handling to not allow variables to be defined twice

This branch includes the following new commits:

     new 8789b48  Change variable handling to not allow variables to be defined twice

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[sling-org-apache-sling-feature-launcher] 01/01: Change variable handling to not allow variables to be defined twice

Posted by pa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

pauls pushed a commit to branch variables
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-launcher.git

commit 8789b48dcd7568d8f80db20ed21d64ce0e08a7b6
Author: Karl Pauls <ka...@gmail.com>
AuthorDate: Thu Sep 6 09:59:59 2018 +0200

    Change variable handling to not allow variables to be defined twice
---
 .gitignore                                         |  2 ++
 .../feature/launcher/impl/FeatureProcessor.java    | 25 +++++++++++-----------
 .../apache/sling/feature/launcher/impl/Main.java   | 21 ++++++++++++++++++
 .../launcher/impl/launchers/AbstractRunner.java    |  1 -
 4 files changed, 36 insertions(+), 13 deletions(-)

diff --git a/.gitignore b/.gitignore
index 5b783ed..1f87c49 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,3 +15,5 @@ maven-eclipse.xml
 .DS_Store
 jcr.log
 atlassian-ide-plugin.xml
+license.properties
+/launcher
diff --git a/src/main/java/org/apache/sling/feature/launcher/impl/FeatureProcessor.java b/src/main/java/org/apache/sling/feature/launcher/impl/FeatureProcessor.java
index 4d438f4..2e77570 100644
--- a/src/main/java/org/apache/sling/feature/launcher/impl/FeatureProcessor.java
+++ b/src/main/java/org/apache/sling/feature/launcher/impl/FeatureProcessor.java
@@ -71,7 +71,7 @@ public class FeatureProcessor {
                     // ignore
                 }
                 return null;
-            }).add(StreamSupport.stream(Spliterators.spliteratorUnknownSize(
+            }, config.getVariables(), config.getInstallation().getFrameworkProperties()).add(StreamSupport.stream(Spliterators.spliteratorUnknownSize(
             ServiceLoader.load(FeatureExtensionHandler.class).iterator(), Spliterator.ORDERED), false).toArray(FeatureExtensionHandler[]::new));
 
         List<Feature> features = new ArrayList<>();
@@ -126,17 +126,6 @@ public class FeatureProcessor {
                 config.getInstallation().addBundle(entry.getKey(), artifactFile);
             }
         }
-        extensions: for(final Extension ext : app.getExtensions()) {
-            for (ExtensionHandler handler : ServiceLoader.load(ExtensionHandler.class,  FeatureProcessor.class.getClassLoader()))
-            {
-                if (handler.handle(ext, ctx, config.getInstallation())) {
-                    continue extensions;
-                }
-            }
-            if ( ext.isRequired() ) {
-                throw new Exception("Unknown required extension " + ext.getName());
-            }
-        }
 
         for (final Configuration cfg : app.getConfigurations()) {
             if ( cfg.isFactoryConfiguration() ) {
@@ -151,6 +140,18 @@ public class FeatureProcessor {
                 config.getInstallation().getFrameworkProperties().put(prop.getKey(), prop.getValue());
             }
         }
+
+        extensions: for(final Extension ext : app.getExtensions()) {
+            for (ExtensionHandler handler : ServiceLoader.load(ExtensionHandler.class,  FeatureProcessor.class.getClassLoader()))
+            {
+                if (handler.handle(ext, ctx, config.getInstallation())) {
+                    continue extensions;
+                }
+            }
+            if ( ext.isRequired() ) {
+                throw new Exception("Unknown required extension " + ext.getName());
+            }
+        }
     }
 
     /**
diff --git a/src/main/java/org/apache/sling/feature/launcher/impl/Main.java b/src/main/java/org/apache/sling/feature/launcher/impl/Main.java
index 2d36ca4..1ab089f 100644
--- a/src/main/java/org/apache/sling/feature/launcher/impl/Main.java
+++ b/src/main/java/org/apache/sling/feature/launcher/impl/Main.java
@@ -180,6 +180,27 @@ public class Main {
         }
         launcherConfig.getVariables().put("sling.launchpad", launcherConfig.getHomeDirectory().getAbsolutePath() + "/launchpad");
 
+        final Installation installation = launcherConfig.getInstallation();
+
+        // set sling home, and use separate locations for launchpad and properties
+        installation.getFrameworkProperties().put("sling.home", launcherConfig.getHomeDirectory().getAbsolutePath());
+        installation.getFrameworkProperties().put("sling.launchpad", launcherConfig.getHomeDirectory().getAbsolutePath() + "/launchpad");
+        if (!installation.getFrameworkProperties().containsKey("repository.home")) {
+            installation.getFrameworkProperties().put("repository.home", launcherConfig.getHomeDirectory().getAbsolutePath() + File.separatorChar + "repository");
+        }
+        installation.getFrameworkProperties().put("sling.properties", "conf/sling.properties");
+
+
+        // additional OSGi properties
+        // move storage inside launcher
+        if ( installation.getFrameworkProperties().get(STORAGE_PROPERTY) == null ) {
+            installation.getFrameworkProperties().put(STORAGE_PROPERTY, launcherConfig.getHomeDirectory().getAbsolutePath() + File.separatorChar + "framework");
+        }
+        // set start level to 30
+        if ( installation.getFrameworkProperties().get(START_LEVEL_PROP) == null ) {
+            installation.getFrameworkProperties().put(START_LEVEL_PROP, "30");
+        }
+        
         Main.LOG().info("");
         Main.LOG().info("Apache Sling Application Launcher");
         Main.LOG().info("---------------------------------");
diff --git a/src/main/java/org/apache/sling/feature/launcher/impl/launchers/AbstractRunner.java b/src/main/java/org/apache/sling/feature/launcher/impl/launchers/AbstractRunner.java
index 064b632..f532a2c 100644
--- a/src/main/java/org/apache/sling/feature/launcher/impl/launchers/AbstractRunner.java
+++ b/src/main/java/org/apache/sling/feature/launcher/impl/launchers/AbstractRunner.java
@@ -322,7 +322,6 @@ public abstract class AbstractRunner implements Callable<Integer> {
                         }
                     }
                     else {
-                        framework.getBundleContext().getDataFile("INSTALLED").mkdirs();
                         latch.countDown();
                     }
                 }