org.apache.slide.search.basic
Class BasicQueryImpl

java.lang.Object
  extended byorg.apache.slide.search.SearchQuery
      extended byorg.apache.slide.search.basic.BasicQuery
          extended byorg.apache.slide.search.basic.BasicQueryImpl
All Implemented Interfaces:
IBasicQuery

public class BasicQueryImpl
extends BasicQuery
implements IBasicQuery

BasicQueryImpl represents the generic (store independent) implementation of BasicSearch.

Version:
$Revision: 1.16 $

Nested Class Summary
 
Nested classes inherited from class org.apache.slide.search.basic.BasicQuery
BasicQuery.ExpressionCompilerProvider
 
Field Summary
static java.lang.String FROM_ELEMENT_MISSING
          Message of a BadQueryException that is thrown if the query element does not contain a <from> element.
static java.lang.String NO_QUERY_ELEMENT
          Message of a BadQueryException that is thrown if the query element is null.
protected  NotNormalizer notNormalizer
          the NotNormalizer, may be overridden in extending classes
static java.lang.String NRESULTS_MISSING
          Message of a BadQueryException that is thrown if the query element contains a <limit> element but no <nresults> element.
static java.lang.String NRESULTS_MUST_BE_AN_INTEGER
          Message of a BadQueryException that is thrown if the <nresults> element is not an integer.
static java.lang.String PROP_OR_ALLPROP_ELEMENT_MISSING
          Message of a BadQueryException that is thrown if the query element neither contains a <prop> nor a <allprop> element.
static java.lang.String SELECT_ELEMENT_MISSING
          Message of a BadQueryException that is thrown if the query element does not contain a <select> element.
 
Fields inherited from class org.apache.slide.search.basic.BasicQuery
expressionCompilerProvider, limit, limitDefined, namespace, orderBy, propertyProvider, queryElement, queryScope, requestedProperties, rootExpression, slideUri, store, whereElement
 
Fields inherited from class org.apache.slide.search.SearchQuery
searchToken, structureHelper
 
Constructor Summary
BasicQueryImpl()
          Default constructor, to enable creation by reflection
BasicQueryImpl(SearchToken searchToken)
          Creates a BasicQueryImpl.
BasicQueryImpl(SearchToken searchToken, IBasicExpressionCompilerProvider expressionCompilerProvider)
          Creates a BasicQueryImpl.
 
Method Summary
protected  OrderBy createNewOrderBy(org.jdom.Element orderByElement)
           
protected  RequestedProperties createRequestedProperties(org.jdom.Element propElement)
          This method may be overridden, if a store specific implementation adds new property semantic.
 SearchQueryResult execute()
          Executes a request.
static QueryScope getScope(org.jdom.Element basicSearchElementJDOM)
          Needed to decide, which implementation of BasicQuery to load
 void parseQuery(org.jdom.Element expressionElement, PropertyProvider propertyProvider)
          builds the internal structure from the JDOM tree
 void parseQueryElement(org.jdom.Element basicSearchElement, PropertyProvider propertyProvider)
          Builds the internal structure from the JDOM tree.
 void parseQueryElement(org.jdom.Element basicSearchElement, PropertyProvider propertyProvider, QueryScope queryScope)
          Builds the internal structure from the JDOM tree.
protected  void parseQueryWithoutExpression(org.jdom.Element basicSearchElement)
          builds the internal structure from the JDOM tree.
 RequestedProperties requestedProperties()
          Method getSelectedProperties
 
Methods inherited from class org.apache.slide.search.basic.BasicQuery
getContentExpressionFactory, getExpression, getLimit, getOrderBy, getPropertiesExpressionFactory, getPropertyProvider, getScope, getSearchToken, getSlidePath, getStore, init, isLimitDefined, setScope, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.slide.search.basic.IBasicQuery
getContentExpressionFactory, getExpression, getLimit, getPropertiesExpressionFactory, getPropertyProvider, getScope, getSearchToken, getSlidePath, getStore, init, isLimitDefined
 

Field Detail

NO_QUERY_ELEMENT

public static final java.lang.String NO_QUERY_ELEMENT
Message of a BadQueryException that is thrown if the query element is null.

See Also:
Constant Field Values

FROM_ELEMENT_MISSING

public static final java.lang.String FROM_ELEMENT_MISSING
Message of a BadQueryException that is thrown if the query element does not contain a <from> element.

See Also:
Constant Field Values

SELECT_ELEMENT_MISSING

public static final java.lang.String SELECT_ELEMENT_MISSING
Message of a BadQueryException that is thrown if the query element does not contain a <select> element.

