01: /*
02: * This software is released under a licence similar to the Apache Software Licence.
03: * See org.logicalcobwebs.proxool.package.html for details.
04: * The latest version is available at http://proxool.sourceforge.net
05: */
06: package org.logicalcobwebs.proxool.admin;
07:
08: import org.logicalcobwebs.proxool.ProxoolFacade;
09: import org.logicalcobwebs.proxool.ResultMonitor;
10:
11: /**
12: * A ResultMonitor specifically for Snapshots
13: *
14: * @version $Revision: 1.4 $, $Date: 2003/03/03 11:12:05 $
15: * @author bill
16: * @author $Author: billhorsman $ (current maintainer)
17: * @since Proxool 0.8
18: */
19: public abstract class SnapshotResultMonitor extends ResultMonitor {
20:
21: private SnapshotIF snapshot;
22:
23: private String alias;
24:
25: /**
26: * @param alias so we can lookup the latest {@link SnapshotIF snapshot}
27: */
28: public SnapshotResultMonitor(String alias) {
29: this .alias = alias;
30: }
31:
32: /**
33: * Passes the latest snapshot to {@link #check(org.logicalcobwebs.proxool.admin.SnapshotIF) check}.
34: * @return {@link #SUCCESS} or {@link #TIMEOUT}
35: * @throws Exception if anything goes wrong
36: */
37: public boolean check() throws Exception {
38: snapshot = ProxoolFacade.getSnapshot(alias);
39: return check(snapshot);
40: }
41:
42: /**
43: * Override this with your specific check
44: * @param snapshot the latest snapshot
45: * @return true if the result has happened, else false
46: * @throws Exception if anything goes wrong
47: */
48: public abstract boolean check(SnapshotIF snapshot) throws Exception;
49:
50: /**
51: * Get the snapshot used in the most recent {@link #check(org.logicalcobwebs.proxool.admin.SnapshotIF) check}
52: * @return snapshot
53: */
54: public SnapshotIF getSnapshot() {
55: return snapshot;
56: }
57:
58: }
59:
60: /*
61: Revision history:
62: $Log: SnapshotResultMonitor.java,v $
63: Revision 1.4 2003/03/03 11:12:05 billhorsman
64: fixed licence
65:
66: Revision 1.3 2003/03/01 15:27:24 billhorsman
67: checkstyle
68:
69: Revision 1.2 2003/03/01 15:22:50 billhorsman
70: doc
71:
72: Revision 1.1 2003/03/01 15:14:14 billhorsman
73: new ResultMonitor to help cope with test threads
74:
75: */
|