Interface MediaPackageElement

All Superinterfaces:
Cloneable, Comparable<MediaPackageElement>, ManifestContributor
All Known Subinterfaces:
AdaptivePlaylist, Attachment, Catalog, Publication, Track
All Known Implementing Classes:
AbstractMediaPackageElement, AttachmentImpl, CatalogImpl, PublicationImpl, TrackImpl, XMLCatalogImpl

public interface MediaPackageElement extends ManifestContributor, Comparable<MediaPackageElement>, Cloneable
All classes that will be part of a media package must implement this interface.
  • Method Details

    • getIdentifier

      String getIdentifier()
      Returns the element identifier.
      Returns:
      the element identifier, may be null
    • setIdentifier

      void setIdentifier(String id)
      Sets the element identifier.
      Parameters:
      id - the new element identifier
    • generateIdentifier

      String generateIdentifier()
      Generate a new random identifier for this element.
      Returns:
      The new identifier.
    • getElementType

      MediaPackageElement.Type getElementType()
      Returns the element's manifest type.
      Returns:
      the manifest type
    • getElementDescription

      String getElementDescription()
      Returns a human readable name for this media package element. If no name was provided, the filename is returned instead.
      Returns:
      the element name
    • setElementDescription

      void setElementDescription(String description)
      Sets the element description of this media package element.
      Parameters:
      description - the new element description
    • setTags

      void setTags(String[] tags)
      Sets the given tags for the media package element, overwriting any that may have been set previously.
      Parameters:
      tags - array of tags
    • addTag

      void addTag(String tag)
      Tags the media package element with the given tag.
      Parameters:
      tag - the tag
    • removeTag

      void removeTag(String tag)
      Removes the tag from the media package element.
      Parameters:
      tag - the tag
    • containsTag

      boolean containsTag(String tag)
      Returns true if the media package element contains the given tag.
      Parameters:
      tag - the tag
      Returns:
      true if the element is tagged
    • containsTag

      boolean containsTag(Collection<String> tags)
      Returns true if the media package element contains at least one of the given tags. If there are no tags contained in the set, then the element is considered to match as well.
      Parameters:
      tags - the set of tag
      Returns:
      true if the element is tagged accordingly
    • getTags

      String[] getTags()
      Returns the tags for this media package element or an empty array if there are no tags.
      Returns:
      the tags
    • clearTags

      void clearTags()
      Removes all tags associated with this element
    • getMediaPackage

      MediaPackage getMediaPackage()
      Returns the media package if the element has been added, null otherwise.
      Returns:
      the media package
    • getReference

      MediaPackageReference getReference()
      Returns a reference to another entitiy, both inside or outside the media package.
      Returns:
      the reference
    • setReference

      void setReference(MediaPackageReference reference)
      Sets the element reference.
      Parameters:
      reference - the reference
    • getURI

      URI getURI()
      Returns a reference to the element location.
      Returns:
      the element location
    • setURI

      void setURI(URI uri)
      Sets the elements location.
      Parameters:
      uri - the element location
    • getChecksum

      Checksum getChecksum()
      Returns the file's checksum.
      Returns:
      the checksum
    • setChecksum

      void setChecksum(Checksum checksum)
      Sets the new checksum on this media package element.
      Parameters:
      checksum - the checksum
    • getMimeType

      MimeType getMimeType()
      Returns the element's mimetype as found in the ISO Mime Type Registrations.

      For example, in case of motion jpeg slides, this method will return the mime type for video/mj2.

      Returns:
      the mime type
    • setMimeType

      void setMimeType(MimeType mimeType)
      Sets the mime type on this media package element.
      Parameters:
      mimeType - the new mime type
    • getFlavor

      Returns the element's type as defined for the specific media package element.

      For example, in case of a video track, the type could be video/x-presentation.

      Returns:
      the element flavor
    • setFlavor

      void setFlavor(MediaPackageElementFlavor flavor)
      Sets the flavor on this media package element.
      Parameters:
      flavor - the new flavor
    • getSize

      long getSize()
      Returns the number of bytes that are occupied by this media package element.
      Returns:
      the size
    • setSize

      void setSize(long size)
      Sets the file size in bytes
      Parameters:
      size -
    • verify

      void verify() throws MediaPackageException
      Verifies the integrity of the media package element.
      Throws:
      MediaPackageException - if the media package element is in an incosistant state
    • referTo

      void referTo(MediaPackageElement element)
      Adds a reference to the media package element element.

      Note that an element can only refere to one object. Therefore, any existing reference will be replaced. Also note that if this element is part of a media package, a consistency check will be made making sure the refered element is also part of the same media package. If not, a MediaPackageException will be thrown.

      Parameters:
      element - the element to refere to
    • referTo

      void referTo(MediaPackageReference reference)
      Adds an arbitrary reference.

      Note that an element can only have one reference. Therefore, any existing reference will be replaced. Also note that if this element is part of a media package, a consistency check will be made making sure the refered element is also part of the same media package. If not, a MediaPackageException will be thrown.

      Parameters:
      reference - the reference
    • clearReference

      void clearReference()
      Removes any reference.
    • clone

      Object clone()
      Create a deep copy of this object.
      Returns:
      The copy