FileSystem

public class FileSystem

Fields

base32Pattern

public static final Pattern base32Pattern

Methods

assertDir

public static final String assertDir(String sessionString)

Asserts that a temporary directory for this session exists, creating it if necessary.

Parameters:
  • sessionString – The session string for which the directory is guaranteed to exist after calling this function. If session is Null, a random directory will be created.

Returns:

A String with the existing directory.

checkTarget

public static boolean checkTarget(EntityInterface entity, Access access, TransactionBenchmark b)

Checks if a target path is consistent with the server’s configuration and the file system.

Parameters:
  • entity

Throws:

getBasepath

public static String getBasepath()

getDropOffBox

public static String getDropOffBox()

getFromFileSystem

public static File getFromFileSystem(String path)

Get the file from the internal file system. Returns null if the file does not exist.

Parameters:
  • path

getFromShared

public static File getFromShared(String path)

Get the file from the shared files folder.

Conditions under which null is returned:

The file does not exist.The file is a folder.The requested path is just a file, without parent folders.The requested path is not normalized.The first component of the path does not match the base32 pattern for shared folders.

Parameters:
  • path – The path to the requested file.

Returns:

File

getPath

public static String getPath(String location)

Return the canonical path on the native file system of the server’s host which is guaranteed to be a valid path under the server’s internal file system.

Parameters:
  • location

Throws:
  • Message – TARGET_PATH_NOT_ALLOWED if location does not belong to the file system.

Returns:

A canonical path.

getShared

public static String getShared()

getTmp

public static String getTmp()

init

public static void init()

pickUp

public static final FileProperties pickUp(String path, String session)

Pick up file from DropOffBox and load it into tmp dir.

Parameters:
  • path

  • session

Throws:
Returns:

A FileProperties Object which represents the object in the tmp dir.

upload

public static final FileProperties upload(FileItemStream item, String session)

Reads a FileItemStream and stores the file into the tmpfolder. Generates FileProperties.

Parameters:
  • item

  • session

Throws:
Returns:

FileProperties of the uploaded File.