summaryrefslogtreecommitdiff
path: root/src/main/java/com/keuin/kbackupfabric/operation/backup/PrimitiveBackupMehtod.java
diff options
context:
space:
mode:
authorKeuin <[email protected]>2020-10-04 13:43:15 +0800
committerkeuin <[email protected]>2020-10-04 13:43:15 +0800
commite59bdf4ac0b66ce683be1bbc36852bfce6f70a63 (patch)
tree6c8b97f97af857d2740e7b79d46349cc83a8c7dd /src/main/java/com/keuin/kbackupfabric/operation/backup/PrimitiveBackupMehtod.java
parentd9c2af035ac2edb68bc8b6a1f94b7c772c3509c8 (diff)
Pump up
Diffstat (limited to 'src/main/java/com/keuin/kbackupfabric/operation/backup/PrimitiveBackupMehtod.java')
-rw-r--r--src/main/java/com/keuin/kbackupfabric/operation/backup/PrimitiveBackupMehtod.java42
1 files changed, 0 insertions, 42 deletions
diff --git a/src/main/java/com/keuin/kbackupfabric/operation/backup/PrimitiveBackupMehtod.java b/src/main/java/com/keuin/kbackupfabric/operation/backup/PrimitiveBackupMehtod.java
deleted file mode 100644
index 3c2a608..0000000
--- a/src/main/java/com/keuin/kbackupfabric/operation/backup/PrimitiveBackupMehtod.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.keuin.kbackupfabric.operation.backup;
-
-import com.keuin.kbackupfabric.exception.ZipUtilException;
-import com.keuin.kbackupfabric.metadata.BackupMetadata;
-import com.keuin.kbackupfabric.util.PrintUtil;
-import com.keuin.kbackupfabric.util.ZipUtil;
-import com.keuin.kbackupfabric.util.backup.builder.BackupFileNameBuilder;
-import com.keuin.kbackupfabric.util.backup.formatter.BackupFileNameFormatter;
-
-import java.io.File;
-import java.io.IOException;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-
-public class PrimitiveBackupMehtod implements BackupMethod {
- @Override
- public boolean backup(String backupName, String levelPath, String backupSaveDirectory) throws IOException {
- try {
- String backupFileName = BackupFileNameBuilder.primitiveZipBackup().build(LocalDateTime.now(),backupName);
- BackupMetadata backupMetadata = new BackupMetadata(System.currentTimeMillis(), backupName);
-
- PrintUtil.info(String.format("zip(srcPath=%s, destPath=%s)", levelPath, backupSaveDirectory));
- PrintUtil.info("Compressing level ...");
- ZipUtil.makeBackupZip(levelPath, backupSaveDirectory, backupFileName, backupMetadata);
-
- } catch (ZipUtilException exception) {
- PrintUtil.info("Infinite recursive of directory tree detected, backup was aborted.");
- return false;
- }
- return true;
- }
-
- @Override
- public BackupFileNameBuilder getBackupFileNameBuilder() {
- return BackupFileNameBuilder.primitiveZipBackup();
- }
-
- @Override
- public BackupFileNameFormatter getBackupFileNameFormatter() {
- return BFNF;
- }
-}