See Also:
Constant Field Values

PROP_OR_ALLPROP_ELEMENT_MISSING

public static final java.lang.String PROP_OR_ALLPROP_ELEMENT_MISSING
Message of a BadQueryException that is thrown if the query element neither contains a <prop> nor a <allprop> element.

See Also:
Constant Field Values

NRESULTS_MISSING

public static final java.lang.String NRESULTS_MISSING
Message of a BadQueryException that is thrown if the query element contains a <limit> element but no <nresults> element.

See Also:
Constant Field Values

NRESULTS_MUST_BE_AN_INTEGER

public static final java.lang.String NRESULTS_MUST_BE_AN_INTEGER
Message of a BadQueryException that is thrown if the <nresults> element is not an integer.

See Also:
Constant Field Values

notNormalizer

protected NotNormalizer notNormalizer
the NotNormalizer, may be overridden in extending classes

Constructor Detail

BasicQueryImpl

public BasicQueryImpl(SearchToken searchToken)
Creates a BasicQueryImpl.


BasicQueryImpl

public BasicQueryImpl()
Default constructor, to enable creation by reflection


BasicQueryImpl

public BasicQueryImpl(SearchToken searchToken,
                      IBasicExpressionCompilerProvider expressionCompilerProvider)
Creates a BasicQueryImpl. Used for testing

Parameters:
expressionCompilerProvider - the provider which delivers the expression compiler to use.
Method Detail

execute

public SearchQueryResult execute()
                          throws ServiceAccessException
Executes a request.

Specified by:
execute in interface IBasicQuery
Specified by:
execute in class BasicQuery
Returns:
a SearchQueryResult
Throws:
ServiceAccessException

parseQuery

public void parseQuery(org.jdom.Element expressionElement,
                       PropertyProvider propertyProvider)
                throws BadQueryException
builds the internal structure from the JDOM tree

Specified by:
parseQuery in class BasicQuery
Parameters:
expressionElement - the (root) expression Element.
propertyProvider - the PropertyProvider to use (may be null).
Throws:
BadQueryException

requestedProperties

public RequestedProperties requestedProperties()
Method getSelectedProperties

Specified by:
requestedProperties in interface IBasicQuery
Overrides:
requestedProperties in class BasicQuery
Returns:
a SelectedPropertyList

parseQueryElement

public void parseQueryElement(org.jdom.Element basicSearchElement,
                              PropertyProvider propertyProvider)
                       throws BadQueryException
Builds the internal structure from the JDOM tree. Concrete implementations may use parseQueryElementWithoutExpression to create most of the objects describing the query.

Specified by:
parseQueryElement in interface IBasicQuery
Overrides:
parseQueryElement in class BasicQuery
Parameters:
basicSearchElement - the (root) expression Element.
propertyProvider - the PropertyProvider to use (may be null).
Throws:
BadQueryException

parseQueryElement

public void parseQueryElement(org.jdom.Element basicSearchElement,
                              PropertyProvider propertyProvider,
                              QueryScope queryScope)
                       throws BadQueryException
Builds the internal structure from the JDOM tree. Concrete implementations may use parseQueryElementWithoutExpression to create most of the objects describing the query.

Parameters:
basicSearchElement - the (root) expression Element.
propertyProvider - the PropertyProvider to use (may be null).
Throws:
BadQueryException

getScope

public static QueryScope getScope(org.jdom.Element basicSearchElementJDOM)
                           throws BadQueryException
Needed to decide, which implementation of BasicQuery to load

Parameters:
basicSearchElementJDOM - an Element
Returns:
a QueryScope
Throws:
BadQueryException

parseQueryWithoutExpression

protected void parseQueryWithoutExpression(org.jdom.Element basicSearchElement)
                                    throws BadQueryException
builds the internal structure from the JDOM tree. It may be used by the concrete implementation of BasicQuery. It does NOT create the tree of Expressions. This must be done in the specific implementation.

Overrides:
parseQueryWithoutExpression in class BasicQuery
Parameters:
basicSearchElement - an Element
Throws:
BadQueryException

createNewOrderBy

protected OrderBy createNewOrderBy(org.jdom.Element orderByElement)
                            throws InvalidQueryException
Throws:
InvalidQueryException

createRequestedProperties

protected RequestedProperties createRequestedProperties(org.jdom.Element propElement)
                                                 throws BadQueryException
This method may be overridden, if a store specific implementation adds new property semantic.

Parameters:
propElement - an Element
Returns:
a RequestedProperties
Throws:
BadQueryException