1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.jdiagnose.example;
17
18 import java.net.UnknownHostException;
19
20 import org.jdiagnose.library.JavaVersionDiagnostic;
21 import org.jdiagnose.remote.DefaultAgent;
22 import org.jdiagnose.remote.SendingResultListener;
23 import org.jdiagnose.remote.comms.HttpSender;
24 import org.jdiagnose.runtime.DefaultDiagnosticRunner;
25 import org.jdiagnose.runtime.DiagnosticRunner;
26
27 /***
28 * Example class that sends remote results
29 *
30 * @author jmccrindle
31 */
32 public class Main {
33
34 /***
35 * @param args expects single URL argument, usually: http://host:port/jdiagnose/httplistener.htm
36 * @throws UnknownHostException if the application can't find out the current hostname
37 */
38 public static void main(String[] args) throws UnknownHostException {
39
40
41
42 JavaVersionDiagnostic diagnostic = new JavaVersionDiagnostic("1.3+");
43
44
45 DiagnosticRunner runner = new DefaultDiagnosticRunner(diagnostic);
46
47
48
49 DefaultAgent agent = new DefaultAgent("jdiagnose");
50 agent.init();
51
52
53 HttpSender httpSender = new HttpSender(args[0]);
54
55
56 runner.addResultListener(new SendingResultListener(httpSender, agent));
57
58
59 runner.run();
60
61 }
62 }