Class FileBackupResourceProvider

java.lang.Object
net.solarnetwork.node.backup.FileBackupResourceProvider
All Implemented Interfaces:
BackupResourceProvider

public class FileBackupResourceProvider extends Object implements BackupResourceProvider
BackupResourceProvider for node files, such as installed application bundle JARs.
Version:
1.2
Author:
matt
  • Field Details

    • log

      protected final org.slf4j.Logger log
      A class-level logger.
  • Constructor Details

    • FileBackupResourceProvider

      public FileBackupResourceProvider()
      Default constructor.
  • Method Details

    • getKey

      public String getKey()
      Description copied from interface: BackupResourceProvider
      Get a key, unique among all other BackupResourceProvider instances.

      The key should contain only alpha-numeric and/or the period characters. A good candidate is the full class name of the provider.

      Specified by:
      getKey in interface BackupResourceProvider
      Returns:
      the provider key
    • getBackupResources

      public Iterable<BackupResource> getBackupResources()
      Description copied from interface: BackupResourceProvider
      Get the resources that should be backed up.
      Specified by:
      getBackupResources in interface BackupResourceProvider
      Returns:
      the resources, never null
    • restoreBackupResource

      public boolean restoreBackupResource(BackupResource resource)
      Description copied from interface: BackupResourceProvider
      Restore a BackupResource.
      Specified by:
      restoreBackupResource in interface BackupResourceProvider
      Parameters:
      resource - the resource to restore
      Returns:
      true if successful, false otherwise
    • providerInfo

      public BackupResourceProviderInfo providerInfo(Locale locale)
      Description copied from interface: BackupResourceProvider
      Get info about the provider.
      Specified by:
      providerInfo in interface BackupResourceProvider
      Parameters:
      locale - The desired locale of the information, or null for the system locale.
      Returns:
      The info.
    • resourceInfo

      public BackupResourceInfo resourceInfo(BackupResource resource, Locale locale)
      Description copied from interface: BackupResourceProvider
      Get info about a particular resource.
      Specified by:
      resourceInfo in interface BackupResourceProvider
      Parameters:
      resource - The resource to get the information for.
      locale - The desired locale of the information, or null for the system locale.
      Returns:
      The info, or null if none available.
    • setResourceDirs

      public void setResourceDirs(String list)
      Set the resourceDirectories property as a comma-delimited string.
      Parameters:
      list - a comma-delimited list of paths
    • getResourceDirs

      public String getResourceDirs()
      Get a comma-delimited string of the configured resourceDirectories property.
      Returns:
      a comma-delimited list of paths
    • getRootPath

      public String getRootPath()
      Get the root path.
      Returns:
      the root path
    • setRootPath

      public void setRootPath(String rootPath)
      Set the root path from which resourceDirectories are relative to.

      If not provided, the system property Constants.SYSTEM_PROP_NODE_HOME will be used, and if that isn't set then the runtime working directory will be used.

      Parameters:
      rootPath - the root path to use
    • getResourceDirectories

      public String[] getResourceDirectories()
      Get an array of directory paths, relative to rootPath, to look for files to include in the backup.
      Returns:
      the paths to use
    • setResourceDirectories

      public void setResourceDirectories(String[] bundlePaths)
      Set an array of directory paths, relative to rootPath, to look for files to include in the backup.
      Parameters:
      bundlePaths - the paths to use; defaults to [app/main]
    • getFileNamePattern

      public String getFileNamePattern()
      Get the file name patter.
      Returns:
      the pattern to use
    • setFileNamePattern

      public void setFileNamePattern(String fileNamePattern)
      Set a regexp used to match against files found in the resourceDirectories.

      Only files matching this expression are included in the backup.

      Parameters:
      fileNamePattern - the pattern to use; defaults to \.jar$
    • setMessageSource

      public void setMessageSource(org.springframework.context.MessageSource messageSource)
      Set the MessageSource to resolve localized messages with.
      Parameters:
      messageSource - The message source.
    • getMessageSource

      public org.springframework.context.MessageSource getMessageSource()
      Get the configured MessageSource.
      Returns:
      the message source