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:36 UTC

[sling-org-apache-sling-settings] annotated tag org.apache.sling.settings-1.2.2 created (now 717da52)

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

rombert pushed a change to annotated tag org.apache.sling.settings-1.2.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-settings.git.


      at 717da52  (tag)
 tagging 2e380679cb5a01517f86b196b248cf80d0d4bb07 (commit)
      by Carsten Ziegeler
      on Tue Nov 27 10:17:20 2012 +0000

- Log -----------------------------------------------------------------
org.apache.sling.settings-1.2.2
-----------------------------------------------------------------------

This annotated tag includes the following new commits:

     new e29b17b  SLING-1460 : Move SlingSettingsService to new Settings bundle
     new 2f625ec  SLING-1651 - Integrate RunMode module into new Settings Module SLING-983 - Add sling.properties file to configuration status page
     new fdbf548  SLING-1651 - Integrate RunMode module into new Settings Module SLING-983 - Add sling.properties file to configuration status page
     new 02d570e  Ignore Eclipse files
     new c7ffd13  Don't delete sling id file in engine for compatibility and add a temporary np check
     new fee338d  Delayed activation if engine bundle is available but not started yet.
     new 9381905  Some pom formatting, set export version and make dependencies provided
     new d766e1e  Add site generation properties and Bundle-DocURL manifest header
     new 55a7b4b  [maven-release-plugin] prepare release org.apache.sling.settings-1.0.0
     new 7374c80  [maven-release-plugin] prepare for next development iteration
     new 13ea134  Add README.txt
     new 1c24d3b  SLING-1835 : Remove direct dependency to web console by using new configuration printer support
     new 855b40f  [maven-release-plugin] prepare release org.apache.sling.settings-1.0.2
     new f8f82be  [maven-release-plugin] prepare for next development iteration
     new 305e51c  updating all modules to parent 10-SNAPSHOT in anticipation of emma additions to parent
     new dde5897  Update to recent snapshots
     new c7bd56b  Use latest releases.
     new de1d202  SLING-1970 : Potential deadlock during start of settings service
     new 9897382  SLING-2089 - adding getAbsolutePathWithinSlingHome() method
     new c144627  SLING-2150 : Update plugins to use the latest available versions
     new b1b2847  SLING-2155 : Remove check for Sling Engine bundle
     new 2614e9f  Update to recent snapshot
     new 09f8851  Using latest released parent pom
     new 8e82fb1  SLING-2187 - adding new module to contain our custom notice file; adding remote-resources plugin configuration to parent pom and removing all existing appended-resources NOTICE files
     new e535edf  temporarily using snapshots during release vote
     new cdf97c6  using latest releases
     new 50e68a4  [maven-release-plugin] prepare release org.apache.sling.settings-1.1.0
     new a9b604a  [maven-release-plugin] prepare for next development iteration
     new 73a4d66  SLING-2480 : Add config for maven-sling-plugin to m2e configuration
     new a10e502  Remove old scr javadoc annotation
     new dc197cd  Update to latest parent pom
     new 8a358ad  Use released versions
     new 11b3f5c  SLING-2662 :  Enhance run mode handling
     new 4c28623  SLING-2662 :  Enhance run mode handling
     new bbb8a01  SLING-2662 - more readable tests and some additional ones
     new cc7e187  [maven-release-plugin] prepare release org.apache.sling.settings-1.2.0
     new f582fe7  [maven-release-plugin] prepare for next development iteration
     new 4dc89f8  SLING-2662 - test case with empty run modes string
     new 1cb0791  SLING-2673 - close fis stream
     new 3ffd484  SLING-2674 - take new run mode options into account when starting on an older Sling instance
     new 1ae0f68  SLING-2674: SlingSettingsServiceImpl should detect and handle upgrades
     new 7c9f72c  Support portals bridge
     new 7c677f2  SLING-2674 :  SlingSettingsServiceImpl should detect and handle upgrades
     new 6f759e5  [maven-release-plugin] prepare release org.apache.sling.settings-1.2.2
     new 2e38067  [maven-release-plugin]  copy for tag org.apache.sling.settings-1.2.2

The 45 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.


-- 
To stop receiving notification emails like this one, please contact
['"commits@sling.apache.org" <co...@sling.apache.org>'].

[sling-org-apache-sling-settings] 02/09: SLING-2662 - test case with empty run modes string

Posted by ro...@apache.org.
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 4dc89f8d4fa81976a3e7a7c7d7147ab028ac9418
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Nov 22 13:47:25 2012 +0000

    SLING-2662 - test case with empty run modes string
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/settings@1412550 13f79535-47bb-0310-9956-ffa450edef68
---
 src/test/java/org/apache/sling/settings/impl/RunModeImplTest.java | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/test/java/org/apache/sling/settings/impl/RunModeImplTest.java b/src/test/java/org/apache/sling/settings/impl/RunModeImplTest.java
