org.firebirdsql.management
Class FBBackupManager

java.lang.Object
  extended by org.firebirdsql.management.FBServiceManager
      extended by org.firebirdsql.management.FBBackupManager
All Implemented Interfaces:
BackupManager, ServiceManager

public class FBBackupManager
extends FBServiceManager
implements BackupManager

Implements the backup and restore functionality of Firebird Services API.

Author:
Roman Rokytskyy

Field Summary
 
Fields inherited from class org.firebirdsql.management.FBServiceManager
BUFFER_SIZE
 
Fields inherited from interface org.firebirdsql.management.BackupManager
BACKUP_CONVERT, BACKUP_EXPAND, BACKUP_IGNORE_CHECKSUMS, BACKUP_IGNORE_LIMBO, BACKUP_METADATA_ONLY, BACKUP_NO_GARBAGE_COLLECT, BACKUP_NON_TRANSPORTABLE, BACKUP_OLD_DESCRIPTIONS, RESTORE_DEACTIVATE_INDEX, RESTORE_NO_SHADOW, RESTORE_NO_VALIDITY, RESTORE_ONE_AT_A_TIME, RESTORE_USE_ALL_SPACE
 
Constructor Summary
FBBackupManager()
          Create a new instance of FBBackupManager based on the default GDSType.
FBBackupManager(org.firebirdsql.gds.impl.GDSType gdsType)
          Create a new instance of FBBackupManager based on a given GDSType.
FBBackupManager(java.lang.String gdsType)
          Create a new instance of FBBackupManager based on a given GDSType.
 
Method Summary
 void addBackupPath(java.lang.String path)
          Add backup file to the list.
 void addBackupPath(java.lang.String path, int size)
          Add the file to the backup of the specified size.
 void addRestorePath(java.lang.String path, int size)
          Add the file to the multi-file database of the specified size for restore operation.
 void backupDatabase()
          Perform the backup operation.
 void backupDatabase(int options)
          Perform the backup operation.
 void backupMetadata()
          Perform the backup operation, metadata only.
 void clearBackupPaths()
          Clear the information about backup paths.
 void clearRestorePaths()
          Clear the information about restore paths.
 void restoreDatabase()
          Perform the restore operation.
 void restoreDatabase(int options)
          Perform the restore operation.
 void setBackupPath(java.lang.String backupPath)
          Sets the location of the backup file.
 void setDatabase(java.lang.String database)
          Sets the database path for the connection to the service manager.
 void setRestorePageBufferCount(int bufferCount)
          Set the default number of pages to be buffered (cached) by default in a restored database.
 void setRestorePageSize(int pageSize)
          Set the page size that will be used for a restored database.
 void setRestoreReadOnly(boolean readOnly)
          Set the read-only attribute on a restored database.
 void setRestoreReplace(boolean replace)
          Set the restore operation to create a new database, as opposed to overwriting an existing database.
 void setVerbose(boolean verbose)
          Set whether the operations of this BackupManager will result in verbose logging to the configured logger.
 
Methods inherited from class org.firebirdsql.management.FBServiceManager
attachServiceManager, createRequestBuffer, detachServiceManager, executeServicesOperation, getDatabase, getGds, getHost, getLogger, getPassword, getPort, getServiceName, getUser, queueService, setHost, setLogger, setPassword, setPort, setUser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.firebirdsql.management.ServiceManager
getDatabase, getHost, getLogger, getPassword, getPort, getUser, setHost, setLogger, setPassword, setPort, setUser
 

Constructor Detail

FBBackupManager

public FBBackupManager()
Create a new instance of FBBackupManager based on the default GDSType.


FBBackupManager

public FBBackupManager(java.lang.String gdsType)
Create a new instance of FBBackupManager based on a given GDSType.

Parameters:
gdsType - type must be PURE_JAVA, EMBEDDED, or NATIVE

FBBackupManager

public FBBackupManager(org.firebirdsql.gds.impl.GDSType gdsType)
Create a new instance of FBBackupManager based on a given GDSType.

Parameters:
gdsType - type must be PURE_JAVA, EMBEDDED, or NATIVE
Method Detail

setBackupPath

public void setBackupPath(java.lang.String backupPath)
Description copied from interface: BackupManager
Sets the location of the backup file. This method is used to set the path to the backup consisting of a single file. It is not possible to add multiple files or specify the max. size of the file using this method. It is also not possible to call BackupManager.addBackupPath(String, int) method after calling this one.

Specified by:
setBackupPath in interface BackupManager
Parameters:
backupPath - the location of the backup file.
See Also:
BackupManager.setBackupPath(java.lang.String)

addBackupPath

public void addBackupPath(java.lang.String path)
Description copied from interface: BackupManager
Add backup file to the list. This method is used only during restoring the database to specify multi-file backups. The call is equivalent to passing the size -1 to BackupManager.addBackupPath(String, int) call.

If application invokes backup operation, an error is generated in that call.

Specified by:
addBackupPath in interface BackupManager
Parameters:
path - path to the backup file.

addBackupPath

