Class RecordingCounter<T>
Object
RecordingCounter<T>
- Type Parameters:
- T- shared-state of- CopyFilesNaming
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 SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidCloses the logger.intIncrements the counter.voidrecordCopiedOutput(Path source, Optional<Path> destination, int index) Records an copy operation in the log / CSV path mapping.
- 
Constructor Details- 
RecordingCounterpublic RecordingCounter(Counter counter, Outputter outputter, T namingSharedState) throws OperationFailedException - Throws:
- OperationFailedException
 
 
- 
- 
Method Details- 
incrementCounterpublic int incrementCounter()Increments the counter.This is thread-safe. - Returns:
- the index of the counter before being incremented.
 
- 
recordCopiedOutputpublic 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).
 
- 
closeLoggerpublic void closeLogger()Closes the logger.
 
-