|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.eigenbase.util.CompoundClosableAllocation
net.sf.farrago.util.FarragoCompoundAllocation
net.sf.farrago.query.FarragoStmtValidator
public class FarragoStmtValidator
FarragoStmtValidator is a default implementation of the FarragoSessionStmtValidator interface.
| Field Summary | |
|---|---|
private FarragoObjectCache |
codeCache
|
private FemRole |
currentRole
|
private FemUser |
currentUser
|
private FarragoDataWrapperCache |
dataWrapperCache
|
private FarragoDdlLockManager |
ddlLockManager
|
private FennelDbHandle |
fennelDbHandle
|
private FarragoSessionIndexMap |
indexMap
|
private FarragoSessionParser |
parser
|
private SqlParserPos |
parserPos
|
private FarragoSessionPrivilegeChecker |
privilegeChecker
|
private FarragoRepos |
repos
|
private FarragoReposTxnContext |
reposTxnContext
|
private FarragoSession |
session
|
private FarragoSessionVariables |
sessionVariables
|
private FarragoObjectCache |
sharedDataWrapperCache
|
private Map<String,CwmSqldataType> |
sqldataTypeCache
|
private EigenbaseTimingTracer |
timingTracer
|
private FarragoTypeFactory |
typeFactory
|
private FarragoWarningQueue |
warningQueue
|
| Fields inherited from class org.eigenbase.util.CompoundClosableAllocation |
|---|
allocations |
| Constructor Summary | |
|---|---|
FarragoStmtValidator(FarragoRepos repos,
FennelDbHandle fennelDbHandle,
FarragoSession session,
FarragoObjectCache codeCache,
FarragoObjectCache sharedDataWrapperCache,
FarragoSessionIndexMap indexMap,
FarragoDdlLockManager ddlLockManager)
Creates a new FarragoStmtValidator object. |
|
| Method Summary | ||
|---|---|---|
private void |
checkValidated(CwmModelElement element)
|
|
void |
closeAllocation()
Closes this object. |
|
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. |
|
private RefClass |
findRefClass(Class<? extends RefObject> clazz)
|
|
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. |
|
|
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. |
|
private CwmSqldataType |
findSqldataTypeImpl(SqlIdentifier typeName)
|
|
|
findUnqualifiedObject(SqlIdentifier unqualifiedName,
Class<T> clazz)
Looks up a top-level object (e.g. |
|
private List<SqlMoniker> |
getAllObjectNamesByType(Collection<CwmModelElement> collection,
Class<? extends CwmModelElement> type)
Returns a list of all object names of a given type in a collection. |
|
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 |
|
private CwmCatalog |
lookupCatalog(String catalogName,
boolean throwIfNotFound)
|
|
private FemLocalSchema |
lookupSchema(SqlIdentifier schemaName,
boolean throwIfNotFound)
|
|
private EigenbaseException |
newPositionalError(SqlValidatorException ex)
|
|
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. |
|
|
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 class org.eigenbase.util.CompoundClosableAllocation |
|---|
addAllocation, forgetAllocation, hasAllocations |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.eigenbase.util.ClosableAllocationOwner |
|---|
addAllocation |
| Field Detail |
|---|
private final FarragoRepos repos
private final FennelDbHandle fennelDbHandle
private final FarragoSession session
private final FarragoTypeFactory typeFactory
private final FarragoSessionVariables sessionVariables
private final FarragoObjectCache codeCache
private final FarragoDataWrapperCache dataWrapperCache
private final FarragoSessionIndexMap indexMap
private final FarragoObjectCache sharedDataWrapperCache
private final FarragoSessionParser parser
private final FarragoSessionPrivilegeChecker privilegeChecker
private final FarragoDdlLockManager ddlLockManager
private SqlParserPos parserPos
private EigenbaseTimingTracer timingTracer
private FarragoReposTxnContext reposTxnContext
private FarragoWarningQueue warningQueue
private FemUser currentUser
private FemRole currentRole
private Map<String,CwmSqldataType> sqldataTypeCache
| Constructor Detail |
|---|
public FarragoStmtValidator(FarragoRepos repos,
FennelDbHandle fennelDbHandle,
FarragoSession session,
FarragoObjectCache codeCache,
FarragoObjectCache sharedDataWrapperCache,
FarragoSessionIndexMap indexMap,
FarragoDdlLockManager ddlLockManager)
repos - repos to use for object definitionsfennelDbHandle - handle to Fennel database to accesssession - invoking sessioncodeCache - FarragoObjectCache to use for caching code snippets
needed during preparationsharedDataWrapperCache - FarragoObjectCache to use for caching
FarragoMedDataWrapper instancesddlLockManager - FarragoDdlLockManager to use for protecting catalog
objects in use from modificationindexMap - FarragoSessionIndexMap to use for index access| Method Detail |
|---|
public FarragoSessionParser getParser()
getParser in interface FarragoSessionStmtValidatorpublic FarragoRepos getRepos()
getRepos in interface FarragoSessionStmtValidatorpublic FennelDbHandle getFennelDbHandle()
getFennelDbHandle in interface FarragoSessionStmtValidatorpublic FarragoSession getSession()
getSession in interface FarragoSessionStmtValidatorpublic FarragoTypeFactory getTypeFactory()
getTypeFactory in interface FarragoSessionStmtValidatorpublic FarragoSessionVariables getSessionVariables()
getSessionVariables in interface FarragoSessionStmtValidatorpublic FarragoObjectCache getCodeCache()
getCodeCache in interface FarragoSessionStmtValidatorpublic FarragoDataWrapperCache getDataWrapperCache()
getDataWrapperCache in interface FarragoSessionStmtValidatorpublic FarragoSessionIndexMap getIndexMap()
getIndexMap in interface FarragoSessionStmtValidatorpublic FarragoObjectCache getSharedDataWrapperCache()
getSharedDataWrapperCache in interface FarragoSessionStmtValidatorpublic FarragoSessionPrivilegeChecker getPrivilegeChecker()
getPrivilegeChecker in interface FarragoSessionStmtValidatorpublic FarragoDdlLockManager getDdlLockManager()
getDdlLockManager in interface FarragoSessionStmtValidatorpublic FarragoWarningQueue getWarningQueue()
FarragoSessionStmtValidator
getWarningQueue in interface FarragoSessionStmtValidatorpublic void setWarningQueue(FarragoWarningQueue warningQueue)
FarragoSessionStmtValidator
setWarningQueue in interface FarragoSessionStmtValidatorwarningQueue - target queue to use
public void requestPrivilege(CwmModelElement obj,
String action)
FarragoSessionStmtValidator
requestPrivilege in interface FarragoSessionStmtValidatorobj - object to be accessedaction - the action to be performed on obj (see PrivilegedActionEnum for base set)
public CwmColumn findColumn(CwmNamedColumnSet namedColumnSet,
String columnName)
FarragoSessionStmtValidator
findColumn in interface FarragoSessionStmtValidatornamedColumnSet - the table to searchcolumnName - name of column to find
public CwmCatalog findCatalog(String catalogName)
FarragoSessionStmtValidator
findCatalog in interface FarragoSessionStmtValidatorcatalogName - name of catalog to look up
public List<SqlMoniker> getAllSchemaObjectNames(List<String> names)
FarragoSessionStmtValidator
getAllSchemaObjectNames in interface FarragoSessionStmtValidatornames - 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'
SqlMoniker object (schema and table)
names under the above criteria
private List<SqlMoniker> getAllObjectNamesByType(Collection<CwmModelElement> collection,
Class<? extends CwmModelElement> type)
collection - Collectiontype - Type of object to return
private CwmCatalog lookupCatalog(String catalogName,
boolean throwIfNotFound)
public CwmCatalog getDefaultCatalog()
FarragoSessionStmtValidator
getDefaultCatalog in interface FarragoSessionStmtValidatorpublic FemLocalSchema findSchema(SqlIdentifier schemaName)
FarragoSessionStmtValidator
findSchema in interface FarragoSessionStmtValidatorschemaName - name of schema to look up
private FemLocalSchema lookupSchema(SqlIdentifier schemaName,
boolean throwIfNotFound)
public FemDataWrapper findDataWrapper(SqlIdentifier wrapperName,
boolean isForeign)
FarragoSessionStmtValidator
findDataWrapper in interface FarragoSessionStmtValidatorwrapperName - name of wrapper to look up (must be simple)isForeign - true for foreign data wrapper; false for local data
wrapper
public FemDataServer findDataServer(SqlIdentifier serverName)
FarragoSessionStmtValidator
findDataServer in interface FarragoSessionStmtValidatorserverName - name of server to look up (must be simple)
public FemDataServer getDefaultLocalDataServer()
getDefaultLocalDataServer in interface FarragoSessionStmtValidator
public <T extends CwmModelElement> T findSchemaObject(SqlIdentifier qualifiedName,
Class<T> clazz)
FarragoSessionStmtValidator
findSchemaObject in interface FarragoSessionStmtValidatorqualifiedName - name of object to look upclazz - expected class of object; if the object exists with a
different class, it will be treated as if it did not exist
private RefClass findRefClass(Class<? extends RefObject> clazz)
public <T extends CwmModelElement> T findUnqualifiedObject(SqlIdentifier unqualifiedName,
Class<T> clazz)
FarragoSessionStmtValidator
findUnqualifiedObject in interface FarragoSessionStmtValidatorunqualifiedName - SqlIdentifier which returns true for isSimple()clazz - class of object to find
public List<FemRoutine> findRoutineOverloads(SqlIdentifier invocationName,
ProcedureType routineType)
FarragoSessionStmtValidator
findRoutineOverloads in interface FarragoSessionStmtValidatorinvocationName - invocation name of routine to look uproutineType - type of routine to look up, or null for any type
public CwmSqldataType findSqldataType(SqlIdentifier typeName)
FarragoSessionStmtValidator
findSqldataType in interface FarragoSessionStmtValidatortypeName - name of type to find
private CwmSqldataType findSqldataTypeImpl(SqlIdentifier typeName)
public FemJar findJarFromLiteralName(String jarName)
FarragoSessionStmtValidator
findJarFromLiteralName in interface FarragoSessionStmtValidatorjarName - string literal representing name of jar
private void checkValidated(CwmModelElement element)
public <T extends CwmModelElement> FarragoSessionResolvedObject<T> resolveSchemaObjectName(String[] names,
Class<T> clazz)
FarragoSessionStmtValidator
resolveSchemaObjectName in interface FarragoSessionStmtValidatornames - array of 1 or more name components, from most general to
most specificclazz - type of object to resolve
public CwmNamedColumnSet getSampleDataset(CwmNamedColumnSet columnSet,
String datasetName)
FarragoSessionStmtValidator
getSampleDataset in interface FarragoSessionStmtValidatorcolumnSet - Schema objectdatasetName - Name of dataset, not null
public void setParserPosition(SqlParserPos pos)
FarragoSessionStmtValidator
setParserPosition in interface FarragoSessionStmtValidatorpos - new position to set, or null to clearprivate EigenbaseException newPositionalError(SqlValidatorException ex)
public void validateFeature(org.eigenbase.resgen.ResourceDefinition feature,
SqlParserPos context)
FarragoSessionStmtValidator
validateFeature in interface FarragoSessionStmtValidatorfeature - feature being used, represented as a resource definition
from EigenbaseResourcecontext - parser position context for error reporting, or null if
none availablepublic void setTimingTracer(EigenbaseTimingTracer timingTracer)
FarragoSessionStmtValidator
setTimingTracer in interface FarragoSessionStmtValidatortimingTracer - tracer to usepublic EigenbaseTimingTracer getTimingTracer()
getTimingTracer in interface FarragoSessionStmtValidatorpublic void setReposTxnContext(FarragoReposTxnContext reposTxnContext)
FarragoSessionStmtValidator
setReposTxnContext in interface FarragoSessionStmtValidatorreposTxnContext - repos txn context to usepublic FarragoReposTxnContext getReposTxnContext()
getReposTxnContext in interface FarragoSessionStmtValidator
public void validateDataType(SqlDataTypeSpec dataType)
throws SqlValidatorException
FarragoSessionStmtValidator
validateDataType in interface FarragoSessionStmtValidatorSqlValidatorExceptionpublic void closeAllocation()
ClosableAllocation
closeAllocation in interface ClosableAllocationcloseAllocation in class CompoundClosableAllocation
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||