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 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 ClientConfigurationclientConfiguration
-
Constructor Summary
Constructors Modifier Constructor Description protectedVitamClientFactory(ClientConfiguration configuration, java.lang.String resourcePath)Constructor with standard configurationprotectedVitamClientFactory(ClientConfiguration configuration, java.lang.String resourcePath, boolean cacheable)Constructor with standard configurationprotectedVitamClientFactory(ClientConfiguration configuration, java.lang.String resourcePath, boolean chunkedMode, boolean cacheable)Constructor to allow to enable Multipart support or Chunked mode.protectedVitamClientFactory(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 voidchangeResourcePath(java.lang.String resourcePath)Change the server resourcePath to use.voidchangeServerPort(int port)Change the server port to use.protected voiddisableUseAuthorizationFilter()protected voidenableUseAuthorizationFilter()ClientConfigurationgetClientConfiguration()java.util.Map<VitamRestEasyConfiguration,java.lang.Object>getDefaultConfigCient()java.util.Map<VitamRestEasyConfiguration,java.lang.Object>getDefaultConfigCient(boolean chunkedMode)javax.ws.rs.client.ClientgetHttpClient()Get the internal Http clientjavax.ws.rs.client.ClientgetHttpClient(boolean useChunkedMode)Get the internal Http client according to the chunk modejava.lang.StringgetResourcePath()Get the resource path of the server.java.lang.StringgetServiceUrl()Get the service URLVitamClientFactoryInterface.VitamClientTypegetVitamClientType()VitamThreadPoolExecutorgetVitamThreadPoolExecutor()protected voidinitialisation(ClientConfiguration configuration, java.lang.String resourcePath)Initialize default resource path, service Url, pool manager, ssl configuration and the VitamApacheHttpClient for RestEasyprotected booleanisAllowGzipDecoded()protected booleanisAllowGzipEncoded()static voidresetConnections()Closes 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 clientVitamClientFactory<T>setVitamClientType(VitamClientFactoryInterface.VitamClientType vitamClientType)voidshutdown()Shutdown the global Connection Manager (cannot be restarted yet)java.lang.StringtoString()-
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 cacheable)
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, 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:
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
-
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
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: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
public VitamClientFactoryInterface.VitamClientType 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
public java.lang.String 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
public java.lang.String getServiceUrl()
Description copied from interface:VitamClientFactoryInterfaceGet the service URL- Specified by:
getServiceUrlin interfaceVitamClientFactoryInterface<T extends MockOrRestClient>- Returns:
- the service URL
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getClientConfiguration
public final ClientConfiguration getClientConfiguration()
- Specified by:
getClientConfigurationin interfaceVitamClientFactoryInterface<T extends MockOrRestClient>- Returns:
- the Vitam client configuration
-
getDefaultConfigCient
public final java.util.Map<VitamRestEasyConfiguration,java.lang.Object> getDefaultConfigCient()
- Specified by:
getDefaultConfigCientin 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:
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.
-
getVitamThreadPoolExecutor
public VitamThreadPoolExecutor getVitamThreadPoolExecutor()
- Returns:
- the VitamThreadPoolExecutor used by the server
-
-