KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Id: Query.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.ItemExistsException;
27 import javax.jcr.PathNotFoundException;
28 import javax.jcr.RepositoryException;
29 import javax.jcr.nodetype.ConstraintViolationException;
30
31 /**
32  * A <code>Query</code> object.
33  *
34  * @author Peeter Piegaze
35  */

36 public interface Query {
37
38   /**
39    * Executes this search and returns a
40    * <code>{@link QueryResultIterator}</code>.
41    *
42    * @return a <code>QueryResultIterator</code>
43    */

44   public QueryResultIterator execute();
45
46   /**
47    * Returns the statement set for this query. Returns <code>null</code>
48    * if no statement is currently set.
49    *
50    * @return the query statement.
51    */

52   public String JavaDoc getStatement();
53
54   /**
55    * Returns the language set for this query. This will be one of the
56    * QueryLanguage constants returned by
57    * QueryManager.getSupportedQueryLanguages(). If the query was created
58    * using a mechanism outside the specification, this method may return 0.
59    *
60    * @return the query language.
61    */

62   public int getLanguage();
63
64   /**
65    * If this is a persistent query (i.e., it has been saved), returns the path of the
66    * node that persists it. If this query has not been saved, it returns null.
67    *
68    * @return path of persisted node representing this query in content.
69    */

70   public String JavaDoc getPersistentQueryPath();
71
72   /**
73    * Creates a persistent query. The persisted query will be created as a
74    * node of node type <code>nt:query</code>. This method persists the new node
75    * immediately; there is no need to call <code>Node.save</code>.
76    *
77    * @param absPath path at which to persist this query.
78    * @throws ItemExistsException If an item already exists at the indicated position
79    * @throws PathNotFoundException If the path cannot be found
80    * @throws ConstraintViolationException If creating the node would violate a
81    * node type (or other implementation specific) constraint.
82    * @throws RepositoryException If another error occurs.
83    */

84   public void save(String JavaDoc absPath) throws ItemExistsException, PathNotFoundException, ConstraintViolationException, RepositoryException;
85 }
86
Popular Tags