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 Summary
Modifier and TypeMethodDescriptionvoidacceptChunk(FileUploadJob job, long chunk, InputStream content) Appends the next part to the payload and updates the upload job accordingly.voidCleans outdated jobs on the file systemcreateJob(String filename, long fileSize, int chunkSize, MediaPackage mp, MediaPackageElementFlavor flavor) Creates a new upload job with the given metadata.voidDeletes the job permanently, thus deleting persistent data.Returns the upload job with the given ID, throwsFileUploadExceptionif the job can not be found.getPayload(FileUploadJob job) Returns anInputStreamcontaining the data from the payload.booleanReturns true is a job with the given ID exists.
-
Method Details
-
hasJob
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 uploadedfileSize- size of the filechunkSize- size of the file parts that will be uploadedmp- the mediapackage this file should belong to- Returns:
- FileUploadJob the job object
- Throws:
FileUploadException
-
getJob
Returns the upload job with the given ID, throwsFileUploadExceptionif 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
Cleans outdated jobs on the file system- Throws:
IOException
-
deleteJob
Deletes the job permanently, thus deleting persistent data.- Parameters:
id- ID of the upload job to delete- Throws:
FileUploadException
-
acceptChunk
Appends the next part to the payload and updates the upload job accordingly.- Parameters:
job- the job object for the uploadchunk- the number of the chunk being transferedcontent- the actual payload data- Throws:
FileUploadException
-
getPayload
Returns anInputStreamcontaining the data from the payload.- Parameters:
job- job to retrieve payload data from- Returns:
- InputStream the payload data
- Throws:
FileUploadException
-