public abstract class AbstractAttachmentBuilderPlugin extends AbstractElementBuilderPlugin
MediaPackageElementBuilderPlugin recognizes attachments and provides utility
methods for creating media package element representations for them.| Modifier and Type | Field and Description |
|---|---|
protected MediaPackageElementFlavor |
flavor
The flavor to look for
|
protected MediaPackageElement.Type |
type
The candidate type
|
mimeTypes, priority, xpath| Constructor and Description |
|---|
AbstractAttachmentBuilderPlugin()
Creates a new attachment plugin builder that will accept attachments with any flavor.
|
AbstractAttachmentBuilderPlugin(MediaPackageElementFlavor flavor)
Creates a new attachment plugin builder that will accept attachments with the given flavor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
accept(MediaPackageElement.Type type,
MediaPackageElementFlavor flavor)
This implementation of
accept tests for the element type (attachment). |
boolean |
accept(Node elementNode)
This implementation of
accept tests for the correct node type (attachment). |
boolean |
accept(URI uri,
MediaPackageElement.Type type,
MediaPackageElementFlavor flavor)
This method is called on every registered media package builder plugin until one of these plugins returns
true. |
MediaPackageElement |
elementFromManifest(Node elementNode,
MediaPackageSerializer serializer)
Creates a media package element from the DOM element.
|
MediaPackageElement |
elementFromURI(URI uri)
Utility method that returns an attachment object from the given url.
|
MediaPackageElement |
elementFromURI(URI uri,
MediaPackageElement.Type type,
MediaPackageElementFlavor flavor) |
MediaPackageElement |
newElement(MediaPackageElement.Type type,
MediaPackageElementFlavor flavor)
Creates a new media package element of the specified type.
|
protected Attachment |
specializeAttachment(Attachment attachment)
Overwrite this method in order to return a specialization of the attachment.
|
String |
toString() |
destroy, getPriority, init, setPriorityprotected MediaPackageElement.Type type
protected MediaPackageElementFlavor flavor
public AbstractAttachmentBuilderPlugin()
public AbstractAttachmentBuilderPlugin(MediaPackageElementFlavor flavor)
flavor - the attachment flavorpublic boolean accept(URI uri, MediaPackageElement.Type type, MediaPackageElementFlavor flavor)
MediaPackageElementBuilderPlugintrue. If no plugin recognises the file, it is rejected.
The parameters type and flavor may be taken as strong hints and may both be
null.
Implementers schould return the correct mime type for the given file if they are absolutely sure about the file.
Otherwise, null should be returned.
uri - the element locationtype - the element typeflavor - the element flavortrue if the plugin can handle the elementMediaPackageElementBuilderPlugin.accept(URI,
org.opencastproject.mediapackage.MediaPackageElement.Type ,
org.opencastproject.mediapackage.MediaPackageElementFlavor)public boolean accept(MediaPackageElement.Type type, MediaPackageElementFlavor flavor)
accept tests for the element type (attachment).type - the typeflavor - the element flavortrue if the plugin is able to create such an elementMediaPackageElementBuilderPlugin.accept(org.opencastproject.mediapackage.MediaPackageElement.Type
, org.opencastproject.mediapackage.MediaPackageElementFlavor)public boolean accept(Node elementNode)
accept tests for the correct node type (attachment).elementNode - the nodetrue if the plugin is able to create such an elementMediaPackageElementBuilderPlugin.accept(org.w3c.dom.Node)public MediaPackageElement newElement(MediaPackageElement.Type type, MediaPackageElementFlavor flavor)
MediaPackageElementBuilderPlugintype - the element typeflavor - the element flavorMediaPackageElementBuilder.newElement(org.opencastproject.mediapackage.MediaPackageElement.Type
, org.opencastproject.mediapackage.MediaPackageElementFlavor)public MediaPackageElement elementFromManifest(Node elementNode, MediaPackageSerializer serializer) throws UnsupportedElementException
MediaPackageElementBuilderPluginelementNode - the DOM nodeserializer - the media package serializerUnsupportedElementExceptionMediaPackageElementBuilderPlugin.elementFromManifest(org.w3c.dom.Node,
org.opencastproject.mediapackage.MediaPackageSerializer)public MediaPackageElement elementFromURI(URI uri) throws UnsupportedElementException
uri - the element locationUnsupportedElementException - if the attachment cannto be readpublic MediaPackageElement elementFromURI(URI uri, MediaPackageElement.Type type, MediaPackageElementFlavor flavor) throws UnsupportedElementException
protected Attachment specializeAttachment(Attachment attachment) throws UnsupportedElementException
attachment - the general attachment representationUnsupportedElementException - if the attachment fails to be specializedpublic String toString()
toString in class ObjectObject.toString()Copyright © 2009–2020 Opencast Project. All rights reserved.