Class ConfluenceBackupRestoreManager
- java.lang.Object
-
- com.atlassian.confluence.impl.backuprestore.ConfluenceBackupRestoreManager
-
- All Implemented Interfaces:
BackupRestoreManager
public class ConfluenceBackupRestoreManager extends Object implements BackupRestoreManager
Responsible for accepting backup/restore operations, checking permissions, managing the queue and cluster-wide locks. Uses BackupRestoreService for the actual backup/restore operations. At this moment, this implementation does not support Confluence cluster. So each mode works independently.- Since:
- 7.17.0
-
-
Constructor Summary
Constructors Constructor Description ConfluenceBackupRestoreManager(SiteBackupService siteBackupService, SpaceBackupService spaceBackupService, SiteRestoreService siteRestoreService, SpaceRestoreService spaceRestoreService, BackupRestorePermissionsHelper permissionsHelper, BackupRestoreJobPersister backupRestoreJobPersister)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
cancelAllJobsFromQueue()
Cancels all queued jobs.BackupRestoreJob
cancelJob(Long jobId)
Cancels the job.Collection<BackupRestoreJob>
findJobs(BackupRestoreJobsSearchFilter backupRestoreJobsSearchFilter, int limit)
Returns jobs based on the filter provided.BackupRestoreJob
getJob(Long jobId)
Get job by id.void
scheduled()
BackupRestoreJob
startSiteBackup(BackupRestoreSettings siteBackupSettings)
Starts the new site backup job if possible.BackupRestoreJob
startSiteRestore(BackupRestoreSettings siteRestoreSettings)
Starts the new site restore job if possible.BackupRestoreJob
startSpaceBackup(BackupRestoreSettings spaceBackupSettings)
Adds the new space backup job to the queue.BackupRestoreJob
startSpaceRestore(BackupRestoreSettings spaceRestoreSettings)
Adds the new space restore job to the queue.void
updateActiveJobsAndProcessTheQueue()
Every few seconds we have to check the statuses of the jobs running.
-
-
-
Constructor Detail
-
ConfluenceBackupRestoreManager
public ConfluenceBackupRestoreManager(SiteBackupService siteBackupService, SpaceBackupService spaceBackupService, SiteRestoreService siteRestoreService, SpaceRestoreService spaceRestoreService, BackupRestorePermissionsHelper permissionsHelper, BackupRestoreJobPersister backupRestoreJobPersister)
-
-
Method Detail
-
scheduled
@Scheduled(fixedDelay=5000L) public void scheduled() throws InterruptedException
- Throws:
InterruptedException
-
updateActiveJobsAndProcessTheQueue
public void updateActiveJobsAndProcessTheQueue() throws InterruptedException
Every few seconds we have to check the statuses of the jobs running. Update their statuses if they finish their execution. Also move some jobs from the queue to in-progress state if possible.- Throws:
InterruptedException
-
startSiteBackup
public BackupRestoreJob startSiteBackup(BackupRestoreSettings siteBackupSettings) throws SiteBackupRestoreJobAlreadyInProgressException, NotPermittedException
Starts the new site backup job if possible. If another site backup/restore job is in progress, the operation will be rejected because the existing site backup must be either cancelled or finished first. Throws an exception if the operation is not permitted. The user has to the a sysadmin to perform this operation.- Specified by:
startSiteBackup
in interfaceBackupRestoreManager
- Parameters:
siteBackupSettings
- site backup settings- Throws:
SiteBackupRestoreJobAlreadyInProgressException
NotPermittedException
-
startSiteRestore
public BackupRestoreJob startSiteRestore(BackupRestoreSettings siteRestoreSettings) throws NotPermittedException, SiteBackupRestoreJobAlreadyInProgressException
Starts the new site restore job if possible. If another site backup/restore job is in progress, the operation will be rejected because the existing site backup must be either cancelled or finished first. Throws an exception if the operation is not permitted.- Specified by:
startSiteRestore
in interfaceBackupRestoreManager
- Parameters:
siteRestoreSettings
- site restore settings- Throws:
NotPermittedException
SiteBackupRestoreJobAlreadyInProgressException
-
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
public BackupRestoreJob getJob(Long jobId)
Get job by id.- Specified by:
getJob
in interfaceBackupRestoreManager
-
startSpaceBackup
public BackupRestoreJob startSpaceBackup(BackupRestoreSettings spaceBackupSettings) throws BackupRestoreException
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:
BackupRestoreException
-
cancelJob
public BackupRestoreJob cancelJob(Long jobId) throws NotPermittedException
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
public int cancelAllJobsFromQueue()
Description copied from interface:BackupRestoreManager
Cancels all queued jobs. Does not affect jobs that are being processed at this moment.- Specified by:
cancelAllJobsFromQueue
in interfaceBackupRestoreManager
- Returns:
- number of cancelled jobs.
-
findJobs
public Collection<BackupRestoreJob> findJobs(BackupRestoreJobsSearchFilter backupRestoreJobsSearchFilter, int limit) throws BackupRestoreException
Returns jobs based on the filter provided. Permissions depend on the filter.- Specified by:
findJobs
in interfaceBackupRestoreManager
- Throws:
BackupRestoreException
-
-