Package org.opencastproject.mediapackage
Class MediaPackageSupport
java.lang.Object
org.opencastproject.mediapackage.MediaPackageSupport
Utility class used for media package handling.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classFilters and predicates to work with media package element collections.static final classFunctions on media packages.static enumMode used when merging media packages. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Function<MediaPackage, String> Deprecated.static final Function<MediaPackageElement, String> -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancontains(String identifier, MediaPackage mp) Returnstrueif the media package contains an element with the specified identifier.static MediaPackagecopy(MediaPackage mp) Create a copy of the given media package.static com.entwinemedia.fn.data.Opt<String> Extract the file name from a media package elements URI.static MediaPackageloadFromClassPath(String path) To be used in unit tests.static MediaPackagemerge(MediaPackage dest, MediaPackage src, MediaPackageSupport.MergeMode mode) Merges the contents of media package located atsourceDirinto the media package located attargetDir.Basic sanity checking for media packages.static Effect<MediaPackageElement> updateElement(MediaPackage, MediaPackageElement)as en effect.static voidUpdate a mediapackage element of a mediapackage.
-
Field Details
-
getMediaPackageElementId
-
getId
Deprecated.Function to extract the ID of a media package.
-
-
Method Details
-
merge
public static MediaPackage merge(MediaPackage dest, MediaPackage src, MediaPackageSupport.MergeMode mode) throws MediaPackageException Merges the contents of media package located atsourceDirinto the media package located attargetDir.When choosing to move the media package element into the new place instead of copying them, the source media package folder will be removed afterwards.
- Parameters:
dest- the target media package directorysrc- the source media package directorymode- conflict resolution strategy in case of identical element identifier- Throws:
MediaPackageException- if an error occurs either accessing one of the two media packages or merging them
-
contains
Returnstrueif the media package contains an element with the specified identifier.- Parameters:
identifier- the identifier- Returns:
trueif the media package contains an element with this identifier
-
getFileName
Extract the file name from a media package elements URI.- Returns:
- the file name or none if it could not be determined
-
copy
Create a copy of the given media package.ATTENTION: Copying changes the type of the media package elements, e.g. an element of type
DublinCoreCatalogwill become aCatalogImpl. -
updateElement
Update a mediapackage element of a mediapackage. Mutatesmp. -
updateElement
updateElement(MediaPackage, MediaPackageElement)as en effect. -
sanityCheck
Basic sanity checking for media packages.// media package is ok sanityCheck(mp).isNone()
- Returns:
- none if the media package is a healthy condition, some([error_msgs]) otherwise
-
loadFromClassPath
To be used in unit tests.
-