public class ScuflReader extends Object implements WorkflowBundleReader
Modifier and Type | Field and Description |
---|---|
static String |
APPLICATION_VND_TAVERNA_SCUFL_XML |
Constructor and Description |
---|
ScuflReader() |
Modifier and Type | Method and Description |
---|---|
Set<String> |
getMediaTypes()
Return the media types that this reader can read.
|
ScuflParser |
getParser() |
String |
guessMediaTypeForSignature(byte[] firstBytes)
Attempt to guess the media type for a stream or file that starts with
these bytes.
|
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(ScuflParser parser) |
public static final String APPLICATION_VND_TAVERNA_SCUFL_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 filepublic 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(ScuflParser parser)
public ScuflParser 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 © 2015–2016 The Apache Software Foundation. All rights reserved.