Class CatalogBuilderPlugin
- java.lang.Object
-
- org.opencastproject.mediapackage.elementbuilder.CatalogBuilderPlugin
-
- All Implemented Interfaces:
MediaPackageElementBuilderPlugin
public class CatalogBuilderPlugin extends Object implements MediaPackageElementBuilderPlugin
This implementation of theMediaPackageElementBuilderPlugin
recognizes metadata catalogs and provides the functionality of reading it on behalf of the media package.
-
-
Constructor Summary
Constructors Constructor Description CatalogBuilderPlugin()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 returnstrue
.boolean
accept(MediaPackageElement.Type type, MediaPackageElementFlavor flavor)
This method is called if the media package builder tries to create a new media package element of typeelementType
.boolean
accept(Node elementNode)
This method is called while the media package builder parses a media package manifest.void
destroy()
This method is called before the plugin is abandoned by the element builder.MediaPackageElement
elementFromManifest(Node elementNode, MediaPackageSerializer serializer)
Creates a media package element from the DOM element.MediaPackageElement
elementFromURI(URI uri)
Creates a media package element from the given url that was previously accepted.void
init()
This method is called once in a plugin's life cycle.MediaPackageElement
newElement(MediaPackageElement.Type type, MediaPackageElementFlavor flavor)
Creates a new media package element of the specified type.String
toString()
-
-
-
Field Detail
-
xpath
protected XPath xpath
The xpath facility
-
-
Method Detail
-
accept
public boolean accept(MediaPackageElement.Type type, MediaPackageElementFlavor flavor)
Description copied from interface:MediaPackageElementBuilderPlugin
This method is called if the media package builder tries to create a new media package element of typeelementType
.Every registered builder plugin will then be asked whether it is able to create a media package element from the given element type. If this is the case for a plugin, it will then be asked to create such an element by a call to
MediaPackageElementBuilderPlugin.newElement(org.opencastproject.mediapackage.MediaPackageElement.Type ,MediaPackageElementFlavor)
.- Specified by:
accept
in interfaceMediaPackageElementBuilderPlugin
- Parameters:
type
- the typeflavor
- the element flavor- Returns:
true
if the plugin is able to create such an element- See Also:
MediaPackageElementBuilderPlugin.accept(org.opencastproject.mediapackage.MediaPackageElement.Type, org.opencastproject.mediapackage.MediaPackageElementFlavor)
-
accept
public boolean accept(Node elementNode)
Description copied from interface:MediaPackageElementBuilderPlugin
This method is called while the media package builder parses a media package manifest.Every registered builder plugin will then be asked, whether it is able to create a media package element from the given element definition.
The element must then be constructed and returned in the call to
MediaPackageElementBuilderPlugin.elementFromManifest(Node, MediaPackageSerializer)
.- Specified by:
accept
in interfaceMediaPackageElementBuilderPlugin
- Parameters:
elementNode
- the node- Returns:
true
if the plugin is able to create such an element- See Also:
MediaPackageElementBuilderPlugin.accept(org.w3c.dom.Node)
-
accept
public boolean accept(URI uri, MediaPackageElement.Type type, MediaPackageElementFlavor flavor)
Description copied from interface:MediaPackageElementBuilderPlugin
This 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
type
andflavor
may 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,
null
should be returned.- Specified by:
accept
in interfaceMediaPackageElementBuilderPlugin
- Parameters:
uri
- the element locationtype
- the element typeflavor
- the element flavor- Returns:
true
if the plugin can handle the element- See Also:
MediaPackageElementBuilderPlugin.accept(URI, org.opencastproject.mediapackage.MediaPackageElement.Type, org.opencastproject.mediapackage.MediaPackageElementFlavor)
-
elementFromURI
public MediaPackageElement elementFromURI(URI uri) throws UnsupportedElementException
Description copied from interface:MediaPackageElementBuilderPlugin
Creates a media package element from the given url that was previously accepted.- Specified by:
elementFromURI
in interfaceMediaPackageElementBuilderPlugin
- Parameters:
uri
- the element location- Returns:
- the new media package element
- Throws:
UnsupportedElementException
- if creating the media package element fails- See Also:
MediaPackageElementBuilderPlugin.elementFromURI(URI)
-
destroy
public void destroy()
This method is called before the plugin is abandoned by the element builder.- Specified by:
destroy
in interfaceMediaPackageElementBuilderPlugin
- See Also:
MediaPackageElementBuilderPlugin.destroy()
-
elementFromManifest
public MediaPackageElement elementFromManifest(Node elementNode, MediaPackageSerializer serializer) throws UnsupportedElementException
Creates a media package element from the DOM element.- Specified by:
elementFromManifest
in interfaceMediaPackageElementBuilderPlugin
- Parameters:
elementNode
- the DOM nodeserializer
- the media package serializer- Returns:
- the media package element
- Throws:
UnsupportedElementException
- See Also:
MediaPackageElementBuilderPlugin.elementFromManifest(org.w3c.dom.Node, org.opencastproject.mediapackage.MediaPackageSerializer)
-
newElement
public MediaPackageElement newElement(MediaPackageElement.Type type, MediaPackageElementFlavor flavor)
Creates a new media package element of the specified type.- Specified by:
newElement
in interfaceMediaPackageElementBuilderPlugin
- Parameters:
type
- the element typeflavor
- the element flavor- Returns:
- the new media package element
- See Also:
MediaPackageElementBuilderPlugin.newElement(org.opencastproject.mediapackage.MediaPackageElement.Type, org.opencastproject.mediapackage.MediaPackageElementFlavor)
-
init
public void init() throws Exception
This method is called once in a plugin's life cycle. When this method is called, the plugin can make sure that everything is in place for it to work properly. If this isn't the case, it should throw an exception so it will no longer be bothered by the element builder.- Specified by:
init
in interfaceMediaPackageElementBuilderPlugin
- Throws:
Exception
- if some unrecoverable state is reached- See Also:
MediaPackageElementBuilderPlugin.init()
-
-