net.sf.farrago.session.mock
Class MockReposTxnContext

java.lang.Object
  extended by net.sf.farrago.catalog.FarragoReposTxnContext
      extended by net.sf.farrago.session.mock.MockReposTxnContext

public class MockReposTxnContext
extends FarragoReposTxnContext

MockReposTxnContext overrides FarragoReposTxnContext so that no FarragoRepos implementation is needed. Note that this class does not actually create any transaction or lock. See MockSessionStmtValidator.

Since:
Dec 8, 2006
Version:
$Id: //open/dev/farrago/src/net/sf/farrago/session/mock/MockReposTxnContext.java#6 $
Author:
stephan/jack

Field Summary
private  boolean isRead
           
private  boolean isWrite
           
private  boolean locked
           
 
Constructor Summary
MockReposTxnContext()
           
 
Method Summary
 void beginLockedTxn(boolean readOnly)
          Acquires a repository lock and begins a matching MDR transaction (shared lock for read, or exclusive lock for write).
 void beginReadTxn()
          Begins a new read-only transaction.
 void beginWriteTxn()
          Begins a new read/write transaction.
 void commit()
          Commits the active transaction, if any.
 boolean isReadTxnInProgress()
           
 boolean isTxnInProgress()
           
 void rollback()
          Rolls back the active transaction, if any.
 void unlockAfterTxn()
          Releases lock acquired by beginLockedTxn.
 
Methods inherited from class net.sf.farrago.catalog.FarragoReposTxnContext
beginExclusiveAccess, endExclusiveAccess, setReposReadOnly
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isRead

private boolean isRead

isWrite

private boolean isWrite

locked

private boolean locked
Constructor Detail

MockReposTxnContext

public MockReposTxnContext()
Method Detail

beginReadTxn

public void beginReadTxn()
Description copied from class: FarragoReposTxnContext
Begins a new read-only transaction.

Overrides:
beginReadTxn in class FarragoReposTxnContext

beginWriteTxn

public void beginWriteTxn()
Description copied from class: FarragoReposTxnContext
Begins a new read/write transaction.

Overrides:
beginWriteTxn in class FarragoReposTxnContext

commit

public void commit()
Description copied from class: FarragoReposTxnContext
Commits the active transaction, if any.

Overrides:
commit in class FarragoReposTxnContext

isReadTxnInProgress

public boolean isReadTxnInProgress()
Overrides:
isReadTxnInProgress in class FarragoReposTxnContext
Returns:
whether a read-only transaction is currently in progress

isTxnInProgress

public boolean isTxnInProgress()
Overrides:
isTxnInProgress in class FarragoReposTxnContext
Returns:
whether a transaction is currently in progress

rollback

public void rollback()
Description copied from class: FarragoReposTxnContext
Rolls back the active transaction, if any.

Overrides:
rollback in class FarragoReposTxnContext

beginLockedTxn

public void beginLockedTxn(boolean readOnly)
Description copied from class: FarragoReposTxnContext
Acquires a repository lock and begins a matching MDR transaction (shared lock for read, or exclusive lock for write). Typical usage is start of SQL statement preparation (e.g. readOnly=true for DML or query, false for DDL).

Overrides:
beginLockedTxn in class FarragoReposTxnContext
Parameters:
readOnly - if true, a shared lock is acquired on the catalog; otherwise, an exclusive lock is acquired

unlockAfterTxn

public void unlockAfterTxn()
Description copied from class: FarragoReposTxnContext
Releases lock acquired by beginLockedTxn. Caller should already have ended transaction with either commit or rollback.

Overrides:
unlockAfterTxn in class FarragoReposTxnContext