annotate src/org/dancres/blitz/txn/NullBatcher.java @ 17:4580bb12db30

Separate command execution from command logging.
author Dan Creswell <dan.creswell@gmail.com>
date Sun, 05 Jul 2009 16:26:25 +0100
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
1 package org.dancres.blitz.txn;
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
2
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
3 import java.io.IOException;
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
4 import java.io.Serializable;
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
5 import org.prevayler.Command;
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
6 import org.prevayler.PrevalentSystem;
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
7 import org.prevayler.implementation.SnapshotPrevayler;
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
8 import org.prevayler.implementation.PrevaylerCore;
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
9 import org.prevayler.implementation.Snapshotter;
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
10
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
11 public class NullBatcher implements SnapshotPrevayler {
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
12 private PrevaylerCore thePrevayler;
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
13
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
14 NullBatcher(PrevaylerCore aPrevayler) {
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
15 thePrevayler = aPrevayler;
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
16 }
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
17 public Snapshotter takeSnapshot() throws IOException {
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
18 return thePrevayler.takeSnapshot();
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
19 }
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
20
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
21 public PrevalentSystem system() {
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
22 return thePrevayler.system();
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
23 }
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
24
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
25 public Serializable executeCommand(Command aCommand) throws Exception {
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
26 thePrevayler.logCommand(aCommand);
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
27 return aCommand.execute(system());
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
28 }
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
29
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
30 public Serializable executeCommand(Command aCommand, boolean sync) throws Exception {
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
31 thePrevayler.logCommand(aCommand, sync);
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
32 return aCommand.execute(system());
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
33 }
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
34
4580bb12db30 Separate command execution from command logging.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff changeset
35 }