org.apache.ignite.internal.processors.rest.handlers.redis

## Class GridRedisRestCommandHandler

- java.lang.Object
- - org.apache.ignite.internal.processors.rest.handlers.redis.GridRedisRestCommandHandler

All Implemented Interfaces:
  GridRedisCommandHandler

Direct Known Subclasses:
  GridRedisAppendCommandHandler, GridRedisDbSizeCommandHandler, GridRedisDelCommandHandler, GridRedisExistsCommandHandler, GridRedisGetCommandHandler, GridRedisGetRangeCommandHandler, GridRedisGetSetCommandHandler, GridRedisIncrDecrCommandHandler, GridRedisMGetCommandHandler, GridRedisMSetCommandHandler, GridRedisSetCommandHandler, GridRedisSetRangeCommandHandler, GridRedisStrlenCommandHandler

    public abstract class GridRedisRestCommandHandler
    extends Object
    implements GridRedisCommandHandler

Redis command handler done via REST.

### Field Summary

Fields
`protected static String` `CACHE_NAME` Used cache name.
`protected GridRestProtocolHandler` `hnd` REST protocol handler.
`protected IgniteLogger` `log` Logger.

### Constructor Summary

Constructors
Constructor and Description
`GridRedisRestCommandHandler(IgniteLogger log, GridRestProtocolHandler hnd)` Constructor.

### Method Summary

Methods
`abstract GridRestRequest` `asRestRequest(GridRedisMessage msg)` Converts `GridRedisMessage` to `GridRestRequest`.
`IgniteInternalFuture<GridRedisMessage>` `handleAsync(GridRedisMessage msg)`
`protected Long` `longValue(String name, List<String> params)` Retrieves long value following the parameter name from parameters list.
`abstract ByteBuffer` `makeResponse(GridRestResponse resp, List<String> params)` Prepares a response according to the request.

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

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

### Methods inherited from interface org.apache.ignite.internal.processors.rest.handlers.redis.GridRedisCommandHandler

`supportedCommands`

### Field Detail

#### CACHE_NAME

    protected static final String CACHE_NAME

Used cache name.

See Also:
  Constant Field Values

#### log

    protected final IgniteLogger log

Logger.

#### hnd

    protected final GridRestProtocolHandler hnd

REST protocol handler.

### Constructor Detail

#### GridRedisRestCommandHandler

    public GridRedisRestCommandHandler(IgniteLogger log,
                               GridRestProtocolHandler hnd)

Constructor.

Parameters:
  `log` - Logger.
  `hnd` - REST protocol handler.

### Method Detail

#### handleAsync

    public IgniteInternalFuture<GridRedisMessage> handleAsync(GridRedisMessage msg)

Specified by:
  `handleAsync` in interface `GridRedisCommandHandler`
Parameters:
  `msg` - Request message.
Returns:
  Future.

#### longValue

    @Nullable
    protected Long longValue(String name,
                          List<String> params)
                      throws GridRedisGenericException

Retrieves long value following the parameter name from parameters list.

Parameters:
  `name` - Parameter name.
  `params` - Parameters list.
Returns:
  Long value from parameters list or null if not exists.
Throws:
  `GridRedisGenericException` - If parsing failed.

#### asRestRequest

    public abstract GridRestRequest asRestRequest(GridRedisMessage msg)
                                           throws IgniteCheckedException

Converts `GridRedisMessage` to `GridRestRequest`.

Parameters:
  `msg` - `GridRedisMessage`
Returns:
  `GridRestRequest`
Throws:
  `IgniteCheckedException` - If fails.

#### makeResponse

    public abstract ByteBuffer makeResponse(GridRestResponse resp,
                          List<String> params)

Prepares a response according to the request.

Parameters:
  `resp` - REST response.
  `params` - Auxiliary parameters.
Returns:
  Response for the command.

2017 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.0.0
Release Date | : April 30 2017