Class CollectClientRest
- java.lang.Object
-
- fr.gouv.vitam.common.external.client.DefaultClient
-
- fr.gouv.vitam.collect.external.client.CollectClientRest
-
- All Implemented Interfaces:
CollectClient,MockOrRestClient,BasicClient,VitamAutoCloseable,java.lang.AutoCloseable
public class CollectClientRest extends DefaultClient implements CollectClient
Collect Client implementation for production environment
-
-
Field Summary
-
Fields inherited from interface fr.gouv.vitam.common.external.client.BasicClient
STATUS_URL
-
-
Constructor Summary
Constructors Constructor Description CollectClientRest(VitamClientFactoryInterface<?> factory)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.ws.rs.core.ResponseaddBinary(java.lang.String unitId, java.lang.String usage, java.lang.Integer version, java.io.InputStream inputStreamUploaded)ADD Binary Consume and produce MediaType.APPLICATION_JSONRequestResponseOK<com.fasterxml.jackson.databind.JsonNode>addObjectGroup(java.lang.String unitId, java.lang.String usage, java.lang.Integer version, com.fasterxml.jackson.databind.JsonNode objectJsonNode)ADD Object Group Consume and produce MediaType.APPLICATION_JSONvoidcheckStatus()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 clientjavax.ws.rs.core.ResponsecloseTransaction(java.lang.String transactionId)Close Transaction Consume and produce MediaType.APPLICATION_JSONvoidconsumeAnyEntityAndClose(javax.ws.rs.core.Response response)Helper when an error occurs on client usage side to consume response howeverjavax.ws.rs.client.ClientgetChunkedClient()javax.ws.rs.client.ClientgetClient()VitamClientFactory<?>getClientFactory()java.lang.StringgetResourcePath()Get the resource path of the server.java.lang.StringgetServiceUrl()Get the service URLRequestResponseOK<com.fasterxml.jackson.databind.JsonNode>ingest(java.lang.String transactionId)Generate SIP + Send to Vitam Consume and produce MediaType.APPLICATION_JSONRequestResponse<com.fasterxml.jackson.databind.JsonNode>initTransaction(TransactionDto transactionDto)Initialize a collect transaction Consume and produce MediaType.APPLICATION_JSONjavax.ws.rs.core.Responsemake(VitamRequestBuilder request)javax.ws.rs.core.ResponsemakeSpecifyingUrl(VitamRequestBuilder request)static voidstaticConsumeAnyEntityAndClose(javax.ws.rs.core.Response response)java.lang.StringtoString()RequestResponseOK<com.fasterxml.jackson.databind.JsonNode>uploadArchiveUnit(java.lang.String transactionId, com.fasterxml.jackson.databind.JsonNode unitJsonNode)ADD Archive Unit Consume and produce MediaType.APPLICATION_JSON-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface fr.gouv.vitam.common.client.MockOrRestClient
checkStatus, checkStatus, close, consumeAnyEntityAndClose, getResourcePath, getServiceUrl
-
-
-
-
Constructor Detail
-
CollectClientRest
public CollectClientRest(VitamClientFactoryInterface<?> factory)
-
-
Method Detail
-
initTransaction
public RequestResponse<com.fasterxml.jackson.databind.JsonNode> initTransaction(TransactionDto transactionDto)
Description copied from interface:CollectClientInitialize a collect transaction Consume and produce MediaType.APPLICATION_JSON- Specified by:
initTransactionin interfaceCollectClient- Returns:
- RequestResponse
guid created for the transaction
-
uploadArchiveUnit
public RequestResponseOK<com.fasterxml.jackson.databind.JsonNode> uploadArchiveUnit(java.lang.String transactionId, com.fasterxml.jackson.databind.JsonNode unitJsonNode) throws InvalidParseOperationException
Description copied from interface:CollectClientADD Archive Unit Consume and produce MediaType.APPLICATION_JSON- Specified by:
uploadArchiveUnitin interfaceCollectClient- Returns:
- RequestResponse
Archive Unit saved - Throws:
InvalidParseOperationException- exception occurs when parse operation failed
-
addObjectGroup
public RequestResponseOK<com.fasterxml.jackson.databind.JsonNode> addObjectGroup(java.lang.String unitId, java.lang.String usage, java.lang.Integer version, com.fasterxml.jackson.databind.JsonNode objectJsonNode) throws InvalidParseOperationException
Description copied from interface:CollectClientADD Object Group Consume and produce MediaType.APPLICATION_JSON- Specified by:
addObjectGroupin interfaceCollectClient- Returns:
- RequestResponse
Archive Unit saved - Throws:
InvalidParseOperationException- exception occurs when parse operation failed
-
addBinary
public javax.ws.rs.core.Response addBinary(java.lang.String unitId, java.lang.String usage, java.lang.Integer version, java.io.InputStream inputStreamUploaded) throws InvalidParseOperationExceptionDescription copied from interface:CollectClientADD Binary Consume and produce MediaType.APPLICATION_JSON- Specified by:
addBinaryin interfaceCollectClient- Returns:
- RequestResponse
Archive Unit saved - Throws:
InvalidParseOperationException- exception occurs when parse operation failed
-
closeTransaction
public javax.ws.rs.core.Response closeTransaction(java.lang.String transactionId) throws InvalidParseOperationExceptionDescription copied from interface:CollectClientClose Transaction Consume and produce MediaType.APPLICATION_JSON- Specified by:
closeTransactionin interfaceCollectClient- Returns:
- RequestResponse
Archive Unit saved - Throws:
InvalidParseOperationException- exception occurs when parse operation failed
-
ingest
public RequestResponseOK<com.fasterxml.jackson.databind.JsonNode> ingest(java.lang.String transactionId) throws InvalidParseOperationException
Description copied from interface:CollectClientGenerate SIP + Send to Vitam Consume and produce MediaType.APPLICATION_JSON- Specified by:
ingestin interfaceCollectClient- Returns:
- RequestResponse
Archive Unit saved - Throws:
InvalidParseOperationException- exception occurs when parse operation failed
-
staticConsumeAnyEntityAndClose
public static void staticConsumeAnyEntityAndClose(javax.ws.rs.core.Response 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
-
getChunkedClient
public javax.ws.rs.client.Client getChunkedClient()
-
getClient
public javax.ws.rs.client.Client getClient()
-
getClientFactory
public VitamClientFactory<?> getClientFactory()
-
-