org.teiid.query.processor.proc
Class ProcedurePlan

java.lang.Object
  extended by org.teiid.query.processor.ProcessorPlan
      extended by org.teiid.query.processor.proc.ProcedurePlan
All Implemented Interfaces:
java.lang.Cloneable, BatchCollector.BatchProducer

public class ProcedurePlan
extends ProcessorPlan


Constructor Summary
ProcedurePlan(Program originalProgram)
          Constructor for ProcedurePlan.
 
Method Summary
 ProcessorPlan clone()
          Return a safe clone of the ProcessorPlan.
 void close()
          Close the plan after processing.
 void executePlan(ProcessorPlan command, java.lang.String rsName, java.util.Map<ElementSymbol,ElementSymbol> procAssignments, boolean keepRs)
           
 CommandContext getContext()
          Get the processor context, which can be modified.
 java.util.List getCurrentRow(java.lang.String rsName)
           
 VariableContext getCurrentVariableContext()
           Get the current VariavleContext on this environment.
 ProcessorDataManager getDataManager()
           
 PlanNode getDescriptionProperties()
           
 Program getOriginalProgram()
           
 java.util.List getOutputElements()
          Get list of resolved elements describing output columns for this plan.
 java.util.List getSchema(java.lang.String rsName)
          Get the schema from the tuple source that represents the columns in a result set
 java.util.Set getTempContext()
           
 TempTableStore getTempTableStore()
           
 void incrementProgramCounter()
           
 void initialize(CommandContext context, ProcessorDataManager dataMgr, BufferManager bufferMgr)
          Initialize the plan with some required pieces of data for making queries.
protected  boolean isBatchFull()
           
 boolean isUpdateProcedure()
           
 boolean iterateCursor(java.lang.String rsName)
           
 TupleBatch nextBatch()
          Get a batch of results or possibly an Exception.
 void open()
          Open the plan for processing.
 Program peek()
           
 void pop()
           
protected  TupleBatch pullBatch()
           
 void push(Program program)
           
 void removeResults(java.lang.String rsName)
           
 boolean requiresTransaction(boolean transactionalReads)
           
 void reset()
          Reset a plan so that it can be processed again.
 boolean resultSetExists(java.lang.String rsName)
           
 void setImplicitParams(java.util.Map<ElementSymbol,Reference> implicitParams)
           
 void setMetadata(QueryMetadataInterface metadata)
           
 void setOutputElements(java.util.List outputElements)
           
protected  void setParameterValue(ElementSymbol param, VariableContext context, java.lang.Object value)
           
 void setParams(java.util.LinkedHashMap<ElementSymbol,Expression> params)
           
 void setRequiresTransaction(boolean requiresTransaction)
           
 void setUpdateProcedure(boolean b)
           
protected  void terminateBatches()
           
 java.lang.String toString()
           
 
Methods inherited from class org.teiid.query.processor.ProcessorPlan
addWarning, getAndClearWarnings, setContext
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProcedurePlan

public ProcedurePlan(Program originalProgram)
Constructor for ProcedurePlan.

Method Detail

getOriginalProgram

public Program getOriginalProgram()

initialize

public void initialize(CommandContext context,
                       ProcessorDataManager dataMgr,
                       BufferManager bufferMgr)
Description copied from class: ProcessorPlan
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.

Specified by:
initialize in class ProcessorPlan
Parameters:
context - Process execution context
dataMgr - Data manager reference
bufferMgr - Buffer manager reference
See Also:
ProcessorPlan#initialize(ProcessorDataManager, Object)

reset

public void reset()
Description copied from class: ProcessorPlan
Reset a plan so that it can be processed again.

Overrides:
reset in class ProcessorPlan

getDataManager

public ProcessorDataManager getDataManager()

open

public void open()
          throws TeiidProcessingException,
                 TeiidComponentException
Description copied from class: ProcessorPlan
Open the plan for processing.

Specified by:
open in class ProcessorPlan
Throws:
TeiidComponentException
TeiidProcessingException

setParameterValue

protected void setParameterValue(ElementSymbol param,
                                 VariableContext context,
                                 java.lang.Object value)

