com.continuent.tungsten.replicator.backup.postgresql
Class PostgreSqlDumpAgent

java.lang.Object
  extended by com.continuent.tungsten.replicator.backup.AbstractBackupAgent
      extended by com.continuent.tungsten.replicator.backup.postgresql.PostgreSqlDumpAgent
All Implemented Interfaces:
BackupAgent, BackupPlugin

public class PostgreSqlDumpAgent
extends AbstractBackupAgent

Implements a backup agent that works using pg_dump to dump data and pg_restore to restore.

Version:
1.0
Author:
Stephane Giron

Field Summary
 
Fields inherited from class com.continuent.tungsten.replicator.backup.AbstractBackupAgent
capabilities, logger, processHelper, restoreCompleted
 
Constructor Summary
PostgreSqlDumpAgent()
          Creates a new PostgreSqlDumpAgent object
 
Method Summary
 BackupSpecification backup()
          Back up the database.
 void configure()
          Complete plug-in configuration.
 void release()
          Release all resources used by plug-in.
protected  void restoreOneLocator(BackupLocator locator)
          restoreOneLocator is used to restore a database using one locator.
 void setDatabaseToConnect(java.lang.String databaseToConnect)
          Sets the database to be used while connecting.
 void setDriver(java.lang.String driver)
          Set the PostgreSQL JDBC driver name.
 void setDumpDir(java.lang.String dumpDirName)
          Sets the directory name where dumps should be stored.
 void setHost(java.lang.String host)
          Sets the host to be used while backuping / restoring to the given value.
 void setHotBackupEnabled(boolean hotBackupEnabled)
          If true, hot backup is enabled.
 void setIgnoreDatabaseList(java.lang.String ignoreDatabaseList)
          Sets the list of databases that should not be dumped by a backup operation.
 void setPassword(java.lang.String password)
          Sets the password to be used while connecting to the database.
 void setPgdumpOptions(java.lang.String pgdumpOptions)
          Sets options to use for pg_dump.
 void setPgrestoreOptions(java.lang.String pgrestoreOptions)
          Sets options to provide pg_restore utility.
 void setPort(int port)
          Sets the port to be used while connecting to the database.
 void setUrl(java.lang.String url)
          Sets the URL used to connect to the PostgreSQL instance.
 void setUser(java.lang.String user)
          Sets the user to be used while connecting to the database.
 
Methods inherited from class com.continuent.tungsten.replicator.backup.AbstractBackupAgent
capabilities, completeRestore, initRestore, restore
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PostgreSqlDumpAgent

public PostgreSqlDumpAgent()
Creates a new PostgreSqlDumpAgent object

Method Detail

setHost

public void setHost(java.lang.String host)
Sets the host to be used while backuping / restoring to the given value.

Parameters:
host - the host name or ip to be used

setPort

public void setPort(int port)
Sets the port to be used while connecting to the database.

Parameters:
port - the port number

setUser

public void setUser(java.lang.String user)
Sets the user to be used while connecting to the database.

Parameters:
user - user name to be used while connecting to the database

setPassword

public void setPassword(java.lang.String password)
Sets the password to be used while connecting to the database.

Parameters:
password - the password to be used

setDumpDir

public void setDumpDir(java.lang.String dumpDirName)
Sets the directory name where dumps should be stored.

Parameters:
dumpDirName - a path to the directory

setIgnoreDatabaseList

public void setIgnoreDatabaseList(java.lang.String ignoreDatabaseList)
Sets the list of databases that should not be dumped by a backup operation.

Parameters:
ignoreDatabaseList - Space separated list of databases that will be ignored

setDatabaseToConnect

public void setDatabaseToConnect(java.lang.String databaseToConnect)
Sets the database to be used while connecting. This database will then be used to get the list of all databases hosted on this database backend.

Parameters:
databaseToConnect - the database name

setPgdumpOptions

public void setPgdumpOptions(java.lang.String pgdumpOptions)
Sets options to use for pg_dump.


setPgrestoreOptions

public void setPgrestoreOptions(java.lang.String pgrestoreOptions)
Sets options to provide pg_restore utility.


setHotBackupEnabled

public void setHotBackupEnabled(boolean hotBackupEnabled)
If true, hot backup is enabled.


setUrl

public void setUrl(java.lang.String url)
Sets the URL used to connect to the PostgreSQL instance. If unset, this value is generated automatically.


setDriver

public void setDriver(java.lang.String driver)
Set the PostgreSQL JDBC driver name. If unset this defaults to the usual PostgreSQL driver.


backup

public BackupSpecification backup()
                           throws BackupException
Back up the database.

Specified by:
backup in interface BackupAgent
Specified by:
backup in class AbstractBackupAgent
Throws:
BackupException
See Also:
AbstractBackupAgent.backup()

restoreOneLocator

protected void restoreOneLocator(BackupLocator locator)
                          throws BackupException,
                                 java.io.FileNotFoundException
restoreOneLocator is used to restore a database using one locator.

Specified by:
restoreOneLocator in class AbstractBackupAgent
Parameters:
locator - the locator to be used to restore the database
Throws:
BackupException - if something happens while restoring
java.io.FileNotFoundException - if the dump file cannot be found
See Also:
AbstractBackupAgent.restoreOneLocator(com.continuent.tungsten.replicator.backup.BackupLocator)

configure

public void configure()
               throws BackupException
Complete plug-in configuration. This is called after setters are invoked.

Specified by:
configure in interface BackupPlugin
Overrides:
configure in class AbstractBackupAgent
Throws:
BackupException
See Also:
BackupPlugin.configure()

release

public void release()
             throws BackupException
Release all resources used by plug-in. This is called before the plug-in is deallocated.

Specified by:
release in interface BackupPlugin
Specified by:
release in class AbstractBackupAgent
Throws:
BackupException
See Also:
BackupPlugin.release()