|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ch.braincell.stickbackup.process.BackupTask
public class BackupTask
Main class for backup tasks. This one starts the backup and processes it.
Field Summary | |
---|---|
protected java.io.File |
archivedDir
archive directory where the obsolete files of the destination goes. |
static java.lang.String |
archiveFileDir
all archiving files will be stored in a subdirectory "archive". |
protected java.util.AbstractList<java.io.File> |
archivingDestinationDirs
All deleted or moved directories. |
protected java.util.Set<java.io.File> |
archivingDestinationFiles
All deleted, moved or changed files from the backup directory which needs to be archived. |
static java.lang.String |
backupFileDir
all backuped files will be copied in the subdirectory "backup". |
protected int |
backupprogress
counts up in the progress of the backup. |
protected java.io.File |
destinationDir
destination directory where the backup of the source goes. |
protected int |
destinationDirLength
Length of the destination directory path (convenience for some methods) |
protected java.util.Map<java.lang.String,java.io.File> |
destinationDirList
directory list of the destination directory (all already backed up files). |
protected java.util.Map<java.lang.String,java.io.File> |
destinationFileList
Filelist of the destination directory (all already backed up files). |
protected ch.braincell.stickbackup.process.ProcessListenerObservant |
listener
|
protected java.util.AbstractList<java.io.File> |
newSourceDirs
All new directories from the source who needs to be backed up. |
protected java.util.Set<java.io.File> |
newSourceFiles
All new or changed files from the source who needs to be backed up. |
protected boolean |
processCanceled
is set to true if the backup process should be canceled. |
protected java.io.File |
sourceDir
Source directory which needs to be backed up. |
protected int |
sourceDirLength
Length of the source directory path (convenience for some methods) |
protected java.util.Map<java.lang.String,java.io.File> |
sourceDirList
directory list of the source directory to be backed up |
protected java.util.Map<java.lang.String,java.io.File> |
sourceFileList
Filelist of the source directory to be backed up |
Constructor Summary | |
---|---|
BackupTask()
|
Method Summary | |
---|---|
void |
addListener(ProcessListener listener)
|
protected void |
archiveDirectories(java.util.Date date)
Create all deleted / changed / moved Directories since the last backup in the archive directory. |
protected void |
archiveFiles(java.util.Date date)
Copy all deleted / changed / moved files since the last backup from the destination directory to the archive directory. |
protected void |
backupDirectories()
Create the new backup: create all new / moved directories from the source to the destination directory. |
protected void |
backupFiles()
Create the new backup: copy all new / moved / changed files from the source to the destination directory. |
protected void |
cleanupArchivedDirectories()
Deletes all archived Directories from the backup directory (destination directory). |
protected void |
cleanupArchivedFiles()
Deletes all archived files from the backup directory (destination directory). |
protected void |
copyFile(java.io.File source,
java.io.File destination)
Copies a file from the source to the destination. |
protected void |
findAllChangedAndNewFiles()
Compares the source directory with the destination directory and finds all changed and new files. |
protected void |
findAllNewSourceDirectories()
Compares the source directory with the destination directory and finds all new directories. |
protected void |
findAllRemovedSourceDirectories()
Compares the source directory with the destination directory and finds all removed directories. |
protected void |
findAllRemovedSourceFiles()
Compares the source directory with the destination directory and finds all deleted and moved files. |
int |
getBackupprogress()
Gets the actual progress index of the process. |
boolean |
isProcessCanceled()
test if the process is canceled by the user. |
protected void |
loadDestDir()
Loads all files from the destination directory (recursive) where the last backup is. |
protected void |
loadSourceDir()
Loads all Files from the source directory (recursive) which needs to be backed up. |
void |
processBackupAndArchive()
Processes archiving and backup of the files. |
int |
readFilesToBackupAndArchive()
Reads the files from the source and the destination. |
void |
setProcessCanceled(boolean processCanceled)
Sets the cancelation of the process. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String backupFileDir
public static final java.lang.String archiveFileDir
protected volatile int backupprogress
protected volatile boolean processCanceled
protected java.util.Map<java.lang.String,java.io.File> sourceFileList
protected java.util.Map<java.lang.String,java.io.File> sourceDirList
protected java.util.Map<java.lang.String,java.io.File> destinationFileList
protected java.util.Map<java.lang.String,java.io.File> destinationDirList
protected java.util.Set<java.io.File> newSourceFiles
protected java.util.AbstractList<java.io.File> newSourceDirs
protected java.util.Set<java.io.File> archivingDestinationFiles
protected java.util.AbstractList<java.io.File> archivingDestinationDirs
protected java.io.File sourceDir
protected java.io.File destinationDir
protected java.io.File archivedDir
protected int sourceDirLength
protected int destinationDirLength
protected ch.braincell.stickbackup.process.ProcessListenerObservant listener
Constructor Detail |
---|
public BackupTask()
Method Detail |
---|
public void addListener(ProcessListener listener)
public int readFilesToBackupAndArchive()
public void processBackupAndArchive()
protected void loadSourceDir()
protected void loadDestDir()
protected void findAllChangedAndNewFiles()
protected void findAllNewSourceDirectories()
protected void findAllRemovedSourceFiles()
protected void findAllRemovedSourceDirectories()
protected void archiveDirectories(java.util.Date date)
date
- the date to create the subdirectory in the archive.
java.io.IOException
protected void archiveFiles(java.util.Date date) throws java.io.IOException
date
- the date to create the subdirectory in the archive.
java.io.IOException
protected void cleanupArchivedFiles() throws java.io.IOException
java.io.IOException
protected void cleanupArchivedDirectories()
protected void backupDirectories()
protected void backupFiles() throws java.io.IOException
java.io.IOException
protected void copyFile(java.io.File source, java.io.File destination) throws java.io.IOException
source
- sourcefile. Will be opened readonly.destination
- destinationfile.
java.io.IOException
public boolean isProcessCanceled()
public void setProcessCanceled(boolean processCanceled)
public int getBackupprogress()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |