@Service(value="blDefaultFileServiceProvider") public class FileSystemFileServiceProvider extends Object implements FileServiceProvider
Modifier and Type | Field and Description |
---|---|
protected String |
baseDirectory |
protected String |
fileSystemBaseDirectory |
protected int |
maxGeneratedDirectoryDepth |
Constructor and Description |
---|
FileSystemFileServiceProvider() |
Modifier and Type | Method and Description |
---|---|
void |
addOrUpdateResources(FileWorkArea area,
List<File> files,
boolean removeResourcesFromWorkArea)
Takes in a work area and application type and moves all of the files to the configured FileProvider.
|
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()
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 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
- applicationTypepublic void addOrUpdateResources(FileWorkArea area, List<File> files, boolean removeResourcesFromWorkArea)
FileServiceProvider
addOrUpdateResources
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()
protected String getSiteDirectory(String baseDirectory)
The
- starting directory for local files which must end with a '/';Copyright © 2014. All rights reserved.