From 3631e00a907d420ba53942c243489b73ff4c6cdc Mon Sep 17 00:00:00 2001 From: lucio Date: Wed, 21 Dec 2022 19:16:43 +0100 Subject: [PATCH] modified --- src/main/java/BackupJackrabbit.java | 2 +- src/main/java/RetoreJackrabbitBackup.java | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/BackupJackrabbit.java b/src/main/java/BackupJackrabbit.java index 1829e4d..619cd24 100644 --- a/src/main/java/BackupJackrabbit.java +++ b/src/main/java/BackupJackrabbit.java @@ -20,7 +20,7 @@ public class BackupJackrabbit implements AbstractScript{ StringBuilder stringBuilder = new StringBuilder(); try { try(OutputStream os = new ByteArrayOutputStream()){ - session.exportDocumentView("/", os, true, false); + session.exportSystemView("/", os, true, false); stringBuilder.append(os.toString()); } }catch (Throwable e) { diff --git a/src/main/java/RetoreJackrabbitBackup.java b/src/main/java/RetoreJackrabbitBackup.java index 6b6a45c..7238b55 100644 --- a/src/main/java/RetoreJackrabbitBackup.java +++ b/src/main/java/RetoreJackrabbitBackup.java @@ -3,6 +3,8 @@ import java.io.PrintWriter; import java.io.StringWriter; import java.net.URI; +import javax.jcr.ImportUUIDBehavior; + import org.apache.jackrabbit.api.JackrabbitSession; import org.gcube.data.access.storagehub.scripting.AbstractScript; import org.gcube.data.access.storagehub.scripting.ScriptParameter; @@ -21,8 +23,11 @@ public class RetoreJackrabbitBackup implements AbstractScript{ StringBuilder stringBuilder = new StringBuilder(); try { - try(InputStream is = new URI("https://data-dev.d4science.net/VoyH").toURL().openStream()){ - session.importXML("/", is, 1); + if(session.nodeExists("/Share")) + session.getNode("/Share").remove(); + session.save(); + try(InputStream is = new URI("https://data-dev.d4science.net/iUnB").toURL().openStream()){ + session.importXML("/", is, ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW); } session.save(); }catch (Throwable e) {