java.lang.Object
org.firebirdsql.management.FBServiceManager
org.firebirdsql.management.FBBackupManagerBase
- All Implemented Interfaces:
AttachmentProperties
,BaseProperties
,ServiceConnectionProperties
,BackupManager
,ServiceManager
- Direct Known Subclasses:
FBBackupManager
,FBStreamingBackupManager
Implements the common functionality between regular and streaming backup/restore
- Author:
- Roman Rokytskyy, Mark Rotteveel
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
Structure that holds path to the database and corresponding size of the file (in case of backup - that is size of the file in megabytes, in case of restore - size of the database file in pages). -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
protected final List<FBBackupManagerBase.PathSizeStruct>
protected boolean
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
ConstructorsModifierConstructorDescriptionprotected
Create a new instance ofFBBackupManagerBase
based on the default GDSType.protected
FBBackupManagerBase
(String gdsType) Create a new instance ofFBBackupManagerBase
based on a given GDSType.protected
FBBackupManagerBase
(GDSType gdsType) Create a new instance ofFBBackupManagerBase
based on a given GDSType. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addBackupPath
(String path) Add backup file to the list.protected abstract void
addBackupsToBackupRequestBuffer
(FbService service, ServiceRequestBuffer backupSPB) Adds the backup source for the backup opration, depending on the manager usedprotected abstract void
addBackupsToRestoreRequestBuffer
(FbService service, ServiceRequestBuffer restoreSPB) Adds the backup files to be used during restorevoid
addRestorePath
(String path, int size) Add the file to the multi-file database of the specified size for restore operation.void
Perform the backup operation.void
Perform the backup operation, metadata only.void
Clear the information about restore paths.protected ServiceRequestBuffer
getBackupSRB
(FbService service, int options) Creates and returns the "backup" service request buffer for the Service Manager.protected ServiceRequestBuffer
getRestoreSRB
(FbService service, int options) Creates and returns the "backup" service request buffer for the Service Manager.void
Perform the restore operation.void
setDatabase
(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 thisBackupManager
will result in verbose logging to the configured logger.protected abstract boolean
Whether the backup will produce verbose outputMethods inherited from class org.firebirdsql.management.FBServiceManager
attachDatabase, attachServiceManager, connectionPropertyValues, createRequestBuffer, executeServicesOperation, getAuthPlugins, getBooleanProperty, getCharSet, getDatabase, getDbCryptConfig, getExpectedDb, getHost, getIntProperty, getLogger, getPassword, getPort, getPortNumber, getProperty, getServerName, getServerVersion, getServiceName, getUser, getWireCrypt, getWireCryptAsEnum, isWireCompression, queueService, setAuthPlugins, setBooleanProperty, setCharSet, setDbCryptConfig, setExpectedDb, setHost, setIntProperty, setLogger, setPassword, setPort, setPortNumber, setProperty, setServerName, setServiceName, setType, setUser, setWireCompression, setWireCryptAsEnum
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.firebirdsql.jaybird.props.AttachmentProperties
getAuthPlugins, getCharSet, getConnectTimeout, getDbCryptConfig, getEnableProtocol, getEncoding, getParallelWorkers, getPassword, getPortNumber, getProcessId, getProcessName, getRoleName, getServerName, getSocketBufferSize, getSocketFactory, getSoTimeout, getType, getUser, getWireCrypt, isWireCompression, setAuthPlugins, setCharSet, setConnectTimeout, setDbCryptConfig, setEnableProtocol, setEncoding, setParallelWorkers, setPassword, setPortNumber, setProcessId, setProcessName, setRoleName, setServerName, setSocketBufferSize, setSocketFactory, setSoTimeout, setType, setUser, setWireCompression, setWireCrypt
Methods inherited from interface org.firebirdsql.management.BackupManager
addBackupPath, backupDatabase, clearBackupPaths, restoreDatabase, setBackupPath
Methods inherited from interface org.firebirdsql.jaybird.props.BaseProperties
connectionPropertyValues, getBooleanProperty, getBooleanProperty, getIntProperty, getIntProperty, getProperty, getProperty, setBooleanProperty, setIntProperty, setProperty
Methods inherited from interface org.firebirdsql.jaybird.props.ServiceConnectionProperties
getExpectedDb, getServiceName, setExpectedDb, setServiceName
Methods inherited from interface org.firebirdsql.management.ServiceManager
getDatabase, getHost, getLogger, getPort, getServerVersion, getWireCryptAsEnum, setHost, setLogger, setPort, setWireCryptAsEnum
-
Field Details
-
noLimitRestore
protected boolean noLimitRestore -
restorePaths
-
verbose
protected boolean verbose
-
-
Constructor Details
-
FBBackupManagerBase
protected FBBackupManagerBase()Create a new instance ofFBBackupManagerBase
based on the default GDSType. -
FBBackupManagerBase
Create a new instance ofFBBackupManagerBase
based on a given GDSType.- Parameters:
gdsType
- type must be PURE_JAVA, EMBEDDED, or NATIVE
-
FBBackupManagerBase
Create a new instance ofFBBackupManagerBase
based on a given GDSType.- Parameters:
gdsType
- type must be PURE_JAVA, EMBEDDED, or NATIVE
-
-
Method Details
-
addBackupPath
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 toBackupManager.addBackupPath(String, int)
call.If application invokes backup operation, an error is generated in that call.
- Specified by:
addBackupPath
in interfaceBackupManager
- Parameters:
path
- path to the backup file.
-
setDatabase
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 interfaceBackupManager
- Specified by:
setDatabase
in interfaceServiceManager
- Overrides:
setDatabase
in classFBServiceManager
- Parameters:
database
- path for the connection to the service manager.
-
addRestorePath
Description copied from interface:BackupManager
Add the file to the multi-file database of the specified size for restore operation.- Specified by:
addRestorePath
in interfaceBackupManager
- 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 theBackupManager.addRestorePath(String, int)
orBackupManager.setDatabase(String)
methods.- Specified by:
clearRestorePaths
in interfaceBackupManager
-
backupDatabase
Description copied from interface:BackupManager
Perform the backup operation.- Specified by:
backupDatabase
in interfaceBackupManager
- Throws:
SQLException
- if a database error occurs during the backup
-
backupMetadata
Description copied from interface:BackupManager
Perform the backup operation, metadata only.- Specified by:
backupMetadata
in interfaceBackupManager
- Throws:
SQLException
- if a database error occurs during the backup
-
getBackupSRB
Creates and returns the "backup" service request buffer for the Service Manager.- Parameters:
service
- Service handleoptions
- The isc_spb_bkp_* parameters options to be used- Returns:
- the "backup" service request buffer for the Service Manager.
- Throws:
SQLException
-
restoreDatabase
Description copied from interface:BackupManager
Perform the restore operation.- Specified by:
restoreDatabase
in interfaceBackupManager
- Throws:
SQLException
- if a database error occurs during the restore
-
setVerbose
public void setVerbose(boolean verbose) Set whether the operations of thisBackupManager
will result in verbose logging to the configured logger.- Specified by:
setVerbose
in interfaceBackupManager
- Parameters:
verbose
- Iftrue
, 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 interfaceBackupManager
- 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 forpageSize
must be one ofPageSizeConstants
. 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 interfaceBackupManager
- Parameters:
pageSize
- The page size to be used in a restored database, seePageSizeConstants
- 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 interfaceBackupManager
- Parameters:
replace
- Iftrue
, 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 interfaceBackupManager
- Parameters:
readOnly
- Iftrue
, a restored database will be read-only, otherwise it will be read-write.
-
getRestoreSRB
Creates and returns the "backup" service request buffer for the Service Manager.- Parameters:
service
- Service handleoptions
- 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
-