Package de.gebit.integrity.runner.console.intercept

## Class DefaultConsoleInterceptionAggregator

- java.lang.Object
- - de.gebit.integrity.runner.console.intercept.DefaultConsoleInterceptionAggregator

- All Implemented Interfaces:
    `ConsoleInterceptionAggregator`

      public class DefaultConsoleInterceptionAggregator
      extends Object
      implements ConsoleInterceptionAggregator

  Default implementation of an interception aggregator. This one uses the `ConsoleOutputInterceptor` to do the actual intercepting.
  Author:
    Rene Schneider - initial API and implementation

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected Intercept` | `currentIntercept` | The currently active interception job.
    `protected Object` | `interceptionSync` | A sync object used to synchronize access to the interception buffer.
    `protected ConsoleOutputInterceptor` | `interceptor` | The interceptor service.
    `protected ConsoleInterceptorTarget` | `interceptorTarget` | The interceptor target used to receive intercepted lines.
    `protected boolean` | `interceptPaused` | Whether interception is temporarily paused.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DefaultConsoleInterceptionAggregator()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `pauseIntercept()` | Pauses interception.
    `void` | `resumeIntercept()` | Resumes a paused interception.
    `Intercept` | `retrieveIntercept()` | Returns a single interception job.
    `void` | `startIntercept()` | Starts interception.
    `void` | `stopIntercept()` | Stops interception.

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

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

- - ### Field Detail

    - #### interceptionSync

          protected final Object interceptionSync

      A sync object used to synchronize access to the interception buffer.

    - #### currentIntercept

          protected Intercept currentIntercept

      The currently active interception job.

    - #### interceptPaused

          protected volatile boolean interceptPaused

      Whether interception is temporarily paused. This flag is used for quick and lightweight interception pauses.

    - #### interceptorTarget

          protected ConsoleInterceptorTarget interceptorTarget

      The interceptor target used to receive intercepted lines.

    - #### interceptor

          @Inject
          protected ConsoleOutputInterceptor interceptor

      The interceptor service.

  - ### Constructor Detail

    - #### DefaultConsoleInterceptionAggregator

          public DefaultConsoleInterceptionAggregator()

  - ### Method Detail

    - #### startIntercept

          public void startIntercept()

      Description copied from interface: `ConsoleInterceptionAggregator`
      Starts interception. Must be called at least once. May be called repeatedly without any effect.
      Specified by:
        `startIntercept` in interface `ConsoleInterceptionAggregator`

    - #### stopIntercept

          public void stopIntercept()

      Description copied from interface: `ConsoleInterceptionAggregator`
      Stops interception. Must be called at some point in time if an interception has been started! Can be called repeatedly without any effect.
      Specified by:
        `stopIntercept` in interface `ConsoleInterceptionAggregator`

    - #### pauseIntercept

          public void pauseIntercept()

      Description copied from interface: `ConsoleInterceptionAggregator`
      Pauses interception. Streams are kept hooked; this command can thus be called often without negative effects on performance.
      Specified by:
        `pauseIntercept` in interface `ConsoleInterceptionAggregator`

    - #### resumeIntercept

          public void resumeIntercept()

      Description copied from interface: `ConsoleInterceptionAggregator`
      Resumes a paused interception.
      Specified by:
        `resumeIntercept` in interface `ConsoleInterceptionAggregator`

    - #### retrieveIntercept

          public Intercept retrieveIntercept()

      Description copied from interface: `ConsoleInterceptionAggregator`
      Returns a single interception job. This automatically starts a new interception job.
      Specified by:
        `retrieveIntercept` in interface `ConsoleInterceptionAggregator`
      Returns:
        the intercept job