summaryrefslogtreecommitdiff
path: root/src/main/java/com/keuin/kbackupfabric/operation/backup
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/keuin/kbackupfabric/operation/backup')
-rw-r--r--src/main/java/com/keuin/kbackupfabric/operation/backup/feedback/BackupFeedback.java1
-rw-r--r--src/main/java/com/keuin/kbackupfabric/operation/backup/feedback/IncrementalBackupFeedback.java28
-rw-r--r--src/main/java/com/keuin/kbackupfabric/operation/backup/feedback/PrimitiveBackupFeedback.java3
-rw-r--r--src/main/java/com/keuin/kbackupfabric/operation/backup/method/BackupMethod.java (renamed from src/main/java/com/keuin/kbackupfabric/operation/backup/BackupMethod.java)6
-rw-r--r--src/main/java/com/keuin/kbackupfabric/operation/backup/method/IncrementalBackupMethod.java17
-rw-r--r--src/main/java/com/keuin/kbackupfabric/operation/backup/method/PrimitiveBackupMethod.java (renamed from src/main/java/com/keuin/kbackupfabric/operation/backup/PrimitiveBackupMethod.java)2
6 files changed, 52 insertions, 5 deletions
diff --git a/src/main/java/com/keuin/kbackupfabric/operation/backup/feedback/BackupFeedback.java b/src/main/java/com/keuin/kbackupfabric/operation/backup/feedback/BackupFeedback.java
index 92a9f39..0fe0766 100644
--- a/src/main/java/com/keuin/kbackupfabric/operation/backup/feedback/BackupFeedback.java
+++ b/src/main/java/com/keuin/kbackupfabric/operation/backup/feedback/BackupFeedback.java
@@ -2,4 +2,5 @@ package com.keuin.kbackupfabric.operation.backup.feedback;
public interface BackupFeedback {
String getFeedback();
+ boolean isSuccess();
}
diff --git a/src/main/java/com/keuin/kbackupfabric/operation/backup/feedback/IncrementalBackupFeedback.java b/src/main/java/com/keuin/kbackupfabric/operation/backup/feedback/IncrementalBackupFeedback.java
new file mode 100644
index 0000000..f39fde6
--- /dev/null
+++ b/src/main/java/com/keuin/kbackupfabric/operation/backup/feedback/IncrementalBackupFeedback.java
@@ -0,0 +1,28 @@
+package com.keuin.kbackupfabric.operation.backup.feedback;
+
+public class IncrementalBackupFeedback implements BackupFeedback {
+ private final boolean success;
+ private final int newFilesAdded;
+
+ public IncrementalBackupFeedback(boolean success, int newFilesAdded) {
+ this.success = success;
+ this.newFilesAdded = newFilesAdded;
+ }
+
+ @Override
+ public boolean isSuccess() {
+ return success;
+ }
+
+ public long getNewFilesAdded() {
+ return newFilesAdded;
+ }
+
+ @Override
+ public String getFeedback() {
+ if (success && newFilesAdded >= 0)
+ return String.format("File(s) added: %d.", newFilesAdded);
+ else
+ return "";
+ }
+}
diff --git a/src/main/java/com/keuin/kbackupfabric/operation/backup/feedback/PrimitiveBackupFeedback.java b/src/main/java/com/keuin/kbackupfabric/operation/backup/feedback/PrimitiveBackupFeedback.java
index 6d7a15b..3bcd012 100644
--- a/src/main/java/com/keuin/kbackupfabric/operation/backup/feedback/PrimitiveBackupFeedback.java
+++ b/src/main/java/com/keuin/kbackupfabric/operation/backup/feedback/PrimitiveBackupFeedback.java
@@ -11,6 +11,7 @@ public class PrimitiveBackupFeedback implements BackupFeedback {
this.backupSizeBytes = backupSizeBytes;
}
+ @Override
public boolean isSuccess() {
return success;
}
@@ -22,7 +23,7 @@ public class PrimitiveBackupFeedback implements BackupFeedback {
@Override
public String getFeedback() {
if (success && backupSizeBytes >= 0)
- return String.format(" File size: %s.", getFriendlyFileSizeString(backupSizeBytes));
+ return String.format("File size: %s.", getFriendlyFileSizeString(backupSizeBytes));
else
return "";
}
diff --git a/src/main/java/com/keuin/kbackupfabric/operation/backup/BackupMethod.java b/src/main/java/com/keuin/kbackupfabric/operation/backup/method/BackupMethod.java
index b65a076..25a5952 100644
--- a/src/main/java/com/keuin/kbackupfabric/operation/backup/BackupMethod.java
+++ b/src/main/java/com/keuin/kbackupfabric/operation/backup/method/BackupMethod.java
@@ -1,6 +1,6 @@
-package com.keuin.kbackupfabric.operation.backup;
+package com.keuin.kbackupfabric.operation.backup.method;
-import com.keuin.kbackupfabric.operation.backup.feedback.PrimitiveBackupFeedback;
+import com.keuin.kbackupfabric.operation.backup.feedback.BackupFeedback;
import java.io.IOException;
@@ -15,7 +15,7 @@ public interface BackupMethod {
* @param backupName the backup name.
* @return if the backup operation succeed.
*/
- PrimitiveBackupFeedback backup(String backupName, String levelPath, String backupSaveDirectory) throws IOException;
+ BackupFeedback backup(String backupName, String levelPath, String backupSaveDirectory) throws IOException;
boolean restore(String backupName, String levelPath, String backupSaveDirectory) throws IOException;
diff --git a/src/main/java/com/keuin/kbackupfabric/operation/backup/method/IncrementalBackupMethod.java b/src/main/java/com/keuin/kbackupfabric/operation/backup/method/IncrementalBackupMethod.java
new file mode 100644
index 0000000..1dacc44
--- /dev/null
+++ b/src/main/java/com/keuin/kbackupfabric/operation/backup/method/IncrementalBackupMethod.java
@@ -0,0 +1,17 @@
+package com.keuin.kbackupfabric.operation.backup.method;
+
+import com.keuin.kbackupfabric.operation.backup.feedback.IncrementalBackupFeedback;
+
+import java.io.IOException;
+
+public class IncrementalBackupMethod implements BackupMethod {
+ @Override
+ public IncrementalBackupFeedback backup(String backupName, String levelPath, String backupSaveDirectory) throws IOException {
+ return null;
+ }
+
+ @Override
+ public boolean restore(String backupName, String levelPath, String backupSaveDirectory) throws IOException {
+ return false;
+ }
+}
diff --git a/src/main/java/com/keuin/kbackupfabric/operation/backup/PrimitiveBackupMethod.java b/src/main/java/com/keuin/kbackupfabric/operation/backup/method/PrimitiveBackupMethod.java
index 9c065a6..1f15346 100644
--- a/src/main/java/com/keuin/kbackupfabric/operation/backup/PrimitiveBackupMethod.java
+++ b/src/main/java/com/keuin/kbackupfabric/operation/backup/method/PrimitiveBackupMethod.java
@@ -1,4 +1,4 @@
-package com.keuin.kbackupfabric.operation.backup;
+package com.keuin.kbackupfabric.operation.backup.method;
import com.keuin.kbackupfabric.exception.ZipUtilException;
import com.keuin.kbackupfabric.metadata.BackupMetadata;