Package net.solarnetwork.node.backup
Class FileBackupResourceProvider
java.lang.Object
net.solarnetwork.node.backup.FileBackupResourceProvider
- All Implemented Interfaces:
BackupResourceProvider
BackupResourceProvider for node files, such as installed application
bundle JARs.- Version:
- 1.2
- Author:
- matt
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the resources that should be backed up.Get the file name patter.getKey()Get a key, unique among all otherBackupResourceProviderinstances.org.springframework.context.MessageSourceGet the configuredMessageSource.String[]Get an array of directory paths, relative torootPath, to look for files to include in the backup.Get a comma-delimited string of the configuredresourceDirectoriesproperty.Get the root path.providerInfo(Locale locale) Get info about the provider.resourceInfo(BackupResource resource, Locale locale) Get info about a particular resource.booleanrestoreBackupResource(BackupResource resource) Restore aBackupResource.voidsetFileNamePattern(String fileNamePattern) Set a regexp used to match against files found in theresourceDirectories.voidsetMessageSource(org.springframework.context.MessageSource messageSource) Set theMessageSourceto resolve localized messages with.voidsetResourceDirectories(String[] bundlePaths) Set an array of directory paths, relative torootPath, to look for files to include in the backup.voidsetResourceDirs(String list) Set theresourceDirectoriesproperty as a comma-delimited string.voidsetRootPath(String rootPath) Set the root path from whichresourceDirectoriesare relative to.
-
Field Details
-
log
protected final org.slf4j.Logger logA class-level logger.
-
-
Constructor Details
-
FileBackupResourceProvider
public FileBackupResourceProvider()
-
-
Method Details
-
getKey
Description copied from interface:BackupResourceProviderGet a key, unique among all otherBackupResourceProviderinstances.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:
getKeyin interfaceBackupResourceProvider- Returns:
- the provider key
-
getBackupResources
Description copied from interface:BackupResourceProviderGet the resources that should be backed up.- Specified by:
getBackupResourcesin interfaceBackupResourceProvider- Returns:
- the resources, never null
-
restoreBackupResource
Description copied from interface:BackupResourceProviderRestore aBackupResource.- Specified by:
restoreBackupResourcein interfaceBackupResourceProvider- Parameters:
resource- the resource to restore- Returns:
- true if successful, false otherwise
-
providerInfo
Description copied from interface:BackupResourceProviderGet info about the provider.- Specified by:
providerInfoin interfaceBackupResourceProvider- Parameters:
locale- The desired locale of the information, or null for the system locale.- Returns:
- The info.
-
resourceInfo
Description copied from interface:BackupResourceProviderGet info about a particular resource.- Specified by:
resourceInfoin interfaceBackupResourceProvider- 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
Set theresourceDirectoriesproperty as a comma-delimited string.- Parameters:
list- a comma-delimited list of paths
-
getResourceDirs
Get a comma-delimited string of the configuredresourceDirectoriesproperty.- Returns:
- a comma-delimited list of paths
-
getRootPath
Get the root path.- Returns:
- the root path
-
setRootPath
Set the root path from whichresourceDirectoriesare relative to.If not provided, the system property
Constants.SYSTEM_PROP_NODE_HOMEwill be used, and if that isn't set then the runtime working directory will be used.- Parameters:
rootPath- the root path to use
-
getResourceDirectories
Get an array of directory paths, relative torootPath, to look for files to include in the backup.- Returns:
- the paths to use
-
setResourceDirectories
Set an array of directory paths, relative torootPath, to look for files to include in the backup.- Parameters:
bundlePaths- the paths to use; defaults to [app/main]
-
getFileNamePattern
Get the file name patter.- Returns:
- the pattern to use
-
setFileNamePattern
Set a regexp used to match against files found in theresourceDirectories.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 theMessageSourceto resolve localized messages with.- Parameters:
messageSource- The message source.
-
getMessageSource
public org.springframework.context.MessageSource getMessageSource()Get the configuredMessageSource.- Returns:
- the message source
-