class GridChangeClusterStateCommandHandler extends GridRestCommandHandlerAdapter {
    /** Commands. */
    private static final Collection<GridRestCommand> COMMANDS = U.sealList(CLUSTER_SET_STATE, CLUSTER_STATE);

    /**
     * @param ctx Context.
     */
    public GridChangeClusterStateCommandHandler(GridKernalContext ctx) {
        super(ctx);
    }

    /** {@inheritDoc} */
    @Override public Collection<GridRestCommand> supportedCommands() {
        return COMMANDS;
    }

    /** {@inheritDoc} */
    @Override public IgniteInternalFuture<GridRestResponse> handleAsync(GridRestRequest restReq)
        throws IgniteCheckedException {<FILL_FUNCTION_BODY>}
}

        GridRestClusterStateRequest req = (GridRestClusterStateRequest)restReq;

        switch (req.command()) {
            case CLUSTER_STATE:
                assert req.isReqCurrentMode() : req;

                return new GridFinishedFuture<>(new GridRestResponse(ctx.grid().cluster().state()));

            default:
                assert req.state() != null : req;

                U.log(log, "Received cluster state change request to " + req.state() +
                    " state from client node with ID: " + req.clientId());

                ctx.state().changeGlobalState(req.state(), req.forceDeactivation(),
                    ctx.cluster().get().forServers().nodes(), false).get();

                return new GridFinishedFuture<>(new GridRestResponse(req.command().key() + " done"));
        }
    
<methods><variables>protected final non-sealed org.apache.ignite.internal.GridKernalContext ctx,protected final non-sealed org.apache.ignite.IgniteLogger log