1 package org.csc.phynixx.watchdog;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 import java.io.Serializable;
25
26
27 public class WatchdogInfo implements Serializable {
28
29
30
31
32
33 private static final long serialVersionUID = -4208724399286983526L;
34
35 private String info = null;
36
37 private String[] conditions;
38
39 public WatchdogInfo(IWatchdog wd) {
40 this.setConditions(wd);
41 this.setInfo(wd);
42 }
43
44
45 private void setInfo(IWatchdog wd) {
46
47 this.info = wd.getWatchdogInfo();
48
49 }
50
51 private void setConditions(IWatchdog wd) {
52 this.conditions = wd.getConditionInfos();
53
54 }
55
56
57 public String getWatchdogInfo() {
58 return info;
59 }
60
61
62 public String[] getConditions() {
63 return conditions;
64 }
65
66
67 public String[] getWatchdogInfos() {
68 String[] conds = this.getConditions();
69 String[] infos = new String[conds.length + 1];
70
71 infos[0] = this.getWatchdogInfo();
72
73 for (int i = 0; i < conds.length; i++) {
74 infos[i + 1] = " " + conds[i];
75 }
76 return infos;
77
78 }
79
80 public String toString() {
81 StringBuffer buffer = new StringBuffer();
82 buffer.append("Watchdog - executing Thread=" + this.getWatchdogInfo()).append("\n");
83 String[] conds = this.getConditions();
84 for (int i = 0; i < conds.length; i++) {
85 buffer.append(" ").append(conds[i]).append("\n");
86 }
87 return buffer.toString();
88 }
89
90
91 }