|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.modeshape.graph.query.process.QueryProcessor
public abstract class QueryProcessor
An abstract Processor
implementation that builds a tree of ProcessingComponent
objects to perform the different
parts of the query processing logic. Subclasses are required to only implement one method: the
#createAccessComponent(QueryCommand,QueryContext, PlanNode, Columns, Analyzer)
should create a ProcessorComponent
object that will perform the (low-level access) query described by the plan
given as a parameter.
Constructor Summary | |
---|---|
QueryProcessor()
|
Method Summary | |
---|---|
protected abstract ProcessingComponent |
createAccessComponent(QueryCommand originalQuery,
QueryContext context,
PlanNode accessNode,
QueryResults.Columns resultColumns,
SelectComponent.Analyzer analyzer)
Create the ProcessingComponent that processes a single PlanNode.Type.ACCESS branch of a query plan. |
protected SelectComponent.Analyzer |
createAnalyzer(QueryContext context)
Create an SelectComponent.Analyzer implementation that should be used by the non-access ProcessingComponent s that evaluate
criteria. |
protected ProcessingComponent |
createComponent(QueryCommand originalQuery,
QueryContext context,
PlanNode node,
QueryResults.Columns columns,
SelectComponent.Analyzer analyzer)
Method that is called to build up the ProcessingComponent objects that correspond to the optimized query plan. |
QueryResults |
execute(QueryContext context,
QueryCommand command,
QueryResults.Statistics statistics,
PlanNode plan)
Process the supplied query plan for the given command and return the results. |
protected void |
postExecute(QueryContext context)
A method that can be overridden when a hook is required immediately after the top-level ProcessingComponent is
executed and all processing has been completed, even if there was an error. |
protected void |
preExecute(QueryContext context)
A method that can be overridden when a hook is required immediately before the top-level ProcessingComponent is
executed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public QueryProcessor()
Method Detail |
---|
public QueryResults execute(QueryContext context, QueryCommand command, QueryResults.Statistics statistics, PlanNode plan)
execute
in interface Processor
context
- the context in which the command is being processedcommand
- the command being executedstatistics
- the time metrics up until this executionplan
- the plan to be processed
Processor.execute(org.modeshape.graph.query.QueryContext,
org.modeshape.graph.query.model.QueryCommand, org.modeshape.graph.query.QueryResults.Statistics,
org.modeshape.graph.query.plan.PlanNode)
protected void preExecute(QueryContext context)
ProcessingComponent
is
executed. By default, this method does nothing.
context
- the context in which the query is being executed; may not be nullprotected void postExecute(QueryContext context)
ProcessingComponent
is
executed and all processing has been completed, even if there was an error. By default, this method does nothing.
context
- the context in which the query is being executed; may not be nullprotected SelectComponent.Analyzer createAnalyzer(QueryContext context)
SelectComponent.Analyzer
implementation that should be used by the non-access ProcessingComponent
s that evaluate
criteria. By default, this method returns null, which means that any criteria evaluation will likely be pushed down under
an ACCESS
node (and thus handled by an
access component
.
However, for more simple access components that are not capable of handling joins and other non-trivial criteria, simply return an Analyzer implementation that implements the methods using the source.
context
- the context in which query is being evaluated
protected abstract ProcessingComponent createAccessComponent(QueryCommand originalQuery, QueryContext context, PlanNode accessNode, QueryResults.Columns resultColumns, SelectComponent.Analyzer analyzer)
ProcessingComponent
that processes a single PlanNode.Type.ACCESS
branch of a query plan.
originalQuery
- the original query that is being executed; never nullcontext
- the context in which query is being evaluated; never nullaccessNode
- the node in the query plan that represents the PlanNode.Type.ACCESS
plan; never nullresultColumns
- the columns that are to be returned; never nullanalyzer
- the criteria analyzer; never null
protected ProcessingComponent createComponent(QueryCommand originalQuery, QueryContext context, PlanNode node, QueryResults.Columns columns, SelectComponent.Analyzer analyzer)
ProcessingComponent
objects that correspond to the optimized query plan. This
method is called by #execute(QueryContext, QueryCommand, Statistics, PlanNode)
for each of the various
PlanNode
objects in the optimized query plan, and the method is actually recursive (since the optimized query plan
forms a tree). However, whenever this call structure reaches the ACCESS
nodes in the query plan (which
each represents a separate atomic low-level query to the underlying system), the
#createAccessComponent(QueryCommand,QueryContext, PlanNode, Columns, Analyzer)
method is called. Subclasses should
create an appropriate ProcessingComponent implementation that performs this atomic low-level query.
originalQuery
- the original query that is being executed; never nullcontext
- the context in which query is being evaluatednode
- the plan node for which the ProcessingComponent is to be createdcolumns
- the definition of the result columns for this portion of the queryanalyzer
- the analyzer (returned from createAnalyzer(QueryContext)
) that should be used on the components
that evaluate criteria; may be null if a best-effort should be made for the evaluation
problems
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |