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:17:19 UTC

[sling-org-apache-sling-settings] annotated tag org.apache.sling.settings-1.3.8 created (now fdf0def)

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

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


      at fdf0def  (tag)
 tagging 2dcdb47957654d30014524a6ad4430a6ea5534f5 (commit)
      by Carsten Ziegeler
      on Tue Dec 29 10:00:51 2015 +0000

- Log -----------------------------------------------------------------
org.apache.sling.settings-1.3.8
-----------------------------------------------------------------------

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 442e5f4  [maven-release-plugin] prepare for next development iteration
     new 63f7ade  Use latest releases and update to new parent pom
     new 6d4543f  Update to latest parent pom and use latest releases in launchpad
     new 5cd294c  Correct reactor pom and update to parent pom 16
     new a3279d2  Update to latest parent pom
     new 2395548  SLING-2976 :  Add support for instance name and description
     new aeb6067  SLING-2976 :  Add support for instance name and description
     new 2b30ad8  [maven-release-plugin] prepare release org.apache.sling.settings-1.3.0
     new 2b35f10  [maven-release-plugin] prepare for next development iteration
     new ce2f298  Update to parent pom 18
     new a716016  Revert to old maven bundle plugin if DynamicImport-Package is used
     new 11b2ccd  SLING-3286 - Remove plugin version overrides from poms
     new a52cf20  SLING-3286 - Remove plugin version overrides from poms
     new 1f53831  Update to parent pom v19
     new dac3466  SLING-3737 : Instance Sling Identifier may be randomly reset on restart. Apply patch from Timothee Maret
     new 26ab368  [maven-release-plugin] prepare release org.apache.sling.settings-1.3.2
     new ca1d3d5  [maven-release-plugin] prepare for next development iteration
     new e11f919  Updated to parent version 20
     new 521ed2b  SLING-3818 - RunModeImplTest.testParseRunModes fails under Java 8 : Parsed runModes match for ' foo , bar '
     new c008719  Update to Sling Parent POM 22 with baselining enabled
     new 73217ee  SLING-3981 : Make dependency to config admin optional
     new 40209b6  [maven-release-plugin] prepare release org.apache.sling.settings-1.3.4
     new 44740b4  [maven-release-plugin] prepare for next development iteration
     new 91c8c18  SLING-4482 : Settings plugin might not show current values for sling properties
     new 869c7a8  [maven-release-plugin] prepare release org.apache.sling.settings-1.3.6
     new bef7237  [maven-release-plugin] prepare for next development iteration
     new 7944ce3  Add missing licence header
     new e896bc3  SLING-4698 - Set parent.relativePath to empty for all modules
     new a1c1433  Update to Sling Parent 23
     new 54f7c27  set parent version to 24 and add empty relativePath where missing
     new 8f96117  fix typo
     new 418f672  Update the main reactor to parent 25
     new d706264  SLING-5190 factor out of SlingSettingsServiceImpl a Sling ID util
     new bbdf3d1  SLING-5190 factor out of SlingSettingsServiceImpl a Sling ID util
     new 418f76c  SLING-5190 factor out of SlingSettingsServiceImpl a Sling ID util
     new de5307b  SLING-5190 factor out of SlingSettingsServiceImpl a Sling ID util
     new 1456ce5  SLING-5190 factor out of SlingSettingsServiceImpl a Sling ID util
     new 11e1d65  revert r1710229 SLING-5190 factor out of SlingSettingsServiceImpl a Sling ID util
     new 6357e3e  SLING-5190 factor out of SlingSettingsServiceImpl a Sling ID util
     new bab3a9b  SLING-5190 factor out of SlingSettingsServiceImpl a Sling ID util
     new 564691c  style
     new 566a7fe  SLING-5190 factor out of SlingSettingsServiceImpl a Sling ID util
     new 43aced2  style
     new 9a2c5e6  SLING-4892 : Remove dependency to StartupHandler
     new 40550d2  [maven-release-plugin] prepare release org.apache.sling.settings-1.3.8
     new 2dcdb47  [maven-release-plugin] copy for tag org.apache.sling.settings-1.3.8

The 90 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] 16/21: style

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.3.8
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-settings.git

commit 564691c4c8a8afa06675b59707c4287825612947
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Sat Oct 24 11:53:55 2015 +0000

    style
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/settings@1710335 13f79535-47bb-0310-9956-ffa450edef68
---
 .../impl/SlingSettingsServiceImplTest.java         | 56 ++++++++++------------
 1 file changed, 25 insertions(+), 31 deletions(-)

diff --git a/src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java b/src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java
index 13cd74a..0bf1a37 100644
--- a/src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java
+++ b/src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java
@@ -32,9 +32,11 @@ import org.junit.Assert;
 import org.apache.sling.launchpad.api.StartupHandler;
 import org.junit.Before;
 import org.junit.Test;
