com.metamatrix.query.processor.proc
Class ProcedurePlan

java.lang.Object
  extended by com.metamatrix.query.processor.BaseProcessorPlan
      extended by com.metamatrix.query.processor.proc.ProcedurePlan
All Implemented Interfaces:
Describable, ProcessorPlan, java.lang.Cloneable

public class ProcedurePlan
extends BaseProcessorPlan


Field Summary
 
Fields inherited from interface com.metamatrix.query.processor.Describable
PROP_BINDINGS, PROP_CHILDREN, PROP_CONDITIONS, PROP_CRITERIA, PROP_DATA_COL, PROP_DEFAULT, PROP_DEFAULT_PROGRAM, PROP_ELSE, PROP_ENCODING, PROP_EXECUTION_PLAN, PROP_EXPRESSION, PROP_FORMATTED, PROP_GROUP, PROP_GROUP_COLS, PROP_IN_MEMORY, PROP_INTO_GROUP, PROP_IS_STAGING, PROP_JOIN_CRITERIA, PROP_JOIN_STRATEGY, PROP_JOIN_TYPE, PROP_MESSAGE, PROP_MODEL_NAME, PROP_NAMESPACE, PROP_NAMESPACE_DECL, PROP_NODE_COST_ESTIMATES, PROP_NODE_STATS_LIST, PROP_NODE_STATS_PROPS, PROP_OPTIONAL, PROP_OUTPUT_COLS, PROP_PROGRAM, PROP_PROGRAMS, PROP_RECURSE_DIR, PROP_REMOVE_DUPS, PROP_RESULT_SET, PROP_ROW_LIMIT, PROP_ROW_OFFSET, PROP_SELECT_COLS, PROP_SORT_COLS, PROP_SQL, PROP_TAG, PROP_THEN, PROP_TYPE, PROP_VARIABLE
 
Constructor Summary
ProcedurePlan(Program originalProgram)
          Constructor for ProcedurePlan.
 
Method Summary
 java.lang.Object 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.Collection getChildPlans()
          Finds all nested plans and returns them.
 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()
           
 java.util.Map getDescriptionProperties()
          Get a description as a set of properties of primitive types such as String, Integer, etc.
 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)
           
 void reset()
          Reset a plan so that it can be processed again.
 boolean resultSetExists(java.lang.String rsName)
           
 void setMetadata(QueryMetadataInterface metadata)
           
 void setOutputElements(java.util.List outputElements)
           
 void setParams(java.util.Map<ElementSymbol,Expression> params)
           
 void setUpdateProcedure(boolean b)
           
protected  void terminateBatches()
           
 java.lang.String toString()
           
 
Methods inherited from class com.metamatrix.query.processor.BaseProcessorPlan
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

initialize

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

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 interface: ProcessorPlan
Reset a plan so that it can be processed again.

Specified by:
reset in interface ProcessorPlan
Overrides:
reset in class BaseProcessorPlan

getDataManager

public ProcessorDataManager getDataManager()

open

public void open()
          throws MetaMatrixProcessingException,
                 MetaMatrixComponentException
Description copied from interface: ProcessorPlan
Open the plan for processing.

Throws:
MetaMatrixComponentException
MetaMatrixProcessingException

nextBatch

public TupleBatch nextBatch()
                     throws MetaMatrixComponentException,
                            MetaMatrixProcessingException,
                            BlockedException
Description copied from interface: ProcessorPlan
Get a batch of results or possibly an Exception.

Returns:
Batch of results
Throws:
BlockedException - indicating next batch is not available yet
MetaMatrixComponentException - for non-business rule exception
MetaMatrixProcessingException - for business rule exception, related to user input or modeling
See Also:
ProcessorPlan.nextBatch()

close

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

Throws:
MetaMatrixComponentException

toString

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

clone

public java.lang.Object clone()
Description copied from interface: 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 interface ProcessorPlan
Specified by:
clone in class BaseProcessorPlan
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 java.util.Map getDescriptionProperties()
Description copied from interface: Describable
Get a description as a set of properties of primitive types such as String, Integer, etc.

Returns:
Map of properties

getChildPlans

public java.util.Collection getChildPlans()
Description copied from interface: ProcessorPlan
Finds all nested plans and returns them.

Returns:
List of ProcessorPlan
Since:
4.2
See Also:
ProcessorPlan.getChildPlans()

setMetadata

public void setMetadata(QueryMetadataInterface metadata)

setParams

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

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)
                 throws MetaMatrixComponentException,
                        MetaMatrixProcessingException
Throws:
MetaMatrixComponentException
MetaMatrixProcessingException

pop

public void pop()
         throws MetaMatrixComponentException
Throws:
MetaMatrixComponentException
See Also:
com.metamatrix.query.processor.program.ProgramEnvironment#pop()

push

public void push(Program program)
See Also:
com.metamatrix.query.processor.program.ProgramEnvironment#push(com.metamatrix.query.processor.program.Program)

incrementProgramCounter

public void incrementProgramCounter()
                             throws MetaMatrixComponentException
Throws:
MetaMatrixComponentException
See Also:
com.metamatrix.query.processor.program.ProgramEnvironment#incrementProgramCounter()

getTempContext

public java.util.Set getTempContext()

getCurrentRow

public java.util.List getCurrentRow(java.lang.String rsName)

iterateCursor

public boolean iterateCursor(java.lang.String rsName)
                      throws MetaMatrixComponentException,
                             MetaMatrixProcessingException
Throws:
MetaMatrixComponentException
MetaMatrixProcessingException

removeResults

public void removeResults(java.lang.String rsName)
                   throws MetaMatrixComponentException
Throws:
MetaMatrixComponentException

getSchema

public java.util.List getSchema(java.lang.String rsName)
                         throws MetaMatrixComponentException
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
MetaMatrixComponentException

resultSetExists

public boolean resultSetExists(java.lang.String rsName)

getContext

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

Specified by:
getContext in interface ProcessorPlan
Overrides:
getContext in class BaseProcessorPlan
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 interface: ProcessorPlan
Get list of resolved elements describing output columns for this plan.

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()


Copyright © 2009. All Rights Reserved.