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 java.lang.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 Modifier and Type Field Description protected ClientConfiguration
clientConfiguration
-
Constructor Summary
Constructors Modifier Constructor Description protected
VitamClientFactory(ClientConfiguration configuration, java.lang.String resourcePath)
Constructor with standard configurationprotected
VitamClientFactory(ClientConfiguration configuration, java.lang.String resourcePath, boolean chunkedMode)
Constructor to allow to enable Multipart support or Chunked mode.protected
VitamClientFactory(ClientConfiguration configuration, java.lang.String resourcePath, javax.ws.rs.client.Client client)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
changeResourcePath(java.lang.String resourcePath)
Change the server resourcePath to use.void
changeServerPort(int port)
Change the server port to use.ClientConfiguration
getClientConfiguration()
java.util.Map<VitamRestEasyConfiguration,java.lang.Object>
getDefaultConfigCient()
java.util.Map<VitamRestEasyConfiguration,java.lang.Object>
getDefaultConfigCient(boolean chunkedMode)
javax.ws.rs.client.Client
getHttpClient()
Get the internal Http clientjavax.ws.rs.client.Client
getHttpClient(boolean useChunkedMode)
Get the internal Http client according to the chunk modejava.lang.String
getResourcePath()
Get the resource path of the server.java.lang.String
getServiceUrl()
Get the service URLVitamClientFactoryInterface.VitamClientType
getVitamClientType()
protected void
initialisation(ClientConfiguration configuration, java.lang.String resourcePath)
Initialize default resource path, service Url, pool manager, ssl configuration and the VitamApacheHttpClient for RestEasyprotected boolean
isAllowGzipDecoded()
protected boolean
isAllowGzipEncoded()
static void
resetConnections()
Closes any pending connection.void
resume(javax.ws.rs.client.Client client, boolean chunk)
Reset the client into the Client pool if possiblevoid
setGzipdecoded(boolean allowGzipDecoded)
Allow or not the GzipDecoded input from servervoid
setGzipEncoded(boolean allowGzipEncoded)
Allow or not the GzipEncoded output from clientVitamClientFactory<T>
setVitamClientType(VitamClientFactoryInterface.VitamClientType vitamClientType)
void
shutdown()
Shutdown the global Connection Manager (cannot be restarted yet)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.VitamClientFactoryInterface
getClient
-
-
-
-
Field Detail
-
clientConfiguration
protected ClientConfiguration clientConfiguration
-
-
Constructor Detail
-
VitamClientFactory
protected VitamClientFactory(ClientConfiguration configuration, java.lang.String resourcePath)
Constructor with standard configuration- Parameters:
configuration
- The client configurationresourcePath
- the resource path of the server for the client calls- Throws:
java.lang.UnsupportedOperationException
- HTTPS not implemented yet
-
VitamClientFactory
protected VitamClientFactory(ClientConfiguration configuration, java.lang.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:
java.lang.UnsupportedOperationException
- HTTPS not implemented yet
-
VitamClientFactory
protected VitamClientFactory(ClientConfiguration configuration, java.lang.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:
java.lang.UnsupportedOperationException
- HTTPS not implemented yet
-
-
Method Detail
-
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
protected final void initialisation(ClientConfiguration configuration, java.lang.String resourcePath)
Initialize default resource path, service Url, pool manager, ssl configuration and the VitamApacheHttpClient for RestEasy- Parameters:
configuration
-resourcePath
-
-
changeResourcePath
public void changeResourcePath(java.lang.String resourcePath)
Description copied from interface:VitamClientFactoryInterface
Change the server resourcePath to use. Only in JUNIT- Specified by:
changeResourcePath
in interfaceVitamClientFactoryInterface<T extends MockOrRestClient>
-
changeServerPort
public void changeServerPort(int port)
Description copied from interface:VitamClientFactoryInterface
Change the server port to use. Only in JUNIT- Specified by:
changeServerPort
in interfaceVitamClientFactoryInterface<T extends MockOrRestClient>
-
getVitamClientType
public VitamClientFactoryInterface.VitamClientType getVitamClientType()
- Specified by:
getVitamClientType
in interfaceVitamClientFactoryInterface<T extends MockOrRestClient>
- Returns:
- the current
VitamClientFactoryInterface.VitamClientType
-
setVitamClientType
public VitamClientFactory<T> setVitamClientType(VitamClientFactoryInterface.VitamClientType vitamClientType)
- Specified by:
setVitamClientType
in 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:VitamClientFactoryInterface
Reset the client into the Client pool if possible- Specified by:
resume
in interfaceVitamClientFactoryInterface<T extends MockOrRestClient>
-
getHttpClient
public javax.ws.rs.client.Client getHttpClient()
Description copied from interface:VitamClientFactoryInterface
Get the internal Http client- Specified by:
getHttpClient
in interfaceVitamClientFactoryInterface<T extends MockOrRestClient>
- Returns:
- the client
-
getHttpClient
public javax.ws.rs.client.Client getHttpClient(boolean useChunkedMode)
Description copied from interface:VitamClientFactoryInterface
Get the internal Http client according to the chunk mode- Specified by:
getHttpClient
in interfaceVitamClientFactoryInterface<T extends MockOrRestClient>
- Returns:
- the client
-
getResourcePath
public java.lang.String getResourcePath()
Description copied from interface:VitamClientFactoryInterface
Get the resource path of the server.- Specified by:
getResourcePath
in interfaceVitamClientFactoryInterface<T extends MockOrRestClient>
- Returns:
- the resource path as string
-
getServiceUrl
public java.lang.String getServiceUrl()
Description copied from interface:VitamClientFactoryInterface
Get the service URL- Specified by:
getServiceUrl
in interfaceVitamClientFactoryInterface<T extends MockOrRestClient>
- Returns:
- the service URL
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getClientConfiguration
public final ClientConfiguration getClientConfiguration()
- Specified by:
getClientConfiguration
in interfaceVitamClientFactoryInterface<T extends MockOrRestClient>
- Returns:
- the Vitam client configuration
-
getDefaultConfigCient
public final java.util.Map<VitamRestEasyConfiguration,java.lang.Object> getDefaultConfigCient()
- Specified by:
getDefaultConfigCient
in interfaceVitamClientFactoryInterface<T extends MockOrRestClient>
- Returns:
- the Default Client configuration (Chunked Mode)
-
getDefaultConfigCient
public final java.util.Map<VitamRestEasyConfiguration,java.lang.Object> getDefaultConfigCient(boolean chunkedMode)
- Specified by:
getDefaultConfigCient
in 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:
shutdown
in interfaceVitamClientFactoryInterface<T extends MockOrRestClient>
-
resetConnections
public static void resetConnections()
Closes any pending connection.
-
-