modified
This commit is contained in:
parent
d567786ff6
commit
3631e00a90
|
@ -20,7 +20,7 @@ public class BackupJackrabbit implements AbstractScript{
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
try {
|
try {
|
||||||
try(OutputStream os = new ByteArrayOutputStream()){
|
try(OutputStream os = new ByteArrayOutputStream()){
|
||||||
session.exportDocumentView("/", os, true, false);
|
session.exportSystemView("/", os, true, false);
|
||||||
stringBuilder.append(os.toString());
|
stringBuilder.append(os.toString());
|
||||||
}
|
}
|
||||||
}catch (Throwable e) {
|
}catch (Throwable e) {
|
||||||
|
|
|
@ -3,6 +3,8 @@ import java.io.PrintWriter;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
|
import javax.jcr.ImportUUIDBehavior;
|
||||||
|
|
||||||
import org.apache.jackrabbit.api.JackrabbitSession;
|
import org.apache.jackrabbit.api.JackrabbitSession;
|
||||||
import org.gcube.data.access.storagehub.scripting.AbstractScript;
|
import org.gcube.data.access.storagehub.scripting.AbstractScript;
|
||||||
import org.gcube.data.access.storagehub.scripting.ScriptParameter;
|
import org.gcube.data.access.storagehub.scripting.ScriptParameter;
|
||||||
|
@ -21,8 +23,11 @@ public class RetoreJackrabbitBackup implements AbstractScript{
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
try(InputStream is = new URI("https://data-dev.d4science.net/VoyH").toURL().openStream()){
|
if(session.nodeExists("/Share"))
|
||||||
session.importXML("/", is, 1);
|
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();
|
session.save();
|
||||||
}catch (Throwable e) {
|
}catch (Throwable e) {
|
||||||
|
|
Loading…
Reference in New Issue