You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by kw...@apache.org on 2020/09/18 15:26:42 UTC

[sling-site] branch master updated: SLING-9031, SLING-8548 document enhanced run mode support

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

kwin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-site.git


The following commit(s) were added to refs/heads/master by this push:
     new a434627  SLING-9031, SLING-8548 document enhanced run mode support
a434627 is described below

commit a43462783e7b20ecc76f46191ded677cba1e4b28
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Fri Sep 18 17:26:30 2020 +0200

    SLING-9031, SLING-8548 document enhanced run mode support
---
 .../bundles/file-installer-provider.md              |  6 ++++--
 .../documentation/bundles/jcr-installer-provider.md |  4 +++-
 .../sling-settings-org-apache-sling-settings.md     | 21 +++++++++++++++++++--
 3 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/src/main/jbake/content/documentation/bundles/file-installer-provider.md b/src/main/jbake/content/documentation/bundles/file-installer-provider.md
index 174adc2..6d3cef8 100644
--- a/src/main/jbake/content/documentation/bundles/file-installer-provider.md
+++ b/src/main/jbake/content/documentation/bundles/file-installer-provider.md
@@ -32,9 +32,11 @@ Configurations are handled by the [Configuration Installer Factory](/documentati
 
 Custom artifacts are handled by the OSGi installer depending on the installed plugins. Have a look at the OSGi installer and its plugins for more information.
 
-## Runmode Support
+## Run Mode Support
 
-The file installer supports run modes for installing artifacts (added with [SLING-4478](https://issues.apache.org/jira/browse/SLING-4478)). Within the scanned directory, a folder prefixed with "install." and followed by one or more run modes (separated by ".") will only be considered if all the respective run modes are active. For example artifacts below a folder named `install.a1.dev` are only taken into account if the run modes `a1` and `dev` are both active. 
+The file installer supports run modes for installing artifacts (added with [SLING-4478](https://issues.apache.org/jira/browse/SLING-4478)). Within the scanned directory, a folder prefixed with `install.` and followed by one or more run modes (separated by `.`) will only be considered if all the respective run modes are active. For example artifacts below a folder named `install.a1.dev` are only taken into account if the run modes `a1` and `dev` are both active. 
+
+Since version 1.3.0 of the File Installer bundle ([SLING-9031](https://issues.apache.org/jira/browse/SLING-9031) and [SLING-8548](https://issues.apache.org/jira/browse/SLING-8548)) advanced run mode support has been added, so that folder names in the form `install.[RUNMODESPEC]` are supported. `RUNMODESPEC` is defined in [Sling Settings](/documentation/bundles/sling-settings-org-apache-sling-settings.html#decisions-based-on-run-modes).
 
 You can even combine start level and run mode support. Just pay attention that the run mode foldername must be set on a direct child folder of `sling.fileinstall.dir` while the start level must be set directly on the parent folder of the artifact you want to install. E.g. `<sling.fileinstall.dir>/install.a1.dev/3/mybundle.jar` will only be considered if both run modes `a1` and `dev` are set. If this is the case then the according artifact will be installed in start level 3.
 
diff --git a/src/main/jbake/content/documentation/bundles/jcr-installer-provider.md b/src/main/jbake/content/documentation/bundles/jcr-installer-provider.md
index ae82646..8f59095 100644
--- a/src/main/jbake/content/documentation/bundles/jcr-installer-provider.md
+++ b/src/main/jbake/content/documentation/bundles/jcr-installer-provider.md
@@ -20,7 +20,9 @@ The JCR installer provider does not check or scan the artifacts itself, the dete
 
 The JCR installer supports [run modes](sling-settings-org-apache-sling-settings.html) for installing artifacts. By default folders named `install` are checked for artifacts. If Apache Sling is started with one (or more run modes), all folders named `install.[RUNMODE]` are scanned as well. To be precise, the folder name can be followed by any number of run modes separated by dot (`.`). For example, if started with run modes `dev`, `a1`, and `public`, folders like `install.dev`, `install.a [...]
 
-Artifacts from folders with a run mode get a higher priority. For example by default, an `install` folder underneath `/libs` gets the priority `50`. For each run mode in the folder name, this priority is increased by `1`, so `install.dev` has `51` and `install.a1.dev` has `52`.
+Since version 3.3.0 of the JCR Installer bundle ([SLING-9031](https://issues.apache.org/jira/browse/SLING-9031) and [SLING-8548](https://issues.apache.org/jira/browse/SLING-8548)) advanced run mode support has been added, so that folder names in the form `install.[RUNMODESPEC]` are supported. `RUNMODESPEC` is defined in [Sling Settings](/documentation/bundles/sling-settings-org-apache-sling-settings.html#decisions-based-on-run-modes).
+
+Artifacts from folders with a run mode get a higher priority. For example by default, an `install` folder underneath `/libs` gets the priority `50`. For each matching run mode in the folder name, this priority is increased by `1`, so `install.dev` has `51` and `install.a1.dev` has `52`.
 
 ## Start Level Support
 
diff --git a/src/main/jbake/content/documentation/bundles/sling-settings-org-apache-sling-settings.md b/src/main/jbake/content/documentation/bundles/sling-settings-org-apache-sling-settings.md
index 914d291..84859fb 100644
--- a/src/main/jbake/content/documentation/bundles/sling-settings-org-apache-sling-settings.md
+++ b/src/main/jbake/content/documentation/bundles/sling-settings-org-apache-sling-settings.md
@@ -17,7 +17,7 @@ The Sling Settings Bundle exposes the `SlingSettingsService` which allows access
 
 The new Sling Settings Bundle replaces the former `org.apache.sling.runmode` bundle and the `SlingSettingsService` previously provided by the Sling Engine bundle, as it also implements the run modes logic.
 
-## Selecting the active run modes
+# Selecting the active run modes
 The run modes are selected based on the `sling.run.modes` property (the "selection property"), specified in the Sling settings file or as a command-line parameter (which takes precedence), out of the valid run modes defined by the properties described below. The value is a String which contains a list of comma-separated run modes. If a run mode is given here which is not contained in any group of valid run modes (given in `sling.run.mode.install.options` or `sling.run.mode.options`) it i [...]
 
 Using `-Dsling.run.modes=foo,bar` on the JVM command-line, for example, activates the *foo* and *bar* run modes if that combination is valid.
@@ -65,7 +65,7 @@ User defined run modes (e.g. via property `sling.run.modes`) | Effectively activ
 
 Remember to look at the `RunModeImplTest` mentioned above for details, and feel free to enhance it with useful examples.
 
-### Getting the Run Modes of the Sling instance
+# Getting the Run Modes of the Sling instance
 
 The `SlingSettings` service provides the Run Modes of the running Sling instance as in this example:
 
@@ -80,3 +80,20 @@ The `SlingSettings` service provides the Run Modes of the running Sling instance
     }
 	
 Getting run modes in this way is usually not needed, it's better to define bundles or configurations that are only valid in specific run modes, rather than making decisions in code based on run modes.
+
+# Decisions based on Run Modes
+
+Since version 1.4.0 ([SLING-9031](https://issues.apache.org/jira/browse/SLING-9031) and [SLING-8548](https://issues.apache.org/jira/browse/SLING-8548)) of the Sling Settings bundle there is support for checking a run mode spec against the currently active run modes.
+
+The run mode spec grammar is as follows
+
+    run mode spec ::= disjunctions
+    disjunctions ::= conjunctions { "," conjunctions }
+    conjunctions ::= conjunction { '.' conjunction }
+    conjunction ::= notrunmode | runmode
+    notrunmode ::= '-' runmode
+
+It supports OR (`,`) and AND (`.`) combinations of run modes and negations with `-` .
+
+Programmatically this can be used via `SlingSettings.getBestRunModeMatchCountFromSpec(String runModeSpec)`.
+