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
,AutoCloseable
- Enclosing class:
- FakeDriverImpl
-
Field Summary
Fields inherited from interface fr.gouv.vitam.common.client.BasicClient
STATUS_URL
-
Method Summary
Modifier and TypeMethodDescriptionbulkPutObjects
(StorageBulkPutRequest request) Bulk put object files into the storage offer.checkAccessRequestStatuses
(List<String> accessRequestIds, int tenant, boolean adminCrossTenantAccessRequestAllowed) Check access request statuses of asynchronous offer.boolean
Check immediate availability of objects from asynchronous storage offer.void
Check the status from the servicevoid
checkStatus
(javax.ws.rs.core.MultivaluedHashMap<String, Object> headers) Check the status from the service used to passe "X-SSL-CLIENT-CERT" header that contain a pem certificatevoid
close()
Close the underneath http clientfinal void
consumeAnyEntityAndClose
(javax.ws.rs.core.Response response) Helper when an error occurs on client usage side to consume response howeverCreate an access request for retrieving objects from asynchronous storage offer.Bulk get metadata of objectsjavax.ws.rs.client.Client
javax.ws.rs.client.Client
getMetadatas
(StorageGetMetadataRequest request) Get metadata of objectgetObject
(StorageObjectRequest objectRequest) Retrieve an object from the storage offer based on criterias defined in request argument.getOfferLogs
(StorageOfferLogRequest storageOfferLogRequest) Get a listing of offer logs on a container typeGet the resource path of the server.Get the service URLgetStorageCapacity
(Integer tenantId) Retrieve the remaining storage capacity available on the distant offer.javax.ws.rs.core.Response
launchOfferLogCompaction
(VitamContext vitamContext) launch Offer Log CompactionlistObjects
(StorageListRequest request) List object on a container typejavax.ws.rs.core.Response
make
(VitamRequestBuilder request) javax.ws.rs.core.Response
makeSpecifyingUrl
(VitamRequestBuilder request) boolean
objectExistsInOffer
(StorageObjectRequest request) Check if an object is present in the offerputObject
(StoragePutRequest objectRequest) Put the object file into the storage offer based on criteria defined in request argument and underlying connection parameters.void
removeAccessRequest
(String accessRequestId, int tenant, boolean adminCrossTenantAccessRequestAllowed) Removes (cancel / delete) and access request for an asynchronous offer.removeObject
(StorageRemoveRequest objectRequest) Delete an object on the distant storage offer.void
setGetObjectFunction
(FakeDriverImpl.ThrowableFunction<StorageObjectRequest, StorageGetResult> getObjectFunction) static void
staticConsumeAnyEntityAndClose
(javax.ws.rs.core.Response response) This method consume everything (in particular InputStream) and close the response.toString()
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 Details
-
getOfferId
-
setGetObjectFunction
public void setGetObjectFunction(FakeDriverImpl.ThrowableFunction<StorageObjectRequest, StorageGetResult> getObjectFunction) -
getStorageCapacity
Description copied from interface:Connection
Retrieve 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
Description copied from interface:Connection
Retrieve 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
Description copied from interface:Connection
Create 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 Map<String,AccessRequestStatus> checkAccessRequestStatuses(List<String> accessRequestIds, int tenant, boolean adminCrossTenantAccessRequestAllowed) Description copied from interface:Connection
Check 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
AccessRequestStatus
by access request Id
-
removeAccessRequest
public void removeAccessRequest(String accessRequestId, int tenant, boolean adminCrossTenantAccessRequestAllowed) Description copied from interface:Connection
Removes (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
Description copied from interface:Connection
Check immediate availability of objects from asynchronous storage offer.- Parameters:
request
- the request to send. It contains information needed to check object availability.- Returns:
true
if ALL objects are available, otherwisefalse
.
-
putObject
Description copied from interface:Connection
Put 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
Description copied from interface:Connection
Bulk put object files into the storage offer. -
removeObject
Description copied from interface:Connection
Delete 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
Description copied from interface:Connection
Check 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
Description copied from interface:Connection
Get metadata of object- Returns:
- a result that may contain information about the storage metadata
-
getBulkMetadata
Description copied from interface:Connection
Bulk get metadata of objects- Returns:
- a result that may contain information about the storage metadata
-
listObjects
Description copied from interface:Connection
List object on a container type- Parameters:
request
- the request contains data needed to list container type- Returns:
- an iterator with each object metadata
-
getOfferLogs
Description copied from interface:Connection
Get 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
Description copied from interface:Connection
launch 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:MockOrRestClient
Helper when an error occurs on client usage side to consume response however- Specified by:
consumeAnyEntityAndClose
in interfaceMockOrRestClient
-
checkStatus
Description copied from interface:MockOrRestClient
Check the status from the service- Specified by:
checkStatus
in interfaceMockOrRestClient
- Throws:
VitamApplicationServerException
- if the Server is unavailable
-
checkStatus
public void checkStatus(javax.ws.rs.core.MultivaluedHashMap<String, Object> headers) throws VitamApplicationServerExceptionDescription copied from interface:MockOrRestClient
Check the status from the service used to passe "X-SSL-CLIENT-CERT" header that contain a pem certificate- Specified by:
checkStatus
in interfaceMockOrRestClient
- Throws:
VitamApplicationServerException
- if the Server is unavailable
-
getResourcePath
Description copied from interface:MockOrRestClient
Get the resource path of the server.- Specified by:
getResourcePath
in interfaceMockOrRestClient
- Returns:
- the resource path as string
-
getServiceUrl
Description copied from interface:MockOrRestClient
Get the service URL- Specified by:
getServiceUrl
in interfaceMockOrRestClient
- Returns:
- the service URL
-
close
public void close()Description copied from interface:MockOrRestClient
Close the underneath http client- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceMockOrRestClient
- Specified by:
close
in interfaceVitamAutoCloseable
-
toString
-
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
-
getClient
public javax.ws.rs.client.Client getClient() -
getChunkedClient
public javax.ws.rs.client.Client getChunkedClient()
-