Package fr.gouv.vitam.common.client
Class DefaultAdminClient
- java.lang.Object
-
- fr.gouv.vitam.common.client.DefaultAdminClient
-
- All Implemented Interfaces:
AdminClient
,BasicClient
,MockOrRestClient
,VitamAutoCloseable
,java.lang.AutoCloseable
public class DefaultAdminClient extends java.lang.Object implements AdminClient
-
-
Field Summary
-
Fields inherited from interface fr.gouv.vitam.common.client.BasicClient
STATUS_URL
-
-
Constructor Summary
Constructors Constructor Description DefaultAdminClient(VitamClientFactoryInterface<DefaultAdminClient> factory)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description VitamError<com.fasterxml.jackson.databind.JsonNode>
adminAutotest()
Check the dependencies and return a VitamError status where getHttpCode contains either 200 for OK or 503 for error and a sub list of VitamErrors for each tested subservicesAdminStatusMessage
adminStatus()
Get the administration status from the servicevoid
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 howeverjava.lang.String
getAdminUrl()
javax.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 URLjavax.ws.rs.core.Response
make(VitamRequestBuilder request)
javax.ws.rs.core.Response
makeSpecifyingUrl(VitamRequestBuilder request)
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 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
-
DefaultAdminClient
public DefaultAdminClient(VitamClientFactoryInterface<DefaultAdminClient> factory)
-
-
Method Detail
-
adminStatus
public AdminStatusMessage adminStatus()
Description copied from interface:AdminClient
Get the administration status from the service- Specified by:
adminStatus
in interfaceAdminClient
- Returns:
- the AdminStatusMessage
-
adminAutotest
public VitamError<com.fasterxml.jackson.databind.JsonNode> adminAutotest()
Description copied from interface:AdminClient
Check the dependencies and return a VitamError status where getHttpCode contains either 200 for OK or 503 for error and a sub list of VitamErrors for each tested subservices- Specified by:
adminAutotest
in interfaceAdminClient
- Returns:
- the VitamError status, both in case of OK or ServiceUnavailable
-
getAdminUrl
public java.lang.String getAdminUrl()
- Specified by:
getAdminUrl
in interfaceAdminClient
- Returns:
- the adminUrl
-
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()
-
-