nextBatch

public TupleBatch nextBatch()
                     throws TeiidComponentException,
                            TeiidProcessingException,
                            BlockedException
Description copied from class: ProcessorPlan
Get a batch of results or possibly an Exception.

Specified by:
nextBatch in interface BatchCollector.BatchProducer
Specified by:
nextBatch in class ProcessorPlan
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
See Also:
ProcessorPlan.nextBatch()

close

public void close()
           throws TeiidComponentException
Description copied from class: ProcessorPlan
Close the plan after processing.

Specified by:
close in class ProcessorPlan
Throws:
TeiidComponentException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

clone

public ProcessorPlan clone()
Description copied from class: ProcessorPlan
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.

Specified by:
clone in class ProcessorPlan
Returns:
safe clone of this ProcessorPlan, as long as it is not open for processing

terminateBatches

protected void terminateBatches()

isBatchFull

protected boolean isBatchFull()

pullBatch

protected TupleBatch pullBatch()

getDescriptionProperties

public PlanNode getDescriptionProperties()
Overrides:
getDescriptionProperties in class ProcessorPlan

setMetadata

public void setMetadata(QueryMetadataInterface metadata)

setParams

public void setParams(java.util.LinkedHashMap<ElementSymbol,Expression> params)

setImplicitParams

public void setImplicitParams(java.util.Map<ElementSymbol,Reference> implicitParams)

getCurrentVariableContext

public VariableContext getCurrentVariableContext()

Get the current VariavleContext on this environment. The VariableContext is updated with variables and their values by ProgramInstructions that are part of the ProcedurePlan that use this environment.

Returns:
The current VariariableContext.

executePlan

public void executePlan(ProcessorPlan command,
                        java.lang.String rsName,
                        java.util.Map<ElementSymbol,ElementSymbol> procAssignments,
                        boolean keepRs)
                 throws TeiidComponentException,
                        TeiidProcessingException
Throws:
TeiidComponentException
TeiidProcessingException

pop

public void pop()
         throws TeiidComponentException
Throws:
TeiidComponentException

push

public void push(Program program)

incrementProgramCounter

public void incrementProgramCounter()
                             throws TeiidComponentException
Throws:
TeiidComponentException

getTempContext

public java.util.Set getTempContext()

getCurrentRow

public java.util.List getCurrentRow(java.lang.String rsName)
                             throws TeiidComponentException
Throws:
TeiidComponentException

iterateCursor

public boolean iterateCursor(java.lang.String rsName)
                      throws TeiidComponentException,
                             TeiidProcessingException
Throws:
TeiidComponentException
TeiidProcessingException

removeResults

public void removeResults(java.lang.String rsName)

getSchema

public java.util.List getSchema(java.lang.String rsName)
                         throws TeiidComponentException
Get the schema from the tuple source that represents the columns in a result set

Parameters:
rsName - the ResultSet name (not a temp group)
Returns:
List of elements
Throws:
QueryProcessorException - if the list of elements is null
TeiidComponentException

resultSetExists

public boolean resultSetExists(java.lang.String rsName)

getContext

public CommandContext getContext()
Description copied from class: ProcessorPlan
Get the processor context, which can be modified.

Overrides:
getContext in class ProcessorPlan
Returns:
context object

isUpdateProcedure

public boolean isUpdateProcedure()
Returns:

setUpdateProcedure

public void setUpdateProcedure(boolean b)
Parameters:
b -

getOutputElements

public java.util.List getOutputElements()
Description copied from class: ProcessorPlan
Get list of resolved elements describing output columns for this plan.

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

setOutputElements

public void setOutputElements(java.util.List outputElements)

getTempTableStore

public TempTableStore getTempTableStore()
Returns:
Returns the tempTableStore.
Since:
5.5

peek

public Program peek()

setRequiresTransaction

public void setRequiresTransaction(boolean requiresTransaction)

requiresTransaction

public boolean requiresTransaction(boolean transactionalReads)
Overrides:
requiresTransaction in class ProcessorPlan


Copyright © 2010. All Rights Reserved.