public class ServerFilePathTransformer
extends java.lang.Object
FsFile
path and server-local File
.Constructor and Description |
---|
ServerFilePathTransformer() |
Modifier and Type | Method and Description |
---|---|
FsFile |
getFsFileFromServerFile(java.io.File serverFile)
Given a server-local
File , returns the corresponding repository path. |
com.google.common.base.Function<java.lang.String,java.lang.String> |
getPathSanitizer()
Get the string transformer that is used to make file-path components safe across platforms.
|
java.io.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(java.io.File baseDirFile)
Set the repository root directory, to which
FsFile instances are considered to be relative. |
void |
setPathSanitizer(com.google.common.base.Function<java.lang.String,java.lang.String> pathSanitizer)
Set the string transformer that is used to make file-path components safe across platforms.
|
public java.io.File getServerFileFromFsFile(FsFile fsFile)
File
.
Must be executed server-side.fsFile
- a repository pathFile
public FsFile getFsFileFromServerFile(java.io.File serverFile) throws java.io.IOException
File
, returns the corresponding repository path.
Must be executed server-side.serverFile
- a server-local File
within the repositoryjava.io.IOException
- 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<java.lang.String,java.lang.String> getPathSanitizer()
public void setPathSanitizer(com.google.common.base.Function<java.lang.String,java.lang.String> pathSanitizer)
pathSanitizer
- the file-path component string transformerpublic void setBaseDirFile(java.io.File baseDirFile)
FsFile
instances are considered to be relative.baseDirFile
- the repository root directoryjava.io.IOException
- if the absolute path of the root directory could not be foundjava.lang.IllegalArgumentException
- if the root directory does not exist
Version: 5.4.6-ice35-b87
Copyright © 2018 The University of Dundee & Open Microscopy Environment. All Rights Reserved.