Package org.opencastproject.mediapackage
Class MediaPackageParser
- java.lang.Object
-
- org.opencastproject.mediapackage.MediaPackageParser
-
public final class MediaPackageParser extends Object
Convenience implementation that supports serializing and deserializing media packages.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
getArrayAsXml(List<MediaPackage> mediaPackages)
Serializes media package list to a string.static List<MediaPackage>
getArrayFromXml(String xml)
Parses the serialized media package list.static String
getAsJSON(MediaPackage mediaPackage)
Serializes the media package to a JSON string.static String
getAsXml(MediaPackage mediaPackage)
Serializes the media package to a string.static Document
getAsXml(MediaPackage mediaPackage, MediaPackageSerializer serializer)
Serializes the media package to aDocument
.static Document
getAsXmlDocument(MediaPackage mp)
Serializes a media package to aDocument
without any further processing.static MediaPackage
getFromXml(String xml)
Parses the media package and returns its object representation.
-
-
-
Method Detail
-
getAsXml
public static String getAsXml(MediaPackage mediaPackage)
Serializes the media package to a string.- Parameters:
mediaPackage
- the media package- Returns:
- the serialized media package
-
getAsJSON
public static String getAsJSON(MediaPackage mediaPackage)
Serializes the media package to a JSON string.- Parameters:
mediaPackage
- the media package- Returns:
- the serialized media package
-
getAsXmlDocument
public static Document getAsXmlDocument(MediaPackage mp)
Serializes a media package to aDocument
without any further processing.
-
getAsXml
public static Document getAsXml(MediaPackage mediaPackage, MediaPackageSerializer serializer) throws MediaPackageException
Serializes the media package to aDocument
.todo Implementation is currently defective since it misses various properties. See http://opencast.jira.com/browse/MH-9489 Use
getAsXmlDocument(MediaPackage)
instead if you do not need a serializer.- Parameters:
mediaPackage
- the mediapackageserializer
- the serializer- Returns:
- the serialized media package
- Throws:
MediaPackageException
- if serializing fails
-
getFromXml
public static MediaPackage getFromXml(String xml) throws MediaPackageException
Parses the media package and returns its object representation.- Parameters:
xml
- the serialized media package- Returns:
- the media package instance
- Throws:
MediaPackageException
- if de-serializing the media package fails
-
getArrayAsXml
public static String getArrayAsXml(List<MediaPackage> mediaPackages) throws MediaPackageException
Serializes media package list to a string.- Parameters:
mediaPackages
- media package list to be serialized- Returns:
- serialized media package list
- Throws:
MediaPackageException
- if serialization fails
-
getArrayFromXml
public static List<MediaPackage> getArrayFromXml(String xml) throws MediaPackageException
Parses the serialized media package list.- Parameters:
xml
- String to be parsed- Returns:
- parsed media package list
- Throws:
MediaPackageException
- if de-serialization fails
-
-