Class FileSystemBackupService

java.lang.Object
net.solarnetwork.node.backup.BackupServiceSupport
net.solarnetwork.node.backup.FileSystemBackupService
All Implemented Interfaces:
BackupService, net.solarnetwork.settings.SettingSpecifierProvider

public class FileSystemBackupService extends BackupServiceSupport implements net.solarnetwork.settings.SettingSpecifierProvider
BackupService implementation that copies files to another location in the file system.
Version:
2.0
Author:
matt
  • Field Details

  • Constructor Details

    • FileSystemBackupService

      public FileSystemBackupService()
  • Method Details

    • getSettingUid

      public String getSettingUid()
      Specified by:
      getSettingUid in interface net.solarnetwork.settings.SettingSpecifierProvider
    • getDisplayName

      public String getDisplayName()
      Specified by:
      getDisplayName in interface net.solarnetwork.settings.SettingSpecifierProvider
    • getMessageSource

      public org.springframework.context.MessageSource getMessageSource()
      Specified by:
      getMessageSource in interface net.solarnetwork.settings.SettingSpecifierProvider
    • setMessageSource

      public void setMessageSource(org.springframework.context.MessageSource messageSource)
      Set the message source.
      Parameters:
      messageSource - the message source to set
    • getSettingSpecifiers

      public List<net.solarnetwork.settings.SettingSpecifier> getSettingSpecifiers()
      Specified by:
      getSettingSpecifiers in interface net.solarnetwork.settings.SettingSpecifierProvider
    • getKey

      public String getKey()
      Description copied from interface: BackupService
      Get a unique key for this service.

      This key should be unique among all possible implementations of BackupService.

      Specified by:
      getKey in interface BackupService
      Returns:
      a unique key
    • getInfo

      public BackupServiceInfo getInfo()
      Description copied from interface: BackupService
      Get general status information about the service.
      Specified by:
      getInfo in interface BackupService
      Returns:
      status info (never null)
    • backupForKey

      public Backup backupForKey(String key)
      Description copied from interface: BackupService
      Get a backup for a given backup key.
      Specified by:
      backupForKey in interface BackupService
      Parameters:
      key - the key
      Returns:
      the backup
    • performBackup

      public Backup performBackup(Iterable<BackupResource> resources)
      Description copied from interface: BackupService
      Execute a backup now.

      This method may block until the backup completes.

      Specified by:
      performBackup in interface BackupService
      Parameters:
      resources - the resources to include in the backup
      Returns:
      backup instance
    • getBackupResources

      public BackupResourceIterable getBackupResources(Backup backup)
      Description copied from interface: BackupService
      Get the resources for a specific backup.
      Specified by:
      getBackupResources in interface BackupService
      Parameters:
      backup - the backup to get the resources for
      Returns:
      an Iterable for the backup resources
    • importBackup

      public Backup importBackup(Date date, BackupResourceIterable resources, Map<String,String> props)
      Description copied from interface: BackupService
      Import a set of backup resources as a new Backup.
      Specified by:
      importBackup in interface BackupService
      Parameters:
      date - The backup date, or null if not known.
      resources - The resources to include in the backup.
      props - An optional map of properties to pass to the import process. The BackupManager.BACKUP_KEY property can be used to provide a proposed backup key.
      Returns:
      A backup instance for the imported resources.
    • removeAllBackups

      public void removeAllBackups()
      Delete any existing backups.
    • getAvailableBackups

      public Collection<Backup> getAvailableBackups()
      Description copied from interface: BackupService
      Get a collection of Backup instances known by this service.

      These should be ideally ordered in newest to oldest order.

      Specified by:
      getAvailableBackups in interface BackupService
      Returns:
      the available backups, never null
    • getSettingSpecifierProvider

      public net.solarnetwork.settings.SettingSpecifierProvider getSettingSpecifierProvider()
      Description copied from interface: BackupService
      Get a SettingSpecifierProvider for this service.
      Specified by:
      getSettingSpecifierProvider in interface BackupService
      Returns:
      provider, or null if not supported
    • getSettingSpecifierProviderForRestore

      public net.solarnetwork.settings.SettingSpecifierProvider getSettingSpecifierProviderForRestore()
      Description copied from interface: BackupService
      Get a SettingSpecifierProvider for this service, when restoring from an existing backup.
      Specified by:
      getSettingSpecifierProviderForRestore in interface BackupService
      Returns:
      provider, or null if not supported
    • getBackupDir

      public File getBackupDir()
      Get the directory to backup to.
      Returns:
      the backup directory
    • setBackupDir

      public void setBackupDir(File backupDir)
      Set the directory to backup to.
      Parameters:
      backupDir - the directory to use
    • getAdditionalBackupCount

      public int getAdditionalBackupCount()
      Get the number of additional backups to maintain.
      Returns:
      the additional backup count
    • setAdditionalBackupCount

      public void setAdditionalBackupCount(int additionalBackupCount)
      Set the number of additional backups to maintain.

      If greater than zero, then this service will maintain this many copies of past backups.

      Parameters:
      additionalBackupCount - the additional backup count to use
    • getIdentityService

      public net.solarnetwork.service.OptionalService<IdentityService> getIdentityService()
      Get the identity service.
      Returns:
      the service
    • setIdentityService

      public void setIdentityService(net.solarnetwork.service.OptionalService<IdentityService> identityService)
      Set the identity service.
      Parameters:
      identityService - the service to use