org.apache.slide.search.basic
Class BasicExpressionCompiler

java.lang.Object
  extended byorg.apache.slide.search.basic.BasicExpressionCompiler
All Implemented Interfaces:
IBasicExpressionCompiler

public class BasicExpressionCompiler
extends java.lang.Object
implements IBasicExpressionCompiler

The implementation of the IBasicExpressionCompiler interface.

Version:
$Revision: 1.10 $

Field Summary
protected  boolean alreadyTriedToInstantiate
          Inidicates if it has already been tried to instantiate the storeSpecificExpressionFactory.
protected  IBasicExpressionFactory contentExpressionFactory
          The store specific IBasicExpressionFactory for content expressions to use (if one exists).
protected  IBasicExpressionFactory genericExpressionFactory
          The default IBasicExpressionFactory to use.
protected  IBasicExpressionFactory propertiesExpressionFactory
          The store specific IBasicExpressionFactory for property expressions to use (if one exists).
protected  PropertyProvider propertyProvider
          The PropertyProvider to use (if set).
protected  IBasicQuery query
          The IBasicQuery that provides some general information about the query.
 
Constructor Summary
BasicExpressionCompiler(IBasicQuery query, PropertyProvider propertyProvider)
          Creates the BasicExpressionCompiler, loads and inits the expression factories.
 
Method Summary
 IBasicExpression compile(org.jdom.Element expressionElement)
          Compiles an IBasicExpression (-tree) from the given expressionElement.
static boolean isContentExpression(org.jdom.Element expressionElement)
          Checks, if an expression is a contains expression.
static boolean isMergeExpression(org.jdom.Element expressionElement)
          Returns true if the given expressionElement describes a merge expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

query

protected IBasicQuery query
The IBasicQuery that provides some general information about the query.


propertyProvider

protected PropertyProvider propertyProvider
The PropertyProvider to use (if set).


genericExpressionFactory

protected IBasicExpressionFactory genericExpressionFactory
The default IBasicExpressionFactory to use.


propertiesExpressionFactory

protected IBasicExpressionFactory propertiesExpressionFactory
The store specific IBasicExpressionFactory for property expressions to use (if one exists).


contentExpressionFactory

protected IBasicExpressionFactory contentExpressionFactory
The store specific IBasicExpressionFactory for content expressions to use (if one exists).


alreadyTriedToInstantiate

protected boolean alreadyTriedToInstantiate
Inidicates if it has already been tried to instantiate the storeSpecificExpressionFactory.

Constructor Detail

BasicExpressionCompiler

public BasicExpressionCompiler(IBasicQuery query,
                               PropertyProvider propertyProvider)
                        throws BadQueryException
Creates the BasicExpressionCompiler, loads and inits the expression factories. If no store / indexer specific factory is defined, the generic expression factory is used.

Parameters:
query - the IBasicQuery.
propertyProvider - the PropertyProvider to use (may be null).
Method Detail

compile

public IBasicExpression compile(org.jdom.Element expressionElement)
                         throws BadQueryException
Compiles an IBasicExpression (-tree) from the given expressionElement.

Specified by:
compile in interface IBasicExpressionCompiler
Parameters:
expressionElement - the (root) expression Element to compile into an IBasicExpression.
Returns:
the compiled IBasicExpression.
Throws:
BadQueryException - if compiling the expression failed.

isMergeExpression

public static boolean isMergeExpression(org.jdom.Element expressionElement)
Returns true if the given expressionElement describes a merge expression.

Parameters:
expressionElement - the Element that describes the expression.
Returns:
true if the given expressionElement describes a merge expression.

isContentExpression

public static boolean isContentExpression(org.jdom.Element expressionElement)
Checks, if an expression is a contains expression. TODO: ask the contentIndexer, if it knows this expression (to allow proprietary extensions to DASL, for example , )

Parameters:
expressionElement - an Element
Returns:
a boolean