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:57:08 UTC
[sling-org-apache-sling-installer-provider-jcr] branch master
updated: SLING-8419 write-back configurations in JSON format
This is an automated email from the ASF dual-hosted git repository.
kwin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-installer-provider-jcr.git
The following commit(s) were added to refs/heads/master by this push:
new e203067 SLING-8419 write-back configurations in JSON format
e203067 is described below
commit e2030671df5fa16915d1f2c216b9c9575901d031
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