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 voidonDiagnostics(List<SRUDiagnostic> diagnostics)Receive notification of diagnostics.voidonExtraRecordData(String identifier, int position, XMLStreamReader reader)Receive notification of extra record data.voidonExtraResponseData(XMLStreamReader reader)Receive notification of extra response data.voidonExtraTermData(String value, XMLStreamReader reader)Receive notification of extra term data.voidonFinishRecords(int nextRecordPosition)Receive notifications of the end of the enumeration of records in the response.voidonFinishTerms()Receive notifications of the end of the enumeration of terms in the response.voidonRecord(String identifier, int position, SRURecordData data)Receive notification of a record in the result set.voidonRequestStatistics(int bytes, long millisTotal, long millisNetwork, long millisParsing)Receive notification of request statistics.voidonStartRecords(int numberOfRecords, String resultSetId, int resultSetIdleTime)Receive notifications of the start of the enumeration of records in the response.voidonStartTerms()Receive notifications of the start of the enumeration of terms in the response.voidonSurrogateRecord(String identifier, int position, SRUDiagnostic data)Receive notification of a surrogate record in the result set.voidonTerm(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:SRUExplainHandlerReceive notification of diagnostics.- Specified by:
onDiagnosticsin interfaceSRUExplainHandler- Specified by:
onDiagnosticsin interfaceSRUScanHandler- Specified by:
onDiagnosticsin 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:SRUExplainHandlerReceive notification of request statistics.- Specified by:
onRequestStatisticsin interfaceSRUExplainHandler- Specified by:
onRequestStatisticsin interfaceSRUScanHandler- Specified by:
onRequestStatisticsin 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:SRUExplainHandlerReceive notification of extra response data.- Specified by:
onExtraResponseDatain interfaceSRUExplainHandler- Specified by:
onExtraResponseDatain interfaceSRUScanHandler- Specified by:
onExtraResponseDatain interfaceSRUSearchRetrieveHandler- Parameters:
reader- aXMLStreamReaderto 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 SRUClientExceptionDescription copied from interface:SRUScanHandlerReceive notifications of the start of the enumeration of terms in the response.- Specified by:
onStartTermsin interfaceSRUScanHandler- Throws:
SRUClientException- any SRU exception, possibly wrapping another exception
-
onFinishTerms
public void onFinishTerms() throws SRUClientExceptionDescription copied from interface:SRUScanHandlerReceive notifications of the end of the enumeration of terms in the response.- Specified by:
onFinishTermsin 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:SRUScanHandlerReceive notification of a term.- Specified by:
onTermin 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 ornullif not availablewhereInList- a flag to indicate the position of the term within the complete term list ornullof 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:SRUScanHandlerReceive notification of extra term data.- Specified by:
onExtraTermDatain interfaceSRUScanHandler- Parameters:
value- the term (exactly) as it appears in the indexreader- aXMLStreamReaderto 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 SRUClientExceptionDescription copied from interface:SRUExplainHandlerReceive notifications of the start of the enumeration of records in the response.- Specified by:
onStartRecordsin interfaceSRUExplainHandler- Specified by:
onStartRecordsin interfaceSRUSearchRetrieveHandler- Parameters:
numberOfRecords- the number of records or-1if not availableresultSetId- the result set id ornullif not availableresultSetIdleTime- the result set idle time or-1if not available- Throws:
SRUClientException- any SRU exception, possibly wrapping another exception
-
onFinishRecords
public void onFinishRecords(int nextRecordPosition) throws SRUClientExceptionDescription copied from interface:SRUExplainHandlerReceive notifications of the end of the enumeration of records in the response.- Specified by:
onFinishRecordsin interfaceSRUExplainHandler- Specified by:
onFinishRecordsin interfaceSRUSearchRetrieveHandler- Parameters:
nextRecordPosition- the next record position or-1if 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:SRUExplainHandlerReceive notification of a record in the result set.- Specified by:
onRecordin interfaceSRUExplainHandler- Specified by:
onRecordin interfaceSRUSearchRetrieveHandler- Parameters:
identifier- identifier of the record ornullif not availableposition- position of the record in the result set or-1if 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:SRUSearchRetrieveHandlerReceive notification of a surrogate record in the result set.- Specified by:
onSurrogateRecordin interfaceSRUSearchRetrieveHandler- Parameters:
identifier- identifier of the record ornullif not availableposition- position of the record in the result set or-1if 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:SRUExplainHandlerReceive notification of extra record data.- Specified by:
onExtraRecordDatain interfaceSRUExplainHandler- Specified by:
onExtraRecordDatain interfaceSRUSearchRetrieveHandler- Parameters:
identifier- identifier of the record ornullif not availableposition- position of the record in the result set or-1if not availablereader- aXMLStreamReaderto parse the extra term data- Throws:
XMLStreamException- an error occurred while parsing the responseSRUClientException- any SRU exception, possibly wrapping another exception
-
-