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) {