Class MediaPackageSupport

java.lang.Object
org.opencastproject.mediapackage.MediaPackageSupport

public final class MediaPackageSupport extends Object
Utility class used for media package handling.
  • Field Details

  • Method Details

    • merge

      Merges the contents of media package located at sourceDir into the media package located at targetDir.

      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 directory
      src - the source media package directory
      mode - 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

      public static boolean contains(String identifier, MediaPackage mp)
      Returns true if the media package contains an element with the specified identifier.
      Parameters:
      identifier - the identifier
      Returns:
      true if the media package contains an element with this identifier
    • getFileName

      public static com.entwinemedia.fn.data.Opt<String> getFileName(MediaPackageElement mpe)
      Extract the file name from a media package elements URI.
      Returns:
      the file name or none if it could not be determined
    • copy

      public static MediaPackage copy(MediaPackage mp)
      Create a copy of the given media package.

      ATTENTION: Copying changes the type of the media package elements, e.g. an element of type DublinCoreCatalog will become a CatalogImpl.

    • updateElement

      public static void updateElement(MediaPackage mp, MediaPackageElement e)
      Update a mediapackage element of a mediapackage. Mutates mp.
    • updateElement

      public static Effect<MediaPackageElement> updateElement(MediaPackage mp)
    • sanityCheck

      public static Option<List<String>> sanityCheck(MediaPackage mp)
      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

      public static MediaPackage loadFromClassPath(String path)
      To be used in unit tests.