|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.farrago.ddl.DdlStmt net.sf.farrago.ddl.DdlReloadTableStmt
public abstract class DdlReloadTableStmt
DdlReloadTableStmt is an abstract base for statements which need to self-insert data from an existing table. Currently this includes ALTER TABLE REBUILD and ALTER TABLE ADD COLUMN.
Nested Class Summary | |
---|---|
private class |
DdlReloadTableStmt.ReloadTableIndexMap
A special index map used when rebuildIndexes=true. |
Field Summary | |
---|---|
private FarragoSessionIndexMap |
baseIndexMap
|
private boolean |
rebuildingIndexes
|
private FarragoSessionIndexMap |
rebuildMap
|
private String |
recoveryRefMofId
|
private String |
reloadSql
|
private FarragoRepos |
repos
|
private CwmTable |
table
|
private RefClass |
tableClass
|
private String |
tableMofId
|
private FarragoDataWrapperCache |
wrapperCache
|
private Map<String,Long> |
writeIndexMap
|
Constructor Summary | |
---|---|
DdlReloadTableStmt(CwmTable table)
Constructs a DdlReloadTableStmt. |
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. |
private void |
crashIfTrapSet()
|
void |
executeUnlocked(FarragoSessionDdlValidator ddlValidator,
FarragoSession session)
Executes long-running DDL actions. |
protected CwmTable |
getOldTableStructureForIndexMap()
|
protected abstract String |
getReloadDml(SqlPrettyWriter writer)
Generates the SQL to be used to reload the table. |
protected CwmTable |
getTable()
|
void |
prepForExecuteUnlocked(FarragoSessionDdlValidator ddlValidator,
FarragoSession session)
Provides access to the repository in preparation for the execution of DdlStmt. |
protected void |
recoverFromFailure(FarragoSessionDdlValidator ddlValidator,
FarragoSession session)
Called after an exception is thrown during the execution phase. |
protected void |
setRecoveryRef(FemRecoveryReference recoveryRef)
Sets up a recovery reference to be used in the event of a crash. |
protected boolean |
shouldRebuildIndexes(FarragoSessionDdlValidator ddlValidator)
Determines whether statement execution should rebuild all indexes on the table. |
private void |
sleepIfTrapSet()
|
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 |
---|
private CwmTable table
private String tableMofId
private RefClass tableClass
private FarragoRepos repos
private FarragoSessionIndexMap baseIndexMap
private FarragoDataWrapperCache wrapperCache
private Map<String,Long> writeIndexMap
private FarragoSessionIndexMap rebuildMap
private String reloadSql
private boolean rebuildingIndexes
private String recoveryRefMofId
Constructor Detail |
---|
public DdlReloadTableStmt(CwmTable table)
table
- target tableMethod Detail |
---|
public void visit(DdlVisitor visitor)
DdlStmt
visit
in class DdlStmt
visitor
- DdlVisitor to invokepublic void prepForExecuteUnlocked(FarragoSessionDdlValidator ddlValidator, FarragoSession session)
DdlMultipleTransactionStmt
prepForExecuteUnlocked
in interface DdlMultipleTransactionStmt
ddlValidator
- DDL validator for this statementFarragoReposTxnContext
public void executeUnlocked(FarragoSessionDdlValidator ddlValidator, FarragoSession session)
DdlMultipleTransactionStmt
executeUnlocked
in interface DdlMultipleTransactionStmt
ddlValidator
- DDL validator for this statementsession
- reentrant Farrago session which may be used to execute DML
statementsprivate void sleepIfTrapSet()
public boolean completeRequiresWriteTxn()
DdlMultipleTransactionStmt
DdlMultipleTransactionStmt.completeAfterExecuteUnlocked(
FarragoSessionDdlValidator, FarragoSession, boolean)
method requires a
repository write transaction.
completeRequiresWriteTxn
in interface DdlMultipleTransactionStmt
protected void recoverFromFailure(FarragoSessionDdlValidator ddlValidator, FarragoSession session)
ddlValidator
- DDL validator for this statementsession
- reentrant Farrago sessionpublic void completeAfterExecuteUnlocked(FarragoSessionDdlValidator ddlValidator, FarragoSession session, boolean success)
DdlMultipleTransactionStmt
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)
.
completeAfterExecuteUnlocked
in interface DdlMultipleTransactionStmt
ddlValidator
- DDL validator for this statementsession
- reentrant Farrago session which may be used to execute DML
statementssuccess
- whether the execution succeeded; detection of failure can
be used to recoverprivate void crashIfTrapSet()
protected boolean shouldRebuildIndexes(FarragoSessionDdlValidator ddlValidator)
ddlValidator
- validator for this DDL statement
protected abstract String getReloadDml(SqlPrettyWriter writer)
writer
- writer to uses for generating SQL
protected void setRecoveryRef(FemRecoveryReference recoveryRef)
recoveryRef
- recovery reference for this operationprotected CwmTable getTable()
protected CwmTable getOldTableStructureForIndexMap()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |