01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.solr.request;
17:
18: import org.apache.solr.util.NamedList;
19: import org.apache.solr.core.SolrInfoMBean;
20:
21: /**
22: * Implementations of <code>SolrRequestHandler</code> are called to handle query requests.
23: *
24: * Different <code>SolrRequestHandler</code>s are registered with the <code>SolrCore</code>.
25: * One way to register a SolrRequestHandler with the core is thorugh the <code>solrconfig.xml</code> file.
26: * <p>
27: * Example <code>solrconfig.xml</code> entry to register a <code>SolrRequestHandler</code> implementation to
28: * handle all queries with a query type of "test":
29: * <p>
30: * <code>
31: * <requestHandler name="test" class="solr.tst.TestRequestHandler" />
32: * </code>
33: * <p>
34: * A single instance of any registered SolrRequestHandler is created
35: * via the default constructor and is reused for all relevant queries.
36: *
37: * @author yonik
38: * @version $Id: SolrRequestHandler.java 472574 2006-11-08 18:25:52Z yonik $
39: */
40: public interface SolrRequestHandler extends SolrInfoMBean {
41:
42: /** <code>init</code> will be called just once, immediately after creation.
43: * <p>The args are user-level initialization parameters that
44: * may be specified when declaring a request handler in
45: * solrconfig.xml
46: */
47: public void init(NamedList args);
48:
49: /**
50: * Handles a query request, this method must be thread safe.
51: * <p>
52: * Information about the request may be obtained from <code>req</code> and
53: * response information may be set using <code>rsp</code>.
54: * <p>
55: * There are no mandatory actions that handleRequest must perform.
56: * An empty handleRequest implementation would fulfill
57: * all interface obligations.
58: */
59: public void handleRequest(SolrQueryRequest req,
60: SolrQueryResponse rsp);
61: }
|