You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by kw...@apache.org on 2019/12/20 09:59:00 UTC

[sling-org-apache-sling-installer-provider-jcr] branch feature/json-config-writeback created (now b37158e)

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

kwin pushed a change to branch feature/json-config-writeback
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-installer-provider-jcr.git.


      at b37158e  SLING-8419 write-back configurations in JSON format

This branch includes the following new commits:

     new b37158e  SLING-8419 write-back configurations in JSON format

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



[sling-org-apache-sling-installer-provider-jcr] 01/01: SLING-8419 write-back configurations in JSON format

Posted by kw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kwin pushed a commit to branch feature/json-config-writeback
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-installer-provider-jcr.git

commit b37158e9480db32d0b4a2b3c580a15ba80705898
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Fri Dec 20 10:56:57 2019 +0100

    SLING-8419 write-back configurations in JSON format
---
 pom.xml                                                           | 2 +-
 .../apache/sling/installer/provider/jcr/impl/JcrInstaller.java    | 8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 1ecbead..91611d1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -105,7 +105,7 @@
             the .config files being generated by the write back feature -->
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.installer.core</artifactId>
-            <version>3.6.6</version> 
+            <version>3.9.1-SNAPSHOT</version> 
             <scope>provided</scope>
         </dependency>
         <dependency>
diff --git a/src/main/java/org/apache/sling/installer/provider/jcr/impl/JcrInstaller.java b/src/main/java/org/apache/sling/installer/provider/jcr/impl/JcrInstaller.java
index aa19d2e..6971215 100644
--- a/src/main/java/org/apache/sling/installer/provider/jcr/impl/JcrInstaller.java
+++ b/src/main/java/org/apache/sling/installer/provider/jcr/impl/JcrInstaller.java
@@ -52,6 +52,8 @@ import org.apache.sling.installer.api.InstallableResource;
 import org.apache.sling.installer.api.OsgiInstaller;
 import org.apache.sling.installer.api.UpdateHandler;
 import org.apache.sling.installer.api.UpdateResult;
+import org.apache.sling.installer.api.serializer.ConfigurationSerializer;
+import org.apache.sling.installer.api.serializer.ConfigurationSerializerFactory;
 import org.apache.sling.jcr.api.SlingRepository;
 import org.apache.sling.serviceusermapping.ServiceUserMapped;
 import org.apache.sling.settings.SlingSettingsService;
@@ -775,9 +777,9 @@ public class JcrInstaller implements UpdateHandler, ManagedService {
             }
 
             // write to a byte array stream
-            final ByteArrayOutputStream baos = new ByteArrayOutputStream();
-            baos.write("# Configuration created by Apache Sling JCR Installer\n".getBytes("UTF-8"));
-            ConfigurationHandler.write(baos, dict);
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            ConfigurationSerializer serializer = ConfigurationSerializerFactory.create(ConfigurationSerializerFactory.Format.JSON);
+            serializer.serialize(dict, baos);
             baos.close();
 
             // get or create file node