class ServerRestService {

    @DELETE
    @Path( "/{hostId}" )
    @Produces( "application/json" )
    public Response removeServer( @PathParam( "hostId" ) String hostId )
        throws HmsException, Exception
    {
        logger.info( "In removeServer, removing host with hostId: {}.", hostId );
        BaseResponse response = null;
        String message = null;

        // check that hostId is a valid hostId (exists in the nodeMap).
        if ( !serverConnector.getNodeMap().containsKey( hostId ) )
        {
            logger.debug( "In removeServer, Server with NodeID: {} not found in inventory.", hostId );
            response = HmsGenericUtil.getBaseResponse( Status.BAD_REQUEST, "Invalid HostId: " + hostId );
            return Response.status( Status.BAD_REQUEST ).entity( response ).build();
        }

        // put server in maintenance
        NodeAdminStatus nodeAdminStatus = NodeAdminStatus.DECOMISSION;
        ServerNode serverNode = (ServerNode) serverConnector.getNodeMap().get( hostId );
        serverNode.setAdminStatus( nodeAdminStatus );
        logger.debug( "In removeServer, set host with hostId: {} admin status as {}.", hostId,
                      nodeAdminStatus.toString() );

        // remove hostId from ServerNodeConnector nodeMap
        ServerNode serverNode1 = (ServerNode) serverConnector.removeServer( hostId );
        if ( serverNode1 == null )
        {
            message = String.format( "Failed to remove host '%1$s' from inventory.", hostId );
            logger.error( "In removeServer, {}.", message );
            response = HmsGenericUtil.getBaseResponse( Status.INTERNAL_SERVER_ERROR, message );
            serverNode.setAdminStatus( NodeAdminStatus.OPERATIONAL );
            logger.info( "In removeServer, as {}, set host '{}' admin status to {}.", message, hostId,
                         NodeAdminStatus.OPERATIONAL.toString() );
            return Response.status( Status.INTERNAL_SERVER_ERROR ).entity( response ).build();
        }

        // Remove BoardService
        BoardServiceProvider.removeBoardServiceClass( hostId );
        BoardServiceProvider.removeNodeSupportedOperations( hostId );

        message = String.format( "Removed host '%1$s' from inventory.", hostId );
        logger.info( "In removeServer, {}", message );
        response = HmsGenericUtil.getBaseResponse( Status.OK, message );
        return Response.status( Status.OK ).entity( response ).build();
    }

}