Package eu.clarin.sru.client
Class SRUSearchRetrieveRequest
- java.lang.Object
-
- eu.clarin.sru.client.SRUSearchRetrieveRequest
-
public class SRUSearchRetrieveRequest extends Object
An object for performing a searchRetrieve operation.The following argument arguments are mandatory:
- query
- queryType, if using query language other than CQL (only SRU 2.0)
-
-
Field Summary
Fields Modifier and Type Field Description protected URI
baseURI
The baseURI of the SRU server.protected Map<String,String>
extraRequestData
A map of extra request data parameters.static String
MALFORMED_OMIT
for end-point conformance testing only.protected static String
OP_EXPLAIN
protected static String
OP_SCAN
protected static String
OP_SEARCH_RETRIEVE
protected static String
PARAM_EXTENSION_PREFIX
protected static String
PARAM_HTTP_ACCEPT
protected static String
PARAM_MAXIMUM_RECORDS
protected static String
PARAM_MAXIMUM_TERMS
protected static String
PARAM_OPERATION
protected static String
PARAM_QUERY
protected static String
PARAM_QUERY_TYPE
protected static String
PARAM_RECORD_PACKING
protected static String
PARAM_RECORD_SCHEMA
protected static String
PARAM_RECORD_X_PATH
protected static String
PARAM_RECORD_XML_ESCAPING
protected static String
PARAM_RENDER_BY
protected static String
PARAM_RESPONSE_POSITION
protected static String
PARAM_RESPONSE_TYPE
protected static String
PARAM_RESULT_SET_TTL
protected static String
PARAM_SCAN_CLAUSE
protected static String
PARAM_SORT_KEYS
protected static String
PARAM_START_RECORD
protected static String
PARAM_STYLESHEET
protected static String
PARAM_VERSION
protected static String
RECORD_PACKING_PACKED
protected static String
RECORD_PACKING_UNPACKED
protected static String
RECORD_XML_ESCAPING_XML
protected static String
RECORD_XML_ESCPAING_STRING
protected static String
RENDER_BY_CLIENT
protected static String
RENDER_BY_SERVER
protected SRUVersion
version
The version to be used for this request.protected static String
VERSION_1_1
protected static String
VERSION_1_2
static String
X_MALFORMED_MAXIMUM_RECORDS
for end-point conformance testing only.static String
X_MALFORMED_OPERATION
for end-point conformance testing only.static String
X_MALFORMED_QUERY
for end-point conformance testing only.static String
X_MALFORMED_RECORD_XML_ESCAPING
for end-point conformance testing only.static String
X_MALFORMED_START_RECORD
for end-point conformance testing only.static String
X_MALFORMED_VERSION
for end-point conformance testing only.
-
Constructor Summary
Constructors Constructor Description SRUSearchRetrieveRequest(String baseURI)
Constructor.SRUSearchRetrieveRequest(URI baseURI)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description URI
getBaseURI()
Get the baseURI of the SRU server.String
getExtraRequestData(String name)
Set the value of extra request parameter for this request.int
getMaximumRecords()
Get the value of the maximumRecords argument for this request.SRUOperation
getOperation()
Note: this method is not a part of public API.String
getQuery()
Get the value of the query argument for this request.String
getQueryType()
(SRU 2.0) Get the value of the queryType argument for this request.SRURecordPacking
getRecordPacking()
Get the recordPacking (SRU 2.0) parameter of this request.String
getRecordSchema()
Get the value of the recordSchema argument for this request.SRURecordXmlEscaping
getRecordXmlEscaping()
Get the recordXmlEscpaing (SRU 2.0) or recordPacking (SRU 1.1 and SRU 1.2) parameter of this request.URI
getRequestedURI()
Get the URI that was used to perform the request.SRUVersion
getRequestedVersion()
Get the version that was used to carry out this request.int
getResultSetTTL()
Get the value of the resultSetTTL argument for this request.int
getStartRecord()
Get the value of the startRecord argument for this request.SRUVersion
getVersion()
Get the version for this request.boolean
isStrictMode()
Get the SRU protocol conformance mode for this requestprotected URI
makeURI(SRUVersion defaultVersion)
void
setExtraRequestData(String name, String value)
Set an extra request parameter for this request.void
setMaximumRecords(int maximumRecords)
Set the value of the maximumRecords argument for this request.void
setQuery(String queryType, String query)
Set the value of the queryType (SRU 2.0) and the query argument for this request.void
setRecordPacking(SRURecordPacking recordPacking)
Set the recordPacking (SRU 2.0) parameter of this request.void
setRecordSchema(String recordSchema)
Set the value of the recordSchema argument for this request.void
setRecordXmlEscaping(SRURecordXmlEscaping recordXmlEscaping)
Set the recordXmlEscpaing (SRU 2.0) or recordPacking (SRU 1.1 and SRU 1.2) parameter of this request.void
setResultSetTTL(int resultSetTTL)
Set the value of the resultSetTTL argument for this request.void
setStartRecord(int startRecord)
Set the value of the startRecord argument for this request.void
setStrictMode(boolean strictMode)
Set the SRU protocol conformance mode for this requestvoid
setVersion(SRUVersion version)
Set the version for this request.
-
-
-
Field Detail
-
X_MALFORMED_QUERY
public static final String X_MALFORMED_QUERY
for end-point conformance testing only. never use in production.- See Also:
- Constant Field Values
-
X_MALFORMED_START_RECORD
public static final String X_MALFORMED_START_RECORD
for end-point conformance testing only. never use in production.- See Also:
- Constant Field Values
-
X_MALFORMED_MAXIMUM_RECORDS
public static final String X_MALFORMED_MAXIMUM_RECORDS
for end-point conformance testing only. never use in production.- See Also:
- Constant Field Values
-
X_MALFORMED_RECORD_XML_ESCAPING
public static final String X_MALFORMED_RECORD_XML_ESCAPING
for end-point conformance testing only. never use in production.- See Also:
- Constant Field Values
-
PARAM_OPERATION
protected static final String PARAM_OPERATION
- See Also:
- Constant Field Values
-
PARAM_VERSION
protected static final String PARAM_VERSION
- See Also:
- Constant Field Values
-
PARAM_STYLESHEET
protected static final String PARAM_STYLESHEET
- See Also:
- Constant Field Values
-
PARAM_RENDER_BY
protected static final String PARAM_RENDER_BY
- See Also:
- Constant Field Values
-
PARAM_HTTP_ACCEPT
protected static final String PARAM_HTTP_ACCEPT
- See Also:
- Constant Field Values
-
PARAM_RESPONSE_TYPE
protected static final String PARAM_RESPONSE_TYPE
- See Also:
- Constant Field Values
-
PARAM_QUERY
protected static final String PARAM_QUERY
- See Also:
- Constant Field Values
-
PARAM_QUERY_TYPE
protected static final String PARAM_QUERY_TYPE
- See Also:
- Constant Field Values
-
PARAM_START_RECORD
protected static final String PARAM_START_RECORD
- See Also:
- Constant Field Values
-
PARAM_MAXIMUM_RECORDS
protected static final String PARAM_MAXIMUM_RECORDS
- See Also:
- Constant Field Values
-
PARAM_RECORD_XML_ESCAPING
protected static final String PARAM_RECORD_XML_ESCAPING
- See Also:
- Constant Field Values
-
PARAM_RECORD_PACKING
protected static final String PARAM_RECORD_PACKING
- See Also:
- Constant Field Values
-
PARAM_RECORD_SCHEMA
protected static final String PARAM_RECORD_SCHEMA
- See Also:
- Constant Field Values
-
PARAM_RECORD_X_PATH
protected static final String PARAM_RECORD_X_PATH
- See Also:
- Constant Field Values
-
PARAM_RESULT_SET_TTL
protected static final String PARAM_RESULT_SET_TTL
- See Also:
- Constant Field Values
-
PARAM_SORT_KEYS
protected static final String PARAM_SORT_KEYS
- See Also:
- Constant Field Values
-
PARAM_SCAN_CLAUSE
protected static final String PARAM_SCAN_CLAUSE
- See Also:
- Constant Field Values
-
PARAM_RESPONSE_POSITION
protected static final String PARAM_RESPONSE_POSITION
- See Also:
- Constant Field Values
-
PARAM_MAXIMUM_TERMS
protected static final String PARAM_MAXIMUM_TERMS
- See Also:
- Constant Field Values
-
OP_EXPLAIN
protected static final String OP_EXPLAIN
- See Also:
- Constant Field Values
-
OP_SCAN
protected static final String OP_SCAN
- See Also:
- Constant Field Values
-
OP_SEARCH_RETRIEVE
protected static final String OP_SEARCH_RETRIEVE
- See Also:
- Constant Field Values
-
VERSION_1_1
protected static final String VERSION_1_1
- See Also:
- Constant Field Values
-
VERSION_1_2
protected static final String VERSION_1_2
- See Also:
- Constant Field Values
-
RECORD_XML_ESCAPING_XML
protected static final String RECORD_XML_ESCAPING_XML
- See Also:
- Constant Field Values
-
RECORD_XML_ESCPAING_STRING
protected static final String RECORD_XML_ESCPAING_STRING
- See Also:
- Constant Field Values
-
RECORD_PACKING_PACKED
protected static final String RECORD_PACKING_PACKED
- See Also:
- Constant Field Values
-
RECORD_PACKING_UNPACKED
protected static final String RECORD_PACKING_UNPACKED
- See Also:
- Constant Field Values
-
RENDER_BY_CLIENT
protected static final String RENDER_BY_CLIENT
- See Also:
- Constant Field Values
-
RENDER_BY_SERVER
protected static final String RENDER_BY_SERVER
- See Also:
- Constant Field Values
-
PARAM_EXTENSION_PREFIX
protected static final String PARAM_EXTENSION_PREFIX
- See Also:
- Constant Field Values
-
X_MALFORMED_OPERATION
public static final String X_MALFORMED_OPERATION
for end-point conformance testing only. never use in production.- See Also:
- Constant Field Values
-
X_MALFORMED_VERSION
public static final String X_MALFORMED_VERSION
for end-point conformance testing only. never use in production.- See Also:
- Constant Field Values
-
MALFORMED_OMIT
public static final String MALFORMED_OMIT
for end-point conformance testing only. never use in production.- See Also:
- Constant Field Values
-
baseURI
protected final URI baseURI
The baseURI of the SRU server.
-
version
protected SRUVersion version
The version to be used for this request.
-
-
Method Detail
-
getQueryType
public String getQueryType()
(SRU 2.0) Get the value of the queryType argument for this request.- Returns:
- the value for the queryType argument or
null
of none was set
-
getQuery
public String getQuery()
Get the value of the query argument for this request.- Returns:
- the value for the query argument or
null
of none was set
-
setQuery
public void setQuery(String queryType, String query)
Set the value of the queryType (SRU 2.0) and the query argument for this request.For SRU 1.1 and SRU 1.2 requests use the following:
String cql_query = ... SRUSearchRetrieveRequest req = new SRUSearchRetrieveRequest("http://endpoint.example.org"); req.setQuery(SRUClientConstants.QUERY_TYPE_CQL, cql_query);
- Parameters:
queryType
- the value for the queryType argumentquery
- the value for the query argument- Throws:
NullPointerException
- if any required argument isnull
IllegalArgumentException
- if any argument is invalid- See Also:
SRUClientConstants.QUERY_TYPE_CQL
-
getStartRecord
public int getStartRecord()
Get the value of the startRecord argument for this request.- Returns:
- the value for the startRecord argument or
-1
of none was set
-
setStartRecord
public void setStartRecord(int startRecord)
Set the value of the startRecord argument for this request.- Parameters:
startRecord
- the value for the startRecord argument- Throws:
IllegalArgumentException
- if any argument is invalid
-
getMaximumRecords
public int getMaximumRecords()
Get the value of the maximumRecords argument for this request.- Returns:
- the value for the maximumRecords argument or
-1
of none was set
-
setMaximumRecords
public void setMaximumRecords(int maximumRecords)
Set the value of the maximumRecords argument for this request.- Parameters:
maximumRecords
- the value for the maximumRecords argument- Throws:
IllegalArgumentException
- if any argument is invalid
-
getRecordSchema
public String getRecordSchema()
Get the value of the recordSchema argument for this request.- Returns:
- the value for the recordSchema argument or
null
of none was set
-
setRecordSchema
public void setRecordSchema(String recordSchema)
Set the value of the recordSchema argument for this request.- Parameters:
recordSchema
- the value for the recordSchema argument- Throws:
NullPointerException
- if any required argument isnull
IllegalArgumentException
- if any argument is invalid
-
getRecordXmlEscaping
public SRURecordXmlEscaping getRecordXmlEscaping()
Get the recordXmlEscpaing (SRU 2.0) or recordPacking (SRU 1.1 and SRU 1.2) parameter of this request.- Returns:
- the requested record XML escaping
- See Also:
SRURecordXmlEscaping
-
setRecordXmlEscaping
public void setRecordXmlEscaping(SRURecordXmlEscaping recordXmlEscaping)
Set the recordXmlEscpaing (SRU 2.0) or recordPacking (SRU 1.1 and SRU 1.2) parameter of this request.- Parameters:
recordXmlEscaping
- the requested record XML escaping- See Also:
SRURecordXmlEscaping
-
getRecordPacking
public SRURecordPacking getRecordPacking()
Get the recordPacking (SRU 2.0) parameter of this request.- Returns:
- the requested record packing
- See Also:
SRURecordPacking
-
setRecordPacking
public void setRecordPacking(SRURecordPacking recordPacking)
Set the recordPacking (SRU 2.0) parameter of this request.- Parameters:
recordPacking
- the requested recordPacking mode- See Also:
SRURecordXmlEscaping
-
getResultSetTTL
public int getResultSetTTL()
Get the value of the resultSetTTL argument for this request.- Returns:
- the value for the resultSetTTL argument or
-1
of none was set
-
setResultSetTTL
public void setResultSetTTL(int resultSetTTL)
Set the value of the resultSetTTL argument for this request.- Parameters:
resultSetTTL
- the value for the resultSetTTL argument- Throws:
IllegalArgumentException
- if any argument is invalid
-
getOperation
public SRUOperation getOperation()
Note: this method is not a part of public API.- Returns:
- a operation constant for this request
-
getBaseURI
public URI getBaseURI()
Get the baseURI of the SRU server.- Returns:
- the baseURI of the SRU server
-
isStrictMode
public boolean isStrictMode()
Get the SRU protocol conformance mode for this request- Returns:
true
if the request will be performed in strict mode,false
if the request will be performed in a more tolerant mode
-
setStrictMode
public void setStrictMode(boolean strictMode)
Set the SRU protocol conformance mode for this request- Parameters:
strictMode
-true
if the request should be performed in strict mode,false
if the request should be performed client should in a more tolerant mode
-
setVersion
public void setVersion(SRUVersion version)
Set the version for this request.- Parameters:
version
- a version ofnull
for client default
-
getVersion
public SRUVersion getVersion()
Get the version for this request.- Returns:
- version for this request or
null
if client default is used
-
setExtraRequestData
public void setExtraRequestData(String name, String value)
Set an extra request parameter for this request.- Parameters:
name
- the name for the extra request data parametervalue
- the value for the extra request data parameter- Throws:
NullPointerException
- if any required argument isnull
IllegalArgumentException
- if any argument is invalid- See Also:
- SRU Extra Data / Extensions
-
getExtraRequestData
public String getExtraRequestData(String name)
Set the value of extra request parameter for this request.- Parameters:
name
- the name for the extra request data parameter- Returns:
- the value for the extra request data parameter or
null
if parameter was not set - Throws:
NullPointerException
- if any required argument isnull
IllegalArgumentException
- if any argument is invalid- See Also:
- SRU Extra Data / Extensions
-
getRequestedURI
public final URI getRequestedURI()
Get the URI that was used to perform the request. This method may only be called after the request was carried out, otherwise it will throw anIllegalStateException
.- Returns:
- the URI that was used to carry out this request
- Throws:
IllegalStateException
- if the request was not yet carried out
-
getRequestedVersion
public final SRUVersion getRequestedVersion()
Get the version that was used to carry out this request. This method may only be called after the request was carried out, otherwise it will throw anIllegalStateException
.- Returns:
- the version that was used to carry out this request
- Throws:
IllegalStateException
- if the request was not yet carried out
-
makeURI
protected final URI makeURI(SRUVersion defaultVersion) throws SRUClientException
- Throws:
SRUClientException
-
-