index 645b23a..36a2954 100644
--- a/src/test/java/org/apache/sling/settings/impl/RunModeImplTest.java
+++ b/src/test/java/org/apache/sling/settings/impl/RunModeImplTest.java
@@ -80,6 +80,12 @@ public class RunModeImplTest {
         assertActive(rm, false, "b", "c", "e", "f");
     }
 
+    @org.junit.Test public void testEmptyRunModesWithOptions() {
+        final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("", "a,b,c|d,e,f", null));
+        assertActive(rm, true, "a", "d");
+        assertActive(rm, false, "b", "c", "e", "f");
+    }
+
     @org.junit.Test public void testOptionsSelected() {
         final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("foo,bar,c,e", "a,b,c|d,e,f", null));
         assertActive(rm, true, "foo", "bar", "c", "e");

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-settings] 04/09: SLING-2674 - take new run mode options into account when starting on an older Sling instance

Posted by ro...@apache.org.
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>.

[sling-org-apache-sling-settings] 09/09: [maven-release-plugin] copy for tag org.apache.sling.settings-1.2.2

Posted by ro...@apache.org.
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 2e380679cb5a01517f86b196b248cf80d0d4bb07
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Nov 27 10:17:20 2012 +0000

    [maven-release-plugin]  copy for tag org.apache.sling.settings-1.2.2
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.settings-1.2.2@1414073 13f79535-47bb-0310-9956-ffa450edef68

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-settings] 01/09: [maven-release-plugin] prepare for next development iteration

Posted by ro...@apache.org.
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 f582fe7348a856caa429dd43dbd012d5e4f97d68
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Nov 16 07:43:09 2012 +0000

    [maven-release-plugin] prepare for next development iteration
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/settings@1410225 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index c6b66d1..8f3f2af 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,7 +29,7 @@
 
     <artifactId>org.apache.sling.settings</artifactId>
     <packaging>bundle</packaging>
-    <version>1.2.0</version>
+    <version>1.2.1-SNAPSHOT</version>
 
     <name>Apache Sling Settings</name>
     <description>
@@ -38,13 +38,13 @@
 
     <scm>
         <connection>
-            scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.settings-1.2.0
+            scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/settings
         </connection>
         <developerConnection>
-            scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.settings-1.2.0
+            scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/settings
         </developerConnection>
         <url>
-            http://svn.apache.org/viewvc/sling/tags/org.apache.sling.settings-1.2.0
+            http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/settings
         </url>
     </scm>
 

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-settings] 03/09: SLING-2673 - close fis stream

Posted by ro...@apache.org.
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 1cb079146ff8e82280756dbc8bb75ec463b0336c
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Nov 22 13:51:14 2012 +0000

    SLING-2673 - close fis stream
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/settings@1412552 13f79535-47bb-0310-9956-ffa450edef68
---
 .../java/org/apache/sling/settings/impl/SlingSettingsServiceImpl.java | 4 ++--
 1 file changed, 2 insertions(+), 2 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 89c2588..7447681 100644
--- a/src/main/java/org/apache/sling/settings/impl/SlingSettingsServiceImpl.java
+++ b/src/main/java/org/apache/sling/settings/impl/SlingSettingsServiceImpl.java
@@ -212,8 +212,8 @@ public class SlingSettingsServiceImpl
                     if ( ois != null ) {
                         try { ois.close(); } catch ( final IOException ignore) {}
                     }
-                    if ( ois != null ) {
-                        try { ois.close(); } catch ( final IOException ignore) {}
+                    if ( fis != null ) {
+                        try { fis.close(); } catch ( final IOException ignore) {}
                     }
                 }
                 if ( optionsList != null ) {

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-settings] 08/09: [maven-release-plugin] prepare release org.apache.sling.settings-1.2.2

Posted by ro...@apache.org.
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 6f759e57e1e20224fb52b4e94465c5fdbff649f1
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Nov 27 10:17:08 2012 +0000

    [maven-release-plugin] prepare release org.apache.sling.settings-1.2.2
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/settings@1414072 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index b147e79..0bc6e86 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,7 +29,7 @@
 
     <artifactId>org.apache.sling.settings</artifactId>
     <packaging>bundle</packaging>
-    <version>1.2.1-SNAPSHOT</version>
+    <version>1.2.2</version>
 
     <name>Apache Sling Settings</name>
     <description>
@@ -38,13 +38,13 @@
 
     <scm>
         <connection>
-            scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/settings
+            scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.settings-1.2.2
         </connection>
         <developerConnection>
-            scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/settings
+            scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.settings-1.2.2
         </developerConnection>
         <url>
-            http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/settings
+            http://svn.apache.org/viewvc/sling/tags/org.apache.sling.settings-1.2.2
         </url>
     </scm>
 

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-settings] 06/09: Support portals bridge

Posted by ro...@apache.org.
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 7c9f72c46bac36be6c8271c8cb7ec4a6257cae75
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Nov 23 14:46:43 2012 +0000

    Support portals bridge
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/settings@1412905 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |   6 +
 .../settings/impl/SlingSettingsServiceImpl.java    | 136 ++++++++++++---------
 2 files changed, 87 insertions(+), 55 deletions(-)