-import org.mockito.Mockito;
 import org.osgi.framework.BundleContext;
 
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
 public class SlingSettingsServiceImplTest {
 
     private static final String SLING_ID_FILE_NAME = "sling.id.file";
@@ -49,15 +51,13 @@ public class SlingSettingsServiceImplTest {
 
     @Before
     public void before() throws IOException {
-        slingIdFile = File.createTempFile(
-                SLING_ID_FILE_NAME, "");
-        optionsFile = File.createTempFile(
-                OPTIONS_FILE_NAME, "");
+        slingIdFile = File.createTempFile(SLING_ID_FILE_NAME, "");
+        optionsFile = File.createTempFile(OPTIONS_FILE_NAME, "");
     }
 
     @After
     public void after() throws IOException {
-        if (slingIdFile != null ) {
+        if (slingIdFile != null) {
             slingIdFile.delete();
             slingIdFile = null;
         }
@@ -68,19 +68,17 @@ public class SlingSettingsServiceImplTest {
     }
 
     @Test
-    public void testGetSlingIdCreating()
-            throws IOException {
-        final SlingSettingsService slingSettingsService = getSlingSettings(slingIdFile, optionsFile);
+    public void testGetSlingIdCreating() throws IOException {
+        final SlingSettingsService slingSettingsService = createSlingSettingsService(slingIdFile, optionsFile);
 
         final String slingId = slingSettingsService.getSlingId();
         Assert.assertNotNull(slingId);
     }
 
     @Test
-    public void testGetSlingIdExisting()
-            throws IOException {
+    public void testGetSlingIdExisting() throws IOException {
         SlingIdUtil.writeSlingId(slingIdFile, SLING_ID);
-        final SlingSettingsService slingSettingsService = getSlingSettings(slingIdFile, optionsFile);
+        final SlingSettingsService slingSettingsService = createSlingSettingsService(slingIdFile, optionsFile);
 
         final String slingId = slingSettingsService.getSlingId();
         Assert.assertNotNull(slingId);
@@ -88,11 +86,10 @@ public class SlingSettingsServiceImplTest {
     }
 
     @Test
-    public void testGetSlingIdFromTooLargeData()
-            throws IOException {
+    public void testGetSlingIdFromTooLargeData() throws IOException {
         final String data = SLING_ID + RandomStringUtils.randomAscii(1024 * 1024); // 1MB long random String
         SlingIdUtil.writeSlingId(slingIdFile, data);
-        final SlingSettingsService slingSettingsService = getSlingSettings(slingIdFile, optionsFile);
+        final SlingSettingsService slingSettingsService = createSlingSettingsService(slingIdFile, optionsFile);
 
         final String slingId = slingSettingsService.getSlingId();
         Assert.assertNotNull(slingId);
@@ -100,44 +97,40 @@ public class SlingSettingsServiceImplTest {
     }
 
     @Test
-    public void testGetSlingIdFromTooShortData()
-            throws IOException {
-        final String data = RandomStringUtils.randomAscii(8); // 8 byte long string
+    public void testGetSlingIdFromTooShortData() throws IOException {
+        final String data = RandomStringUtils.randomAscii(8); // 8 byte long random String
         SlingIdUtil.writeSlingId(slingIdFile, data);
-        final SlingSettingsService slingSettingsService = getSlingSettings(slingIdFile, optionsFile);
+        final SlingSettingsService slingSettingsService = createSlingSettingsService(slingIdFile, optionsFile);
 
         final String slingId = slingSettingsService.getSlingId();
         Assert.assertNotNull(slingId);
         Assert.assertNotEquals(SLING_ID, slingId);
     }
 
-    private SlingSettingsServiceImpl getSlingSettings(File slingIdFile, File optionsFile)
-            throws IOException {
-        BundleContext context = Mockito.mock(BundleContext.class);
-        Mockito.when(context.getDataFile(SLING_ID_FILE_NAME))
-                .thenReturn(slingIdFile);
-        Mockito.when(context.getDataFile(OPTIONS_FILE_NAME))
-                .thenReturn(optionsFile);
-        StartupHandler handler = Mockito.mock(StartupHandler.class);
+    private SlingSettingsService createSlingSettingsService(final File slingIdFile, final File optionsFile) throws IOException {
+        BundleContext context = mock(BundleContext.class);
+        when(context.getDataFile(SLING_ID_FILE_NAME)).thenReturn(slingIdFile);
+        when(context.getDataFile(OPTIONS_FILE_NAME)).thenReturn(optionsFile);
+        final StartupHandler handler = mock(StartupHandler.class);
         // write options
-        List<SlingSettingsServiceImpl.Options> options = new ArrayList<SlingSettingsServiceImpl.Options>();
+        final List<SlingSettingsServiceImpl.Options> options = new ArrayList<SlingSettingsServiceImpl.Options>();
         FileOutputStream fos = null;
         ObjectOutputStream oos = null;
         try {
             fos = new FileOutputStream(optionsFile);
             oos = new ObjectOutputStream(fos);
             oos.writeObject(options);
-        } catch ( final IOException ioe ) {
+        } catch (final IOException ioe) {
             throw new RuntimeException("Unable to write to options data file.", ioe);
         } finally {
-            if ( oos != null ) {
+            if (oos != null) {
                 try {
                     oos.close();
                 } catch (IOException ignore) {
                     // ...
                 }
             }
-            if ( fos != null ) {
+            if (fos != null) {
                 try {
                     fos.close();
                 } catch (IOException ignore) {
@@ -147,4 +140,5 @@ public class SlingSettingsServiceImplTest {
         }
         return new SlingSettingsServiceImpl(context, handler);
     }
+
 }

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

[sling-org-apache-sling-settings] 17/21: SLING-5190 factor out of SlingSettingsServiceImpl a Sling ID util

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.3.8
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-settings.git

commit 566a7fe08cacf93bf3b715fb3e10d6c9434e4ce1
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Sun Oct 25 11:13:27 2015 +0000

    SLING-5190 factor out of SlingSettingsServiceImpl a Sling ID util
    
    * use Sling ID created by util instead of constant SLING_ID
    * remove assert which can never be true
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/settings@1710425 13f79535-47bb-0310-9956-ffa450edef68
---
 .../sling/settings/impl/SlingSettingsServiceImplTest.java   | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java b/src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java
index 0bf1a37..55ee328 100644
--- a/src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java
+++ b/src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java
@@ -43,8 +43,6 @@ public class SlingSettingsServiceImplTest {
 
     private static final String OPTIONS_FILE_NAME = "sling.options.file";
 
-    private static final String SLING_ID = "097bae9b-bf60-45a2-ad8c-ccdd374dd9b0";
-
     private File slingIdFile = null;
 
     private File optionsFile = null;
@@ -77,23 +75,25 @@ public class SlingSettingsServiceImplTest {
 
     @Test
     public void testGetSlingIdExisting() throws IOException {
-        SlingIdUtil.writeSlingId(slingIdFile, SLING_ID);
+        final String expected = SlingIdUtil.createSlingId();
+        SlingIdUtil.writeSlingId(slingIdFile, expected);
         final SlingSettingsService slingSettingsService = createSlingSettingsService(slingIdFile, optionsFile);
 
         final String slingId = slingSettingsService.getSlingId();
         Assert.assertNotNull(slingId);
-        Assert.assertEquals(SLING_ID, slingId);
+        Assert.assertEquals(expected, slingId);
     }
 
     @Test
     public void testGetSlingIdFromTooLargeData() throws IOException {
-        final String data = SLING_ID + RandomStringUtils.randomAscii(1024 * 1024); // 1MB long random String
+        final String expected = SlingIdUtil.createSlingId();
+        final String data = expected + RandomStringUtils.randomAscii(1024 * 1024); // 1MB long random String
         SlingIdUtil.writeSlingId(slingIdFile, data);
         final SlingSettingsService slingSettingsService = createSlingSettingsService(slingIdFile, optionsFile);
 
         final String slingId = slingSettingsService.getSlingId();
         Assert.assertNotNull(slingId);
-        Assert.assertEquals(SLING_ID, slingId);
+        Assert.assertEquals(expected, slingId);
     }
 
     @Test
@@ -104,7 +104,6 @@ public class SlingSettingsServiceImplTest {
 
         final String slingId = slingSettingsService.getSlingId();
         Assert.assertNotNull(slingId);
-        Assert.assertNotEquals(SLING_ID, slingId);
     }
 
     private SlingSettingsService createSlingSettingsService(final File slingIdFile, final File optionsFile) throws IOException {

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

[sling-org-apache-sling-settings] 11/21: SLING-5190 factor out of SlingSettingsServiceImpl a Sling ID util

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.3.8
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-settings.git

commit de5307bfdf12d42cc0786a4889826dcd9824aba4
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Fri Oct 23 14:46:12 2015 +0000

    SLING-5190 factor out of SlingSettingsServiceImpl a Sling ID util
    
    * make methods in SlingIdUtil public
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/settings@1710227 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/java/org/apache/sling/settings/impl/SlingIdUtil.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/sling/settings/impl/SlingIdUtil.java b/src/main/java/org/apache/sling/settings/impl/SlingIdUtil.java
index af20483..23875f1 100644
--- a/src/main/java/org/apache/sling/settings/impl/SlingIdUtil.java
+++ b/src/main/java/org/apache/sling/settings/impl/SlingIdUtil.java
@@ -28,14 +28,14 @@ import java.util.UUID;
 
 public class SlingIdUtil {
 
-    static String createSlingId() {
+    public static String createSlingId() {
         return UUID.randomUUID().toString();
     }
 
     /**
      * Read the id from a file.
      */
-    static String readSlingId(final File idFile, int maxLength) throws IOException {
+    public static String readSlingId(final File idFile, int maxLength) throws IOException {
         if (idFile.exists() && idFile.length() >= maxLength) {
             DataInputStream dis = null;
             try {
@@ -60,7 +60,7 @@ public class SlingIdUtil {
     /**
      * Write the sling id file.
      */
-    static void writeSlingId(final File idFile, final String id) throws IOException {
+    public static void writeSlingId(final File idFile, final String id) throws IOException {
         idFile.delete();
         idFile.getParentFile().mkdirs();
         DataOutputStream dos = null;

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

[sling-org-apache-sling-settings] 04/21: Update to Sling Parent 23

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.3.8
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-settings.git

commit a1c1433661cceb1a0a3fa7e91138c46c945e5796
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Thu Jun 25 13:08:16 2015 +0000

    Update to Sling Parent 23
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/settings@1687500 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 81639e3..875b19a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>22</version>
+        <version>23</version>
         <relativePath/>
     </parent>
 

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

[sling-org-apache-sling-settings] 12/21: SLING-5190 factor out of SlingSettingsServiceImpl a Sling ID util

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.3.8
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-settings.git

commit 1456ce5ac60257de93fb1545060179fc95e9cf72
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Fri Oct 23 15:08:45 2015 +0000

    SLING-5190 factor out of SlingSettingsServiceImpl a Sling ID util
    
    * rename SlingSettingsServiceImpl to SlingIdUtilTest
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/settings@1710229 13f79535-47bb-0310-9956-ffa450edef68
---
 .../impl/{SlingSettingsServiceImplTest.java => SlingIdUtilTest.java}    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java b/src/test/java/org/apache/sling/settings/impl/SlingIdUtilTest.java
similarity index 99%
rename from src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java
rename to src/test/java/org/apache/sling/settings/impl/SlingIdUtilTest.java
index 732f69b..79177a0 100644
--- a/src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java
+++ b/src/test/java/org/apache/sling/settings/impl/SlingIdUtilTest.java
@@ -34,7 +34,7 @@ import org.junit.Test;
 import org.mockito.Mockito;
 import org.osgi.framework.BundleContext;
 
-public class SlingSettingsServiceImplTest {
+public class SlingIdUtilTest {
 
     private static final String SLING_ID_FILE_NAME = "sling.id.file";
 

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

[sling-org-apache-sling-settings] 10/21: SLING-5190 factor out of SlingSettingsServiceImpl a Sling ID util

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.3.8
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-settings.git

commit 418f76cc21bd4f188d63e25b10587a27b14663e5
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Fri Oct 23 14:34:26 2015 +0000

    SLING-5190 factor out of SlingSettingsServiceImpl a Sling ID util
    
    * add createSlingId():String
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/settings@1710223 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/java/org/apache/sling/settings/impl/SlingIdUtil.java         | 4 ++++
 .../java/org/apache/sling/settings/impl/SlingSettingsServiceImpl.java | 3 +--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/sling/settings/impl/SlingIdUtil.java b/src/main/java/org/apache/sling/settings/impl/SlingIdUtil.java
index 0bcbf3b..af20483 100644
--- a/src/main/java/org/apache/sling/settings/impl/SlingIdUtil.java
+++ b/src/main/java/org/apache/sling/settings/impl/SlingIdUtil.java
@@ -28,6 +28,10 @@ import java.util.UUID;
 
 public class SlingIdUtil {
 
+    static String createSlingId() {
+        return UUID.randomUUID().toString();
+    }
+
     /**
      * Read the id from a file.
      */
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 d865896..07eea4b 100644
--- a/src/main/java/org/apache/sling/settings/impl/SlingSettingsServiceImpl.java
+++ b/src/main/java/org/apache/sling/settings/impl/SlingSettingsServiceImpl.java
@@ -35,7 +35,6 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.UUID;
 
 import org.apache.sling.launchpad.api.StartupHandler;
 import org.apache.sling.launchpad.api.StartupMode;
@@ -137,7 +136,7 @@ public class SlingSettingsServiceImpl
 
         // no sling id yet or failure to read file: create an id and store
         if (slingId == null) {
-            slingId = UUID.randomUUID().toString();
+            slingId = SlingIdUtil.createSlingId();
             logger.info("Created new Sling ID {}", slingId);
             try {
                 SlingIdUtil.writeSlingId(idFile, slingId);

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

[sling-org-apache-sling-settings] 14/21: SLING-5190 factor out of SlingSettingsServiceImpl a Sling ID util

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.3.8
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-settings.git

commit 6357e3efa58fb06e9f88f2ee37639e68414309e4
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Fri Oct 23 15:37:01 2015 +0000

    SLING-5190 factor out of SlingSettingsServiceImpl a Sling ID util
    
    * make the Sling ID length an internal of SlingIdUtil
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/settings@1710243 13f79535-47bb-0310-9956-ffa450edef68
---
 .../java/org/apache/sling/settings/impl/SlingIdUtil.java   |  9 ++++++---
 .../sling/settings/impl/SlingSettingsServiceImpl.java      |  5 +----
 .../sling/settings/impl/SlingSettingsServiceImplTest.java  | 14 +++++++-------
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/main/java/org/apache/sling/settings/impl/SlingIdUtil.java b/src/main/java/org/apache/sling/settings/impl/SlingIdUtil.java
index 23875f1..29ad3ea 100644
--- a/src/main/java/org/apache/sling/settings/impl/SlingIdUtil.java
+++ b/src/main/java/org/apache/sling/settings/impl/SlingIdUtil.java
@@ -28,6 +28,9 @@ import java.util.UUID;
 
 public class SlingIdUtil {
 
+    /** The length in bytes of a sling identifier */
+    private static final int SLING_ID_LENGTH = 36;
+
     public static String createSlingId() {
         return UUID.randomUUID().toString();
     }
@@ -35,11 +38,11 @@ public class SlingIdUtil {
     /**
      * Read the id from a file.
      */
-    public static String readSlingId(final File idFile, int maxLength) throws IOException {
-        if (idFile.exists() && idFile.length() >= maxLength) {
+    public static String readSlingId(final File idFile) throws IOException {
+        if (idFile.exists() && idFile.length() >= SLING_ID_LENGTH) {
             DataInputStream dis = null;
             try {
-                final byte[] rawBytes = new byte[maxLength];
+                final byte[] rawBytes = new byte[SLING_ID_LENGTH];
                 dis = new DataInputStream(new FileInputStream(idFile));
                 dis.readFully(rawBytes);
                 final String rawString = new String(rawBytes, "ISO-8859-1");
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 07eea4b..56b5aa7 100644
--- a/src/main/java/org/apache/sling/settings/impl/SlingSettingsServiceImpl.java
+++ b/src/main/java/org/apache/sling/settings/impl/SlingSettingsServiceImpl.java
@@ -76,9 +76,6 @@ public class SlingSettingsServiceImpl
     /** The name of the data file holding install run mode options */
     private static final String OPTIONS_FILE = "sling.options.file";
 
-    /** The length in bytes of a sling identifier */
-    private static final int SLING_ID_LENGTH = 36;
-
     /** The properties for name, description. */
     private final Map<String, String> slingProps = new HashMap<String, String>();
 
@@ -128,7 +125,7 @@ public class SlingSettingsServiceImpl
         }
 
         try {
-            slingId = SlingIdUtil.readSlingId(idFile, SLING_ID_LENGTH);
+            slingId = SlingIdUtil.readSlingId(idFile);
             logger.info("Read Sling ID {} from file {}", slingId, idFile);
         } catch (final Throwable t) {
             logger.error("Failed reading Sling ID from file " + idFile, t);
diff --git a/src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java b/src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java
index 732f69b..b4cc5e7 100644
--- a/src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java
+++ b/src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java
@@ -69,7 +69,7 @@ public class SlingSettingsServiceImplTest {
     @Test
     public void testGenerateSlingId()
             throws IOException {
-        String slingId =  readSlingId(slingIdFile, optionsFile, SLING_ID.length());
+        String slingId =  readSlingId(slingIdFile, optionsFile);
         Assert.assertNotNull(slingId);
     }
 
@@ -77,10 +77,10 @@ public class SlingSettingsServiceImplTest {
     public void testGetSlingId()
             throws IOException {
         writeSlingId(slingIdFile, optionsFile, SLING_ID);
-        String generated =  readSlingId(slingIdFile, optionsFile, SLING_ID.length());
+        String generated =  readSlingId(slingIdFile, optionsFile);
         Assert.assertNotNull(generated);
         Assert.assertEquals(SLING_ID, generated);
-        String slingId = readSlingId(slingIdFile, optionsFile, SLING_ID.length());
+        String slingId = readSlingId(slingIdFile, optionsFile);
         Assert.assertNotNull(slingId);
         Assert.assertEquals(generated, slingId);
     }
@@ -90,7 +90,7 @@ public class SlingSettingsServiceImplTest {
             throws IOException {
         String data = SLING_ID + RandomStringUtils.randomAscii(1024 * 1024); // 1MB long random String
         writeSlingId(slingIdFile, optionsFile, data);
-        String slingId =  readSlingId(slingIdFile, optionsFile, SLING_ID.length());
+        String slingId =  readSlingId(slingIdFile, optionsFile);
         Assert.assertNotNull(slingId);
         Assert.assertEquals(SLING_ID, slingId);
     }
@@ -100,15 +100,15 @@ public class SlingSettingsServiceImplTest {
             throws IOException {
         String data = RandomStringUtils.randomAscii(8); // 8 byte long string
         writeSlingId(slingIdFile, optionsFile, data);
-        String slingId =  readSlingId(slingIdFile, optionsFile, SLING_ID.length());
+        String slingId =  readSlingId(slingIdFile, optionsFile);
         Assert.assertNotNull(slingId);
         Assert.assertNotEquals(SLING_ID, slingId);
     }
 
-    private String readSlingId(File slingIdFile, File optionsFile, int maxLength)
+    private String readSlingId(File slingIdFile, File optionsFile)
             throws IOException {
         SlingSettingsServiceImpl settings = getSlingSettings(slingIdFile, optionsFile);
-        return SlingIdUtil.readSlingId(slingIdFile, maxLength);
+        return SlingIdUtil.readSlingId(slingIdFile);
     }
 
     private void writeSlingId(File slingIdFile, File optionsFile, String slingId)

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

[sling-org-apache-sling-settings] 05/21: set parent version to 24 and add empty relativePath where missing

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.3.8
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-settings.git

commit 54f7c2762804d957e8fef6141515141f35fcbc58
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Tue Jul 7 08:09:17 2015 +0000

    set parent version to 24 and add empty relativePath where missing
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/settings@1689593 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 875b19a..a3fb6e8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>23</version>
+        <version>24</version>
         <relativePath/>
     </parent>
 

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

[sling-org-apache-sling-settings] 15/21: SLING-5190 factor out of SlingSettingsServiceImpl a Sling ID util

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.3.8
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-settings.git

commit bab3a9bc4da24aa5a3a9afe94c4c821593b30573
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Sat Oct 24 11:05:16 2015 +0000

    SLING-5190 factor out of SlingSettingsServiceImpl a Sling ID util
    
    * make tests more obvious
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/settings@1710327 13f79535-47bb-0310-9956-ffa450edef68
---
 .../impl/SlingSettingsServiceImplTest.java         | 50 ++++++++++------------
 1 file changed, 22 insertions(+), 28 deletions(-)

diff --git a/src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java b/src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java
index b4cc5e7..13cd74a 100644
--- a/src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java
+++ b/src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java
@@ -26,6 +26,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.commons.lang.RandomStringUtils;
+import org.apache.sling.settings.SlingSettingsService;
 import org.junit.After;
 import org.junit.Assert;
 import org.apache.sling.launchpad.api.StartupHandler;
@@ -67,30 +68,33 @@ public class SlingSettingsServiceImplTest {
     }
 
     @Test
-    public void testGenerateSlingId()
+    public void testGetSlingIdCreating()
             throws IOException {
-        String slingId =  readSlingId(slingIdFile, optionsFile);
+        final SlingSettingsService slingSettingsService = getSlingSettings(slingIdFile, optionsFile);
+
+        final String slingId = slingSettingsService.getSlingId();
         Assert.assertNotNull(slingId);
     }
 
     @Test
-    public void testGetSlingId()
+    public void testGetSlingIdExisting()
             throws IOException {
-        writeSlingId(slingIdFile, optionsFile, SLING_ID);
-        String generated =  readSlingId(slingIdFile, optionsFile);
-        Assert.assertNotNull(generated);
-        Assert.assertEquals(SLING_ID, generated);
-        String slingId = readSlingId(slingIdFile, optionsFile);
+        SlingIdUtil.writeSlingId(slingIdFile, SLING_ID);
+        final SlingSettingsService slingSettingsService = getSlingSettings(slingIdFile, optionsFile);
+
+        final String slingId = slingSettingsService.getSlingId();
         Assert.assertNotNull(slingId);
-        Assert.assertEquals(generated, slingId);
+        Assert.assertEquals(SLING_ID, slingId);
     }
 
     @Test
-    public void testGetLongSlingIdFromTooLargeData()
+    public void testGetSlingIdFromTooLargeData()
             throws IOException {
-        String data = SLING_ID + RandomStringUtils.randomAscii(1024 * 1024); // 1MB long random String
-        writeSlingId(slingIdFile, optionsFile, data);
-        String slingId =  readSlingId(slingIdFile, optionsFile);
+        final String data = SLING_ID + RandomStringUtils.randomAscii(1024 * 1024); // 1MB long random String
+        SlingIdUtil.writeSlingId(slingIdFile, data);
+        final SlingSettingsService slingSettingsService = getSlingSettings(slingIdFile, optionsFile);
+
+        final String slingId = slingSettingsService.getSlingId();
         Assert.assertNotNull(slingId);
         Assert.assertEquals(SLING_ID, slingId);
     }
@@ -98,25 +102,15 @@ public class SlingSettingsServiceImplTest {
     @Test
     public void testGetSlingIdFromTooShortData()
             throws IOException {
-        String data = RandomStringUtils.randomAscii(8); // 8 byte long string
-        writeSlingId(slingIdFile, optionsFile, data);
-        String slingId =  readSlingId(slingIdFile, optionsFile);
+        final String data = RandomStringUtils.randomAscii(8); // 8 byte long string
+        SlingIdUtil.writeSlingId(slingIdFile, data);
+        final SlingSettingsService slingSettingsService = getSlingSettings(slingIdFile, optionsFile);
+
+        final String slingId = slingSettingsService.getSlingId();
         Assert.assertNotNull(slingId);
         Assert.assertNotEquals(SLING_ID, slingId);
     }
 
-    private String readSlingId(File slingIdFile, File optionsFile)
-            throws IOException {
-        SlingSettingsServiceImpl settings = getSlingSettings(slingIdFile, optionsFile);
-        return SlingIdUtil.readSlingId(slingIdFile);
-    }
-
-    private void writeSlingId(File slingIdFile, File optionsFile, String slingId)
-            throws IOException {
-        SlingSettingsServiceImpl settings = getSlingSettings(slingIdFile, optionsFile);
-        SlingIdUtil.writeSlingId(slingIdFile, slingId);
-    }
-
     private SlingSettingsServiceImpl getSlingSettings(File slingIdFile, File optionsFile)
             throws IOException {
         BundleContext context = Mockito.mock(BundleContext.class);

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

[sling-org-apache-sling-settings] 20/21: [maven-release-plugin] prepare release org.apache.sling.settings-1.3.8

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.3.8
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-settings.git

commit 40550d2abb3968fe7792dff0043056db35d1cc23
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Dec 29 10:00:37 2015 +0000

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

diff --git a/pom.xml b/pom.xml
index 74f27ee..67205b2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,12 +24,12 @@
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
         <version>25</version>
-        <relativePath/>
+        <relativePath />
     </parent>
 
     <artifactId>org.apache.sling.settings</artifactId>
     <packaging>bundle</packaging>
-    <version>1.3.7-SNAPSHOT</version>
+    <version>1.3.8</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.3.8
         </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.3.8
         </developerConnection>
         <url>
-            http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/settings
+            http://svn.apache.org/viewvc/sling/tags/org.apache.sling.settings-1.3.8
         </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] 19/21: SLING-4892 : Remove dependency to StartupHandler

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.3.8
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-settings.git

commit 9a2c5e6af5144a722c759518b68d506b5ffc791e
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Dec 4 08:22:08 2015 +0000

    SLING-4892 : Remove dependency to StartupHandler
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/settings@1717909 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |  6 ---
 .../sling/settings/impl/ServicesListener.java      | 43 +---------------
 .../settings/impl/SlingSettingsServiceImpl.java    | 38 +++++----------
 .../sling/settings/impl/RunModeImplTest.java       | 57 ++++++----------------
 .../impl/SlingSettingsServiceImplTest.java         | 14 +++---
 5 files changed, 35 insertions(+), 123 deletions(-)

diff --git a/pom.xml b/pom.xml
index f7bad08..74f27ee 100644
--- a/pom.xml
+++ b/pom.xml
@@ -100,12 +100,6 @@
             <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/ServicesListener.java b/src/main/java/org/apache/sling/settings/impl/ServicesListener.java
index accb6b3..8ac0e96 100644
--- a/src/main/java/org/apache/sling/settings/impl/ServicesListener.java
+++ b/src/main/java/org/apache/sling/settings/impl/ServicesListener.java
@@ -21,7 +21,6 @@ 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;
@@ -41,9 +40,6 @@ public class ServicesListener {
     /** The bundle context. */
     private final BundleContext bundleContext;
 
-    /** The listener for the startup handler. */
-    private final Listener startupListener;
-
     /** The listener for configuration admin. */
     private ConfigAdminListener configAdminListener;
 
@@ -59,25 +55,7 @@ public class ServicesListener {
      */
     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 SlingSettingsServiceImpl settingsService = new SlingSettingsServiceImpl(bundleContext, handler);
+        final SlingSettingsServiceImpl settingsService = new SlingSettingsServiceImpl(bundleContext);
 
         final Dictionary<String, String> props = new Hashtable<String, String>();
         props.put(Constants.SERVICE_DESCRIPTION,
@@ -110,7 +88,6 @@ public class ServicesListener {
             this.configAdminListener.deactivate();
             this.configAdminListener = null;
         }
-        this.startupListener.deactivate();
         if ( this.settingsReg != null ) {
             this.settingsReg.unregister();
             this.settingsReg = null;
@@ -214,24 +191,6 @@ public class ServicesListener {
     }
 
     /**
-     * Helper class listening for service events for a defined service.
-     */
-    private final class Listener extends AbstractListener {
-
-        /**
-         * Constructor
-         */
-        public Listener(final String serviceName) {
-            super(serviceName);
-        }
-
-        @Override
-        protected void serviceChanged() {
-            notifyChange();
-        }
-    }
-
-    /**
      * Helper class listening for service events for config admin
      */
     private final class ConfigAdminListener extends AbstractListener {
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 56b5aa7..28f2f78 100644
--- a/src/main/java/org/apache/sling/settings/impl/SlingSettingsServiceImpl.java
+++ b/src/main/java/org/apache/sling/settings/impl/SlingSettingsServiceImpl.java
@@ -36,8 +36,6 @@ import java.util.List;
 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.BundleContext;
 import org.slf4j.Logger;
@@ -85,16 +83,12 @@ public class SlingSettingsServiceImpl
      * Setup run modes
      * @param context The bundle context
      */
-    public SlingSettingsServiceImpl(final BundleContext context,
-            final StartupHandler handler) {
+    public SlingSettingsServiceImpl(final BundleContext context) {
         this.setupSlingProps(context);
         this.setupSlingHome(context);
         this.setupSlingId(context);
 
-        final StartupMode mode = handler.getMode();
-        logger.debug("Settings: Using startup mode : {}", mode);
-
-        this.setupRunModes(context, mode);
+        this.setupRunModes(context);
 
     }
 
@@ -197,8 +191,7 @@ public class SlingSettingsServiceImpl
     /**
      * Set up run modes.
      */
-    private void setupRunModes(final BundleContext context,
-            final StartupMode startupMode) {
+    private void setupRunModes(final BundleContext context) {
         final Set<String> modesSet = new HashSet<String>();
 
         // check configuration property first
@@ -214,26 +207,21 @@ public class SlingSettingsServiceImpl
         this.handleOptions(modesSet, context.getProperty(RUN_MODE_OPTIONS));
 
         // 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);
+        // 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);
-        }
+        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
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 d32f5e6..ee47135 100644
--- a/src/test/java/org/apache/sling/settings/impl/RunModeImplTest.java
+++ b/src/test/java/org/apache/sling/settings/impl/RunModeImplTest.java
@@ -32,8 +32,6 @@ import java.util.HashSet;
 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;
@@ -48,33 +46,8 @@ 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), new StartupHandlerImpl());
+        final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock(str, null, null));
         final Set<String> modes = rm.getRunModes();
 
         Set<String> expectedSet = new HashSet<String>(expected.length);
@@ -103,61 +76,61 @@ public class RunModeImplTest {
     }
 
     @org.junit.Test public void testMatchesNotEmpty() {
-        final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("foo,bar", null, null), new StartupHandlerImpl());
+        final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("foo,bar", null, null));
         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), new StartupHandlerImpl());
+        final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("foo,bar", "a,b,c|d,e,f", null));
         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), new StartupHandlerImpl());
+        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), new StartupHandlerImpl());
+        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");
         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), new StartupHandlerImpl());
+        final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("foo,bar,c,e,f,a", "a,b,c|d,e,f", null));
         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), new StartupHandlerImpl());
+        final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("foo,bar,c,f,a,d", "a,b,c|d,e,f", null));
         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"), new StartupHandlerImpl());
+        final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("foo,bar", null, "a,b,c|d,e,f"));
         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"), new StartupHandlerImpl());
+        final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("foo,bar,c,e", null , "a,b,c|d,e,f"));
         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"), new StartupHandlerImpl());
+        final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("foo,bar,c,e,f,a", null, "a,b,c|d,e,f"));
         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"), new StartupHandlerImpl());
+        final SlingSettingsService rm = new SlingSettingsServiceImpl(new BundleContextMock("foo,bar,c,d,f,a", null, "a,b,c|d,e,f"));
         assertActive(rm, true, "foo", "bar", "a", "d");
         assertActive(rm, false, "b", "c", "e", "f");
     }
@@ -167,13 +140,13 @@ public class RunModeImplTest {
 
         {
             // create first context to simulate install
-            final SlingSettingsService rm = new SlingSettingsServiceImpl(bc, new StartupHandlerImpl());
+            final SlingSettingsService rm = new SlingSettingsServiceImpl(bc);
             assertActive(rm, true, "foo", "bar", "a", "e");
             assertActive(rm, false, "b", "c", "d", "f");
         }
 
         {
-            final SlingSettingsService rm = new SlingSettingsServiceImpl(bc, new StartupHandlerImpl(StartupMode.RESTART));
+            final SlingSettingsService rm = new SlingSettingsServiceImpl(bc);
             assertActive(rm, true, "foo", "bar", "a", "e");
             assertActive(rm, false, "b", "c", "d", "f");
         }
@@ -182,7 +155,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, new StartupHandlerImpl(StartupMode.RESTART));
+            final SlingSettingsService rm = new SlingSettingsServiceImpl(bc);
             assertActive(rm, true, "foo", "doo", "a", "e", "waa");
             assertActive(rm, false, "bar", "b", "c", "d", "f");
         }
@@ -257,7 +230,7 @@ public class RunModeImplTest {
             if ( f == null ) {
                 try {
                     f = File.createTempFile(filename, "id");
-                    f.deleteOnExit();
+                    f.delete();
                     files.put(filename, f);
                 } catch (IOException ioe) {
                     throw new RuntimeException(ioe);
diff --git a/src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java b/src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java
index f50fed2..6f8820a 100644
--- a/src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java
+++ b/src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java
@@ -18,6 +18,11 @@
  */
 package org.apache.sling.settings.impl;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
@@ -28,16 +33,10 @@ import java.util.List;
 import org.apache.commons.lang.RandomStringUtils;
 import org.apache.sling.settings.SlingSettingsService;
 import org.junit.After;
-import org.apache.sling.launchpad.api.StartupHandler;
 import org.junit.Before;
 import org.junit.Test;
 import org.osgi.framework.BundleContext;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
 public class SlingSettingsServiceImplTest {
 
     private static final String SLING_ID_FILE_NAME = "sling.id.file";
@@ -111,7 +110,6 @@ public class SlingSettingsServiceImplTest {
         BundleContext context = mock(BundleContext.class);
         when(context.getDataFile(SLING_ID_FILE_NAME)).thenReturn(slingIdFile);
         when(context.getDataFile(OPTIONS_FILE_NAME)).thenReturn(optionsFile);
-        final StartupHandler handler = mock(StartupHandler.class);
         // write options
         final List<SlingSettingsServiceImpl.Options> options = new ArrayList<SlingSettingsServiceImpl.Options>();
         FileOutputStream fos = null;
@@ -138,7 +136,7 @@ public class SlingSettingsServiceImplTest {
                 }
             }
         }
-        return new SlingSettingsServiceImpl(context, handler);
+        return new SlingSettingsServiceImpl(context);
     }
 
 }

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

[sling-org-apache-sling-settings] 01/21: [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.3.8
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-settings.git

commit bef7237c18c7b65c08240ef392c01595778d24a6
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Mar 9 08:01:13 2015 +0000

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

diff --git a/pom.xml b/pom.xml
index 66e9466..e86c8aa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,7 +29,7 @@
 
     <artifactId>org.apache.sling.settings</artifactId>
     <packaging>bundle</packaging>
-    <version>1.3.6</version>
+    <version>1.3.7-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.3.6
+            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.3.6
+            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.3.6
+            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] 02/21: Add missing licence header

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.3.8
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-settings.git

commit 7944ce342ec96da502d4193be4cf5343e1f42071
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Apr 27 14:47:39 2015 +0000

    Add missing licence header
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/settings@1676280 13f79535-47bb-0310-9956-ffa450edef68
---
 ...ling.settings.impl.SlingSettingsServiceImpl.xml | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/main/resources/OSGI-INF/metatype/org.apache.sling.settings.impl.SlingSettingsServiceImpl.xml b/src/main/resources/OSGI-INF/metatype/org.apache.sling.settings.impl.SlingSettingsServiceImpl.xml
index f88fb82..0471a2e 100644
--- a/src/main/resources/OSGI-INF/metatype/org.apache.sling.settings.impl.SlingSettingsServiceImpl.xml
+++ b/src/main/resources/OSGI-INF/metatype/org.apache.sling.settings.impl.SlingSettingsServiceImpl.xml
@@ -1,5 +1,23 @@
-<?xml version="1.0" encoding="UTF-8"?><metatype:MetaData xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.0.0" 
-localization="OSGI-INF/metatype/metatype">
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+--><metatype:MetaData xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.0.0" 
+                      localization="OSGI-INF/metatype/metatype">
     <OCD id="org.apache.sling.settings.impl.SlingSettingsServiceImpl" name="%settings.name" description="%settings.description">
         <AD id="sling.name" type="String" name="%sling.name.name" description="%sling.name.description"/>
         <AD id="sling.description" type="String" name="%sling.description.name" description="%sling.description.description"/>

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

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

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.3.8
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-settings.git

commit 2dcdb47957654d30014524a6ad4430a6ea5534f5
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Dec 29 10:00:51 2015 +0000

    [maven-release-plugin] copy for tag org.apache.sling.settings-1.3.8
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.settings-1.3.8@1722083 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] 07/21: Update the main reactor to parent 25

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.3.8
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-settings.git

commit 418f672a2ebdbce0cc7e722b3b1158c8f251424d
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Mon Oct 5 10:03:45 2015 +0000

    Update the main reactor to parent 25
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/settings@1706780 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index a3fb6e8..f7bad08 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>24</version>
+        <version>25</version>
         <relativePath/>
     </parent>
 

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

[sling-org-apache-sling-settings] 08/21: SLING-5190 factor out of SlingSettingsServiceImpl a Sling ID util

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.3.8
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-settings.git

commit d706264385abe0a91b1381f3bdf2822efa4703cd
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Fri Oct 23 10:18:22 2015 +0000

    SLING-5190 factor out of SlingSettingsServiceImpl a Sling ID util
    
    * move readSlingId(File, int):String and writeSlingId(File, String):void from SlingSettingsServiceImpl to new class SlingIdUtil
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/settings@1710166 13f79535-47bb-0310-9956-ffa450edef68
---
 .../apache/sling/settings/impl/SlingIdUtil.java    | 85 ++++++++++++++++++++++
 .../settings/impl/SlingSettingsServiceImpl.java    | 60 +--------------
 .../impl/SlingSettingsServiceImplTest.java         |  4 +-
 3 files changed, 89 insertions(+), 60 deletions(-)

diff --git a/src/main/java/org/apache/sling/settings/impl/SlingIdUtil.java b/src/main/java/org/apache/sling/settings/impl/SlingIdUtil.java
new file mode 100644
index 0000000..95032c2
--- /dev/null
+++ b/src/main/java/org/apache/sling/settings/impl/SlingIdUtil.java
@@ -0,0 +1,85 @@
+/*
+ * 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.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.UUID;
+
+public class SlingIdUtil {
+
+    /**
+     * Read the id from a file.
+     */
+    static String readSlingId(final File idFile, int maxLength) {
+        if (idFile.exists() && idFile.length() >= maxLength) {
+            DataInputStream dis = null;
+            try {
+                final byte[] rawBytes = new byte[maxLength];
+                dis = new DataInputStream(new FileInputStream(idFile));
+                dis.readFully(rawBytes);
+                final String rawString = new String(rawBytes, "ISO-8859-1");
+
+                // roundtrip to ensure correct format of UUID value
+                final String id = UUID.fromString(rawString).toString();
+                // logger.debug("Got Sling ID {} from file {}", id, idFile);
+
+                return id;
+            } catch (final Throwable t) {
+                // logger.error("Failed reading UUID from id file " + idFile
+                //        + ", creating new id", t);
+            } finally {
+                if (dis != null) {
+                    try {
+                        dis.close();
+                    } catch (IOException ignore){}
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Write the sling id file.
+     */
+    static void writeSlingId(final File idFile, final String id) {
+        idFile.delete();
+        idFile.getParentFile().mkdirs();
+        DataOutputStream dos = null;
+        try {
+            final byte[] rawBytes = id.getBytes("ISO-8859-1");
+            dos = new DataOutputStream(new FileOutputStream(idFile));
+            dos.write(rawBytes, 0, rawBytes.length);
+            dos.flush();
+        } catch (final Throwable t) {
+            // logger.error("Failed writing UUID to id file " + idFile, t);
+        } finally {
+            if (dos != null) {
+                try {
+                    dos.close();
+                } catch (IOException ignore) {}
+            }
+        }
+    }
+
+}
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 56448c5..1899aa3 100644
--- a/src/main/java/org/apache/sling/settings/impl/SlingSettingsServiceImpl.java
+++ b/src/main/java/org/apache/sling/settings/impl/SlingSettingsServiceImpl.java
@@ -18,8 +18,6 @@
  */
 package org.apache.sling.settings.impl;
 
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
@@ -129,12 +127,12 @@ public class SlingSettingsServiceImpl
             // the osgi framework does not support storing something in the file system
             throw new RuntimeException("Unable to read from bundle data file.");
         }
-        this.slingId = this.readSlingId(idFile, SLING_ID_LENGTH);
+        this.slingId = SlingIdUtil.readSlingId(idFile, SLING_ID_LENGTH);
 
         // no sling id yet or failure to read file: create an id and store
         if (slingId == null) {
             slingId = UUID.randomUUID().toString();
-            this.writeSlingId(idFile, this.slingId);
+            SlingIdUtil.writeSlingId(idFile, this.slingId);
         }
     }
 
@@ -290,60 +288,6 @@ public class SlingSettingsServiceImpl
     }
 
     /**
-     * Read the id from a file.
-     */
-    String readSlingId(final File idFile, int maxLength) {
-        if (idFile.exists() && idFile.length() >= maxLength) {
-            DataInputStream dis = null;
-            try {
-                final byte[] rawBytes = new byte[maxLength];
-                dis = new DataInputStream(new FileInputStream(idFile));
-                dis.readFully(rawBytes);
-                final String rawString = new String(rawBytes, "ISO-8859-1");
-
-                // roundtrip to ensure correct format of UUID value
-                final String id = UUID.fromString(rawString).toString();
-                logger.debug("Got Sling ID {} from file {}", id, idFile);
-
-                return id;
-            } catch (final Throwable t) {
-                logger.error("Failed reading UUID from id file " + idFile
-                        + ", creating new id", t);
-            } finally {
-                if (dis != null) {
-                    try {
-                        dis.close();
-                    } catch (IOException ignore){}
-                }
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Write the sling id file.
-     */
-    void writeSlingId(final File idFile, final String id) {
-        idFile.delete();
-        idFile.getParentFile().mkdirs();
-        DataOutputStream dos = null;
-        try {
-            final byte[] rawBytes = id.getBytes("ISO-8859-1");
-            dos = new DataOutputStream(new FileOutputStream(idFile));
-            dos.write(rawBytes, 0, rawBytes.length);
-            dos.flush();
-        } catch (final Throwable t) {
-            logger.error("Failed writing UUID to id file " + idFile, t);
-        } finally {
-            if (dos != null) {
-                try {
-                    dos.close();
-                } catch (IOException ignore) {}
-            }
-        }
-    }
-
-    /**
      * @see org.apache.sling.settings.SlingSettingsService#getAbsolutePathWithinSlingHome(String)
      */
     public String getAbsolutePathWithinSlingHome(final String relativePath) {
diff --git a/src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java b/src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java
index 81e3dd1..732f69b 100644
--- a/src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java
+++ b/src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java
@@ -108,13 +108,13 @@ public class SlingSettingsServiceImplTest {
     private String readSlingId(File slingIdFile, File optionsFile, int maxLength)
             throws IOException {
         SlingSettingsServiceImpl settings = getSlingSettings(slingIdFile, optionsFile);
-        return settings.readSlingId(slingIdFile, maxLength);
+        return SlingIdUtil.readSlingId(slingIdFile, maxLength);
     }
 
     private void writeSlingId(File slingIdFile, File optionsFile, String slingId)
             throws IOException {
         SlingSettingsServiceImpl settings = getSlingSettings(slingIdFile, optionsFile);
-        settings.writeSlingId(slingIdFile, slingId);
+        SlingIdUtil.writeSlingId(slingIdFile, slingId);
     }
 
     private SlingSettingsServiceImpl getSlingSettings(File slingIdFile, File optionsFile)

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

[sling-org-apache-sling-settings] 06/21: fix typo

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.3.8
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-settings.git

commit 8f9611786fd488bfaf4cb38226bd1f46d291299a
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Thu Aug 6 10:38:39 2015 +0000

    fix typo
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/settings@1694444 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/java/org/apache/sling/settings/impl/ServicesListener.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/settings/impl/ServicesListener.java b/src/main/java/org/apache/sling/settings/impl/ServicesListener.java
index d0dd139..accb6b3 100644
--- a/src/main/java/org/apache/sling/settings/impl/ServicesListener.java
+++ b/src/main/java/org/apache/sling/settings/impl/ServicesListener.java
@@ -151,7 +151,7 @@ public class ServicesListener {
                         + Constants.OBJECTCLASS + "=" + serviceName + ")");
             } catch (final InvalidSyntaxException ise) {
                 // this should really never happen
-                throw new RuntimeException("Unexpected exception occured.", ise);
+                throw new RuntimeException("Unexpected exception occurred.", ise);
             }
             this.retainService();
         }

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

[sling-org-apache-sling-settings] 03/21: SLING-4698 - Set parent.relativePath to empty for all modules

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.3.8
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-settings.git

commit e896bc3a6995d8d71958cba9082d04ff84f2e721
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Thu May 7 10:14:40 2015 +0000

    SLING-4698 - Set parent.relativePath to empty for all modules
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/settings@1678154 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index e86c8aa..81639e3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
         <version>22</version>
-        <relativePath>../../../parent/pom.xml</relativePath>
+        <relativePath/>
     </parent>
 
     <artifactId>org.apache.sling.settings</artifactId>

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

[sling-org-apache-sling-settings] 09/21: SLING-5190 factor out of SlingSettingsServiceImpl a Sling ID util

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.3.8
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-settings.git

commit bbdf3d146669a3601d63689e59deb761ec98c336
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Fri Oct 23 12:02:50 2015 +0000

    SLING-5190 factor out of SlingSettingsServiceImpl a Sling ID util
    
    * fix logging and adjust exception handling
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/settings@1710190 13f79535-47bb-0310-9956-ffa450edef68
---
 .../java/org/apache/sling/settings/impl/SlingIdUtil.java  | 14 +++-----------
 .../sling/settings/impl/SlingSettingsServiceImpl.java     | 15 +++++++++++++--
 2 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/main/java/org/apache/sling/settings/impl/SlingIdUtil.java b/src/main/java/org/apache/sling/settings/impl/SlingIdUtil.java
index 95032c2..0bcbf3b 100644
--- a/src/main/java/org/apache/sling/settings/impl/SlingIdUtil.java
+++ b/src/main/java/org/apache/sling/settings/impl/SlingIdUtil.java
@@ -31,7 +31,7 @@ public class SlingIdUtil {
     /**
      * Read the id from a file.
      */
-    static String readSlingId(final File idFile, int maxLength) {
+    static String readSlingId(final File idFile, int maxLength) throws IOException {
         if (idFile.exists() && idFile.length() >= maxLength) {
             DataInputStream dis = null;
             try {
@@ -41,13 +41,7 @@ public class SlingIdUtil {
                 final String rawString = new String(rawBytes, "ISO-8859-1");
 
                 // roundtrip to ensure correct format of UUID value
-                final String id = UUID.fromString(rawString).toString();
-                // logger.debug("Got Sling ID {} from file {}", id, idFile);
-
-                return id;
-            } catch (final Throwable t) {
-                // logger.error("Failed reading UUID from id file " + idFile
-                //        + ", creating new id", t);
+                return UUID.fromString(rawString).toString();
             } finally {
                 if (dis != null) {
                     try {
@@ -62,7 +56,7 @@ public class SlingIdUtil {
     /**
      * Write the sling id file.
      */
-    static void writeSlingId(final File idFile, final String id) {
+    static void writeSlingId(final File idFile, final String id) throws IOException {
         idFile.delete();
         idFile.getParentFile().mkdirs();
         DataOutputStream dos = null;
@@ -71,8 +65,6 @@ public class SlingIdUtil {
             dos = new DataOutputStream(new FileOutputStream(idFile));
             dos.write(rawBytes, 0, rawBytes.length);
             dos.flush();
-        } catch (final Throwable t) {
-            // logger.error("Failed writing UUID to id file " + idFile, t);
         } finally {
             if (dos != null) {
                 try {
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 1899aa3..d865896 100644
--- a/src/main/java/org/apache/sling/settings/impl/SlingSettingsServiceImpl.java
+++ b/src/main/java/org/apache/sling/settings/impl/SlingSettingsServiceImpl.java
@@ -127,12 +127,23 @@ public class SlingSettingsServiceImpl
             // the osgi framework does not support storing something in the file system
             throw new RuntimeException("Unable to read from bundle data file.");
         }
-        this.slingId = SlingIdUtil.readSlingId(idFile, SLING_ID_LENGTH);
+
+        try {
+            slingId = SlingIdUtil.readSlingId(idFile, SLING_ID_LENGTH);
+            logger.info("Read Sling ID {} from file {}", slingId, idFile);
+        } catch (final Throwable t) {
+            logger.error("Failed reading Sling ID from file " + idFile, t);
+        }
 
         // no sling id yet or failure to read file: create an id and store
         if (slingId == null) {
             slingId = UUID.randomUUID().toString();
-            SlingIdUtil.writeSlingId(idFile, this.slingId);
+            logger.info("Created new Sling ID {}", slingId);
+            try {
+                SlingIdUtil.writeSlingId(idFile, slingId);
+            } catch (final Throwable t) {
+                logger.error("Failed writing Sling ID to file " + idFile, t);
+            }
         }
     }
 

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

[sling-org-apache-sling-settings] 18/21: style

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.3.8
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-settings.git

commit 43aced2ae9f979028edb3d455bf6fa1773537629
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Sun Oct 25 11:15:28 2015 +0000

    style
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/settings@1710426 13f79535-47bb-0310-9956-ffa450edef68
---
 .../java/org/apache/sling/settings/impl/SlingIdUtil.java  | 10 +++++++---
 .../sling/settings/impl/SlingSettingsServiceImplTest.java | 15 ++++++++-------
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/src/main/java/org/apache/sling/settings/impl/SlingIdUtil.java b/src/main/java/org/apache/sling/settings/impl/SlingIdUtil.java
index 29ad3ea..4b1995a 100644
--- a/src/main/java/org/apache/sling/settings/impl/SlingIdUtil.java
+++ b/src/main/java/org/apache/sling/settings/impl/SlingIdUtil.java
@@ -28,7 +28,9 @@ import java.util.UUID;
 
 public class SlingIdUtil {
 
-    /** The length in bytes of a sling identifier */
+    /**
+     * The length in bytes of a sling identifier
+     */
     private static final int SLING_ID_LENGTH = 36;
 
     public static String createSlingId() {
@@ -53,7 +55,8 @@ public class SlingIdUtil {
                 if (dis != null) {
                     try {
                         dis.close();
-                    } catch (IOException ignore){}
+                    } catch (IOException ignore) {
+                    }
                 }
             }
         }
@@ -76,7 +79,8 @@ public class SlingIdUtil {
             if (dos != null) {
                 try {
                     dos.close();
-                } catch (IOException ignore) {}
+                } catch (IOException ignore) {
+                }
             }
         }
     }
diff --git a/src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java b/src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java
index 55ee328..f50fed2 100644
--- a/src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java
+++ b/src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java
@@ -28,12 +28,13 @@ import java.util.List;
 import org.apache.commons.lang.RandomStringUtils;
 import org.apache.sling.settings.SlingSettingsService;
 import org.junit.After;
-import org.junit.Assert;
 import org.apache.sling.launchpad.api.StartupHandler;
 import org.junit.Before;
 import org.junit.Test;
 import org.osgi.framework.BundleContext;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -70,7 +71,7 @@ public class SlingSettingsServiceImplTest {
         final SlingSettingsService slingSettingsService = createSlingSettingsService(slingIdFile, optionsFile);
 
         final String slingId = slingSettingsService.getSlingId();
-        Assert.assertNotNull(slingId);
+        assertNotNull(slingId);
     }
 
     @Test
@@ -80,8 +81,8 @@ public class SlingSettingsServiceImplTest {
         final SlingSettingsService slingSettingsService = createSlingSettingsService(slingIdFile, optionsFile);
 
         final String slingId = slingSettingsService.getSlingId();
-        Assert.assertNotNull(slingId);
-        Assert.assertEquals(expected, slingId);
+        assertNotNull(slingId);
+        assertEquals(expected, slingId);
     }
 
     @Test
@@ -92,8 +93,8 @@ public class SlingSettingsServiceImplTest {
         final SlingSettingsService slingSettingsService = createSlingSettingsService(slingIdFile, optionsFile);
 
         final String slingId = slingSettingsService.getSlingId();
-        Assert.assertNotNull(slingId);
-        Assert.assertEquals(expected, slingId);
+        assertNotNull(slingId);
+        assertEquals(expected, slingId);
     }
 
     @Test
@@ -103,7 +104,7 @@ public class SlingSettingsServiceImplTest {
         final SlingSettingsService slingSettingsService = createSlingSettingsService(slingIdFile, optionsFile);
 
         final String slingId = slingSettingsService.getSlingId();
-        Assert.assertNotNull(slingId);
+        assertNotNull(slingId);
     }
 
     private SlingSettingsService createSlingSettingsService(final File slingIdFile, final File optionsFile) throws IOException {

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

[sling-org-apache-sling-settings] 13/21: revert r1710229 SLING-5190 factor out of SlingSettingsServiceImpl a Sling ID util

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.3.8
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-settings.git

commit 11e1d6547648f26208e5f461756bd38f990c5aac
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Fri Oct 23 15:17:08 2015 +0000

    revert r1710229 SLING-5190 factor out of SlingSettingsServiceImpl a Sling ID util
    
    * rename SlingSettingsServiceImpl to SlingIdUtilTest
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/settings@1710233 13f79535-47bb-0310-9956-ffa450edef68
---
 .../impl/{SlingIdUtilTest.java => SlingSettingsServiceImplTest.java}    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/sling/settings/impl/SlingIdUtilTest.java b/src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java
similarity index 99%
rename from src/test/java/org/apache/sling/settings/impl/SlingIdUtilTest.java
rename to src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java
index 79177a0..732f69b 100644
--- a/src/test/java/org/apache/sling/settings/impl/SlingIdUtilTest.java
+++ b/src/test/java/org/apache/sling/settings/impl/SlingSettingsServiceImplTest.java
@@ -34,7 +34,7 @@ import org.junit.Test;
 import org.mockito.Mockito;
 import org.osgi.framework.BundleContext;
 
-public class SlingIdUtilTest {
+public class SlingSettingsServiceImplTest {
 
     private static final String SLING_ID_FILE_NAME = "sling.id.file";
 

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