/**
   * Performs threshold checking on an directory which contains one or more RRD files containing
   * latency/response time information. ThresholdEntity objects are stored for performing threshold
   * checking.
   *
   * @param latIface TODO
   * @param latParms TODO
   * @param parameters
   * @param iface
   * @param directory RRD repository directory
   * @param m_nodeId Node identifier of interface being checked
   * @param ipAddr IP address of the interface being checked
   * @param interval Configured thresholding interval
   * @param date Source for timestamp to be used for all generated events
   * @param thresholdMap Map of configured interface level ThresholdEntity objects keyed by
   *     datasource name.
   * @param events Castor events object containing any events to be generated as a result of
   *     threshold checking.
   * @throws IllegalArgumentException if path parameter is not a directory.
   * @throws ThresholdingException
   */
  Events checkRrdDir(LatencyInterface latIface, LatencyParameters latParms)
      throws IllegalArgumentException, ThresholdingException {
    Map<String, ThresholdEntity> thresholdMap = latIface.getThresholdMap();

    // Sanity Check
    if (latIface.getInetAddress() == null || thresholdMap == null) {
      throw new ThresholdingException(
          "check: Threshold checking failed for " + m_svcName + "/" + latIface.getHostAddress(),
          THRESHOLDING_FAILED);
    }

    Events events = new Events();
    Date date = new Date();

    for (Iterator<String> it = thresholdMap.keySet().iterator(); it.hasNext(); ) {
      String datasource = it.next();
      ThresholdEntity threshold = thresholdMap.get(datasource);
      if (threshold != null) {
        Double dsValue = threshold.fetchLastValue(latIface, latParms);
        Map<String, Double> dsValues = new HashMap<String, Double>();
        dsValues.put(datasource, dsValue);
        List<Event> eventList = threshold.evaluateAndCreateEvents(dsValues, date);
        if (eventList.size() == 0) {
          // Nothing to do, so continue
          continue;
        }

        completeEventListAndAddToEvents(events, eventList, latIface);

        /*
        threshold.evaluateThreshold(dsValue, events, date, latIface);
        */
      }
    }

    return events;
  }