net.sf.farrago.ddl
Class DdlTruncateStmt

java.lang.Object
  extended by net.sf.farrago.ddl.DdlStmt
      extended by net.sf.farrago.ddl.DdlTruncateStmt
All Implemented Interfaces:
DdlMultipleTransactionStmt, FarragoSessionDdlStmt

public class DdlTruncateStmt
extends DdlStmt
implements DdlMultipleTransactionStmt

DdlTruncateStmt represents a DDL TRUNCATE statement of any kind.

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

Field Summary
private  List<String> indexMofIds
           
private  RefClass tableClass
           
private  String tableMofId
           
 
Constructor Summary
DdlTruncateStmt(CwmModelElement truncatedElement)
          Constructs a new DdlTruncateStmt.
 
Method Summary
 void completeAfterExecuteUnlocked(FarragoSessionDdlValidator ddlValidator, FarragoSession session, boolean success)
          Provides access to the repository after execution of the DDL.
 boolean completeRequiresWriteTxn()
          Checks whether the DdlMultipleTransactionStmt.completeAfterExecuteUnlocked( FarragoSessionDdlValidator, FarragoSession, boolean) method requires a repository write transaction.
 void executeUnlocked(FarragoSessionDdlValidator ddlValidator, FarragoSession session)
          Executes long-running DDL actions.
 void prepForExecuteUnlocked(FarragoSessionDdlValidator ddlValidator, FarragoSession session)
          Provides access to the repository in preparation for the execution of DdlStmt.
 void visit(DdlVisitor visitor)
          Invokes a visitor on this statement.
 
Methods inherited from class net.sf.farrago.ddl.DdlStmt
getModelElement, isDropRestricted, postCommit, postExecute, preExecute, preValidate, requiresCommit, runsAsDml
 
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.session.FarragoSessionDdlStmt
getModelElement, isDropRestricted, postCommit, postExecute, preExecute, preValidate, requiresCommit, runsAsDml
 

Field Detail

tableMofId

private String tableMofId

tableClass

private RefClass tableClass

indexMofIds

private List<String> indexMofIds
Constructor Detail

DdlTruncateStmt

public DdlTruncateStmt(CwmModelElement truncatedElement)
Constructs a new DdlTruncateStmt.

Parameters:
truncatedElement - top-level element truncated by this stmt
Method Detail

visit

public void visit(DdlVisitor visitor)
Description copied from class: DdlStmt
Invokes a visitor on this statement.

Specified by:
visit in class DdlStmt
Parameters:
visitor - DdlVisitor to invoke

prepForExecuteUnlocked

public void prepForExecuteUnlocked(FarragoSessionDdlValidator ddlValidator,
                                   FarragoSession session)
Description copied from interface: DdlMultipleTransactionStmt
Provides access to the repository in preparation for the execution of DdlStmt. This method is invoked within the context the original repository transaction for the DDL statement. Whether that transaction is a write transaction depends on the DDL statement being executed.

Specified by:
prepForExecuteUnlocked in interface DdlMultipleTransactionStmt
Parameters:
ddlValidator - DDL validator for this statement
See Also:
FarragoReposTxnContext

executeUnlocked

public void executeUnlocked(FarragoSessionDdlValidator ddlValidator,
                            FarragoSession session)
Description copied from interface: DdlMultipleTransactionStmt
Executes long-running DDL actions. This method is invoked outside the context of any repository transaction.

Specified by:
executeUnlocked in interface DdlMultipleTransactionStmt
Parameters:
ddlValidator - DDL validator for this statement
session - reentrant Farrago session which may be used to execute DML statements

completeRequiresWriteTxn

public boolean completeRequiresWriteTxn()
Description copied from interface: DdlMultipleTransactionStmt
Checks whether the DdlMultipleTransactionStmt.completeAfterExecuteUnlocked( FarragoSessionDdlValidator, FarragoSession, boolean) method requires a repository write transaction.

Specified by:
completeRequiresWriteTxn in interface DdlMultipleTransactionStmt
Returns:
true if a write txn must be started before executing the completion step, false if a read txn is sufficient

completeAfterExecuteUnlocked

public void completeAfterExecuteUnlocked(FarragoSessionDdlValidator ddlValidator,
                                         FarragoSession session,
                                         boolean success)
Description copied from interface: DdlMultipleTransactionStmt
Provides access to the repository after execution of the DDL. Typically implementations of this method modify the repository to store the results of DdlMultipleTransactionStmt.executeUnlocked(FarragoSessionDdlValidator, FarragoSession). This method is invoked in a locked repository transaction. The method DdlMultipleTransactionStmt.completeRequiresWriteTxn() controls whether the transaction read-only or not. This method may not access and/or modify repository objects loaded in a previous transaction unless they are reloaded by MOF ID. Be aware that objects may have been modified by another session unless some external mechanism (for instance, the "table-in-use" collection) guarantees that they have not been modified by another statement.

Note that any repository modifications made during the execution of this method will not be post-processed by DdlValidator. For instance, DdlValidator.checkJmiConstraints(RefObject) is not called, and therefore any mandatory default primitives are not automatically set, which will cause errors later if the attributes have not been explicitly initialized. See JmiObjUtil.setMandatoryPrimitiveDefaults(javax.jmi.reflect.RefObject).

Specified by:
completeAfterExecuteUnlocked in interface DdlMultipleTransactionStmt
Parameters:
ddlValidator - DDL validator for this statement
session - reentrant Farrago session which may be used to execute DML statements
success - whether the execution succeeded; detection of failure can be used to recover