org.objectweb.cjdbc.controller.backup
Class PostgreSQLBinaryBackuper

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

public class PostgreSQLBinaryBackuper
extends AbstractPostgreSQLBackuper

This class defines a Backuper for PostgreSQL databases. This backuper creates dumps in a binary formatu, using the "--format=c" switch on pg_dump.

Supported URLs are jdbc:postgresql://host:port/dbname?param1=foo,param2=bar

Currently the Backuper only takes 1 parameter, the encoding of the database that is created upon restore. More options can be easily added. This class makes calls to the pg_dump, createdb, dropdb and pg_restore commands.

Version:
1.1
Author:
Dylan Hansen

Field Summary
(package private) static Trace logger
           
 
Fields inherited from class org.objectweb.cjdbc.controller.backup.AbstractPostgreSQLBackuper
optionsMap, optionsString
 
Constructor Summary
PostgreSQLBinaryBackuper()
          Creates a new PostgreSQLBinaryBackuper 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.
 java.lang.String getDumpFormat()
          Returns a String representing the format handled by this 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.
 
Methods inherited from class org.objectweb.cjdbc.controller.backup.AbstractPostgreSQLBackuper
deleteDump, fetchDump, getBackupManager, getDatabaseNameFromURL, getDumpPhysicalPath, getHostFromURL, getOptions, getPortFromURL, setOptions, setupServer
 
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

PostgreSQLBinaryBackuper

public PostgreSQLBinaryBackuper()
Creates a new PostgreSQLBinaryBackuper 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.

Returns:
the Backuper specific format
See Also:
Backuper.getDumpFormat()

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.

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.

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)


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