From 81497ebee2cdb0dac3bcdc26c5d77d06bdb98b5d Mon Sep 17 00:00:00 2001 From: Keuin Date: Wed, 13 Jan 2021 12:51:15 +0800 Subject: Clean old incremental backup codes. --- .../util/backup/incremental/ObjectCollectionFactory.java | 6 +++--- .../util/backup/incremental/ObjectCollectionSerializer.java | 3 +++ .../util/backup/incremental/identifier/FileIdentifierFactory.java | 8 -------- .../backup/incremental/identifier/FileIdentifierProvider.java | 8 ++++++++ .../util/backup/incremental/identifier/Sha256Identifier.java | 4 ++-- 5 files changed, 16 insertions(+), 13 deletions(-) delete mode 100644 src/main/java/com/keuin/kbackupfabric/util/backup/incremental/identifier/FileIdentifierFactory.java create mode 100644 src/main/java/com/keuin/kbackupfabric/util/backup/incremental/identifier/FileIdentifierProvider.java (limited to 'src/main/java/com/keuin/kbackupfabric/util/backup/incremental') diff --git a/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/ObjectCollectionFactory.java b/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/ObjectCollectionFactory.java index ea9edd9..ac87883 100644 --- a/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/ObjectCollectionFactory.java +++ b/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/ObjectCollectionFactory.java @@ -1,6 +1,6 @@ package com.keuin.kbackupfabric.util.backup.incremental; -import com.keuin.kbackupfabric.util.backup.incremental.identifier.FileIdentifierFactory; +import com.keuin.kbackupfabric.util.backup.incremental.identifier.FileIdentifierProvider; import com.keuin.kbackupfabric.util.backup.incremental.identifier.ObjectIdentifier; import java.io.File; @@ -17,9 +17,9 @@ import java.util.*; */ public class ObjectCollectionFactory { - private final FileIdentifierFactory identifierFactory; + private final FileIdentifierProvider identifierFactory; - public ObjectCollectionFactory(FileIdentifierFactory identifierFactory) { + public ObjectCollectionFactory(FileIdentifierProvider identifierFactory) { this.identifierFactory = identifierFactory; } diff --git a/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/ObjectCollectionSerializer.java b/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/ObjectCollectionSerializer.java index cc77837..6f9b792 100644 --- a/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/ObjectCollectionSerializer.java +++ b/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/ObjectCollectionSerializer.java @@ -3,6 +3,9 @@ package com.keuin.kbackupfabric.util.backup.incremental; import java.io.*; import java.util.Objects; +/** + * Serialize and deserialize ObjectCollection from/to the disk file. + */ public class ObjectCollectionSerializer { public static ObjectCollection fromFile(File file) throws IOException { Objects.requireNonNull(file); diff --git a/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/identifier/FileIdentifierFactory.java b/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/identifier/FileIdentifierFactory.java deleted file mode 100644 index 34ad9a0..0000000 --- a/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/identifier/FileIdentifierFactory.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.keuin.kbackupfabric.util.backup.incremental.identifier; - -import java.io.File; -import java.io.IOException; - -public interface FileIdentifierFactory { - T fromFile(File file) throws IOException; -} diff --git a/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/identifier/FileIdentifierProvider.java b/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/identifier/FileIdentifierProvider.java new file mode 100644 index 0000000..9a03371 --- /dev/null +++ b/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/identifier/FileIdentifierProvider.java @@ -0,0 +1,8 @@ +package com.keuin.kbackupfabric.util.backup.incremental.identifier; + +import java.io.File; +import java.io.IOException; + +public interface FileIdentifierProvider { + T fromFile(File file) throws IOException; +} diff --git a/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/identifier/Sha256Identifier.java b/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/identifier/Sha256Identifier.java index 9ecf2d3..cbf1bb9 100644 --- a/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/identifier/Sha256Identifier.java +++ b/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/identifier/Sha256Identifier.java @@ -15,7 +15,7 @@ public class Sha256Identifier extends SingleHashIdentifier { private static final int SHA256_LENGTH = 32; private static final Sha256Identifier DUMMY = new Sha256Identifier(new byte[SHA256_LENGTH]); // only for using its hash method - private static final FileIdentifierFactory factory = Sha256Identifier::fromFile; + private static final FileIdentifierProvider factory = Sha256Identifier::fromFile; public static Sha256Identifier fromFile(File file) throws IOException { if (!Objects.requireNonNull(file).isFile()) { @@ -24,7 +24,7 @@ public class Sha256Identifier extends SingleHashIdentifier { return new Sha256Identifier(DUMMY.hash(file)); } - public static FileIdentifierFactory getFactory() { + public static FileIdentifierProvider getFactory() { return factory; } -- cgit v1.2.3