net.sf.farrago.namespace
Interface FarragoMedDataServer

All Superinterfaces:
ClosableAllocation, FarragoAllocation
All Known Subinterfaces:
FarragoMedLocalDataServer
All Known Implementing Classes:
FlatFileDataServer, FtrsDataServer, LcsDataServer, MedAbstractDataServer, MedAbstractFennelDataServer, MedAbstractLocalDataServer, MedJdbcDataServer, MedMdrDataServer, MedMockDataServer, MedMockLocalDataServer, MedMqlDataServer

public interface FarragoMedDataServer
extends FarragoAllocation

FarragoMedDataServer defines an interface representing a server instance accessed via a FarragoMedDataWrapper.

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/namespace/FarragoMedDataServer.java#18 $
Author:
John V. Sichi

Field Summary
static String PROP_SERVER_NAME
          keyword for NAME in server properties list
static String PROP_SERVER_TYPE
          keyword for TYPE in server properties list
static String PROP_SERVER_VERSION
          keyword for VERSION in server properties list
 
Method Summary
 FarragoMedNameDirectory getNameDirectory()
          Gets a FarragoMedNameDirectory corresponding to this server.
 Object getRuntimeSupport(Object param)
          Gets an object needed for runtime support.
 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 registerRelMetadataProviders(ChainedRelMetadataProvider chain)
          Gives this wrapper a chance to register one or more RelMetadataProviders in the chain which will be used to answer relational expression metadata queries during optimization.
 void registerRules(RelOptPlanner planner)
          Gives this wrapper a chance to register any special optimization rules.
 void releaseResources()
          Gives this wrapper a chance to release any resources.
 void setLoopbackDataSource(DataSource loopbackDataSource)
          Sets a loopback DataSource which can be used to issue internal SQL queries against the containing DBMS.
 
Methods inherited from interface org.eigenbase.util.ClosableAllocation
closeAllocation
 

Field Detail

PROP_SERVER_TYPE

static final String PROP_SERVER_TYPE
keyword for TYPE in server properties list

See Also:
Constant Field Values

PROP_SERVER_VERSION

static final String PROP_SERVER_VERSION
keyword for VERSION in server properties list

See Also:
Constant Field Values

PROP_SERVER_NAME

static final String PROP_SERVER_NAME
keyword for NAME in server properties list

See Also:
Constant Field Values
Method Detail

setLoopbackDataSource

void setLoopbackDataSource(DataSource loopbackDataSource)
Sets a loopback DataSource which can be used to issue internal SQL queries against the containing DBMS. This may be called multiple times on the same server instance with different data sources; the server should use only the last one provided.

Parameters:
loopbackDataSource - a DataSource for establishing a loopback connection into Farrago, or null if loopback connections are not available in the current context

getNameDirectory

FarragoMedNameDirectory getNameDirectory()
                                         throws SQLException
Gets a FarragoMedNameDirectory corresponding to this server.

Returns:
directory, or null if this server does not have the required metadata capability
Throws:
SQLException - if directory access is unsuccessful (but not if directory access is unsupported)

newColumnSet

FarragoMedColumnSet newColumnSet(String[] localName,
                                 Properties tableProps,
                                 FarragoTypeFactory typeFactory,
                                 RelDataType rowType,
                                 Map<String,Properties> columnPropMap)
                                 throws SQLException
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.

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

getRuntimeSupport

Object getRuntimeSupport(Object param)
                         throws SQLException
Gets an object needed for runtime support. Typically, this will be called from code generated by this server. The meaning of this is entirely dependent on the server implementation. If the returned object implements FarragoAllocation, its closeAllocation() method will be called automatically as soon as it is no longer needed.

Parameters:
param - parameter supplied at runtime
Returns:
support object
Throws:
SQLException

registerRules

void registerRules(RelOptPlanner planner)
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.

Parameters:
planner - the planner in which the rules should be registered

registerRelMetadataProviders

void registerRelMetadataProviders(ChainedRelMetadataProvider chain)
Gives this wrapper a chance to register one or more RelMetadataProviders in the chain which will be used to answer relational expression metadata queries during optimization. Wrappers which define their own relational expressions will generally need to supply corresponding metadata providers.

Parameters:
chain - receives wrappers's custom providers, if any

releaseResources

void releaseResources()
Gives this wrapper a chance to release any resources.