public class LazyBackupStore extends java.lang.Object implements IBackupStore
| Constructor and Description |
|---|
LazyBackupStore(java.lang.String prefix)
Creates a new lazy backup store
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
backup(java.io.File file)
Backup the file.
|
void |
backupAll(java.io.File file)
Backs up a file, or everything under a directory.
|
boolean |
backupCopy(java.io.File file)
Same as
IBackupStore.backup(File) except that a copy is kept in the original location. |
void |
backupCopyAll(java.io.File file)
Backs up a file, or everything under a directory.
|
boolean |
backupDirectory(java.io.File file)
Performs backup of an empty directory.
|
void |
discard()
Discards and closes this BackupStore.
|
java.lang.String |
getBackupName()
Returns the unique backup name (this is the name of generated backup directories).
|
void |
restore()
Restores all backup files from backup store.
|
public LazyBackupStore(java.lang.String prefix)
prefix - The prefix to use in constructing the backup store directorypublic boolean backup(java.io.File file)
throws java.io.IOException
IBackupStoreIBackupStore.backupDirectory(File).
A file (path) can only be backed up once per IBackupStore instance.
If a directory is first backed up, and later replaced by a regular file, and this file
is also backed up (or vice versa) - an IllegalArgumentException is thrown
A backup can not be performed on a closed IBackupStore.backup in interface IBackupStorefile - - the file (or directory) to backupjava.io.IOException - - if the backup operation fails, or the file does not existpublic boolean backupDirectory(java.io.File file)
throws java.io.IOException
IBackupStorebackupDirectory in interface IBackupStorefile - - the (empty) directory to back upjava.io.IOException - if directory can not be moved to the backup store, or if the directory is not writeablepublic void discard()
IBackupStorediscard in interface IBackupStorepublic void restore()
throws java.io.IOException
IBackupStorerestore in interface IBackupStorejava.io.IOException - if the backup was not fully restored - unrestored items should have been logged.public java.lang.String getBackupName()
IBackupStoregetBackupName in interface IBackupStorepublic boolean backupCopy(java.io.File file)
throws java.io.IOException
IBackupStoreIBackupStore.backup(File) except that a copy is kept in the original location.
Can not be used to copy directories.backupCopy in interface IBackupStorefile - to backup and copyjava.io.IOException - - if the backup operation fails, if the file does not exist, or if the copy can not be created.public void backupCopyAll(java.io.File file)
throws java.io.IOException
IBackupStorebackupCopyAll in interface IBackupStorejava.io.IOExceptionpublic void backupAll(java.io.File file)
throws java.io.IOException
IBackupStorebackupAll in interface IBackupStorefile - - file to backup or directoryjava.io.IOException - if backup operation failed