public void addBackupPath(java.lang.String path,
                          int size)
Description copied from interface: BackupManager
Add the file to the backup of the specified size. Firebird allows splitting the backup into multiple files, limiting the size of the backup file. This can be useful for example for creating a backup on CD or DVD.

Specified by:
addBackupPath in interface BackupManager
Parameters:
path - path to the backup file.
size - max size of the file in bytes.

clearBackupPaths

public void clearBackupPaths()
Description copied from interface: BackupManager
Clear the information about backup paths. This method undoes all parameters set in the BackupManager.addBackupPath(String, int) or BackupManager.addBackupPath(String) methods.

Specified by:
clearBackupPaths in interface BackupManager

setDatabase

public void setDatabase(java.lang.String database)
Description copied from interface: ServiceManager
Sets the database path for the connection to the service manager.

Specified by:
setDatabase in interface BackupManager
Specified by:
setDatabase in interface ServiceManager
Overrides:
setDatabase in class FBServiceManager
Parameters:
database - path for the connection to the service manager.

addRestorePath

public void addRestorePath(java.lang.String path,
                           int size)
Description copied from interface: BackupManager
Add the file to the multi-file database of the specified size for restore operation.

Specified by:
addRestorePath in interface BackupManager
Parameters:
path - path to the backup file.
size - max size of the database file in pages.

clearRestorePaths

public void clearRestorePaths()
Description copied from interface: BackupManager
Clear the information about restore paths. This method undoes all parameters set in the BackupManager.addRestorePath(String, int) or BackupManager.setDatabase(String) methods.

Specified by:
clearRestorePaths in interface BackupManager

backupDatabase

public void backupDatabase()
                    throws java.sql.SQLException
Description copied from interface: BackupManager
Perform the backup operation.

Specified by:
backupDatabase in interface BackupManager
Throws:
java.sql.SQLException - if a database error occurs during the backup
See Also:
BackupManager.backupDatabase()

backupMetadata

public void backupMetadata()
                    throws java.sql.SQLException
Description copied from interface: BackupManager
Perform the backup operation, metadata only.

Specified by:
backupMetadata in interface BackupManager
Throws:
java.sql.SQLException - if a database error occurs during the backup
See Also:
BackupManager.backupMetadata()

backupDatabase

public void backupDatabase(int options)
                    throws java.sql.SQLException
Description copied from interface: BackupManager
Perform the backup operation.

Specified by:
backupDatabase in interface BackupManager
Parameters:
options - a bitmask combination of the BACKUP_* static final fields for the backup operation
Throws:
java.sql.SQLException - if a database error occurs during the backup
See Also:
BackupManager.backupDatabase(int)

restoreDatabase

public void restoreDatabase()
                     throws java.sql.SQLException
Description copied from interface: BackupManager
Perform the restore operation.

Specified by:
restoreDatabase in interface BackupManager
Throws:
java.sql.SQLException - if a database error occurs during the restore
See Also:
BackupManager.restoreDatabase()

restoreDatabase

public void restoreDatabase(int options)
                     throws java.sql.SQLException
Description copied from interface: BackupManager
Perform the restore operation.

Specified by:
restoreDatabase in interface BackupManager
Parameters:
options - A bitmask combination of RESTORE_* static final fields
Throws:
java.sql.SQLException - if a database error occurs during the restore
See Also:
BackupManager.restoreDatabase(int)

setVerbose

public void setVerbose(boolean verbose)
Set whether the operations of this BackupManager will result in verbose logging to the configured logger.

Specified by:
setVerbose in interface BackupManager
Parameters:
verbose - If true, operations will be logged verbosely, otherwise they will not be logged verbosely

setRestorePageBufferCount

public void setRestorePageBufferCount(int bufferCount)
Set the default number of pages to be buffered (cached) by default in a restored database.

Specified by:
setRestorePageBufferCount in interface BackupManager
Parameters:
bufferCount - The page-buffer size to be used, a positive value

setRestorePageSize

public void setRestorePageSize(int pageSize)
Set the page size that will be used for a restored database. The value for pageSize must be one of: 1024, 2048, 4096, 8192 or 16384. The default value depends on the Firebird version.

Specified by:
setRestorePageSize in interface BackupManager
Parameters:
pageSize - The page size to be used in a restored database, one of 1024, 2048, 4196, 8192 or 16384

setRestoreReplace

public void setRestoreReplace(boolean replace)
Set the restore operation to create a new database, as opposed to overwriting an existing database. This is true by default.

Specified by:
setRestoreReplace in interface BackupManager
Parameters:
replace - If true, the restore operation will attempt to create a new database, otherwise the restore operation will overwrite an existing database

setRestoreReadOnly

public void setRestoreReadOnly(boolean readOnly)
Set the read-only attribute on a restored database.

Specified by:
setRestoreReadOnly in interface BackupManager
Parameters:
readOnly - If true, a restored database will be read-only, otherwise it will be read-write.


Copyright © 2001-2019 Jaybird (Firebird JDBC/JCA) team. All rights reserved.