Package org.apache.daffodil.api
Interface Compiler
public interface Compiler
Compile DFDL schemas into
ProcessorFactory
's or
reload saved parsers into DataProcessor
's.
Use Daffodil#compiler()
to get a compiler instance.
-
Method Summary
Modifier and TypeMethodDescriptiondefault ProcessorFactory
compileFile
(File schemaFile) Compile DFDL schema file into aProcessorFactory
default ProcessorFactory
compileFile
(File schemaFile, String rootName) Compile DFDL schema file into aProcessorFactory
compileFile
(File schemaFile, String rootName, String rootNamespace) Compile DFDL schema file into aProcessorFactory
default ProcessorFactory
compileResource
(String name) Compile DFDL resource name into aProcessorFactory
default ProcessorFactory
compileResource
(String name, String rootName) Compile DFDL resource name into aProcessorFactory
compileResource
(String name, String rootName, String rootNamespace) Compile DFDL resource name into aProcessorFactory
default ProcessorFactory
compileSource
(URI uri) Compile DFDL schema source into aProcessorFactory
default ProcessorFactory
compileSource
(URI uri, String rootName) Compile DFDL schema source into aProcessorFactory
compileSource
(URI uri, String rootName, String rootNamespace) Compile DFDL schema source into aProcessorFactory
Reload a saved parser from a filereload
(ReadableByteChannel savedParser) Reload a saved parser from a java.nio.channels.ReadableByteChannelwithTunable
(String tunable, String value) Return a newCompiler
with a specific Daffodil tunable parameterwithTunables
(Map<String, String> tunables) Return a newCompiler
with multiple tunable parameters
-
Method Details
-
compileFile
Compile DFDL schema file into aProcessorFactory
To allow jar-file packaging, (where schema files might be part of a jar), it is recommended to use
Compiler.compileSource
instead.- Parameters:
schemaFile
- DFDL schema file used to create aProcessorFactory
.- Returns:
ProcessorFactory
used to createDataProcessor
(s). Must checkProcessorFactory.isError
before using it.
-
compileFile
Compile DFDL schema file into aProcessorFactory
To allow jar-file packaging, (where schema files might be part of a jar), it is recommended to use
Compiler.compileSource
instead.- Parameters:
schemaFile
- DFDL schema file used to create aProcessorFactory
.rootName
- name of root element, or null to choose automatically from first element of schema.- Returns:
ProcessorFactory
used to createDataProcessor
(s). Must checkProcessorFactory.isError
before using it.
-
compileFile
Compile DFDL schema file into aProcessorFactory
To allow jar-file packaging, (where schema files might be part of a jar), it is recommended to use
Compiler.compileSource
instead.- Parameters:
schemaFile
- DFDL schema file used to create aProcessorFactory
.rootName
- name of root element, or null to choose automatically from first element of schema.rootNamespace
- String of namespace of the root element, or null to infer automatically when unambiguous. Pass "" (empty string) for No Namespace.*- Returns:
ProcessorFactory
used to createDataProcessor
(s). Must checkProcessorFactory.isError
before using it.
-
compileSource
Compile DFDL schema source into aProcessorFactory
- Parameters:
uri
- URI of DFDL schema file used to create aProcessorFactory
.- Returns:
ProcessorFactory
used to createDataProcessor
(s). Must checkProcessorFactory.isError
before using it.
-
compileSource
Compile DFDL schema source into aProcessorFactory
- Parameters:
uri
- URI of DFDL schema file used to create aProcessorFactory
.rootName
- name of root element, or null to choose automatically from first element of schema.- Returns:
ProcessorFactory
used to createDataProcessor
(s). Must checkProcessorFactory.isError
before using it.
-
compileSource
Compile DFDL schema source into aProcessorFactory
- Parameters:
uri
- URI of DFDL schema file used to create aProcessorFactory
.rootName
- name of root element, or null to choose automatically from first element of schema.rootNamespace
- String of namespace of the root element, or null to infer automatically when unambiguous. Pass "" (empty string) for No Namespace.- Returns:
ProcessorFactory
used to createDataProcessor
(s). Must checkProcessorFactory.isError
before using it.
-
compileResource
Compile DFDL resource name into aProcessorFactory
- Parameters:
name
- Resource name of a DFDL schema used to create aProcessorFactory
.- Returns:
ProcessorFactory
used to createDataProcessor
(s). Must checkProcessorFactory.isError
before using it.- Throws:
IOException
- if resource cannot be found
-
compileResource
Compile DFDL resource name into aProcessorFactory
- Parameters:
name
- Resource name of a DFDL schema used to create aProcessorFactory
.rootName
- name of root element, or null to choose automatically from first element of schema.- Returns:
ProcessorFactory
used to createDataProcessor
(s). Must checkProcessorFactory.isError
before using it.- Throws:
IOException
- if resource cannot be found
-
compileResource
ProcessorFactory compileResource(String name, String rootName, String rootNamespace) throws IOException Compile DFDL resource name into aProcessorFactory
- Parameters:
name
- Resource name of a DFDL schema used to create aProcessorFactory
.rootName
- name of root element, or null to choose automatically from first element of schema.rootNamespace
- String of namespace of the root element, or null to infer automatically when unambiguous. Pass "" (empty string) for No Namespace.- Returns:
ProcessorFactory
used to createDataProcessor
(s). Must checkProcessorFactory.isError
before using it.- Throws:
IOException
- if resource cannot be found
-
reload
Reload a saved parser from a fileTo allow jar-file packaging, (where the savedParser might be part of a jar), it is recommended to use the other version of
Compiler.reload(savedParser:java\.nio\.channels\.ReadableByteChannel)* Compiler.reload
where the argument is a java.nio.channels.ReadableByteChannel for a saved parser.- Parameters:
savedParser
- file of a saved parser, created withDataProcessor.save
- Returns:
DataProcessor
used to parse data. Must checkDataProcessor.isError
before using it.- Throws:
InvalidParserException
- if the file is not a valid saved parser.
-
reload
Reload a saved parser from a java.nio.channels.ReadableByteChannel- Parameters:
savedParser
- java.nio.channels.ReadableByteChannel of a saved parser, created withDataProcessor.save
- Returns:
DataProcessor
used to parse data. Must checkDataProcessor.isError
before using it.- Throws:
InvalidParserException
- if the file is not a valid saved parser.
-
withTunable
Return a newCompiler
with a specific Daffodil tunable parameter- Parameters:
tunable
- name of the tunable parameter to set.value
- value of the tunable parameter to set- Returns:
- new
Compiler
with a specific Daffodil tunable parameter - See Also:
-
- Tunable Parameters - list of tunables names of default values
-
withTunables
Return a newCompiler
with multiple tunable parameters- Parameters:
tunables
- a map of key/value pairs, where the key is the tunable name and the value is the value to set it to- Returns:
- new
Compiler
with multiple tunable parameters - See Also:
-
- Tunable Parameters - list of tunables names of default values
-