public class T2FlowReader extends Object implements WorkflowBundleReader
Modifier and Type | Field and Description |
---|---|
static String |
APPLICATION_VND_TAVERNA_T2FLOW_XML |
protected static URI |
ENTITY |
protected static URI |
HAD_ORIGINAL_SOURCE |
protected static URI |
PROV |
Constructor and Description |
---|
T2FlowReader() |
Modifier and Type | Method and Description |
---|---|
protected String |
bundleUUID(WorkflowBundle bundle) |
Set<String> |
getMediaTypes()
Return the media types that this reader can read.
|
T2FlowParser |
getParser() |
String |
guessMediaTypeForSignature(byte[] firstBytes)
Attempt to guess the media type for a stream or file that starts with
these bytes.
|
protected void |
preserveOriginal(WorkflowBundle bundle,
InputStream t2flowStream) |
WorkflowBundle |
readBundle(File bundleFile,
String mediaType)
Read a file containing a workflow bundle in the specified media type and
return a
WorkflowBundle . |
WorkflowBundle |
readBundle(InputStream inputStream,
String mediaType)
Read a stream containing a workflow bundle in the specified media type
and return a
WorkflowBundle . |
void |
setParser(T2FlowParser parser) |
protected static final URI PROV
protected static final URI HAD_ORIGINAL_SOURCE
protected static final URI ENTITY
public static final String APPLICATION_VND_TAVERNA_T2FLOW_XML
public Set<String> getMediaTypes()
WorkflowBundleReader
Returned media types are must be valid mediaType
arguments
to WorkflowBundleReader.readBundle(File, String)
and/or
WorkflowBundleReader.readBundle(InputStream, String)
for this reader.
It is recommended, but not required, that the reader can also recognise
those media types from WorkflowBundleReader.guessMediaTypeForSignature(byte[])
.
If the returned set is empty, the reader should should be able to
Recognise at least one media type from
WorkflowBundleReader.guessMediaTypeForSignature(byte[])
.
getMediaTypes
in interface WorkflowBundleReader
public WorkflowBundle readBundle(File bundleFile, String mediaType) throws ReaderException, IOException
WorkflowBundleReader
WorkflowBundle
.readBundle
in interface WorkflowBundleReader
bundleFile
- the file containing the workflow bundlemediaType
- the media type of the workflow bundleWorkflowBundle
read from the fileReaderException
- if there is an error parsing the workflow bundleIOException
- if there is an error reading the fileprotected void preserveOriginal(WorkflowBundle bundle, InputStream t2flowStream) throws IOException
IOException
protected String bundleUUID(WorkflowBundle bundle)
public WorkflowBundle readBundle(InputStream inputStream, String mediaType) throws ReaderException, IOException
WorkflowBundleReader
WorkflowBundle
.readBundle
in interface WorkflowBundleReader
inputStream
- the stream containing the workflow bundlemediaType
- the media type of the workflow bundleWorkflowBundle
read from the streamReaderException
- if there is an error parsing the workflow bundleIOException
- if there is an error reading from the streampublic void setParser(T2FlowParser parser)
public T2FlowParser getParser() throws JAXBException
JAXBException
public String guessMediaTypeForSignature(byte[] firstBytes)
WorkflowBundleReader
Return null
if ambiguous (more than one possibility) or
unknown.
Typically a WorkflowBundleReader should be able to recognise the same
types as those listed in WorkflowBundleReader.getMediaTypes()
, but this is no
requirement. A WorkflowBundleReader could also recognise types not listed
in its WorkflowBundleReader.getMediaTypes()
.
guessMediaTypeForSignature
in interface WorkflowBundleReader
firstBytes
- The initial bytes, at least 512 bytes long unless the resource
is smaller.null
if the bytes were
ambiguous or unknown.Copyright © 2014 myGrid. All rights reserved.