source: SRUServer/trunk/src/main/java/eu/clarin/sru/server/utils/SRUSearchEngineBase.java @ 6825

Last change on this file since 6825 was 6825, checked in by Oliver Schonefeld, 9 years ago
  • add SRUQueryParserFactory and expose interface to register query parsers
File size: 3.7 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.utils;
18
19import java.util.Map;
20
21import javax.servlet.ServletContext;
22
23import eu.clarin.sru.server.SRUConfigException;
24import eu.clarin.sru.server.SRUDiagnosticList;
25import eu.clarin.sru.server.SRUException;
26import eu.clarin.sru.server.SRUExplainResult;
27import eu.clarin.sru.server.SRUQueryParserRegistry;
28import eu.clarin.sru.server.SRURequest;
29import eu.clarin.sru.server.SRUScanResultSet;
30import eu.clarin.sru.server.SRUSearchEngine;
31import eu.clarin.sru.server.SRUSearchResultSet;
32import eu.clarin.sru.server.SRUServerConfig;
33
34
35/**
36 * Base class required for an {@link SRUSearchEngine} implementation to be used
37 * with the {@link SRUServerServlet} Servlet.
38 */
39public abstract class SRUSearchEngineBase implements SRUSearchEngine {
40
41    public SRUSearchEngineBase() {
42    }
43
44
45    /**
46     * Handle a <em>explain</em> operation. The default implementation is a
47     * no-op. Override this method, if you want to provide a custom behavior.
48     *
49     * @see SRUSearchEngine#explain(SRUServerConfig, SRURequest,
50     *      SRUDiagnosticList)
51     */
52    @Override
53    public SRUExplainResult explain(SRUServerConfig config, SRURequest request,
54            SRUDiagnosticList diagnostics) throws SRUException {
55        return null;
56    }
57
58
59    /**
60     * Handle a <em>scan</em> operation. The default implementation is a no-op.
61     * Override this method, if you want to provide a custom behavior.
62     *
63     * @see SRUSearchEngine#scan(SRUServerConfig, SRURequest, SRUDiagnosticList)
64     */
65    @Override
66    public SRUScanResultSet scan(SRUServerConfig config, SRURequest request,
67            SRUDiagnosticList diagnostics) throws SRUException {
68        return null;
69    }
70
71
72    /**
73     * Handle a <em>searchRetrieve</em> operation.
74     *
75     * @see SRUSearchEngine#search(SRUServerConfig, SRURequest,
76     *      SRUDiagnosticList)
77     */
78    @Override
79    public abstract SRUSearchResultSet search(SRUServerConfig config,
80            SRURequest request, SRUDiagnosticList diagnostics)
81            throws SRUException;
82
83
84    /**
85     * Initialize the search engine.
86     *
87     * @param context
88     *            the {@link ServletContext} for the Servlet
89     * @param config
90     *            the {@link SRUServerConfig} object for this search engine
91     * @param queryParsers
92     *            the {@link SRUQueryParserRegistry} object for this search
93     *            engine. Register additional query parsers with this object.
94     * @param params
95     *            additional parameters gathered from the Servlet configuration
96     *            and Servlet context.
97     * @throws SRUConfigException
98     *             an error occurred during initialization of the search engine
99     */
100    public void init(ServletContext context,
101            SRUServerConfig config,
102            SRUQueryParserRegistry queryParsers,
103            Map<String, String> params) throws SRUConfigException {
104    }
105
106
107    /**
108     * Destroy the search engine. Use this method for any cleanup the search
109     * engine needs to perform upon termination.
110     */
111    public void destroy() {
112    }
113
114} // abstract class SRUSearchEngineBase
Note: See TracBrowser for help on using the repository browser.