Package fr.gouv.vitam.common.client
Class VitamClientFactory<T extends MockOrRestClient>
java.lang.Object
fr.gouv.vitam.common.client.VitamClientFactory<T>
- Type Parameters:
T
- MockOrRestClient class
- All Implemented Interfaces:
VitamClientFactoryInterface<T>
- Direct Known Subclasses:
AccessInternalClientFactory
,AdminManagementClientFactory
,BatchReportClientFactory
,CollectInternalClientFactory
,IhmRecetteClientFactory
,IngestInternalClientFactory
,InternalSecurityClientFactory
,LogbookLifeCyclesClientFactory
,LogbookOperationsClientFactory
,MetaDataClientFactory
,ProcessingManagementClientFactory
,SchedulerClientFactory
,SiegfriedClientFactory
,StorageClientFactory
,TestVitamClientFactory
,WorkerClientFactory
,WorkspaceClientFactory
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
-
Constructor Summary
ModifierConstructorDescriptionprotected
VitamClientFactory
(ClientConfiguration configuration, String resourcePath) Constructor with standard configurationprotected
VitamClientFactory
(ClientConfiguration configuration, String resourcePath, boolean cacheable) Constructor with standard configurationprotected
VitamClientFactory
(ClientConfiguration configuration, String resourcePath, boolean chunkedMode, boolean cacheable) Constructor to allow to enable Multipart support or Chunked mode.protected
VitamClientFactory
(ClientConfiguration configuration, String resourcePath, javax.ws.rs.client.Client client) -
Method Summary
Modifier and TypeMethodDescriptionvoid
changeResourcePath
(String resourcePath) Change the server resourcePath to use.void
changeServerPort
(int port) Change the server port to use.protected void
protected void
final ClientConfiguration
final Map<VitamRestEasyConfiguration,
Object> final Map<VitamRestEasyConfiguration,
Object> getDefaultConfigCient
(boolean chunkedMode) javax.ws.rs.client.Client
Get the internal Http clientjavax.ws.rs.client.Client
getHttpClient
(boolean useChunkedMode) Get the internal Http client according to the chunk modeGet the resource path of the server.Get the service URLprotected final void
initialisation
(ClientConfiguration configuration, String resourcePath) Initialize default resource path, service Url, pool manager, ssl configuration and the VitamApacheHttpClient for RestEasyprotected boolean
protected boolean
static void
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 clientsetVitamClientType
(VitamClientFactoryInterface.VitamClientType vitamClientType) void
shutdown()
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, wait
Methods 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 cacheable) 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, boolean cacheable) Constructor to allow to enable Multipart support or Chunked mode.- Parameters:
configuration
- The client configurationresourcePath
- the resource path of the server for the client callschunkedMode
- one can managed here if the client is in default chunkedMode or not- 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
-
disableUseAuthorizationFilter
protected void disableUseAuthorizationFilter() -
enableUseAuthorizationFilter
protected void enableUseAuthorizationFilter() -
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: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
- 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
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
Description copied from interface:VitamClientFactoryInterface
Get the service URL- Specified by:
getServiceUrl
in interfaceVitamClientFactoryInterface<T extends MockOrRestClient>
- Returns:
- the service URL
-
toString
-
getClientConfiguration
- Specified by:
getClientConfiguration
in interfaceVitamClientFactoryInterface<T extends MockOrRestClient>
- Returns:
- the Vitam client configuration
-
getDefaultConfigCient
- Specified by:
getDefaultConfigCient
in interfaceVitamClientFactoryInterface<T extends MockOrRestClient>
- Returns:
- the Default Client configuration (Chunked Mode)
-
getDefaultConfigCient
- 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. -
getVitamThreadPoolExecutor
- Returns:
- the VitamThreadPoolExecutor used by the server
-