[sling-org-apache-sling-distribution-core] branch master updated: SLING-7730 - Distribution package is lost if there is an installation error on receiver side

2018-06-21 Thread simonetripodi
This is an automated email from the ASF dual-hosted git repository.

simonetripodi pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-distribution-core.git


The following commit(s) were added to refs/heads/master by this push:
 new 3690223  SLING-7730 - Distribution package is lost if there is an 
installation error on receiver side
3690223 is described below

commit 36902234b950596342d0f3da4d771fd9101285bc
Author: Simo Tripodi 
AuthorDate: Thu Jun 21 11:53:53 2018 +0200

SLING-7730 - Distribution package is lost if there is an installation
error on receiver side
---
 .../serialization/impl/vlt/FileVaultContentSerializer.java  |  7 +--
 .../impl/vlt/VaultDistributionPackageBuilderFactory.java| 13 -
 .../sling/distribution/serialization/impl/vlt/VltUtils.java |  4 ++--
 .../impl/importer/LocalDistributionPackageImporterTest.java |  3 ++-
 .../impl/vlt/FileVaultContentSerializerTest.java|  4 ++--
 5 files changed, 23 insertions(+), 8 deletions(-)

diff --git 
a/src/main/java/org/apache/sling/distribution/serialization/impl/vlt/FileVaultContentSerializer.java
 
b/src/main/java/org/apache/sling/distribution/serialization/impl/vlt/FileVaultContentSerializer.java
index c759c36..17fce95 100644
--- 
a/src/main/java/org/apache/sling/distribution/serialization/impl/vlt/FileVaultContentSerializer.java
+++ 
b/src/main/java/org/apache/sling/distribution/serialization/impl/vlt/FileVaultContentSerializer.java
@@ -81,10 +81,12 @@ public class FileVaultContentSerializer implements 
DistributionContentSerializer
 private final boolean useBinaryReferences;
 private final String name;
 private final Map exportPathMapping;
+private final boolean strict;
 
 public FileVaultContentSerializer(String name, Packaging packaging, 
ImportMode importMode, AccessControlHandling aclHandling, String[] packageRoots,
   String[] nodeFilters, String[] 
propertyFilters, boolean useBinaryReferences, int autosaveThreshold,
-  Map exportPathMapping) {
+  Map exportPathMapping,
+  boolean strict) {
 this.name = name;
 this.packaging = packaging;
 this.importMode = importMode;
@@ -95,6 +97,7 @@ public class FileVaultContentSerializer implements 
DistributionContentSerializer
 this.propertyFilters = VltUtils.parseFilters(propertyFilters);
 this.useBinaryReferences = useBinaryReferences;
 this.exportPathMapping = exportPathMapping;
+this.strict = strict;
 }
 
 @Override
@@ -127,7 +130,7 @@ public class FileVaultContentSerializer implements 
DistributionContentSerializer
 Archive archive = null;
 try {
 session = getSession(resourceResolver);
-ImportOptions importOptions = 
VltUtils.getImportOptions(aclHandling, importMode, autosaveThreshold);
+ImportOptions importOptions = 
VltUtils.getImportOptions(aclHandling, importMode, autosaveThreshold, strict);
 Importer importer = new Importer(importOptions);
 archive = new ZipStreamArchive(inputStream);
 archive.open(false);
diff --git 
a/src/main/java/org/apache/sling/distribution/serialization/impl/vlt/VaultDistributionPackageBuilderFactory.java
 
b/src/main/java/org/apache/sling/distribution/serialization/impl/vlt/VaultDistributionPackageBuilderFactory.java
index 220d987..f832883 100644
--- 
a/src/main/java/org/apache/sling/distribution/serialization/impl/vlt/VaultDistributionPackageBuilderFactory.java
+++ 
b/src/main/java/org/apache/sling/distribution/serialization/impl/vlt/VaultDistributionPackageBuilderFactory.java
@@ -208,6 +208,15 @@ public class VaultDistributionPackageBuilderFactory 
implements DistributionPacka
   "The format is {sourcePattern}={destinationPattern}, e.g. 
/etc/(.*)=/var/$1/some or simply /data=/bak")
 private static final String PATHS_MAPPING = "pathsMapping";
 
+private static final boolean DEFAULT_STRICT_IMPORT_SETTINGS = true;
+
+@Property(
+label = "Install a content package in a strict mode",
+description = "Flag to mark an error response will be thrown, if a 
content package will incorrectly installed",
+boolValue = DEFAULT_STRICT_IMPORT_SETTINGS
+)
+public static final String STRICT_IMPORT_SETTINGS = "strictImport";
+
 @Reference
 private Packaging packaging;
 
@@ -256,8 +265,10 @@ public class VaultDistributionPackageBuilderFactory 
implements DistributionPacka
 Map pathsMapping = 
PropertiesUtil.toMap(config.get(PATHS_MAPPING), new String[0]);
 pathsMapping = SettingsUtils.removeEmptyEntries(pathsMapping);
 
+boolean strictImport = 
PropertiesUtil.toBoolean(config.get(STRICT_IMPORT_SETTINGS), 
DEFAULT_STRICT_IMPORT_SETTINGS);
+
 DistributionContentSerializer contentSe

[sling-org-apache-sling-distribution-core] branch master updated: SLING-7730 - Distribution package is lost if there is an installation error on receiver side

2018-06-13 Thread simonetripodi
This is an automated email from the ASF dual-hosted git repository.

simonetripodi pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-distribution-core.git


The following commit(s) were added to refs/heads/master by this push:
 new d89583d  SLING-7730 - Distribution package is lost if there is an 
installation error on receiver side
d89583d is described below

commit d89583d04f34fa9707eba38005f5cc9143e99a01
Author: Simo Tripodi 
AuthorDate: Wed Jun 13 11:39:34 2018 +0200

SLING-7730 - Distribution package is lost if there is an installation
error on receiver side
---
 .../org/apache/sling/distribution/serialization/impl/vlt/VltUtils.java  | 2 ++
 1 file changed, 2 insertions(+)

diff --git 
a/src/main/java/org/apache/sling/distribution/serialization/impl/vlt/VltUtils.java
 
b/src/main/java/org/apache/sling/distribution/serialization/impl/vlt/VltUtils.java
index c822e1a..a0be36e 100644
--- 
a/src/main/java/org/apache/sling/distribution/serialization/impl/vlt/VltUtils.java
+++ 
b/src/main/java/org/apache/sling/distribution/serialization/impl/vlt/VltUtils.java
@@ -247,6 +247,8 @@ public class VltUtils {
 opts.setAutoSaveThreshold(autosaveThreshold);
 }
 
+opts.setStrict(true);
+
 return opts;
 }
 

-- 
To stop receiving notification emails like this one, please contact
simonetrip...@apache.org.