1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.jdiagnose.remote.system;
17
18 import java.util.ArrayList;
19 import java.util.Iterator;
20 import java.util.LinkedList;
21 import java.util.List;
22
23 import org.jdiagnose.RemoteResult;
24 import org.jdiagnose.runtime.ResultState;
25
26 /***
27 * @author jmccrindle
28 */
29 public class DefaultRemoteDiagnostic implements RemoteDiagnostic {
30
31 private String name;
32 private List remoteResultList = new LinkedList();
33
34 public DefaultRemoteDiagnostic(String name) {
35 this.name = name;
36 }
37
38
39
40
41 public String getName() {
42 return name;
43 }
44
45
46
47
48 public Iterator getRemoteResults() {
49 return new ArrayList(remoteResultList).iterator();
50 }
51
52 /***
53 * @return
54 */
55 public List getRemoteResultList() {
56 return remoteResultList;
57 }
58
59
60
61
62 public boolean isUp() {
63 if(remoteResultList != null && remoteResultList.size() > 0) {
64 RemoteResult result = (RemoteResult) remoteResultList.get(0);
65 return result.getResultInfo().getState() != ResultState.FAILED;
66 } else {
67 return true;
68 }
69 }
70
71
72
73
74 public String toString() {
75 return "{" + name + ", " + remoteResultList.toString() + "}";
76 }
77
78 }