net.sf.farrago.ddl
Class DdlValidator

java.lang.Object
  extended by org.eigenbase.util.CompoundClosableAllocation
      extended by net.sf.farrago.util.FarragoCompoundAllocation
          extended by net.sf.farrago.ddl.DdlValidator
All Implemented Interfaces:
EventListener, FarragoSessionDdlValidator, FarragoAllocation, FarragoAllocationOwner, ClosableAllocation, ClosableAllocationOwner, MDRChangeListener, MDRPreChangeListener

public class DdlValidator
extends FarragoCompoundAllocation
implements FarragoSessionDdlValidator, MDRPreChangeListener

DdlValidator validates the process of applying a DDL statement to the catalog. By implementing MDRPreChangeListener, it is able to automatically collect references to all objects modified by the statement. (MDRChangeListener isn't suitable since it's asynchronous.)

Generic validation support is implemented in this class, but object-specific rules should be implemented in handler classes for the appropriate catalog objects.

NOTE: all validation activity must take place in the same thread in which DdlValidator's constructor is called.

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/ddl/DdlValidator.java#74 $
Author:
John V. Sichi

Nested Class Summary
private static class DdlValidator.DeferredException
          DeferredException allows an exception's creation to be deferred.
private  class DdlValidator.RefObjectPositionComparator
          RefObjectPositionComparator compares RefObjects based on their position within the owning DdlValidator's parserContextMap.
private static class DdlValidator.SchedulingDetail
           
private static class DdlValidator.ValidatedOp
           
 
Field Summary
protected  List<DdlHandler> actionHandlers
          List of handlers to be invoked.
private  Thread activeThread
          Thread binding to prevent cross-talk.
private  FemAuthId currentUserAuthId
           
protected  FarragoSessionDdlStmt ddlStmt
          DDL statement being validated.
private  Set<RefObject> deleteQueue
          Set of objects which a DROP CASCADE has encountered but not yet processed.
protected  ReflectiveVisitDispatcher<DdlHandler,CwmModelElement> dispatcher
           
private  MultiMap<Class<?>,FarragoSessionDdlDropRule> dropRules
          Map (from RefAssociation.Class to FarragoSessionDdlDropRule) of associations for which special handling is required during DROP.
private  DdlValidator.DeferredException enqueuedValidationExcn
          Queue of excns detected during plannedChange.
private  Map<Object,SqlParserPos> parserContextMap
          Map from catalog object to SqlParserPos for beginning of definition.
private  Map<RefObject,SqlParserPos> parserOffsetMap
          Map from catalog object to SqlParserPos for offset of body.
private  CwmModelElement replacementTarget
          Object to be replaced if CREATE OR REPLACE
private  Set<CwmModelElement> revalidateQueue
          Set of objects to be revalidated (CREATE OR REPLACE)
private  Map<String,DdlValidator.SchedulingDetail> schedulingMap
          Map containing scheduled validation actions.
private  Map<RefObject,SqlNode> sqlMap
          Map from catalog object to associated SQL definition (not all objects have these).
private  FarragoSessionStmtValidator stmtValidator
           
private  FemAuthId systemUserAuthId
           
private  String timestamp
           
private static Logger tracer
           
private  Map<String,DdlValidator.SchedulingDetail> transitMap
          Map of objects in transition between schedulingMap and validatedMap.
private  boolean usePreviewDelete
           
private  Map<RefObject,DdlValidator.ValidatedOp> validatedMap
          Map of object validations which have already taken place.
 
Fields inherited from class org.eigenbase.util.CompoundClosableAllocation
allocations
 
Constructor Summary
DdlValidator(FarragoSessionStmtValidator stmtValidator)
          Creates a new validator.
 
Method Summary
 void change(MDRChangeEvent event)
           
 void changeCancelled(MDRChangeEvent event)
           
private  void checkInUse(String mofId)
          Checks if an object is in use by a running statement.
private  void checkJmiConstraints(RefObject obj)
           
private  void checkStringLength(AttributeEvent event)
           
private  void checkValidationExcnQueue()
           
 void closeAllocation()
          Closes this object.
