KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > jcr > query > QueryManager


1 /*
2  * $Id: QueryManager.java,v 1.2 2004/07/24 00:16:24 benjmestrallet Exp $
3  *
4  * Copyright 2002-2004 Day Management AG, Switzerland.
5  *
6  * Licensed under the Day RI License, Version 2.0 (the "License"),
7  * as a reference implementation of the following specification:
8  *
9  * Content Repository API for Java Technology, revision 0.12
10  * <http://www.jcp.org/en/jsr/detail?id=170>
11  *
12  * You may not use this file except in compliance with the License.
13  * You may obtain a copy of the License files at
14  *
15  * http://www.day.com/content/en/licenses/day-ri-license-2.0
16  * http://www.apache.org/licenses/LICENSE-2.0
17  *
18  * Unless required by applicable law or agreed to in writing, software
19  * distributed under the License is distributed on an "AS IS" BASIS,
20  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21  * See the License for the specific language governing permissions and
22  * limitations under the License.
23  */

24 package javax.jcr.query;
25
26 import javax.jcr.RepositoryException;
27
28 /**
29  * This interface encapsulates methods for the management of search queries.
30  * Provides methods for the creation and retrieval of search queries.
31  *
32  * @author Peeter Piegaze
33  */

34 public interface QueryManager {
35
36   /**
37    * Creates a new query by specifying the query statement itself and the
38    * language in which the query is stated. If the query statement is
39    * syntactically invalid, given the language specified, an
40    * InvalidQueryException is thrown. language must specify a query language
41    * from among those returned by QueryManager.getSupportedQueryLanguages(); if it is not
42    * then an InvalidQueryException is thrown.
43    *
44    * @return A <code>Query</code> object.
45    * @throws InvalidQueryException if statement is invalid or language is unsupported.
46    * @throws RepositoryException if another error occurs
47    */

48   public Query createQuery(String JavaDoc statement, int language) throws InvalidQueryException, RepositoryException;
49
50   /**
51    * Retrieves an existing persistent query. If absPath is not the path of a
52    * valid persisted query an InvalidQueryException is thrown.
53    *
54    * @param absPath the absolute path of a persisted query.
55    * @return a <code>Query</code> object.
56    * @throws InvalidQueryException If <code>absPath</code> is not the path of
57    * a valid persisted query or if another error occurs.
58    * @throws RepositoryException if another error occurs
59    */

60   public Query getQuery(String JavaDoc absPath) throws InvalidQueryException, RepositoryException;
61
62   /**
63    * Returns an array of integers identifying the supported query languages.
64    * See {@link QueryLanguage}.
65    *
66    * @return An int array.
67    */

68   public int[] getSupportedQueryLanguages();
69 }
70
Popular Tags