Interface WorkingFileRepository
- All Superinterfaces:
StorageUsage
- All Known Implementing Classes:
WorkingFileRepositoryImpl,WorkingFileRepositoryRestEndpoint
The Working File Repository is a file storage service that supports the lecture capture system. It may be used by
other clients, but is neither intended nor required to be used by other systems.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe character encoding used for URLsstatic final StringPath prefix for collection itemsstatic final StringPath prefix for mediapackage elementsstatic final StringThe job type we use to register with the remote services managerstatic final StringPath prefix for working file repository uris -
Method Summary
Modifier and TypeMethodDescriptionbooleancleanupOldFilesFromCollection(String collectionId, long days) Cleans up collection files older than the number of days passed.booleancleanupOldFilesFromMediaPackage(long days) Cleans up media files older than the number of days passed.booleanDelete the file stored at the given media package and element IDs.booleandeleteFromCollection(String collectionId, String fileName) Removes a file from a collectionbooleandeleteFromCollection(String collectionId, String fileName, boolean removeCollection) Removes a file from a collection, and the parent folder if emptyStream the file stored under the given media package and element IDs.Gets the base URI for this service.URI[]getCollectionContents(String collectionId) Gets the URIs of the members of this collectiongetCollectionURI(String collectionID, String fileName) Get the URL for a file stored under the given collection.A textual representation of available and total storageGet the URL for a file stored under the given media package and element IDs.Get the URL for a file stored under the given media package and element IDs.moveTo(String fromCollection, String fromFileName, String toMediaPackage, String toMediaPackageElement, String toFileName) Moves a file from a collection into a mediapackageput(String mediaPackageID, String mediaPackageElementID, String filename, InputStream in) Store the data stream under the given media package and element IDs with filename as name of the file.putInCollection(String collectionId, String fileName, InputStream in) Puts a file into a collection, overwriting the existing file if present.toSafeName(String fileName) Methods inherited from interface org.opencastproject.storage.StorageUsage
getTotalSpace, getUsableSpace, getUsedSpace
-
Field Details
-
CHAR_ENCODING
The character encoding used for URLs- See Also:
-
URI_PREFIX
Path prefix for working file repository uris- See Also:
-
COLLECTION_PATH_PREFIX
Path prefix for collection items- See Also:
-
MEDIAPACKAGE_PATH_PREFIX
Path prefix for mediapackage elements- See Also:
-
SERVICE_TYPE
The job type we use to register with the remote services manager- See Also:
-
-
Method Details
-
getBaseUri
URI getBaseUri()Gets the base URI for this service.- Returns:
- The base URI
-
put
URI put(String mediaPackageID, String mediaPackageElementID, String filename, InputStream in) throws IOException, IllegalArgumentException Store the data stream under the given media package and element IDs with filename as name of the file.- Parameters:
mediaPackageID- the media package identifiermediaPackageElementID- the media package element identifierfilename- the file name to usein- the input stream- Returns:
- The URL to access this file
- Throws:
IOException- if the input stream cannot be accessed or the element cannot be written to the repositoryIllegalArgumentException- if aURIcannot be created from the arguments
-
get
InputStream get(String mediaPackageID, String mediaPackageElementID) throws IOException, NotFoundException Stream the file stored under the given media package and element IDs.- Parameters:
mediaPackageID- the media package identifiermediaPackageElementID- the media package element identifier- Returns:
- the media package element contents
- Throws:
IOException- if there is a problem reading the dataNotFoundException- if the media package element can't be found
-
getCollectionURI
Get the URL for a file stored under the given collection.- Parameters:
collectionID- the collection identifierfileName- the file name- Returns:
- the file's uri
- Throws:
IllegalArgumentException- if aURIcannot be created from the arguments
-
getURI
Get the URL for a file stored under the given media package and element IDs. This may be called for mediapackages, elements, or files that have not yet been stored in the repository.- Parameters:
mediaPackageID- the media package identifiermediaPackageElementID- the media package element identifier- Returns:
- the URI to this resource
- Throws:
IllegalArgumentException- if aURIcannot be created from the arguments
-
getURI
URI getURI(String mediaPackageID, String mediaPackageElementID, String fileName) throws IllegalArgumentException Get the URL for a file stored under the given media package and element IDs. This may be called for mediapackages, elements, or files that have not yet been stored in the repository.- Parameters:
mediaPackageID- the media package identifiermediaPackageElementID- the media package element identifierfileName- the file name- Returns:
- the URI to this resource
- Throws:
IllegalArgumentException- if aURIcannot be created from the arguments
-
toSafeName
-
delete
Delete the file stored at the given media package and element IDs.- Parameters:
mediaPackageID- the media package identifiermediaPackageElementID- the media package element identifier- Throws:
IOException- if the element cannot be deleted
-
putInCollection
Puts a file into a collection, overwriting the existing file if present.- Parameters:
collectionId- The collection identifierfileName- The filename to use in storing the input streamin- the data to store- Returns:
- The URI identifying the file
- Throws:
IOException- if the input stream cannot be accessed or the file cannot be written to the repository
-
getCollectionContents
Gets the URIs of the members of this collection- Parameters:
collectionId- the collection identifier- Returns:
- the URIs for each member of the collection
- Throws:
NotFoundException- if the collectionId does not exist
-
deleteFromCollection
Removes a file from a collection- Parameters:
collectionId- the collection identifierfileName- the filename to remove- Returns:
trueif the file existed and was removed- Throws:
IOException
-
deleteFromCollection
boolean deleteFromCollection(String collectionId, String fileName, boolean removeCollection) throws IOException Removes a file from a collection, and the parent folder if empty- Parameters:
collectionId- the collection identifierfileName- the filename to removeremoveCollection- remove the parent collection folder if empty- Returns:
trueif the file existed and was removed- Throws:
IOException
-
moveTo
URI moveTo(String fromCollection, String fromFileName, String toMediaPackage, String toMediaPackageElement, String toFileName) throws NotFoundException, IOException Moves a file from a collection into a mediapackage- Parameters:
fromCollection- The collection holding the filefromFileName- The filenametoMediaPackage- The media package ID to move the file intotoMediaPackageElement- the media package element ID of the filetoFileName- the name of the resulting file- Returns:
- the URI pointing to the file's new location
- Throws:
NotFoundExceptionIOException
-
getDiskSpace
String getDiskSpace()A textual representation of available and total storage- Returns:
- Percentage and numeric values of used storage space
-
cleanupOldFilesFromCollection
Cleans up collection files older than the number of days passed.- Parameters:
collectionId- the collection identifierdays- files older than that will be deleted- Throws:
IOException
-
cleanupOldFilesFromMediaPackage
Cleans up media files older than the number of days passed.- Parameters:
days- files older than that will be deleted- Throws:
IOException
-