From 1b27eb532dbc405cda3a4420345c78bb0bc7c6e7 Mon Sep 17 00:00:00 2001
From: Kai Reinhard <K.Reinhard@micromata.de>
Date: Wed, 19 Dec 2018 22:33:23 +0000
Subject: [PATCH] Diff functionality started.
---
borgbutler-server/src/main/java/de/micromata/borgbutler/server/rest/ArchivesRest.java | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/borgbutler-server/src/main/java/de/micromata/borgbutler/server/rest/ArchivesRest.java b/borgbutler-server/src/main/java/de/micromata/borgbutler/server/rest/ArchivesRest.java
index 8a6e39f..23dc2af 100644
--- a/borgbutler-server/src/main/java/de/micromata/borgbutler/server/rest/ArchivesRest.java
+++ b/borgbutler-server/src/main/java/de/micromata/borgbutler/server/rest/ArchivesRest.java
@@ -11,8 +11,7 @@
import de.micromata.borgbutler.json.borg.BorgFilesystemItem;
import de.micromata.borgbutler.utils.DirUtils;
import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.output.ByteArrayOutputStream;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -26,7 +25,6 @@
import java.awt.*;
import java.io.File;
import java.io.IOException;
-import java.nio.file.Files;
import java.util.List;
@Path("/archives")
@@ -60,6 +58,7 @@
* @param mode Flat (default) or tree.
* @param currentDirectory The current displayed directory (only files and directories contained will be returned).
* @param maxResultSize maximum number of file items to return (default is 50).
+ * @param diffArchiveId If given, the differences between archiveId and diffArchiveId will be returned.
* @param force If false (default), non cached file lists will not be loaded by borg.
* @param prettyPrinter If true then the json output will be in pretty format.
* @return Repository (including list of archives) as json string.
@@ -70,6 +69,7 @@
@QueryParam("mode") String mode,
@QueryParam("currentDirectory") String currentDirectory,
@QueryParam("maxResultSize") String maxResultSize,
+ @QueryParam("diffArchiveId") String diffArchiveId,
@QueryParam("force") boolean force,
@QueryParam("prettyPrinter") boolean prettyPrinter) {
int maxSize = NumberUtils.toInt(maxResultSize, 50);
@@ -83,6 +83,9 @@
if (items == null) {
return "[{\"mode\": \"notLoaded\"}]";
}
+ if (StringUtils.isNotBlank(diffArchiveId)) {
+ log.info("Diff between archives not yet supported.");
+ }
return JsonUtils.toJson(items, prettyPrinter);
}
@@ -92,7 +95,6 @@
/**
* @param archiveId
* @param fileNumber The fileNumber of the file or directory in the archive served by BorgButler's
- * {@link #getArchiveFileLIst(String, String, String, boolean, boolean)}
*/
public Response restore(@QueryParam("archiveId") String archiveId, @QueryParam("fileNumber") int fileNumber) {
log.info("Requesting file #" + fileNumber + " of archive '" + archiveId + "'.");
@@ -137,14 +139,14 @@
}
}
- public void openFileBrowser(File directory) {
+ private void openFileBrowser(File directory) {
if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE_FILE_DIR)) {
Desktop.getDesktop().browseFileDirectory(directory);
}
}
private Response handleRestoredFiles(BorgRepoConfig repoConfig, Archive archive) {
- // Todo: Handle download from single files as well as download of zip archive (if BorgButler runs remote).
+ // Todo: Handle download of single files as well as download of zip archive (if BorgButler runs remote).
return null;
/* File file = path.toFile();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
--
Gitblit v1.10.0