public class ServerFilePathTransformer extends Object
Constructor and Description |
---|
ServerFilePathTransformer() |
Modifier and Type | Method and Description |
---|---|
FsFile |
getFsFileFromServerFile(File serverFile)
Given a server-local
File , returns the corresponding repository path. |
com.google.common.base.Function<String,String> |
getPathSanitizer()
Get the string transformer that is used to make file-path components safe across platforms.
|
File |
getServerFileFromFsFile(FsFile fsFile)
Given a repository path, returns the corresponding server-local
File . |
boolean |
isLegalFsFile(FsFile fsFile)
Test if the given
FsFile has been properly sanitized by the client. |
void |
setBaseDirFile(File baseDirFile)
Set the repository root directory, to which
FsFile instances are considered to be relative. |
void |
setPathSanitizer(com.google.common.base.Function<String,String> pathSanitizer)
Set the string transformer that is used to make file-path components safe across platforms.
|
public File getServerFileFromFsFile(FsFile fsFile)
File
.
Must be executed server-side.fsFile
- a repository pathFile
public FsFile getFsFileFromServerFile(File serverFile) throws IOException
File
, returns the corresponding repository path.
Must be executed server-side.serverFile
- a server-local File
within the repositoryIOException
- if the absolute path of the File
could not be foundpublic boolean isLegalFsFile(FsFile fsFile)
FsFile
has been properly sanitized by the client.fsFile
- a repository pathpublic com.google.common.base.Function<String,String> getPathSanitizer()
public void setPathSanitizer(com.google.common.base.Function<String,String> pathSanitizer)
pathSanitizer
- the file-path component string transformerpublic void setBaseDirFile(File baseDirFile)
FsFile
instances are considered to be relative.baseDirFile
- the repository root directoryIOException
- if the absolute path of the root directory could not be foundIllegalArgumentException
- if the root directory does not exist
Version: 5.2.8-ice35-b57
Copyright © 2017 The University of Dundee & Open Microscopy Environment. All Rights Reserved.