Package eu.clarin.sru.client
Class SRUClientConfig.Builder
- java.lang.Object
 - 
- eu.clarin.sru.client.SRUClientConfig.Builder
 
 
- 
- Enclosing class:
 - SRUClientConfig
 
public static class SRUClientConfig.Builder extends Object
A class that implements the builder pattern to createSRUClientConfiginstances.- See Also:
 SRUClientConfig
 
- 
- 
Constructor Summary
Constructors Constructor Description Builder()Constructor. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SRUClientConfig.BuilderaddExtraResponseDataParser(SRUExtraResponseDataParser parser)Add an extra response data parser instance to the list of extra response data parsersSRUClientConfig.BuilderaddRecordDataParser(SRURecordDataParser parser)Add a record data parser instance to the list of record data parsersSRUClientConfigbuild()Create a configuration instance object for configuring SRU clientsSRUClientConfig.BuildersetConnectTimeout(int connectTimeout)Set the timeout in milliseconds until a connection is established.SRUClientConfig.BuildersetCustomizedHttpClient(org.apache.http.impl.client.CloseableHttpClient httpClient)Set a customized HTTP client which is to be used.SRUClientConfig.BuildersetDefaultVersion(SRUVersion defaultVersion)Set the default SRU version to be used.SRUClientConfig.BuildersetHttpContext(org.apache.http.client.protocol.HttpClientContext httpContext)Optionally set the HTTP context which is to be used by the customized HTTP client.SRUClientConfig.BuildersetRequestAuthenticator(SRURequestAuthenticator requestAuthenticator)SRUClientConfig.BuildersetSocketTimeout(int socketTimeout)Set the socket timeout (SO_TIMEOUT) in milliseconds, which is the timeout for waiting for data.SRUClientConfig.BuildersetThreadCount(int threadCount)Set the number of worker threads. 
 - 
 
- 
- 
Method Detail
- 
setDefaultVersion
public SRUClientConfig.Builder setDefaultVersion(SRUVersion defaultVersion)
Set the default SRU version to be used.- Parameters:
 defaultVersion- the default SRU version to be used- Returns:
 - this 
SRUClientConfig.Builderinstance - Throws:
 NullPointerException- if a mandatory argument isnull
 
- 
setConnectTimeout
public SRUClientConfig.Builder setConnectTimeout(int connectTimeout)
Set the timeout in milliseconds until a connection is established.A timeout value of
0is interpreted as an infinite timeout;-1is interpreted as system default.- Parameters:
 connectTimeout- the timeout in milliseconds- Returns:
 - this 
SRUClientConfig.Builderinstance 
 
- 
setSocketTimeout
public SRUClientConfig.Builder setSocketTimeout(int socketTimeout)
Set the socket timeout (SO_TIMEOUT) in milliseconds, which is the timeout for waiting for data.A timeout value of
0is interpreted as an infinite timeout;-1is interpreted as system default.- Parameters:
 socketTimeout- the socket timeout in milliseconds- Returns:
 - this 
SRUClientConfig.Builderinstance 
 
- 
setCustomizedHttpClient
public SRUClientConfig.Builder setCustomizedHttpClient(org.apache.http.impl.client.CloseableHttpClient httpClient)
Set a customized HTTP client which is to be used.- Parameters:
 httpClient- a configured HTTP client instance- Returns:
 - this 
SRUClientConfig.Builderinstance 
 
- 
setHttpContext
public SRUClientConfig.Builder setHttpContext(org.apache.http.client.protocol.HttpClientContext httpContext)
Optionally set the HTTP context which is to be used by the customized HTTP client.- Parameters:
 httpContext- a HTTP context instance- Returns:
 - this 
SRUClientConfig.Builderinstance 
 
- 
setRequestAuthenticator
public SRUClientConfig.Builder setRequestAuthenticator(SRURequestAuthenticator requestAuthenticator)
 
- 
setThreadCount
public SRUClientConfig.Builder setThreadCount(int threadCount)
Set the number of worker threads. This value is only relevant for theSRUThreadedClient.- Parameters:
 threadCount- the number of worker threads- Returns:
 - this 
SRUClientConfig.Builderinstance 
 
- 
addRecordDataParser
public SRUClientConfig.Builder addRecordDataParser(SRURecordDataParser parser)
Add a record data parser instance to the list of record data parsers- Parameters:
 parser- the record data parser to be added- Returns:
 - this 
SRUClientConfig.Builderinstance - Throws:
 IllegalArgumentException- if registering of the parser fails- See Also:
 SRURecordDataParser
 
- 
addExtraResponseDataParser
public SRUClientConfig.Builder addExtraResponseDataParser(SRUExtraResponseDataParser parser)
Add an extra response data parser instance to the list of extra response data parsers- Parameters:
 parser- the extra response data parser to be added- Returns:
 - this 
SRUClientConfig.Builderinstance - Throws:
 IllegalArgumentException- if registering of the parser fails- See Also:
 SRUExtraResponseDataParser
 
- 
build
public SRUClientConfig build()
Create a configuration instance object for configuring SRU clients- Returns:
 - a immutable configuration instance
 
 
 - 
 
 -