org.ibisph.resource
Interface FileBackupFactory

All Known Implementing Classes:
VersionedFileBackupFactory

public interface FileBackupFactory

File Backup Factory signatures needed for all file backup factory implementors.

Author:
Garth Braithwaite, STG

Field Summary
static int BACKUP_TYPE_COPY
          Causes the backup operation to create a copy of the source file to the backup file.
static int BACKUP_TYPE_RENAME
          Causes the backup operation to rename the source file to backup file.
 
Method Summary
 FileBackup newFileBackup(java.io.File sourceFile)
          Factory method that creates the backup file object base on the source file.
 FileBackup newFileBackup(java.lang.String sourcePathAndFilename)
          Factory method that creates the backup file object based on the path and filename passed.
 void setAutoDeleteBackupWhenDone(boolean deleteBackupWhenDone)
          Controls auto deletion of the backup file after this object is not used.
 void setBackupType(int backupType)
          Controls the backup type.
 

Field Detail

BACKUP_TYPE_RENAME

static final int BACKUP_TYPE_RENAME
Causes the backup operation to rename the source file to backup file.

See Also:
Constant Field Values

BACKUP_TYPE_COPY

static final int BACKUP_TYPE_COPY
Causes the backup operation to create a copy of the source file to the backup file.

See Also:
Constant Field Values
Method Detail

setBackupType

void setBackupType(int backupType)
Controls the backup type.

Parameters:
backupType - Specifies the type of backup to be perfomed. The value of BACKUP_TYPE_RENAME will cause the backup to rename the source file as the backup file with a new name. Backup type of BACKUP_TYPE_COPY causes the backup method to create a new copy of the source file and name it the backup name.

setAutoDeleteBackupWhenDone

void setAutoDeleteBackupWhenDone(boolean deleteBackupWhenDone)
Controls auto deletion of the backup file after this object is not used. When this backup object going to be garbage collected it's finalize method is called. The finalize method uses this property to control deletion of the backup file.

Parameters:
deleteBackupWhenDone - True then file is deleted when object is no longer being referenced. False, the default value if not set, the backup file is not deleted except if explicitly called.

newFileBackup

FileBackup newFileBackup(java.lang.String sourcePathAndFilename)
                         throws java.io.IOException
Factory method that creates the backup file object based on the path and filename passed.

Parameters:
sourcePathAndFilename - Path and filename of the source file to be backed up.
Returns:
New FileBackup object with the source being backed up at the time of object creation.
Throws:
java.io.IOException - Related to the file operation.

newFileBackup

FileBackup newFileBackup(java.io.File sourceFile)
                         throws java.io.IOException
Factory method that creates the backup file object base on the source file.

Parameters:
sourceFile - Source file to be backed up.
Returns:
New FileBackup object with the source being backed up at the time of object creation.
Throws:
java.io.IOException - Related to the file operation.