Class ConvertWizardConsole


  • public class ConvertWizardConsole
    extends Object
    This class represents a console to realize a kind of an interactive wizard to guide the user through the workflow configuration. This is a step by step wizard in which the the user needs to make an input for each step:
    1. Import phase
      1. choose source corpus
      2. choose importer (if possible show a list of recommended importers and the rest)
      3. choose configuration properties (wizard presents a list of possible properties)
      4. another importer? press enter for no, corpus path for yes
    2. Manipulation phase
      1. choose manipulator (enter for non)
      2. choose configuration properties (wizard presents a list of possible properties)
      3. another manipulator? press enter for no
    3. Export phase
      1. choose target path for corpus
      2. choose configuration properties (wizard presents a list of possible properties)
      3. another exporter? press enter for no, corpus path for yes
    Author:
    Florian Zipser
    • Field Detail

      • isDebug

        public Boolean isDebug
        Determines if debug mode is on or off
    • Constructor Detail

      • ConvertWizardConsole

        public ConvertWizardConsole​(String prefixPrompt)
        Initializes an object.
        Parameters:
        prefixPrompt - the prefix prompt to be displayed, before the prompt of this console.
    • Method Detail

      • getPepper

        public org.corpus_tools.pepper.common.Pepper getPepper()
        Returns:
        The Pepper object, which shall create and run the job
      • setPepper

        public void setPepper​(org.corpus_tools.pepper.common.Pepper pepper)
        Parameters:
        pepper - The Pepper object, which shall create and run the job
      • start

        public void start()
        Starts this console, using std in and std out.
      • start

        public org.corpus_tools.pepper.common.PepperJob start​(BufferedReader in,
                                                              PrintStream out)
        Starts the wizard for a 'session'. A wizard can only be started as singleton. That means it needs to be quit before it can be started again.
        1. startes wizard for import phase importPhase(PepperJob)
        2. startes wizard for manipulation phase manipulationPhase(PepperJob)
        3. startes wizard for export phase exportPhase(PepperJob)
        4. requests user input to store workflow description or to start conversion
        Parameters:
        in -
        out -
      • deresolveURIs

        public static void deresolveURIs​(File outputFile,
                                         org.corpus_tools.pepper.common.PepperJob pepperJob)
                                  throws IOException
        Before saving, create relative URIs for Pepper job. Create a base URI to deresolve relative URIs
        Parameters:
        outputFile -
        pepperJob -
        Throws:
        IOException
      • importPhase

        public boolean importPhase​(org.corpus_tools.pepper.common.PepperJob pepperJob)
        A sub wizard to manage the import phase. Asks all importers from the user.
        1. state 0: reads corpus path, empty input leads to exit import phase
        2. state 1: choose importer
        3. state 2: choose properties, empty input leads to state 0
        Parameters:
        pepperJob - the PepperJob object to be filled.
        Returns:
        true if an importer was chosen, false if phase was aborted
      • manipulationPhase

        public void manipulationPhase​(org.corpus_tools.pepper.common.PepperJob pepperJob)
        A sub wizard to manage the manipulation phase. Asks for all manipulators from the user.
        1. state 1: reads name of manipulator, empty input leads to exit import phase
        2. state 2: asks for properties, input leads to state 1
        Parameters:
        pepperJob - the PepperJob object to be filled.
      • exportPhase

        public boolean exportPhase​(org.corpus_tools.pepper.common.PepperJob pepperJob)
        A sub wizard to manage the import phase. Asks all importers from the user.
        1. state 0: choose output path, empty input leads to exit of export phase
        2. state 1: choose exporter
        3. state 2: choose property, empty input leads to state 0
        Parameters:
        pepperJob - the PepperJob object to be filled.
        Returns:
        if an exporter was set, false otherwise