net.sf.okapi.common.pipelinedriver

## Class PipelineDriver

- java.lang.Object
- - net.sf.okapi.common.pipelinedriver.PipelineDriver

- All Implemented Interfaces:
    IPipelineDriver

      public class PipelineDriver
      extends java.lang.Object
      implements IPipelineDriver

  Default implementation of the `IPipelineDriver` interface.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PipelineDriver()` Creates an new PipelineDriver object with an empty pipeline.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addBatchItem(IBatchItemContext item)` Adds an item to this batch.
    `void` | `addBatchItem(RawDocument... rawDocs)` Adds an item to this batch, using one or more RawDocument objects.
    `void` | `addBatchItem(RawDocument rawDoc, java.net.URI outputURI, java.lang.String outputEncoding)` Adds an item to this batch, using a RawDocument object.
    `void` | `addBatchItem(java.net.URI inputURI, java.lang.String defaultEncoding, java.lang.String filterConfigId, LocaleId srcLoc, LocaleId trgLoc)` Adds an item to this batch, using direct parameters.
    `void` | `addStep(IPipelineStep step)` Adds a step to the pipeline currently associated with this driver.
    `void` | `clearItems()` Removes all current batch items from this driver.
    `void` | `clearSteps()` Remove all the `IPipelineStep`s from the pipeline.
    `void` | `destroy()` Destroy the pipeline releasing all resources
    `protected void` | `displayInput(IBatchItemContext item)` Logs the information about which batch item is about to be processed.
    `protected java.util.List<IBatchItemContext>` | `getBatchItems()`
    `protected ExecutionContext` | `getContext()`
    `protected IFilterConfigurationMapper` | `getFcMapper()`
    `protected java.lang.String` | `getInputRootDir()`
    `protected java.lang.String` | `getOutputDir()`
    `protected java.util.LinkedList<java.util.List<ConfigurationParameter>>` | `getParamList()`
    `IPipeline` | `getPipeline()` Gets the `IPipeline` currently associated with this driver.
    `int` | `getRequestedInputCount()` Gets the highest number of input documents needed to run the pipeline for this driver.
    `protected java.lang.String` | `getRootDir()`
    `protected java.lang.Object` | `getUiParent()`
    `void` | `processBatch()` Processes all the batch items currently in the driver.
    `void` | `processBatch(java.util.List<IBatchItemContext> batchItems)` Sets a new set of batch items for this driver and processes them.
    `void` | `setExecutionContext(ExecutionContext context)` Sets the execution context for this driver.
    `void` | `setFilterConfigurationMapper(IFilterConfigurationMapper fcMapper)` Sets the filter configuration mapper object for this driver.
    `void` | `setOutputDirectory(java.lang.String outputDir)` Sets the output directory according to the user's preferences.
    `void` | `setPipeline(IPipeline pipeline)` Sets the `IPipeline` to use with this driver.
    `void` | `setRootDirectories(java.lang.String rootDir, java.lang.String inputRootDir)` Sets the root directories corresponding to the ${rootDir} and ${inputRootDir} variables for steps.
    `void` | `setUIParent(java.lang.Object uiParent)` Sets the UI parent object for this driver.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PipelineDriver

          public PipelineDriver()

      Creates an new PipelineDriver object with an empty pipeline.

  - ### Method Detail

    - #### setFilterConfigurationMapper

          public void setFilterConfigurationMapper(IFilterConfigurationMapper fcMapper)

      Description copied from interface: `IPipelineDriver`
      Sets the filter configuration mapper object for this driver.
      Specified by:
        `setFilterConfigurationMapper` in interface `IPipelineDriver`
      Parameters:
        `fcMapper` - the filter configuration mapper to use.

    - #### setRootDirectories

          public void setRootDirectories(java.lang.String rootDir,
                                java.lang.String inputRootDir)

      Description copied from interface: `IPipelineDriver`
      Sets the root directories corresponding to the ${rootDir} and ${inputRootDir} variables for steps.
      Specified by:
        `setRootDirectories` in interface `IPipelineDriver`
      Parameters:
        `rootDir` - the root directory of the project. If it is null, the fall-back is expected to be the user home directory.
        `inputRootDir` - the root directory of the first set of input files. If it is null, the fall-back is expected to be an empty string.

    - #### setOutputDirectory

          public void setOutputDirectory(java.lang.String outputDir)

      Description copied from interface: `IPipelineDriver`
      Sets the output directory according to the user's preferences.
      Specified by:
        `setOutputDirectory` in interface `IPipelineDriver`
      Parameters:
        `outputDir` - the output directory, possibly overridden to be different from the inputRootDir.

    - #### setUIParent

          public void setUIParent(java.lang.Object uiParent)

      Description copied from interface: `IPipelineDriver`
      Sets the UI parent object for this driver.
      Specified by:
        `setUIParent` in interface `IPipelineDriver`
      Parameters:
        `uiParent` - the UI parent object (window/shell/etc.). Its type depend on the caller, for example for SWT you pass the shell of the caller.

    - #### setExecutionContext

          public void setExecutionContext(ExecutionContext context)

      Description copied from interface: `IPipelineDriver`
      Sets the execution context for this driver.
      Specified by:
        `setExecutionContext` in interface `IPipelineDriver`
      Parameters:
        `context` - the execution context such as batch mode, CLI/GUI, etc.

    - #### setPipeline

          public void setPipeline(IPipeline pipeline)

      Description copied from interface: `IPipelineDriver`
      Sets the `IPipeline` to use with this driver.
      Specified by:
        `setPipeline` in interface `IPipelineDriver`
      Parameters:
        `pipeline` - the new `IPipeline` to associate with this driver.

    - #### getPipeline

          public IPipeline getPipeline()

      Description copied from interface: `IPipelineDriver`
      Gets the `IPipeline` currently associated with this driver.
      Specified by:
        `getPipeline` in interface `IPipelineDriver`
      Returns:
        the `IPipeline` currently associated with this driver.

    - #### addStep

          public void addStep(IPipelineStep step)

      Description copied from interface: `IPipelineDriver`
      Adds a step to the pipeline currently associated with this driver.
      Specified by:
        `addStep` in interface `IPipelineDriver`
      Parameters:
        `step` - the step to add.

    - #### processBatch

          public void processBatch(java.util.List<IBatchItemContext> batchItems)

      Description copied from interface: `IPipelineDriver`
      Sets a new set of batch items for this driver and processes them. Any batch item that was already in the driver is removed and replaced by the ones provided to this method.
      Specified by:
        `processBatch` in interface `IPipelineDriver`
      Parameters:
        `batchItems` - the list of the batch items to process.

    - #### processBatch

          public void processBatch()

      Description copied from interface: `IPipelineDriver`
      Processes all the batch items currently in the driver.
      Specified by:
        `processBatch` in interface `IPipelineDriver`

    - #### addBatchItem

          public void addBatchItem(IBatchItemContext item)

      Description copied from interface: `IPipelineDriver`
      Adds an item to this batch.
      Specified by:
        `addBatchItem` in interface `IPipelineDriver`
      Parameters:
        `item` - the item to add to this batch.

    - #### addBatchItem

          public void addBatchItem(RawDocument... rawDocs)

      Description copied from interface: `IPipelineDriver`
      Adds an item to this batch, using one or more RawDocument objects. The added batch item will have as many input documents as provided.
      Specified by:
        `addBatchItem` in interface `IPipelineDriver`
      Parameters:
        `rawDocs` - one or more RawDocuments to include in this item.

    - #### addBatchItem

          public void addBatchItem(RawDocument rawDoc,
                          java.net.URI outputURI,
                          java.lang.String outputEncoding)

      Description copied from interface: `IPipelineDriver`
      Adds an item to this batch, using a RawDocument object. The added item will have a single input document.
      Specified by:
        `addBatchItem` in interface `IPipelineDriver`
      Parameters:
        `rawDoc` - the RawDocument object from which to create an entry.
        `outputURI` - path of the output document (can be null if no used)
        `outputEncoding` - encoding of the output (can be null if no used)

    - #### addBatchItem

          public void addBatchItem(java.net.URI inputURI,
                          java.lang.String defaultEncoding,
                          java.lang.String filterConfigId,
                          LocaleId srcLoc,
                          LocaleId trgLoc)

      Description copied from interface: `IPipelineDriver`
      Adds an item to this batch, using direct parameters. The added item will have a single input document.
      Specified by:
        `addBatchItem` in interface `IPipelineDriver`
      Parameters:
        `inputURI` - the URI of the input document.
        `defaultEncoding` - the default encoding of the document.
        `filterConfigId` - the filter configuration ID of the document (can be null if not used).
        `srcLoc` - the source locale.
        `trgLoc` - the target locale.

    - #### clearItems

          public void clearItems()

      Description copied from interface: `IPipelineDriver`
      Removes all current batch items from this driver.
      Specified by:
        `clearItems` in interface `IPipelineDriver`

    - #### displayInput

          protected void displayInput(IBatchItemContext item)

      Logs the information about which batch item is about to be processed. This method is called inside the loop that process the batch.
      Parameters:
        `item` - the batch item that is about to be processed.

    - #### clearSteps

          public void clearSteps()

      Description copied from interface: `IPipelineDriver`
      Remove all the `IPipelineStep`s from the pipeline. Also calls the destroy() method on each step.
      Specified by:
        `clearSteps` in interface `IPipelineDriver`

    - #### getRequestedInputCount

          public int getRequestedInputCount()

      Description copied from interface: `IPipelineDriver`
      Gets the highest number of input documents needed to run the pipeline for this driver.
      Specified by:
        `getRequestedInputCount` in interface `IPipelineDriver`
      Returns:
        the higher number of input document needed.

    - #### destroy

          public void destroy()

      Description copied from interface: `IPipelineDriver`
      Destroy the pipeline releasing all resources
      Specified by:
        `destroy` in interface `IPipelineDriver`

    - #### getBatchItems

          protected java.util.List<IBatchItemContext> getBatchItems()

    - #### getParamList

          protected java.util.LinkedList<java.util.List<ConfigurationParameter>> getParamList()

    - #### getFcMapper

          protected IFilterConfigurationMapper getFcMapper()

    - #### getRootDir

          protected java.lang.String getRootDir()

    - #### getInputRootDir

          protected java.lang.String getInputRootDir()

    - #### getOutputDir

          protected java.lang.String getOutputDir()

    - #### getUiParent

          protected java.lang.Object getUiParent()

    - #### getContext

          protected ExecutionContext getContext()