Class CAClient
java.lang.Object
com.io7m.hibiscus.api.HBClientAbstract<CAIMessageType,CAClientConnectionParameters,CAClientException>
com.io7m.cardant.client.basic.internal.CAClient
- All Implemented Interfaces:
CAClientType,com.io7m.hibiscus.api.HBClientCloseableType<CAClientException>,com.io7m.hibiscus.api.HBClientType<CAIMessageType,,CAClientConnectionParameters, CAClientException> com.io7m.hibiscus.api.HBIOOperationsType<CAIMessageType,,CAClientException> com.io7m.repetoir.core.RPServiceType,AutoCloseable
public final class CAClient
extends com.io7m.hibiscus.api.HBClientAbstract<CAIMessageType,CAClientConnectionParameters,CAClientException>
implements CAClientType
The synchronous client.
-
Constructor Summary
ConstructorsConstructorDescriptionCAClient(CAClientConfiguration inConfiguration, CAStrings inStrings, Supplier<HttpClient> inHttpClients) The client. -
Method Summary
Modifier and TypeMethodDescriptionvoidfileDownload(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.toString()transaction(List<CAICommandType<?>> commands) Execute all the given commands in order, in a single transaction.userId()Methods inherited from class com.io7m.hibiscus.api.HBClientAbstract
checkNotClosingOrClosed, close, connect, disconnect, handler, isClosed, receive, send, sendAndForget, sendAndWait, state, stateNowMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.io7m.cardant.client.api.CAClientType
connectOrThrow, description, sendAndWaitOrThrowMethods inherited from interface com.io7m.hibiscus.api.HBClientCloseableType
close, isClosedMethods inherited from interface com.io7m.hibiscus.api.HBClientType
connect, disconnect, state, stateNowMethods inherited from interface com.io7m.hibiscus.api.HBIOOperationsType
receive, send, sendAndForget, sendAndWait
-
Constructor Details
-
CAClient
public CAClient(CAClientConfiguration inConfiguration, CAStrings inStrings, Supplier<HttpClient> inHttpClients) The client.- Parameters:
inConfiguration- The configurationinStrings- The string resourcesinHttpClients- The HTTP clients
-
-
Method Details
-
toString
-
userId
- Specified by:
userIdin interfaceCAClientType- Returns:
- The current logged-in user
-
fileDownload
public void fileDownload(CAFileID fileID, Path file, Path fileTmp, long size, String hashAlgorithm, String hashValue, Consumer<CAClientTransferStatistics> statistics) throws InterruptedException, CAClientException Description copied from interface:CAClientTypeDownload 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 interfaceCAClientType- 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- Throws:
InterruptedException- On interruptionCAClientException- On errors
-
fileUpload
public void fileUpload(CAFileID fileID, Path file, String contentType, String description, Consumer<CAClientTransferStatistics> statistics) throws InterruptedException, CAClientException Description copied from interface:CAClientTypeUpload the data associated with the given file.- Specified by:
fileUploadin interfaceCAClientType- 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
public List<CAIResponseType> transaction(List<CAICommandType<?>> commands) throws CAClientException, InterruptedException Description copied from interface:CAClientTypeExecute all the given commands in order, in a single transaction.- Specified by:
transactionin interfaceCAClientType- Parameters:
commands- The commands- Returns:
- The responses
- Throws:
CAClientExceptionInterruptedException
-