org.objectweb.cjdbc.controller.backup
Class DerbyEmbeddedBackuper

java.lang.Object
  extended byorg.objectweb.cjdbc.controller.backup.DerbyEmbeddedBackuper
All Implemented Interfaces:
Backuper

public class DerbyEmbeddedBackuper
extends java.lang.Object
implements Backuper

This class defines a Backuper for Apache Derby databases.

Supported URLs are jdbc:derby:PathToDerbyDatabase[;options]

The Backuper itself does not take any option. It simply dumps the Derby directory into a zip file.

Version:
1.0
Author:
Emmanuel Cecchet

Field Summary
(package private) static Trace logger
           
 
Constructor Summary
DerbyEmbeddedBackuper()
          Creates a new DerbyEmbeddedBackuper object
 
Method Summary
 java.util.Date backup(DatabaseBackend backend, java.lang.String login, java.lang.String password, java.lang.String dumpName, java.lang.String path, java.util.ArrayList tables)
          Create a backup from the content of a backend.
 void deleteDump(java.lang.String path, java.lang.String dumpName)
          Delete the specified dump.
 void fetchDump(DumpTransferInfo dumpTransferInfo, java.lang.String path, java.lang.String dumpName)
          Client side: Fetch a remote dump from specified dump server.
 BackupManager getBackupManager()
          Return the BackupManager this Backuper belongs to.
private  java.lang.String getDerbyPath(DatabaseBackend backend, boolean checkPath)
          Extract the path where the Derby database is stored by parsing the backend JDBC URL.
 java.lang.String getDumpFormat()
          Returns a String representing the format handled by this Backuper.
private  java.lang.String getDumpPhysicalPath(java.lang.String path, java.lang.String dumpName)
          Get the dump physical path from its logical name
 java.lang.String getOptions()
          Retrieve the backuper options that were used to initialize the backuper.
 void restore(DatabaseBackend backend, java.lang.String login, java.lang.String password, java.lang.String dumpName, java.lang.String path, java.util.ArrayList tables)
          Restore a dump on a specific backend.
 void setOptions(java.lang.String options)
          Options that can be set at backuper initialization.
 DumpTransferInfo setupServer()
          Server side: setup a server and returns a DumpTransferInfo suitable for authenticated communication by a client using fetchDump().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

static Trace logger
Constructor Detail

DerbyEmbeddedBackuper

public DerbyEmbeddedBackuper()
Creates a new DerbyEmbeddedBackuper object

Method Detail

getDumpFormat

public java.lang.String getDumpFormat()
Description copied from interface: Backuper
Returns a String representing the format handled by this Backuper. This field should be human readable and as detailed as possible so that no confusion can be made by the administrator.

Specified by:
getDumpFormat in interface Backuper
Returns:
the Backuper specific format
See Also:
Backuper.getDumpFormat()

getOptions

public java.lang.String getOptions()
Description copied from interface: Backuper
Retrieve the backuper options that were used to initialize the backuper.

Specified by:
getOptions in interface Backuper
Returns:
the backuper options
See Also:
Backuper.getOptions()

setOptions

public void setOptions(java.lang.String options)
Description copied from interface: Backuper
Options that can be set at backuper initialization. These options are provided in the definition of the Backuper element (see dtd).

Specified by:
setOptions in interface Backuper
Parameters:
options - Backuper specific options
See Also:
Backuper.setOptions(java.lang.String)

backup

public java.util.Date backup(DatabaseBackend backend,
                             java.lang.String login,
                             java.lang.String password,
                             java.lang.String dumpName,
                             java.lang.String path,
                             java.util.ArrayList tables)
                      throws BackupException
Description copied from interface: Backuper
Create a backup from the content of a backend.

Specified by:
backup in interface Backuper
Parameters:
backend - the target backend to backup
login - the login to use to connect to the database for the backup operation
password - the password to use to connect to the database for the backup operation
dumpName - the name of the dump to create
path - the path where to store the dump
tables - the list of tables to backup, null means all tables
Returns:
the timestamp for the dump if the backup was sucessful, null otherwise
Throws:
BackupException - if the backup operation fails
See Also:
Backuper.backup(org.objectweb.cjdbc.controller.backend.DatabaseBackend, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.util.ArrayList)

restore

public void restore(DatabaseBackend backend,
                    java.lang.String login,
                    java.lang.String password,
                    java.lang.String dumpName,
                    java.lang.String path,
                    java.util.ArrayList tables)
             throws BackupException
Description copied from interface: Backuper
Restore a dump on a specific backend.

Specified by:
restore in interface Backuper
Parameters:
backend - the target backend to restore to
login - the login to use to connect to the database for the restore operation
password - the password to use to connect to the database for the restore operation
dumpName - the name of the dump to restore
path - the path where to retrieve the dump
tables - the list of tables to restore, null means all tables
Throws:
BackupException - if the restore operation failed
See Also:
Backuper.restore(org.objectweb.cjdbc.controller.backend.DatabaseBackend, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.util.ArrayList)

deleteDump

public void deleteDump(java.lang.String path,
                       java.lang.String dumpName)
                throws BackupException
Description copied from interface: Backuper
Delete the specified dump.

Specified by:
deleteDump in interface Backuper
Parameters:
path - the path where to retrieve the dump
dumpName - the dump to delete
Throws:
BackupException - if we failed to delete the dump
See Also:
Backuper.deleteDump(java.lang.String, java.lang.String)

getDumpPhysicalPath

private java.lang.String getDumpPhysicalPath(java.lang.String path,
                                             java.lang.String dumpName)
Get the dump physical path from its logical name

Parameters:
path - the path where the dump is stored
dumpName - dump logical name
Returns:
path to zip file

getDerbyPath

private java.lang.String getDerbyPath(DatabaseBackend backend,
                                      boolean checkPath)
                               throws BackupException
Extract the path where the Derby database is stored by parsing the backend JDBC URL.

Parameters:
backend - the Derby backend
checkPath - if true we check if the path is a valid directory
Returns:
path to the Derby database
Throws:
BackupException - if the URL is not valid or the path not valid

fetchDump

public void fetchDump(DumpTransferInfo dumpTransferInfo,
                      java.lang.String path,
                      java.lang.String dumpName)
               throws BackupException
Description copied from interface: Backuper
Client side: Fetch a remote dump from specified dump server.

Specified by:
fetchDump in interface Backuper
Parameters:
dumpTransferInfo - the address and session key of the dump server to contact for fetching.
path - the path part of the remote dump spec (interpreted by server)
dumpName - the name part of the remote dump spec (interpreted by server)
Throws:
BackupException - in any error case: authentication error, transfer error, else.
See Also:
Backuper.fetchDump(org.objectweb.cjdbc.controller.backup.DumpTransferInfo, java.lang.String, java.lang.String)

setupServer

public DumpTransferInfo setupServer()
Description copied from interface: Backuper
Server side: setup a server and returns a DumpTransferInfo suitable for authenticated communication by a client using fetchDump().

Specified by:
setupServer in interface Backuper
Returns:
a DumpTransferInfo to be used by a client for authenticated communication upon fetchDump invocation.
See Also:
Backuper.setupServer()

getBackupManager

public BackupManager getBackupManager()
Description copied from interface: Backuper
Return the BackupManager this Backuper belongs to.

Specified by:
getBackupManager in interface Backuper
Returns:
the BackupManager this Backuper belongs to.
See Also:
Backuper.getBackupManager()


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