Class AbstractMediaPackageElement
- All Implemented Interfaces:
Serializable,Cloneable,Comparable<MediaPackageElement>,ManifestContributor,MediaPackageElement
- Direct Known Subclasses:
AttachmentImpl,CatalogImpl,PublicationImpl,TrackImpl
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opencastproject.mediapackage.MediaPackageElement
MediaPackageElement.Type -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ChecksumThe element's checksumprotected StringThe element's descriptionprotected MediaPackageElement.TypeThe element's type whithin the manifest: Track, Catalog etc.protected MediaPackageElementFlavorThe element's type, e. g.protected StringThe element identifierprotected MediaPackageThe parent media packageprotected MimeTypeThe element's mime type, e. g.protected MediaPackageReferenceThe optional reference to other elements or seriesprotected LongSize in bytesThe tagsprotected URIThe element's location -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedNeeded by JAXBprotectedAbstractMediaPackageElement(String id, MediaPackageElement.Type elementType, MediaPackageElementFlavor flavor, URI uri, Long size, Checksum checksum, MimeType mimeType) Creates a new media package element.protectedAbstractMediaPackageElement(MediaPackageElement.Type elementType, MediaPackageElementFlavor flavor, URI uri) Creates a new media package element.protectedAbstractMediaPackageElement(MediaPackageElement.Type elementType, MediaPackageElementFlavor flavor, URI uri, Long size, Checksum checksum, MimeType mimeType) Creates a new media package element. -
Method Summary
Modifier and TypeMethodDescriptionvoidTags the media package element with the given tag.voidRemoves any reference.voidRemoves all tags associated with this elementclone()Attention: The media package reference is not being cloned so that callinggetMediaPackage()on the clone yields null.intbooleancontainsTag(String tag) Returnstrueif the media package element contains the given tag.booleancontainsTag(Collection<String> tags) Returnstrueif the media package element contains at least one of the given tags.booleanGenerate a new random identifier for this element.Returns the file's checksum.Returns a human readable name for this media package element.Returns the element's manifest type.Returns the element's type as defined for the specific media package element.Returns the element identifier.Returns the media package if the element has been added,nullotherwise.Returns the element's mimetype as found in the ISO Mime Type Registrations.Returns a reference to another entitiy, both inside or outside the media package.longgetSize()Returns the number of bytes that are occupied by this media package element.String[]getTags()Returns the tags for this media package element or an empty array if there are no tags.getURI()Returns a reference to the element location.inthashCode()voidreferTo(MediaPackageElement element) Adds a reference to the media package elementelement.voidreferTo(MediaPackageReference reference) Adds an arbitrary reference.voidRemoves the tag from the media package element.voidsetChecksum(Checksum checksum) Sets the new checksum on this media package element.voidsetElementDescription(String name) Sets the element description of this media package element.voidsetFlavor(MediaPackageElementFlavor flavor) Sets the flavor on this media package element.voidsetIdentifier(String id) Sets the element identifier.voidsetMimeType(MimeType mimeType) Sets the mime type on this media package element.voidsetReference(MediaPackageReference reference) Sets the element reference.voidsetSize(long size) Sets the file size in bytesvoidSets the given tags for the media package element, overwriting any that may have been set previously.voidSets the elements location.toManifest(Document document, MediaPackageSerializer serializer) This method returns an XML serialization of the object to be stored in the media package manifest.toString()voidverify()Verifies the integrity of the media package element.
-
Field Details
-
id
The element identifier -
elementType
The element's type whithin the manifest: Track, Catalog etc. -
description
The element's description -
mimeType
The element's mime type, e. g. 'audio/mp3' -
flavor
The element's type, e. g. 'track/slide' -
tags
The tags -
uri
The element's location -
size
Size in bytes -
checksum
The element's checksum -
mediaPackage
The parent media package -
reference
The optional reference to other elements or series
-
-
Constructor Details
-
AbstractMediaPackageElement
protected AbstractMediaPackageElement()Needed by JAXB -
AbstractMediaPackageElement
protected AbstractMediaPackageElement(MediaPackageElement.Type elementType, MediaPackageElementFlavor flavor, URI uri) Creates a new media package element.- Parameters:
elementType- the type, e. g. Track, Catalog etc.flavor- the flavoruri- the elements location
-
AbstractMediaPackageElement
protected AbstractMediaPackageElement(MediaPackageElement.Type elementType, MediaPackageElementFlavor flavor, URI uri, Long size, Checksum checksum, MimeType mimeType) Creates a new media package element.- Parameters:
elementType- the type, e. g. Track, Catalog etc.flavor- the flavoruri- the elements locationsize- the element size in byteschecksum- the element checksummimeType- the element mime type
-
AbstractMediaPackageElement
protected AbstractMediaPackageElement(String id, MediaPackageElement.Type elementType, MediaPackageElementFlavor flavor, URI uri, Long size, Checksum checksum, MimeType mimeType) Creates a new media package element.- Parameters:
id- the element identifier withing the packageelementType- the type, e. g. Track, Catalog etc.flavor- the flavoruri- the elements locationsize- the element size in byteschecksum- the element checksummimeType- the element mime type
-
-
Method Details
-
setIdentifier
Description copied from interface:MediaPackageElementSets the element identifier.- Specified by:
setIdentifierin interfaceMediaPackageElement- Parameters:
id- the new element identifier- See Also:
-
generateIdentifier
Description copied from interface:MediaPackageElementGenerate a new random identifier for this element.- Specified by:
generateIdentifierin interfaceMediaPackageElement- Returns:
- The new identifier.
-
getIdentifier
Description copied from interface:MediaPackageElementReturns the element identifier.- Specified by:
getIdentifierin interfaceMediaPackageElement- Returns:
- the element identifier, may be null
- See Also:
-
setTags
Description copied from interface:MediaPackageElementSets the given tags for the media package element, overwriting any that may have been set previously.- Specified by:
setTagsin interfaceMediaPackageElement- Parameters:
tags- array of tags- See Also:
-
addTag
Description copied from interface:MediaPackageElementTags the media package element with the given tag.- Specified by:
addTagin interfaceMediaPackageElement- Parameters:
tag- the tag- See Also:
-
removeTag
Description copied from interface:MediaPackageElementRemoves the tag from the media package element.- Specified by:
removeTagin interfaceMediaPackageElement- Parameters:
tag- the tag- See Also:
-
containsTag
Description copied from interface:MediaPackageElementReturnstrueif the media package element contains the given tag.- Specified by:
containsTagin interfaceMediaPackageElement- Parameters:
tag- the tag- Returns:
trueif the element is tagged- See Also:
-
containsTag
Description copied from interface:MediaPackageElementReturnstrueif 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.- Specified by:
containsTagin interfaceMediaPackageElement- Parameters:
tags- the set of tag- Returns:
trueif the element is tagged accordingly- See Also:
-
getTags
Description copied from interface:MediaPackageElementReturns the tags for this media package element or an empty array if there are no tags.- Specified by:
getTagsin interfaceMediaPackageElement- Returns:
- the tags
- See Also:
-
clearTags
public void clearTags()Description copied from interface:MediaPackageElementRemoves all tags associated with this element- Specified by:
clearTagsin interfaceMediaPackageElement- See Also:
-
getMediaPackage
Description copied from interface:MediaPackageElementReturns the media package if the element has been added,nullotherwise.- Specified by:
getMediaPackagein interfaceMediaPackageElement- Returns:
- the media package
- See Also:
-
getElementType
Description copied from interface:MediaPackageElementReturns the element's manifest type.- Specified by:
getElementTypein interfaceMediaPackageElement- Returns:
- the manifest type
- See Also:
-
getElementDescription
Description copied from interface:MediaPackageElementReturns a human readable name for this media package element. If no name was provided, the filename is returned instead.- Specified by:
getElementDescriptionin interfaceMediaPackageElement- Returns:
- the element name
- See Also:
-
setElementDescription
Description copied from interface:MediaPackageElementSets the element description of this media package element.- Specified by:
setElementDescriptionin interfaceMediaPackageElement- Parameters:
name- the new element description- See Also:
-
getReference
Description copied from interface:MediaPackageElementReturns a reference to another entitiy, both inside or outside the media package.- Specified by:
getReferencein interfaceMediaPackageElement- Returns:
- the reference
- See Also:
-
setReference
Description copied from interface:MediaPackageElementSets the element reference.- Specified by:
setReferencein interfaceMediaPackageElement- Parameters:
reference- the reference- See Also:
-
getURI
Description copied from interface:MediaPackageElementReturns a reference to the element location.- Specified by:
getURIin interfaceMediaPackageElement- Returns:
- the element location
- See Also:
-
setURI
Description copied from interface:MediaPackageElementSets the elements location.- Specified by:
setURIin interfaceMediaPackageElement- Parameters:
uri- the element location- See Also:
-
getChecksum
Description copied from interface:MediaPackageElementReturns the file's checksum.- Specified by:
getChecksumin interfaceMediaPackageElement- Returns:
- the checksum
- See Also:
-
setChecksum
Description copied from interface:MediaPackageElementSets the new checksum on this media package element.- Specified by:
setChecksumin interfaceMediaPackageElement- Parameters:
checksum- the checksum- See Also:
-
getMimeType
Description copied from interface:MediaPackageElementReturns 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.- Specified by:
getMimeTypein interfaceMediaPackageElement- Returns:
- the mime type
- See Also:
-
setMimeType
Description copied from interface:MediaPackageElementSets the mime type on this media package element.- Specified by:
setMimeTypein interfaceMediaPackageElement- Parameters:
mimeType- the new mime type- See Also:
-
setFlavor
Description copied from interface:MediaPackageElementSets the flavor on this media package element.- Specified by:
setFlavorin interfaceMediaPackageElement- Parameters:
flavor- the new flavor- See Also:
-
getFlavor
Description copied from interface:MediaPackageElementReturns 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.- Specified by:
getFlavorin interfaceMediaPackageElement- Returns:
- the element flavor
- See Also:
-
getSize
public long getSize()Description copied from interface:MediaPackageElementReturns the number of bytes that are occupied by this media package element.- Specified by:
getSizein interfaceMediaPackageElement- Returns:
- the size
- See Also:
-
setSize
public void setSize(long size) Description copied from interface:MediaPackageElementSets the file size in bytes- Specified by:
setSizein interfaceMediaPackageElement- Parameters:
size-- See Also:
-
referTo
Description copied from interface:MediaPackageElementAdds a reference to the media package elementelement.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
MediaPackageExceptionwill be thrown.- Specified by:
referToin interfaceMediaPackageElement- Parameters:
element- the element to refere to- See Also:
-
referTo
Description copied from interface:MediaPackageElementAdds 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
MediaPackageExceptionwill be thrown.- Specified by:
referToin interfaceMediaPackageElement- Parameters:
reference- the reference- See Also:
-
clearReference
public void clearReference()Description copied from interface:MediaPackageElementRemoves any reference.- Specified by:
clearReferencein interfaceMediaPackageElement- See Also:
-
verify
Description copied from interface:MediaPackageElementVerifies the integrity of the media package element.- Specified by:
verifyin interfaceMediaPackageElement- Throws:
MediaPackageException- if the media package element is in an incosistant state- See Also:
-
compareTo
- Specified by:
compareToin interfaceComparable<MediaPackageElement>- See Also:
-
equals
-
hashCode
public int hashCode() -
toManifest
public Node toManifest(Document document, MediaPackageSerializer serializer) throws MediaPackageException Description copied from interface:ManifestContributorThis method returns an XML serialization of the object to be stored in the media package manifest. It should be possible to reconstruct the object from this data.For creating
MediaPackageElements from a manifest, please useMediaPackageElementBuilder.elementFromManifest(org.w3c.dom.Node, MediaPackageSerializer). All other objects shall provide their own implementation specific reconstruction mechanism.- Specified by:
toManifestin interfaceManifestContributor- Parameters:
document- the parentserializer- the media package serializer- Returns:
- the object's xml representation
- Throws:
MediaPackageException- if the mediapackage can't be serialized- See Also:
-
toString
-
clone
Attention: The media package reference is not being cloned so that callinggetMediaPackage()on the clone yields null.- Specified by:
clonein interfaceMediaPackageElement- Overrides:
clonein classObject- Returns:
- The copy
-