org.appng.cli

## Class CliCore

- java.lang.Object
- - org.appng.cli.CliCore

-     public class CliCore
      extends Object

  The core of the command line interface, aggregating the available `ExecutableCliCommand`s to a `CliCommands`-object.
  Author:
    Matthias Herlitzius

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `COMMAND_EXECUTION_ERROR`
    `static int` | `COMMAND_INVALID`
    `protected CliCommands` | `commands`
    `static int` | `DATABASE_ERROR`
    `static int` | `OPTION_INVALID`
    `static int` | `OPTION_MISSING`
    `static int` | `STATUS_OK`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CliCore()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getStatus()`
    `int` | `perform(Properties cliConfig)` Performs a cli command
    `boolean` | `processCommand(String[] args)` Parses the given command line arguments and sets the state for this `CliCore`.
    `void` | `setContext(org.springframework.context.ApplicationContext platformContext)`

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

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

- - ### Field Detail

    - #### STATUS_OK

          public static final int STATUS_OK

      See Also:
        Constant Field Values

    - #### DATABASE_ERROR

          public static final int DATABASE_ERROR

      See Also:
        Constant Field Values

    - #### COMMAND_EXECUTION_ERROR

          public static final int COMMAND_EXECUTION_ERROR

      See Also:
        Constant Field Values

    - #### COMMAND_INVALID

          public static final int COMMAND_INVALID

      See Also:
        Constant Field Values

    - #### OPTION_INVALID

          public static final int OPTION_INVALID

      See Also:
        Constant Field Values

    - #### OPTION_MISSING

          public static final int OPTION_MISSING

      See Also:
        Constant Field Values

    - #### commands

          protected CliCommands commands

  - ### Constructor Detail

    - #### CliCore

          public CliCore()

  - ### Method Detail

    - #### perform

          public int perform(Properties cliConfig)

      Performs a cli command
      Parameters:
        `cliConfig` - the properties read from "/conf/appNG.properties"

    - #### setContext

          public void setContext(org.springframework.context.ApplicationContext platformContext)

    - #### processCommand

          public boolean processCommand(String[] args)
                                 throws com.beust.jcommander.ParameterException

      Parses the given command line arguments and sets the state for this `CliCore`. Must be called before `perform(Properties)`. Only if this method returns `true`, it is reasonable to call `perform(Properties)`.
      Parameters:
        `args` - the command line arguments
      Returns:
        `true` if the given arguments have been parsed to an `ExecutableCliCommand` and `perform(Properties)` should be called, `false` otherwise
      Throws:
        `com.beust.jcommander.ParameterException`
      See Also:
        `getStatus()`

    - #### getStatus

          public int getStatus()

Copyright © 2011–2023 aiticon GmbH. All rights reserved.