Class VitamClientFactory<T extends MockOrRestClient>
java.lang.Object
fr.gouv.vitam.common.external.client.VitamClientFactory<T>
- Type Parameters:
T- MockOrRestClient class
- All Implemented Interfaces:
VitamClientFactoryInterface<T>
- Direct Known Subclasses:
AccessExternalClientFactory,AccessExternalClientV2Factory,AdminExternalClientFactory,CollectExternalClientFactory,IngestExternalClientFactory,TestVitamClientFactory
public abstract class VitamClientFactory<T extends MockOrRestClient>
extends Object
implements VitamClientFactoryInterface<T>
General VitamClientFactory for non SSL client
-
Nested Class Summary
Nested classes/interfaces inherited from interface fr.gouv.vitam.common.client.VitamClientFactoryInterface
VitamClientFactoryInterface.VitamClientType -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedVitamClientFactory(ClientConfiguration configuration, String resourcePath) Constructor with standard configurationprotectedVitamClientFactory(ClientConfiguration configuration, String resourcePath, boolean chunkedMode) Constructor to allow to enable Multipart support or Chunked mode.protectedVitamClientFactory(ClientConfiguration configuration, String resourcePath, javax.ws.rs.client.Client client) -
Method Summary
Modifier and TypeMethodDescriptionvoidchangeResourcePath(String resourcePath) Change the server resourcePath to use.voidchangeServerPort(int port) Change the server port to use.final ClientConfigurationfinal Map<VitamRestEasyConfiguration,Object> final Map<VitamRestEasyConfiguration,Object> getDefaultConfigCient(boolean chunkedMode) javax.ws.rs.client.ClientGet the internal Http clientjavax.ws.rs.client.ClientgetHttpClient(boolean useChunkedMode) Get the internal Http client according to the chunk modeGet the resource path of the server.Get the service URLprotected final voidinitialisation(ClientConfiguration configuration, String resourcePath) Initialize default resource path, service Url, pool manager, ssl configuration and the VitamApacheHttpClient for RestEasyprotected booleanprotected booleanstatic voidCloses any pending connection.voidresume(javax.ws.rs.client.Client client, boolean chunk) Reset the client into the Client pool if possiblevoidsetGzipdecoded(boolean allowGzipDecoded) Allow or not the GzipDecoded input from servervoidsetGzipEncoded(boolean allowGzipEncoded) Allow or not the GzipEncoded output from clientsetVitamClientType(VitamClientFactoryInterface.VitamClientType vitamClientType) voidshutdown()Shutdown the global Connection Manager (cannot be restarted yet)toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface fr.gouv.vitam.common.client.VitamClientFactoryInterface
getClient
-
Field Details
-
clientConfiguration
-
-
Constructor Details
-
VitamClientFactory
Constructor with standard configuration- Parameters:
configuration- The client configurationresourcePath- the resource path of the server for the client calls- Throws:
UnsupportedOperationException- HTTPS not implemented yet
-
VitamClientFactory
protected VitamClientFactory(ClientConfiguration configuration, String resourcePath, boolean chunkedMode) Constructor to allow to enable Multipart support or Chunked mode.- Parameters:
configuration- The client configurationresourcePath- the resource path of the server for the client calls- Throws:
UnsupportedOperationException- HTTPS not implemented yet
-
VitamClientFactory
protected VitamClientFactory(ClientConfiguration configuration, String resourcePath, javax.ws.rs.client.Client client) - Parameters:
configuration- the client configurationresourcePath- the resource path of the server for the client callsclient- the HTTP client to use- Throws:
UnsupportedOperationException- HTTPS not implemented yet
-
-
Method Details
-
setGzipEncoded
public void setGzipEncoded(boolean allowGzipEncoded) Allow or not the GzipEncoded output from client- Parameters:
allowGzipEncoded-
-
isAllowGzipEncoded
protected boolean isAllowGzipEncoded()- Returns:
- true if client is allowed to gzip encoded
-
setGzipdecoded
public void setGzipdecoded(boolean allowGzipDecoded) Allow or not the GzipDecoded input from server- Parameters:
allowGzipDecoded-
-
isAllowGzipDecoded
protected boolean isAllowGzipDecoded()- Returns:
- true if client is allowed to gzip decoded
-
initialisation
Initialize default resource path, service Url, pool manager, ssl configuration and the VitamApacheHttpClient for RestEasy- Parameters:
configuration-resourcePath-
-
changeResourcePath
Description copied from interface:VitamClientFactoryInterfaceChange the server resourcePath to use. Only in JUNIT- Specified by:
changeResourcePathin interfaceVitamClientFactoryInterface<T extends MockOrRestClient>
-
changeServerPort
public void changeServerPort(int port) Description copied from interface:VitamClientFactoryInterfaceChange the server port to use. Only in JUNIT- Specified by:
changeServerPortin interfaceVitamClientFactoryInterface<T extends MockOrRestClient>
-
getVitamClientType
- Specified by:
getVitamClientTypein interfaceVitamClientFactoryInterface<T extends MockOrRestClient>- Returns:
- the current
VitamClientFactoryInterface.VitamClientType
-
setVitamClientType
public VitamClientFactory<T> setVitamClientType(VitamClientFactoryInterface.VitamClientType vitamClientType) - Specified by:
setVitamClientTypein interfaceVitamClientFactoryInterface<T extends MockOrRestClient>- Parameters:
vitamClientType- to set- Returns:
- this
-
resume
public void resume(javax.ws.rs.client.Client client, boolean chunk) Description copied from interface:VitamClientFactoryInterfaceReset the client into the Client pool if possible- Specified by:
resumein interfaceVitamClientFactoryInterface<T extends MockOrRestClient>
-
getHttpClient
public javax.ws.rs.client.Client getHttpClient()Description copied from interface:VitamClientFactoryInterfaceGet the internal Http client- Specified by:
getHttpClientin interfaceVitamClientFactoryInterface<T extends MockOrRestClient>- Returns:
- the client
-
getHttpClient
public javax.ws.rs.client.Client getHttpClient(boolean useChunkedMode) Description copied from interface:VitamClientFactoryInterfaceGet the internal Http client according to the chunk mode- Specified by:
getHttpClientin interfaceVitamClientFactoryInterface<T extends MockOrRestClient>- Returns:
- the client
-
getResourcePath
Description copied from interface:VitamClientFactoryInterfaceGet the resource path of the server.- Specified by:
getResourcePathin interfaceVitamClientFactoryInterface<T extends MockOrRestClient>- Returns:
- the resource path as string
-
getServiceUrl
Description copied from interface:VitamClientFactoryInterfaceGet the service URL- Specified by:
getServiceUrlin interfaceVitamClientFactoryInterface<T extends MockOrRestClient>- Returns:
- the service URL
-
toString
-
getClientConfiguration
- Specified by:
getClientConfigurationin interfaceVitamClientFactoryInterface<T extends MockOrRestClient>- Returns:
- the Vitam client configuration
-
getDefaultConfigCient
- Specified by:
getDefaultConfigCientin interfaceVitamClientFactoryInterface<T extends MockOrRestClient>- Returns:
- the Default Client configuration (Chunked Mode)
-
getDefaultConfigCient
- Specified by:
getDefaultConfigCientin interfaceVitamClientFactoryInterface<T extends MockOrRestClient>- Returns:
- the Default Client configuration according to the chunked mode
-
shutdown
public void shutdown()Shutdown the global Connection Manager (cannot be restarted yet)- Specified by:
shutdownin interfaceVitamClientFactoryInterface<T extends MockOrRestClient>
-
resetConnections
public static void resetConnections()Closes any pending connection.
-