net.sf.farrago.syslib
Class FarragoBackupRestoreUtil

java.lang.Object
  extended by net.sf.farrago.syslib.FarragoBackupRestoreUtil

public abstract class FarragoBackupRestoreUtil
extends Object

FarragoBackupRestoreUtil contains utility methods used by backup and restore.

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/syslib/FarragoBackupRestoreUtil.java#5 $
Author:
Zelaine Fong

Field Summary
private static String CATALOG_BACKUP_FILENAME
           
 
Constructor Summary
FarragoBackupRestoreUtil()
           
 
Method Summary
private static void checkBackupFile(String archiveDirectory, String filename, boolean isBackup)
           
static void checkBackupFiles(String archiveDirectory, boolean isCompressed, boolean isBackup)
          Verifies the existence or non-existence of files in the archive directory.
static FarragoBackupType getBackupType(String backupType)
          Translates a string representing a backup type (full, incremental, or differential) into a symbolic value.
static File getCatalogBackupFile(String archiveDir, boolean isCompressed)
          Returns the catalog backup file name relative to the given archive directory.
static boolean isCompressed(String compressionMode)
          Validates a string representing the compression mode of a backup.
static String validateArchiveDirectory(String directory, boolean isBackup)
          Validates the archive directory, expanding property names within the name, as needed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CATALOG_BACKUP_FILENAME

private static final String CATALOG_BACKUP_FILENAME
See Also:
Constant Field Values
Constructor Detail

FarragoBackupRestoreUtil

public FarragoBackupRestoreUtil()
Method Detail

validateArchiveDirectory

public static String validateArchiveDirectory(String directory,
                                              boolean isBackup)
Validates the archive directory, expanding property names within the name, as needed.

Parameters:
directory - the full pathname of the archive directory
isBackup - true if this is a backup, as opposed to a restore
Returns:
the archive directory name with properties expanded

getBackupType

public static FarragoBackupType getBackupType(String backupType)
Translates a string representing a backup type (full, incremental, or differential) into a symbolic value. Throws an exception if an invalid type is passed in.

Parameters:
backupType - string value of the backup type
Returns:
the symbolic value of the backup type

checkBackupFiles

public static void checkBackupFiles(String archiveDirectory,
                                    boolean isCompressed,
                                    boolean isBackup)
                             throws Exception
Verifies the existence or non-existence of files in the archive directory.

Parameters:
archiveDirectory - the name of the archive directory
isCompressed - whether the backup is compressed
isBackup - true if the files are going to be used for a backup, as opposed to a restore
Throws:
Exception

checkBackupFile

private static void checkBackupFile(String archiveDirectory,
                                    String filename,
                                    boolean isBackup)
                             throws Exception
Throws:
Exception

isCompressed

public static boolean isCompressed(String compressionMode)
Validates a string representing the compression mode of a backup. Throws an exception for an invalid mode.

Parameters:
compressionMode - string value indicating the compression mode
Returns:
true if the string indicates compression

getCatalogBackupFile

public static File getCatalogBackupFile(String archiveDir,
                                        boolean isCompressed)
Returns the catalog backup file name relative to the given archive directory.

Parameters:
archiveDir - archive directory
isCompressed - whether compression is enabled