private  boolean containsCycle(CwmModelElement rootElement)
          Check transitive closure of dependencies of an element for cycles.
<T extends CwmModelElement>
CwmDependency
createDependency(CwmNamespace client, Collection<T> suppliers)
          Creates a new dependency.
 void defineDropRule(RefAssociation refAssoc, FarragoSessionDdlDropRule dropRule)
          Adds a FarragoSessionDdlDropRule.
 void deleteObject(RefObject obj)
          Deletes the given object and cascades deletion as necessary to subordinate objects.
 void deleteReplacementTarget(CwmModelElement newElement)
          Delete the existing object of a CREATE OR REPLACE statement, saving its dependencies for later revalidation.
 void discardDataWrapper(CwmModelElement wrapper)
          Discards a data wrapper or server from the shared cache (called when it is dropped).
private  void enqueueValidationExcn(DdlValidator.DeferredException excn)
           
 void executeStorage()
          Executes storage management commands for any model elements encountered during validation.
private  CwmModelElement findDuplicate(CwmModelElement target)
          Searches an element's namespace's owned elements and returns the first duplicate found (by name, type).
private  void fireDropRule(FarragoSessionDdlDropRule rule, RefObject droppedEnd, RefObject otherEnd)
           
 void fixupView(FemLocalView view, FarragoSessionAnalyzedSql analyzedSql)
          Modifies the analyzed SQL for a view definition, to take into account any system columns which a personality may need to have in the view.
 FarragoDataWrapperCache getDataWrapperCache()
           
 Set<CwmModelElement> getDependencies(CwmModelElement rootElement)
          Returns immediate dependencies of an of element.
 FennelDbHandle getFennelDbHandle()
           
 FarragoSessionIndexMap getIndexMap()
           
 FarragoSession getInvokingSession()
           
private  String getNameKey(CwmModelElement element, boolean includeType)
           
private  SqlIdentifier getNewName()
          Returns RENAME TO argument of CREATE OR REPLACE.
private  DdlValidator.ValidatedOp getObjectStatusFromMap(Map<String,DdlValidator.SchedulingDetail> map, RefObject refObject)
           
 FarragoSessionParser getParser()
           
 SqlParserPos getParserOffset(RefObject obj)
          Retrieves the parser offset for the body of a given object.
private  SqlParserPos getParserPos(RefObject obj)
           
 String getParserPosString(RefObject obj)
          Finds the parse position for an object affected by DDL.
 FarragoRepos getRepos()
           
 SqlNode getSqlDefinition(RefObject obj)
          Retrieves an SQL definition previously associated with a catalog object via FarragoSessionDdlValidator.setSqlDefinition(javax.jmi.reflect.RefObject, org.eigenbase.sql.SqlNode).
 FarragoSessionStmtValidator getStmtValidator()
           
 FarragoTypeFactory getTypeFactory()
           
(package private)  void handlePostCommit(CwmModelElement modelElement, String command)
           
protected  boolean invokeHandler(CwmModelElement modelElement, String action)
           
 boolean isCreatedObject(RefObject refObject)
          Determines whether a catalog object is being created by this DDL statement.
 boolean isDeletedObject(RefObject refObject)
          Determines whether a catalog object is being deleted by this DDL statement.
 boolean isDropRestrict()
           
private  boolean isNewObject(CwmModelElement modelElement)
          Determines whether a catalog object has had its visibility set yet.
 boolean isReplace()
          Tests if DDL statement is CREATE OR REPLACE.
 boolean isReplacingType(CwmModelElement object)
          Tests if DDL statement is CREATE OR REPLACE and the target object (to be replaced) is of the specified type.
