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 | */ |
---|
17 | package eu.clarin.sru.client; |
---|
18 | |
---|
19 | import java.util.List; |
---|
20 | |
---|
21 | import javax.xml.stream.XMLStreamException; |
---|
22 | import javax.xml.stream.XMLStreamReader; |
---|
23 | |
---|
24 | |
---|
25 | /** |
---|
26 | * Receive notifications to the response of a <em>explain</em> request. |
---|
27 | * |
---|
28 | * @see SRUExplainRequest |
---|
29 | * @see <a href="http://www.loc.gov/standards/sru/specs/explain.html">SRU Explain Operation</a> |
---|
30 | */ |
---|
31 | public interface SRUExplainHandler { |
---|
32 | |
---|
33 | /** |
---|
34 | * Receive notification of diagnostics. |
---|
35 | * |
---|
36 | * @param diagnostics |
---|
37 | * a list of {@link SRUDiagnostic} |
---|
38 | * @throws SRUClientException |
---|
39 | * any SRU exception, possibly wrapping another exception |
---|
40 | * @see SRUDiagnostic |
---|
41 | */ |
---|
42 | public void onDiagnostics(List<SRUDiagnostic> diagnostics) |
---|
43 | throws SRUClientException; |
---|
44 | |
---|
45 | |
---|
46 | /** |
---|
47 | * Receive notification of request statistics. |
---|
48 | * |
---|
49 | * @param totalBytesTransferred |
---|
50 | * the total number of bytes transferred while receiving the |
---|
51 | * response |
---|
52 | * @param millisTotal |
---|
53 | * the total time spend processing the request |
---|
54 | * @param millisNetwork |
---|
55 | * the time spend performing network operations |
---|
56 | * @param millisProcessing |
---|
57 | * the time spend processing the response |
---|
58 | */ |
---|
59 | public void onRequestStatistics(int totalBytesTransferred, |
---|
60 | long millisTotal, long millisNetwork, long millisProcessing); |
---|
61 | |
---|
62 | |
---|
63 | /** |
---|
64 | * Receive notification of extra response data. |
---|
65 | * |
---|
66 | * @param reader |
---|
67 | * a {@link XMLStreamReader} to parse the extra response data |
---|
68 | * @throws XMLStreamException |
---|
69 | * an error occurred while parsing the response |
---|
70 | * @throws SRUClientException |
---|
71 | * any SRU exception, possibly wrapping another exception |
---|
72 | * @see <a href="http://www.loc.gov/standards/sru/specs/extra-data.html">SRU |
---|
73 | * Extra Data / Extensions</a> |
---|
74 | */ |
---|
75 | public void onExtraResponseData(XMLStreamReader reader) |
---|
76 | throws XMLStreamException, SRUClientException; |
---|
77 | |
---|
78 | /** |
---|
79 | * Receive notifications of the start of the enumeration of records in the |
---|
80 | * response. |
---|
81 | * |
---|
82 | * @param numberOfRecords |
---|
83 | * the number of records or <code>-1</code> if not available |
---|
84 | * @param resultSetId |
---|
85 | * the result set id or <code>null</code> if not available |
---|
86 | * @param resultSetIdleTime |
---|
87 | * the result set idle time or <code>-1</code> if not available |
---|
88 | * @throws SRUClientException |
---|
89 | * any SRU exception, possibly wrapping another exception |
---|
90 | */ |
---|
91 | public void onStartRecords(int numberOfRecords, String resultSetId, |
---|
92 | int resultSetIdleTime) throws SRUClientException; |
---|
93 | |
---|
94 | |
---|
95 | /** |
---|
96 | * Receive notifications of the end of the enumeration of records in the |
---|
97 | * response. |
---|
98 | * |
---|
99 | * @param nextRecordPosition |
---|
100 | * the next record position or <code>-1</code> if not available |
---|
101 | * @throws SRUClientException |
---|
102 | * any SRU exception, possibly wrapping another exception |
---|
103 | */ |
---|
104 | public void onFinishRecords(int nextRecordPosition) |
---|
105 | throws SRUClientException; |
---|
106 | |
---|
107 | |
---|
108 | /** |
---|
109 | * Receive notification of a record in the result set. |
---|
110 | * |
---|
111 | * @param identifier |
---|
112 | * identifier of the record or <code>null</code> if not available |
---|
113 | * @param position |
---|
114 | * position of the record in the result set or <code>-1</code> if |
---|
115 | * not available |
---|
116 | * @param data |
---|
117 | * the parsed record data |
---|
118 | * @throws SRUClientException |
---|
119 | * any SRU exception, possibly wrapping another exception |
---|
120 | * @see SRURecordData |
---|
121 | * @see SRURecordDataParser |
---|
122 | */ |
---|
123 | public void onRecord(String identifier, int position, SRURecordData data) |
---|
124 | throws SRUClientException; |
---|
125 | |
---|
126 | |
---|
127 | /** |
---|
128 | * Receive notification of extra record data. |
---|
129 | * |
---|
130 | * @param identifier |
---|
131 | * identifier of the record or <code>null</code> if not available |
---|
132 | * @param position |
---|
133 | * position of the record in the result set or <code>-1</code> if |
---|
134 | * not available |
---|
135 | * @param reader |
---|
136 | * a {@link XMLStreamReader} to parse the extra term data |
---|
137 | * @throws XMLStreamException |
---|
138 | * an error occurred while parsing the response |
---|
139 | * @throws SRUClientException |
---|
140 | * any SRU exception, possibly wrapping another exception |
---|
141 | */ |
---|
142 | public void onExtraRecordData(String identifier, int position, |
---|
143 | XMLStreamReader reader) throws XMLStreamException, |
---|
144 | SRUClientException; |
---|
145 | |
---|
146 | } // interface SRUExplainHandler |
---|