Class RecordingCounter<T>
Object
RecordingCounter<T>
- Type Parameters:
T
- shared-state ofCopyFilesNaming
A counter that also records outputs in a message-log and CSV file.
The following outputs are produced:
Output Name | Default? | Description |
---|---|---|
"copyLog" | no | a text log file showing each copy operation (and any skipped files). |
"pathMapping" | no | a CSV file showing the source and destination paths for each copy operation (skipped files are not included).. |
- Author:
- Owen Feehan
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Closes the logger.int
Increments the counter.void
recordCopiedOutput
(Path source, Optional<Path> destination, int index) Records an copy operation in the log / CSV path mapping.
-
Constructor Details
-
RecordingCounter
public RecordingCounter(Counter counter, Outputter outputter, T namingSharedState) throws OperationFailedException - Throws:
OperationFailedException
-
-
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 operationdestination
- destination-path for copying operationindex
- the index of file (an integer number uniquely assigned to each operation)- Throws:
OperationFailedException
- if this method has been previously called with an identicaldestination
(only if it's not-empty).
-
closeLogger
public void closeLogger()Closes the logger.
-