Interface TemporaryStorage

All Known Implementing Classes:
TemporaryStorageImpl

public interface TemporaryStorage
API for uploading files to the temporary storage.
  • Method Details

    • saveFile

      UUID saveFile(byte[] data)
      Store the byte array in a new temporary file.
      Parameters:
      data - file contents
      Returns:
      temporary file ID. This ID is cached in memory and can be used for subsequent operations.
    • saveFile

      UUID saveFile(InputStream stream, @Nullable TemporaryStorage.UploadProgressListener listener)
      Store the content of stream in a new temporary file.
      Parameters:
      stream - stream which content is to be stored
      listener - optional listener to be notified about storing progress
      Returns:
      temporary file ID. This ID is cached in memory and can be used for subsequent operations.
    • createFile

      Create a new empty temporary file and cache its ID for subsequent operations.
      Returns:
      the new temporary file ID
      Throws:
      FileStorageException - in case of IO problems
    • getFile

      @Nullable File getFile(UUID fileId)
      Return a previously registered temporary file by its ID.
      Parameters:
      fileId - temporary file ID
      Returns:
      temporary file object or null if no file registered under this ID
    • deleteFile

      void deleteFile(UUID fileId)
      Remove a file from the temporary storage.
      This method is automatically called from putFileIntoStorage() when the file is successfully stored on the middleware.
      Parameters:
      fileId - temporary file ID
      Throws:
      FileStorageException - in case of IO problems
    • deleteFileLink

      void deleteFileLink(String fileName)
      Remove an entry from the list of currently cached temporary file IDs, if such exists. This method is used by the framework when cleaning up the temp folder.
      Parameters:
      fileName - absolute path to the temporary file
    • putFileIntoStorage

      FileRef putFileIntoStorage(UUID fileId, String fileName, FileStorage fileStorage)
      Uploads a file from the temporary storage to the FileStorage.
      Parameters:
      fileId - temporary file ID
      fileName - file name
      fileStorage - file storage
    • putFileIntoStorage

      FileRef putFileIntoStorage(UUID fileId, String fileName)
      Uploads a file from the temporary storage to the default FileStorage, which is determined by calling FileStorageLocator.getDefault().
      Parameters:
      fileId - temporary file ID
      fileName - file name