Class Batch

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

public class Batch 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, since the start-up phase must only be executed once.

This class has one static method only and is the command-line front end for BatchProcessor. That class is less restricted. Here, due to the syntax of BatchOptions, for instance only one single set of style-sheet parameters can be given, for all transformations.

If any parsing of the inputs is wanted, then at least one xslt processing job or the mere xml output must be requested.

  • Field Details

    • prototypeGui

      public static final BatchOptionsGui prototypeGui
      Service access point: prototype for gui-based client software.
  • Constructor Details

    • Batch

      public Batch()
  • Method Details

    • s_error

      protected static <D> void s_error(MessageReceiver<SimpleMessage<D>> msg, String s, Object... args)
      Evident
    • s_warning

      protected static <D> void s_warning(MessageReceiver<SimpleMessage<D>> msg, int debuglevel, String s, Object... args)
      Evident
      Parameters:
      debuglevel - the parameter value given by the caller. The warning is only printed if that is > 0.
    • s_log

      protected static <D> void s_log(MessageReceiver<SimpleMessage<D>> msg, int debuglevel, String s, Object... args)
      Evident
      Parameters:
      debuglevel - the parameter value given by the caller. The logging is only printed if that is > 0.
    • printErrorCounter

      protected static void printErrorCounter(MessageCounter mc)
      Evident
    • terminateApplicationOnErrors_printUsage

      protected static void terminateApplicationOnErrors_printUsage(MessageCounter mc)
      Evident
    • terminateApplicationOnErrors

      protected static void terminateApplicationOnErrors(MessageCounter mc)
      Evident
    • initModuleReg

      protected static ModuleRegistry initModuleReg(BatchOptions options, MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg)
      Construct a module registry according to the command line options.
    • initErrorStrategy

      protected static Text2Udom.ErrorStrategy initErrorStrategy(BatchOptions options)
      Construct an eror strategy according to the command line options.
    • convert

      protected static EnumSet<Options.traceflag> convert(EnumSet<BatchOptions.traceflag> set)
      Convert an enum set of xslt trace flags as defined in this package to a set of trace flags as defined with xslt. Correspondance is by name.
    • interpretCommandline

      public static void interpretCommandline(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg, String cli_text)
      Service access point: execute the value as if it were a command line suffix.
    • nonStatic_interpretCommandline

      public void nonStatic_interpretCommandline(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg, String cli_text)
      Simulate CLI input for programmatic use, esp. for tests. Does NOT decode the "--version" option, etc.
    • main

      public static void main(String[] args)
      Central command line processing method. The command line parameters are defined by BatchOptions. The processing uses the metatools xslt 1.0 implementation "txsl", and the options include also most txsl options.

      Stylesheet parameters can be given a sequence of style sheet parameter files, and one by one on the command line, with increasing priority. The character SimpleFilePattern.defaultPlaceholder can be used in these parameter values and will be replaced by the file name stem currently processed.

      One single call converts "k" source files into "m" output files using xslt, plus possibly the pure ".xml" version. This produces "k*m" or "k*(m+1)" output files, while all preparatory module loading, xslt compiling, etc. is performed only once. The source files are given as file position (not as "URI" etc.)

      The naming for the output files is as follows: A "stem" is extracted from all sources, and combined with all target formats to construct the output file name, in the same way as "make" does. See SimpleFilePattern for details. The placeholder character can also appear in style sheet parameter values, and will also be replaced by the stem.

      The following combination of input data are currently supported:

            sources     pattern   xmlOut       resultFiles          styleshee    
                                                                     parameters
            a.b b.b     %.b       %.xml        %.html %.mk           %  <src>%<</src>
      
         NOT supported:
         --single source mode--
            a.b         (na)      my.xml       other.html  adLib.mk  (none)
         --or even mixed
            a.b         %.b       my.xml       %.html  adLib.mk      %  &tl;src>%</src>
        
      (The placeholder character MUST be present in the pattern and in all output file names.)
    • execute

      public static boolean execute(BatchOptions options, MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msgIn)
      Execute the CLI-parsed or GUI-generated Option model.
      Returns:
      whether the kind of error proposes to any cli-based caller to present the "usage()" in case of errors
      See Also: