Class AbstractAttachmentBuilderPlugin
java.lang.Object
org.opencastproject.mediapackage.elementbuilder.AbstractElementBuilderPlugin
org.opencastproject.mediapackage.elementbuilder.AbstractAttachmentBuilderPlugin
- All Implemented Interfaces:
MediaPackageElementBuilderPlugin
- Direct Known Subclasses:
AttachmentBuilderPlugin
This implementation of the
MediaPackageElementBuilderPlugin recognizes attachments and provides utility
methods for creating media package element representations for them.-
Field Summary
FieldsFields inherited from class org.opencastproject.mediapackage.elementbuilder.AbstractElementBuilderPlugin
mimeTypes, priority, xpath -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new attachment plugin builder that will accept attachments with any flavor.Creates a new attachment plugin builder that will accept attachments with the given flavor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaccept(URI uri, MediaPackageElement.Type type, MediaPackageElementFlavor flavor) This method is called on every registered media package builder plugin until one of these plugins returnstrue.booleanaccept(MediaPackageElement.Type type, MediaPackageElementFlavor flavor) This implementation ofaccepttests for the element type (attachment).booleanThis implementation ofaccepttests for the correct node type (attachment).elementFromManifest(Node elementNode, MediaPackageSerializer serializer) Creates a media package element from the DOM element.elementFromURI(URI uri) Utility method that returns an attachment object from the given url.elementFromURI(URI uri, MediaPackageElement.Type type, MediaPackageElementFlavor flavor) newElement(MediaPackageElement.Type type, MediaPackageElementFlavor flavor) Creates a new media package element of the specified type.protected AttachmentspecializeAttachment(Attachment attachment) Overwrite this method in order to return a specialization of the attachment.toString()Methods inherited from class org.opencastproject.mediapackage.elementbuilder.AbstractElementBuilderPlugin
destroy, getPriority, init, setPriority
-
Field Details
-
flavor
The flavor to look for
-
-
Constructor Details
-
AbstractAttachmentBuilderPlugin
public AbstractAttachmentBuilderPlugin()Creates a new attachment plugin builder that will accept attachments with any flavor. -
AbstractAttachmentBuilderPlugin
Creates a new attachment plugin builder that will accept attachments with the given flavor.- Parameters:
flavor- the attachment flavor
-
-
Method Details
-
accept
Description copied from interface:MediaPackageElementBuilderPluginThis method is called on every registered media package builder plugin until one of these plugins returnstrue. If no plugin recognises the file, it is rejected.The parameters
typeandflavormay be taken as strong hints and may both benull.Implementers schould return the correct mime type for the given file if they are absolutely sure about the file. Otherwise,
nullshould be returned.- Parameters:
uri- the element locationtype- the element typeflavor- the element flavor- Returns:
trueif the plugin can handle the element- See Also:
-
accept
This implementation ofaccepttests for the element type (attachment).- Parameters:
type- the typeflavor- the element flavor- Returns:
trueif the plugin is able to create such an element- See Also:
-
accept
This implementation ofaccepttests for the correct node type (attachment).- Parameters:
elementNode- the node- Returns:
trueif the plugin is able to create such an element- See Also:
-
newElement
public MediaPackageElement newElement(MediaPackageElement.Type type, MediaPackageElementFlavor flavor) Description copied from interface:MediaPackageElementBuilderPluginCreates a new media package element of the specified type.- Parameters:
type- the element typeflavor- the element flavor- Returns:
- the new media package element
- See Also:
-
elementFromManifest
public MediaPackageElement elementFromManifest(Node elementNode, MediaPackageSerializer serializer) throws UnsupportedElementException Description copied from interface:MediaPackageElementBuilderPluginCreates a media package element from the DOM element.- Parameters:
elementNode- the DOM nodeserializer- the media package serializer- Returns:
- the media package element
- Throws:
UnsupportedElementException- See Also:
-
elementFromURI
Utility method that returns an attachment object from the given url.- Parameters:
uri- the element location- Returns:
- an attachment object
- Throws:
UnsupportedElementException- if the attachment cannto be read
-
elementFromURI
public MediaPackageElement elementFromURI(URI uri, MediaPackageElement.Type type, MediaPackageElementFlavor flavor) throws UnsupportedElementException - Throws:
UnsupportedElementException- See Also:
-
specializeAttachment
Overwrite this method in order to return a specialization of the attachment. This implementation just returns the attachment that is was given.- Parameters:
attachment- the general attachment representation- Returns:
- a specialized attachment
- Throws:
UnsupportedElementException- if the attachment fails to be specialized
-
toString
-