Interface AssetManager
public interface AssetManager
The AssetManager stores versioned snapshots of media packages.
It also supports the association of properties to a history of snapshots which is called an episode.
Terms
Snapshot
A snapshot saves a particular version of a media package. Snapshots are immutable and can only be deleted.Episode
An episode is the set of snapshots of a media package.Properties
Properties are associated with an episode and have a volatile character. They support the quick and easy storage of meta data. This removes the need for services to create their own persistence layer if they want to associate metadata with a media package.Notes
Media package IDs are considered to be unique throughout the whole system. The organization ID is just a discriminator and not necessary to uniquely identify a media package.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionlongCount the number of assetslongcountEvents(String organization) Count the number of events stored for a given organization.longCount the number of propertieslongcountSnapshots(String organization) Count the number of snapshots stored for a given organization.intRemove all snapshots with the given mediaPackage id, except for the snapshot with the highest version numberintdeleteProperties(String mediaPackageId) Delete all properties for a given media package identifierintdeleteProperties(String mediaPackageId, String namespace) Delete all properties for a given media package identifier and namespace.intdeletePropertiesWithCurrentUser(String mediaPackageId, String namespace) Delete all properties for a given media package identifier and namespace.intdeleteSnapshots(String mpId) Remove all snapshots with the given mediaPackage idGet the asset that is uniquely identified by the triple {version, media package ID, media package element ID}.getAssetStore(String storeId) Get an asset store by id (local or remote).getLatestSnapshot(String mediaPackageId) Get the latest snapshot.getLatestSnapshots(Collection mediaPackageIds) Get the latest snapshots.getLatestSnapshotsBySeriesId(String seriesId) Get the latest snapshots from the seriesGet the local asset store.Optional<org.opencastproject.mediapackage.MediaPackage> getMediaPackage(String mediaPackageId) Get the media package from the latest snapshot.Get the remote asset stores as a list.getSnapshotByMpIdOrgIdAndVersion(String mpId, String orgId, Version version) Gets a snapshot that confirms to the given parametersgetSnapshotsByDateOrderedById(Date start, Date end) Returns a list ofSnapshotfiltered by date.getSnapshotsById(String mpId) Returns a list ofSnapshotfiltered by mediapackage IDsgetSnapshotsByIdAndDate(String mpId, Date start, Date end) Returns a list ofSnapshotfiltered by date and mediapackage.getSnapshotsByIdAndDateOrderedByVersion(String mpId, Date start, Date end, boolean asc) Returns a list ofSnapshotfiltered by date and mediapackage.getSnapshotsByIdAndVersion(String mpId, Version version) Returns a list ofSnapshotfiltered by mediapackage ID and versiongetSnapshotsByIdOrderedByVersion(String mpId, boolean asc) Returns a list ofSnapshotfiltered by mediapackage IDs.voidmoveSnapshotsByDate(Date start, Date end, String targetStore) Moves all versions of all mediapackages archived within a data range to a new storage location.voidmoveSnapshotsById(String mpId, String targetStore) Moves all versions of a given mediapackage ID from their respective source stores to a single target storevoidmoveSnapshotsByIdAndDate(String mpId, Date start, Date end, String targetStore) Moves all versions of a mediapackage archived within a data range to a new storage location.voidmoveSnapshotsByIdAndVersion(String mpId, Version version, String targetStore) Moves a specific version of a given mediapackage ID to a new storevoidmoveSnapshotToStore(Version version, String mpId, String storeId) Move snapshot from current store to new store Note: This may require downloading and re-uploadingselectProperties(String mediaPackageId, String namespace) Select all properties for a specific media package.booleansetProperty(Property property) Set a property.booleansnapshotExists(String mediaPackageId) Check if any snapshot with the given media package identifier exists.booleansnapshotExists(String mediaPackageId, String organization) Check if any snapshot with the given media package identifier exists.takeSnapshot(String owner, org.opencastproject.mediapackage.MediaPackage mp) Take a versioned snapshot of a media package.takeSnapshot(org.opencastproject.mediapackage.MediaPackage mediaPackage) Take a versioned snapshot of a media package using the owner of the last snapshot or the default owner if it does not exist.Deserialize a version from a string.voidtriggerIndexUpdate(String mediaPackageId) Trigger search index update for event.
-
Field Details
-
DEFAULT_OWNER
- See Also:
-
-
Method Details
-
getMediaPackage
Get the media package from the latest snapshot.- Parameters:
mediaPackageId-- Returns:
- mediapackage
-
getAsset
Get the asset that is uniquely identified by the triple {version, media package ID, media package element ID}.- Parameters:
version- the versionmpId- the media package IDmpeId- the media package element ID- Returns:
- the asset or none, if no such asset exists
-
getAssetStore
Get an asset store by id (local or remote).- Parameters:
storeId- the store id- Returns:
- the asset store if it exists
-
getRemoteAssetStores
List<AssetStore> getRemoteAssetStores()Get the remote asset stores as a list.- Returns:
- a list of asset stores
-
getLocalAssetStore
AssetStore getLocalAssetStore()Get the local asset store.- Returns:
- the asset store
-
getLatestSnapshot
Get the latest snapshot.- Parameters:
mediaPackageId-- Returns:
- Snapshot
-
getLatestSnapshots
Get the latest snapshots.- Parameters:
mediaPackageIds-- Returns:
- Snapshot returns the latest snapshot for each given mediaPackageId
-
snapshotExists
Check if any snapshot with the given media package identifier exists.- Parameters:
mediaPackageId- The media package identifier to check for- Returns:
- If a snapshot exists for the given media package
-
snapshotExists
Check if any snapshot with the given media package identifier exists.- Parameters:
mediaPackageId- The media package identifier to check fororganization- The organization to limit the search to- Returns:
- If a snapshot exists for the given media package
-
getSnapshotsById
Returns a list ofSnapshotfiltered by mediapackage IDs- Parameters:
mpId- The mediapackage ID to filter results for- Returns:
- The
Snapshotlist filtered by mediapackage ID
-
getSnapshotsByIdOrderedByVersion
Returns a list ofSnapshotfiltered by mediapackage IDs. This stream consists of all versions of all mediapackage ordered by the Version -
getSnapshotsByIdAndVersion
Returns a list ofSnapshotfiltered by mediapackage ID and version- Parameters:
mpId- The mediapackage ID to filter results forversion- The version to filter results for- Returns:
- The
Snapshotlist filtered by mediapackage ID
-
getSnapshotsByDateOrderedById
Returns a list ofSnapshotfiltered by date. This stream consists of all a mediapackages which have at least one version archived within the date range. -
getSnapshotsByIdAndDate
Returns a list ofSnapshotfiltered by date and mediapackage. This stream consists of all versions of a mediapackage archived within the date range. -
getSnapshotsByIdAndDateOrderedByVersion
List<Snapshot> getSnapshotsByIdAndDateOrderedByVersion(String mpId, Date start, Date end, boolean asc) Returns a list ofSnapshotfiltered by date and mediapackage. This stream consists of all versions of a mediapackage archived within the date range ordered by there Version. -
getLatestSnapshotsBySeriesId
Get the latest snapshots from the series- Parameters:
seriesId- the id of the series- Returns:
- a list of the latest snapshots from the series
-
getSnapshotByMpIdOrgIdAndVersion
Gets a snapshot that confirms to the given parameters- Parameters:
mpId- the mediaPackageIdorgId- the organizationIdversion- the version- Returns:
-
deleteSnapshots
Remove all snapshots with the given mediaPackage id- Parameters:
mpId- the mediaPackage id- Returns:
- the amount of snapshots removed
-
deleteAllButLatestSnapshot
Remove all snapshots with the given mediaPackage id, except for the snapshot with the highest version number- Parameters:
mpId- the mediaPackage id- Returns:
- the amount of snapshots removed
-
takeSnapshot
Take a versioned snapshot of a media package.Snapshot are tagged with string identifying the owner. Only the owner of a snapshot is allowed to delete it. Ownership only affects the deletion of a snapshot.
- Parameters:
owner- the owner of the snapshot, e.g. the name of the calling service
-
takeSnapshot
Take a versioned snapshot of a media package using the owner of the last snapshot or the default owner if it does not exist.- Parameters:
mediaPackage- The media package to snapshot- Returns:
- A new snapshot
-
moveSnapshotToStore
void moveSnapshotToStore(Version version, String mpId, String storeId) throws org.opencastproject.util.NotFoundException Move snapshot from current store to new store Note: This may require downloading and re-uploading- Parameters:
version- The version to movempId- The media package to movestoreId- The store to move to- Throws:
org.opencastproject.util.NotFoundException
-
moveSnapshotsById
void moveSnapshotsById(String mpId, String targetStore) throws org.opencastproject.util.NotFoundException Moves all versions of a given mediapackage ID from their respective source stores to a single target store- Parameters:
mpId- The mediapackage ID to movetargetStore- The store ID to move all versions of this mediapackage to- Throws:
org.opencastproject.util.NotFoundException
-
moveSnapshotsByIdAndVersion
void moveSnapshotsByIdAndVersion(String mpId, Version version, String targetStore) throws org.opencastproject.util.NotFoundException Moves a specific version of a given mediapackage ID to a new store- Parameters:
mpId- The mediapackage ID to moveversion- The version to movetargetStore- The store ID to move this version of the mediapackage to- Throws:
org.opencastproject.util.NotFoundException
-
moveSnapshotsByDate
void moveSnapshotsByDate(Date start, Date end, String targetStore) throws org.opencastproject.util.NotFoundException Moves all versions of all mediapackages archived within a data range to a new storage location. -
moveSnapshotsByIdAndDate
void moveSnapshotsByIdAndDate(String mpId, Date start, Date end, String targetStore) throws org.opencastproject.util.NotFoundException Moves all versions of a mediapackage archived within a data range to a new storage location. -
setProperty
Set a property. Use this method to either insert a new property or update an existing one. Properties are stored per episode.- Returns:
- false, if the referenced episode does not exist.
-
selectProperties
Select all properties for a specific media package.- Parameters:
mediaPackageId- Media package identifier to check fornamespace- Namespace to limit the search to- Returns:
- List of properties
-
deleteProperties
Delete all properties for a given media package identifier- Parameters:
mediaPackageId- Media package identifier- Returns:
- Number of deleted properties
-
deleteProperties
Delete all properties for a given media package identifier and namespace.- Parameters:
mediaPackageId- Media package identifiernamespace- A namespace prefix to use for deletion- Returns:
- Number of deleted properties
-
deletePropertiesWithCurrentUser
Delete all properties for a given media package identifier and namespace. Restricts access based on the current user- Parameters:
mediaPackageId- Media package identifiernamespace- A namespace prefix to use for deletion- Returns:
- Number of deleted properties
-
toVersion
Deserialize a version from a string. This is the inverse function ofVersion.toString().- Returns:
- a version or none, if no version can be archived from the given string
-
countEvents
Count the number of events stored for a given organization.- Parameters:
organization- The organization to check. This may be `null` to not filter for an organization which is significantly faster.- Returns:
- Number of events
-
countSnapshots
Count the number of snapshots stored for a given organization.- Parameters:
organization- The organization to check- Returns:
- Number of snapshots
-
countAssets
long countAssets()Count the number of assets- Returns:
- Number of assets
-
countProperties
long countProperties()Count the number of properties- Returns:
- Number of properties
-
triggerIndexUpdate
void triggerIndexUpdate(String mediaPackageId) throws org.opencastproject.util.NotFoundException, org.opencastproject.security.api.UnauthorizedException Trigger search index update for event.- Parameters:
mediaPackageId- The event ID to trigger an index update for- Throws:
org.opencastproject.util.NotFoundExceptionorg.opencastproject.security.api.UnauthorizedException
-