You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by kw...@apache.org on 2020/06/05 15:47:55 UTC
[jackrabbit-filevault] branch feature/rcp-configure-filter created
(now 500d56f)
This is an automated email from the ASF dual-hosted git repository.
kwin pushed a change to branch feature/rcp-configure-filter
in repository https://gitbox.apache.org/repos/asf/jackrabbit-filevault.git.
at 500d56f JCRVLT-437 allow to pass a filter.xml to the ResourceCopier
This branch includes the following new commits:
new 500d56f JCRVLT-437 allow to pass a filter.xml to the ResourceCopier
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.
[jackrabbit-filevault] 01/01: JCRVLT-437 allow to pass a filter.xml
to the ResourceCopier
Posted by kw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kwin pushed a commit to branch feature/rcp-configure-filter
in repository https://gitbox.apache.org/repos/asf/jackrabbit-filevault.git
commit 500d56fec908c07fd581a19016bcc0e7f896fb80
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Fri Jun 5 17:47:35 2020 +0200
JCRVLT-437 allow to pass a filter.xml to the ResourceCopier
---
vault-doc/src/site/markdown/rcp.md | 1 +
.../org/apache/jackrabbit/vault/rcp/impl/RcpServlet.java | 14 +++++++++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/vault-doc/src/site/markdown/rcp.md b/vault-doc/src/site/markdown/rcp.md
index 4bea4a5..e264f78 100644
--- a/vault-doc/src/site/markdown/rcp.md
+++ b/vault-doc/src/site/markdown/rcp.md
@@ -147,6 +147,7 @@ Creates a new task.
| throttle | \- | Number of seconds to sleep after each intermediate save. Default is _0_. |
| resumeFrom | \- | Source path to resume a prior aborted copy. Note that the algorithm simply skips all source nodes until the _resumeFrom_ path is found. It is necessary that the content structure of the source repository does not change in between runs, and that content already needs to be present in the detination location. |
| excludes | \- | Array of java regular expressions that exclude source paths. |
+| filter | \- | Serialized [filter.xml](filter.html) specifing which repository areas to copy. Only used if `excludes` is not given. Make sure that the value is properly escaped. |
##### Example
diff --git a/vault-rcp/src/main/java/org/apache/jackrabbit/vault/rcp/impl/RcpServlet.java b/vault-rcp/src/main/java/org/apache/jackrabbit/vault/rcp/impl/RcpServlet.java
index 7e15cde..e66859f 100644
--- a/vault-rcp/src/main/java/org/apache/jackrabbit/vault/rcp/impl/RcpServlet.java
+++ b/vault-rcp/src/main/java/org/apache/jackrabbit/vault/rcp/impl/RcpServlet.java
@@ -18,7 +18,9 @@
package org.apache.jackrabbit.vault.rcp.impl;
import java.io.IOException;
+import java.io.StringReader;
import java.net.URI;
+import java.nio.charset.StandardCharsets;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
@@ -33,6 +35,7 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.io.IOUtils;
import org.apache.jackrabbit.vault.fs.api.RepositoryAddress;
import org.apache.jackrabbit.vault.fs.api.WorkspaceFilter;
+import org.apache.jackrabbit.vault.fs.config.DefaultWorkspaceFilter;
import org.apache.jackrabbit.vault.rcp.RcpTask;
import org.apache.jackrabbit.vault.rcp.RcpTaskManager;
import org.apache.sling.api.SlingHttpServletRequest;
@@ -72,6 +75,7 @@ public class RcpServlet extends SlingAllMethodsServlet {
public static final String PARAM_THROTTLE = "throttle";
public static final String PARAM_EXCLUDES = "excludes";
public static final String PARAM_RESUME_FROM = "resumeFrom";
+ public static final String PARAM_FILTER = "filter";
/**
* default logger
@@ -171,7 +175,15 @@ public class RcpServlet extends SlingAllMethodsServlet {
}
task = taskMgr.addTask(address, creds, dst, id, excludeList, recursive);
} else {
- task = taskMgr.addTask(address, creds, dst, id, (WorkspaceFilter)null, recursive);
+ final WorkspaceFilter filter;
+ if (data.has(PARAM_FILTER)) {
+ DefaultWorkspaceFilter filterImpl = new DefaultWorkspaceFilter();
+ filterImpl.load(IOUtils.toInputStream(data.getString(PARAM_FILTER), StandardCharsets.UTF_8));
+ filter = filterImpl;
+ } else {
+ filter = null;
+ }
+ task = taskMgr.addTask(address, creds, dst, id, filter, recursive);
}
// add additional data