Class ConnectionImpl
- java.lang.Object
-
- fr.gouv.vitam.common.client.DefaultClient
-
- fr.gouv.vitam.storage.driver.AbstractConnection
-
- fr.gouv.vitam.storage.offers.workspace.driver.ConnectionImpl
-
- All Implemented Interfaces:
BasicClient
,MockOrRestClient
,VitamAutoCloseable
,Connection
,java.lang.AutoCloseable
public class ConnectionImpl extends AbstractConnection
Workspace Connection Implementation
-
-
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 StorageBulkPutResult
bulkPutObjects(StorageBulkPutRequest request)
Bulk put object files into the storage offer.void
checkStatus()
Check the status from the servicevoid
checkStatus(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 certificatevoid
close()
Close the underneath http clientvoid
consumeAnyEntityAndClose(javax.ws.rs.core.Response response)
Helper when an error occurs on client usage side to consume response howeverRequestResponse<TapeReadRequestReferentialEntity>
createReadOrderRequest(StorageObjectRequest request)
Asynchronous retrieve an object from the storage offer based on criterias defined in request argument.StorageBulkMetadataResult
getBulkMetadata(StorageGetBulkMetadataRequest request)
Bulk get metadata of objectsjavax.ws.rs.client.Client
getChunkedClient()
javax.ws.rs.client.Client
getClient()
VitamClientFactory<?>
getClientFactory()
StorageMetadataResult
getMetadatas(StorageGetMetadataRequest request)
Get metadata of objectStorageGetResult
getObject(StorageObjectRequest request)
Retrieve an object from the storage offer based on criterias defined in request argument.RequestResponse<OfferLog>
getOfferLogs(StorageOfferLogRequest storageGetOfferLogRequest)
Get a listing of offer logs on a container typeRequestResponse<TapeReadRequestReferentialEntity>
getReadOrderRequest(java.lang.String readOrderRequestId, int tenant)
java.lang.String
getResourcePath()
Get the resource path of the server.java.lang.String
getServiceUrl()
Get the service URLStorageCapacityResult
getStorageCapacity(java.lang.Integer tenantId)
Retrieve the remaining storage capacity available on the distant offer.CloseableIterator<ObjectEntry>
listObjects(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 offerStoragePutResult
putObject(StoragePutRequest request)
Put the object file into the storage offer based on criterias defined in request argument and underlaying connection parameters.StorageRemoveResult
removeObject(StorageRemoveRequest request)
Delete an object on the distant storage offer.void
removeReadOrderRequest(java.lang.String readOrderRequestId, int tenant)
static void
staticConsumeAnyEntityAndClose(javax.ws.rs.core.Response response)
This method consume everything (in particular InputStream) and close the response.java.lang.String
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 Detail
-
getStorageCapacity
public StorageCapacityResult getStorageCapacity(java.lang.Integer tenantId) throws StorageDriverPreconditionFailedException, StorageDriverNotFoundException, StorageDriverException
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
public StorageGetResult getObject(StorageObjectRequest request) throws StorageDriverException
Description copied from interface:Connection
Retrieve an object from the storage offer based on criterias defined in request argument.- Parameters:
request
- 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
-
createReadOrderRequest
public RequestResponse<TapeReadRequestReferentialEntity> createReadOrderRequest(StorageObjectRequest request) throws StorageDriverException
Description copied from interface:Connection
Asynchronous retrieve an object from the storage offer based on criterias defined in request argument.- Parameters:
request
- 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
-
getReadOrderRequest
public RequestResponse<TapeReadRequestReferentialEntity> getReadOrderRequest(java.lang.String readOrderRequestId, int tenant) throws StorageDriverException
- Throws:
StorageDriverException
-
removeReadOrderRequest
public void removeReadOrderRequest(java.lang.String readOrderRequestId, int tenant) throws StorageDriverException
- Throws:
StorageDriverException
-
putObject
public StoragePutResult putObject(StoragePutRequest request) throws StorageDriverException
Description copied from interface:Connection
Put the object file into the storage offer based on criterias defined in request argument and underlaying connection parameters.- Parameters:
request
- the request to send. It may contains informations needed to store the file.- Returns:
- a result that may contains metadatas or statistics about the object put operation.
- Throws:
StorageDriverException
- if any problem occurs during request
-
bulkPutObjects
public StorageBulkPutResult bulkPutObjects(StorageBulkPutRequest request) throws StorageDriverException
Description copied from interface:Connection
Bulk put object files into the storage offer.- Throws:
StorageDriverException
- if any problem occurs during request
-
removeObject
public StorageRemoveResult removeObject(StorageRemoveRequest request) throws StorageDriverException
Description copied from interface:Connection
Delete an object on the distant storage offer.- Parameters:
request
- 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.
- Throws:
StorageDriverException
- if any problem occurs during request
-
objectExistsInOffer
public boolean objectExistsInOffer(StorageObjectRequest request) throws StorageDriverException
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
- Throws:
StorageDriverException
- if any problem occurs during request
-
getMetadatas
public StorageMetadataResult getMetadatas(StorageGetMetadataRequest request) throws StorageDriverException
Description copied from interface:Connection
Get metadata of object- Returns:
- a result that may contain information about the storage metadata
- Throws:
StorageDriverException
-
getBulkMetadata
public StorageBulkMetadataResult getBulkMetadata(StorageGetBulkMetadataRequest request) throws StorageDriverException, InvalidParseOperationException
Description copied from interface:Connection
Bulk get metadata of objects- Returns:
- a result that may contain information about the storage metadata
- Throws:
StorageDriverException
InvalidParseOperationException
-
listObjects
public CloseableIterator<ObjectEntry> listObjects(StorageListRequest request) throws StorageDriverException, StorageDriverNotFoundException
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
- Throws:
StorageDriverException
StorageDriverNotFoundException
-
getOfferLogs
public RequestResponse<OfferLog> getOfferLogs(StorageOfferLogRequest storageGetOfferLogRequest) throws StorageDriverException
Description copied from interface:Connection
Get a listing of offer logs on a container type- Parameters:
storageGetOfferLogRequest
- the request contains data needed to retrieve the listing of the container- Returns:
- the listing of last objects save according to the request
- Throws:
StorageDriverException
- to be thrown in case of any driver exception
-
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
public void checkStatus() throws VitamApplicationServerException
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<java.lang.String,java.lang.Object> headers) throws VitamApplicationServerException
Description 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
public java.lang.String 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
public java.lang.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 interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceMockOrRestClient
- Specified by:
close
in interfaceVitamAutoCloseable
-
toString
public java.lang.String toString()
- Overrides:
toString
in 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()
-
-