@Service(value="blDefaultFileServiceProvider") public class FileSystemFileServiceProvider extends Object implements FileServiceProvider
Modifier and Type | Field and Description |
---|---|
protected String |
baseDirectory |
protected BroadleafFileServiceExtensionManager |
extensionManager |
protected String |
fileSystemBaseDirectory |
protected int |
maxGeneratedDirectoryDepth |
Constructor and Description |
---|
FileSystemFileServiceProvider() |
Modifier and Type | Method and Description |
---|---|
void |
addOrUpdateResources(FileWorkArea workArea,
List<File> files,
boolean removeFilesFromWorkArea)
Deprecated.
|
List<String> |
addOrUpdateResourcesForPaths(FileWorkArea workArea,
List<File> files,
boolean removeFilesFromWorkArea)
Adds all of the given files and returns the resource names of all of them suitable for invoking
FileServiceProvider.getResource(String) and/or FileServiceProvider.removeResource(String) |
protected String |
buildResourceName(String url)
Stores the file on the file-system by performing an MD5 hash of the
the passed in fileName
To ensure that files can be stored and accessed in an efficient manner, the
system creates directories based on the characters in the hash.
|
protected String |
getBaseDirectory(boolean skipSite)
Returns a base directory (unique for each tenant in a multi-tenant installation.
|
File |
getResource(String url)
Returns a File representing the passed in url.
|
File |
getResource(String url,
FileApplicationType applicationType)
Returns a File representing the passed in name and application type.
|
protected String |
getSiteDirectory(String baseDirectory)
Creates a unique directory on the file system for each site.
|
boolean |
removeResource(String name)
Removes the resource from the file service.
|
@Value(value="${asset.server.file.system.path}") protected String fileSystemBaseDirectory
@Value(value="${asset.server.max.generated.file.system.directories}") protected int maxGeneratedDirectoryDepth
protected BroadleafFileServiceExtensionManager extensionManager
protected String baseDirectory
public File getResource(String url)
FileServiceProvider
getResource
in interface FileServiceProvider
public File getResource(String url, FileApplicationType applicationType)
FileServiceProvider
getResource
in interface FileServiceProvider
url
- - the URL-representation of the resource. This means that paths should always have / separators rather than
system-specific valuesapplicationType
- applicationType@Deprecated public void addOrUpdateResources(FileWorkArea workArea, List<File> files, boolean removeFilesFromWorkArea)
FileServiceProvider
addOrUpdateResources
in interface FileServiceProvider
files
- the files that should be copiedpublic List<String> addOrUpdateResourcesForPaths(FileWorkArea workArea, List<File> files, boolean removeFilesFromWorkArea)
FileServiceProvider
FileServiceProvider.getResource(String)
and/or FileServiceProvider.removeResource(String)
addOrUpdateResourcesForPaths
in interface FileServiceProvider
public boolean removeResource(String name)
FileServiceProvider
removeResource
in interface FileServiceProvider
name
- - fully qualified path to the resourceprotected String buildResourceName(String url)
url
- The URL used to represent an asset for which a name on the fileSystem is desired.protected String getBaseDirectory(boolean skipSite)
protected String getSiteDirectory(String baseDirectory)
The
- starting directory for local files which must end with a '/';Copyright © 2022. All rights reserved.