net.sf.farrago.namespace.mock
Class MedMockLocalDataServer

java.lang.Object
  extended by net.sf.farrago.plugin.FarragoAbstractPluginBase
      extended by net.sf.farrago.namespace.impl.MedAbstractBase
          extended by net.sf.farrago.namespace.impl.MedAbstractDataServer
              extended by net.sf.farrago.namespace.mock.MedMockDataServer
                  extended by net.sf.farrago.namespace.mock.MedMockLocalDataServer
All Implemented Interfaces:
FarragoMedDataServer, FarragoMedLocalDataServer, FarragoAllocation, ClosableAllocation

 class MedMockLocalDataServer
extends MedMockDataServer
implements FarragoMedLocalDataServer

MedMockLocalDataServer provides a mock implementation of the FarragoMedLocalDataServer interface.

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/namespace/mock/MedMockLocalDataServer.java#24 $
Author:
John V. Sichi

Field Summary
 
Fields inherited from class net.sf.farrago.namespace.mock.MedMockDataServer
DEFAULT_EXTRACT_COLUMNS, extractColumns, PROP_EXECUTOR_IMPL, PROP_EXTRACT_COLUMNS, PROP_ROW_COUNT, PROP_ROW_COUNT_SQL, PROP_SCHEMA_NAME, PROP_SIMULATE_BAD, PROP_TABLE_NAME, PROP_UDX_SPECIFIC_NAME, PROPVAL_FENNEL, PROPVAL_JAVA
 
Fields inherited from class net.sf.farrago.plugin.FarragoAbstractPluginBase
BOOLEAN_CHOICES_DEFAULT_FALSE, BOOLEAN_CHOICES_DEFAULT_TRUE, EMPTY_DRIVER_PROPERTIES
 
Fields inherited from interface net.sf.farrago.namespace.FarragoMedDataServer
PROP_SERVER_NAME, PROP_SERVER_TYPE, PROP_SERVER_VERSION
 
Constructor Summary
MedMockLocalDataServer(MedAbstractDataWrapper wrapper, String serverMofId, Properties props)
           
 
Method Summary
 FarragoMedLocalIndexStats computeIndexStats(FemLocalIndex index, long rootPageId, boolean estimate, FennelTxnContext txnContext)
          Verifies an index and returns its page count.
 RelNode constructIndexBuildPlan(RelOptTable table, FemLocalIndex index, RelOptCluster cluster)
          Creates a plan for loading existing rows of a table into an index.
 long createIndex(FemLocalIndex index, FennelTxnContext txnContext)
          Creates an index.
 void dropIndex(FemLocalIndex index, long rootPageId, boolean truncate, FennelTxnContext txnContext)
          Drops or truncates an index.
 FarragoMedColumnSet newColumnSet(String[] localName, Properties tableProps, FarragoTypeFactory typeFactory, RelDataType rowType, Map<String,Properties> columnPropMap)
          Creates an instance of a FarragoMedColumnSet corresponding to row data identified by properties rather than container name.
 void registerRules(RelOptPlanner planner)
          Gives this wrapper a chance to register any special optimization rules.
 void setFennelDbHandle(FennelDbHandle fennelDbHandle)
          Sets the Fennel database handle to use for accessing local storage.
 boolean supportsAlterTableAddColumn()
          Checks whether ALTER TABLE ADD COLUMN is implemented for tables stored by this local data server.
 void validateTableDefinition(FemLocalTable table, FemLocalIndex generatedPrimaryKeyIndex)
          Validates the definition of a table being created.
 void validateTableDefinition(FemLocalTable table, FemLocalIndex generatedPrimaryKeyIndex, boolean creation)
          Validates the definition of a table being created.
 void versionIndexRoot(Long oldRoot, Long newRoot, FennelTxnContext txnContext)
          Versions the root page of an index
 
Methods inherited from class net.sf.farrago.namespace.mock.MedMockDataServer
closeAllocation, createMockColumnType, createMockRowType, getForeignSchemaName, getForeignTableName, getNameDirectory, getRuntimeSupport, getWrapper, initialize
 
Methods inherited from class net.sf.farrago.namespace.impl.MedAbstractDataServer
getLoopbackDataSource, getProperties, getServerMofId, registerRelMetadataProviders, releaseResources, setLoopbackDataSource
 
Methods inherited from class net.sf.farrago.plugin.FarragoAbstractPluginBase
getBooleanProperty, getByteProperty, getDoubleProperty, getFloatProperty, getIntProperty, getLongProperty, getShortProperty, requireProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.farrago.namespace.FarragoMedDataServer
getNameDirectory, getRuntimeSupport, registerRelMetadataProviders, releaseResources, setLoopbackDataSource
 
Methods inherited from interface org.eigenbase.util.ClosableAllocation
closeAllocation
 

Constructor Detail

MedMockLocalDataServer

MedMockLocalDataServer(MedAbstractDataWrapper wrapper,
                       String serverMofId,
                       Properties props)
Method Detail

setFennelDbHandle

public void setFennelDbHandle(FennelDbHandle fennelDbHandle)
Description copied from interface: FarragoMedLocalDataServer
Sets the Fennel database handle to use for accessing local storage.

Specified by:
setFennelDbHandle in interface FarragoMedLocalDataServer
Parameters:
fennelDbHandle - the handle to use

validateTableDefinition

public void validateTableDefinition(FemLocalTable table,
                                    FemLocalIndex generatedPrimaryKeyIndex)
                             throws SQLException
Description copied from interface: FarragoMedLocalDataServer
Validates the definition of a table being created. May have side-effects such as creating additional system-maintained indexes.

Specified by:
validateTableDefinition in interface FarragoMedLocalDataServer
Parameters:
table - definition of the table being created
generatedPrimaryKeyIndex - if non-null, a reference to an index generated by the system to enforce the primary key
Throws:
SQLException

validateTableDefinition

public void validateTableDefinition(FemLocalTable table,
                                    FemLocalIndex generatedPrimaryKeyIndex,
                                    boolean creation)
                             throws SQLException
Description copied from interface: FarragoMedLocalDataServer
Validates the definition of a table being created. May have side-effects such as creating additional system-maintained indexes.

Specified by:
validateTableDefinition in interface FarragoMedLocalDataServer
Parameters:
table - definition of the table being created
generatedPrimaryKeyIndex - if non-null, a reference to an index generated by the system to enforce the primary key
creation - true if the table being validated is being newly created
Throws:
SQLException

createIndex

public long createIndex(FemLocalIndex index,
                        FennelTxnContext txnContext)
                 throws SQLException
Description copied from interface: FarragoMedLocalDataServer
Creates an index.

Specified by:
createIndex in interface FarragoMedLocalDataServer
Parameters:
index - definition of the index to create
txnContext - Fennel txn context
Returns:
root PageId of index
Throws:
SQLException

dropIndex

public void dropIndex(FemLocalIndex index,
                      long rootPageId,
                      boolean truncate,
                      FennelTxnContext txnContext)
               throws SQLException
Description copied from interface: FarragoMedLocalDataServer
Drops or truncates an index.

Specified by:
dropIndex in interface FarragoMedLocalDataServer
Parameters:
index - definition of the index to drop
rootPageId - root PageId of index
truncate - if true, only truncate storage; if false, drop storage entirely
txnContext - Fennel txn context
Throws:
SQLException

computeIndexStats

public FarragoMedLocalIndexStats computeIndexStats(FemLocalIndex index,
                                                   long rootPageId,
                                                   boolean estimate,
                                                   FennelTxnContext txnContext)
                                            throws SQLException
Description copied from interface: FarragoMedLocalDataServer
Verifies an index and returns its page count.

Specified by:
computeIndexStats in interface FarragoMedLocalDataServer
Parameters:
index - definition of the index to verify
rootPageId - root PageId of index
estimate - whether to estimate statistics for a quicker result (and at the cost of no unique key count)
txnContext - Fennel txn context
Returns:
index statistics for the specified index
Throws:
SQLException

registerRules

public void registerRules(RelOptPlanner planner)
Description copied from interface: FarragoMedDataServer
Gives this wrapper a chance to register any special optimization rules. This method may be called more than once, each time with a different planner instance.

Specified by:
registerRules in interface FarragoMedDataServer
Overrides:
registerRules in class MedMockDataServer
Parameters:
planner - the planner in which the rules should be registered

newColumnSet

public FarragoMedColumnSet newColumnSet(String[] localName,
                                        Properties tableProps,
                                        FarragoTypeFactory typeFactory,
                                        RelDataType rowType,
                                        Map<String,Properties> columnPropMap)
                                 throws SQLException
Description copied from interface: FarragoMedDataServer
Creates an instance of a FarragoMedColumnSet corresponding to row data identified by properties rather than container name. This supports the SQL/MED CREATE FOREIGN TABLE statement. As much validation as possible should be performed, including accessing representative data.

Specified by:
newColumnSet in interface FarragoMedDataServer
Overrides:
newColumnSet in class MedMockDataServer
Parameters:
localName - the qualified name to assign to the column set within Farrago; this should NOT be used for finding the actual data, since it can be set arbitrarily by the caller; instead, it should be used to implement the RelOptTable.getQualifiedName() method, and can be useful for correlation during debugging
tableProps - properties to use for data location and access
typeFactory - FarragoTypeFactory to use for defining types
rowType - type to impose on the rows of this column set (including column names and types), or null to infer row type; if this is non-null, it must be saved for use by the getRowType() returned from FarragoMedColumnSet
columnPropMap - map from column name to column-specific Properties; this is optional and may only be specified when rowType is also specified (the field names in rowType are used as the keys for columnPropMap)
Returns:
new FarragoMedColumnSet
Throws:
SQLException - if data access is unsuccessful

constructIndexBuildPlan

public RelNode constructIndexBuildPlan(RelOptTable table,
                                       FemLocalIndex index,
                                       RelOptCluster cluster)
Description copied from interface: FarragoMedLocalDataServer
Creates a plan for loading existing rows of a table into an index. Typically, the topmost node of this plan will be a FarragoIndexBuilderRel, and this plugin will supply a rule which transforms that into a corresponding physical rel for writing to the index. Where possible, the returned plan should consist of logical rels, increasing optimization potential.

Specified by:
constructIndexBuildPlan in interface FarragoMedLocalDataServer
Parameters:
table - the optimizer representation for the indexed table
index - the index to be loaded
cluster - container for newly created relational expressions
Returns:
plan which will be used as input to optimization

versionIndexRoot

public void versionIndexRoot(Long oldRoot,
                             Long newRoot,
                             FennelTxnContext txnContext)
                      throws SQLException
Description copied from interface: FarragoMedLocalDataServer
Versions the root page of an index

Specified by:
versionIndexRoot in interface FarragoMedLocalDataServer
Parameters:
oldRoot - original root page
newRoot - new versioned, root page
txnContext - Fennel txn context
Throws:
SQLException

supportsAlterTableAddColumn

public boolean supportsAlterTableAddColumn()
Description copied from interface: FarragoMedLocalDataServer
Checks whether ALTER TABLE ADD COLUMN is implemented for tables stored by this local data server.

Specified by:
supportsAlterTableAddColumn in interface FarragoMedLocalDataServer
Returns:
whether ALTER TABLE ADD COLUMN can be executed