Package ome.formats.importer.transfers
Interface FileTransfer
-
- All Known Implementing Classes:
AbstractExecFileTransfer
,AbstractFileTransfer
,CopyFileTransfer
,CopyMoveFileTransfer
,HardlinkFileTransfer
,MoveFileTransfer
,SymlinkFileTransfer
,UploadFileTransfer
,UploadRmFileTransfer
public interface FileTransfer
Abstracted concept of "getting the file to the server". A singleFileTransfer
instance should be used for all the instances in a single "import". Implementations are responsible for making sure that when the server accesses the remote (i.e. server-side) location that a file-like object (file, hard-link, soft-link, etc.) is present with the right size and checksum. Transfer implementations have a number of responsibilities such as reporting on progress and estimating remaining time which make them not completely trivial to implement. Sub-classing an existing implementation is likely the easiest way to modify behavior. Implementations should be thread-safe, i.e. callable from multiple threads, and blocking should be avoided if at all possible.- Since:
- 5.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
afterTransfer(int errors, java.util.List<java.lang.String> transferredFiles)
Callback which must be invoked after a related set of files has been processed.java.lang.String
transfer(TransferState state)
Transfers a file and returns the appropriate checksum string for the source file.
-
-
-
Method Detail
-
transfer
java.lang.String transfer(TransferState state) throws java.io.IOException, ServerError
Transfers a file and returns the appropriate checksum string for the source file. TheTransferState
instance should be unique for this invocation, i.e. not used by any other threads. After execution, the fields can be inspected to see, e.g., the newly created file.- Throws:
java.io.IOException
ServerError
-
afterTransfer
void afterTransfer(int errors, java.util.List<java.lang.String> transferredFiles) throws CleanupFailure
Callback which must be invoked after a related set of files has been processed. This provides theFileTransfer
instance a chance to free resources. If any errors have occurred, then no destructive changes should be made, though the user may should be given the option to react.- Throws:
CleanupFailure
-
-