org.apache.derby.impl.sql.execute
Class GenericExecutionFactory

java.lang.Object
  extended by org.apache.derby.impl.sql.execute.GenericExecutionFactory
All Implemented Interfaces:
ModuleControl, ModuleSupportable, ExecutionFactory

public class GenericExecutionFactory
extends java.lang.Object
implements ModuleControl, ModuleSupportable, ExecutionFactory

This Factory is for creating the execution items needed by a connection for a given database. Once created for the connection, they should be pushed onto the execution context so that they can be found again by subsequent actions during the session.


Field Summary
private  GenericConstantActionFactory genericConstantActionFactory
           
private  ResultSetFactory rsFactory
           
private  ResultSetStatisticsFactory rssFactory
          Statistics factory for this factory.
private  XPLAINFactoryIF xplainFactory
           
 
Fields inherited from interface org.apache.derby.iapi.sql.execute.ExecutionFactory
MODULE
 
Constructor Summary
GenericExecutionFactory()
           
 
Method Summary
 void boot(boolean create, java.util.Properties startParams)
          This Factory is expected to be booted relative to a LanguageConnectionFactory.
 boolean canSupport(java.util.Properties startParams)
          See if this implementation can support any attributes that are listed in properties.
 GenericConstantActionFactory getConstantActionFactory()
          Get the factory for constant actions.
 ExecIndexRow getIndexableRow(ExecRow valueRow)
          This returns the value row as an indexable row
 ExecIndexRow getIndexableRow(int numColumns)
          This returns an indexable row
 Qualifier getQualifier(int columnId, int operator, GeneratedMethod orderableGetter, Activation activation, boolean orderedNulls, boolean unknownRV, boolean negateCompareResult, int variantType)
          Get a Qualifier to use with a scan of a conglomerate.
 ResultColumnDescriptor getResultColumnDescriptor(ResultColumnDescriptor compileRCD)
          Create an execution time ResultColumnDescriptor from a compile time RCD.
 ResultDescription getResultDescription(ResultColumnDescriptor[] columns, java.lang.String statementType)
          Make a result description
 ResultSetFactory getResultSetFactory()
          Factories are generic and can be used by all connections.
 ResultSetStatisticsFactory getResultSetStatisticsFactory()
          Get the ResultSetStatisticsFactory from this ExecutionFactory.
 RowChanger getRowChanger(long heapConglom, StaticCompiledOpenConglomInfo heapSCOCI, DynamicCompiledOpenConglomInfo heapDCOCI, IndexRowGenerator[] irgs, long[] indexCIDS, StaticCompiledOpenConglomInfo[] indexSCOCIs, DynamicCompiledOpenConglomInfo[] indexDCOCIs, int numberOfColumns, TransactionController tc, int[] changedColumnIds, FormatableBitSet baseRowReadList, int[] baseRowReadMap, int[] streamStorableColIds, Activation activation)
          Create a new RowChanger for doing insert update and delete operations based on partial before and after.
 RowChanger getRowChanger(long heapConglom, StaticCompiledOpenConglomInfo heapSCOCI, DynamicCompiledOpenConglomInfo heapDCOCI, IndexRowGenerator[] irgs, long[] indexCIDS, StaticCompiledOpenConglomInfo[] indexSCOCIs, DynamicCompiledOpenConglomInfo[] indexDCOCIs, int numberOfColumns, TransactionController tc, int[] changedColumnIds, int[] streamStorableHeapColIds, Activation activation)
          Create a new RowChanger for performing update and delete operations based on full before and after rows.
 ScanQualifier[][] getScanQualifier(int numQualifiers)
          Get an array of ScanQualifiers for a scan.
 InternalTriggerExecutionContext getTriggerExecutionContext(LanguageConnectionContext lcc, ConnectionContext cc, java.lang.String statementText, int dmlType, int[] changedColIds, java.lang.String[] changedColNames, UUID targetTableId, java.lang.String targetTableName, java.util.Vector aiCounters)
          Get a trigger execution context
 ExecRow getValueRow(int numColumns)
          This returns a new row that is storable but not indexable
 XPLAINFactoryIF getXPLAINFactory()
          Get the XPLAINFactory from this ExecutionContext.
 ExecutionContext newExecutionContext(ContextManager cm)
          We want a dependency context so that we can push it onto the stack.
 void releaseScanQualifier(ScanQualifier[][] qualifiers)
          Release a ScanQualifier[] (back to the pool or free it).
 void stop()
          Stop the module.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rssFactory

