Interface FileUploadService

All Known Implementing Classes:
FileUploadServiceImpl

public interface FileUploadService
Interface for a Service that manages upload jobs and receives and handles file parts.
  • Method Details

    • hasJob

      boolean hasJob(String id)
      Returns true is a job with the given ID exists.
      Parameters:
      id - ID of the job in question
      Returns:
      true if job exists, false otherwise
    • createJob

      FileUploadJob createJob(String filename, long fileSize, int chunkSize, MediaPackage mp, MediaPackageElementFlavor flavor) throws FileUploadException
      Creates a new upload job with the given metadata.
      Parameters:
      filename - name of the file to be uploaded
      fileSize - size of the file
      chunkSize - size of the file parts that will be uploaded
      mp - the mediapackage this file should belong to
      Returns:
      FileUploadJob the job object
      Throws:
      FileUploadException
    • getJob

      Returns the upload job with the given ID, throws FileUploadException if the job can not be found.
      Parameters:
      id - ID of the upload job to retrieve
      Returns:
      FileUploadJob the job object in question
      Throws:
      FileUploadException
    • cleanOutdatedJobs

      void cleanOutdatedJobs() throws IOException
      Cleans outdated jobs on the file system
      Throws:
      IOException
    • deleteJob

      void deleteJob(String id) throws FileUploadException
      Deletes the job permanently, thus deleting persistent data.
      Parameters:
      id - ID of the upload job to delete
      Throws:
      FileUploadException
    • acceptChunk

      void acceptChunk(FileUploadJob job, long chunk, InputStream content) throws FileUploadException
      Appends the next part to the payload and updates the upload job accordingly.
      Parameters:
      job - the job object for the upload
      chunk - the number of the chunk being transfered
      content - the actual payload data
      Throws:
      FileUploadException
    • getPayload

      Returns an InputStream containing the data from the payload.
      Parameters:
      job - job to retrieve payload data from
      Returns:
      InputStream the payload data
      Throws:
      FileUploadException