Class TaskProcessorCommand

java.lang.Object
eu.svjatoslav.alyverkko_cli.commands.task_processor.TaskProcessorCommand
All Implemented Interfaces:
Command

public class TaskProcessorCommand extends Object implements Command
TODO: What happens when directory gets renamed ? Will event listener reindex all files inside it for processing ? The TaskProcessorCommand continuously monitors a specified tasks directory for new or modified text files, checks if they have a "TOCOMPUTE:" marker, and if so, adds them to a priority queue to be processed in priority order. Once processed, results are appended to the same file.

Usage:

   alyverkko-cli mail
 
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    eu.svjatoslav.commons.cli_helper.parameter_parser.parameter.FileOption
    Optional CLI argument for specifying a configuration file path.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    executeCommand(String[] cliArguments)
    Executes the "mail" command, loading configuration, starting a WatchService on the mail directory, adding existing files to the task queue, and processing tasks in priority order.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • configFileOption

      public eu.svjatoslav.commons.cli_helper.parameter_parser.parameter.FileOption configFileOption
      Optional CLI argument for specifying a configuration file path.
  • Constructor Details

    • TaskProcessorCommand

      public TaskProcessorCommand()
  • Method Details

    • getCommandName

      public String getCommandName()
      Specified by:
      getCommandName in interface Command
      Returns:
      the name of this command, i.e., "mail".
    • executeCommand

      public void executeCommand(String[] cliArguments) throws IOException, InterruptedException
      Executes the "mail" command, loading configuration, starting a WatchService on the mail directory, adding existing files to the task queue, and processing tasks in priority order.
      Specified by:
      executeCommand in interface Command
      Parameters:
      cliArguments - the command-line arguments following the "mail" subcommand.
      Throws:
      IOException - if reading/writing tasks fails.
      InterruptedException - if the WatchService is interrupted.