Class DefaultBackupRestoreService
- java.lang.Object
-
- com.atlassian.confluence.impl.backuprestore.DefaultBackupRestoreService
-
- All Implemented Interfaces:
BackupRestoreService
public class DefaultBackupRestoreService extends Object implements BackupRestoreService
Service responsible for accepting backup/restore operations.- Since:
- 8.2.0
-
-
Constructor Summary
Constructors Constructor Description DefaultBackupRestoreService(BackupRestoreManager manager, BackupRestoreJobConverter jobConverter, BackupRestoreFilesystemManager backupRestoreFilesystemManager, com.atlassian.event.api.EventPublisher eventPublisher)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
cancelAllQueuedJobs()
Cancels all queued jobs.JobDetails
cancelJob(long jobId)
Cancels the job.SiteBackupJobDetails
createSiteBackupJob(SiteBackupSettings settings)
Starts the new site backup job if possible.SiteRestoreJobDetails
createSiteRestoreJob(SiteRestoreSettings settings)
Starts the new site restore job if possible.SiteRestoreJobDetails
createSiteRestoreJob(SiteRestoreSettings settings, InputStream inputStream)
Starts the new site restore (from uploaded file) job if possible.SpaceBackupJobDetails
createSpaceBackupJob(SpaceBackupSettings settings)
Creates new space backup job and adds it to the queue.SpaceRestoreJobDetails
createSpaceRestoreJob(SpaceRestoreSettings settings)
Creates new space restore job and adds it to the queue.SpaceRestoreJobDetails
createSpaceRestoreJob(SpaceRestoreSettings settings, InputStream inputStream)
Creates new space restore (from uploaded file) job and adds it to the queue.List<JobDetails>
findJobs(JobFilter filter)
Gets backup/restore jobs based on the filter provided.File
getBackupFile(Long jobId)
Download backup file.List<FileInfo>
getFiles(JobScope jobScope)
Gets information of files stored in /restore/(jobScope)JobDetails
getJob(long jobId)
Get job by id.
-
-
-
Constructor Detail
-
DefaultBackupRestoreService
public DefaultBackupRestoreService(BackupRestoreManager manager, BackupRestoreJobConverter jobConverter, BackupRestoreFilesystemManager backupRestoreFilesystemManager, com.atlassian.event.api.EventPublisher eventPublisher)
-
-
Method Detail
-
createSpaceBackupJob
public SpaceBackupJobDetails createSpaceBackupJob(SpaceBackupSettings settings)
Description copied from interface:BackupRestoreService
Creates new space backup job and adds it to the queue. Supports either single-space backup or multi-space backups (depends on how many space ids are provided). Throws an exception if the operation is not permitted. The user should have Space Export permissions to all the spaces passed for backup (or be a sysadmin) to be able to perform this operation.- Specified by:
createSpaceBackupJob
in interfaceBackupRestoreService
- Parameters:
settings
- space backup settings- Returns:
- space backup job details
-
createSiteBackupJob
public SiteBackupJobDetails createSiteBackupJob(SiteBackupSettings settings)
Description copied from interface:BackupRestoreService
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 should be a sysadmin to be able to perform this operation.- Specified by:
createSiteBackupJob
in interfaceBackupRestoreService
- Parameters:
settings
- site backup settings- Returns:
- site backup job details
-
createSpaceRestoreJob
public SpaceRestoreJobDetails createSpaceRestoreJob(SpaceRestoreSettings settings)
Description copied from interface:BackupRestoreService
Creates new space restore job and adds it to the queue. Throws an exception if the operation is not permitted. The user should be a sysadmin to be able to perform this operation.- Specified by:
createSpaceRestoreJob
in interfaceBackupRestoreService
- Parameters:
settings
- space restore settings- Returns:
- space restore job details
-
createSiteRestoreJob
public SiteRestoreJobDetails createSiteRestoreJob(SiteRestoreSettings settings)
Description copied from interface:BackupRestoreService
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. The user should be a sysadmin to be able to perform this operation.- Specified by:
createSiteRestoreJob
in interfaceBackupRestoreService
- Parameters:
settings
- site restore settings- Returns:
- site restore job details
-
createSpaceRestoreJob
public SpaceRestoreJobDetails createSpaceRestoreJob(SpaceRestoreSettings settings, InputStream inputStream)
Description copied from interface:BackupRestoreService
Creates new space restore (from uploaded file) job and adds it to the queue. Throws an exception if the operation is not permitted. The user should be a sysadmin to be able to perform this operation.- Specified by:
createSpaceRestoreJob
in interfaceBackupRestoreService
- Parameters:
settings
- space restore settingsinputStream
- Input Stream ( File contents)- Returns:
- space restore job details
-
createSiteRestoreJob
public SiteRestoreJobDetails createSiteRestoreJob(SiteRestoreSettings settings, InputStream inputStream)
Description copied from interface:BackupRestoreService
Starts the new site restore (from uploaded file) 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 should be a sysadmin to be able to perform this operation.- Specified by:
createSiteRestoreJob
in interfaceBackupRestoreService
- Parameters:
settings
- site restore settingsinputStream
- Input Stream ( File contents)- Returns:
- site restore job details
-
getJob
public JobDetails getJob(long jobId)
Description copied from interface:BackupRestoreService
Get job by id. The user should be a sysadmin or an owner of the job- Specified by:
getJob
in interfaceBackupRestoreService
- Parameters:
jobId
- id of the backup/restore job- Returns:
- job details
-
findJobs
public List<JobDetails> findJobs(JobFilter filter)
Description copied from interface:BackupRestoreService
Gets backup/restore jobs based on the filter provided.- Specified by:
findJobs
in interfaceBackupRestoreService
- Parameters:
filter
- job filter- Returns:
- List of backup/restore jobs visible to user based on the filter provided.
-
cancelJob
public JobDetails cancelJob(long jobId)
Description copied from interface:BackupRestoreService
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. The user should be a sysadmin or an owner of this job to be able to perform this operation.- Specified by:
cancelJob
in interfaceBackupRestoreService
- Parameters:
jobId
- id of the backup/restore job- Returns:
- details of cancelled job
-
getFiles
public List<FileInfo> getFiles(JobScope jobScope)
Description copied from interface:BackupRestoreService
Gets information of files stored in /restore/(jobScope)- Specified by:
getFiles
in interfaceBackupRestoreService
- Parameters:
jobScope
- SITE or SPACE, the scope to get files from- Returns:
- List of file information of files in the directory storing the jobScope's restore files.
-
cancelAllQueuedJobs
public int cancelAllQueuedJobs()
Description copied from interface:BackupRestoreService
Cancels all queued jobs. Does not affect jobs that are being processed at the moment.- Specified by:
cancelAllQueuedJobs
in interfaceBackupRestoreService
- Returns:
- number of cancelled jobs
-
getBackupFile
public File getBackupFile(Long jobId) throws NotFoundException
Description copied from interface:BackupRestoreService
Download backup file. Throws an exception if the operation is not permitted or the file is missing in the confluence-home/temp directory. The user should be a sysadmin or have permissions to back up all spaces for this job.- Specified by:
getBackupFile
in interfaceBackupRestoreService
- Parameters:
jobId
- id of the backup job- Returns:
- backup file
- Throws:
NotFoundException
- if job cannot be found, lack permissions or the backup file does not exist in confluence-home/temp directory
-
-