1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.jdiagnose.library;
17
18 import org.jdiagnose.DiagnosticUnit;
19 import org.jdiagnose.Pingable;
20
21 /***
22 * Diagnoses an object that implements the Pingable interface
23 *
24 * @see org.jdiagnose.Pingable
25 * @author jmccrindle
26 */
27 public class PingableDiagnostic extends DiagnosticUnit {
28
29 private Pingable pingable = null;
30
31 /***
32 * Creates a new DiagnosticUnit. It's name defaults to the FQ class name.
33 */
34 public PingableDiagnostic() {
35 }
36
37 /***
38 * Create a new DiagnosticUnit with a Fully Qualified Name
39 *
40 * @param name the name of this diagnostic.
41 */
42 public PingableDiagnostic(String name, Pingable pingable) {
43 super(name);
44 this.pingable = pingable;
45 }
46
47 /***
48 * Creates a new DiagnosticUnit. It's name defaults to the FQ class name.
49 */
50 public PingableDiagnostic(Pingable pingable) {
51 this.pingable = pingable;
52 }
53
54 public void diagnosePing() throws Throwable {
55 pingable.ping();
56 }
57
58 public Pingable getPingable() {
59 return pingable;
60 }
61
62 public void setPingable(Pingable pingable) {
63 this.pingable = pingable;
64 }
65
66 }