net.sf.farrago.session
Interface FarragoSessionStmtValidator

All Superinterfaces:
ClosableAllocation, ClosableAllocationOwner, FarragoAllocation, FarragoAllocationOwner
All Known Implementing Classes:
FarragoStmtValidator, MockSessionStmtValidator

public interface FarragoSessionStmtValidator
extends FarragoAllocationOwner

FarragoSessionStmtValidator defines a generic interface for statement validation services. It is not as specific as the other validator-related interfaces (FarragoSessionDdlValidator and FarragoSessionPreparingStmt).

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/session/FarragoSessionStmtValidator.java#30 $
Author:
John V. Sichi

Method Summary
 CwmCatalog findCatalog(String catalogName)
          Looks up a catalog by name, throwing a validation error if not found.
 CwmColumn findColumn(CwmNamedColumnSet namedColumnSet, String columnName)
          Looks up a table's column by name, throwing a validation error if not found.
 FemDataServer findDataServer(SqlIdentifier serverName)
          Looks up a data server by name, throwing a validation error if not found.
 FemDataWrapper findDataWrapper(SqlIdentifier wrapperName, boolean isForeign)
          Looks up a data wrapper by name, throwing a validation error if not found.
 FemJar findJarFromLiteralName(String jarName)
          Looks up a jar from a string literal representing its name (typically from a LIBRARY clause), throwing an exception if not found.
 List<FemRoutine> findRoutineOverloads(SqlIdentifier invocationName, ProcedureType routineType)
          Looks up all matching routine overloads by invocation name.
 FemLocalSchema findSchema(SqlIdentifier schemaName)
          Looks up a schema by name, throwing a validation error if not found.
<T extends CwmModelElement>
T
findSchemaObject(SqlIdentifier qualifiedName, Class<T> clazz)
          Looks up a schema object by name, throwing a validation error if not found.
 CwmSqldataType findSqldataType(SqlIdentifier typeName)
          Looks up a SQL datatype by name, throwing an exception if not found.
