Class BackupManagerImpl

java.lang.Object
org.exoplatform.services.jcr.ext.backup.impl.BackupManagerImpl
All Implemented Interfaces:
BackupManager, ExtendedBackupManager, org.picocontainer.Startable

public class BackupManagerImpl extends Object implements ExtendedBackupManager, org.picocontainer.Startable
Created by The eXo Platform SAS .
Version:
$Id: $
Author:
Gennady Azarenkov
  • Field Details

    • LOG

      protected static final org.exoplatform.services.log.Log LOG
    • DEFAULT_INCREMENTAL_JOB_PERIOD

      public static final String DEFAULT_INCREMENTAL_JOB_PERIOD
      Name of default incremental job period parameter in configuration.
      See Also:
    • BACKUP_PROPERTIES

      public static final String BACKUP_PROPERTIES
      Name of backup properties parameter in configuration.
      See Also:
    • FULL_BACKUP_TYPE

      public static final String FULL_BACKUP_TYPE
      Name of full backup type parameter in configuration.
      See Also:
    • INCREMENTAL_BACKUP_TYPE

      public static final String INCREMENTAL_BACKUP_TYPE
      Name of incremental backup type parameter in configuration.
      See Also:
    • DEFAULT_VALUE_INCREMENTAL_JOB_PERIOD

      public static final String DEFAULT_VALUE_INCREMENTAL_JOB_PERIOD
      Default value of incremental job period parameter in configuration.
      See Also:
    • DEFAULT_VALUE_INCREMENTAL_BACKUP_TYPE

      public static final String DEFAULT_VALUE_INCREMENTAL_BACKUP_TYPE
      Default value of incremental backup type parameter in configuration.
    • DEFAULT_VALUE_FULL_BACKUP_TYPE

      public static final String DEFAULT_VALUE_FULL_BACKUP_TYPE
      Default value of incremental backup type parameter in configuration.
    • BACKUP_DIR

      public static final String BACKUP_DIR
      Name of backup dir parameter in configuration.
      See Also:
    • restoreRepositoryJobs

      protected CopyOnWriteArrayList<JobRepositoryRestore> restoreRepositoryJobs
      The list of repository restore job.
  • Constructor Details

    • BackupManagerImpl

      public BackupManagerImpl(org.exoplatform.container.xml.InitParams initParams, org.exoplatform.services.jcr.RepositoryService repoService)
      BackupManagerImpl constructor.
      Parameters:
      initParams - InitParams, the init parameters
      repoService - RepositoryService, the repository service
    • BackupManagerImpl

      public BackupManagerImpl(org.exoplatform.container.ExoContainerContext ctx, org.exoplatform.container.xml.InitParams initParams, org.exoplatform.services.jcr.RepositoryService repoService)
      BackupManagerImpl constructor.
      Parameters:
      initParams - InitParams, the init parameters
      repoService - RepositoryService, the repository service
    • BackupManagerImpl

      public BackupManagerImpl(org.exoplatform.container.xml.InitParams initParams, org.exoplatform.services.jcr.RepositoryService repoService, RegistryService registryService)
      BackupManagerImpl constructor. InitParams, the init parameters
      Parameters:
      repoService - RepositoryService, the repository service
      registryService - RegistryService, the registry service
    • BackupManagerImpl

      public BackupManagerImpl(org.exoplatform.container.ExoContainerContext ctx, org.exoplatform.container.xml.InitParams initParams, org.exoplatform.services.jcr.RepositoryService repoService, RegistryService registryService)
      BackupManagerImpl constructor. InitParams, the init parameters
      Parameters:
      repoService - RepositoryService, the repository service
      registryService - RegistryService, the registry service
  • Method Details

    • getCurrentBackups

      public Set<BackupChain> getCurrentBackups()
      Getting current backups.
      Specified by:
      getCurrentBackups in interface BackupManager
      Returns:
      Set return the set of current backups
    • getMessages

      public BackupMessage[] getMessages()
      Getting the backup messages.
      Specified by:
      getMessages in interface BackupManager
      Returns:
      BackupMessage[] return the backup messages
    • getBackupsLogs

      public BackupChainLog[] getBackupsLogs()
      Getting all backup logs .
      Specified by:
      getBackupsLogs in interface BackupManager
      Returns:
      BackupChainLog[] return the all backup logs
    • getRepositoryBackupsLogs

      public RepositoryBackupChainLog[] getRepositoryBackupsLogs()
      Getting all repository backup logs.
      Specified by:
      getRepositoryBackupsLogs in interface BackupManager
      Returns:
      RepositoryBackupChainLog[] return the all repository backup logs
    • restoreOverInitializer

      protected void restoreOverInitializer(BackupChainLog log, String repositoryName, org.exoplatform.services.jcr.config.WorkspaceEntry workspaceEntry) throws BackupOperationException, javax.jcr.RepositoryException, org.exoplatform.services.jcr.config.RepositoryConfigurationException, BackupConfigurationException
      Throws:
      BackupOperationException
      javax.jcr.RepositoryException
      org.exoplatform.services.jcr.config.RepositoryConfigurationException
      BackupConfigurationException
    • startBackup

      public BackupChain startBackup(BackupConfig config) throws BackupOperationException, BackupConfigurationException, javax.jcr.RepositoryException, org.exoplatform.services.jcr.config.RepositoryConfigurationException
      Starting backup.
      Specified by:
      startBackup in interface BackupManager
      Parameters:
      config - BackupConfig, the backup configuration
      Returns:
      BackupChain return the backup chain
      Throws:
      BackupOperationException - BackupOperationException will be generate the exception BackupOperationException
      BackupConfigurationException - will be generate the exception BackupConfigurationException
      javax.jcr.RepositoryException - will be generate the exception RepositoryException
      org.exoplatform.services.jcr.config.RepositoryConfigurationException - will be generate the exception RepositoryConfigurationException
    • stopBackup

      public void stopBackup(BackupChain backup)
      Stop backup.
      Specified by:
      stopBackup in interface BackupManager
      Parameters:
      backup - BackupChain, the backup chain
    • start

      public void start()
      Specified by:
      start in interface org.picocontainer.Startable
    • stop

      public void stop()
      Specified by:
      stop in interface org.picocontainer.Startable
    • findBackup

      public BackupChain findBackup(String repository, String workspace)
      Finding current backup by repository and workspace.
      Specified by:
      findBackup in interface BackupManager
      Parameters:
      repository - String, the repository name
      workspace - String, the workspace name
      Returns:
      BackupChain return the current backup
    • findBackup

      public BackupChain findBackup(String backupId)
      Finding current backup by identifier.
      Specified by:
      findBackup in interface BackupManager
      Parameters:
      backupId - String the backup identifier
      Returns:
      BackupChain return the current backup
    • getBackupDirectory

      public File getBackupDirectory()
      Getting backup directory.
      Specified by:
      getBackupDirectory in interface BackupManager
      Returns:
      File return the backup directory
    • getFullBackupType

      public String getFullBackupType()
      Getting full backup type.
      Specified by:
      getFullBackupType in interface BackupManager
      Returns:
      Sting return FQN to full backup type
    • getIncrementalBackupType

      public String getIncrementalBackupType()
      Getting incremental backup type.
      Specified by:
      getIncrementalBackupType in interface BackupManager
      Returns:
      String return FQN to full backup type
    • getDefaultIncrementalJobPeriod

      public long getDefaultIncrementalJobPeriod()
      Getting default incremental job period.
      Specified by:
      getDefaultIncrementalJobPeriod in interface BackupManager
      Returns:
      long return the default incremental job period
    • getRestores

      public List<JobWorkspaceRestore> getRestores()
      Getting list of restores.
      Specified by:
      getRestores in interface BackupManager
      Returns:
      List return the list of backups
    • getLastRestore

      public JobWorkspaceRestore getLastRestore(String repositoryName, String workspaceName)
      Getting last restore by repository and workspace name.
      Specified by:
      getLastRestore in interface BackupManager
      Parameters:
      repositoryName - String, the repository name
      workspaceName - String, the workspace name
      Returns:
      JobWorkspaceRestore return the job to restore
    • getLastRepositoryRestore

      public JobRepositoryRestore getLastRepositoryRestore(String repositoryName)
      Getting last repository restore by repository name.
      Specified by:
      getLastRepositoryRestore in interface BackupManager
      Parameters:
      repositoryName - String, the repository name
      Returns:
      JobWorkspaceRestore return the job to restore
    • getRepositoryRestores

      public List<JobRepositoryRestore> getRepositoryRestores()
      Description copied from interface: BackupManager
      Getting list of repository restores.
      Specified by:
      getRepositoryRestores in interface BackupManager
      Returns:
      List return the list of backups
    • restore

      public void restore(BackupChainLog log, String repositoryName, org.exoplatform.services.jcr.config.WorkspaceEntry workspaceEntry, boolean asynchronous) throws BackupOperationException, BackupConfigurationException, javax.jcr.RepositoryException, org.exoplatform.services.jcr.config.RepositoryConfigurationException
      Restore from backup.
      Specified by:
      restore in interface BackupManager
      Parameters:
      log - BackupChainLog, the backup log
      repositoryName - String, repository name
      workspaceEntry - WorkspaceEntry, the workspace entry
      asynchronous - boolean, in 'true' then asynchronous restore.
      Throws:
      BackupOperationException - will be generate the exception BackupOperationException
      BackupConfigurationException - will be generate the exception BackupConfigurationException
      javax.jcr.RepositoryException - will be generate the exception RepositoryException
      org.exoplatform.services.jcr.config.RepositoryConfigurationException - will be generate the exception RepositoryConfigurationException
    • restore

      public void restore(RepositoryBackupChainLog log, org.exoplatform.services.jcr.config.RepositoryEntry repositoryEntry, boolean asynchronous) throws BackupOperationException, BackupConfigurationException, javax.jcr.RepositoryException, org.exoplatform.services.jcr.config.RepositoryConfigurationException
      Repository restore from backup.
      Specified by:
      restore in interface BackupManager
      Parameters:
      log - RepositoryBackupChainLog, the repository backup log
      repositoryEntry - RepositoryEntry, the repository entry
      asynchronous - boolean, in 'true' then asynchronous restore.
      Throws:
      BackupOperationException - will be generate the exception BackupOperationException
      BackupConfigurationException - will be generate the exception BackupConfigurationException
      javax.jcr.RepositoryException - will be generate the exception RepositoryException
      org.exoplatform.services.jcr.config.RepositoryConfigurationException - will be generate the exception RepositoryConfigurationException
    • restore

      public void restore(RepositoryBackupChainLog log, org.exoplatform.services.jcr.config.RepositoryEntry repositoryEntry, boolean asynchronous, boolean removeJobOnceOver) throws BackupOperationException, BackupConfigurationException, javax.jcr.RepositoryException, org.exoplatform.services.jcr.config.RepositoryConfigurationException
      Repository restore from backup.
      Specified by:
      restore in interface BackupManager
      Parameters:
      log - RepositoryBackupChainLog, the repository backup log
      repositoryEntry - RepositoryEntry, the repository entry
      asynchronous - boolean, in 'true' then asynchronous restore.
      removeJobOnceOver - boolean, in 'true' then restore job well remove after restore.
      Throws:
      BackupOperationException - will be generate the exception BackupOperationException
      BackupConfigurationException - will be generate the exception BackupConfigurationException
      javax.jcr.RepositoryException - will be generate the exception RepositoryException
      org.exoplatform.services.jcr.config.RepositoryConfigurationException - will be generate the exception RepositoryConfigurationException
    • restore

      public void restore(RepositoryBackupChainLog rblog, org.exoplatform.services.jcr.config.RepositoryEntry repositoryEntry, Map<String,String> workspaceNamesCorrespondMap, boolean asynchronous) throws BackupOperationException, BackupConfigurationException, javax.jcr.RepositoryException, org.exoplatform.services.jcr.config.RepositoryConfigurationException
      Repository restore from backup.
      Specified by:
      restore in interface BackupManager
      Parameters:
      rblog - RepositoryBackupChainLog, the repository backup log
      repositoryEntry - RepositoryEntry, the repository entry
      workspaceNamesCorrespondMap - the map with correspondence workspace name in RepositoryEntry and RepositoryBackupChainLog.
      asynchronous - boolean, in 'true' then asynchronous restore.
      Throws:
      BackupOperationException - will be generate the exception BackupOperationException
      BackupConfigurationException - will be generate the exception BackupConfigurationException
      javax.jcr.RepositoryException - will be generate the exception RepositoryException
      org.exoplatform.services.jcr.config.RepositoryConfigurationException - will be generate the exception RepositoryConfigurationException
    • startBackup

      public RepositoryBackupChain startBackup(RepositoryBackupConfig config) throws BackupOperationException, BackupConfigurationException, javax.jcr.RepositoryException, org.exoplatform.services.jcr.config.RepositoryConfigurationException
      Starting repository backup.
      Specified by:
      startBackup in interface BackupManager
      Parameters:
      config - RepositoryBackupConfig, the backup configuration to repository
      Returns:
      RepositoryBackupChain return the repository backup chain
      Throws:
      BackupOperationException - BackupOperationException will be generate the exception BackupOperationException
      BackupConfigurationException - will be generate the exception BackupConfigurationException
      javax.jcr.RepositoryException - will be generate the exception RepositoryException
      org.exoplatform.services.jcr.config.RepositoryConfigurationException - will be generate the exception RepositoryConfigurationException
    • stopBackup

      public void stopBackup(RepositoryBackupChain backup)
      Stop backup.
      Specified by:
      stopBackup in interface BackupManager
      Parameters:
      backup - RepositoryBackupChain, the repositroy backup chain
    • findRepositoryBackup

      public RepositoryBackupChain findRepositoryBackup(String repository)
      Finding current backup by repository.
      Specified by:
      findRepositoryBackup in interface BackupManager
      Parameters:
      repository - String, the repository name
      Returns:
      RepositoryBackupChain return the current backup to repository
    • getCurrentRepositoryBackups

      public Set<RepositoryBackupChain> getCurrentRepositoryBackups()
      Getting current repository backups.
      Specified by:
      getCurrentRepositoryBackups in interface BackupManager
      Returns:
      Set return the set of current backups
    • findRepositoryBackupId

      public RepositoryBackupChain findRepositoryBackupId(String backupId)
      Finding current backup by id.
      Specified by:
      findRepositoryBackupId in interface BackupManager
      Parameters:
      backupId - String, the repository name
      Returns:
      RepositoryBackupChain return the current backup to repository
    • restoreExistingRepository

      public void restoreExistingRepository(RepositoryBackupChainLog rblog, org.exoplatform.services.jcr.config.RepositoryEntry repositoryEntry, boolean asynchronous) throws BackupOperationException, BackupConfigurationException
      Restore existing repository. Previous data will be deleted. For getting status of repository restore can use BackupManager.getLastRestore(String repositoryName) method
      Specified by:
      restoreExistingRepository in interface ExtendedBackupManager
      Parameters:
      rblog - repository backup log
      repositoryEntry - new repository configuration
      asynchronous - if 'true' restore will be in asynchronous mode (i.e. in separated thread)
      Throws:
      BackupOperationException - if backup operation exception occurred
      BackupConfigurationException - if configuration exception occurred
    • restoreExistingRepository

      public void restoreExistingRepository(String repositoryBackupIdentifier, org.exoplatform.services.jcr.config.RepositoryEntry repositoryEntry, boolean asynchronous) throws BackupOperationException, BackupConfigurationException
      Restore existing repository. Previous data will be deleted. For getting status of repository restore can use BackupManager.getLastRestore(String repositoryName) method
      Specified by:
      restoreExistingRepository in interface ExtendedBackupManager
      Parameters:
      repositoryBackupIdentifier - backup identifier
      repositoryEntry - new repository configuration
      asynchronous - if 'true' restore will be in asynchronous mode (i.e. in separated thread)
      Throws:
      BackupOperationException - if backup operation exception occurred
      BackupConfigurationException - if configuration exception occurred
    • restoreExistingWorkspace

      public void restoreExistingWorkspace(BackupChainLog log, String repositoryName, org.exoplatform.services.jcr.config.WorkspaceEntry workspaceEntry, boolean asynchronous) throws BackupOperationException, BackupConfigurationException
      Restore existing workspace. Previous data will be deleted. For getting status of workspace restore can use BackupManager.getLastRestore(String repositoryName, String workspaceName) method
      Specified by:
      restoreExistingWorkspace in interface ExtendedBackupManager
      Parameters:
      log - workspace backup log
      workspaceEntry - new workspace configuration
      asynchronous - if 'true' restore will be in asynchronous mode (i.e. in separated thread)
      Throws:
      BackupOperationException - if backup operation exception occurred
      BackupConfigurationException - if configuration exception occurred
    • restoreExistingWorkspace

      public void restoreExistingWorkspace(String workspaceBackupIdentifier, String repositoryName, org.exoplatform.services.jcr.config.WorkspaceEntry workspaceEntry, boolean asynchronous) throws BackupOperationException, BackupConfigurationException
      Restore existing workspace. Previous data will be deleted. For getting status of workspace restore can use BackupManager.getLastRestore(String repositoryName, String workspaceName) method
      Specified by:
      restoreExistingWorkspace in interface ExtendedBackupManager
      Parameters:
      workspaceBackupIdentifier - backup identifier
      workspaceEntry - new workspace configuration
      asynchronous - if 'true' restore will be in asynchronous mode (i.e. in separated thread)
      Throws:
      BackupOperationException - if backup operation exception occurred
      BackupConfigurationException - if configuration exception occurred
    • restoreExistingRepository

      public void restoreExistingRepository(String repositoryBackupIdentifier, boolean asynchronous) throws BackupOperationException, BackupConfigurationException
      Restore existing repository. Previous data will be deleted. For getting status of repository restore can use BackupManager.getLastRestore(String repositoryName) method. ReprositoryEntry for restore should be contains in BackupChainLog.
      Specified by:
      restoreExistingRepository in interface ExtendedBackupManager
      Parameters:
      repositoryBackupIdentifier - identifier to repository backup.
      asynchronous - if 'true' restore will be in asynchronous mode (i.e. in separated thread)
      Throws:
      BackupOperationException - if backup operation exception occurred
      BackupConfigurationException - if configuration exception occurred
    • restoreExistingWorkspace

      public void restoreExistingWorkspace(String workspaceBackupIdentifier, boolean asynchronous) throws BackupOperationException, BackupConfigurationException
      Restore existing workspace. Previous data will be deleted. For getting status of workspace restore can use BackupManager.getLastRestore(String repositoryName, String workspaceName) method WorkspaceEntry for restore should be contains in BackupChainLog.
      Specified by:
      restoreExistingWorkspace in interface ExtendedBackupManager
      Parameters:
      workspaceBackupIdentifier - identifier to workspace backup.
      asynchronous - if 'true' restore will be in asynchronous mode (i.e. in separated thread)
      Throws:
      BackupOperationException - if backup operation exception occurred
      BackupConfigurationException - if configuration exception occurred
    • restoreRepository

      public void restoreRepository(String repositoryBackupIdentifier, boolean asynchronous) throws BackupOperationException, BackupConfigurationException
      ReprositoryEntry for restore should be contains in BackupChainLog.
      Specified by:
      restoreRepository in interface ExtendedBackupManager
      Parameters:
      repositoryBackupIdentifier - identifier to repository backup.
      asynchronous - if 'true' restore will be in asynchronous mode (i.e. in separated thread)
      Throws:
      BackupOperationException - if backup operation exception occurred
      BackupConfigurationException - if configuration exception occurred
    • restoreWorkspace

      public void restoreWorkspace(String workspaceBackupIdentifier, boolean asynchronous) throws BackupOperationException, BackupConfigurationException
      WorkspaceEntry for restore should be contains in BackupChainLog.
      Specified by:
      restoreWorkspace in interface ExtendedBackupManager
      Parameters:
      workspaceBackupIdentifier - identifier to workspace backup.
      asynchronous - if 'true' restore will be in asynchronous mode (i.e. in separated thread)
      Throws:
      BackupOperationException - if backup operation exception occurred
      BackupConfigurationException - if configuration exception occurred
    • restoreExistingRepository

      public void restoreExistingRepository(File repositoryBackupSetDir, boolean asynchronous) throws BackupOperationException, BackupConfigurationException
      Restore existing repository. Previous data will be deleted. For getting status of repository restore can use BackupManager.getLastRestore(String repositoryName) method. ReprositoryEntry for restore should be contains in BackupChainLog.
      Specified by:
      restoreExistingRepository in interface ExtendedBackupManager
      Parameters:
      repositoryBackupSetDir - the directory with backup set
      asynchronous - if 'true' restore will be in asynchronous mode (i.e. in separated thread)
      Throws:
      BackupOperationException - if backup operation exception occurred
      BackupConfigurationException - if configuration exception occurred
    • restoreExistingWorkspace

      public void restoreExistingWorkspace(File workspaceBackupSetDir, boolean asynchronous) throws BackupOperationException, BackupConfigurationException
      Restore existing workspace. Previous data will be deleted. For getting status of workspace restore can use BackupManager.getLastRestore(String repositoryName, String workspaceName) method WorkspaceEntry for restore should be contains in BackupChainLog.
      Specified by:
      restoreExistingWorkspace in interface ExtendedBackupManager
      Parameters:
      workspaceBackupSetDir - the directory with backup set
      asynchronous - if 'true' restore will be in asynchronous mode (i.e. in separated thread)
      Throws:
      BackupOperationException - if backup operation exception occurred
      BackupConfigurationException - if configuration exception occurred
    • restoreRepository

      public void restoreRepository(File repositoryBackupSetDir, boolean asynchronous) throws BackupOperationException, BackupConfigurationException
      ReprositoryEntry for restore should be contains in BackupChainLog.
      Specified by:
      restoreRepository in interface ExtendedBackupManager
      Parameters:
      repositoryBackupSetDir - the directory with backup set
      asynchronous - if 'true' restore will be in asynchronous mode (i.e. in separated thread)
      Throws:
      BackupOperationException - if backup operation exception occurred
      BackupConfigurationException - if configuration exception occurred
    • restoreWorkspace

      public void restoreWorkspace(File workspaceBackupSetDir, boolean asynchronous) throws BackupOperationException, BackupConfigurationException
      WorkspaceEntry for restore should be contains in BackupChainLog.
      Specified by:
      restoreWorkspace in interface ExtendedBackupManager
      Parameters:
      workspaceBackupSetDir - the directory with backup set
      asynchronous - if 'true' restore will be in asynchronous mode (i.e. in separated thread)
      Throws:
      BackupOperationException - if backup operation exception occurred
      BackupConfigurationException - if configuration exception occurred