From 01de936b65bd09e2db30070c084cb4c2128481e9 Mon Sep 17 00:00:00 2001
From: Kai Reinhard <K.Reinhard@micromata.de>
Date: Sun, 16 Dec 2018 09:23:22 +0000
Subject: [PATCH] Archive rest calls -> ArchivesRest.java
---
borgbutler-webapp/src/components/views/repos/ArchiveView.jsx | 2
borgbutler-server/src/main/java/de/micromata/borgbutler/server/rest/ArchivesRest.java | 54 +++++++++++++++++++++++++++
borgbutler-server/src/main/java/de/micromata/borgbutler/server/rest/ReposRest.java | 19 ---------
3 files changed, 55 insertions(+), 20 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
new file mode 100644
index 0000000..8f3e88d
--- /dev/null
+++ b/borgbutler-server/src/main/java/de/micromata/borgbutler/server/rest/ArchivesRest.java
@@ -0,0 +1,54 @@
+package de.micromata.borgbutler.server.rest;
+
+import de.micromata.borgbutler.cache.ButlerCache;
+import de.micromata.borgbutler.data.Archive;
+import de.micromata.borgbutler.data.Repository;
+import de.micromata.borgbutler.json.JsonUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+
+@Path("/archives")
+public class ArchivesRest {
+ private static Logger log = LoggerFactory.getLogger(ArchivesRest.class);
+
+ @GET
+ @Produces(MediaType.APPLICATION_JSON)
+ /**
+ *
+ * @param repo Name of repository ({@link Repository#getName()}.
+ * @param archive Id or name of archive.
+ * @param prettyPrinter If true then the json output will be in pretty format.
+ * @return Repository (including list of archives) as json string.
+ * @see JsonUtils#toJson(Object, boolean)
+ */
+ public String getArchive(@QueryParam("repo") String repoName,
+ @QueryParam("archive") String archiveIdOrName, @QueryParam("force") boolean force,
+ @QueryParam("prettyPrinter") boolean prettyPrinter) {
+ Archive archive = ButlerCache.getInstance().getArchive(repoName, archiveIdOrName, force);
+ return JsonUtils.toJson(archive, prettyPrinter);
+ }
+
+ @GET
+ @Path("filelist")
+ @Produces(MediaType.APPLICATION_JSON)
+ /**
+ *
+ * @param repo Name of repository ({@link Repository#getName()}.
+ * @param archive Id or name of archive.
+ * @param prettyPrinter If true then the json output will be in pretty format.
+ * @return Repository (including list of archives) as json string.
+ * @see JsonUtils#toJson(Object, boolean)
+ */
+ public String getArchiveFileLIst(@QueryParam("repo") String repoName,
+ @QueryParam("archive") String archiveIdOrName, @QueryParam("force") boolean force,
+ @QueryParam("prettyPrinter") boolean prettyPrinter) {
+ Archive archive = ButlerCache.getInstance().getArchive(repoName, archiveIdOrName, force);
+ return JsonUtils.toJson(archive, prettyPrinter);
+ }
+}
diff --git a/borgbutler-server/src/main/java/de/micromata/borgbutler/server/rest/ReposRest.java b/borgbutler-server/src/main/java/de/micromata/borgbutler/server/rest/ReposRest.java
index 06a798c..7ed0c7c 100644
--- a/borgbutler-server/src/main/java/de/micromata/borgbutler/server/rest/ReposRest.java
+++ b/borgbutler-server/src/main/java/de/micromata/borgbutler/server/rest/ReposRest.java
@@ -1,7 +1,6 @@
package de.micromata.borgbutler.server.rest;
import de.micromata.borgbutler.cache.ButlerCache;
-import de.micromata.borgbutler.data.Archive;
import de.micromata.borgbutler.data.Repository;
import de.micromata.borgbutler.json.JsonUtils;
import de.micromata.borgbutler.json.borg.BorgRepository;
@@ -71,22 +70,4 @@
Repository repository = ButlerCache.getInstance().getRepositoryArchives(id);
return JsonUtils.toJson(repository, prettyPrinter);
}
-
- @GET
- @Path("archive")
- @Produces(MediaType.APPLICATION_JSON)
- /**
- *
- * @param repo Name of repository ({@link Repository#getName()}.
- * @param archive Id or name of archive.
- * @param prettyPrinter If true then the json output will be in pretty format.
- * @return Repository (including list of archives) as json string.
- * @see JsonUtils#toJson(Object, boolean)
- */
- public String getArchive(@QueryParam("repo") String repoName,
- @QueryParam("archive") String archiveIdOrName, @QueryParam("force") boolean force,
- @QueryParam("prettyPrinter") boolean prettyPrinter) {
- Archive archive = ButlerCache.getInstance().getArchive(repoName, archiveIdOrName, force);
- return JsonUtils.toJson(archive, prettyPrinter);
- }
}
diff --git a/borgbutler-webapp/src/components/views/repos/ArchiveView.jsx b/borgbutler-webapp/src/components/views/repos/ArchiveView.jsx
index c26f4c6..b08c7e6 100644
--- a/borgbutler-webapp/src/components/views/repos/ArchiveView.jsx
+++ b/borgbutler-webapp/src/components/views/repos/ArchiveView.jsx
@@ -24,7 +24,7 @@
isFetching: true,
failed: false
});
- fetch(getRestServiceUrl('repos/archive', {
+ fetch(getRestServiceUrl('archives', {
repo: this.state.repoId,
archive: this.state.archiveId,
force: force
--
Gitblit v1.10.0