net.sf.farrago.query
Class FarragoReentrantStmt

java.lang.Object
  extended by net.sf.farrago.query.FarragoReentrantStmt
Direct Known Subclasses:
DdlRelationalHandler.ReentrantIndexBuilderStmt, FarragoReentrantStmtExecutor

public abstract class FarragoReentrantStmt
extends Object

FarragoReentrantStmt provides infrastructure for safely executing a reentrant statement as part of the preparation of some outer statement. The caller is required to define a subclass which executes the internal statement; the base class takes care of releasing resources correctly regardless of how the internal statement fares.

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/query/FarragoReentrantStmt.java#10 $
Author:
John V. Sichi

Field Summary
private  FarragoSessionPreparingStmt preparingStmt
           
private  FarragoSessionStmtContext rootStmtContext
           
private  FarragoSessionStmtContext stmtContext
           
 
Constructor Summary
FarragoReentrantStmt(FarragoSessionStmtContext rootStmtContext)
           
 
Method Summary
 void execute(FarragoSession session, boolean allocateSession)
          Executes the reentrant statement; subclass specified what to do in executeImpl().
protected abstract  void executeImpl()
          Supplies subclass-specific behavior.
protected  FarragoSessionPreparingStmt getPreparingStmt()
           
protected  FarragoSessionStmtContext getRootStmtContext()
           
protected  FarragoSessionStmtContext getStmtContext()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

preparingStmt

private FarragoSessionPreparingStmt preparingStmt

stmtContext

private FarragoSessionStmtContext stmtContext

rootStmtContext

private FarragoSessionStmtContext rootStmtContext
Constructor Detail

FarragoReentrantStmt

public FarragoReentrantStmt(FarragoSessionStmtContext rootStmtContext)
Method Detail

getPreparingStmt

protected FarragoSessionPreparingStmt getPreparingStmt()

getStmtContext

protected FarragoSessionStmtContext getStmtContext()

getRootStmtContext

protected FarragoSessionStmtContext getRootStmtContext()

executeImpl

protected abstract void executeImpl()
                             throws Exception
Supplies subclass-specific behavior.

Throws:
Exception

execute

public void execute(FarragoSession session,
                    boolean allocateSession)
Executes the reentrant statement; subclass specified what to do in executeImpl().

Parameters:
session - session on which to execute
allocateSession - if true, allocate a re-entrant session; if false, use the given session directly