private  void mapParserPosition(RefObject obj)
           
 EigenbaseException newPositionalError(RefObject refObj, SqlValidatorException ex)
          Wraps a validation error with position information.
 FarragoSession newReentrantSession()
          Creates a new reentrant session; this is required during validation of some DDL commands (e.g.
 String obtainTimestamp()
          Obtains the single consistent timestamp for this DDL transaction.
 void plannedChange(MDRChangeEvent event)
           
 void releaseReentrantSession(FarragoSession session)
          Releases a FarragoSession acquired with newReentrantSession().
private  void replaceDependencies(CwmModelElement oldElement, CwmModelElement newElement)
          Removes dependency associations on oldElement so that it may be deleted without cascading side effects.
private  void rollbackDeletions()
           
private  void scheduleDeletion(RefObject obj)
           
private  void scheduleModification(RefObject obj)
           
private  void scheduleRevalidation(Set<CwmModelElement> elements)
           
 void setCreatedSchemaContext(FemLocalSchema schema)
          Sets the context for a compound CREATE SCHEMA statement to be used by all object definitions in the new schema.
 String setParserOffset(RefObject obj, SqlParserPos pos, String body)
          Sets the parser offset for the body of a given object.
 void setRevalidationResult(CwmModelElement element, EigenbaseException ex)
          Handle an exception encountered during validation of dependencies of an object replaced via CREATE OR REPLACE (a.k.a.
 void setSchemaObjectName(CwmModelElement schemaElement, SqlIdentifier qualifiedName)
          Sets the name of a new object being defined, and adds the object to the correct schema.
private  void setSourceInContext(EigenbaseException e, String sourceString)
           
 void setSqlDefinition(RefObject obj, SqlNode sqlNode)
          Associates an SQL definition with a catalog object.
private  void startListening()
           
private  void stopListening()
           
private  boolean testObjectStatus(RefObject refObject, DdlValidator.ValidatedOp status)
           
private  void updateObjectTimestamp(CwmModelElement element)
           
 void validate(FarragoSessionDdlStmt ddlStmt)
          Validates all scheduled operations.
private  boolean validateAction(CwmModelElement modelElement, DdlValidator.ValidatedOp action)
           
 void validateUniqueNames(CwmModelElement container, Collection<? extends CwmModelElement> collection, boolean includeType)
          Determines whether all of the objects in a collection have distinct names, throwing an appropriate exception if not.
 void validateViewColumnList(Collection<?> collection)
          validate the names provided in a VIEW's explicit column list.
 
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

tracer

private static final Logger tracer

stmtValidator

private final FarragoSessionStmtValidator stmtValidator

enqueuedValidationExcn

private DdlValidator.DeferredException enqueuedValidationExcn
Queue of excns detected during plannedChange.


dropRules

private MultiMap<Class<?>,FarragoSessionDdlDropRule> dropRules
Map (from RefAssociation.Class to FarragoSessionDdlDropRule) of associations for which special handling is required during DROP.


parserContextMap

private final Map<Object,SqlParserPos> parserContextMap
Map from catalog object to SqlParserPos for beginning of definition.


parserOffsetMap

private final Map<RefObject,SqlParserPos> parserOffsetMap
Map from catalog object to SqlParserPos for offset of body.


sqlMap

private final Map<RefObject,SqlNode> sqlMap
Map from catalog object to associated SQL definition (not all objects have these).


schedulingMap

private Map<String,DdlValidator.SchedulingDetail> schedulingMap
Map containing scheduled validation actions. The key is the MofId of the object scheduled for validation; the value is a simple object containing a ValidatedOp and the object's RefClass.


transitMap

private Map<String,DdlValidator.SchedulingDetail> transitMap
Map of objects in transition between schedulingMap and validatedMap. Content format is same as for schedulingMap.


validatedMap

private Map<RefObject,DdlValidator.ValidatedOp> validatedMap
Map of object validations which have already taken place. The key is the RefObject itself; the value is the action type.


deleteQueue

private Set<RefObject> deleteQueue
Set of objects which a DROP CASCADE has encountered but not yet processed.


activeThread

private Thread activeThread
Thread binding to prevent cross-talk.


ddlStmt

protected FarragoSessionDdlStmt ddlStmt
DDL statement being validated.


actionHandlers

protected List<DdlHandler> actionHandlers
List of handlers to be invoked.


replacementTarget

private CwmModelElement replacementTarget
Object to be replaced if CREATE OR REPLACE


revalidateQueue

private Set<CwmModelElement> revalidateQueue
Set of objects to be revalidated (CREATE OR REPLACE)


timestamp

private String timestamp

dispatcher

protected final ReflectiveVisitDispatcher<DdlHandler,CwmModelElement> dispatcher

systemUserAuthId

private FemAuthId systemUserAuthId

currentUserAuthId

private FemAuthId currentUserAuthId

usePreviewDelete

private boolean usePreviewDelete
Constructor Detail

DdlValidator

public DdlValidator(FarragoSessionStmtValidator stmtValidator)
Creates a new validator. The validator will listen for repository change events and schedule appropriate validation actions on the affected objects. Validation is deferred until validate() is called.

Parameters:
stmtValidator - generic stmt validator
Method Detail

getStmtValidator

public FarragoSessionStmtValidator getStmtValidator()
Specified by:
getStmtValidator in interface FarragoSessionDdlValidator
Returns:
generic stmt validator

getRepos

public FarragoRepos getRepos()
Specified by:
getRepos in interface FarragoSessionDdlValidator
Returns:
repos storing object definitions being validated

getFennelDbHandle

public FennelDbHandle getFennelDbHandle()
Specified by:
getFennelDbHandle in interface FarragoSessionDdlValidator
Returns:
Handle to Fennel database accessed by this stmt

getTypeFactory

public FarragoTypeFactory getTypeFactory()
Specified by:
getTypeFactory in interface FarragoSessionDdlValidator
Returns:
type factory to be used for any type-checking during validation

getIndexMap

public FarragoSessionIndexMap getIndexMap()
Specified by:
getIndexMap in interface FarragoSessionDdlValidator
Returns:
the FarragoSessionIndexMap to use for managing index storage

getDataWrapperCache

public FarragoDataWrapperCache getDataWrapperCache()
Specified by:
getDataWrapperCache in interface FarragoSessionDdlValidator
Returns:
cache for loaded data wrappers

newReentrantSession

public FarragoSession newReentrantSession()
Description copied from interface: FarragoSessionDdlValidator
Creates a new reentrant session; this is required during validation of some DDL commands (e.g. view creation) for preparation or execution of internal SQL statements.

Specified by:
newReentrantSession in interface FarragoSessionDdlValidator
Returns:
a FarragoSession to use for reentrant SQL; when done, this session must be released by calling releaseReentrantSession

getInvokingSession

public FarragoSession getInvokingSession()
Specified by:
getInvokingSession in interface FarragoSessionDdlValidator
Returns:
the FarragoSession which invoked this DDL

releaseReentrantSession

public void releaseReentrantSession(FarragoSession session)
Description copied from interface: FarragoSessionDdlValidator
Releases a FarragoSession acquired with newReentrantSession().

Specified by:
releaseReentrantSession in interface FarragoSessionDdlValidator
Parameters:
session - the session to release

getParser

public FarragoSessionParser getParser()
Specified by:
getParser in interface FarragoSessionDdlValidator
Returns:
the parser whose statement is being validated

isDeletedObject

public boolean isDeletedObject(RefObject refObject)
Description copied from interface: FarragoSessionDdlValidator
Determines whether a catalog object is being deleted by this DDL statement.

Specified by:
isDeletedObject in interface FarragoSessionDdlValidator
Parameters:
refObject - object in question
Returns:
true if refObject is being deleted

isCreatedObject

public boolean isCreatedObject(RefObject refObject)
Description copied from interface: FarragoSessionDdlValidator
Determines whether a catalog object is being created by this DDL statement.

Specified by:
isCreatedObject in interface FarragoSessionDdlValidator
Parameters:
refObject - object in question
Returns:
true if refObject is being created

testObjectStatus

private boolean testObjectStatus(RefObject refObject,
                                 DdlValidator.ValidatedOp status)

getObjectStatusFromMap

private DdlValidator.ValidatedOp getObjectStatusFromMap(Map<String,DdlValidator.SchedulingDetail> map,
                                                        RefObject refObject)

isDropRestrict

public boolean isDropRestrict()
Specified by:
isDropRestrict in interface FarragoSessionDdlValidator
Returns:
is a DROP RESTRICT being executed?

isNewObject

private boolean isNewObject(CwmModelElement modelElement)
Determines whether a catalog object has had its visibility set yet. NOTE: this should remain private and only be called prior to executeStorage().

Parameters:
modelElement - object in question
Returns:
true if refObject isn't visible yet

getParserPosString

public String getParserPosString(RefObject obj)
Description copied from interface: FarragoSessionDdlValidator
Finds the parse position for an object affected by DDL. Not all objects have parse positions (e.g. when a table is dropped, referencing views are implicitly affected).

Specified by:
getParserPosString in interface FarragoSessionDdlValidator
Parameters:
obj - the affected object
Returns:
the parse position string associated with the given object, or null if the object was not encountered by parsing

getParserPos

private SqlParserPos getParserPos(RefObject obj)

setParserOffset

public String setParserOffset(RefObject obj,
                              SqlParserPos pos,
                              String body)
Description copied from interface: FarragoSessionDdlValidator
Sets the parser offset for the body of a given object.

If the body text has preceding whitespace, trims the whitespace and advances the position by the number of whitespace characters removed. Returns the trimmed body.

Specified by:
setParserOffset in interface FarragoSessionDdlValidator
Parameters:
obj - object being defined
pos - parser offset
body - text of body
Returns:
body text with preceding whitespace removed

getParserOffset

public SqlParserPos getParserOffset(RefObject obj)
Description copied from interface: FarragoSessionDdlValidator
Retrieves the parser offset for the body of a given object.

Specified by:
getParserOffset in interface FarragoSessionDdlValidator
Parameters:
obj - object to look up
Returns:
parser offset, or null if none recorded

setSqlDefinition

public void setSqlDefinition(RefObject obj,
                             SqlNode sqlNode)
Description copied from interface: FarragoSessionDdlValidator
Associates an SQL definition with a catalog object. This is called from the parser; later, this information is retrieved during validation via FarragoSessionDdlValidator.getSqlDefinition(javax.jmi.reflect.RefObject).

Specified by:
setSqlDefinition in interface FarragoSessionDdlValidator
Parameters:
obj - object being defined
sqlNode - SQL definition

getSqlDefinition

public SqlNode getSqlDefinition(RefObject obj)
Description copied from interface: FarragoSessionDdlValidator
Retrieves an SQL definition previously associated with a catalog object via FarragoSessionDdlValidator.setSqlDefinition(javax.jmi.reflect.RefObject, org.eigenbase.sql.SqlNode). As a side effect, also restores parser context for this object if available.

Specified by:
getSqlDefinition in interface FarragoSessionDdlValidator
Parameters:
obj - object being validated
Returns:
SQL definition

setSchemaObjectName

public void setSchemaObjectName(CwmModelElement schemaElement,
                                SqlIdentifier qualifiedName)
Description copied from interface: FarragoSessionDdlValidator
Sets the name of a new object being defined, and adds the object to the correct schema.

Specified by:
setSchemaObjectName in interface FarragoSessionDdlValidator
Parameters:
schemaElement - the object being named
qualifiedName - the (possibly) qualified name of the object

change

public void change(MDRChangeEvent event)
Specified by:
change in interface MDRChangeListener

changeCancelled

public void changeCancelled(MDRChangeEvent event)
Specified by:
changeCancelled in interface MDRPreChangeListener

closeAllocation

public void closeAllocation()
Description copied from interface: ClosableAllocation
Closes this object.

Specified by:
closeAllocation in interface ClosableAllocation
Overrides:
closeAllocation in class CompoundClosableAllocation

isReplace

public boolean isReplace()
Tests if DDL statement is CREATE OR REPLACE.

Returns:
true if statement is CREATE OR REPLACE

getNewName

private SqlIdentifier getNewName()
Returns RENAME TO argument of CREATE OR REPLACE.

Returns:
new name of object, or null if this is not a CREATE OR REPLACE or RENAME TO.

isReplacingType

public boolean isReplacingType(CwmModelElement object)
Tests if DDL statement is CREATE OR REPLACE and the target object (to be replaced) is of the specified type.

Parameters:
object - Object type to test for
Returns:
true if CREATE OR REPLACE and replacing an object of this type

deleteReplacementTarget

public void deleteReplacementTarget(CwmModelElement newElement)
Delete the existing object of a CREATE OR REPLACE statement, saving its dependencies for later revalidation.


executeStorage

public void executeStorage()
Description copied from interface: FarragoSessionDdlValidator
Executes storage management commands for any model elements encountered during validation.

Specified by:
executeStorage in interface FarragoSessionDdlValidator

checkJmiConstraints

private void checkJmiConstraints(RefObject obj)

updateObjectTimestamp

private void updateObjectTimestamp(CwmModelElement element)

plannedChange

public void plannedChange(MDRChangeEvent event)
Specified by:
plannedChange in interface MDRPreChangeListener

validate

public void validate(FarragoSessionDdlStmt ddlStmt)
Description copied from interface: FarragoSessionDdlValidator
Validates all scheduled operations. Validation may cause other objects to be changed, so the process continues until a fixpoint is reached.

Specified by:
validate in interface FarragoSessionDdlValidator
Parameters:
ddlStmt - DDL statement to be validated

setSourceInContext

private void setSourceInContext(EigenbaseException e,
                                String sourceString)

setRevalidationResult

public void setRevalidationResult(CwmModelElement element,
                                  EigenbaseException ex)
Handle an exception encountered during validation of dependencies of an object replaced via CREATE OR REPLACE (a.k.a. revalidation).

Specified by:
setRevalidationResult in interface FarragoSessionDdlValidator
Parameters:
element - Catalog object causing revalidation exception
ex - Revalidation exception

validateUniqueNames

public void validateUniqueNames(CwmModelElement container,
                                Collection<? extends CwmModelElement> collection,
                                boolean includeType)
Description copied from interface: FarragoSessionDdlValidator
Determines whether all of the objects in a collection have distinct names, throwing an appropriate exception if not.

Specified by:
validateUniqueNames in interface FarragoSessionDdlValidator
Parameters:
container - namespace object for use in error message
collection - Collection of CwmModelElements representing namespace contents
includeType - if true, include type in name; if false, ignore

getNameKey

private String getNameKey(CwmModelElement element,
                          boolean includeType)

createDependency

public <T extends CwmModelElement> CwmDependency createDependency(CwmNamespace client,
                                                                  Collection<T> suppliers)
Description copied from interface: FarragoSessionDdlValidator
Creates a new dependency.

Specified by:
createDependency in interface FarragoSessionDdlValidator
Parameters:
client - element which depends on others; we require this to be a CwmNamespace so that it can own the CwmDependency created
suppliers - collection of elements on which client depends
Returns:
new dependency

discardDataWrapper

public void discardDataWrapper(CwmModelElement wrapper)
Description copied from interface: FarragoSessionDdlValidator
Discards a data wrapper or server from the shared cache (called when it is dropped).

Specified by:
discardDataWrapper in interface FarragoSessionDdlValidator
Parameters:
wrapper - definition of wrapper to discard

setCreatedSchemaContext

public void setCreatedSchemaContext(FemLocalSchema schema)
Description copied from interface: FarragoSessionDdlValidator
Sets the context for a compound CREATE SCHEMA statement to be used by all object definitions in the new schema.

Specified by:
setCreatedSchemaContext in interface FarragoSessionDdlValidator
Parameters:
schema - new schema being created

newPositionalError

public EigenbaseException newPositionalError(RefObject refObj,
                                             SqlValidatorException ex)
Description copied from interface: FarragoSessionDdlValidator
Wraps a validation error with position information.

Specified by:
newPositionalError in interface FarragoSessionDdlValidator
Parameters:
refObj - object whose definition should be used for position information
ex - exception to be wrapped
Returns:
wrapping exception

deleteObject

public void deleteObject(RefObject obj)
Description copied from interface: FarragoSessionDdlValidator
Deletes the given object and cascades deletion as necessary to subordinate objects. Implementation of deletion is handled with the highest performance possible given the underlying repository implementation.

Specified by:
deleteObject in interface FarragoSessionDdlValidator
Parameters:
obj - object to delete

defineDropRule

public void defineDropRule(RefAssociation refAssoc,
                           FarragoSessionDdlDropRule dropRule)
Description copied from interface: FarragoSessionDdlValidator
Adds a FarragoSessionDdlDropRule.

Specified by:
defineDropRule in interface FarragoSessionDdlValidator
Parameters:
refAssoc - model association to which the rule relates
dropRule - rule to add

enqueueValidationExcn

private void enqueueValidationExcn(DdlValidator.DeferredException excn)

checkValidationExcnQueue

private void checkValidationExcnQueue()

fireDropRule

private void fireDropRule(FarragoSessionDdlDropRule rule,
                          RefObject droppedEnd,
                          RefObject otherEnd)

mapParserPosition

private void mapParserPosition(RefObject obj)

rollbackDeletions

private void rollbackDeletions()

scheduleDeletion

private void scheduleDeletion(RefObject obj)

scheduleModification

private void scheduleModification(RefObject obj)

checkStringLength

private void checkStringLength(AttributeEvent event)

startListening

private void startListening()

stopListening

private void stopListening()

validateAction

private boolean validateAction(CwmModelElement modelElement,
                               DdlValidator.ValidatedOp action)

handlePostCommit

void handlePostCommit(CwmModelElement modelElement,
                      String command)

invokeHandler

protected boolean invokeHandler(CwmModelElement modelElement,
                                String action)

containsCycle

private boolean containsCycle(CwmModelElement rootElement)
Check transitive closure of dependencies of an element for cycles.

Parameters:
rootElement - Starting element for dependency search
Returns:
true if cycle is found

scheduleRevalidation

private void scheduleRevalidation(Set<CwmModelElement> elements)

getDependencies

public Set<CwmModelElement> getDependencies(CwmModelElement rootElement)
Description copied from interface: FarragoSessionDdlValidator
Returns immediate dependencies of an of element.

Specified by:
getDependencies in interface FarragoSessionDdlValidator
Parameters:
rootElement - Starting element for dependency search
Returns:
Set of CwmModelElement, immediate dependencies of rootElement

fixupView

public void fixupView(FemLocalView view,
                      FarragoSessionAnalyzedSql analyzedSql)
Description copied from interface: FarragoSessionDdlValidator
Modifies the analyzed SQL for a view definition, to take into account any system columns which a personality may need to have in the view. In particular, makes sure that the analyzed SQL returns the same number and type of columns as the view definition.

Specified by:
fixupView in interface FarragoSessionDdlValidator
Parameters:
view - View definition
analyzedSql - Analyzed SQL for the view definition

replaceDependencies

private void replaceDependencies(CwmModelElement oldElement,
                                 CwmModelElement newElement)
Removes dependency associations on oldElement so that it may be deleted without cascading side effects. Reassign these dependencies to newElement. Assumes MDR change listener isn't active.

Parameters:
oldElement - Element to remove dependencies from
newElement - Element to add dependencies to

findDuplicate

private CwmModelElement findDuplicate(CwmModelElement target)
Searches an element's namespace's owned elements and returns the first duplicate found (by name, type).

Parameters:
target - Target of search
Returns:
CwmModelElement found, or null if not found

obtainTimestamp

public String obtainTimestamp()
Description copied from interface: FarragoSessionDdlValidator
Obtains the single consistent timestamp for this DDL transaction.

Specified by:
obtainTimestamp in interface FarragoSessionDdlValidator
Returns:
the timestamp for this DDL transaction

validateViewColumnList

public void validateViewColumnList(Collection<?> collection)
Description copied from interface: FarragoSessionDdlValidator
validate the names provided in a VIEW's explicit column list.

Specified by:
validateViewColumnList in interface FarragoSessionDdlValidator
Parameters:
collection - Collection of CwmModelElements representing the explicitly named columns

checkInUse

private void checkInUse(String mofId)
Checks if an object is in use by a running statement. If so, throw a deferred exception. Used only in the DROP case. CREATE OR REPLACE throws a different exception.

Parameters:
mofId - Object MOFID being dropped