Interface AssetManager
- All Known Implementing Classes:
AssetManagerImpl
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 TypeMethodDescriptionlongcountEvents(String organization) Count the number of events stored for a given organization.Create a new query builder.intdeleteProperties(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.Get 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).Get the local asset store.getMediaPackage(String mediaPackageId) Get the media package from the lates snapshot.Get the remote asset stores as a list.getSnapshotsByDate(Date start, Date end) Returns a stream ofRichAResultfiltered by date.getSnapshotsByDateOrderedById(Date start, Date end) Returns a stream ofRichAResultfiltered by date.getSnapshotsById(String mpId) Returns a stream ofRichAResultfiltered by mediapackage IDsgetSnapshotsByIdAndDate(String mpId, Date start, Date end) Returns a stream ofRichAResultfiltered by date and mediapackage.getSnapshotsByIdAndDateOrderedByVersion(String mpId, Date start, Date end, boolean asc) Returns a stream ofRichAResultfiltered by date and mediapackage.getSnapshotsByIdAndVersion(String mpId, Version version) Returns a stream ofRichAResultfiltered by mediapackage ID and versiongetSnapshotsByIdOrderedByVersion(String mpId, boolean asc) Returns a stream ofRichAResultfiltered 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, MediaPackage mp) Take a versioned snapshot of a media package.takeSnapshot(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 lates 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
-
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 stream ofRichAResultfiltered by mediapackage IDs- Parameters:
mpId- The mediapackage ID to filter results for- Returns:
- The
RichAResultstream filtered by mediapackage ID
-
getSnapshotsByIdOrderedByVersion
Returns a stream ofRichAResultfiltered by mediapackage IDs. This stream consists of all versions of all mediapackage ordered by the Version- Parameters:
mpId- The mediapackage ID to filter results forasc- The ascBooleandecides if to order ascending (true) or descending (false)- Returns:
- The
RichAResultstream filtered by mediapackage ID
-
getSnapshotsByIdAndVersion
Returns a stream ofRichAResultfiltered by mediapackage ID and version- Parameters:
mpId- The mediapackage ID to filter results forversion- The version to filter results for- Returns:
- The
RichAResultstream filtered by mediapackage ID
-
getSnapshotsByDate
Returns a stream ofRichAResultfiltered by date. This stream consists of all versions of all mediapackages archived within the date range.- Parameters:
start- The startDateto filter byend- The endDateto filter by- Returns:
- The
RichAResultstream filtered by date
-
getSnapshotsByDateOrderedById
Returns a stream ofRichAResultfiltered by date. This stream consists of all a mediapackages which have at least one version archived within the date range.- Parameters:
start- The startDateto filter byend- The endDateto filter by- Returns:
- The
RichAResultstream filtered by date
-
getSnapshotsByIdAndDate
Returns a stream ofRichAResultfiltered by date and mediapackage. This stream consists of all versions of a mediapackage archived within the date range.- Parameters:
mpId- The mediapackage ID to filter forstart- The startDateto filter byend- The endDateto filter by- Returns:
- The
RichAResultstream filtered by date
-
getSnapshotsByIdAndDateOrderedByVersion
Returns a stream ofRichAResultfiltered by date and mediapackage. This stream consists of all versions of a mediapackage archived within the date range ordered by there Version.- Parameters:
mpId- The mediapackage ID to filter forstart- The startDateto filter byend- The endDateto filter byasc- The ascBooleandecides if to order ascending (true) or descending (false)- Returns:
- The
RichAResultstream filtered by date
-
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
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:
NotFoundException
-
moveSnapshotsById
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:
NotFoundException
-
moveSnapshotsByIdAndVersion
void moveSnapshotsByIdAndVersion(String mpId, Version version, String targetStore) throws 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:
NotFoundException
-
moveSnapshotsByDate
Moves all versions of all mediapackages archived within a data range to a new storage location.- Parameters:
start- The startDateto filter byend- The endDateto filter bytargetStore- THe store ID to move the snapshots to- Throws:
NotFoundException
-
moveSnapshotsByIdAndDate
void moveSnapshotsByIdAndDate(String mpId, Date start, Date end, String targetStore) throws NotFoundException Moves all versions of a mediapackage archived within a data range to a new storage location.- Parameters:
mpId- The mediapackage ID to filter forstart- The startDateto filter byend- The endDateto filter bytargetStore- THe store ID to move the snapshots to- Throws:
NotFoundException
-
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
-
createQuery
AQueryBuilder createQuery()Create a new query builder. -
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
-
triggerIndexUpdate
Trigger search index update for event.- Parameters:
mediaPackageId- The event ID to trigger an index update for- Throws:
NotFoundExceptionUnauthorizedException
-