Class CAClientSynchronous
java.lang.Object
com.io7m.hibiscus.basic.HBClientSynchronousAbstract<CAClientException,CAICommandType<?>,CAIResponseType,CAIResponseType,CAIResponseError,CAClientEventType,CAClientCredentials>
com.io7m.cardant.client.basic.internal.CAClientSynchronous
- All Implemented Interfaces:
CAClientSynchronousType,com.io7m.hibiscus.api.HBClientCloseableType<CAClientException>,com.io7m.hibiscus.api.HBClientStatusType<CAICommandType<?>,,CAIResponseType, CAIResponseError, CAClientEventType, CAClientCredentials> com.io7m.hibiscus.api.HBClientSynchronousOperationsType<CAClientException,,CAICommandType<?>, CAIResponseType, CAIResponseType, CAIResponseError, CAClientCredentials> com.io7m.hibiscus.api.HBClientSynchronousType<CAClientException,,CAICommandType<?>, CAIResponseType, CAIResponseType, CAIResponseError, CAClientEventType, CAClientCredentials> com.io7m.repetoir.core.RPServiceType,AutoCloseable
public final class CAClientSynchronous
extends com.io7m.hibiscus.basic.HBClientSynchronousAbstract<CAClientException,CAICommandType<?>,CAIResponseType,CAIResponseType,CAIResponseError,CAClientEventType,CAClientCredentials>
implements CAClientSynchronousType
The synchronous client.
-
Constructor Summary
ConstructorsConstructorDescriptionCAClientSynchronous(CAClientConfiguration inConfiguration, CAStrings inStrings, HttpClient inHttpClient) The synchronous client. -
Method Summary
Modifier and TypeMethodDescriptioncom.io7m.hibiscus.api.HBResultType<Path, CAIResponseError> fileDownload(CAFileID fileID, Path file, Path fileTmp, long size, String hashAlgorithm, String hashValue, Consumer<CAClientTransferStatistics> statistics) Download the data associated with the given file.com.io7m.hibiscus.api.HBResultType<CAFileID, CAIResponseError> fileUpload(CAFileID fileID, Path file, String contentType, String description, Consumer<CAClientTransferStatistics> statistics) Upload the data associated with the given file.com.io7m.hibiscus.api.HBResultType<CAClientUnit, CAIResponseError> garbage()Send random garbage to the server.com.io7m.hibiscus.api.HBResultType<CAClientUnit, CAIResponseError> invalid()Send random garbage to the server.toString()userId()Methods inherited from class com.io7m.hibiscus.basic.HBClientSynchronousAbstract
checkNotClosingOrClosed, close, currentHandler, disconnect, eventPublisher, events, execute, isClosed, isConnected, login, pollEvents, state, stateNow, statePublisherMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.io7m.cardant.client.api.CAClientSynchronousType
description, executeOrElseThrow, fileDownloadOrThrow, fileUploadOrThrow, garbageOrElseThrow, invalidOrElseThrow, loginOrElseThrowMethods inherited from interface com.io7m.hibiscus.api.HBClientCloseableType
close, isClosedMethods inherited from interface com.io7m.hibiscus.api.HBClientStatusType
events, isConnected, state, stateNowMethods inherited from interface com.io7m.hibiscus.api.HBClientSynchronousOperationsType
disconnect, execute, login, pollEventsMethods inherited from interface com.io7m.hibiscus.api.HBClientSynchronousType
executeOrElseThrow, loginOrElseThrow
-
Constructor Details
-
CAClientSynchronous
public CAClientSynchronous(CAClientConfiguration inConfiguration, CAStrings inStrings, HttpClient inHttpClient) The synchronous client.- Parameters:
inConfiguration- The configurationinStrings- The string resourcesinHttpClient- The HTTP client
-
-
Method Details
-
userId
- Specified by:
userIdin interfaceCAClientSynchronousType- Returns:
- The current logged-in user
-
fileDownload
public com.io7m.hibiscus.api.HBResultType<Path,CAIResponseError> fileDownload(CAFileID fileID, Path file, Path fileTmp, long size, String hashAlgorithm, String hashValue, Consumer<CAClientTransferStatistics> statistics) throws InterruptedException Description copied from interface:CAClientSynchronousTypeDownload 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 interfaceCAClientSynchronousType- 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 interruption
-
fileUpload
public com.io7m.hibiscus.api.HBResultType<CAFileID,CAIResponseError> fileUpload(CAFileID fileID, Path file, String contentType, String description, Consumer<CAClientTransferStatistics> statistics) throws InterruptedException Description copied from interface:CAClientSynchronousTypeUpload the data associated with the given file.- Specified by:
fileUploadin interfaceCAClientSynchronousType- Parameters:
fileID- The file IDfile- The input filecontentType- The content typedescription- The file descriptionstatistics- A receiver of transfer statistics- Returns:
- The result
- Throws:
InterruptedException- On interruption
-
garbage
public com.io7m.hibiscus.api.HBResultType<CAClientUnit,CAIResponseError> garbage() throws InterruptedExceptionDescription copied from interface:CAClientSynchronousTypeSend random garbage to the server.- Specified by:
garbagein interfaceCAClientSynchronousType- Returns:
- The result
- Throws:
InterruptedException- On interruption
-
invalid
public com.io7m.hibiscus.api.HBResultType<CAClientUnit,CAIResponseError> invalid() throws InterruptedExceptionDescription copied from interface:CAClientSynchronousTypeSend random garbage to the server.- Specified by:
invalidin interfaceCAClientSynchronousType- Returns:
- The result
- Throws:
InterruptedException- On interruption
-
toString
-