Package eu.clarin.sru.client
Class SRUDefaultHandlerAdapter
- java.lang.Object
-
- eu.clarin.sru.client.SRUDefaultHandlerAdapter
-
- All Implemented Interfaces:
SRUDefaultHandler
,SRUExplainHandler
,SRUScanHandler
,SRUSearchRetrieveHandler
public class SRUDefaultHandlerAdapter extends Object implements SRUDefaultHandler
Default base class for SRU client response handlers.This class is available as a convenience base class for SRU client applications: it provides default implementations for all of the callbacks in the three request handler handler classes:
Application writers can extend this class when they need to implement only part of an interface; parser writers can instantiate this class to provide default handlers when the application has not supplied its own.
- See Also:
SRUExplainHandler
,SRUScanHandler
,SRUSearchRetrieveHandler
-
-
Constructor Summary
Constructors Constructor Description SRUDefaultHandlerAdapter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
onDiagnostics(List<SRUDiagnostic> diagnostics)
Receive notification of diagnostics.void
onExtraRecordData(String identifier, int position, XMLStreamReader reader)
Receive notification of extra record data.void
onExtraResponseData(XMLStreamReader reader)
Receive notification of extra response data.void
onExtraTermData(String value, XMLStreamReader reader)
Receive notification of extra term data.void
onFinishRecords(int nextRecordPosition)
Receive notifications of the end of the enumeration of records in the response.void
onFinishTerms()
Receive notifications of the end of the enumeration of terms in the response.void
onRecord(String identifier, int position, SRURecordData data)
Receive notification of a record in the result set.void
onRequestStatistics(int bytes, long millisTotal, long millisNetwork, long millisParsing)
Receive notification of request statistics.void
onStartRecords(int numberOfRecords, String resultSetId, int resultSetIdleTime)
Receive notifications of the start of the enumeration of records in the response.void
onStartTerms()
Receive notifications of the start of the enumeration of terms in the response.void
onSurrogateRecord(String identifier, int position, SRUDiagnostic data)
Receive notification of a surrogate record in the result set.void
onTerm(String value, int numberOfRecords, String displayTerm, SRUWhereInList whereInList)
Receive notification of a term.
-
-
-
Method Detail
-
onDiagnostics
public void onDiagnostics(List<SRUDiagnostic> diagnostics) throws SRUClientException
Description copied from interface:SRUExplainHandler
Receive notification of diagnostics.- Specified by:
onDiagnostics
in interfaceSRUExplainHandler
- Specified by:
onDiagnostics
in interfaceSRUScanHandler
- Specified by:
onDiagnostics
in interfaceSRUSearchRetrieveHandler
- Parameters:
diagnostics
- a list ofSRUDiagnostic
- Throws:
SRUClientException
- any SRU exception, possibly wrapping another exception- See Also:
SRUDiagnostic
-
onRequestStatistics
public void onRequestStatistics(int bytes, long millisTotal, long millisNetwork, long millisParsing)
Description copied from interface:SRUExplainHandler
Receive notification of request statistics.- Specified by:
onRequestStatistics
in interfaceSRUExplainHandler
- Specified by:
onRequestStatistics
in interfaceSRUScanHandler
- Specified by:
onRequestStatistics
in interfaceSRUSearchRetrieveHandler
- Parameters:
bytes
- the total number of bytes transferred while receiving the responsemillisTotal
- the total time spend processing the requestmillisNetwork
- the time spend performing network operationsmillisParsing
- the time spend processing the response
-
onExtraResponseData
public void onExtraResponseData(XMLStreamReader reader) throws XMLStreamException, SRUClientException
Description copied from interface:SRUExplainHandler
Receive notification of extra response data.- Specified by:
onExtraResponseData
in interfaceSRUExplainHandler
- Specified by:
onExtraResponseData
in interfaceSRUScanHandler
- Specified by:
onExtraResponseData
in interfaceSRUSearchRetrieveHandler
- Parameters:
reader
- aXMLStreamReader
to parse the extra response data- Throws:
XMLStreamException
- an error occurred while parsing the responseSRUClientException
- any SRU exception, possibly wrapping another exception- See Also:
- SRU Extra Data / Extensions
-
onStartTerms
public void onStartTerms() throws SRUClientException
Description copied from interface:SRUScanHandler
Receive notifications of the start of the enumeration of terms in the response.- Specified by:
onStartTerms
in interfaceSRUScanHandler
- Throws:
SRUClientException
- any SRU exception, possibly wrapping another exception
-
onFinishTerms
public void onFinishTerms() throws SRUClientException
Description copied from interface:SRUScanHandler
Receive notifications of the end of the enumeration of terms in the response.- Specified by:
onFinishTerms
in interfaceSRUScanHandler
- Throws:
SRUClientException
- any SRU exception, possibly wrapping another exception
-
onTerm
public void onTerm(String value, int numberOfRecords, String displayTerm, SRUWhereInList whereInList) throws SRUClientException
Description copied from interface:SRUScanHandler
Receive notification of a term.- Specified by:
onTerm
in interfaceSRUScanHandler
- Parameters:
value
- the term (exactly) as it appears in the indexnumberOfRecords
- the number of records for the current term which would be matcheddisplayTerm
- a string for the current term to display to the end user in place of the term itself ornull
if not availablewhereInList
- a flag to indicate the position of the term within the complete term list ornull
of not available- Throws:
SRUClientException
- any SRU exception, possibly wrapping another exception
-
onExtraTermData
public void onExtraTermData(String value, XMLStreamReader reader) throws XMLStreamException, SRUClientException
Description copied from interface:SRUScanHandler
Receive notification of extra term data.- Specified by:
onExtraTermData
in interfaceSRUScanHandler
- Parameters:
value
- the term (exactly) as it appears in the indexreader
- aXMLStreamReader
to parse the extra term data- Throws:
XMLStreamException
- an error occurred while parsing the responseSRUClientException
- any SRU exception, possibly wrapping another exception
-
onStartRecords
public void onStartRecords(int numberOfRecords, String resultSetId, int resultSetIdleTime) throws SRUClientException
Description copied from interface:SRUExplainHandler
Receive notifications of the start of the enumeration of records in the response.- Specified by:
onStartRecords
in interfaceSRUExplainHandler
- Specified by:
onStartRecords
in interfaceSRUSearchRetrieveHandler
- Parameters:
numberOfRecords
- the number of records or-1
if not availableresultSetId
- the result set id ornull
if not availableresultSetIdleTime
- the result set idle time or-1
if not available- Throws:
SRUClientException
- any SRU exception, possibly wrapping another exception
-
onFinishRecords
public void onFinishRecords(int nextRecordPosition) throws SRUClientException
Description copied from interface:SRUExplainHandler
Receive notifications of the end of the enumeration of records in the response.- Specified by:
onFinishRecords
in interfaceSRUExplainHandler
- Specified by:
onFinishRecords
in interfaceSRUSearchRetrieveHandler
- Parameters:
nextRecordPosition
- the next record position or-1
if not available- Throws:
SRUClientException
- any SRU exception, possibly wrapping another exception
-
onRecord
public void onRecord(String identifier, int position, SRURecordData data) throws SRUClientException
Description copied from interface:SRUExplainHandler
Receive notification of a record in the result set.- Specified by:
onRecord
in interfaceSRUExplainHandler
- Specified by:
onRecord
in interfaceSRUSearchRetrieveHandler
- Parameters:
identifier
- identifier of the record ornull
if not availableposition
- position of the record in the result set or-1
if not availabledata
- the parsed record data- Throws:
SRUClientException
- any SRU exception, possibly wrapping another exception- See Also:
SRURecordData
,SRURecordDataParser
-
onSurrogateRecord
public void onSurrogateRecord(String identifier, int position, SRUDiagnostic data) throws SRUClientException
Description copied from interface:SRUSearchRetrieveHandler
Receive notification of a surrogate record in the result set.- Specified by:
onSurrogateRecord
in interfaceSRUSearchRetrieveHandler
- Parameters:
identifier
- identifier of the record ornull
if not availableposition
- position of the record in the result set or-1
if not availabledata
- the surrogate record data, i.e. a diagnostic- Throws:
SRUClientException
- any SRU exception, possibly wrapping another exception- See Also:
SRUDiagnostic
-
onExtraRecordData
public void onExtraRecordData(String identifier, int position, XMLStreamReader reader) throws XMLStreamException, SRUClientException
Description copied from interface:SRUExplainHandler
Receive notification of extra record data.- Specified by:
onExtraRecordData
in interfaceSRUExplainHandler
- Specified by:
onExtraRecordData
in interfaceSRUSearchRetrieveHandler
- Parameters:
identifier
- identifier of the record ornull
if not availableposition
- position of the record in the result set or-1
if not availablereader
- aXMLStreamReader
to parse the extra term data- Throws:
XMLStreamException
- an error occurred while parsing the responseSRUClientException
- any SRU exception, possibly wrapping another exception
-
-