| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| QueryFactory |
|
| 2.0;2 |
| 1 | /* Copyright (2006-2007) Schibsted Søk AS | |
| 2 | * This file is part of SESAT. | |
| 3 | * | |
| 4 | * SESAT is free software: you can redistribute it and/or modify | |
| 5 | * it under the terms of the GNU Affero General Public License as published by | |
| 6 | * the Free Software Foundation, either version 3 of the License, or | |
| 7 | * (at your option) any later version. | |
| 8 | * | |
| 9 | * SESAT is distributed in the hope that it will be useful, | |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 12 | * GNU Affero General Public License for more details. | |
| 13 | * | |
| 14 | * You should have received a copy of the GNU Affero General Public License | |
| 15 | * along with SESAT. If not, see <http://www.gnu.org/licenses/>. | |
| 16 | ||
| 17 | */ | |
| 18 | package no.sesat.search.run; | |
| 19 | ||
| 20 | ||
| 21 | import javax.servlet.http.HttpServletRequest; | |
| 22 | import javax.servlet.http.HttpServletResponse; | |
| 23 | import no.sesat.search.site.SiteKeyedFactoryInstantiationException; | |
| 24 | import org.apache.log4j.Logger; | |
| 25 | ||
| 26 | /** | |
| 27 | * QueryFactory is part of no.sesat.search.query. | |
| 28 | * | |
| 29 | * Use QueryFactory to create a new RunningQuery instance. The RunningQuery | |
| 30 | * should contain all information on how to search in fast. | |
| 31 | * | |
| 32 | * | |
| 33 | * @version $Id: QueryFactory.java 6596 2008-05-10 10:05:48Z ssmiweve $ | |
| 34 | */ | |
| 35 | 0 | public abstract class QueryFactory { |
| 36 | ||
| 37 | 0 | private static final Logger LOG = Logger.getLogger(QueryFactory.class); |
| 38 | private static QueryFactory instance; | |
| 39 | ||
| 40 | /** | |
| 41 | * Create a new instance of QueryFactory. | |
| 42 | * @return instance | |
| 43 | */ | |
| 44 | public static QueryFactory getInstance() { | |
| 45 | 0 | if (instance == null) { |
| 46 | ||
| 47 | 0 | if (LOG.isInfoEnabled()) { |
| 48 | 0 | LOG.info("Creating new QueryFactory instance"); |
| 49 | } | |
| 50 | 0 | instance = new QueryFactoryImpl(); |
| 51 | } | |
| 52 | 0 | return instance; |
| 53 | } | |
| 54 | ||
| 55 | /** | |
| 56 | * Create a new instance of running query. The implementation can | |
| 57 | * be RunningWebQuery, RunningAdvWebQuery for example. | |
| 58 | * @param mode with SearchConfiguration | |
| 59 | * @param request with parameters | |
| 60 | * @param response | |
| 61 | * @return instance of RunningQuery | |
| 62 | */ | |
| 63 | public abstract RunningQuery createQuery( | |
| 64 | RunningQuery.Context cxt, | |
| 65 | HttpServletRequest request, | |
| 66 | HttpServletResponse response) throws SiteKeyedFactoryInstantiationException; | |
| 67 | ||
| 68 | } |