Class FBBackupManagerBase

java.lang.Object
org.firebirdsql.management.FBServiceManager
org.firebirdsql.management.FBBackupManagerBase
All Implemented Interfaces:
AttachmentProperties, BaseProperties, ServiceConnectionProperties, BackupManager, ServiceManager
Direct Known Subclasses:
FBBackupManager, FBStreamingBackupManager

public abstract class FBBackupManagerBase extends FBServiceManager implements BackupManager
Implements the common functionality between regular and streaming backup/restore
Author:
Roman Rokytskyy, Mark Rotteveel
  • Field Details

  • Constructor Details

    • FBBackupManagerBase

      protected FBBackupManagerBase()
      Create a new instance of FBBackupManagerBase based on the default GDSType.
    • FBBackupManagerBase

      protected FBBackupManagerBase(String gdsType)
      Create a new instance of FBBackupManagerBase based on a given GDSType.
      Parameters:
      gdsType - type must be PURE_JAVA, EMBEDDED, or NATIVE
    • FBBackupManagerBase

      protected FBBackupManagerBase(GDSType gdsType)
      Create a new instance of FBBackupManagerBase based on a given GDSType.
      Parameters:
      gdsType - type must be PURE_JAVA, EMBEDDED, or NATIVE
  • Method Details

    • addBackupPath

      public void addBackupPath(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.
    • setDatabase

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

      Will also set the expectedDb property. If a different value must be used, it must be set after calling this method.

      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(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 SQLException
      Description copied from interface: BackupManager
      Perform the backup operation.
      Specified by:
      backupDatabase in interface BackupManager
      Throws:
      SQLException - if a database error occurs during the backup
    • backupMetadata

      public void backupMetadata() throws SQLException
      Description copied from interface: BackupManager
      Perform the backup operation, metadata only.
      Specified by:
      backupMetadata in interface BackupManager
      Throws:
      SQLException - if a database error occurs during the backup
    • getBackupSRB

      protected ServiceRequestBuffer getBackupSRB(FbService service, int options) throws SQLException
      Creates and returns the "backup" service request buffer for the Service Manager.
      Parameters:
      service - Service handle
      options - The isc_spb_bkp_* parameters options to be used
      Returns:
      the "backup" service request buffer for the Service Manager.
      Throws:
      SQLException
    • restoreDatabase

      public void restoreDatabase() throws SQLException
      Description copied from interface: BackupManager
      Perform the restore operation.
      Specified by:
      restoreDatabase in interface BackupManager
      Throws:
      SQLException - if a database error occurs during the restore
    • 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 PageSizeConstants. The default value depends on the Firebird version.

      Be aware that not all page sizes are supported by all Firebird versions.

      Specified by:
      setRestorePageSize in interface BackupManager
      Parameters:
      pageSize - The page size to be used in a restored database, see PageSizeConstants
      See Also:
    • 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.
    • getRestoreSRB

      protected ServiceRequestBuffer getRestoreSRB(FbService service, int options)
      Creates and returns the "backup" service request buffer for the Service Manager.
      Parameters:
      service - Service handle
      options - The options to be used for the backup operation
      Returns:
      the "backup" service request buffer for the Service Manager.
    • addBackupsToBackupRequestBuffer

      protected abstract void addBackupsToBackupRequestBuffer(FbService service, ServiceRequestBuffer backupSPB) throws SQLException
      Adds the backup source for the backup opration, depending on the manager used
      Parameters:
      backupSPB - The buffer to be used during the backup operation
      Throws:
      SQLException
    • addBackupsToRestoreRequestBuffer

      protected abstract void addBackupsToRestoreRequestBuffer(FbService service, ServiceRequestBuffer restoreSPB)
      Adds the backup files to be used during restore
    • verboseBackup

      protected abstract boolean verboseBackup()
      Whether the backup will produce verbose output