Class CATransport1
java.lang.Object
com.io7m.cardant.client.basic.internal.CATransport1
- All Implemented Interfaces:
CATransportType,com.io7m.hibiscus.api.HBClientCloseableType<CAClientException>,com.io7m.hibiscus.api.HBIOOperationsType<CAIMessageType,,CAClientException> com.io7m.hibiscus.api.HBTransportType<CAIMessageType,,CAClientException> AutoCloseable
The version 1 transport.
-
Constructor Summary
ConstructorsConstructorDescriptionCATransport1(Clock inClock, CAStrings inStrings, HttpClient inHttpClient, URI baseURI) The version 1 transport. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()fileDownload(CAFileID fileID, Path file, Path fileTmp, long size, String hashAlgorithm, String hashValue, Consumer<CAClientTransferStatistics> statistics) Download the data associated with the given file.voidfileUpload(CAFileID fileID, Path file, String contentType, String description, Consumer<CAClientTransferStatistics> statistics) Upload the data associated with the given file.booleanisClosed()com.io7m.hibiscus.api.HBReadType<CAIMessageType> voidsend(CAIMessageType message) voidsendAndForget(CAIMessageType message) sendAndWait(CAIMessageType message, Duration timeout) toString()transaction(List<CAICommandType<?>> commands) Execute all the given commands in order, in a single transaction.
-
Constructor Details
-
CATransport1
The version 1 transport.- Parameters:
inClock- The clockinStrings- The string resourcesinHttpClient- The HTTP clientbaseURI- The base URI
-
-
Method Details
-
isClosed
public boolean isClosed()- Specified by:
isClosedin interfacecom.io7m.hibiscus.api.HBClientCloseableType<CAClientException>
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfacecom.io7m.hibiscus.api.HBClientCloseableType<CAClientException>
-
receive
public com.io7m.hibiscus.api.HBReadType<CAIMessageType> receive(Duration timeout) throws CAClientException, InterruptedException - Specified by:
receivein interfacecom.io7m.hibiscus.api.HBIOOperationsType<CAIMessageType,CAClientException> - Throws:
CAClientExceptionInterruptedException
-
send
- Specified by:
sendin interfacecom.io7m.hibiscus.api.HBIOOperationsType<CAIMessageType,CAClientException> - Throws:
CAClientExceptionInterruptedException
-
sendAndForget
- Specified by:
sendAndForgetin interfacecom.io7m.hibiscus.api.HBIOOperationsType<CAIMessageType,CAClientException> - Throws:
CAClientExceptionInterruptedException
-
sendAndWait
public CAIMessageType sendAndWait(CAIMessageType message, Duration timeout) throws CAClientException, InterruptedException - Specified by:
sendAndWaitin interfacecom.io7m.hibiscus.api.HBIOOperationsType<CAIMessageType,CAClientException> - Throws:
CAClientExceptionInterruptedException
-
toString
-
fileDownload
public Path fileDownload(CAFileID fileID, Path file, Path fileTmp, long size, String hashAlgorithm, String hashValue, Consumer<CAClientTransferStatistics> statistics) throws CAClientException Description copied from interface:CATransportTypeDownload 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.- Specified by:
fileDownloadin interfaceCATransportType- 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:
CAClientException- On errors
-
fileUpload
public void fileUpload(CAFileID fileID, Path file, String contentType, String description, Consumer<CAClientTransferStatistics> statistics) throws CAClientException Description copied from interface:CATransportTypeUpload the data associated with the given file.- Specified by:
fileUploadin interfaceCATransportType- Parameters:
fileID- The file IDfile- The input filecontentType- The content typedescription- The file descriptionstatistics- A receiver of transfer statistics- Throws:
CAClientException- On errors
-
transaction
public List<CAIResponseType> transaction(List<CAICommandType<?>> commands) throws InterruptedException, CAClientException Description copied from interface:CATransportTypeExecute all the given commands in order, in a single transaction.- Specified by:
transactionin interfaceCATransportType- Parameters:
commands- The commands- Returns:
- The responses
- Throws:
InterruptedException- On interruptionCAClientException- On errors
-