|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.prevayler.util.memento.MementoTransaction
public abstract class MementoTransaction
An atomic transaction to be executed on a PrevalentSystem. Any operation which changes the observable state of a PrevalentSystem must be encapsulated as a Command. This command adds the capability to create mementos of objects before they get modified. In the event of a failure, these mementos are restored and the system is left in the state it was in before the command got executed. The execution is split in four parts:
Constructor Summary | |
---|---|
MementoTransaction()
|
Method Summary | |
---|---|
protected abstract void |
checkPrecondition()
Check the precondition. |
protected abstract void |
createMementos(MementoCollector collector)
Create mementos for all objects which (possibly) get modified. |
protected abstract Account |
execute(MementoCollector collector)
Execute the actual command. |
Account |
execute(MementoCollector collector,
Bank prevalentSystem)
Executes this command on the received system. |
protected abstract void |
findObjects(Bank prevalentSystem)
Find the objects this command modifies. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MementoTransaction()
Method Detail |
---|
public Account execute(MementoCollector collector, Bank prevalentSystem) throws Exception
collector
- The memento collector to which to add the mementos. A memento
collector instead of a Prevayler instance is passed, so the command will not easily
invoke subcommands through the prevayler (which is not allowed).prevalentSystem
- The system on which to execute the command.
Exception
protected abstract void findObjects(Bank prevalentSystem) throws Exception
prevalentSystem
- The prevalent system in which to find the objects.
Exception
protected abstract void checkPrecondition() throws Exception
Exception
protected abstract void createMementos(MementoCollector collector)
collector
- The memento collector to which to add the mementos.protected abstract Account execute(MementoCollector collector) throws Exception
collector
- The memento collector which can be used to execute subcommands.
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |