comparison src/org/prevayler/implementation/NullPrevayler.java @ 0:3dc0c5604566

Initial checkin of blitz 2.0 fcs - no installer yet.
author Dan Creswell <dan.creswell@gmail.com>
date Sat, 21 Mar 2009 11:00:06 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:3dc0c5604566
1 package org.prevayler.implementation;
2
3 import java.io.IOException;
4 import java.io.Serializable;
5
6 import org.prevayler.Command;
7 import org.prevayler.PrevalentSystem;
8
9 /**
10 Prevayler which logs nothing but dispatches all commands.
11 */
12 public class NullPrevayler implements SnapshotPrevayler {
13
14 private PrevalentSystem theSystem;
15
16 private Snapshotter theNullSnapshotter = new NullSnapshotter();
17
18 public NullPrevayler(PrevalentSystem aSystem) {
19 theSystem = aSystem;
20 theSystem.clock(new SystemClock());
21 }
22
23 public PrevalentSystem system() {
24 return theSystem;
25 }
26
27 public Serializable executeCommand(Command command) throws Exception {
28 return command.execute(theSystem);
29 }
30
31 public Serializable executeCommand(Command command, boolean sync)
32 throws Exception {
33 return command.execute(theSystem);
34 }
35
36 public synchronized Snapshotter takeSnapshot() throws IOException {
37 return theNullSnapshotter;
38 }
39
40 private static class NullSnapshotter implements Snapshotter {
41 NullSnapshotter() {
42 }
43
44 public void save() throws IOException {
45 // Do nothing
46 }
47 }
48 }