Class StaticFileServiceImpl
java.lang.Object
org.opencastproject.staticfiles.impl.StaticFileServiceImpl
- All Implemented Interfaces:
StaticFileService
Stores and retrieves static file resources.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe key to find the root directory for the static file service in the OSGi properties. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(org.osgi.service.component.ComponentContext cc) OSGI callback for activating this componentvoidCallback from OSGi on service deactivation.voiddeleteFile(String uuid) Deletes a static file.getContentLength(String uuid) Returns the content length of a file stored in the static file service.Returns anInputStreamto read a file from the static file service by its UUID.getFileName(String uuid) Returns the original filename of a file stored in the static file service.voidpersistFile(String uuid) Persists a file that was previously uploaded to the temporary storage section with#storeFile(String, InputStream)for long-term usage.voidsetOrganizationDirectoryService(OrganizationDirectoryService directoryService) OSGi DIvoidsetSecurityService(SecurityService securityService) OSGi DIstoreFile(String filename, InputStream inputStream) Stores a file in the temporary storage section of the static file service.
-
Field Details
-
STATICFILES_ROOT_DIRECTORY_KEY
The key to find the root directory for the static file service in the OSGi properties.- See Also:
-
-
Constructor Details
-
StaticFileServiceImpl
public StaticFileServiceImpl()
-
-
Method Details
-
activate
public void activate(org.osgi.service.component.ComponentContext cc) OSGI callback for activating this component- Parameters:
cc- the osgi component context
-
deactivate
public void deactivate()Callback from OSGi on service deactivation. -
setSecurityService
OSGi DI -
setOrganizationDirectoryService
OSGi DI -
storeFile
Description copied from interface:StaticFileServiceStores a file in the temporary storage section of the static file service. Make sure you callStaticFileService.persistFile(String)if you want to persist a file durable. A file that is stored in the temporary storage section may be removed at any time without notice!- Specified by:
storeFilein interfaceStaticFileService- Parameters:
filename- The filename and extension for the file.inputStream- TheInputStreamthat represents the file itself.- Returns:
- A UUID that represents the static file.
- Throws:
IOException- Thrown if there is a problem storing the file.
-
getFile
Description copied from interface:StaticFileServiceReturns anInputStreamto read a file from the static file service by its UUID.- Specified by:
getFilein interfaceStaticFileService- Parameters:
uuid- The UUID of the file.- Returns:
- The input stream to read the file
- Throws:
NotFoundException- Thrown if the file cannot be found.IOException- If the file could not be read.
-
persistFile
Description copied from interface:StaticFileServicePersists a file that was previously uploaded to the temporary storage section with#storeFile(String, InputStream)for long-term usage.- Specified by:
persistFilein interfaceStaticFileService- Parameters:
uuid- The UUID of the file to persist.- Throws:
NotFoundException- If the file could not be found.IOException
-
deleteFile
Description copied from interface:StaticFileServiceDeletes a static file.- Specified by:
deleteFilein interfaceStaticFileService- Parameters:
uuid- The uuid of the static file.- Throws:
NotFoundException- if the file cannot be found.IOException
-
getFileName
Description copied from interface:StaticFileServiceReturns the original filename of a file stored in the static file service.- Specified by:
getFileNamein interfaceStaticFileService- Parameters:
uuid- The UUID of the file.- Returns:
- The filename.
- Throws:
NotFoundException- If the file with the given UUID was not found.
-
getContentLength
Description copied from interface:StaticFileServiceReturns the content length of a file stored in the static file service.- Specified by:
getContentLengthin interfaceStaticFileService- Parameters:
uuid- The UUID of the file.- Returns:
- The content length.
- Throws:
NotFoundException- If the file with the given UUID was not found.
-