org.firebirdsql.management

## Class FBStreamingBackupManager

- java.lang.Object
- - org.firebirdsql.management.FBServiceManager
  - - org.firebirdsql.management.FBBackupManagerBase
    - - org.firebirdsql.management.FBStreamingBackupManager

All Implemented Interfaces:
  BackupManager, ServiceManager

    public class FBStreamingBackupManager
    extends FBBackupManagerBase
    implements BackupManager

Implements the streaming version of the backup and restore functionality of Firebird Services API.

Author:
  Roman Rokytskyy, Mark Rotteveel

### Nested Class Summary

### Nested classes/interfaces inherited from class org.firebirdsql.management.FBBackupManagerBase

`FBBackupManagerBase.PathSizeStruct`

### Field Summary

### Fields inherited from class org.firebirdsql.management.FBBackupManagerBase

`noLimitRestore, restorePaths, verbose`

### 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

Constructors
Constructor and Description
`FBStreamingBackupManager()` Create a new instance of `FBStreamingBackupManager` based on the default GDSType.
`FBStreamingBackupManager(GDSType gdsType)` Create a new instance of `FBStreamingBackupManager` based on a given GDSType.
`FBStreamingBackupManager(java.lang.String gdsType)` Create a new instance of `FBStreamingBackupManager` based on a given GDSType.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addBackupPath(java.lang.String path, int size)` Add the file to the backup of the specified size.
`protected void` `addBackupsToBackupRequestBuffer(FbService service, ServiceRequestBuffer backupSPB)` Adds stdout as a source for the backup operation
`protected void` `addBackupsToRestoreRequestBuffer(FbService service, ServiceRequestBuffer restoreSPB)` Adds stdin as a source for the restore operation
`void` `backupDatabase(int options)` Perform the backup operation.
`void` `clearBackupPaths()` Clear the information about backup paths.
`void` `restoreDatabase(int options)` Perform the restore operation.
`void` `setBackupBufferSize(int bufferSize)` Set the local buffer size to be used when doing a backup.
`void` `setBackupOutputStream(java.io.OutputStream backupStream)`
`void` `setBackupPath(java.lang.String backupPath)` Sets the location of the backup file.
`void` `setRestoreInputStream(java.io.InputStream restoreStream)`
`void` `setRestorePageSize(int pageSize)` Set the page size that will be used for a restored database.
`protected boolean` `verboseBackup()` Streaming backups are currently not capable of verbose output

### Methods inherited from class org.firebirdsql.management.FBBackupManagerBase

`addBackupPath, addRestorePath, backupDatabase, backupMetadata, clearRestorePaths, getBackupSRB, getRestoreSRB, restoreDatabase, setDatabase, setRestorePageBufferCount, setRestoreReadOnly, setRestoreReplace, setVerbose`

### Methods inherited from class org.firebirdsql.management.FBServiceManager

`attachDatabase, attachServiceManager, createRequestBuffer, executeServicesOperation, executeServicesOperation, getAuthPlugins, getCharSet, getDatabase, getDbCryptConfig, getHost, getLogger, getPassword, getPort, getServerVersion, getServiceName, getUser, getWireCrypt, isWireCompression, queueService, setAuthPlugins, setCharSet, setDbCryptConfig, setHost, setLogger, setPassword, setPort, setUser, setWireCompression, setWireCrypt`

### 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.BackupManager

`addBackupPath, addRestorePath, backupDatabase, backupMetadata, clearRestorePaths, restoreDatabase, setDatabase, setRestorePageBufferCount, setRestoreReadOnly, setRestoreReplace, setVerbose`

### Methods inherited from interface org.firebirdsql.management.ServiceManager

`getAuthPlugins, getCharSet, getDatabase, getDbCryptConfig, getHost, getLogger, getPassword, getPort, getServerVersion, getUser, getWireCrypt, isWireCompression, setAuthPlugins, setCharSet, setDbCryptConfig, setHost, setLogger, setPassword, setPort, setUser, setWireCompression, setWireCrypt`

### Constructor Detail

#### FBStreamingBackupManager

    public FBStreamingBackupManager()

Create a new instance of `FBStreamingBackupManager` based on the default GDSType.

#### FBStreamingBackupManager

    public FBStreamingBackupManager(java.lang.String gdsType)

Create a new instance of `FBStreamingBackupManager` based on a given GDSType.

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

#### FBStreamingBackupManager

    public FBStreamingBackupManager(GDSType gdsType)

Create a new instance of `FBStreamingBackupManager` based on a given GDSType.

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

### Method Detail

#### setBackupBufferSize

    public void setBackupBufferSize(int bufferSize)

Set the local buffer size to be used when doing a backup. Default is 30720

Parameters:
  `bufferSize` - The buffer size to be used, a positive value

#### 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:
  `for multi-file backups.`

#### 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.

#### setBackupOutputStream

    public void setBackupOutputStream(java.io.OutputStream backupStream)

#### setRestoreInputStream

    public void setRestoreInputStream(java.io.InputStream restoreStream)

#### 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`

#### 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_*` constants for the backup operation
Throws:
  `java.sql.SQLException` - if a database error occurs during the backup

#### 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_*` constants
Throws:
  `java.sql.SQLException` - if a database error occurs during the restore

#### verboseBackup

    protected boolean verboseBackup()

Streaming backups are currently not capable of verbose output

Specified by:
  `verboseBackup` in class `FBBackupManagerBase`

#### 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 at least 4096, see als `PageSizeConstants`. The default value depends on the Firebird version. Pages smaller than 4096 were dropped in 2006 and are by definition unavailable with the streaming functionality of the Services API

Specified by:
  `setRestorePageSize` in interface `BackupManager`
Overrides:
  `setRestorePageSize` in class `FBBackupManagerBase`
Parameters:
  `pageSize` - The page size to be used in a restored database, see `PageSizeConstants` with a minimum of 4096
See Also:
  `PageSizeConstants`

#### addBackupsToBackupRequestBuffer

    protected void addBackupsToBackupRequestBuffer(FbService service,
                                                   ServiceRequestBuffer backupSPB)

Adds stdout as a source for the backup operation

Specified by:
  `addBackupsToBackupRequestBuffer` in class `FBBackupManagerBase`
Parameters:
  `backupSPB` - The buffer to be used during the backup operation

#### addBackupsToRestoreRequestBuffer

    protected void addBackupsToRestoreRequestBuffer(FbService service,
                                                    ServiceRequestBuffer restoreSPB)

Adds stdin as a source for the restore operation

Specified by:
  `addBackupsToRestoreRequestBuffer` in class `FBBackupManagerBase`
Parameters:
  `restoreSPB` - The buffer to be used during the restore operation