/[xulu]/branches/1.8-gt2-2.6/src/appl/parallel/event/SimpleConsoleMonitor.java
ViewVC logotype

Annotation of /branches/1.8-gt2-2.6/src/appl/parallel/event/SimpleConsoleMonitor.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 47 - (hide annotations)
Mon Aug 31 14:23:19 2009 UTC (15 years, 3 months ago) by mojays
File size: 2096 byte(s)
Branch 1.8-gt2-2.6 (from rev 45) for geotools 2.6 migration
1 mojays 2 package appl.parallel.event;
2    
3     import java.awt.event.ActionEvent;
4     import java.awt.event.ActionListener;
5    
6     import org.apache.log4j.LogManager;
7     import org.apache.log4j.Logger;
8    
9     import appl.parallel.client.RemoteEventHandler;
10     import appl.parallel.client.RemoteExecutionController;
11     import edu.bonn.xulu.XuluModellingPlatform;
12     import edu.bonn.xulu.appl.AbstractXuluPlugin;
13     import edu.bonn.xulu.appl.XuluPlugin;
14    
15     /**
16     * A simple {@link XuluPlugin} that outputs received {@link TimeEvent}s
17     * and {@link TransferEvent}s to the console.
18     *
19     * @author Dominik Appl
20     */
21     public class SimpleConsoleMonitor extends AbstractXuluPlugin implements
22     TimeMonitor, TransferMonitor {
23    
24     protected final Logger LOG = LogManager
25     .getLogger(this.getClass().getName());
26    
27     RemoteEventHandler eventProxy;
28    
29     public SimpleConsoleMonitor() {
30     super(false);
31    
32     }
33    
34     /*
35     * (non-Javadoc)
36     *
37     * @see appl.parallel.event.TimeMonitor#receiveTimeEvent(appl.parallel.event.TimeEvent)
38     */
39     public void receiveTimeEvent(TimeEvent t) {
40     System.out.println(t);
41    
42     }
43    
44     /*
45     * (non-Javadoc)
46     *
47     * @see appl.parallel.event.TransferMonitor#receiveTransferEvent(appl.parallel.event.TransferEvent)
48     */
49     public void receiveTransferEvent(TransferEvent t) {
50     System.out.println(t);
51     }
52    
53     /*
54     * (non-Javadoc)
55     *
56     * @see edu.bonn.xulu.appl.XuluPlugin#execute(edu.bonn.xulu.XuluModellingPlatform)
57     */
58     public void execute(XuluModellingPlatform appl) {
59     super.execute(appl);
60     RemoteExecutionController controller = RemoteExecutionController
61     .getRemoteExecutionController(appl);
62     if (controller == null) {
63     LOG
64     .error("Could not find RemoteExecutionController! -> Could not start SimpleConsoleMonitor");
65     return;
66     }
67     eventProxy = controller.getEventProxy();
68     eventProxy.addTimeEventListener(this);
69     eventProxy.addTransferEventListener(this);
70     started = true;
71     }
72    
73     @Override
74     public void stop() {
75     eventProxy.removeTimeMonitor(this);
76     eventProxy.removeTransferMonitor(this);
77     // TODO Auto-generated method stub
78     super.stop();
79     }
80     }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26