Class BatchProcessor

java.lang.Object
eu.bandm.tools.d2d2.base.BatchProcessor

public class BatchProcessor extends Object
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.
  • Field Details

    • filenameStemPlaceholder

      public static final String 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

      public static final String filename_template_transformations
      Name of the files or pseudo-files for extracted xslt transformations.
      See Also:
    • nsname_omitXmlDeclaration

      public static final NamespaceName nsname_omitXmlDeclaration
      Style-sheet parameter value to suppress xml declaration.
    • msg_counter

      protected final MessageCounter msg_counter
      Evident
    • msg

      Evident
  • Constructor Details

  • Method Details

    • error

      protected void error(String s, Object... args)
      Evident
    • error

      protected void error(Throwable ex, String s, Object... args)
      Evident
    • failure

      protected void failure(String s, Object... args)
      Evident
    • warning

      protected void warning(String s, Object... args)
      Evident
    • log

      protected void log(String s, Object... args)
      Evident
    • logStart

      protected void logStart(String s, Object... args)
      Evident
    • logEnd

      protected void logEnd(String s, Object... args)
      Evident
    • printErrorCounter

      protected void printErrorCounter()
      Print all non-zero message counters to console.
    • toFile

      public void toFile(File input)
      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

      public void toFile(File input, File outputDirectory)
      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

      public Map<BatchProcessor.Job,Object> apply(String input, String localname)
      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

      public Map<BatchProcessor.Job,Object> apply(File input) throws IOException
      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 parse
      localName - 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 translate
      job - 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 translate
      job - 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)