private void processControlFiles(
      final DocumentTransferProcess process, final Set<String> processedFileNames) {
    final File controlDirectory = new File(process.getRootFolder(), "control");
    if (!controlDirectory.isDirectory()) {
      return;
    }

    final String[] fileNames = controlDirectory.list();
    for (int index = 0; index < fileNames.length; index++) {
      final String fileName = fileNames[index];
      if (processedFileNames.contains(fileNames)) {
        continue;
      }

      processedFileNames.add(fileName);

      final File controlFile = new File(controlDirectory, fileName);
      if (controlFile.isFile()) {
        process.registerControlFile(controlFile);
      }
    }
  }
  private void processEventFiles(
      final DocumentTransferProcess process, final Set<String> processedFileNames) {
    final File eventsDirectory = new File(process.getRootFolder(), "events");
    if (!eventsDirectory.isDirectory()) {
      return;
    }

    final String[] fileNames = eventsDirectory.list();
    if (fileNames.length == 0) {
      return;
    }

    /*
     * process in order of ascending time-stamps
     * the format of file-names allows a lexical sort to be used
     */
    Arrays.sort(fileNames);

    for (int index = 0; index < fileNames.length; index++) {
      final String fileName = fileNames[index];

      /*
       * Ignore any processed files
       * (it may be more efficient to strip processed files prior to sorting)
       */
      if (processedFileNames.contains(fileNames)) {
        continue;
      }

      processedFileNames.add(fileName);

      final File eventFile = new File(eventsDirectory, fileName);
      if (eventFile.isFile()) {
        process.registerEventsFile(eventFile);
      }
    }
  }
 private void processTimeouts(final long now, final DocumentTransferProcess process) {
   process.processTimeouts(now);
 }