|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.nakedobjects.runtime.transaction.NakedObjectTransactionManagerAbstract<T>
public abstract class NakedObjectTransactionManagerAbstract<T extends NakedObjectTransaction>
| Constructor Summary | |
|---|---|
NakedObjectTransactionManagerAbstract()
|
|
| Method Summary | ||
|---|---|---|
void |
close()
|
|
protected MessageBroker |
createMessageBroker()
Overridable hook, used in {@link #createTransaction(MessageBroker, UpdateNotifier) |
|
protected T |
createTransaction()
Creates a new transaction and saves, to be accessible in getTransaction(). |
|
protected abstract T |
createTransaction(MessageBroker messageBroker,
UpdateNotifier updateNotifier)
Overridable hook. |
|
protected UpdateNotifier |
createUpdateNotifier()
Overridable hook, used in {@link #createTransaction(MessageBroker, UpdateNotifier) |
|
void |
debugData(DebugString debug)
|
|
protected void |
ensureTransactionInProgress()
|
|
protected void |
ensureTransactionNotInProgress()
|
|
void |
executeWithinTransaction(TransactionalClosure closure)
Run the supplied block of code (closure) in a transaction. |
|
|
executeWithinTransaction(TransactionalClosureWithReturn<Q> closure)
Run the supplied block of code (closure) in a transaction. |
|
protected MessageBroker |
getMessageBroker()
Convenience method returning the MessageBroker
of the current transaction. |
|
NakedObjectSession |
getSession()
The owning NakedObjectSession. |
|
T |
getTransaction()
Current transaction (if any). |
|
protected UpdateNotifier |
getUpdateNotifier()
Convenience method returning the UpdateNotifier
of the current transaction. |
|
void |
injectInto(java.lang.Object candidate)
|
|
boolean |
inTransaction()
|
|
void |
open()
|
|
void |
setSession(NakedObjectSession session)
Should be injected prior to opening |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.nakedobjects.runtime.transaction.NakedObjectTransactionManager |
|---|
abortTransaction, endTransaction, flushTransaction, startTransaction |
| Constructor Detail |
|---|
public NakedObjectTransactionManagerAbstract()
| Method Detail |
|---|
public void open()
open in interface SessionScopedComponentpublic void close()
close in interface SessionScopedComponentpublic T getTransaction()
getTransaction in interface NakedObjectTransactionManagerprotected UpdateNotifier getUpdateNotifier()
UpdateNotifier
of the current transaction.
protected MessageBroker getMessageBroker()
MessageBroker
of the current transaction.
public void executeWithinTransaction(TransactionalClosure closure)
NakedObjectTransactionManagerblock of code (closure) in a transaction.
If a transaction is in progress, then
uses that. Otherwise will start a transaction before
running the block and commit it at the end. If the
closure throws an exception, then will abort the transaction.
executeWithinTransaction in interface NakedObjectTransactionManagerpublic <Q> Q executeWithinTransaction(TransactionalClosureWithReturn<Q> closure)
NakedObjectTransactionManagerblock of code (closure) in a transaction.
If a transaction is in progress, then
uses that. Otherwise will start a transaction before
running the block and commit it at the end. If the
closure throws an exception, then will abort the transaction.
executeWithinTransaction in interface NakedObjectTransactionManagerpublic boolean inTransaction()
protected final T createTransaction()
getTransaction().
protected abstract T createTransaction(MessageBroker messageBroker,
UpdateNotifier updateNotifier)
The provided MessageBroker and UpdateNotifier are obtained from
the hook methods (createMessageBroker() and createUpdateNotifier()).
createMessageBroker(),
createUpdateNotifier()protected MessageBroker createMessageBroker()
Called when a new {@link NakedObjectTransaction} is created.
protected UpdateNotifier createUpdateNotifier()
Called when a new {@link NakedObjectTransaction} is created.
protected void ensureTransactionInProgress()
protected void ensureTransactionNotInProgress()
public void injectInto(java.lang.Object candidate)
injectInto in interface Injectablepublic void debugData(DebugString debug)
debugData in interface NakedObjectTransactionManagerpublic NakedObjectSession getSession()
NakedObjectTransactionManagerNakedObjectSession.
Will be non-null when opened, but null if closed .
getSession in interface NakedObjectTransactionManagerpublic void setSession(NakedObjectSession session)
opening
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||