<T extends CwmModelElement>
T
findUnqualifiedObject(SqlIdentifier unqualifiedName, Class<T> clazz)
          Looks up a top-level object (e.g.
 List<SqlMoniker> getAllSchemaObjectNames(List<String> names)
          Gets schema object names as specified.
 FarragoObjectCache getCodeCache()
           
 FarragoDataWrapperCache getDataWrapperCache()
           
 FarragoDdlLockManager getDdlLockManager()
           
 CwmCatalog getDefaultCatalog()
          Gets the default catalog for unqualified schema names.
 FemDataServer getDefaultLocalDataServer()
           
 FennelDbHandle getFennelDbHandle()
           
 FarragoSessionIndexMap getIndexMap()
           
 FarragoSessionParser getParser()
           
 FarragoSessionPrivilegeChecker getPrivilegeChecker()
           
 FarragoRepos getRepos()
           
 FarragoReposTxnContext getReposTxnContext()
           
 CwmNamedColumnSet getSampleDataset(CwmNamedColumnSet columnSet, String datasetName)
          Looks up a sample dataset for a given schema object, or returns null if none is found.
 FarragoSession getSession()
           
 FarragoSessionVariables getSessionVariables()
           
 FarragoObjectCache getSharedDataWrapperCache()
           
 EigenbaseTimingTracer getTimingTracer()
           
 FarragoTypeFactory getTypeFactory()
           
 FarragoWarningQueue getWarningQueue()
          Gets the warning queue to be used by this validator
 void requestPrivilege(CwmModelElement obj, String action)
          Submits a request for access from the current user and/or role to a catalog object via this validator's privilege checker.
<T extends CwmModelElement>
FarragoSessionResolvedObject<T>
resolveSchemaObjectName(String[] names, Class<T> clazz)
          Resolve a (possibly qualified) name of a schema object.
 void setParserPosition(SqlParserPos pos)
          Sets the parser position to use for context in error messages.
 void setReposTxnContext(FarragoReposTxnContext reposTxnContext)
          Sets the repository transaction context associated with this statement.
 void setTimingTracer(EigenbaseTimingTracer timingTracer)
          Sets the timing tracer associated with this statement
 void setWarningQueue(FarragoWarningQueue warningQueue)
          Sets the warning queue to be used by this validator
 void validateDataType(SqlDataTypeSpec dataType)
          Validates a data type expression.
 void validateFeature(org.eigenbase.resgen.ResourceDefinition feature, SqlParserPos context)
          Validates that a particular feature is enabled.
 
Methods inherited from interface org.eigenbase.util.ClosableAllocationOwner
addAllocation
 
Methods inherited from interface org.eigenbase.util.ClosableAllocation
closeAllocation
 
Methods inherited from interface org.eigenbase.util.ClosableAllocation
closeAllocation
 

Method Detail

getSession

FarragoSession getSession()
Returns:
session invoking stmt to be validated

getParser

FarragoSessionParser getParser()
Returns:
the parser parsing the statement being validated

getRepos

FarragoRepos getRepos()
Returns:
repos to use for validating object references

getFennelDbHandle

FennelDbHandle getFennelDbHandle()
Returns:
FennelDbHandle storing local data to be accessed by validated stmt

getTypeFactory

FarragoTypeFactory getTypeFactory()
Returns:
type factory to use for validation

getSessionVariables

FarragoSessionVariables getSessionVariables()
Returns:
connection defaults to use for validation

getCodeCache

FarragoObjectCache getCodeCache()
Returns:
cache to use for code lookups during validation

getDataWrapperCache

FarragoDataWrapperCache getDataWrapperCache()
Returns:
private cache to use for validating references to data wrappers

getIndexMap

FarragoSessionIndexMap getIndexMap()
Returns:
index map to use for validation

getSharedDataWrapperCache

FarragoObjectCache getSharedDataWrapperCache()
Returns:
shared cache to use for validating references to data wrappers

getPrivilegeChecker

FarragoSessionPrivilegeChecker getPrivilegeChecker()
Returns:
the privilege checker for this validator

getDdlLockManager

FarragoDdlLockManager getDdlLockManager()
Returns:
the DDL lock manager for this validator

getWarningQueue

FarragoWarningQueue getWarningQueue()
Gets the warning queue to be used by this validator

Returns:
warning queue

setWarningQueue

void setWarningQueue(FarragoWarningQueue warningQueue)
Sets the warning queue to be used by this validator

Parameters:
warningQueue - target queue to use

requestPrivilege

void requestPrivilege(CwmModelElement obj,
                      String action)
Submits a request for access from the current user and/or role to a catalog object via this validator's privilege checker. Actual checking of the request may be deferred.

Parameters:
obj - object to be accessed
action - the action to be performed on obj (see PrivilegedActionEnum for base set)

findColumn

CwmColumn findColumn(CwmNamedColumnSet namedColumnSet,
                     String columnName)
Looks up a table's column by name, throwing a validation error if not found.

Parameters:
namedColumnSet - the table to search
columnName - name of column to find
Returns:
column found

findCatalog

CwmCatalog findCatalog(String catalogName)
Looks up a catalog by name, throwing a validation error if not found.

Parameters:
catalogName - name of catalog to look up
Returns:
catalog found

getDefaultCatalog

CwmCatalog getDefaultCatalog()
Gets the default catalog for unqualified schema names.

Returns:
default catalog

findSchema

FemLocalSchema findSchema(SqlIdentifier schemaName)
Looks up a schema by name, throwing a validation error if not found.

Parameters:
schemaName - name of schema to look up
Returns:
schema found

findDataWrapper

FemDataWrapper findDataWrapper(SqlIdentifier wrapperName,
                               boolean isForeign)
Looks up a data wrapper by name, throwing a validation error if not found.

Parameters:
wrapperName - name of wrapper to look up (must be simple)
isForeign - true for foreign data wrapper; false for local data wrapper
Returns:
wrapper found

findDataServer

FemDataServer findDataServer(SqlIdentifier serverName)
Looks up a data server by name, throwing a validation error if not found.

Parameters:
serverName - name of server to look up (must be simple)
Returns:
server found

getDefaultLocalDataServer

FemDataServer getDefaultLocalDataServer()
Returns:
default data server to use if none specified in local table definition

findSchemaObject

<T extends CwmModelElement> T findSchemaObject(SqlIdentifier qualifiedName,
                                               Class<T> clazz)
Looks up a schema object by name, throwing a validation error if not found.

Parameters:
qualifiedName - name of object to look up
clazz - expected class of object; if the object exists with a different class, it will be treated as if it did not exist
Returns:
schema object found

findUnqualifiedObject

<T extends CwmModelElement> T findUnqualifiedObject(SqlIdentifier unqualifiedName,
                                                    Class<T> clazz)
Looks up a top-level object (e.g. a catalog) by name, throwing a validation error if not found.

Parameters:
unqualifiedName - SqlIdentifier which returns true for isSimple()
clazz - class of object to find
Returns:
object found

findRoutineOverloads

List<FemRoutine> findRoutineOverloads(SqlIdentifier invocationName,
                                      ProcedureType routineType)
Looks up all matching routine overloads by invocation name.

Parameters:
invocationName - invocation name of routine to look up
routineType - type of routine to look up, or null for any type
Returns:
list of matching FemRoutine objects (empty if no matches)

findSqldataType

CwmSqldataType findSqldataType(SqlIdentifier typeName)
Looks up a SQL datatype by name, throwing an exception if not found.

Parameters:
typeName - name of type to find
Returns:
type definition

findJarFromLiteralName

FemJar findJarFromLiteralName(String jarName)
Looks up a jar from a string literal representing its name (typically from a LIBRARY clause), throwing an exception if not found.

Parameters:
jarName - string literal representing name of jar
Returns:
jar found

resolveSchemaObjectName

<T extends CwmModelElement> FarragoSessionResolvedObject<T> resolveSchemaObjectName(String[] names,
                                                                                    Class<T> clazz)
Resolve a (possibly qualified) name of a schema object.

Parameters:
names - array of 1 or more name components, from most general to most specific
clazz - type of object to resolve
Returns:
FarragoSessionResolvedObject, or null if object definitely doesn't exist

getAllSchemaObjectNames

List<SqlMoniker> getAllSchemaObjectNames(List<String> names)
Gets schema object names as specified. They can be schema or table object. If names array contain 1 element, return all schema names and all table names under the default schema (if that is set) If names array contain 2 elements, treat 1st element as schema name and return all table names in this schema

Parameters:
names - the array contains either 2 elements representing a partially qualified object name in the format of 'schema.object', or an unqualified name in the format of 'object'
Returns:
the list of all SqlMoniker object (schema and table) names under the above criteria

setParserPosition

void setParserPosition(SqlParserPos pos)
Sets the parser position to use for context in error messages.

Parameters:
pos - new position to set, or null to clear

validateFeature

void validateFeature(org.eigenbase.resgen.ResourceDefinition feature,
                     SqlParserPos context)
Validates that a particular feature is enabled.

Parameters:
feature - feature being used, represented as a resource definition from EigenbaseResource
context - parser position context for error reporting, or null if none available

setTimingTracer

void setTimingTracer(EigenbaseTimingTracer timingTracer)
Sets the timing tracer associated with this statement

Parameters:
timingTracer - tracer to use

getTimingTracer

EigenbaseTimingTracer getTimingTracer()
Returns:
the timing tracer associated with this statement

getSampleDataset

CwmNamedColumnSet getSampleDataset(CwmNamedColumnSet columnSet,
                                   String datasetName)
Looks up a sample dataset for a given schema object, or returns null if none is found.

Parameters:
columnSet - Schema object
datasetName - Name of dataset, not null
Returns:
Sample dataset, or null if not found

validateDataType

void validateDataType(SqlDataTypeSpec dataType)
                      throws SqlValidatorException
Validates a data type expression.

Throws:
SqlValidatorException

setReposTxnContext

void setReposTxnContext(FarragoReposTxnContext reposTxnContext)
Sets the repository transaction context associated with this statement.

Parameters:
reposTxnContext - repos txn context to use

getReposTxnContext

FarragoReposTxnContext getReposTxnContext()
Returns:
the repository transaction context associated with this statement.