Class LocalReplicatorStreamHandler
java.lang.Object
io.clonecloudstore.common.quarkus.server.service.StreamHandlerAbstract<ReplicatorOrder,AccessorObject>
io.clonecloudstore.replicator.server.local.resource.LocalReplicatorStreamHandler
@RequestScoped
public class LocalReplicatorStreamHandler
extends StreamHandlerAbstract<ReplicatorOrder,AccessorObject>
-
Field Summary
Fields inherited from class io.clonecloudstore.common.quarkus.server.service.StreamHandlerAbstract
countDownLatch, exceptionAtomicReference, resultProxy
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
checkDigestToCompute
(ReplicatorOrder businessIn) Default based on QuarkusProperties.serverComputeSha256protected boolean
checkPullAble
(ReplicatorOrder replicatorOrder, io.vertx.core.MultiMap headers) The implementation must check using business object that get inputStream request (server sending InputStream as result) is valid according to the businessIn from te Rest API and the headers.protected void
checkPushAble
(ReplicatorOrder businessIn, MultipleActionsInputStream inputStream) Check if the request for POST is valid, and if so, adapt the given MultipleActionsInputStream that will be used to consume the original InputStream.protected AccessorObject
getAnswerPushInputStream
(ReplicatorOrder replicatorOrder, String finalHash, long size) Returns a BusinessOut in case of POST (receiving InputStream on server side).getHeaderError
(ReplicatorOrder replicatorOrder, int status) Return headers for error message.getHeaderPullInputStream
(ReplicatorOrder replicatorOrder) Returns a Map for Headers response in case of GET, added to InputStream get above (server is sending the InputStream back to the client) (example: headers for object name, object size...)getHeaderPushInputStream
(ReplicatorOrder replicatorOrder, String finalHash, long size, AccessorObject accessorObject) Returns a Map for Headers response in case of POST (receiving InputStream on server side).protected InputStream
getPullInputStream
(ReplicatorOrder replicatorObject) Returns the InputStream required for GET (server is sending the InputStream back to the client).protected void
Method to override for post setupMethods inherited from class io.clonecloudstore.common.quarkus.server.service.StreamHandlerAbstract
checkEndOfPush, clear, doGetInputStream, endPush, getBusinessIn, getCloser, getInputStreamLength, getOpId, getOriginalHash, getRequest, getServerStreamHandlerResponseException, getVertx, isAlreadyCompressed, isExternal, isKeepAlive, isKeepInputStreamCompressed, isResponseCompressed, isUpload, preparePull, pull, pullList, sendError, sendError, setKeepInputStreamCompressed, setResponseCompressed, setResultFromRemote, setup, shallCompress, shallDecompress, throwTrappedException, upload
-
Constructor Details
-
LocalReplicatorStreamHandler
public LocalReplicatorStreamHandler()
-
-
Method Details
-
postSetup
protected void postSetup()Description copied from class:StreamHandlerAbstract
Method to override for post setup- Overrides:
postSetup
in classStreamHandlerAbstract<ReplicatorOrder,
AccessorObject>
-
checkDigestToCompute
Description copied from class:StreamHandlerAbstract
Default based on QuarkusProperties.serverComputeSha256- Overrides:
checkDigestToCompute
in classStreamHandlerAbstract<ReplicatorOrder,
AccessorObject> - Returns:
- True if the digest is to be computed on the fly
-
checkPushAble
protected void checkPushAble(ReplicatorOrder businessIn, MultipleActionsInputStream inputStream) throws CcsClientGenericException, CcsServerGenericException Description copied from class:StreamHandlerAbstract
Check if the request for POST is valid, and if so, adapt the given MultipleActionsInputStream that will be used to consume the original InputStream. The implementation shall use the business logic to check the validity for this InputStream reception (from client to server) and, if valid, use the MultipleActionsInputStream, either as is or as a standard InputStream. (example: check through Object Storage that object does not exist yet, and if so add the consumption of the stream for the Object Storage object creation). Note that the stream might be kept compressed if keepInputStreamCompressed was specified at construction.- Specified by:
checkPushAble
in classStreamHandlerAbstract<ReplicatorOrder,
AccessorObject> - Throws:
CcsClientGenericException
CcsServerGenericException
-
getAnswerPushInputStream
protected AccessorObject getAnswerPushInputStream(ReplicatorOrder replicatorOrder, String finalHash, long size) Description copied from class:StreamHandlerAbstract
Returns a BusinessOut in case of POST (receiving InputStream on server side). The implementation shall use the business logic to get the right BusinessOut object to return. (example: getting the StorageObject object, including the computed or given Hash)- Specified by:
getAnswerPushInputStream
in classStreamHandlerAbstract<ReplicatorOrder,
AccessorObject> - Parameters:
replicatorOrder
- businessIn as passed in constructorfinalHash
- the final Hash if computed on the fly, or the original given onesize
- the real size read (from received stream, could be compressed size if decompression is off at construction)
-
getHeaderPushInputStream
protected Map<String,String> getHeaderPushInputStream(ReplicatorOrder replicatorOrder, String finalHash, long size, AccessorObject accessorObject) Description copied from class:StreamHandlerAbstract
Returns a Map for Headers response in case of POST (receiving InputStream on server side). (example: headers for object name, object size, ...)- Specified by:
getHeaderPushInputStream
in classStreamHandlerAbstract<ReplicatorOrder,
AccessorObject> - Parameters:
replicatorOrder
- businessIn as passed in constructorfinalHash
- the final Hash if computed on the fly, or the original given onesize
- the real size readaccessorObject
- previously constructed from getAnswerPushInputStream
-
checkPullAble
Description copied from class:StreamHandlerAbstract
The implementation must check using business object that get inputStream request (server sending InputStream as result) is valid according to the businessIn from te Rest API and the headers. (example: ObjectStorage check of existence of object)- Specified by:
checkPullAble
in classStreamHandlerAbstract<ReplicatorOrder,
AccessorObject> - Returns:
- True if the read action is valid for this businessIn object and headers
-
getPullInputStream
Description copied from class:StreamHandlerAbstract
Returns the InputStream required for GET (server is sending the InputStream back to the client). The implementation shall use the business logic and controls to get the InputStream to return. (example: getting the Object Storage object stream)- Specified by:
getPullInputStream
in classStreamHandlerAbstract<ReplicatorOrder,
AccessorObject> - Parameters:
replicatorObject
- businessIn as passed in constructor
-
getHeaderPullInputStream
Description copied from class:StreamHandlerAbstract
Returns a Map for Headers response in case of GET, added to InputStream get above (server is sending the InputStream back to the client) (example: headers for object name, object size...)- Specified by:
getHeaderPullInputStream
in classStreamHandlerAbstract<ReplicatorOrder,
AccessorObject> - Parameters:
replicatorOrder
- businessIn as passed in constructor
-
getHeaderError
Description copied from class:StreamHandlerAbstract
Return headers for error message. (example: get headers in case of error as Object name, Bucket name...)- Specified by:
getHeaderError
in classStreamHandlerAbstract<ReplicatorOrder,
AccessorObject>
-