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.Response
addBinary(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_JSONvoid
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 clientjavax.ws.rs.core.Response
closeTransaction(java.lang.String transactionId)
Close Transaction Consume and produce MediaType.APPLICATION_JSONvoid
consumeAnyEntityAndClose(javax.ws.rs.core.Response response)
Helper when an error occurs on client usage side to consume response howeverjavax.ws.rs.client.Client
getChunkedClient()
javax.ws.rs.client.Client
getClient()
VitamClientFactory<?>
getClientFactory()
java.lang.String
getResourcePath()
Get the resource path of the server.java.lang.String
getServiceUrl()
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.Response
make(VitamRequestBuilder request)
javax.ws.rs.core.Response
makeSpecifyingUrl(VitamRequestBuilder request)
static void
staticConsumeAnyEntityAndClose(javax.ws.rs.core.Response response)
java.lang.String
toString()
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:CollectClient
Initialize a collect transaction Consume and produce MediaType.APPLICATION_JSON- Specified by:
initTransaction
in 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:CollectClient
ADD Archive Unit Consume and produce MediaType.APPLICATION_JSON- Specified by:
uploadArchiveUnit
in 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:CollectClient
ADD Object Group Consume and produce MediaType.APPLICATION_JSON- Specified by:
addObjectGroup
in 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 InvalidParseOperationException
Description copied from interface:CollectClient
ADD Binary Consume and produce MediaType.APPLICATION_JSON- Specified by:
addBinary
in 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 InvalidParseOperationException
Description copied from interface:CollectClient
Close Transaction Consume and produce MediaType.APPLICATION_JSON- Specified by:
closeTransaction
in 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:CollectClient
Generate SIP + Send to Vitam Consume and produce MediaType.APPLICATION_JSON- Specified by:
ingest
in 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: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
-
getChunkedClient
public javax.ws.rs.client.Client getChunkedClient()
-
getClient
public javax.ws.rs.client.Client getClient()
-
getClientFactory
public VitamClientFactory<?> getClientFactory()
-
-