Class ConfluenceBackupRestoreManager
java.lang.Object
com.atlassian.confluence.impl.backuprestore.ConfluenceBackupRestoreManager
- All Implemented Interfaces:
BackupRestoreManager
Responsible for accepting backup/restore operations, checking permissions, managing the queue and cluster-wide locks.
Uses BackupRestoreService for the actual backup/restore operations.
NOTE: At this moment, this implementation does not support Confluence cluster. So each mode works independently.
- Since:
- 7.17.0
-
Constructor Summary
ConstructorDescriptionConfluenceBackupRestoreManager
(BackupRestoreJobRunner backupRestoreJobRunner, BackupRestorePermissionsHelper permissionsHelper, BackupRestoreJobDao backupRestoreJobDao, com.atlassian.beehive.ClusterLockService clusterLockService, ConfluenceBackupRestoreJobCanceller confluenceBackupRestoreJobCanceller, com.atlassian.event.api.EventPublisher eventPublisher, BackupRestoreFilesystemManager backupRestoreFilesystemManager, ZduManager zduManager, IndependentBackupRestoreJobManager independentBackupRestoreJobManager) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Checks whether the current user can upload a backup file.int
Cancels all queued jobs including jobs in QUEUED state and PROCESSING state.Cancels the job.findJobs
(BackupRestoreJobsSearchFilter backupRestoreJobsSearchFilter) Returns jobs based on the filter provided.Get job by id.getSettingsById
(long jobId) Returns job settings.getStatisticsById
(long jobId) void
startSiteBackup
(BackupRestoreSettings siteBackupSettings) Queues a new site backup job if possible.startSiteRestore
(BackupRestoreSettings siteRestoreSettings) Queues the new site restore job if possible.startSpaceBackup
(BackupRestoreSettings spaceBackupSettings) Adds the new space backup job to the queue.startSpaceRestore
(BackupRestoreSettings spaceRestoreSettings) Adds the new space restore job to the queue.
-
Constructor Details
-
ConfluenceBackupRestoreManager
public ConfluenceBackupRestoreManager(BackupRestoreJobRunner backupRestoreJobRunner, BackupRestorePermissionsHelper permissionsHelper, BackupRestoreJobDao backupRestoreJobDao, com.atlassian.beehive.ClusterLockService clusterLockService, ConfluenceBackupRestoreJobCanceller confluenceBackupRestoreJobCanceller, com.atlassian.event.api.EventPublisher eventPublisher, BackupRestoreFilesystemManager backupRestoreFilesystemManager, ZduManager zduManager, IndependentBackupRestoreJobManager independentBackupRestoreJobManager)
-
-
Method Details
-
startSiteBackup
public BackupRestoreJob startSiteBackup(BackupRestoreSettings siteBackupSettings) throws NotPermittedException Queues a new site backup job if possible. Throws an exception if the operation is not permitted. The user has to be a sysadmin to perform this operation.- Specified by:
startSiteBackup
in interfaceBackupRestoreManager
- Parameters:
siteBackupSettings
- site backup settings- Throws:
NotPermittedException
-
startSiteRestore
public BackupRestoreJob startSiteRestore(BackupRestoreSettings siteRestoreSettings) throws NotPermittedException Queues the new site restore job if possible. It cancels all other jobs and starts the restore just after. Throws an exception if the operation is not permitted.- Specified by:
startSiteRestore
in interfaceBackupRestoreManager
- Parameters:
siteRestoreSettings
- site restore settings- Throws:
NotPermittedException
-
startSpaceRestore
public BackupRestoreJob startSpaceRestore(BackupRestoreSettings spaceRestoreSettings) throws NotPermittedException Adds the new space restore job to the queue. Throws an exception if the operation is not permitted. The user has to the a sysadmin to perform this operation.- Specified by:
startSpaceRestore
in interfaceBackupRestoreManager
- Parameters:
spaceRestoreSettings
- space restore settings- Throws:
NotPermittedException
-
getJob
Get job by id.- Specified by:
getJob
in interfaceBackupRestoreManager
- Throws:
NotPermittedException
-
startSpaceBackup
public BackupRestoreJob startSpaceBackup(BackupRestoreSettings spaceBackupSettings) throws NotPermittedException, TheSameSpaceBackupRestoreJobAlreadyInProgressException, IllegalArgumentException Adds the new space backup job to the queue. Throws an exception if the operation is not permitted. Support either single-space backup ot multi-space backups (depends on how many space ids are provided).- Specified by:
startSpaceBackup
in interfaceBackupRestoreManager
- Parameters:
spaceBackupSettings
- space backup settings- Throws:
NotPermittedException
TheSameSpaceBackupRestoreJobAlreadyInProgressException
IllegalArgumentException
-
processJobsFromTheQueue
public void processJobsFromTheQueue() -
cancelJob
Cancels the job. If the job is already cancelled or failed, the method will do nothing. Throws an exception if the operation is not permitted.- Specified by:
cancelJob
in interfaceBackupRestoreManager
- Parameters:
jobId
- jobId- Returns:
- the job
- Throws:
NotPermittedException
-
cancelAllJobsFromQueue
Description copied from interface:BackupRestoreManager
Cancels all queued jobs including jobs in QUEUED state and PROCESSING state.- Specified by:
cancelAllJobsFromQueue
in interfaceBackupRestoreManager
- Returns:
- number of cancelled jobs.
- Throws:
NotPermittedException
-
findJobs
public Collection<BackupRestoreJob> findJobs(BackupRestoreJobsSearchFilter backupRestoreJobsSearchFilter) Returns jobs based on the filter provided. Permissions are based on the user SysAdmins can return all, Users can return only jobs that they have space export permissions for- Specified by:
findJobs
in interfaceBackupRestoreManager
- Parameters:
backupRestoreJobsSearchFilter
- properties to filter jobs by- Returns:
- List of BackupRestoreJobs
-
assertUserHasSystemAdminPermissions
Description copied from interface:BackupRestoreManager
Checks whether the current user can upload a backup file. Throws a PermissionException if the user does not have permission.- Specified by:
assertUserHasSystemAdminPermissions
in interfaceBackupRestoreManager
- Throws:
NotPermittedException
-
getSettingsById
Description copied from interface:BackupRestoreManager
Returns job settings.- Specified by:
getSettingsById
in interfaceBackupRestoreManager
- Parameters:
jobId
- job id- Returns:
- settings
-
getStatisticsById
- Specified by:
getStatisticsById
in interfaceBackupRestoreManager
- Parameters:
jobId
-- Returns:
- job's statistics or empty statistics record if no statistics exist
-