private ResultSetStatisticsFactory rssFactory
Statistics factory for this factory.


rsFactory

private ResultSetFactory rsFactory

genericConstantActionFactory

private GenericConstantActionFactory genericConstantActionFactory

xplainFactory

private XPLAINFactoryIF xplainFactory
Constructor Detail

GenericExecutionFactory

public GenericExecutionFactory()
Method Detail

canSupport

public boolean canSupport(java.util.Properties startParams)
Description copied from interface: ModuleSupportable
See if this implementation can support any attributes that are listed in properties. This call may be made on a newly created instance before the boot() method has been called, or after the boot method has been called for a running module.

The module can check for attributes in the properties to see if it can fulfill the required behaviour. E.g. the raw store may define an attribute called RawStore.Recoverable. If a temporary raw store is required the property RawStore.recoverable=false would be added to the properties before calling bootServiceModule. If a raw store cannot support this attribute its canSupport method would return null. Also see the Monitor class's prologue to see how the identifier is used in looking up properties.
Actually a better way maybe to have properties of the form RawStore.Attributes.mandatory=recoverable,smallfootprint and RawStore.Attributes.requested=oltp,fast

Specified by:
canSupport in interface ModuleSupportable
Returns:
true if this instance can be used, false otherwise.

boot

public void boot(boolean create,
                 java.util.Properties startParams)
          throws StandardException
This Factory is expected to be booted relative to a LanguageConnectionFactory.

Specified by:
boot in interface ModuleControl
Throws:
StandardException - Thrown on error
See Also:
LanguageConnectionFactory

stop

public void stop()
Description copied from interface: ModuleControl
Stop the module. The module may be found via a findModule() method until some time after this method returns. Therefore the factory must be prepared to reject requests to it once it has been stopped. In addition other modules may cache a reference to the module and make requests of it after it has been stopped, these requests should be rejected as well.

Specified by:
stop in interface ModuleControl
See Also:
Monitor, ModuleFactory

getResultSetFactory

public ResultSetFactory getResultSetFactory()
Factories are generic and can be used by all connections. We defer instantiation until needed to reduce boot time. We may instantiate too many instances in rare multi-user situation, but consistency will be maintained and at some point, usually always, we will have 1 and only 1 instance of each factory because assignment is atomic.

Specified by:
getResultSetFactory in interface ExecutionFactory
Returns:
the result set factory for this database.

getConstantActionFactory

public GenericConstantActionFactory getConstantActionFactory()
Get the factory for constant actions.

Returns:
the factory for constant actions.

getResultSetStatisticsFactory

public ResultSetStatisticsFactory getResultSetStatisticsFactory()
                                                         throws StandardException
Get the ResultSetStatisticsFactory from this ExecutionFactory.

Specified by:
getResultSetStatisticsFactory in interface ExecutionFactory
Returns:
The result set statistics factory associated with this ExecutionFactory
Throws:
StandardException - Thrown on error

newExecutionContext

public ExecutionContext newExecutionContext(ContextManager cm)
We want a dependency context so that we can push it onto the stack. We could instead require the implementation push it onto the stack for us, but this way we know which context object exactly was pushed onto the stack.

Specified by:
newExecutionContext in interface ExecutionFactory
Parameters:
cm - the context manager

getScanQualifier

public ScanQualifier[][] getScanQualifier(int numQualifiers)
Description copied from interface: ExecutionFactory
Get an array of ScanQualifiers for a scan. ScanQualifiers are used with the DataDictionary.

Specified by:
getScanQualifier in interface ExecutionFactory
Parameters:
numQualifiers - The number of ScanQualifiers to get.

getResultDescription

public ResultDescription getResultDescription(ResultColumnDescriptor[] columns,
                                              java.lang.String statementType)
Make a result description

Specified by:
getResultDescription in interface ExecutionFactory

getResultColumnDescriptor

public ResultColumnDescriptor getResultColumnDescriptor(ResultColumnDescriptor compileRCD)
Create an execution time ResultColumnDescriptor from a compile time RCD.

Specified by:
getResultColumnDescriptor in interface ExecutionFactory
Parameters:
compileRCD - The compile time RCD.
Returns:
The execution time ResultColumnDescriptor

releaseScanQualifier

public void releaseScanQualifier(ScanQualifier[][] qualifiers)
Description copied from interface: ExecutionFactory
Release a ScanQualifier[] (back to the pool or free it).

Specified by:
releaseScanQualifier in interface ExecutionFactory
See Also:
ExecutionFactory.releaseScanQualifier(org.apache.derby.iapi.sql.execute.ScanQualifier[][])

getQualifier

public Qualifier getQualifier(int columnId,
                              int operator,
                              GeneratedMethod orderableGetter,
                              Activation activation,
                              boolean orderedNulls,
                              boolean unknownRV,
                              boolean negateCompareResult,
                              int variantType)
Description copied from interface: ExecutionFactory
Get a Qualifier to use with a scan of a conglomerate.

Specified by:
getQualifier in interface ExecutionFactory
Parameters:
columnId - The store id of the column to qualify
operator - One of Orderable.ORDER_OP_EQUALS, Orderable.ORDER_OP_LESSTHAN, or Orderable.ORDER_OP_LESSOREQUALS
orderableGetter - A generated method that returns the Orderable to be compared with the column
activation - The Activation that acts as the receiver for the generated method
orderedNulls - True means that null == null for the sake of this Qualifier
unknownRV - The value to return if the comparison between the column and the Orderable value returns the unknown truth value
negateCompareResult - True means to negate the result of the comparison. So, for example, to do a > comparison, you would pass ORDER_OP_LESSOREQUALS and set negate to true.
variantType - The variantType for the qualifier's orderable. (Determines whether or not to cache the value.)
Returns:
A new Qualifier
See Also:
ExecutionFactory.getQualifier(int, int, org.apache.derby.iapi.services.loader.GeneratedMethod, org.apache.derby.iapi.sql.Activation, boolean, boolean, boolean, int)

getRowChanger

public RowChanger getRowChanger(long heapConglom,
                                StaticCompiledOpenConglomInfo heapSCOCI,
                                DynamicCompiledOpenConglomInfo heapDCOCI,
                                IndexRowGenerator[] irgs,
                                long[] indexCIDS,
                                StaticCompiledOpenConglomInfo[] indexSCOCIs,
                                DynamicCompiledOpenConglomInfo[] indexDCOCIs,
                                int numberOfColumns,
                                TransactionController tc,
                                int[] changedColumnIds,
                                int[] streamStorableHeapColIds,
                                Activation activation)
                         throws StandardException
Description copied from interface: ExecutionFactory
Create a new RowChanger for performing update and delete operations based on full before and after rows.

Specified by:
getRowChanger in interface ExecutionFactory
Parameters:
heapConglom - Conglomerate # for the heap
heapSCOCI - The SCOCI for the heap.
heapDCOCI - The DCOCI for the heap.
irgs - the IndexRowGenerators for the table's indexes. We use positions in this array as local id's for indexes. To support updates, only indexes that change need be included.
indexCIDS - the conglomerateids for the table's idexes. indexCIDS[ix] corresponds to the same index as irgs[ix].
indexSCOCIs - the SCOCIs for the table's idexes. indexSCOCIs[ix] corresponds to the same index as irgs[ix].
indexDCOCIs - the DCOCIs for the table's idexes. indexDCOCIs[ix] corresponds to the same index as irgs[ix].
numberOfColumns - Number of columns in a full row.
tc - the transaction controller
streamStorableHeapColIds - Column ids of stream storable columns. (0 based, Only needed for sync. null if none or not needed).
activation - The Activation.
Throws:
StandardException - Thrown on error
See Also:
ExecutionFactory.getRowChanger(long, org.apache.derby.iapi.store.access.StaticCompiledOpenConglomInfo, org.apache.derby.iapi.store.access.DynamicCompiledOpenConglomInfo, org.apache.derby.iapi.sql.dictionary.IndexRowGenerator[], long[], org.apache.derby.iapi.store.access.StaticCompiledOpenConglomInfo[], org.apache.derby.iapi.store.access.DynamicCompiledOpenConglomInfo[], int, org.apache.derby.iapi.store.access.TransactionController, int[], int[], org.apache.derby.iapi.sql.Activation)

getRowChanger

public RowChanger getRowChanger(long heapConglom,
                                StaticCompiledOpenConglomInfo heapSCOCI,
                                DynamicCompiledOpenConglomInfo heapDCOCI,
                                IndexRowGenerator[] irgs,
                                long[] indexCIDS,
                                StaticCompiledOpenConglomInfo[] indexSCOCIs,
                                DynamicCompiledOpenConglomInfo[] indexDCOCIs,
                                int numberOfColumns,
                                TransactionController tc,
                                int[] changedColumnIds,
                                FormatableBitSet baseRowReadList,
                                int[] baseRowReadMap,
                                int[] streamStorableColIds,
                                Activation activation)
                         throws StandardException
Description copied from interface: ExecutionFactory
Create a new RowChanger for doing insert update and delete operations based on partial before and after.

Specified by:
getRowChanger in interface ExecutionFactory
Parameters:
heapConglom - Conglomerate # for the heap
heapSCOCI - The SCOCI for the heap.
heapDCOCI - The DCOCI for the heap.
irgs - the IndexRowGenerators for the table's indexes. We use positions in this array as local id's for indexes. To support updates, only indexes that change need be included.
indexCIDS - the conglomerateids for the table's idexes. indexCIDS[ix] corresponds to the same index as irgs[ix].
indexSCOCIs - the SCOCIs for the table's idexes. indexSCOCIs[ix] corresponds to the same index as irgs[ix].
indexDCOCIs - the DCOCIs for the table's idexes. indexDCOCIs[ix] corresponds to the same index as irgs[ix].
numberOfColumns - Number of columns in partial row.
tc - the transaction controller
changedColumnIds - array of 1 based ints of columns to be updated. Used by update only.
baseRowReadList - the columns in the base row that were read (1 based)
baseRowReadMap - baseRowReadMap[heapColId]->readRowColId (0 based)
streamStorableColIds - Column ids of stream storable columns. (0 based, Only needed for sync. null if none or not needed).
activation - The Activation.
Throws:
StandardException - Thrown on error
See Also:
ExecutionFactory.getRowChanger(long, org.apache.derby.iapi.store.access.StaticCompiledOpenConglomInfo, org.apache.derby.iapi.store.access.DynamicCompiledOpenConglomInfo, org.apache.derby.iapi.sql.dictionary.IndexRowGenerator[], long[], org.apache.derby.iapi.store.access.StaticCompiledOpenConglomInfo[], org.apache.derby.iapi.store.access.DynamicCompiledOpenConglomInfo[], int, org.apache.derby.iapi.store.access.TransactionController, int[], int[], org.apache.derby.iapi.sql.Activation)

getTriggerExecutionContext

public InternalTriggerExecutionContext getTriggerExecutionContext(LanguageConnectionContext lcc,
                                                                  ConnectionContext cc,
                                                                  java.lang.String statementText,
                                                                  int dmlType,
                                                                  int[] changedColIds,
                                                                  java.lang.String[] changedColNames,
                                                                  UUID targetTableId,
                                                                  java.lang.String targetTableName,
                                                                  java.util.Vector aiCounters)
                                                           throws StandardException
Get a trigger execution context

Throws:
StandardException - Thrown on error

getValueRow

public ExecRow getValueRow(int numColumns)
Description copied from interface: ExecutionFactory
This returns a new row that is storable but not indexable

Specified by:
getValueRow in interface ExecutionFactory

getIndexableRow

public ExecIndexRow getIndexableRow(int numColumns)
Description copied from interface: ExecutionFactory
This returns an indexable row

Specified by:
getIndexableRow in interface ExecutionFactory

getIndexableRow

public ExecIndexRow getIndexableRow(ExecRow valueRow)
Description copied from interface: ExecutionFactory
This returns the value row as an indexable row

Specified by:
getIndexableRow in interface ExecutionFactory

getXPLAINFactory

public XPLAINFactoryIF getXPLAINFactory()
                                 throws StandardException
Get the XPLAINFactory from this ExecutionContext.

Specified by:
getXPLAINFactory in interface ExecutionFactory
Returns:
The XPLAINFactory associated with this ExecutionContext
Throws:
StandardException - Thrown on error

Built on Thu 2010-12-23 20:49:13+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.