class ServerRestService {

    @PUT
    @Path( "/update" )
    @Consumes( MediaType.APPLICATION_FORM_URLENCODED )
    @Produces( "application/json" )
    public BaseResponse updateNodes( @Form HMSRestServerActionsForm actions )
        throws HMSRestException
    {

        BaseResponse response = new BaseResponse();
        if ( !serverConnector.getNodeMap().containsKey( actions.getId() ) )
            throw new HMSRestException( Status.NOT_FOUND.getStatusCode(), "Invalid Request",
                                        "Can't find host with id " + actions.getId() );

        TaskType type = null;
        switch ( actions.getAction() )
        {
            case "cold_reset":
                type = TaskType.ColdResetBmc;
                break;
            case "hard_reset":
                type = TaskType.PowerResetServer;
                break;
            case "power_down":
                type = TaskType.PowerDownServer;
                break;
            case "power_cycle":
                type = TaskType.PowerCycleServer;
                break;
            case "power_up":
                type = TaskType.PowerUpServer;
                break;

        }

        if ( type != null )
        {
            ServerNode node = (ServerNode) serverConnector.getNodeMap().get( actions.getId() );
            try
            {
                executeTask( node, type );
            }
            catch ( HmsResourceBusyException e )
            {
                throw new HMSRestException( Status.INTERNAL_SERVER_ERROR.getStatusCode(), Constants.RESOURCE_BUSY,
                                            e.getMessage() );
            }
        }
        else
        {
            throw new HMSRestException( Status.NOT_FOUND.getStatusCode(), "Invalid Request", "Can't find action :"
                + actions.getAction() + " to perform on host " + actions.getId() );
        }

        response.setStatusCode( Status.ACCEPTED.getStatusCode() );
        response.setStatusMessage( "Requested update triggered successfully for node: " + actions.getId() );
        return response;
    }

}