source: SRUServer/tags/SRUServer-1.2.0/src/main/java/eu/clarin/sru/server/utils/SRUSearchEngineBase.java @ 2624

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