org.apache.ignite.internal.commandline

## Class CommandHandler

- java.lang.Object
- - org.apache.ignite.internal.commandline.CommandHandler

    public class CommandHandler
    extends Object

Class that execute several commands passed via command line.

### Field Summary

Fields
`static String` `CONFIRM_MSG`
`GridConsole` `console` Console instance.
`static int` `ERR_AUTHENTICATION_FAILED`
`static int` `EXIT_CODE_CONNECTION_FAILED`
`static int` `EXIT_CODE_INVALID_ARGUMENTS`
`static int` `EXIT_CODE_OK`
`static int` `EXIT_CODE_UNEXPECTED_ERROR`
`static String` `NULL`
`protected String` `ses` Session.
`static String` `UTILITY_NAME` Utility name.

### Constructor Summary

Constructors
Constructor and Description
`CommandHandler()`
`CommandHandler(Logger logger)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`int` `execute(List<String> rawArgs)` Parse and execute command.
`<T> T` `getLastOperationResult()` Used for tests.
`static Logger` `initLogger(@Nullable String loggerName)` Initialises JULs logger with basic settings
`static boolean` `isAuthError(Throwable e)`
`static void` `main(String[] args)`
`static StreamHandler` `setupStreamHandler()`

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

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

### Field Detail

#### CONFIRM_MSG

    public static final String CONFIRM_MSG

See Also:
  Constant Field Values

#### EXIT_CODE_OK

    public static final int EXIT_CODE_OK

See Also:
  Constant Field Values

#### EXIT_CODE_INVALID_ARGUMENTS

    public static final int EXIT_CODE_INVALID_ARGUMENTS

See Also:
  Constant Field Values

#### EXIT_CODE_CONNECTION_FAILED

    public static final int EXIT_CODE_CONNECTION_FAILED

See Also:
  Constant Field Values

#### ERR_AUTHENTICATION_FAILED

    public static final int ERR_AUTHENTICATION_FAILED

See Also:
  Constant Field Values

#### EXIT_CODE_UNEXPECTED_ERROR

    public static final int EXIT_CODE_UNEXPECTED_ERROR

See Also:
  Constant Field Values

#### UTILITY_NAME

    public static final String UTILITY_NAME

Utility name.

See Also:
  Constant Field Values

#### NULL

    public static final String NULL

See Also:
  Constant Field Values

#### ses

    protected final String ses

Session.

#### console

    public GridConsole console

Console instance. Public access needs for tests.

### Constructor Detail

#### CommandHandler

    public CommandHandler()

#### CommandHandler

    public CommandHandler(Logger logger)

Parameters:
  `logger` - Logger to use.

### Method Detail

#### main

    public static void main(String[] args)

Parameters:
  `args` - Arguments to parse and apply.

#### setupStreamHandler

    public static StreamHandler setupStreamHandler()

Returns:
  StreamHandler with empty formatting

#### initLogger

    public static Logger initLogger(@Nullable
                                    @Nullable String loggerName)

Initialises JULs logger with basic settings

Parameters:
  `loggerName` - logger name. If `null` anonymous logger is returned.
Returns:
  logger

#### execute

    public int execute(List<String> rawArgs)

Parse and execute command.

Parameters:
  `rawArgs` - Arguments to parse and execute.
Returns:
  Exit code.

#### getLastOperationResult

    public <T> T getLastOperationResult()

Used for tests.

Returns:
  Last operation result;

#### isAuthError

    public static boolean isAuthError(Throwable e)

Parameters:
  `e` - Exception to check.
Returns:
  `true` if specified exception is `GridClientAuthenticationException`.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.9.1
Release Date | : December 9 2020