Class CopyFilesNaming<T>
- Type Parameters:
T
- shared-state
- Direct Known Subclasses:
Anonymize
,ClusterByTimestamp
,CopyFilesNamingWithoutSharedState
How an output name (and path) is selected for an input file when copying.
- Author:
- Owen Feehan
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract T
beforeCopying
(Path destinationDirectory, List<FileWithDirectoryInput> inputs) To be called once before any calls todestinationPath(File, DirectoryWithPrefix, int, CopyContext)
.destinationPath
(File file, DirectoryWithPrefix outputTarget, int index, CopyContext<T> context) Returns the output path (destination to to be copied to) for a given single file.destinationPathRelative
(File file, DirectoryWithPrefix outputTarget, int index, CopyContext<T> context) Calculates the relative-output path (to be appended to destDir)Methods inherited from class org.anchoranalysis.bean.AnchorBean
checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
-
Constructor Details
-
CopyFilesNaming
public CopyFilesNaming()
-
-
Method Details
-
beforeCopying
public abstract T beforeCopying(Path destinationDirectory, List<FileWithDirectoryInput> inputs) throws OperationFailedException To be called once before any calls todestinationPath(File, DirectoryWithPrefix, int, CopyContext)
.- Parameters:
destinationDirectory
- the directory to which files are copied.inputs
- the total number of files to copy.- Throws:
OperationFailedException
-
destinationPath
public Optional<Path> destinationPath(File file, DirectoryWithPrefix outputTarget, int index, CopyContext<T> context) throws OutputWriteFailedException Returns the output path (destination to to be copied to) for a given single file.- Parameters:
file
- file to be copiedoutputTarget
- the directory and prefix associated with the file for outputtingindex
- an increasing sequence of numbers for each file beginning at 0context
- the context for the copying- Returns:
- the absolute-path. if empty, the file should be skipped.
- Throws:
OutputWriteFailedException
-
destinationPathRelative
public abstract Optional<Path> destinationPathRelative(File file, DirectoryWithPrefix outputTarget, int index, CopyContext<T> context) throws OutputWriteFailedException Calculates the relative-output path (to be appended to destDir)- Parameters:
file
- file to be copiedoutputTarget
- the directory and prefix associated with the file for outputtingindex
- an increasing sequence of numbers for each file beginning at 0context
- the context for the copying- Returns:
- the relative-path. if empty, the file should be skipped.
- Throws:
OutputWriteFailedException
-