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 createSRUClientConfig
instances.- See Also:
SRUClientConfig
-
-
Constructor Summary
Constructors Constructor Description Builder()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SRUClientConfig.Builder
addExtraResponseDataParser(SRUExtraResponseDataParser parser)
Add an extra response data parser instance to the list of extra response data parsersSRUClientConfig.Builder
addRecordDataParser(SRURecordDataParser parser)
Add a record data parser instance to the list of record data parsersSRUClientConfig
build()
Create a configuration instance object for configuring SRU clientsSRUClientConfig.Builder
setConnectTimeout(int connectTimeout)
Set the timeout in milliseconds until a connection is established.SRUClientConfig.Builder
setCustomizedHttpClient(org.apache.http.impl.client.CloseableHttpClient httpClient)
Set a customized HTTP client which is to be used.SRUClientConfig.Builder
setDefaultVersion(SRUVersion defaultVersion)
Set the default SRU version to be used.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.SRUClientConfig.Builder
setRequestAuthenticator(SRURequestAuthenticator requestAuthenticator)
SRUClientConfig.Builder
setSocketTimeout(int socketTimeout)
Set the socket timeout (SO_TIMEOUT
) in milliseconds, which is the timeout for waiting for data.SRUClientConfig.Builder
setThreadCount(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.Builder
instance - 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
0
is interpreted as an infinite timeout;-1
is interpreted as system default.- Parameters:
connectTimeout
- the timeout in milliseconds- Returns:
- this
SRUClientConfig.Builder
instance
-
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
0
is interpreted as an infinite timeout;-1
is interpreted as system default.- Parameters:
socketTimeout
- the socket timeout in milliseconds- Returns:
- this
SRUClientConfig.Builder
instance
-
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.Builder
instance
-
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.Builder
instance
-
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.Builder
instance
-
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.Builder
instance - 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.Builder
instance - 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
-
-