@Override
  public void execute(HttpServletRequest req, HttpServletResponse resp, ConfigService configService)
      throws IOException {
    logger.debug("Getting PV's matching wildcard or regex for this appliance.");
    int limit = 500;
    String limitParam = req.getParameter("limit");
    if (limitParam != null) {
      limit = Integer.parseInt(limitParam);
    }

    String nameToMatch = null;
    if (req.getParameter("regex") != null) {
      nameToMatch = req.getParameter("regex");
      logger.debug("Finding PV's for regex " + nameToMatch);
    }

    if (req.getParameter("pv") != null) {
      nameToMatch = req.getParameter("pv");
      nameToMatch = nameToMatch.replace("*", ".*");
      nameToMatch = nameToMatch.replace("?", ".");
      logger.debug("Finding PV's for glob (converted to regex)" + nameToMatch);
    }

    Set<String> pvNamesMatchingRegex = configService.getPVsForApplianceMatchingRegex(nameToMatch);

    LinkedList<String> pvNames = new LinkedList<String>();
    if (limit == -1) {
      pvNames.addAll(pvNamesMatchingRegex);
    } else {
      int pvCount = 0;
      for (String matchedName : pvNamesMatchingRegex) {
        pvNames.add(matchedName);
        pvCount++;
        if (pvCount >= limit) break;
      }
    }

    resp.setContentType(MimeTypeConstants.APPLICATION_JSON);
    try (PrintWriter out = resp.getWriter()) {
      out.println(JSONValue.toJSONString(pvNames));
    } catch (Exception ex) {
      logger.error(
          "Exception getting all pvs on appliance "
              + configService.getMyApplianceInfo().getIdentity(),
          ex);
      resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
    }
  }