org.objectweb.cjdbc.controller.backup
Class BackupManager

java.lang.Object
  extended byorg.objectweb.cjdbc.controller.backup.BackupManager
All Implemented Interfaces:
XmlComponent

public class BackupManager
extends java.lang.Object
implements XmlComponent

This class defines a BackupManager

Version:
1.0
Author:
Nicolas Modrzyk

Field Summary
private  java.lang.String backupDir
           
private  boolean cleanBackupFiles
           
(package private) static Trace logger
           
private  int numberOfBackups
           
private  java.util.Hashtable threads
           
private  boolean zipBackupFiles
           
 
Fields inherited from interface org.objectweb.cjdbc.common.xml.XmlComponent
DOCTYPE_DB, XML_VERSION
 
Constructor Summary
BackupManager()
          Creates a new BackupManager object
BackupManager(java.lang.String backupDir, boolean cleanBackupFiles, boolean zipBackupFiles, int numberOfBackups)
          Creates a new BackupManager object
 
Method Summary
 void backup(DatabaseBackend backend, java.lang.String checkpoint, java.util.ArrayList tables, BackupListener listener)
          Create a backup from the content of a backend
 java.lang.String getBackupDir()
          Returns the backupDir value.
 int getNumberOfBackups()
          Returns the numberOfBackups value.
 void getResult(DatabaseBackend backend, long waitTime)
          Get the result of the backup/recovery process for the given backend
 java.lang.String getXml()
          Get xml formatted representation of this cjdbc component
 boolean isCleanBackupFiles()
          Returns the cleanBackupFiles value.
 boolean isZipBackupFiles()
          Returns the zipBackupFiles value.
 java.io.File[] listAvailableDumpFiles()
          List all the files this backup manager has access to.
 void restore(DatabaseBackend backend, java.lang.String checkpoint, java.util.ArrayList tables, BackupListener listener)
          Restore the content of a backup onto a specific backend
 void setBackupDir(java.lang.String backupDir)
          Sets the backupDir value.
 void setCleanBackupFiles(boolean cleanBackupFiles)
          Sets the cleanBackupFiles value.
 void setNumberOfBackups(int numberOfBackups)
          Sets the numberOfBackups value.
 void setZipBackupFiles(boolean zipBackupFiles)
          Sets the zipBackupFiles value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

static Trace logger

backupDir

private java.lang.String backupDir

cleanBackupFiles

private boolean cleanBackupFiles

zipBackupFiles

private boolean zipBackupFiles

numberOfBackups

private int numberOfBackups

threads

private java.util.Hashtable threads
Constructor Detail

BackupManager

public BackupManager(java.lang.String backupDir,
                     boolean cleanBackupFiles,
                     boolean zipBackupFiles,
                     int numberOfBackups)
Creates a new BackupManager object

Parameters:
backupDir - the directory used for backup
cleanBackupFiles - should we clean temp backup files
zipBackupFiles - should we zip backup files
numberOfBackups - number of backups before deleting others, not used

BackupManager

public BackupManager()
Creates a new BackupManager object

Method Detail

backup

public void backup(DatabaseBackend backend,
                   java.lang.String checkpoint,
                   java.util.ArrayList tables,
                   BackupListener listener)
            throws BackupException
Create a backup from the content of a backend

Parameters:
backend - the target backend to backup from
checkpoint - the checkpoint name of the backup to create
tables - the list of tables to consider for backup
listener - handback object to notify
Throws:
BackupException - if backup fails for unknown reasons

getResult

public void getResult(DatabaseBackend backend,
                      long waitTime)
               throws BackupException,
                      OctopusException
Get the result of the backup/recovery process for the given backend

Parameters:
backend - the backend we started a backup recovery process on
waitTime - the time to wait to join the octopus thread
Throws:
BackupException - if backup fails for unknown reasons
OctopusException - if backup fails because of Octopus

restore

public void restore(DatabaseBackend backend,
                    java.lang.String checkpoint,
                    java.util.ArrayList tables,
                    BackupListener listener)
             throws BackupException
Restore the content of a backup onto a specific backend

Parameters:
backend - the target backend to restore to
checkpoint - the checkpoint name of the backup to restore
tables - the list of tables to consider for restore
listener - handback object to notify
Throws:
BackupException - if backup fails for unknown reasons

listAvailableDumpFiles

public java.io.File[] listAvailableDumpFiles()
List all the files this backup manager has access to.

Returns:
a File[] object that can be empty, but cannot be null

getBackupDir

public java.lang.String getBackupDir()
Returns the backupDir value.

Returns:
Returns the backupDir.

setBackupDir

public void setBackupDir(java.lang.String backupDir)
Sets the backupDir value.

Parameters:
backupDir - The backupDir to set.

isCleanBackupFiles

public boolean isCleanBackupFiles()
Returns the cleanBackupFiles value.

Returns:
Returns the cleanBackupFiles.

setCleanBackupFiles

public void setCleanBackupFiles(boolean cleanBackupFiles)
Sets the cleanBackupFiles value.

Parameters:
cleanBackupFiles - The cleanBackupFiles to set.

getNumberOfBackups

public int getNumberOfBackups()
Returns the numberOfBackups value.

Returns:
Returns the numberOfBackups.

setNumberOfBackups

public void setNumberOfBackups(int numberOfBackups)
Sets the numberOfBackups value.

Parameters:
numberOfBackups - The numberOfBackups to set.

isZipBackupFiles

public boolean isZipBackupFiles()
Returns the zipBackupFiles value.

Returns:
Returns the zipBackupFiles.

setZipBackupFiles

public void setZipBackupFiles(boolean zipBackupFiles)
Sets the zipBackupFiles value.

Parameters:
zipBackupFiles - The zipBackupFiles to set.

getXml

public java.lang.String getXml()
Description copied from interface: XmlComponent
Get xml formatted representation of this cjdbc component

Specified by:
getXml in interface XmlComponent
Returns:
xml formatted fragment
See Also:
XmlComponent.getXml()


Copyright © 2002, 2005 - ObjectWeb Consortium - All Rights Reserved.