source: SRUServer/trunk/src/main/java/eu/clarin/sru/server/SRURequest.java @ 2866

Last change on this file since 2866 was 2866, checked in by oschonef, 11 years ago
  • deprecate getRecordSchemaName() method of SRURequest

HEADS UP: method will be removed in next version. Adjust you source and use use getRecordSchemaIdentifier() instead.

  • Property svn:eol-style set to native
File size: 7.8 KB
Line 
1/**
2 * This software is copyright (c) 2011-2013 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.server;
18
19import java.util.List;
20
21import javax.servlet.http.HttpServletRequest;
22
23import org.z3950.zing.cql.CQLNode;
24
25
26/**
27 * Provides information about a SRU request.
28 */
29public interface SRURequest {
30
31    /**
32     * Get the <em>operation</em> parameter of this request. Available for
33     * <em>explain</em>, <em>searchRetrieve</em> and <em>scan</em> requests.
34     *
35     * @return the operation
36     * @see SRUOperation
37     */
38    public SRUOperation getOperation();
39
40
41    /**
42     * Get the <em>version</em> parameter of this request. Available for
43     * <em>explain</em>, <em>searchRetrieve</em> and <em>scan</em> requests.
44     *
45     * @return the version
46     * @see SRUVersion
47     */
48    public SRUVersion getVersion();
49
50
51    /**
52     * Check if this request is of a specific version.
53     *
54     * @param version
55     *            the version to check
56     * @return <code>true</code> if this request is in the requested version,
57     *         <code>false</code> otherwise
58     * @throws NullPointerException
59     *             if version is <code>null</code>
60     */
61    public boolean isVersion(SRUVersion version);
62
63
64    /**
65     * Check if version of this request is at least <em>min</em> and at most
66     * <em>max</em>.
67     *
68     * @param min
69     *            the minimum version
70     * @param max
71     *            the maximum version
72     * @return <code>true</code> if this request is in the provides version,
73     *         <code>false</code> otherwise
74     * @throws NullPointerException
75     *             if minimum or maximum <code>null</code>
76     * @throws IllegalArgumentException
77     *             if minimum is larger the maximum
78     */
79    public boolean isVersion(SRUVersion min, SRUVersion max);
80
81
82    /**
83     * Get the <em>recordPacking</em> parameter of this request. Only available
84     * for <em>explain</em> and <em>searchRetrieve</em> requests.
85     *
86     * @return the record packing method
87     * @see SRURecordPacking
88     */
89    public SRURecordPacking getRecordPacking();
90
91
92    /**
93     * Get the <em>query</em> parameter of this request. Only available for
94     * <em>searchRetrieve</em> requests.
95     *
96     * @return the parsed query or <code>null</code> if not a
97     *         <em>searchRetrieve</em> request
98     */
99    public CQLNode getQuery();
100
101
102    /**
103     * Get the <em>startRecord</em> parameter of this request. Only available
104     * for <em>searchRetrieve</em> requests. If the client did not provide
105     * a value for the request, it is set to <code>1</code>.
106     *
107     * @return the number of the start record
108     */
109    public int getStartRecord();
110
111
112    /**
113     * Get the <em>maximumRecords</em> parameter of this request. Only available
114     * for <em>searchRetrieve</em> requests. If no value was supplied with the
115     * request, the server will automatically set a default value.
116     *
117     * @return the maximum number of records
118     */
119    public int getMaximumRecords();
120
121
122    /**
123     * Get the <em>recordSchema</em> parameter of this request. Only available
124     * for <em>searchRetrieve</em> requests.
125     *
126     * @return the record schema name or <code>null</code> if no value was
127     *         supplied for this request
128     * @deprecated use {@link #getRecordSchemaIdentifier()}
129     */
130    @Deprecated
131    public String getRecordSchemaName();
132
133
134    /**
135     * Get the record schema identifier derived from the <em>recordSchema</em>
136     * parameter of this request. Only available for <em>searchRetrieve</em>
137     * requests. If the request was send with the short record schema name,
138     * it will automatically expanded to the record schema identifier.
139     *
140     * @return the record schema identifier or <code>null</code> if no
141     *         <em>recordSchema</em> parameter was supplied for this request
142     */
143    public String getRecordSchemaIdentifier();
144
145
146    /**
147     * Get the <em>recordXPath</em> parameter of this request. Only available
148     * for <em>searchRetrieve</em> requests and version 1.1 requests.
149     *
150     * @return the record XPath or <code>null</code> of no value was supplied
151     *         for this request
152     */
153    public String getRecordXPath();
154
155
156    /**
157     * Get the <em>resultSetTTL</em> parameter of this request. Only available
158     * for <em>searchRetrieve</em> requests.
159     *
160     * @return the result set TTL or <code>-1</code> if no value was supplied
161     *         for this request
162     */
163    public int getResultSetTTL();
164
165
166    /**
167     * Get the <em>sortKeys</em> parameter of this request. Only available for
168     * <em>searchRetrieve</em> requests and version 1.1 requests.
169     *
170     * @return the record XPath or <code>null</code> of no value was supplied
171     *         for this request
172     */
173    public String getSortKeys();
174
175
176    /**
177     * Get the <em>scanClause</em> parameter of this request. Only available for
178     * <em>scan</em> requests.
179     *
180     * @return the parsed scan clause or <code>null</code> if not a
181     *         <em>scan</em> request
182     */
183    public CQLNode getScanClause();
184
185
186    /**
187     * Get the <em>responsePosition</em> parameter of this request. Only
188     * available for <em>scan</em> requests. If the client did not provide
189     * a value for the request, it is set to <code>1</code>.
190     *
191     * @return the response position
192     */
193    public int getResponsePosition();
194
195
196    /**
197     * Get the <em>maximumTerms</em> parameter of this request. Available for
198     * any type of request.
199     *
200     * @return the maximum number of terms or <code>-1</code> if no value was
201     *         supplied for this request
202     */
203    public int getMaximumTerms();
204
205
206    /**
207     * Get the <em>stylesheet</em> parameter of this request. Available for
208     * <em>explain</em>, <em>searchRetrieve</em> and <em>scan</em> requests.
209     *
210     * @return the stylesheet or <code>null</code> if no value was supplied for
211     *         this request
212     */
213    public String getStylesheet();
214
215
216    /**
217     * Get the protocol schema which was used of this request. Available for
218     * <em>explain</em>, <em>searchRetrieve</em> and <em>scan</em> requests.
219     *
220     * @return the protocol scheme
221     */
222    public String getProtocolScheme();
223
224
225    /**
226     * Get the names of extra parameters of this request. Available for
227     * <em>explain</em>, <em>searchRetrieve</em> and <em>scan</em> requests.
228     *
229     * @return a possibly empty list of parameter names
230     */
231    public List<String> getExtraRequestDataNames();
232
233
234    /**
235     * Get the value of an extra parameter of this request. Available for
236     * <em>explain</em>, <em>searchRetrieve</em> and <em>scan</em> requests.
237     *
238     * @param name
239     *            name of the extra parameter. Must be prefixed with
240     *            <code>x-</code>
241     * @return the value of the parameter of <code>null</code> of extra
242     *         parameter with that name exists
243     * @throws NullPointerException
244     *             if <code>name</code> is null
245     * @throws IllegalArgumentException
246     *             if <code>name</code> does not start with <code>x-</code>
247     */
248    public String getExtraRequestData(String name);
249
250
251    /**
252     * Get the raw client request information from the Servlet container.
253     *
254     * @return the Servlet request
255     */
256    public HttpServletRequest getServletRequest();
257
258} // interface SRURequest
Note: See TracBrowser for help on using the repository browser.