diff --git a/pom.xml b/pom.xml
index 8f3f2af..b147e79 100644
--- a/pom.xml
+++ b/pom.xml
@@ -98,6 +98,12 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.launchpad.api</artifactId>
+            <version>1.1.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
         </dependency>
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 e1de632..4ab883c 100644
--- a/src/main/java/org/apache/sling/settings/impl/SlingSettingsServiceImpl.java
+++ b/src/main/java/org/apache/sling/settings/impl/SlingSettingsServiceImpl.java
@@ -34,6 +34,7 @@ import java.util.List;
 import java.util.Set;
 import java.util.UUID;
 
+import org.apache.sling.launchpad.api.StartupMode;
 import org.apache.sling.settings.SlingSettingsService;
 import org.osgi.framework.BundleContext;
 import org.slf4j.Logger;
@@ -78,15 +79,24 @@ public class SlingSettingsServiceImpl
         // 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();
+        final boolean isUpdate = !isInstall && !options.exists();
 
-        logger.info("isInstall={}, isUpgrade={}", isInstall, isUpgrade);
-        this.setupRunModes(context, isInstall || isUpgrade);
+        final String startupModeObj = context.getProperty(StartupMode.class.getName());
+        final StartupMode mode;
+        if ( startupModeObj != null ) {
+            mode = StartupMode.valueOf(startupModeObj);
+            logger.debug("Settings: Using startup mode : {}", mode);
+        } else {
+            logger.debug("Settings: Startup mode detection: isInstall={}, isUpdate={}", isInstall, isUpdate);
+            mode = isInstall ? StartupMode.INSTALL : (isUpdate ? StartupMode.UPDATE : StartupMode.RESTART);
+        }
+
+        this.setupRunModes(context, mode);
 
     }
 
     /**
-     * Get sling home and sling home url
+     * Get sling home and sling home URL
      */
     private void setupSlingHome(final BundleContext context) {
         this.slingHome = context.getProperty(SLING_HOME);
@@ -163,7 +173,7 @@ public class SlingSettingsServiceImpl
      */
     @SuppressWarnings("unchecked")
     private void setupRunModes(final BundleContext context,
-            final boolean inspectInstallOptions) {
+            final StartupMode startupMode) {
         final Set<String> modesSet = new HashSet<String>();
 
         // check configuration property first
@@ -175,62 +185,31 @@ public class SlingSettingsServiceImpl
             }
         }
 
-        // now options
+        //  handle configured options
         this.handleOptions(modesSet, context.getProperty(RUN_MODE_OPTIONS));
