Package fr.gouv.vitam.driver.fake
Class FakeDriverImpl.FakeConnectionImpl
- java.lang.Object
-
- fr.gouv.vitam.common.client.DefaultClient
-
- fr.gouv.vitam.storage.driver.AbstractConnection
-
- fr.gouv.vitam.driver.fake.FakeDriverImpl.FakeConnectionImpl
-
- All Implemented Interfaces:
BasicClient,MockOrRestClient,VitamAutoCloseable,Connection,java.lang.AutoCloseable
- Enclosing class:
- FakeDriverImpl
public class FakeDriverImpl.FakeConnectionImpl extends AbstractConnection
-
-
Field Summary
-
Fields inherited from interface fr.gouv.vitam.common.client.BasicClient
STATUS_URL
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StorageBulkPutResultbulkPutObjects(StorageBulkPutRequest request)Bulk put object files into the storage offer.java.util.Map<java.lang.String,AccessRequestStatus>checkAccessRequestStatuses(java.util.List<java.lang.String> accessRequestIds, int tenant, boolean adminCrossTenantAccessRequestAllowed)Check access request statuses of asynchronous offer.booleancheckObjectAvailability(StorageCheckObjectAvailabilityRequest request)Check immediate availability of objects from asynchronous storage offer.voidcheckStatus()Check the status from the servicevoidcheckStatus(javax.ws.rs.core.MultivaluedHashMap<java.lang.String,java.lang.Object> headers)Check the status from the service used to passe "X-SSL-CLIENT-CERT" header that contain a pem certificatevoidclose()Close the underneath http clientvoidconsumeAnyEntityAndClose(javax.ws.rs.core.Response response)Helper when an error occurs on client usage side to consume response howeverjava.lang.StringcreateAccessRequest(StorageAccessRequestCreationRequest request)Create an access request for retrieving objects from asynchronous storage offer.StorageBulkMetadataResultgetBulkMetadata(StorageGetBulkMetadataRequest request)Bulk get metadata of objectsjavax.ws.rs.client.ClientgetChunkedClient()javax.ws.rs.client.ClientgetClient()VitamClientFactory<?>getClientFactory()StorageMetadataResultgetMetadatas(StorageGetMetadataRequest request)Get metadata of objectStorageGetResultgetObject(StorageObjectRequest objectRequest)Retrieve an object from the storage offer based on criterias defined in request argument.java.lang.StringgetOfferId()RequestResponse<OfferLog>getOfferLogs(StorageOfferLogRequest storageOfferLogRequest)Get a listing of offer logs on a container typejava.lang.StringgetResourcePath()Get the resource path of the server.java.lang.StringgetServiceUrl()Get the service URLStorageCapacityResultgetStorageCapacity(java.lang.Integer tenantId)Retrieve the remaining storage capacity available on the distant offer.javax.ws.rs.core.ResponselaunchOfferLogCompaction(VitamContext vitamContext)launch Offer Log CompactionCloseableIterator<ObjectEntry>listObjects(StorageListRequest request)List object on a container typejavax.ws.rs.core.Responsemake(VitamRequestBuilder request)javax.ws.rs.core.ResponsemakeSpecifyingUrl(VitamRequestBuilder request)booleanobjectExistsInOffer(StorageObjectRequest request)Check if an object is present in the offerStoragePutResultputObject(StoragePutRequest objectRequest)Put the object file into the storage offer based on criteria defined in request argument and underlying connection parameters.voidremoveAccessRequest(java.lang.String accessRequestId, int tenant, boolean adminCrossTenantAccessRequestAllowed)Removes (cancel / delete) and access request for an asynchronous offer.StorageRemoveResultremoveObject(StorageRemoveRequest objectRequest)Delete an object on the distant storage offer.voidsetGetObjectFunction(FakeDriverImpl.ThrowableFunction<StorageObjectRequest,StorageGetResult> getObjectFunction)static voidstaticConsumeAnyEntityAndClose(javax.ws.rs.core.Response response)This method consume everything (in particular InputStream) and close the response.java.lang.StringtoString()-
Methods inherited from class fr.gouv.vitam.storage.driver.AbstractConnection
getDriverName
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface fr.gouv.vitam.storage.driver.Connection
close
-
-
-
-
Method Detail
-
getOfferId
public java.lang.String getOfferId()
-
setGetObjectFunction
public void setGetObjectFunction(FakeDriverImpl.ThrowableFunction<StorageObjectRequest,StorageGetResult> getObjectFunction)
-
getStorageCapacity
public StorageCapacityResult getStorageCapacity(java.lang.Integer tenantId) throws StorageDriverException
Description copied from interface:ConnectionRetrieve the remaining storage capacity available on the distant offer. Return values MUST in bytes- Parameters:
tenantId- the tenant id needed to get storage capacity- Returns:
- the usable and used space in bytes and a remind of the given tenantId
- Throws:
StorageDriverPreconditionFailedException- if a bad request is encounteredStorageDriverNotFoundException- if container is not foundStorageDriverException- if any problem occurs during request
-
getObject
public StorageGetResult getObject(StorageObjectRequest objectRequest) throws StorageDriverException
Description copied from interface:ConnectionRetrieve an object from the storage offer based on criterias defined in request argument.- Parameters:
objectRequest- the request to send. It contains informations needed to retrieve a given object.- Returns:
- a result that may contains metadatas as well as the binary file
- Throws:
StorageDriverException- if any problem occurs during request
-
createAccessRequest
public java.lang.String createAccessRequest(StorageAccessRequestCreationRequest request)
Description copied from interface:ConnectionCreate an access request for retrieving objects from asynchronous storage offer.- Parameters:
request- the request to send. It contains information needed to prepare a given object.- Returns:
- an AccessRequestId that can be used to check the status of the AccessRequest, and to remove it
-
checkAccessRequestStatuses
public java.util.Map<java.lang.String,AccessRequestStatus> checkAccessRequestStatuses(java.util.List<java.lang.String> accessRequestIds, int tenant, boolean adminCrossTenantAccessRequestAllowed)
Description copied from interface:ConnectionCheck access request statuses of asynchronous offer.- Parameters:
accessRequestIds- the accessRequestIds whose status is to be checkedtenant- the tenant IdadminCrossTenantAccessRequestAllowed- whentrue, access to access requests of other tenants is allowed from Admin tenant- Returns:
- a Map of
AccessRequestStatusby access request Id
-
removeAccessRequest
public void removeAccessRequest(java.lang.String accessRequestId, int tenant, boolean adminCrossTenantAccessRequestAllowed)Description copied from interface:ConnectionRemoves (cancel / delete) and access request for an asynchronous offer. Does nothing is access request id does not exist (idempotency)- Parameters:
accessRequestId- the accessRequestId to removetenant- the tenant IdadminCrossTenantAccessRequestAllowed- whentrue, removing access requests of other tenants is allowed from Admin tenant
-
checkObjectAvailability
public boolean checkObjectAvailability(StorageCheckObjectAvailabilityRequest request)
Description copied from interface:ConnectionCheck immediate availability of objects from asynchronous storage offer.- Parameters:
request- the request to send. It contains information needed to check object availability.- Returns:
trueif ALL objects are available, otherwisefalse.
-
putObject
public StoragePutResult putObject(StoragePutRequest objectRequest) throws StorageDriverException
Description copied from interface:ConnectionPut the object file into the storage offer based on criteria defined in request argument and underlying connection parameters.- Parameters:
objectRequest- the request to send. It may contain information needed to store the file.- Returns:
- a result that may contain metadata or statistics about the object put operation.
- Throws:
StorageDriverException- if any problem occurs during request
-
bulkPutObjects
public StorageBulkPutResult bulkPutObjects(StorageBulkPutRequest request)
Description copied from interface:ConnectionBulk put object files into the storage offer.
-
removeObject
public StorageRemoveResult removeObject(StorageRemoveRequest objectRequest)
Description copied from interface:ConnectionDelete an object on the distant storage offer.- Parameters:
objectRequest- the request to send, it contains information needed to delete an object on the distant store- Returns:
- a result that may contains metadatas or statistics about the object removal operation.
-
objectExistsInOffer
public boolean objectExistsInOffer(StorageObjectRequest request)
Description copied from interface:ConnectionCheck if an object is present in the offer- Parameters:
request- the request to send. It contains informations needed to retrieve a given object.- Returns:
- true if exists, else false
-
getMetadatas
public StorageMetadataResult getMetadatas(StorageGetMetadataRequest request)
Description copied from interface:ConnectionGet metadata of object- Returns:
- a result that may contain information about the storage metadata
-
getBulkMetadata
public StorageBulkMetadataResult getBulkMetadata(StorageGetBulkMetadataRequest request)
Description copied from interface:ConnectionBulk get metadata of objects- Returns:
- a result that may contain information about the storage metadata
-
listObjects
public CloseableIterator<ObjectEntry> listObjects(StorageListRequest request)
Description copied from interface:ConnectionList object on a container type- Parameters:
request- the request contains data needed to list container type- Returns:
- an iterator with each object metadata
-
getOfferLogs
public RequestResponse<OfferLog> getOfferLogs(StorageOfferLogRequest storageOfferLogRequest)
Description copied from interface:ConnectionGet a listing of offer logs on a container type- Parameters:
storageOfferLogRequest- the request contains data needed to retrieve the listing of the container- Returns:
- the listing of last objects save according to the request
-
launchOfferLogCompaction
public javax.ws.rs.core.Response launchOfferLogCompaction(VitamContext vitamContext)
Description copied from interface:Connectionlaunch Offer Log Compaction- Returns:
- RequestResponse
-
staticConsumeAnyEntityAndClose
public static void staticConsumeAnyEntityAndClose(javax.ws.rs.core.Response response)
This method consume everything (in particular InputStream) and close the response.- Parameters:
response-
-
consumeAnyEntityAndClose
public final void consumeAnyEntityAndClose(javax.ws.rs.core.Response response)
Description copied from interface:MockOrRestClientHelper when an error occurs on client usage side to consume response however- Specified by:
consumeAnyEntityAndClosein interfaceMockOrRestClient
-
checkStatus
public void checkStatus() throws VitamApplicationServerExceptionDescription copied from interface:MockOrRestClientCheck the status from the service- Specified by:
checkStatusin interfaceMockOrRestClient- Throws:
VitamApplicationServerException- if the Server is unavailable
-
checkStatus
public void checkStatus(javax.ws.rs.core.MultivaluedHashMap<java.lang.String,java.lang.Object> headers) throws VitamApplicationServerExceptionDescription copied from interface:MockOrRestClientCheck the status from the service used to passe "X-SSL-CLIENT-CERT" header that contain a pem certificate- Specified by:
checkStatusin interfaceMockOrRestClient- Throws:
VitamApplicationServerException- if the Server is unavailable
-
getResourcePath
public java.lang.String getResourcePath()
Description copied from interface:MockOrRestClientGet the resource path of the server.- Specified by:
getResourcePathin interfaceMockOrRestClient- Returns:
- the resource path as string
-
getServiceUrl
public java.lang.String getServiceUrl()
Description copied from interface:MockOrRestClientGet the service URL- Specified by:
getServiceUrlin interfaceMockOrRestClient- Returns:
- the service URL
-
close
public void close()
Description copied from interface:MockOrRestClientClose the underneath http client- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfaceMockOrRestClient- Specified by:
closein interfaceVitamAutoCloseable
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
makeSpecifyingUrl
public javax.ws.rs.core.Response makeSpecifyingUrl(VitamRequestBuilder request) throws VitamClientInternalException
- Throws:
VitamClientInternalException
-
make
public javax.ws.rs.core.Response make(VitamRequestBuilder request) throws VitamClientInternalException
- Throws:
VitamClientInternalException
-
getClientFactory
public VitamClientFactory<?> getClientFactory()
-
getClient
public javax.ws.rs.client.Client getClient()
-
getChunkedClient
public javax.ws.rs.client.Client getChunkedClient()
-
-