This commit is contained in:
Lucio Lelii 2022-12-21 19:16:43 +01:00
parent d567786ff6
commit 3631e00a90
2 changed files with 8 additions and 3 deletions

View File

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

View File

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