Interface CAHandlerType
- All Superinterfaces:
AutoCloseable,com.io7m.hibiscus.api.HBClientCloseableType<CAClientException>,com.io7m.hibiscus.api.HBClientHandlerType<CAIMessageType,,CAClientConnectionParameters, CAClientException> com.io7m.hibiscus.api.HBIOOperationsType<CAIMessageType,CAClientException>
public interface CAHandlerType
extends com.io7m.hibiscus.api.HBClientHandlerType<CAIMessageType,CAClientConnectionParameters,CAClientException>
A versioned protocol handler.
-
Method Summary
Modifier and TypeMethodDescriptiononExecuteFileDownload(CAFileID fileID, Path file, Path fileTmp, long size, String hashAlgorithm, String hashValue, Consumer<CAClientTransferStatistics> statistics) Download the data associated with the given file.voidonExecuteFileUpload(CAFileID fileID, Path file, String contentType, String description, Consumer<CAClientTransferStatistics> statistics) Upload the data associated with the given file.transaction(List<CAICommandType<?>> commands) Execute all the given commands in order, in a single transaction.userId()Methods inherited from interface com.io7m.hibiscus.api.HBClientCloseableType
close, isClosedMethods inherited from interface com.io7m.hibiscus.api.HBClientHandlerType
doConnect, exceptionTransformer, receive, send, sendAndForget, sendAndWait, transport
-
Method Details
-
userId
-
onExecuteFileDownload
Path onExecuteFileDownload(CAFileID fileID, Path file, Path fileTmp, long size, String hashAlgorithm, String hashValue, Consumer<CAClientTransferStatistics> statistics) throws InterruptedException, CAClientException Download the data associated with the given file. The file will be downloaded to a temporary file and then, if everything succeeds and the hash value matches, the temporary file will atomically replace the output file.- Parameters:
fileID- The file IDfile- The output filefileTmp- The temporary output filesize- The expected sizehashAlgorithm- The hash algorithmhashValue- The expected hash valuestatistics- A receiver of transfer statistics- Returns:
- The result
- Throws:
InterruptedException- On interruptionCAClientException- On errors
-
onExecuteFileUpload
void onExecuteFileUpload(CAFileID fileID, Path file, String contentType, String description, Consumer<CAClientTransferStatistics> statistics) throws InterruptedException, CAClientException Upload the data associated with the given file.- Parameters:
fileID- The file IDfile- The input filecontentType- The content typedescription- The file descriptionstatistics- A receiver of transfer statistics- Throws:
InterruptedException- On interruptionCAClientException- On errors
-
transaction
List<CAIResponseType> transaction(List<CAICommandType<?>> commands) throws InterruptedException, CAClientException Execute all the given commands in order, in a single transaction.- Parameters:
commands- The commands- Returns:
- The responses
- Throws:
InterruptedException- On interruptionCAClientException- On errors
-