Package eu.bandm.tools.d2d2.base
Class BatchProcessor
java.lang.Object
eu.bandm.tools.d2d2.base.BatchProcessor
Batch processing of d2d sources into different back-ends,
using BandMs' own "txsl" implementation of xslt 1_0.
Realizes more efficient processing of more than one input
file into more than one output format without module caching,
since the start-up phase must only be executed once.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classRepresents one transformation job, with all its parameters, to be applied to multiple d2d source file inputs. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringName of the files or pseudo-files for extracted xslt transformations.static final StringWill be replaced by a central substring of the name of the processed document to derive output file names.protected final MessageReceiver<SimpleMessage<@Opt XMLDocumentIdentifier>> Evidentprotected final MessageCounterEvidentstatic final NamespaceNameStyle-sheet parameter value to suppress xml declaration. -
Constructor Summary
ConstructorsConstructorDescriptionBatchProcessor(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg, ModuleRegistry modulereg, Text2Udom.ErrorStrategy errorStrategy, Transformation.Modifiers txsl_modifiers, Trace xsltTrace, int debuglevel, boolean writeIntermediateXsltCodeToFile, boolean partialDocs, @Opt SimpleFilePattern xmlOutputFilePattern, int lineWidth, BatchProcessor.Job... jobs) Only Constructor. -
Method Summary
Modifier and TypeMethodDescriptionService access point: process the d2d source text and return the results in a Map object.Service access point: process the d2d source text and return the results in a Map object and write it to files.Service access point: process the d2d source text and return the results in a Map object.protected @Opt Transformationdo_loadTransformationForModule(ResolvedModule mod, BatchProcessor.Job job, String dateNow, String fileBasis) Constructs the transformation xslt code for the given d2d source text module and the transformation described in one job in the CLI options.protected Templatesdo_loadTransformationForModule_jre(ResolvedModule mod, BatchProcessor.Job job, String dateNow, String fileBasis) protected voidEvidentprotected voidEvidentprotected voidEvidentprotected @Opt TransformationloadTransformationForModule(ResolvedModule mod, BatchProcessor.Job job, String dateNow, String fileBasis) Constructs the transformation xslt code for the given d2d source text module and the transformation described in one job of the command line options.protected TemplatesloadTransformationForModule_jre(ResolvedModule mod, BatchProcessor.Job job, String dateNow, String fileBasis) protected voidEvidentprotected voidEvidentprotected voidEvidentprotected voidPrint all non-zero message counters to console.voidService access point: process the d2d source text and write the results to disk files.voidService access point: process the d2d source text and write the results to disk files.protected voidEvident
-
Field Details
-
filenameStemPlaceholder
Will be replaced by a central substring of the name of the processed document to derive output file names.- See Also:
-
filename_template_transformations
Name of the files or pseudo-files for extracted xslt transformations.- See Also:
-
nsname_omitXmlDeclaration
Style-sheet parameter value to suppress xml declaration. -
msg_counter
Evident -
msg
Evident
-
-
Constructor Details
-
BatchProcessor
public BatchProcessor(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg, ModuleRegistry modulereg, Text2Udom.ErrorStrategy errorStrategy, Transformation.Modifiers txsl_modifiers, Trace xsltTrace, int debuglevel, boolean writeIntermediateXsltCodeToFile, boolean partialDocs, @Opt @Opt SimpleFilePattern xmlOutputFilePattern, int lineWidth, BatchProcessor.Job... jobs) Only Constructor. All parameters are stored and are equally valid for all files which will subsequently be translated by this instance.
-
-
Method Details
-
error
Evident -
error
Evident -
failure
Evident -
warning
Evident -
log
Evident -
logStart
Evident -
logEnd
Evident -
printErrorCounter
protected void printErrorCounter()Print all non-zero message counters to console. -
toFile
Service access point: process the d2d source text and write the results to disk files. The written files will be in the same directory as the input file.- Parameters:
input- must be an absolute path to the d2d source.
-
toFile
Service access point: process the d2d source text and write the results to disk files.- Parameters:
input- must be an absolute path to the d2d source.outputDirectory- where to put the result files
-
apply
Service access point: process the d2d source text and return the results in a Map object.- Parameters:
input- contains the d2d source.localname- a fictional file name, used for error messaging and deriving the names of the output files.- Returns:
- a Map to either Udom result structures or Strings in case of mere-text target format.
-
apply
Service access point: process the d2d source text and return the results in a Map object.- Parameters:
input- must be a path (relative or absolute) to the d2d source.- Returns:
- a Map to either Udom result structures or Strings in case of mere-text target format.
- Throws:
IOException
-
apply
public Map<BatchProcessor.Job,Object> apply(Reader input, String localName, @Opt @Opt File outputDirectory) Service access point: process the d2d source text and return the results in a Map object and write it to files.- Parameters:
input- the input to parselocalName- a fictional file name, used for error messaging and deriving the names of the output files.outputDirectory- where to put the result files. May be ==null for no file writing.- Returns:
- a Map to either Udom result structures or Strings in case of mere-text target format.
-
loadTransformationForModule
@Opt protected @Opt Transformation loadTransformationForModule(ResolvedModule mod, BatchProcessor.Job job, String dateNow, String fileBasis) Constructs the transformation xslt code for the given d2d source text module and the transformation described in one job of the command line options.- Parameters:
mod- resolved module containing the definition of the top-most element to translatejob- the transformation description, giving target name, target tdom, target file name etc.dateNow- for the creation comment in the generated files (=side effect for debugging)fileBasis- directory for the generated files (=side effect for debugging)- Returns:
- cached result or null in case of error (signalled now or already earlier)
-
do_loadTransformationForModule
@Opt protected @Opt Transformation do_loadTransformationForModule(ResolvedModule mod, BatchProcessor.Job job, String dateNow, String fileBasis) Constructs the transformation xslt code for the given d2d source text module and the transformation described in one job in the CLI options.- Parameters:
mod- resolved module containing the definition of the top-most element to translatejob- the transformation description, giving target name, target tdom, target file name etc.dateNow- for the creation comment in the generated files (=side effect for debugging)fileBasis- dirctory for the generated files (=side effect for debugging)- Returns:
- null in case of error
-
loadTransformationForModule_jre
@Opt protected Templates loadTransformationForModule_jre(ResolvedModule mod, BatchProcessor.Job job, String dateNow, String fileBasis) -
do_loadTransformationForModule_jre
@Opt protected Templates do_loadTransformationForModule_jre(ResolvedModule mod, BatchProcessor.Job job, String dateNow, String fileBasis)
-