-        // now install options
-        if ( inspectInstallOptions ) {
-            final List<Options> optionsList = this.handleOptions(modesSet, context.getProperty(RUN_MODE_INSTALL_OPTIONS));
-            final File file = context.getDataFile(OPTIONS_FILE);
-            FileOutputStream fos = null;
-            ObjectOutputStream oos = null;
-            try {
-                fos = new FileOutputStream(file);
-                oos = new ObjectOutputStream(fos);
-                oos.writeObject(optionsList);
-            } catch ( final IOException ioe ) {
-                throw new RuntimeException("Unable to write to options data file.", ioe);
-            } finally {
-                if ( oos != null ) {
-                    try { oos.close(); } catch ( final IOException ignore) {}
-                }
-                if ( fos != null ) {
-                    try { fos.close(); } catch ( final IOException ignore) {}
-                }
-            }
-        } else {
-            final File file = context.getDataFile(OPTIONS_FILE);
-            if ( file.exists() ) {
-                List<Options> optionsList = null;
-                FileInputStream fis = null;
-                ObjectInputStream ois = null;
-                try {
-                    fis = new FileInputStream(file);
-                    ois = new ObjectInputStream(fis);
-
-                    optionsList = (List<Options>) ois.readObject();
-                } catch ( final IOException ioe ) {
-                    throw new RuntimeException("Unable to read from options data file.", ioe);
-                } catch (ClassNotFoundException cnfe) {
-                    throw new RuntimeException("Unable to read from options data file.", cnfe);
-                } finally {
-                    if ( ois != null ) {
-                        try { ois.close(); } catch ( final IOException ignore) {}
-                    }
-                    if ( fis != null ) {
-                        try { fis.close(); } catch ( final IOException ignore) {}
-                    }
-                }
-                if ( optionsList != null ) {
-                    for(final Options o : optionsList) {
-                        for(final String m : o.modes) {
-                            modesSet.remove(m);
-                        }
-                        modesSet.add(o.selected);
+
+        // handle configured install options
+        if ( startupMode != StartupMode.INSTALL ) {
+            // read persisted options if restart or update
+            final List<Options> storedOptions = readOptions(context);
+            if ( storedOptions != null ) {
+                for(final Options o : storedOptions) {
+                    for(final String m : o.modes) {
+                        modesSet.remove(m);
                     }
+                    modesSet.add(o.selected);
                 }
             }
         }
 
+        // now install options
+        if ( startupMode != StartupMode.RESTART ) {
+            // process new install options if install or update
+            final List<Options> optionsList = this.handleOptions(modesSet, context.getProperty(RUN_MODE_INSTALL_OPTIONS));
+            // and always save new install options
+            writeOptions(context, optionsList);
+        }
+
         // make the set unmodifiable and synced
         // we probably don't need a synced set as it is read only
         this.runModes = Collections.synchronizedSet(Collections.unmodifiableSet(modesSet));
@@ -242,6 +221,53 @@ public class SlingSettingsServiceImpl
     }
 
 
+    private List<Options> readOptions(final BundleContext context) {
+        List<Options> optionsList = null;
+        final File file = context.getDataFile(OPTIONS_FILE);
+        if ( file.exists() ) {
+            FileInputStream fis = null;
+            ObjectInputStream ois = null;
+            try {
+                fis = new FileInputStream(file);
+                ois = new ObjectInputStream(fis);
+
+                optionsList = (List<Options>) ois.readObject();
+            } catch ( final IOException ioe ) {
+                throw new RuntimeException("Unable to read from options data file.", ioe);
+            } catch (ClassNotFoundException cnfe) {
+                throw new RuntimeException("Unable to read from options data file.", cnfe);
+            } finally {
+                if ( ois != null ) {
+                    try { ois.close(); } catch ( final IOException ignore) {}
+                }
+                if ( fis != null ) {
+                    try { fis.close(); } catch ( final IOException ignore) {}
+                }
+            }
+        }
+        return optionsList;
+    }
+
+    private void writeOptions(final BundleContext context, final List<Options> optionsList) {
+        final File file = context.getDataFile(OPTIONS_FILE);
+        FileOutputStream fos = null;
+        ObjectOutputStream oos = null;
+        try {
+            fos = new FileOutputStream(file);
+            oos = new ObjectOutputStream(fos);
+            oos.writeObject(optionsList);
+        } catch ( final IOException ioe ) {
+            throw new RuntimeException("Unable to write to options data file.", ioe);
+        } finally {
+            if ( oos != null ) {
+                try { oos.close(); } catch ( final IOException ignore) {}
+            }
+            if ( fos != null ) {
+                try { fos.close(); } catch ( final IOException ignore) {}
+            }
+        }
+    }
+
     /**
      * Read the id from a file.
      */

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-settings] 05/09: SLING-2674: SlingSettingsServiceImpl should detect and handle upgrades

Posted by ro...@apache.org.
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 1ae0f68160210726624a2255b19248b33d9eee4c
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Nov 23 06:47:31 2012 +0000

    SLING-2674: SlingSettingsServiceImpl should detect and handle upgrades
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/settings@1412761 13f79535-47bb-0310-9956-ffa450edef68
---
 .../settings/impl/SlingSettingsServiceImpl.java    | 47 ++++++++++------------
 1 file changed, 22 insertions(+), 25 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 b998690..e1de632 100644
--- a/src/main/java/org/apache/sling/settings/impl/SlingSettingsServiceImpl.java
+++ b/src/main/java/org/apache/sling/settings/impl/SlingSettingsServiceImpl.java
@@ -74,14 +74,14 @@ public class SlingSettingsServiceImpl
     public SlingSettingsServiceImpl(final BundleContext context) {
         this.setupSlingHome(context);
         final boolean isInstall = this.setupSlingId(context);
-        
+
         // 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);
+        this.setupRunModes(context, isInstall || isUpgrade);
 
     }
 
@@ -128,8 +128,8 @@ public class SlingSettingsServiceImpl
     }
 
     private List<Options> handleOptions(final Set<String> modesSet, final String propOptions) {
+        final List<Options> optionsList = new ArrayList<Options>();
         if ( propOptions != null && propOptions.trim().length() > 0 ) {
-            final List<Options> optionsList = new ArrayList<Options>();
 
             final String[] options = propOptions.trim().split("\\|");
             for(final String opt : options) {
@@ -154,9 +154,8 @@ public class SlingSettingsServiceImpl
                 o.modes = modes;
                 optionsList.add(o);
             }
-            return optionsList;
         }
-        return null;
+        return optionsList;
     }
 
     /**
@@ -164,7 +163,7 @@ public class SlingSettingsServiceImpl
      */
     @SuppressWarnings("unchecked")
     private void setupRunModes(final BundleContext context,
-            final boolean isInstall, final boolean isUpgrade) {
+            final boolean inspectInstallOptions) {
         final Set<String> modesSet = new HashSet<String>();
 
         // check configuration property first
@@ -179,25 +178,23 @@ public class SlingSettingsServiceImpl
         // now options
         this.handleOptions(modesSet, context.getProperty(RUN_MODE_OPTIONS));
         // now install options
-        if ( isInstall || isUpgrade) {
+        if ( inspectInstallOptions ) {
             final List<Options> optionsList = this.handleOptions(modesSet, context.getProperty(RUN_MODE_INSTALL_OPTIONS));
-            if ( optionsList != null ) {
-                final File file = context.getDataFile(OPTIONS_FILE);
-                FileOutputStream fos = null;
-                ObjectOutputStream oos = null;
-                try {
-                    fos = new FileOutputStream(file);
-                    oos = new ObjectOutputStream(fos);
-                    oos.writeObject(optionsList);
-                } catch ( final IOException ioe ) {
-                    throw new RuntimeException("Unable to write to options data file.", ioe);
-                } finally {
-                    if ( oos != null ) {
-                        try { oos.close(); } catch ( final IOException ignore) {}
-                    }
-                    if ( fos != null ) {
-                        try { fos.close(); } catch ( final IOException ignore) {}
-                    }
+            final File file = context.getDataFile(OPTIONS_FILE);
+            FileOutputStream fos = null;
+            ObjectOutputStream oos = null;
+            try {
+                fos = new FileOutputStream(file);
+                oos = new ObjectOutputStream(fos);
+                oos.writeObject(optionsList);
+            } catch ( final IOException ioe ) {
+                throw new RuntimeException("Unable to write to options data file.", ioe);
+            } finally {
+                if ( oos != null ) {
+                    try { oos.close(); } catch ( final IOException ignore) {}
+                }
+                if ( fos != null ) {
+                    try { fos.close(); } catch ( final IOException ignore) {}
                 }
             }
         } else {

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-settings] 07/09: SLING-2674 : SlingSettingsServiceImpl should detect and handle upgrades

Posted by ro...@apache.org.
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 7c677f21f70af1b2259bf7261ba3063cd1286b5d
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Nov 26 10:14:09 2012 +0000

    SLING-2674 :  SlingSettingsServiceImpl should detect and handle upgrades
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/settings@1413541 13f79535-47bb-0310-9956-ffa450edef68
---
 .../org/apache/sling/settings/impl/Activator.java  |  43 +----
 .../sling/settings/impl/ServicesListener.java      | 199 +++++++++++++++++++++
 .../settings/impl/SlingSettingsServiceImpl.java    |  28 +--
 .../sling/settings/impl/RunModeImplTest.java       |  61 +++++--
 4 files changed, 257 insertions(+), 74 deletions(-)

diff --git a/src/main/java/org/apache/sling/settings/impl/Activator.java b/src/main/java/org/apache/sling/settings/impl/Activator.java
index 2d1c2a8..91781f2 100644
--- a/src/main/java/org/apache/sling/settings/impl/Activator.java
+++ b/src/main/java/org/apache/sling/settings/impl/Activator.java
@@ -18,14 +18,8 @@
  */
 package org.apache.sling.settings.impl;
 
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.apache.sling.settings.SlingSettingsService;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceRegistration;
 
 /**
  * This is the bundle activator.
@@ -34,48 +28,23 @@ import org.osgi.framework.ServiceRegistration;
  */
 public class Activator implements BundleActivator {
 
-    /** The service registration */
-    private ServiceRegistration serviceRegistration;
+    /** The service listener */
+    private ServicesListener servicesListener;
 
     /**
      * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
      */
     public void start(final BundleContext bundleContext) throws Exception {
-        final SlingSettingsService settingsService = new SlingSettingsServiceImpl(bundleContext);
-
-        final Dictionary<String, String> props = new Hashtable<String, String>();
-        props.put(Constants.SERVICE_PID, settingsService.getClass().getName());
-        props.put(Constants.SERVICE_DESCRIPTION,
-            "Apache Sling Settings Service");
-        props.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation");
-        serviceRegistration = bundleContext.registerService(new String[] {
-                                               SlingSettingsService.class.getName()},
-                                               settingsService, props);
-        SlingPropertiesPrinter.initPlugin(bundleContext);
-        SlingSettingsPrinter.initPlugin(bundleContext, settingsService);
-        try {
-            RunModeCommand.initPlugin(bundleContext, settingsService.getRunModes());
-        } catch (Throwable ignore) {
-            // we just ignore this
-        }
-
+        this.servicesListener = new ServicesListener(bundleContext);
     }
 
     /**
      * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
      */
     public void stop(final BundleContext context) throws Exception {
-        try {
-            RunModeCommand.destroyPlugin();
-        } catch (Throwable ignore) {
-            // we just ignore this
-        }
-        SlingSettingsPrinter.destroyPlugin();
-        SlingPropertiesPrinter.destroyPlugin();
-
-        if ( serviceRegistration != null ) {
-            serviceRegistration.unregister();
-            serviceRegistration = null;
+        if ( this.servicesListener != null ) {
+            this.servicesListener.deactivate();
+            this.servicesListener = null;
         }
     }
 }
diff --git a/src/main/java/org/apache/sling/settings/impl/ServicesListener.java b/src/main/java/org/apache/sling/settings/impl/ServicesListener.java
new file mode 100644
index 0000000..77b8045
--- /dev/null
+++ b/src/main/java/org/apache/sling/settings/impl/ServicesListener.java
@@ -0,0 +1,199 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.settings.impl;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.apache.sling.launchpad.api.StartupHandler;
+import org.apache.sling.settings.SlingSettingsService;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * The <code>ServicesListener</code> listens for the required services
+ * and registers the settings service once all required services are
+ * available
+ */
+public class ServicesListener {
+
+    /** The bundle context. */
+    private final BundleContext bundleContext;
+
+    /** The listener for the startup handler. */
+    private final Listener startupListener;
+
+    /** The registration of the settings service. */
+    private ServiceRegistration settingsReg;
+
+    /**
+     * Start listeners
+     */
+    public ServicesListener(final BundleContext bundleContext) {
+        this.bundleContext = bundleContext;
+        this.startupListener = new Listener(StartupHandler.class.getName());
+        this.startupListener.start();
+    }
+
+    /**
+     * Notify of service changes from the listeners.
+     * If all services are available, register listener and pass resources
+     * to the OSGi installer.
+     */
+    public synchronized void notifyChange() {
+        // check if all services are available
+        final StartupHandler handler = (StartupHandler)this.startupListener.getService();
+        if ( handler != null && this.settingsReg == null ) {
+            this.activate(handler);
+        }
+    }
+
+    private void activate(final StartupHandler handler) {
+        final SlingSettingsService settingsService = new SlingSettingsServiceImpl(bundleContext, handler);
+
+        final Dictionary<String, String> props = new Hashtable<String, String>();
+        props.put(Constants.SERVICE_PID, settingsService.getClass().getName());
+        props.put(Constants.SERVICE_DESCRIPTION,
+            "Apache Sling Settings Service");
+        props.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation");
+        this.settingsReg = bundleContext.registerService(new String[] {
+                                               SlingSettingsService.class.getName()},
+                                               settingsService, props);
+        SlingPropertiesPrinter.initPlugin(bundleContext);
+        SlingSettingsPrinter.initPlugin(bundleContext, settingsService);
+        try {
+            RunModeCommand.initPlugin(bundleContext, settingsService.getRunModes());
+        } catch (Throwable ignore) {
+            // we just ignore this
+        }
+    }
+    /**
+     * Deactivate this listener.
+     */
+    public void deactivate() {
+        this.startupListener.deactivate();
+        if ( this.settingsReg != null ) {
+            this.settingsReg.unregister();
+            this.settingsReg = null;
+        }
+        try {
+            RunModeCommand.destroyPlugin();
+        } catch (Throwable ignore) {
+            // we just ignore this
+        }
+        SlingSettingsPrinter.destroyPlugin();
+        SlingPropertiesPrinter.destroyPlugin();
+    }
+
+    /**
+     * Helper class listening for service events for a defined service.
+     */
+    protected final class Listener implements ServiceListener {
+
+        /** The name of the service. */
+        private final String serviceName;
+
+        /** The service reference. */
+        private volatile ServiceReference reference;
+
+        /** The service. */
+        private volatile Object service;
+
+        /**
+         * Constructor
+         */
+        public Listener(final String serviceName) {
+            this.serviceName = serviceName;
+        }
+
+        /**
+         * Start the listener.
+         * First register a service listener and then check for the service.
+         */
+        public void start() {
+            try {
+                bundleContext.addServiceListener(this, "("
+                        + Constants.OBJECTCLASS + "=" + serviceName + ")");
+            } catch (final InvalidSyntaxException ise) {
+                // this should really never happen
+                throw new RuntimeException("Unexpected exception occured.", ise);
+            }
+            this.retainService();
+        }
+
+        /**
+         * Unregister the listener.
+         */
+        public void deactivate() {
+            bundleContext.removeServiceListener(this);
+        }
+
+        /**
+         * Return the service (if available)
+         */
+        public synchronized Object getService() {
+            return this.service;
+        }
+
+        /**
+         * Try to get the service and notify the change.
+         */
+        private synchronized void retainService() {
+            if ( this.reference == null ) {
+                this.reference = bundleContext.getServiceReference(this.serviceName);
+                if ( this.reference != null ) {
+                    this.service = bundleContext.getService(this.reference);
+                    if ( this.service == null ) {
+                        this.reference = null;
+                    } else {
+                        notifyChange();
+                    }
+                }
+            }
+        }
+
+        /**
+         * Try to release the service and notify the change.
+         */
+        private synchronized void releaseService() {
+            if ( this.reference != null ) {
+                this.service = null;
+                bundleContext.ungetService(this.reference);
+                this.reference = null;
+                notifyChange();
+            }
+        }
+
+        /**
+         * @see org.osgi.framework.ServiceListener#serviceChanged(org.osgi.framework.ServiceEvent)
+         */
+        public void serviceChanged(ServiceEvent event) {
+            if (event.getType() == ServiceEvent.REGISTERED) {
+                this.retainService();
+            } else if ( event.getType() == ServiceEvent.UNREGISTERING ) {
+                this.releaseService();
+            }
+        }
+    }
+}
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 4ab883c..8836a57 100644
--- a/src/main/java/org/apache/sling/settings/impl/SlingSettingsServiceImpl.java
+++ b/src/main/java/org/apache/sling/settings/impl/SlingSettingsServiceImpl.java
@@ -34,6 +34,7 @@ import java.util.List;
 import java.util.Set;
 import java.util.UUID;
 
+import org.apache.sling.launchpad.api.StartupHandler;
 import org.apache.sling.launchpad.api.StartupMode;
 import org.apache.sling.settings.SlingSettingsService;
 import org.osgi.framework.BundleContext;
@@ -72,24 +73,13 @@ public class SlingSettingsServiceImpl
      * Setup run modes
      * @param context The bundle context
      */
-    public SlingSettingsServiceImpl(final BundleContext context) {
+    public SlingSettingsServiceImpl(final BundleContext context,
+            final StartupHandler handler) {
         this.setupSlingHome(context);
-        final boolean isInstall = this.setupSlingId(context);
-
-        // 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 isUpdate = !isInstall && !options.exists();
-
-        final String startupModeObj = context.getProperty(StartupMode.class.getName());
-        final StartupMode mode;
-        if ( startupModeObj != null ) {
-            mode = StartupMode.valueOf(startupModeObj);
-            logger.debug("Settings: Using startup mode : {}", mode);
-        } else {
-            logger.debug("Settings: Startup mode detection: isInstall={}, isUpdate={}", isInstall, isUpdate);
-            mode = isInstall ? StartupMode.INSTALL : (isUpdate ? StartupMode.UPDATE : StartupMode.RESTART);
-        }
+        this.setupSlingId(context);
+
+        final StartupMode mode = handler.getMode();
+        logger.debug("Settings: Using startup mode : {}", mode);
 
         this.setupRunModes(context, mode);
 
@@ -113,7 +103,7 @@ public class SlingSettingsServiceImpl
     /**
      * Get / create sling id
      */
-    private boolean setupSlingId(final BundleContext context) {
+    private void setupSlingId(final BundleContext context) {
         // try to read the id from the id file first
         final File idFile = context.getDataFile(DATA_FILE);
         if ( idFile == null ) {
@@ -126,9 +116,7 @@ public class SlingSettingsServiceImpl
         if (slingId == null) {
             slingId = UUID.randomUUID().toString();
             this.writeSlingId(idFile, this.slingId);
-            return true;
         }
-        return false;
     }
 
     private static final class Options implements Serializable {
diff --git a/src/test/java/org/apache/sling/settings/impl/RunModeImplTest.java b/src/test/java/org/apache/sling/settings/impl/RunModeImplTest.java
index 36a2954..658fad5 100644
--- a/src/test/java/org/apache/sling/settings/impl/RunModeImplTest.java
+++ b/src/test/java/org/apache/sling/settings/impl/RunModeImplTest.java
@@ -30,6 +30,8 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.sling.launchpad.api.StartupHandler;
+import org.apache.sling.launchpad.api.StartupMode;
 import org.apache.sling.settings.SlingSettingsService;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
@@ -44,8 +46,33 @@ import org.osgi.framework.ServiceRegistration;
 
 public class RunModeImplTest {
 
+    private final class StartupHandlerImpl implements StartupHandler {
+
+        private final StartupMode mode;
+
+        public StartupHandlerImpl() {
+            this(StartupMode.INSTALL);
+        }
+
+        public StartupHandlerImpl(final StartupMode mode) {
+            this.mode = mode;
+        }
+
+        public void waitWithStartup(final boolean flag) {
+            // nothing to do
+        }
+
+        public boolean isFinished() {
+            return false;
+        }
+
+        public StartupMode getMode() {
+            return this.mode;
+        }
+    };
+
     private void assertParse(String str, String [] expected) {
-        final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock(str, null, null));
+        final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock(str, null, null), new StartupHandlerImpl());
         final Set<String> modes = rm.getRunModes();
         final String[] actual = modes.toArray(new String[modes.size()]);
         assertArrayEquals("Parsed runModes match for '" + str + "'", expected, actual);
@@ -57,7 +84,7 @@ public class RunModeImplTest {
         assertParse(" foo \t", new String[] { "foo" });
         assertParse(" foo \t,  bar\n", new String[] { "foo", "bar" });
     }
-    
+
     private void assertActive(SlingSettingsService s, boolean active, String ...modes) {
         for(String mode : modes) {
             if(active) {
@@ -69,77 +96,77 @@ public class RunModeImplTest {
     }
 
     @org.junit.Test public void testMatchesNotEmpty() {
-        final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("foo,bar", null, null));
+        final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("foo,bar", null, null), new StartupHandlerImpl());
         assertActive(rm, true, "foo", "bar");
         assertActive(rm, false, "wiz", "bah", "");
     }
 
     @org.junit.Test public void testOptions() {
-        final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("foo,bar", "a,b,c|d,e,f", null));
+        final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("foo,bar", "a,b,c|d,e,f", null), new StartupHandlerImpl());
         assertActive(rm, true, "foo", "bar", "a", "d");
         assertActive(rm, false, "b", "c", "e", "f");
     }
 
     @org.junit.Test public void testEmptyRunModesWithOptions() {
-        final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("", "a,b,c|d,e,f", null));
+        final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("", "a,b,c|d,e,f", null), new StartupHandlerImpl());
         assertActive(rm, true, "a", "d");
         assertActive(rm, false, "b", "c", "e", "f");
     }
 
     @org.junit.Test public void testOptionsSelected() {
-        final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("foo,bar,c,e", "a,b,c|d,e,f", null));
+        final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("foo,bar,c,e", "a,b,c|d,e,f", null), new StartupHandlerImpl());
         assertActive(rm, true, "foo", "bar", "c", "e");
         assertActive(rm, false, "a", "b", "d", "f");
     }
 
     @org.junit.Test public void testOptionsMultipleSelected() {
-        final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("foo,bar,c,e,f,a", "a,b,c|d,e,f", null));
+        final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("foo,bar,c,e,f,a", "a,b,c|d,e,f", null), new StartupHandlerImpl());
         assertActive(rm, true, "foo", "bar", "a", "e");
         assertActive(rm, false, "b", "c", "d", "f");
     }
 
     @org.junit.Test public void testOptionsMultipleSelected2() {
-        final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("foo,bar,c,f,a,d", "a,b,c|d,e,f", null));
+        final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("foo,bar,c,f,a,d", "a,b,c|d,e,f", null), new StartupHandlerImpl());
         assertActive(rm, true, "foo", "bar", "a", "d");
         assertActive(rm, false, "b", "c", "e", "f");
     }
 
     @org.junit.Test public void testInstallOptions() {
-        final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("foo,bar", null, "a,b,c|d,e,f"));
+        final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("foo,bar", null, "a,b,c|d,e,f"), new StartupHandlerImpl());
         assertActive(rm, true, "foo", "bar", "a", "d");
         assertActive(rm, false, "b", "c", "e", "f");
     }
 
     @org.junit.Test public void testInstallOptionsSelected() {
-        final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("foo,bar,c,e", null , "a,b,c|d,e,f"));
+        final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("foo,bar,c,e", null , "a,b,c|d,e,f"), new StartupHandlerImpl());
         assertActive(rm, true, "foo", "bar", "c", "e");
         assertActive(rm, false, "a", "b", "d", "f");
     }
 
     @org.junit.Test public void testInstallOptionsMultipleSelected() {
-        final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("foo,bar,c,e,f,a", null, "a,b,c|d,e,f"));
+        final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("foo,bar,c,e,f,a", null, "a,b,c|d,e,f"), new StartupHandlerImpl());
         assertActive(rm, true, "foo", "bar", "a", "e");
         assertActive(rm, false, "b", "c", "d", "f");
     }
 
     @org.junit.Test public void testInstallOptionsMultipleSelected2() {
-        final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("foo,bar,c,d,f,a", null, "a,b,c|d,e,f"));
+        final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("foo,bar,c,d,f,a", null, "a,b,c|d,e,f"), new StartupHandlerImpl());
         assertActive(rm, true, "foo", "bar", "a", "d");
         assertActive(rm, false, "b", "c", "e", "f");
     }
 
     @org.junit.Test public void testInstallOptionsRestart() {
         final BundleContextMock bc = new BundleContextMock("foo,bar,c,e,f,a", null, "a,b,c|d,e,f");
-        
+
         {
             // create first context to simulate install
-            final SlingSettingsService rm = new SlingSettingsServiceImpl(bc);
+            final SlingSettingsService rm = new SlingSettingsServiceImpl(bc, new StartupHandlerImpl());
             assertActive(rm, true, "foo", "bar", "a", "e");
             assertActive(rm, false, "b", "c", "d", "f");
         }
-        
+
         {
-            final SlingSettingsService rm = new SlingSettingsServiceImpl(bc);
+            final SlingSettingsService rm = new SlingSettingsServiceImpl(bc, new StartupHandlerImpl(StartupMode.RESTART));
             assertActive(rm, true, "foo", "bar", "a", "e");
             assertActive(rm, false, "b", "c", "d", "f");
         }
@@ -148,7 +175,7 @@ public class RunModeImplTest {
         // mentioned in the .options properties are ignored
         bc.update("foo,doo,a,b,c,d,e,f,waa");
         {
-            final SlingSettingsService rm = new SlingSettingsServiceImpl(bc);
+            final SlingSettingsService rm = new SlingSettingsServiceImpl(bc, new StartupHandlerImpl(StartupMode.RESTART));
             assertActive(rm, true, "foo", "doo", "a", "e", "waa");
             assertActive(rm, false, "bar", "b", "c", "d", "f");
         }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.