1 /*2 * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/IBasicQuery.java,v 1.7 2004/07/28 09:35:01 ib Exp $3 * $Revision: 1.7 $4 * $Date: 2004/07/28 09:35:01 $5 *6 * ====================================================================7 *8 * Copyright 1999-2002 The Apache Software Foundation 9 *10 * Licensed under the Apache License, Version 2.0 (the "License");11 * you may not use this file except in compliance with the License.12 * You may obtain a copy of the License at13 *14 * http://www.apache.org/licenses/LICENSE-2.015 *16 * Unless required by applicable law or agreed to in writing, software17 * distributed under the License is distributed on an "AS IS" BASIS,18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.19 * See the License for the specific language governing permissions and20 * limitations under the License.21 *22 */23 24 package org.apache.slide.search.basic;25 26 import org.apache.slide.common.RequestedProperties;27 import org.apache.slide.common.ServiceAccessException;28 import org.apache.slide.search.BadQueryException;29 import org.apache.slide.search.InvalidScopeException;30 import org.apache.slide.search.PropertyProvider;31 import org.apache.slide.search.QueryScope;32 import org.apache.slide.search.SearchQueryResult;33 import org.apache.slide.search.SearchToken;34 import org.apache.slide.store.AbstractStore;35 import org.jdom.Element;36 37 /**38 * A BasicQuery represents the query and is able to deliver a39 * SearchQueryResult using the execute method. It serves as a base class for40 * store specific implementations. It hosts the information about the SELECT,41 * FROM, WHERE, ORDERBY and LIMIT. It also holds a tree of42 * BasicSearchExpressions.43 *44 * @version $Revision: 1.7 $45 */46 public interface IBasicQuery {47 48 /**49 * Method getStore50 *51 * @return an AbstractStore52 *53 */54 public AbstractStore getStore ();55 56 /**57 * Method getSlidePath58 *59 * @return a String60 *61 * @throws InvalidScopeException62 *63 */64 String getSlidePath () throws InvalidScopeException;65 66 /**67 * Method getSearchToken68 *69 * @return a SearchToken70 *71 */72 SearchToken getSearchToken ();73 74 /**75 * Builds the internal structure from the JDOM tree. Concrete implementations76 * may use parseQueryElementWithoutExpression to create most of the77 * objects describing the query.78 *79 * @param basicSearchElement the (root) expression Element.80 * @param propertyProvider the PropertyProvider to use (may be81 * <code>null</code>).82 *83 * @throws BadQueryException84 */85 void parseQueryElement (Element basicSearchElement, PropertyProvider propertyProvider) throws BadQueryException;86 87 /**88 * Executes a request. A store specific implementation should overwrite89 * this to optimize the execution.90 *91 * @return a SearchQueryResult92 *93 * @throws ServiceAccessException94 *95 */96 SearchQueryResult execute () throws ServiceAccessException;97 98 99 /**100 * QueryScope accessor101 *102 * @return the Scope103 *104 */105 public QueryScope getScope ();106 107 /**108 * Method getSelectedProperties109 *110 * @return a SelectedPropertyList111 */112 RequestedProperties requestedProperties ();113 114 /**115 * Method getExpression116 *117 * @return a BasicExpression118 *119 */120 IBasicExpression getExpression ();121 122 /**123 * Method isLimitDefined124 *125 * @return true if <limit> was specified126 */127 boolean isLimitDefined ();128 129 /**130 * Method getLimit131 *132 * @return the value of <limit>133 */134 int getLimit ();135 136 /**137 * Method getPropertyProvider138 *139 * @return a PropertyProvider140 *141 */142 PropertyProvider getPropertyProvider ();143 144 145 /**146 * Method init147 *148 * @param token a SearchToken149 *150 */151 void init (SearchToken token);152 153 154 /**155 * Method getContentExpressionFactory156 *157 * @return the content store / indexer specific ExpressionFactory158 *159 */160 IBasicExpressionFactory getContentExpressionFactory ();161 162 /**163 * Method getPropertiesExpressionFactory164 *165 * @return the properties store / indexer specific ExpressionFactory166 *167 */168 IBasicExpressionFactory getPropertiesExpressionFactory ();169 }170 171