KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > cms > core > search > QueryManager


1 /**
2  *
3  * Magnolia and its source-code is licensed under the LGPL.
4  * You may copy, adapt, and redistribute this file for commercial or non-commercial use.
5  * When copying, adapting, or redistributing this document in keeping with the guidelines above,
6  * you are required to provide proper attribution to obinary.
7  * If you reproduce or distribute the document without making any substantive modifications to its content,
8  * please use the following attribution line:
9  *
10  * Copyright 1993-2006 obinary Ltd. (http://www.obinary.com) All rights reserved.
11  *
12  */

13 package info.magnolia.cms.core.search;
14
15 import javax.jcr.Node;
16 import javax.jcr.RepositoryException;
17 import javax.jcr.query.InvalidQueryException;
18
19
20 /**
21  * Date: Apr 4, 2005 Time: 11:00:02 AM
22  * @author Sameer Charles
23  */

24
25 public interface QueryManager {
26
27     /**
28      * <i>Description inherited from javax.jcr.query.QueryManager#createQuery(String, String)</i><br>
29      * Creates a new query by specifying the query <code>statement</code> itself and the <code>language</code> in
30      * which the query is stated. If the query <code>statement</code> is syntactically invalid, given the language
31      * specified, an <code>InvalidQueryException</code> is thrown. The <code>language</code> must be a string from
32      * among those returned by QueryManager.getSupportedQueryLanguages(); if it is not, then an
33      * <code>InvalidQueryException</code> is thrown.
34      * @throws InvalidQueryException if statement is invalid or language is unsupported.
35      * @throws RepositoryException if another error occurs
36      * @return A <code>Query</code> object.
37      */

38     Query createQuery(String JavaDoc statement, String JavaDoc language) throws InvalidQueryException, RepositoryException;
39
40     /**
41      * <i>Description inherited from javax.jcr.query.QueryManager#getQuery(javax.jcr.Node)</i><br>
42      * Retrieves an existing persistent query. If <code>node</code> is not a valid persisted query (that is, a node of
43      * type <code>nt:query</code>), an <code>InvalidQueryException</code> is thrown. <p/> Persistent queries are
44      * created by first using <code>QueryManager.createQuery</code> to create a <code>Query</code> object and then
45      * calling <code>Query.save</code> to persist the query to a location in the workspace.
46      * @param node a persisted query (that is, a node of type <code>nt:query</code>).
47      * @throws InvalidQueryException If <code>node</code> is not a valid persisted query (that is, a node of type
48      * <code>nt:query</code>).
49      * @throws RepositoryException if another error occurs
50      * @return a <code>Query</code> object.
51      */

52     Query getQuery(Node node) throws InvalidQueryException, RepositoryException;
53
54     /**
55      * <i>Description inherited from javax.jcr.query.QueryManager#getSupportedQueryLanguages()</i><br>
56      * Returns an array of strings representing all query languages supported by this repository. In level 1 this set
57      * must include the string represented by the constant {@link Query#XPATH}. If SQL is supported it must
58      * additionally include the string represented by the constant {@link Query#SQL}. An implementation may also
59      * support other languages as well. See {@link Query}.
60      * @return An string array.
61      * @throws RepositoryException if an error occurs.
62      */

63     String JavaDoc[] getSupportedQueryLanguages() throws RepositoryException;
64
65 }
66
Popular Tags