org.teiid.query.processor
Class ProcessorPlan

java.lang.Object
  extended by org.teiid.query.processor.ProcessorPlan
All Implemented Interfaces:
java.lang.Cloneable, BatchCollector.BatchProducer
Direct Known Subclasses:
BatchedUpdatePlan, ProcedurePlan, RelationalPlan, XMLPlan

public abstract class ProcessorPlan
extends java.lang.Object
implements java.lang.Cloneable, BatchCollector.BatchProducer

This class represents a processor plan. It is generic in that it abstracts the interface to the plan by the processor, meaning that the actual implementation of the plan or the types of processing done by the plan is not important to the processor.

All the implementations of this interface need to implement clone() method. The plan is only clonable in the pre or post-processing stage, not during the processing state (things like program state, result sets, etc). It's only safe to clone in between query processings. In other words, it's only safe to call clone() before the call to open() or after the call to close().


Constructor Summary
ProcessorPlan()
           
 
Method Summary
protected  void addWarning(TeiidException warning)
           
abstract  ProcessorPlan clone()
          Return a safe clone of the ProcessorPlan.
abstract  void close()
          Close the plan after processing.
 java.util.List<java.lang.Exception> getAndClearWarnings()
          Get all warnings found while processing this plan.
 CommandContext getContext()
          Get the processor context, which can be modified.
 PlanNode getDescriptionProperties()
           
abstract  java.util.List getOutputElements()
          Get list of resolved elements describing output columns for this plan.
abstract  void initialize(CommandContext context, ProcessorDataManager dataMgr, BufferManager bufferMgr)
          Initialize the plan with some required pieces of data for making queries.
abstract  TupleBatch nextBatch()
          Get a batch of results or possibly an Exception.
abstract  void open()
          Open the plan for processing.
 boolean requiresTransaction(boolean transactionalReads)
           
 void reset()
          Reset a plan so that it can be processed again.
 void setContext(CommandContext context)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProcessorPlan

public ProcessorPlan()
Method Detail

initialize

public abstract void initialize(CommandContext context,
                                ProcessorDataManager dataMgr,
                                BufferManager bufferMgr)
Initialize the plan with some required pieces of data for making queries. The data manager is used to make queries and the processorID must be passed with the request so the data manager can find the processor again.

Parameters:
context - Process execution context
dataMgr - Data manager reference
bufferMgr - Buffer manager reference

getAndClearWarnings

public java.util.List<java.lang.Exception> getAndClearWarnings()
Get all warnings found while processing this plan. These warnings may be detected throughout the plan lifetime, which means new ones may arrive at any time. This method returns all current warnings and clears the current warnings list. The warnings are in order they were detected.

Returns:
Current list of warnings, never null

addWarning

protected void addWarning(TeiidException warning)

reset

public void reset()
Reset a plan so that it can be processed again.


getOutputElements

public abstract java.util.List getOutputElements()
Get list of resolved elements describing output columns for this plan.

Specified by:
getOutputElements in interface BatchCollector.BatchProducer
Returns:
List of SingleElementSymbol

getContext

public CommandContext getContext()
Get the processor context, which can be modified.

Returns:
context object

setContext

public void setContext(CommandContext context)

open

public abstract void open()
                   throws TeiidComponentException,
                          TeiidProcessingException
Open the plan for processing.

Throws:
TeiidComponentException
TeiidProcessingException

nextBatch

public abstract TupleBatch nextBatch()
                              throws BlockedException,
                                     TeiidComponentException,
                                     TeiidProcessingException
Get a batch of results or possibly an Exception.

Specified by:
nextBatch in interface BatchCollector.BatchProducer
Returns:
Batch of results
Throws:
BlockedException - indicating next batch is not available yet
TeiidComponentException - for non-business rule exception
TeiidProcessingException - for business rule exception, related to user input or modeling

close

public abstract void close()
                    throws TeiidComponentException
Close the plan after processing.

Throws:
TeiidComponentException

clone

public abstract ProcessorPlan clone()
Return a safe clone of the ProcessorPlan. A ProcessorPlan may only be safely cloned in between processings. That is, it is only safe to clone a plan before it is opened or after it is closed.

Overrides:
clone in class java.lang.Object
Returns:
safe clone of this ProcessorPlan, as long as it is not open for processing

requiresTransaction

public boolean requiresTransaction(boolean transactionalReads)

getDescriptionProperties

public PlanNode getDescriptionProperties()


Copyright © 2010. All Rights Reserved.