ChainPreParser
Configuration file |
ChainPreParser.properties |
Class name |
com.ebd.hub.datawizard.parser.stream.ChainPreParser |
Description
This preparser is able to chain up several preparsers. You could, for example, unzip a file with the GzipDecoderPreparser, subsequently remove invalid control characters from the file with the EncodingPatcher and finally remove enclosing quotes from each line with the QuotationRemover. It is up to the user to generate a useful composition of preparsers. The ChainPreParser expects a properties file with the following structure for each preparser position in the chain.
ChainPosition.<N>=<full class name><additional parameter> |
Separate specification of class and additional parameter. |
ChainPosition.<N>=./conf/<subdir>/<PPP-filename>.ppp |
Configuration file of the ChainPosition in PPP format. |
The number "<N>" of the "ChainPosition" can vary from 0 to 9 (higher numbers will be ignored). "ChainPosition.0" must be defined, otherwise, the process will be aborted with an error. The chain positions are processed in an ascending order. The order may have gaps.
The delimiter between the full class name and the additional parameter can be a whitespace, tab, colon, semicolon, or comma. If the additional parameter includes spaces, they have to be escaped with "\" (should be avoided). The additional parameter can be omitted if the correlating preparser does not need any additional configuration. The additional parameter can be a literal value (as in the example below for the EncodingPatcher) or the path to a configuration file.
The PPP file must be under folder "./conf/" and have the ending ".ppp". It is a properties file that first contains the class name of the preparser to be called as property "preparser.class.name" and after that the properties for the configuration of the preparser.
Configuration rules of the ChainPreParser
If the profile contains an additional parameter for the ChainPreParser, it will be used as a relative or absolute path name of the configuration file. Note: Recommended.
If the additional parameter is empty, or only contains whitespaces, the file ./conf/ChainPreParser.properties will be used.
If no configuration can be found in (1) or (2) or no property "ChainPosition.0" is found, the process will be aborted with an error.Example file
ChainPosition.0=com.ebd.hub.datawizard.parser.stream.QuotationRemover
ChainPosition.1=com.ebd.hub.datawizard.parser.stream.EncodingPatcher 0x74657374=
ChainPosition.2=./conf/ppp/EdifactFormatter.ppp
Note: This file can also be created with the Chaining Wizard.
Note: It is also possible to specify multiline preparser configurations with "\r\n". So if you want to specify the parameters
rows=2 |
for the TokenStreamSplitter, you can do that in the following way.
ChainPosition.0=com.ebd.hub.datawizard.parser.stream.TokenStreamSplitter rows=2\r\nheader=CC+SDG |