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 intcancelAllJobsFromQueue()Cancels all queued jobs.BackupRestoreJobcancelJob(Long jobId)Cancels the job.Collection<BackupRestoreJob>findJobs(BackupRestoreJobsSearchFilter backupRestoreJobsSearchFilter, int limit)Returns jobs based on the filter provided.BackupRestoreJobgetJob(Long jobId)Get job by id.voidscheduled()BackupRestoreJobstartSiteBackup(BackupRestoreSettings siteBackupSettings)Starts the new site backup job if possible.BackupRestoreJobstartSiteRestore(BackupRestoreSettings siteRestoreSettings)Starts the new site restore job if possible.BackupRestoreJobstartSpaceBackup(BackupRestoreSettings spaceBackupSettings)Adds the new space backup job to the queue.BackupRestoreJobstartSpaceRestore(BackupRestoreSettings spaceRestoreSettings)Adds the new space restore job to the queue.voidupdateActiveJobsAndProcessTheQueue()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 InterruptedExceptionEvery 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:
startSiteBackupin interfaceBackupRestoreManager- Parameters:
siteBackupSettings- site backup settings- Throws:
SiteBackupRestoreJobAlreadyInProgressExceptionNotPermittedException
-
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:
startSiteRestorein interfaceBackupRestoreManager- Parameters:
siteRestoreSettings- site restore settings- Throws:
NotPermittedExceptionSiteBackupRestoreJobAlreadyInProgressException
-
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:
startSpaceRestorein interfaceBackupRestoreManager- Parameters:
spaceRestoreSettings- space restore settings- Throws:
NotPermittedException
-
getJob
public BackupRestoreJob getJob(Long jobId)
Get job by id.- Specified by:
getJobin 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:
startSpaceBackupin 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:
cancelJobin interfaceBackupRestoreManager- Parameters:
jobId- jobId- Returns:
- the job
- Throws:
NotPermittedException
-
cancelAllJobsFromQueue
public int cancelAllJobsFromQueue()
Description copied from interface:BackupRestoreManagerCancels all queued jobs. Does not affect jobs that are being processed at this moment.- Specified by:
cancelAllJobsFromQueuein 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:
findJobsin interfaceBackupRestoreManager- Throws:
BackupRestoreException
-
-