This is an automated email from the ASF dual-hosted git repository. kwin pushed a commit to branch feature/enhanced-runmodes in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-installer-provider-file.git
commit edb8d53277f7443b6dec3efff127245a2f213b6b Author: Konrad Windszus <[email protected]> AuthorDate: Thu Jun 25 17:45:08 2020 +0200 SLING-9031 SLING-8548 support enhanced run modes Both OR-logic and NOT operator are now supported --- pom.xml | 2 +- .../sling/installer/provider/file/impl/Installer.java | 15 ++------------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/pom.xml b/pom.xml index 218c760..9abf151 100644 --- a/pom.xml +++ b/pom.xml @@ -67,7 +67,7 @@ <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.installer.core</artifactId> - <version>3.10.0</version> + <version>3.11.5-SNAPSHOT</version> <scope>provided</scope> </dependency> <dependency> diff --git a/src/main/java/org/apache/sling/installer/provider/file/impl/Installer.java b/src/main/java/org/apache/sling/installer/provider/file/impl/Installer.java index 1b05e78..e5f16db 100644 --- a/src/main/java/org/apache/sling/installer/provider/file/impl/Installer.java +++ b/src/main/java/org/apache/sling/installer/provider/file/impl/Installer.java @@ -30,6 +30,7 @@ import java.util.Set; import org.apache.sling.installer.api.InstallableResource; import org.apache.sling.installer.api.OsgiInstaller; +import org.apache.sling.installer.api.provider.RunModeSupport; import org.apache.sling.settings.SlingSettingsService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -145,7 +146,7 @@ public class Installer final int pos = name.indexOf('/'); if ( pos != -1 && name.startsWith("install.") ) { final String runModes = name.substring(8, pos); - final int activeModes = this.isActive(runModes); + final int activeModes = RunModeSupport.getNumberOfMatchingRunmodesFromDisjunctions(runModes, activeRunModes);; if ( activeModes > 0 ) { prio = InstallableResource.DEFAULT_PRIORITY + activeModes; } else { @@ -181,16 +182,4 @@ public class Installer return null; } - private int isActive(final String runModesString) { - final String[] runModes = runModesString.split("\\."); - boolean active = true; - for(final String mode : runModes) { - if ( !activeRunModes.contains(mode) ) { - active = false; - break; - } - } - - return active ? runModes.length : 0; - } }
