Class RecordingCounter<T>

Object
RecordingCounter<T>
Type Parameters:
T - shared-state of CopyFilesNaming

public class RecordingCounter<T> extends Object
A counter that also records outputs in a message-log and CSV file.

The following outputs are produced:

Output NameDefault?Description
"copyLog"noa text log file showing each copy operation (and any skipped files).
"pathMapping"noa CSV file showing the source and destination paths for each copy operation (skipped files are not included)..
Author:
Owen Feehan
  • Constructor Details

  • Method Details

    • incrementCounter

      public int incrementCounter()
      Increments the counter.

      This is thread-safe.

      Returns:
      the index of the counter before being incremented.
    • recordCopiedOutput

      public void recordCopiedOutput(Path source, Optional<Path> destination, int index) throws OperationFailedException
      Records an copy operation in the log / CSV path mapping.

      This also performs a check that multiple files are writing to the same output destination.

      Parameters:
      source - source-path for copying operation
      destination - destination-path for copying operation
      index - the index of file (an integer number uniquely assigned to each operation)
      Throws:
      OperationFailedException - if this method has been previously called with an identical destination (only if it's not-empty).
    • closeLogger

      public void closeLogger()
      Closes the logger.
    • getNamingSharedState

      public T getNamingSharedState()