public class DataProcessor extends WithDiagnostics implements scala.Serializable
Constructor and Description |
---|
DataProcessor(org.apache.daffodil.runtime1.processors.DataProcessor dp) |
Modifier and Type | Method and Description |
---|---|
DaffodilUnparseContentHandler |
newContentHandlerInstance(java.nio.channels.WritableByteChannel output)
Obtain a new
DaffodilUnparseContentHandler from the current DataProcessor . |
DaffodilParseXMLReader |
newXMLReaderInstance()
Obtain a new
DaffodilParseXMLReader from the current DataProcessor . |
ParseResult |
parse(InputSourceDataInputStream input,
InfosetOutputter output)
Parse input data from an InputSourceDataInputStream and output the infoset to an InfosetOutputter
|
void |
save(java.nio.channels.WritableByteChannel output)
Save the DataProcessor
|
UnparseResult |
unparse(InfosetInputter input,
java.nio.channels.WritableByteChannel output)
Unparse an InfosetInputter
|
void |
walkMetadata(org.apache.daffodil.runtime1.api.MetadataHandler handler)
Walks the handler over the runtime
Metadata structures. |
DataProcessor |
withDebugger(org.apache.daffodil.runtime1.debugger.Debugger dbg)
Obtain a new
DataProcessor with a specified debugger. |
DataProcessor |
withDebuggerRunner(DebuggerRunner dr)
Obtain a new
DataProcessor with a specified debugger runner. |
DataProcessor |
withDebugging(boolean flag)
Obtain a new
DataProcessor instance with debugging enabled or disabled. |
DataProcessor |
withExternalVariables(java.util.AbstractMap<java.lang.String,java.lang.String> extVars)
Obtain a new
DataProcessor with multiple DFDL variables set. |
DataProcessor |
withExternalVariables(java.io.File extVars)
Obtain a new
DataProcessor with external variables read from a Daffodil configuration file |
DataProcessor |
withValidationMode(ValidationMode mode)
Obtain a new
DataProcessor having a specific validation mode |
DataProcessor |
withValidator(org.apache.daffodil.lib.api.Validator validator)
Obtain a new
DataProcessor having a specific validator |
getDiagnostics, isError
public DataProcessor(org.apache.daffodil.runtime1.processors.DataProcessor dp)
public DaffodilUnparseContentHandler newContentHandlerInstance(java.nio.channels.WritableByteChannel output)
DaffodilUnparseContentHandler
from the current DataProcessor
.output
- (undocumented)public DaffodilParseXMLReader newXMLReaderInstance()
DaffodilParseXMLReader
from the current DataProcessor
.public ParseResult parse(InputSourceDataInputStream input, InfosetOutputter output)
input
- data to be parsedoutput
- the InfosetOutputter that will be used to output the infosetpublic void save(java.nio.channels.WritableByteChannel output)
The resulting output can be reloaded by Compiler.reload(java.nio.channels.ReadableByteChannel)
.
Note that external variable bindings are not saved, and will not be restored upon reloading.
output
- the byte channel to write the DataProcessor
topublic UnparseResult unparse(InfosetInputter input, java.nio.channels.WritableByteChannel output)
input
- the infoset inputter to use for unparsingoutput
- the byte channel to write the data topublic void walkMetadata(org.apache.daffodil.runtime1.api.MetadataHandler handler)
Metadata
structures.
These provide information about name, namespace, type, simple/complex, etc.
This is used to interface Daffodil runtime1 metadata to the metadata structures of other software systems.
See MetadataHandler
for more motivating materials about
runtime1 metadata walking.
handler
- - the handler is called-back during the walk as each metadata structure is encountered.public DataProcessor withDebugger(org.apache.daffodil.runtime1.debugger.Debugger dbg)
DataProcessor
with a specified debugger.
dbg
- debuggerpublic DataProcessor withDebuggerRunner(DebuggerRunner dr)
DataProcessor
with a specified debugger runner.
dr
- debugger runnerpublic DataProcessor withDebugging(boolean flag)
DataProcessor
instance with debugging enabled or disabled.
Before enabling, withDebugger(Debugger)
or withDebuggerRunner(DebuggerRunner)
must be called to obtain a DataProcessor
with a non-null debugger.
flag
- true to enable debugging, false to disabledpublic DataProcessor withExternalVariables(java.io.File extVars) throws ExternalVariableException
DataProcessor
with external variables read from a Daffodil configuration file
extVars
- file to read DFDL variables from.ExternalVariableException
- if an error occurs while setting an external variablepublic DataProcessor withExternalVariables(java.util.AbstractMap<java.lang.String,java.lang.String> extVars) throws ExternalVariableException
DataProcessor
with multiple DFDL variables set.
extVars
- a map of key/value pairs, where the key is the variable
name, and the value is the value of the variable. The key
may be preceded by a string of the form "{namespace}" to
define a namespace for the variable. If preceded with "{}",
then no namespace is used. If not preceded by anything,
then Daffodil will figure out the namespace.ExternalVariableException
- if an error occurs while setting an external variablepublic DataProcessor withValidationMode(ValidationMode mode) throws InvalidUsageException
DataProcessor
having a specific validation mode
mode
- mode to control validationInvalidUsageException
- if mode is not a valid ValidateMode valuepublic DataProcessor withValidator(org.apache.daffodil.lib.api.Validator validator)
DataProcessor
having a specific validatorvalidator
- validator instance