KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > outerj > daisy > repository > query > QueryManager


1 /*
2  * Copyright 2004 Outerthought bvba and Schaubroeck nv
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.outerj.daisy.repository.query;
17
18 import org.outerx.daisy.x10.SearchResultDocument;
19 import org.outerx.daisy.x10.FacetedQueryResultDocument;
20 import org.outerx.daisy.x10.DistinctSearchResultDocument;
21 import org.outerj.daisy.repository.RepositoryException;
22 import org.outerj.daisy.repository.VariantKey;
23
24 import java.util.Locale JavaDoc;
25 import java.util.Map JavaDoc;
26
27 /**
28  * The QueryManager allows to perform queries on the repository.
29  *
30  */

31 public interface QueryManager {
32     /**
33      * Executes a query and returns the results as XML.
34      *
35      * @param query a query written in the Daisy Query Language
36      * @param locale influences the sort behaviour and formatting of non-string fields
37      */

38     public SearchResultDocument performQuery(String JavaDoc query, Locale JavaDoc locale) throws RepositoryException;
39
40     public SearchResultDocument performQuery(String JavaDoc query, Locale JavaDoc locale, EvaluationContext evaluationContext) throws RepositoryException;
41
42     /**
43      * Executes a query and returns the keys of the matching document variants.
44      *
45      * <p>In this case, the select part of the query is ignored, but
46      * should still be specified to have a valid query. Use eg "select id where ...".
47      *
48      * @param query a query written in the Daisy Query Language
49      * @param locale influences the sort behaviour
50      */

51     public VariantKey[] performQueryReturnKeys(String JavaDoc query, Locale JavaDoc locale) throws RepositoryException;
52
53     public VariantKey[] performQueryReturnKeys(String JavaDoc query, Locale JavaDoc locale, EvaluationContext evaluationContext) throws RepositoryException;
54
55     /**
56      * Executes a query and returns the keys of the matching document variants.
57      *
58      * <p>In this case, the select part of the query is ignored, but
59      * should still be specified to have a valid query. Use eg "select id where ...".
60      *
61      * @param query a query written in the Daisy Query Language
62      * @param extraCond extra conditions that will be and-ed to the conditions of the query.
63      * This allows to force certain conditions, eg only returning
64      * documents part of a certain collection.
65      * @param locale influences the sort behaviour
66      */

67     public VariantKey[] performQueryReturnKeys(String JavaDoc query, String JavaDoc extraCond, Locale JavaDoc locale) throws RepositoryException;
68
69     public VariantKey[] performQueryReturnKeys(String JavaDoc query, String JavaDoc extraCond, Map JavaDoc queryOptions, Locale JavaDoc locale) throws RepositoryException;
70
71     public VariantKey[] performQueryReturnKeys(String JavaDoc query, String JavaDoc extraCond, Locale JavaDoc locale,
72                                                EvaluationContext evaluationContext) throws RepositoryException;
73
74     public VariantKey[] performQueryReturnKeys(String JavaDoc query, String JavaDoc extraCond, Map JavaDoc queryOptions, Locale JavaDoc locale,
75                                                EvaluationContext evaluationContext) throws RepositoryException;
76
77     /**
78      * Same as {@link #performQueryReturnKeys(java.lang.String, java.lang.String, java.util.Locale)} but
79      * returns the results as XML.
80      */

81     public SearchResultDocument performQuery(String JavaDoc query, String JavaDoc extraCond, Locale JavaDoc locale) throws RepositoryException;
82
83     public SearchResultDocument performQuery(String JavaDoc query, String JavaDoc extraCond, Map JavaDoc queryOptions, Locale JavaDoc locale) throws RepositoryException;
84
85     public SearchResultDocument performQuery(String JavaDoc query, String JavaDoc extraCond, Locale JavaDoc locale,
86                                              EvaluationContext evaluationContext) throws RepositoryException;
87
88     /**
89      *
90      * @param queryOptions a map specifying forced values for query options (the options which
91      * one can otherwise specify in the query itself, such as 'search_last_version'.
92      * Keys and values in this map should be String objects.
93      */

94     public SearchResultDocument performQuery(String JavaDoc query, String JavaDoc extraCond, Map JavaDoc queryOptions, Locale JavaDoc locale,
95                                              EvaluationContext evaluationContext) throws RepositoryException;
96
97     /**
98      * Performs a query and includes for each selected value the set of distinct values, if the
99      * isFacet property of the corresponding entry in the given facetConfs array is true.
100      *
101      * <p>If the length of the facetConf array does not correspond to the number of selected
102      * values, this will not give an error.
103      */

104     public FacetedQueryResultDocument performFacetedQuery(String JavaDoc query, FacetConf[] facetConfs, int chunkOffset, int chunkLength, Locale JavaDoc locale) throws RepositoryException;
105
106     public DistinctSearchResultDocument performDistinctQuery(String JavaDoc query, SortOrder sortOrder, Locale JavaDoc locale) throws RepositoryException;
107
108     public DistinctSearchResultDocument performDistinctQuery(String JavaDoc query, String JavaDoc extraCond, SortOrder sortOrder, Locale JavaDoc locale) throws RepositoryException;
109
110     /**
111      * Parses a predicate expression (= the where-part of a Daisy query, an expression which
112      * evaluates to either true or false) for future evaluation on a document.
113      */

114     public PredicateExpression parsePredicateExpression(String JavaDoc expression) throws QueryException;
115 }
116
Popular Tags