You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by re...@apache.org on 2021/10/26 09:55:04 UTC

[jackrabbit-filevault] 01/01: JCRVLT-577: add sysprop based config for implicite nodetype calculation

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

reschke pushed a commit to branch bugfix/JCRVLT-557-conf-implicit-nt-calc
in repository https://gitbox.apache.org/repos/asf/jackrabbit-filevault.git

commit ae57884324eba22d11c3ecaf67e482d2b6a1abda
Author: Julian Reschke <ju...@gmx.de>
AuthorDate: Tue Oct 26 10:54:45 2021 +0100

    JCRVLT-577: add sysprop based config for implicite nodetype calculation
---
 .../vault/fs/impl/io/FolderArtifactHandler.java       | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/impl/io/FolderArtifactHandler.java b/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/impl/io/FolderArtifactHandler.java
index f64cc0c..e1ffe16 100644
--- a/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/impl/io/FolderArtifactHandler.java
+++ b/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/impl/io/FolderArtifactHandler.java
@@ -40,6 +40,8 @@ import org.apache.jackrabbit.vault.fs.io.ImportOptions;
 import org.apache.jackrabbit.vault.util.EffectiveNodeType;
 import org.apache.jackrabbit.vault.util.JcrConstants;
 import org.jetbrains.annotations.NotNull;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Handles artifact sets with just a directory.
@@ -47,6 +49,20 @@ import org.jetbrains.annotations.NotNull;
  */
 public class FolderArtifactHandler extends AbstractArtifactHandler {
 
+    private static final Logger LOG = LoggerFactory.getLogger(FolderArtifactHandler.class);
+
+    private static boolean IMPLICIT_NODETYPE_CALCULATION;
+    static {
+        boolean t = true;
+        String key = "org.apache.jackrabbit.filevault.fs.impl.io.FolderArtifactHandler.IMPLICIT_NODETYPE_CALCULATION";
+        String sp = System.getProperty(key);
+        if (sp != null) {
+            LOG.info(key + " set to: '" + sp + "' (default is '" + t + "')");
+            t = Boolean.parseBoolean(sp);
+        }
+        IMPLICIT_NODETYPE_CALCULATION = t;
+    }
+
     /**
      * qualified names of those default node types which should not be used for intermediate nodes (as they come with too many restrictions)
      */
@@ -123,7 +139,8 @@ public class FolderArtifactHandler extends AbstractArtifactHandler {
             }
 
             Node node = parent.getNode(dir.getRelativePath());
-            if (wspFilter.contains(node.getPath()) && wspFilter.getImportMode(node.getPath())==ImportMode.REPLACE && !nodeType.equals(node.getPrimaryNodeType().getName())) {
+            if (IMPLICIT_NODETYPE_CALCULATION
+                    && wspFilter.contains(node.getPath()) && wspFilter.getImportMode(node.getPath()) == ImportMode.REPLACE && !nodeType.equals(node.getPrimaryNodeType().getName())) {
                 modifyPrimaryType(node, info);
             }
             NodeIterator iter = node.getNodes();