source: SRUClient/trunk/src/main/java/eu/clarin/sru/client/SRUSearchRetrieveHandler.java @ 5750

Last change on this file since 5750 was 5750, checked in by Oliver Schonefeld, 10 years ago
  • update copyright
  • clean-up whitespace
  • Property svn:eol-style set to native
File size: 5.7 KB
Line 
1/**
2 * This software is copyright (c) 2012-2014 by
3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
4 * This is free software. You can redistribute it
5 * and/or modify it under the terms described in
6 * the GNU General Public License v3 of which you
7 * should have received a copy. Otherwise you can download
8 * it from
9 *
10 *   http://www.gnu.org/licenses/gpl-3.0.txt
11 *
12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
13 *
14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
15 *  GNU General Public License v3
16 */
17package eu.clarin.sru.client;
18
19import java.util.List;
20
21import javax.xml.stream.XMLStreamException;
22import javax.xml.stream.XMLStreamReader;
23
24
25/**
26 * Receive notifications to the response of a <em>searchRetrieve</em> request.
27 *
28 * @see SRUSearchRetrieveRequest
29 * @see <a href="http://www.loc.gov/standards/sru/specs/search-retrieve.html">
30 *      SRU SearchRetrieve Operation</a>
31 */
32public interface SRUSearchRetrieveHandler {
33
34    /**
35     * Receive notification of diagnostics.
36     *
37     * @param diagnostics
38     *            a list of {@link SRUDiagnostic}
39     * @throws SRUClientException
40     *             any SRU exception, possibly wrapping another exception
41     * @see SRUDiagnostic
42     */
43    public void onDiagnostics(List<SRUDiagnostic> diagnostics)
44            throws SRUClientException;
45
46
47    /**
48     * Receive notification of request statistics.
49     *
50     * @param totalBytesTransferred
51     *            the total number of bytes transferred while receiving the
52     *            response
53     * @param millisTotal
54     *            the total time spend processing the request
55     * @param millisNetwork
56     *            the time spend performing network operations
57     * @param millisProcessing
58     *            the time spend processing the response
59     */
60    public void onRequestStatistics(int totalBytesTransferred,
61            long millisTotal, long millisNetwork, long millisProcessing);
62
63
64    /**
65     * Receive notification of extra response data.
66     *
67     * @param reader
68     *            a {@link XMLStreamReader} to parse the extra response data
69     * @throws XMLStreamException
70     *             an error occurred while parsing the response
71     * @throws SRUClientException
72     *             any SRU exception, possibly wrapping another exception
73     * @see <a href="http://www.loc.gov/standards/sru/specs/extra-data.html">SRU
74     *      Extra Data / Extensions</a>
75     */
76    public void onExtraResponseData(XMLStreamReader reader)
77            throws XMLStreamException, SRUClientException;
78
79
80    /**
81     * Receive notifications of the start of the enumeration of records in the
82     * response.
83     *
84     * @param numberOfRecords
85     *            the number of records or <code>-1</code> if not available
86     * @param resultSetId
87     *            the result set id or <code>null</code> if not available
88     * @param resultSetIdleTime
89     *            the result set idle time or <code>-1</code> if not available
90     * @throws SRUClientException
91     *             any SRU exception, possibly wrapping another exception
92     */
93    public void onStartRecords(int numberOfRecords, String resultSetId,
94            int resultSetIdleTime) throws SRUClientException;
95
96
97    /**
98     * Receive notifications of the end of the enumeration of records in the
99     * response.
100     *
101     * @param nextRecordPosition
102     *            the next record position or <code>-1</code> if not available
103     * @throws SRUClientException
104     *             any SRU exception, possibly wrapping another exception
105     */
106    public void onFinishRecords(int nextRecordPosition)
107            throws SRUClientException;
108
109
110    /**
111     * Receive notification of a record in the result set.
112     *
113     * @param identifier
114     *            identifier of the record or <code>null</code> if not available
115     * @param position
116     *            position of the record in the result set or <code>-1</code> if
117     *            not available
118     * @param data
119     *            the parsed record data
120     * @throws SRUClientException
121     *             any SRU exception, possibly wrapping another exception
122     * @see SRURecordData
123     * @see SRURecordDataParser
124     */
125    public void onRecord(String identifier, int position, SRURecordData data)
126            throws SRUClientException;
127
128
129    /**
130     * Receive notification of a surrogate record in the result set.
131     *
132     * @param identifier
133     *            identifier of the record or <code>null</code> if not available
134     * @param position
135     *            position of the record in the result set or <code>-1</code> if
136     *            not available
137     * @param data
138     *            the surrogate record data, i.e. a diagnostic
139     * @throws SRUClientException
140     *             any SRU exception, possibly wrapping another exception
141     * @see SRUDiagnostic
142     */
143    public void onSurrogateRecord(String identifier, int position,
144            SRUDiagnostic data) throws SRUClientException;
145
146
147    /**
148     * Receive notification of extra record data.
149     *
150     * @param identifier
151     *            identifier of the record or <code>null</code> if not available
152     * @param position
153     *            position of the record in the result set or <code>-1</code> if
154     *            not available
155     * @param reader
156     *            a {@link XMLStreamReader} to parse the extra term data
157     * @throws XMLStreamException
158     *             an error occurred while parsing the response
159     * @throws SRUClientException
160     *             any SRU exception, possibly wrapping another exception
161     */
162    public void onExtraRecordData(String identifier, int position,
163            XMLStreamReader reader) throws XMLStreamException,
164            SRUClientException;
165
166} // interface SRUSearchRetrieveHandler
Note: See TracBrowser for help on using the repository browser.