org.mmbase.storage.search.implementation.database
Class BasicQueryHandler

Package class diagram package BasicQueryHandler
java.lang.Object
  extended by org.mmbase.storage.search.implementation.database.BasicQueryHandler
All Implemented Interfaces:
CoreSearchQueryHandler, SearchQueryHandler

public class BasicQueryHandler
extends Object
implements CoreSearchQueryHandler

Basic implementation using a database. Uses a SqlHandler to create SQL string representations of search queries.

In order to execute search queries, these are represented as SQL strings by the handler, and in this form executed on the database.

Since:
MMBase-1.7
Version:
$Id: BasicQueryHandler.java 45472 2011-02-27 15:16:53Z michiel $
Author:
Rob van Maris

Field Summary
 
Fields inherited from interface org.mmbase.storage.search.SearchQueryHandler
FEATURE_MAX_NUMBER, FEATURE_OFFSET, FEATURE_REGEXP, SUPPORT_NONE, SUPPORT_NORMAL, SUPPORT_OPTIMAL, SUPPORT_WEAK
 
Constructor Summary
BasicQueryHandler(SqlHandler sqlHandler)
          Default constructor.
 
Method Summary
 String createSqlString(SearchQuery query)
          Makes a String of a query, taking into consideration if the database supports offset and maxnumber features.
 List<MMObjectNode> getNodes(SearchQuery query, MMObjectBuilder builder)
          Processes a search query, returns the result as a list of nodes.
 int getSupportLevel(Constraint constraint, SearchQuery query)
           
 int getSupportLevel(int feature, SearchQuery query)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicQueryHandler

public BasicQueryHandler(SqlHandler sqlHandler)
Default constructor.

Parameters:
sqlHandler - The handler use to create SQL string representations of search queries.
Method Detail

getNodes

public List<MMObjectNode> getNodes(SearchQuery query,
                                   MMObjectBuilder builder)
                            throws SearchQueryException
Description copied from interface: CoreSearchQueryHandler
Processes a search query, returns the result as a list of nodes. Depending on the specified builder, the results will be:

Specified by:
getNodes in interface CoreSearchQueryHandler
Parameters:
query - The search query.
builder - The builder for the result nodes. Specify a ResultBuilder to get resultnodes. ClusterBuilder to get clusternodes.
Returns:
The resulting nodes.
Throws:
SearchQueryException
See Also:
ResultNode, ClusterNode

createSqlString

public String createSqlString(SearchQuery query)
                       throws SearchQueryException
Makes a String of a query, taking into consideration if the database supports offset and maxnumber features. The resulting String is an SQL query which can be fed to the database.

Specified by:
createSqlString in interface SearchQueryHandler
Parameters:
query - the query to convert to sql
Returns:
the sql string
Throws:
SearchQueryException - when error occurs while making the string

getSupportLevel

public int getSupportLevel(int feature,
                           SearchQuery query)
                    throws SearchQueryException
Specified by:
getSupportLevel in interface SearchQueryHandler
Throws:
SearchQueryException

getSupportLevel

public int getSupportLevel(Constraint constraint,
                           SearchQuery query)
                    throws SearchQueryException
Specified by:
getSupportLevel in interface SearchQueryHandler
Throws:
SearchQueryException


MMBase2 Core 2.0-SNAPSHOT - 2013-05-29T22:08