class GridChangeStateCommandHandler extends GridRestCommandHandlerAdapter {
    /** Commands. */
    private static final Collection<GridRestCommand> commands =
        U.sealList(CLUSTER_ACTIVATE, CLUSTER_DEACTIVATE, CLUSTER_CURRENT_STATE, CLUSTER_ACTIVE, CLUSTER_INACTIVE);

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

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

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

        GridRestChangeStateRequest req = (GridRestChangeStateRequest)restRest;

        switch (req.command()) {
            case CLUSTER_CURRENT_STATE:
                Boolean curState = ctx.state().publicApiActiveState(false);

                return new GridFinishedFuture<>(new GridRestResponse(curState));

            case CLUSTER_ACTIVE:
            case CLUSTER_INACTIVE:
                log.warning(req.command().key() + " is deprecated. Use newer commands.");
            default:
                ctx.state().changeGlobalState(req.active() ? ACTIVE : INACTIVE, req.forceDeactivation(),
                    ctx.cluster().get().forServers().nodes(), false).get();

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