summaryrefslogtreecommitdiff
path: root/src/main/java/com/keuin/kbackupfabric/metadata
diff options
context:
space:
mode:
authorKeuin <[email protected]>2020-04-24 13:43:20 +0800
committerkeuin <[email protected]>2020-04-24 13:43:20 +0800
commitea01faf3947814fe7ecaa3705e5fbf0f171f7e48 (patch)
tree1cb406b0d0897da70414aa5f96e8b1dd1eac40fb /src/main/java/com/keuin/kbackupfabric/metadata
parent59674ed29c6b2c7e8ac98fc4f0f4fd4fd6d437c9 (diff)
Added hint at the "/kb" output in the first run after restoring from a backup.1.3.0-dev
Warning: Backup in this version is not compatible with older version!
Diffstat (limited to 'src/main/java/com/keuin/kbackupfabric/metadata')
-rw-r--r--src/main/java/com/keuin/kbackupfabric/metadata/BackupMetadata.java26
-rw-r--r--src/main/java/com/keuin/kbackupfabric/metadata/MetadataHolder.java22
2 files changed, 48 insertions, 0 deletions
diff --git a/src/main/java/com/keuin/kbackupfabric/metadata/BackupMetadata.java b/src/main/java/com/keuin/kbackupfabric/metadata/BackupMetadata.java
new file mode 100644
index 0000000..b8cb852
--- /dev/null
+++ b/src/main/java/com/keuin/kbackupfabric/metadata/BackupMetadata.java
@@ -0,0 +1,26 @@
+package com.keuin.kbackupfabric.metadata;
+
+import java.io.Serializable;
+
+/**
+ * WARNING: DO NOT modify this class, or the plugin will be incompatible with backups created by older versions.
+ */
+public class BackupMetadata implements Serializable {
+ public static final String metadataFileName = "kbackup_metadata";
+ private static final long serialVersionUID = 1L;
+ private final long BackupTime;
+ private final String backupName;
+
+ public BackupMetadata(long backupTime, String backupName) {
+ BackupTime = backupTime;
+ this.backupName = backupName;
+ }
+
+ public long getBackupTime() {
+ return BackupTime;
+ }
+
+ public String getBackupName() {
+ return backupName;
+ }
+}
diff --git a/src/main/java/com/keuin/kbackupfabric/metadata/MetadataHolder.java b/src/main/java/com/keuin/kbackupfabric/metadata/MetadataHolder.java
new file mode 100644
index 0000000..4180a19
--- /dev/null
+++ b/src/main/java/com/keuin/kbackupfabric/metadata/MetadataHolder.java
@@ -0,0 +1,22 @@
+package com.keuin.kbackupfabric.metadata;
+
+/**
+ * In the first startup after restoring from a previous backup, the metadata is stored in this class.
+ * The setMetadata can only be called when startup
+ */
+public class MetadataHolder {
+ private static BackupMetadata metadata = null;
+
+ public static BackupMetadata getMetadata() {
+ return metadata;
+ }
+
+ public static void setMetadata(BackupMetadata metadata) {
+ if (MetadataHolder.metadata == null)
+ MetadataHolder.metadata = metadata;
+ }
+
+ public static boolean hasMetadata() {
+ return MetadataHolder.metadata != null;
+ }
+}