Package eu.clarin.sru.client.fcs
Class ClarinFCSClientBuilder
- java.lang.Object
-
- eu.clarin.sru.client.fcs.ClarinFCSClientBuilder
-
public class ClarinFCSClientBuilder extends Object
A class that implements the builder pattern for creating SRU client instances that are configured to be used for CLARIN-FCS.
-
-
Constructor Summary
Constructors Constructor Description ClarinFCSClientBuilder()
Constructor.ClarinFCSClientBuilder(boolean unknownAsDom)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ClarinFCSClientBuilder
addDefaultDataViewParsers()
Add the recommended default set of data record view parsers.SRUClient
buildClient()
Create aSRUClient
instance.SRUSimpleClient
buildSimpleClient()
Create aSRUSimpleClient
instance.SRUThreadedClient
buildThreadedClient()
Create aSRUThreadedClient
instance.ClarinFCSClientBuilder
disableFullLegacyCompatMode()
Configure client to disable support for legacy CLARIN_FCS in full compatibility mode.ClarinFCSClientBuilder
disableLegacySupport()
Configure client to disable support for legacy CLARIN-FCS endpoints.ClarinFCSClientBuilder
enableFullLegacyCompatMode()
Configure client to support legacy CLARIN-FCS endpoints in full compatibility mode.ClarinFCSClientBuilder
enableLegacySupport()
Configure client to enable support for legacy CLARIN-FCS endpoints.int
getConnectTimeout()
Get the timeout in milliseconds until a connection is established.int
getSocketTimeout()
Get the socket timeout (SO_TIMEOUT
) in milliseconds, which is the timeout for waiting for data.ClarinFCSClientBuilder
registerDataViewParser(DataViewParser parser)
Register a Data View parser.ClarinFCSClientBuilder
registerExtraResponseDataParser(SRUExtraResponseDataParser parser)
Register an extra response data parser.ClarinFCSClientBuilder
setConnectTimeout(int connectTimeout)
Set the timeout in milliseconds until a connection is established.ClarinFCSClientBuilder
setDefaultSRUVersion(SRUVersion defaultVersion)
Set default SRU version to be used.ClarinFCSClientBuilder
setRequestAuthenticator(SRURequestAuthenticator requestAuthStrategy)
ClarinFCSClientBuilder
setSocketTimeout(int socketTimeout)
Set the socket timeout (SO_TIMEOUT
) in milliseconds, which is the timeout for waiting for data.ClarinFCSClientBuilder
unknownDataViewAsDOM()
Configure client to parse unknown Data Views into a DOM representation.ClarinFCSClientBuilder
unknownDataViewAsString()
Configure client to parse unknown Data Views into a String representation.
-
-
-
Method Detail
-
addDefaultDataViewParsers
public ClarinFCSClientBuilder addDefaultDataViewParsers()
Add the recommended default set of data record view parsers.- Returns:
- this
ClarinFCSClientBuilder
instance
-
unknownDataViewAsDOM
public ClarinFCSClientBuilder unknownDataViewAsDOM()
Configure client to parse unknown Data Views into a DOM representation.- Returns:
- this
ClarinFCSClientBuilder
instance - See Also:
DataViewParserGenericDOM
,DataViewGenericDOM
-
unknownDataViewAsString
public ClarinFCSClientBuilder unknownDataViewAsString()
Configure client to parse unknown Data Views into a String representation.- Returns:
- this
ClarinFCSClientBuilder
instance - See Also:
DataViewParserGenericString
,DataViewGenericString
-
setDefaultSRUVersion
public ClarinFCSClientBuilder setDefaultSRUVersion(SRUVersion defaultVersion)
Set default SRU version to be used.- Parameters:
defaultVersion
- the default SRU version to be used- Returns:
- this
ClarinFCSClientBuilder
instance
-
enableLegacySupport
public ClarinFCSClientBuilder enableLegacySupport()
Configure client to enable support for legacy CLARIN-FCS endpoints.- Returns:
- this
ClarinFCSClientBuilder
instance
-
disableLegacySupport
public ClarinFCSClientBuilder disableLegacySupport()
Configure client to disable support for legacy CLARIN-FCS endpoints.- Returns:
- this
ClarinFCSClientBuilder
instance
-
enableFullLegacyCompatMode
public ClarinFCSClientBuilder enableFullLegacyCompatMode()
Configure client to support legacy CLARIN-FCS endpoints in full compatibility mode. Automatically enables support for legacy CLARIN-FCS.
NB: This feature should not be used in production!- Returns:
- this
ClarinFCSClientBuilder
instance
-
disableFullLegacyCompatMode
public ClarinFCSClientBuilder disableFullLegacyCompatMode()
Configure client to disable support for legacy CLARIN_FCS in full compatibility mode.
NB: Support for legacy CLARIN-FCS will not be disabled automatically!- Returns:
- this
ClarinFCSClientBuilder
instance
-
getConnectTimeout
public int getConnectTimeout()
Get the timeout in milliseconds until a connection is established.- Returns:
- this connect timeout in milliseconds
-
setConnectTimeout
public ClarinFCSClientBuilder 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 connect timeout in milliseconds- Returns:
- this
ClarinFCSClientBuilder
instance
-
getSocketTimeout
public int getSocketTimeout()
Get the socket timeout (SO_TIMEOUT
) in milliseconds, which is the timeout for waiting for data.- Returns:
- socketTimeout the socket timeout in milliseconds
-
setSocketTimeout
public ClarinFCSClientBuilder 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
ClarinFCSClientBuilder
instance
-
setRequestAuthenticator
public ClarinFCSClientBuilder setRequestAuthenticator(SRURequestAuthenticator requestAuthStrategy)
-
registerDataViewParser
public ClarinFCSClientBuilder registerDataViewParser(DataViewParser parser)
Register a Data View parser.- Parameters:
parser
- the data view parser to be registered- Returns:
- this
ClarinFCSClientBuilder
instance - Throws:
IllegalArgumentException
- if an error occurred while registering the data view parser- See Also:
DataViewParser
-
registerExtraResponseDataParser
public ClarinFCSClientBuilder registerExtraResponseDataParser(SRUExtraResponseDataParser parser)
Register an extra response data parser.- Parameters:
parser
- the extra response data parser to be registered- Returns:
- this
ClarinFCSClientBuilder
instance - Throws:
IllegalArgumentException
- if an error occurred while registering the extra response data parser- See Also:
SRUExtraResponseDataParser
-
buildSimpleClient
public SRUSimpleClient buildSimpleClient()
Create aSRUSimpleClient
instance.- Returns:
- a configured
SRUSimpleClient
instance
-
buildClient
public SRUClient buildClient()
Create aSRUClient
instance.- Returns:
- a configured
SRUClient
instance
-
buildThreadedClient
public SRUThreadedClient buildThreadedClient()
Create aSRUThreadedClient
instance.- Returns:
- a configured
SRUThreadedClient
instance
-
-