You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 10:16:40 UTC
[sling-org-apache-sling-settings] 04/09: SLING-2674 - take new run
mode options into account when starting on an older Sling instance
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.settings-1.2.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-settings.git
commit 3ffd48407d5beeba6b57e8ab2b6cf7b78a843a07
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Nov 22 15:18:04 2012 +0000
SLING-2674 - take new run mode options into account when starting on an older Sling instance
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/settings@1412583 13f79535-47bb-0310-9956-ffa450edef68
---
.../sling/settings/impl/SlingSettingsServiceImpl.java | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/sling/settings/impl/SlingSettingsServiceImpl.java b/src/main/java/org/apache/sling/settings/impl/SlingSettingsServiceImpl.java
index 7447681..b998690 100644
--- a/src/main/java/org/apache/sling/settings/impl/SlingSettingsServiceImpl.java
+++ b/src/main/java/org/apache/sling/settings/impl/SlingSettingsServiceImpl.java
@@ -74,7 +74,14 @@ public class SlingSettingsServiceImpl
public SlingSettingsServiceImpl(final BundleContext context) {
this.setupSlingHome(context);
final boolean isInstall = this.setupSlingId(context);
- this.setupRunModes(context, isInstall);
+
+ // Detect if upgrading from a previous version (where OPTIONS_FILE did not exist),
+ // as in terms of run modes this needs to be handled like an install
+ final File options = context.getDataFile(OPTIONS_FILE);
+ final boolean isUpgrade = !isInstall && !options.exists();
+
+ logger.info("isInstall={}, isUpgrade={}", isInstall, isUpgrade);
+ this.setupRunModes(context, isInstall, isUpgrade);
}
@@ -157,7 +164,7 @@ public class SlingSettingsServiceImpl
*/
@SuppressWarnings("unchecked")
private void setupRunModes(final BundleContext context,
- final boolean isInstall) {
+ final boolean isInstall, final boolean isUpgrade) {
final Set<String> modesSet = new HashSet<String>();
// check configuration property first
@@ -172,7 +179,7 @@ public class SlingSettingsServiceImpl
// now options
this.handleOptions(modesSet, context.getProperty(RUN_MODE_OPTIONS));
// now install options
- if ( isInstall ) {
+ if ( isInstall || isUpgrade) {
final List<Options> optionsList = this.handleOptions(modesSet, context.getProperty(RUN_MODE_INSTALL_OPTIONS));
if ( optionsList != null ) {
final File file = context.getDataFile(OPTIONS_FILE);
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.