Interface MediaPackage

All Superinterfaces:
Cloneable
All Known Implementing Classes:
MediaPackageImpl

public interface MediaPackage extends Cloneable
Interface for a media package, which is a data container moving through the system, containing metadata, tracks and attachments.
  • Method Details

    • getIdentifier

      Id getIdentifier()
      Returns the media package identifier.
      Returns:
      the identifier
    • setIdentifier

      void setIdentifier(Id id)
    • setTitle

      void setTitle(String title)
    • getSeriesTitle

      @Deprecated String getSeriesTitle()
      Deprecated.
      This is not guaranteed to be correct. Use the metadata contained in the Dublin Core catalog instead.
      Returns the title for the associated series, if any.
      Returns:
      The series title
    • setSeriesTitle

      void setSeriesTitle(String seriesTitle)
    • getTitle

      @Deprecated String getTitle()
      Deprecated.
      This is not guaranteed to be correct. Use the metadata contained in the Dublin Core catalog instead.
      Returns the title of the episode that this mediapackage represents.
      Returns:
      The episode title
    • addCreator

      void addCreator(String creator)
    • removeCreator

      void removeCreator(String creator)
    • getCreators

      @Deprecated String[] getCreators()
      Deprecated.
      This is not guaranteed to be correct. Use the metadata contained in the Dublin Core catalog instead.
      Returns the names of the institutions or people who created this mediapackage
      Returns:
      the creators of this mediapackage
    • setSeries

      void setSeries(String identifier)
    • getSeries

      String getSeries()
      Returns the series, if any, to which this mediapackage belongs
      Returns:
      the series
    • setLicense

      void setLicense(String license)
    • getLicense

      @Deprecated String getLicense()
      Deprecated.
      This is not guaranteed to be correct. Use the metadata contained in the Dublin Core catalog instead.
      The license for the content in this mediapackage
      Returns:
      the license
    • addContributor

      void addContributor(String contributor)
    • removeContributor

      void removeContributor(String contributor)
    • getContributors

      @Deprecated String[] getContributors()
      Deprecated.
      This is not guaranteed to be correct. Use the metadata contained in the Dublin Core catalog instead.
      Returns the names of the institutions or people who contributed to the content within this mediapackage
      Returns:
      the contributors
    • setLanguage

      void setLanguage(String language)
    • getLanguage

      @Deprecated String getLanguage()
      Deprecated.
      This is not guaranteed to be correct. Use the metadata contained in the Dublin Core catalog instead.
      Returns the language written and/or spoken in the media content of this mediapackage
      Returns:
      the language
    • addSubject

      void addSubject(String subject)
    • removeSubject

      void removeSubject(String subject)
    • getSubjects

      @Deprecated String[] getSubjects()
      Deprecated.
      This is not guaranteed to be correct. Use the metadata contained in the Dublin Core catalog instead.
      The keywords describing the subject(s) or categories describing the content of this mediapackage
      Returns:
      the subjects
    • setDate

      void setDate(Date date)
    • getDate

      @Deprecated Date getDate()
      Deprecated.
      This is not guaranteed to be correct. Use the metadata contained in the Dublin Core catalog instead.
      Returns the media package start time.
      Returns:
      the start time
    • getDuration

      @Deprecated Long getDuration()
      Deprecated.
      This is not guaranteed to be correct. Use the metadata contained in the Dublin Core catalog instead.
      Returns the media package duration in milliseconds or null if no duration is available.
      Returns:
      the duration
    • setDuration

      void setDuration(Long duration) throws IllegalStateException
      Sets the duration of the media package in milliseconds. This method will throw an IllegalStateException if tracks have been added to the mediapackage already. Also note that as soon as the first track is added, the duration will be udpated according to the track's length.
      Parameters:
      duration - the duration in milliseconds
      Throws:
      IllegalStateException - if the mediapackage already contains a track
    • contains

      boolean contains(MediaPackageElement element)
      Returns true if the given element is part of the media package.
      Parameters:
      element - the element
      Returns:
      true if the element belongs to the media package
    • elements

      Returns an iteration of the media package elements.
      Returns:
      the media package elements
    • getElements

      MediaPackageElement[] getElements()
      Returns all the elements.
      Returns:
      the elements
    • getElementByReference

      MediaPackageElement getElementByReference(MediaPackageReference reference)
      Returns the element that is identified by the given reference or null if no such element exists.
      Parameters:
      reference - the reference
      Returns:
      the element
    • getElementById

      MediaPackageElement getElementById(String id)
      Returns the element that is identified by the given identifier or null if no such element exists.
      Parameters:
      id - the element identifier
      Returns:
      the element
    • getElementsByTags

      MediaPackageElement[] getElementsByTags(Collection<String> tags)
      Returns the elements that are tagged with any of the given tags or an empty array if no such elements are found. If any of the tags in the tags collection start with a '-' character, any elements matching the tag will be excluded from the returned MediaPackageElement[]. If tags is empty or null, all elements are returned.
      Parameters:
      tags - the tags
      Returns:
      the elements
    • getElementsByFlavor

      MediaPackageElement[] getElementsByFlavor(MediaPackageElementFlavor flavor)
      Returns all elements of this media package with the given flavor.
      Returns:
      the media package elements
    • getTrack

      Track getTrack(String trackId)
      Returns the track identified by trackId or null if that track doesn't exists.
      Parameters:
      trackId - the track identifier
      Returns:
      the tracks
    • getTracks

      Track[] getTracks()
      Returns the tracks that are part of this media package.
      Returns:
      the tracks
    • getTracksByTag

      Track[] getTracksByTag(String tag)
      Returns the tracks that are tagged with the given tag or an empty array if no such tracks are found.
      Parameters:
      tag - the tag
      Returns:
      the tracks
    • getTracksByTags

      Track[] getTracksByTags(Collection<String> tags)
      Returns the tracks that are tagged with any of the given tags or an empty array if no such elements are found. If any of the tags in the tags collection start with a '-' character, any elements matching the tag will be excluded from the returned Track[]. If tags is empty or null, all tracks are returned.
      Parameters:
      tags - the tags
      Returns:
      the tracks
    • getTracks

      Track[] getTracks(MediaPackageElementFlavor flavor)
      Returns the tracks that are part of this media package and match the given flavor as defined in Track.
      Parameters:
      flavor - the track's flavor
      Returns:
      the tracks with the specified flavor
    • hasTracks

      boolean hasTracks()
      Returns true if the media package contains media tracks of any kind.
      Returns:
      true if the media package contains tracks
    • getAttachment

      Attachment getAttachment(String attachmentId)
      Returns the attachment identified by attachmentId or null if that attachment does not exist.
      Parameters:
      attachmentId - the attachment identifier
      Returns:
      the attachments
    • getAttachments

      Attachment[] getAttachments()
      Returns the attachments that are part of this media package.
      Returns:
      the attachments
    • getAttachments

      Attachment[] getAttachments(MediaPackageElementFlavor flavor)
      Returns the attachments that are part of this media package and match the specified flavor.
      Parameters:
      flavor - the attachment flavor
      Returns:
      the attachments
    • getPublications

      Publication[] getPublications()
      Returns the presentations that are part of this media package.
      Returns:
      the attachments
    • getCatalog

      Catalog getCatalog(String catalogId)
      Returns the catalog identified by catalogId or null if that catalog doesn't exists.
      Parameters:
      catalogId - the catalog identifier
      Returns:
      the catalogs
    • getCatalogs

      Catalog[] getCatalogs()
      Returns the catalogs associated with this media package.
      Returns:
      the catalogs
    • getCatalogsByTags

      Catalog[] getCatalogsByTags(Collection<String> tags)
      Returns the catalogs that are tagged with any of the given tags or an empty array if no such elements are found. If any of the tags in the tags collection start with a '-' character, any elements matching the tag will be excluded from the returned Catalog[]. If tags is empty or null, all catalogs are returned.
      Parameters:
      tags - the tags
      Returns:
      the catalogs
    • getCatalogs

      Catalog[] getCatalogs(MediaPackageElementFlavor flavor)
      Returns the catalogs associated with this media package that matches the specified flavor.
      Parameters:
      flavor - the catalog type
      Returns:
      the media package catalogs
    • getCatalogs

      Catalog[] getCatalogs(MediaPackageReference reference)
      Returns the catalogs that are part of this media package and are refering to the element identified by reference.
      Parameters:
      reference - the reference
      Returns:
      the catalogs with the specified reference
    • getCatalogs

      Catalog[] getCatalogs(MediaPackageElementFlavor flavor, MediaPackageReference reference)
      Returns the catalogs that are part of this media package and are refering to the element identified by reference.
      Parameters:
      flavor - the element flavor
      reference - the reference
      Returns:
      the catalogs with the specified reference
    • getUnclassifiedElements

      MediaPackageElement[] getUnclassifiedElements()
      Returns media package elements that are neither, attachments, catalogs nor tracks.
      Returns:
      the other media package elements
    • add

      Adds an arbitrary URI to this media package, utilizing a MediaPackageBuilder to create a suitable media package element out of the url. If the content cannot be recognized as being either a metadata catalog or multimedia track, it is added as an attachment.
      Parameters:
      uri - the element location
    • add

      Adds an arbitrary URI to this media package, utilizing a MediaPackageBuilder to create a suitable media package element out of the url. If the content cannot be recognized as being either a metadata catalog or multimedia track, it is added as an attachment.
      Parameters:
      uri - the element location
      type - the element type
      flavor - the element flavor
    • add

      void add(MediaPackageElement element)
      Adds an arbitrary MediaPackageElement to this media package.
      Parameters:
      element - the element
    • add

      void add(Track track)
      Adds a track to this media package, actually moving the underlying file in the filesystem. Use this method only if you do not need the track in its originial place anymore.

      Depending on the implementation, this method may provide significant performance benefits over copying the track.

      Parameters:
      track - the track
    • removeElementById

      MediaPackageElement removeElementById(String id)
      Removes the element with the given identifier from the mediapackage and returns it.
      Parameters:
      id - the element identifier
    • remove

      void remove(Track track)
      Removes the track from the media package.
      Parameters:
      track - the track
    • add

      void add(Catalog catalog)
      Adds catalog information to this media package.
      Parameters:
      catalog - the catalog
    • remove

      void remove(Catalog catalog)
      Removes the catalog from the media package.
      Parameters:
      catalog - the catalog
    • add

      void add(Attachment attachment)
      Adds an attachment to this media package.
      Parameters:
      attachment - the attachment
    • remove

      void remove(MediaPackageElement element)
      Removes an arbitrary media package element.
      Parameters:
      element - the media package element
    • remove

      void remove(Attachment attachment)
      Removes the attachment from the media package.
      Parameters:
      attachment - the attachment
    • addDerived

      void addDerived(MediaPackageElement derivedElement, MediaPackageElement sourceElement)
      Adds an element to this media package that represents a derived version of sourceElement. Examples of a derived element could be an encoded version of a track or a converted version of a time text captions file.

      This method will add derviedElement to the media package and add a reference to the original element sourceElement. Make sure that derivedElement features the right flavor, so that you are later able to look up derived work using getDerived(MediaPackageElement, MediaPackageElementFlavor).

      Parameters:
      derivedElement - the derived element
      sourceElement - the source element
    • getDerived

      MediaPackageElement[] getDerived(MediaPackageElement sourceElement, MediaPackageElementFlavor derivateFlavor)
      Returns those media package elements that are derivates of sourceElement and feature the flavor derivateFlavor. Using this method, you could easily look up e. g. flash-encoded versions of the presenter track or converted versions of a time text captions file.
      Parameters:
      sourceElement - the original track, catalog or attachment
      derivateFlavor - the derivate flavor you are looking for
      Returns:
      the derivates
    • verify

      void verify() throws MediaPackageException
      Verifies the media package consistency by checking the media package elements for mimetypes and checksums.
      Throws:
      MediaPackageException - if an error occurs while checking the media package
    • clone

      Object clone()
      Creates a deep copy of the media package.
      Returns:
      the cloned media package
    • isLive

      boolean isLive()
      Whether the media package contains live tracks.
      Returns:
      if mp is live