1
2
3
4
5 package org.abraracourcix.alipes.alerters;
6 import java.net.MalformedURLException;
7 import java.net.URL;
8 import org.abraracourcix.alipes.common.Event;
9 import org.abraracourcix.alipes.listeners.filter.EventFilterListener;
10 import org.abraracourcix.alipes.listeners.logging.ConsoleListener;
11 import org.abraracourcix.alipes.listeners.status.StatusFrame;
12 import org.abraracourcix.alipes.listeners.status.StatusListener;
13 import org.abraracourcix.alipes.monitors.url.URLEvent;
14 import org.abraracourcix.alipes.monitors.url.URLMonitor;
15 import org.abraracourcix.alipes.pipes.Multiplexor;
16 /***
17 *
18 * About as trivial as we can make it. An alerter that watches the local tomcat
19 * inst.
20 * @author jdt
21 */
22 public final class CommonHostsJDTAlerter {
23 /***
24 * Hide public Constructor
25 *
26 */
27 private CommonHostsJDTAlerter() {
28 }
29 /***
30 * Main method - @TODO needs tarting up
31 *
32 * @param args
33 * ignored
34 * @throws MalformedURLException
35 * whoops
36 * @throws InterruptedException
37 * whoops
38 */
39 public static void main(final String[] args)
40 throws MalformedURLException, InterruptedException {
41 System.out.println("Hit ctrl-C when you get bored");
42 Event[] events =
43 { URLEvent.DOWN, URLEvent.GONE_DOWN, URLEvent.GONE_UP };
44 Multiplexor multiplex = new Multiplexor();
45 EventFilterListener filterAndConsole =
46 new EventFilterListener(
47 new ConsoleListener(),
48 events,
49 EventFilterListener.FilterType.INCLUDED);
50 multiplex.addListener(filterAndConsole);
51 URLMonitor mon =
52 new URLMonitor(
53 multiplex,
54 5,
55 new URL("http://uml01.astrogrid.org:8080"));
56 mon.addNewURL(new URL("http://vm05.astrogrid.org:8080"));
57 mon.addNewURL(new URL("http://vm06.astrogrid.org:8080"));
58 mon.addNewURL(new URL("http://vm07.astrogrid.org:8080"));
59 mon.addNewURL(new URL("http://localhost:8080"));
60 mon.start();
61 StatusFrame frame = new StatusFrame();
62 StatusListener statusListener = new StatusListener(frame);
63 frame.registerStatusListener(statusListener);
64 frame.show();
65 multiplex.addListener(statusListener);
66 Thread.sleep(60 * 10 * 1000);
67 }
68 }
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97