com.metamatrix.query.optimizer
Interface CommandPlanner

All Known Implementing Classes:
BatchedUpdatePlanner, ProcedurePlanner, RelationalPlanner, XMLPlanner, XQueryPlanner

public interface CommandPlanner

The common interface of all planners which take a user's command object and produce a ProcessorPlan object, which is a plan for executing the query.

Implementations need to be stateless; state can be stored in the CommandTreeNode objects during planning. The main client of this interface, QueryOptimizer, will assume the planners to be stateless and therefore thread safe.


Method Summary
 void generateCanonical(CommandTreeNode rootNode, QueryMetadataInterface metadata, AnalysisRecord analysisRecord, CommandContext context)
          Requests that the planner generate the canonical plan(s) for the Command object(s) represented by the CommandTreeNode tree parameter.
 ProcessorPlan optimize(CommandTreeNode node, IDGenerator idGenerator, QueryMetadataInterface metadata, CapabilitiesFinder capFinder, AnalysisRecord analysisRecord, CommandContext context)
          Allows the planner a chance to optimize the canonical plan(s) stored in the CommandTreeNode tree.
 

Method Detail

generateCanonical

void generateCanonical(CommandTreeNode rootNode,
                       QueryMetadataInterface metadata,
                       AnalysisRecord analysisRecord,
                       CommandContext context)
                       throws QueryPlannerException,
                              QueryMetadataException,
                              MetaMatrixComponentException

Requests that the planner generate the canonical plan(s) for the Command object(s) represented by the CommandTreeNode tree parameter. The canonical plan(s) should be added to the node(s) of the tree rooted at rootNode.

It may or may not make sense for a specific implementation of this Class to create a canonical plan. It may be that all planning can be done during the call to optimize(com.metamatrix.query.optimizer.CommandTreeNode, com.metamatrix.core.id.IDGenerator, com.metamatrix.query.metadata.QueryMetadataInterface, com.metamatrix.query.optimizer.capabilities.CapabilitiesFinder, com.metamatrix.query.analysis.AnalysisRecord, com.metamatrix.query.util.CommandContext)

Parameters:
rootNode - tree of CommandTreeNode object(s) rooted at rootNode
context -
debug - whether or not to generate verbose debug output during planning
Throws:
QueryPlannerException - indicating a problem in planning
MetaMatrixComponentException - indicating an unexpected exception
QueryMetadataException

optimize

ProcessorPlan optimize(CommandTreeNode node,
                       IDGenerator idGenerator,
                       QueryMetadataInterface metadata,
                       CapabilitiesFinder capFinder,
                       AnalysisRecord analysisRecord,
                       CommandContext context)
                       throws QueryPlannerException,
                              QueryMetadataException,
                              MetaMatrixComponentException
Allows the planner a chance to optimize the canonical plan(s) stored in the CommandTreeNode tree. This method should be called in a bottom-up manner; from leaf nodes up to the root node.

Parameters:
node - root of a tree (or subtree) of CommandTreeNode objects, each of which should have its canonical plan
metadata - source of metadata
capFinder - Class usable to find the connector capabilities for a particular model
context -
debug - whether or not to generate verbose debug output during planning
Returns:
ProcessorPlan implementation specific to the CommandPlanner
Throws:
QueryPlannerException - indicating a problem in planning
QueryMetadataException - indicating an exception in accessing the metadata
MetaMatrixComponentException - indicating an unexpected exception


Copyright © 2009. All Rights Reserved.