org.apache.ignite.internal.management.api

## Class CommandInvoker<A extends IgniteDataTransferObject>

- java.lang.Object
- - org.apache.ignite.internal.management.api.CommandInvoker<A>

    public class CommandInvoker<A extends IgniteDataTransferObject>
    extends Object

Command invoker.

### Field Summary

Fields
`protected A` `arg` Parsed argument.
`protected Command<A,?>` `cmd` Command to execute.

### Constructor Summary

Constructors
Constructor and Description
`CommandInvoker(Command<A,?> cmd, A arg, @Nullable IgniteEx ignite)`

### Method Summary

All Methods Instance Methods Concrete Methods
`protected @Nullable GridClient` `client()`
`protected GridClientNode` `defaultNode()`
`<R> R` `invoke(Consumer<String> printer, boolean verbose)` Actual command execution with verbose mode if required.
`boolean` `prepare(Consumer<String> printer)`

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

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

### Field Detail

#### cmd

    protected final Command<A extends IgniteDataTransferObject,?> cmd

Command to execute.

#### arg

    protected final A extends IgniteDataTransferObject arg

Parsed argument.

### Constructor Detail

#### CommandInvoker

    public CommandInvoker(Command<A,?> cmd,
                          A arg,
                          @Nullable
                          @Nullable IgniteEx ignite)

Parameters:
  `cmd` - Command to execute.
  `arg` - Argument
  `ignite` - Optional ignite instance.

### Method Detail

#### prepare

    public boolean prepare(Consumer<String> printer)
                    throws GridClientException

Parameters:
  `printer` - Result printer.
Returns:
  `True` of command successfully prepared and can be invoked, `false` otherwise.
Throws:
  `GridClientException` - In failed.

#### invoke

    public <R> R invoke(Consumer<String> printer,
                        boolean verbose)
                 throws GridClientException

Actual command execution with verbose mode if required.

Parameters:
  `printer` - Result printer.
  `verbose` - Use verbose mode or not
Returns:
  Result of operation (mostly usable for tests).
Throws:
  `GridClientException` - In failed.

#### defaultNode

    protected GridClientNode defaultNode()
                                  throws GridClientException

Returns:
  Default node to execute commands.
Throws:
  `GridClientException`

#### client

    @Nullable
    protected @Nullable GridClient client()
                                             throws GridClientException

Returns:
  Grid thin client instance which is already connected to cluster.
Throws:
  `GridClientException` - If failed.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.16.0
Release Date | : December 15 2023