org.apache.slide.search.basic
Class BasicExpressionFactory

java.lang.Object
  extended byorg.apache.slide.search.basic.BasicExpressionFactory
All Implemented Interfaces:
IBasicExpressionFactory

public class BasicExpressionFactory
extends java.lang.Object
implements IBasicExpressionFactory

BasicExpressionFactory.java


Field Summary
protected  PropertyProvider propertyProvider
          The PropertyProvider to use.
protected  IBasicQuery query
          The IBasicQuery to use.
protected  ComparableResourcesPool requestedResourcePool
          The pool of resources in the given scope.
 
Fields inherited from interface org.apache.slide.search.basic.IBasicExpressionFactory
BASIC_EXPRESSION_FACTORY_CLASS
 
Constructor Summary
BasicExpressionFactory()
          Creates a BasicExpressionFactory.
BasicExpressionFactory(ComparableResourcesPool requestedResourcePool)
          Creates a BasicExpressionFactory with the given requestedResourcePool to use.
 
Method Summary
 IBasicExpression createExpression(org.jdom.Element element)
          Creates a (non-merge) expression (compare...) for the given Element.
 IBasicExpression createMergeExpression(java.lang.String name, java.lang.String namespace, java.util.Collection expressionsToMerge)
          Creates a MergeExpression for the given element (AND, OR).
 PropertyProvider getPropertyProvider()
          Returns the PropertyProvider to use (set in method init()).
 IBasicQuery getQuery()
          Returns the IBasicQuery to use (set in method init()).
protected  ComparableResourcesPool getRequestedResourcePool()
          Returns the RequestedResourcesPool to use for the query.
 void init(IBasicQuery query, PropertyProvider propertyProvider)
          Initializes the factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

requestedResourcePool

protected ComparableResourcesPool requestedResourcePool
The pool of resources in the given scope.


query

protected IBasicQuery query
The IBasicQuery to use.


propertyProvider

protected PropertyProvider propertyProvider
The PropertyProvider to use.

Constructor Detail

BasicExpressionFactory

public BasicExpressionFactory()
Creates a BasicExpressionFactory.


BasicExpressionFactory

public BasicExpressionFactory(ComparableResourcesPool requestedResourcePool)
Creates a BasicExpressionFactory with the given requestedResourcePool to use.

Parameters:
requestedResourcePool - the RequestedResourcePool to use.
Method Detail

init

public void init(IBasicQuery query,
                 PropertyProvider propertyProvider)
          throws BadQueryException
Initializes the factory. Is called exactly once and before any call to crateExpression ()

Specified by:
init in interface IBasicExpressionFactory
Parameters:
query - the IBasicQuery.
propertyProvider - the PropertyProvider to use (may be null).
Throws:
BadQueryException

getQuery

public IBasicQuery getQuery()
Returns the IBasicQuery to use (set in method init()).

Specified by:
getQuery in interface IBasicExpressionFactory
Returns:
the IBasicQuery to use.

getPropertyProvider

public PropertyProvider getPropertyProvider()
Returns the PropertyProvider to use (set in method init()).

Specified by:
getPropertyProvider in interface IBasicExpressionFactory
Returns:
the PropertyProvider to use.

createMergeExpression

public IBasicExpression createMergeExpression(java.lang.String name,
                                              java.lang.String namespace,
                                              java.util.Collection expressionsToMerge)
                                       throws BadQueryException
Creates a MergeExpression for the given element (AND, OR). The given children are the expressions to merge.

Specified by:
createMergeExpression in interface IBasicExpressionFactory
Parameters:
name - the name of the Element describing the merge expression.
namespace - the namespace of the Element describing the merge expression.
expressionsToMerge - the expressions to merge.
Returns:
an IBasicExpression
Throws:
BadQueryException

createExpression

public IBasicExpression createExpression(org.jdom.Element element)
                                  throws BadQueryException
Creates a (non-merge) expression (compare...) for the given Element.

Specified by:
createExpression in interface IBasicExpressionFactory
Parameters:
element - an Element describing the expression.
Returns:
an IBasicExpression
Throws:
BadQueryException

getRequestedResourcePool

protected ComparableResourcesPool getRequestedResourcePool()
                                                    throws BadQueryException
Returns the RequestedResourcesPool to use for the query. The pool will be created lazily, means the first time it is requested. If creation fails, a SearchException is thrown.

Returns:
the RequestedResourcesPool to use for the query.
Throws:
SerachException - if creation of the pool failed.
BadQueryException