Class FileUploadServiceImpl
java.lang.Object
org.opencastproject.fileupload.service.FileUploadServiceImpl
- All Implemented Interfaces:
FileUploadService,org.osgi.service.cm.ManagedService
public class FileUploadServiceImpl
extends Object
implements FileUploadService, org.osgi.service.cm.ManagedService
A service for big file uploads via HTTP.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidacceptChunk(FileUploadJob job, long chunkNumber, InputStream content) Appends the next part to the payload and updates the upload job accordingly.protected voidactivate(org.osgi.service.component.ComponentContext cc) 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.protected voiddeactivate(org.osgi.service.component.ComponentContext cc) 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.protected voidsetIngestService(IngestService ingestService) protected voidsetWorkspace(Workspace workspace) voidupdated(Dictionary properties)
-
Constructor Details
-
FileUploadServiceImpl
public FileUploadServiceImpl()
-
-
Method Details
-
activate
- Throws:
Exception
-
deactivate
protected void deactivate(org.osgi.service.component.ComponentContext cc) -
updated
- Specified by:
updatedin interfaceorg.osgi.service.cm.ManagedService- Throws:
org.osgi.service.cm.ConfigurationException
-
setWorkspace
-
setIngestService
-
createJob
public FileUploadJob createJob(String filename, long filesize, int chunksize, MediaPackage mp, MediaPackageElementFlavor flavor) throws FileUploadException Creates a new upload job with the given metadata.- Specified by:
createJobin interfaceFileUploadService- 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- See Also:
-
hasJob
Returns true is a job with the given ID exists.- Specified by:
hasJobin interfaceFileUploadService- Parameters:
id- ID of the job in question- Returns:
- true if job exists, false otherwise
- See Also:
-
getJob
Returns the upload job with the given ID, throwsFileUploadExceptionif the job can not be found.- Specified by:
getJobin interfaceFileUploadService- Parameters:
id- ID of the upload job to retrieve- Returns:
- FileUploadJob the job object in question
- Throws:
FileUploadException- See Also:
-
cleanOutdatedJobs
Cleans outdated jobs on the file system- Specified by:
cleanOutdatedJobsin interfaceFileUploadService- Throws:
IOException- See Also:
-
deleteJob
Deletes the job permanently, thus deleting persistent data.- Specified by:
deleteJobin interfaceFileUploadService- Parameters:
id- ID of the upload job to delete- Throws:
FileUploadException- See Also:
-
acceptChunk
public void acceptChunk(FileUploadJob job, long chunkNumber, InputStream content) throws FileUploadException Description copied from interface:FileUploadServiceAppends the next part to the payload and updates the upload job accordingly.- Specified by:
acceptChunkin interfaceFileUploadService- Parameters:
job- the job object for the uploadchunkNumber- the number of the chunk being transferedcontent- the actual payload data- Throws:
FileUploadException
-
getPayload
Description copied from interface:FileUploadServiceReturns anInputStreamcontaining the data from the payload.- Specified by:
getPayloadin interfaceFileUploadService- Parameters:
job- job to retrieve payload data from- Returns:
- InputStream the payload data
- Throws:
FileUploadException
-