1 |
|
//---PACKAGE DECLARATION--- |
2 |
< |
package uk.ac.ukc.iscream.client.monitors; |
2 |
> |
package uk.org.iscream.client.monitors; |
3 |
|
|
4 |
|
//---IMPORTS--- |
5 |
< |
import uk.ac.ukc.iscream.client.*; |
6 |
< |
import uk.ac.ukc.iscream.core.*; |
7 |
< |
import uk.ac.ukc.iscream.util.*; |
8 |
< |
import uk.ac.ukc.iscream.componentmanager.*; |
5 |
> |
import uk.org.iscream.client.*; |
6 |
> |
import uk.org.iscream.core.*; |
7 |
> |
import uk.org.iscream.util.*; |
8 |
> |
import uk.org.iscream.componentmanager.*; |
9 |
|
|
10 |
|
/** |
11 |
|
* Provides a full XMLPacket feed to the WebFeeder |
13 |
|
* @author $Author$ |
14 |
|
* @version $Id$ |
15 |
|
*/ |
16 |
< |
public class WebFeeder__Monitor implements PluginMonitor { |
16 |
> |
public class WebFeeder__Monitor extends Thread implements PluginMonitor { |
17 |
|
|
18 |
|
//---FINAL ATTRIBUTES--- |
19 |
|
|
30 |
|
|
31 |
|
public WebFeeder__Monitor() { |
32 |
|
_webFeeder = WebFeeder.getInstance(); |
33 |
+ |
this.start(); |
34 |
|
} |
35 |
|
|
36 |
|
//---PUBLIC METHODS--- |
37 |
|
|
38 |
+ |
public void run() { |
39 |
+ |
try { |
40 |
+ |
analysePacket((XMLPacket) getQueue().get(getQueueId())); |
41 |
+ |
} catch (InvalidQueueException e) { |
42 |
+ |
_logger.write(this.toString(), Logger.ERROR, "Unable to get queue."); |
43 |
+ |
} |
44 |
+ |
} |
45 |
+ |
|
46 |
|
public void analysePacket(XMLPacket packet) { |
47 |
< |
_webFeeder.receiveXMLPacket(packet); |
47 |
> |
try { |
48 |
> |
ConfigurationProxy.getInstance().getProperty("WebFeeder", "WebFeeder.latestActive"); |
49 |
> |
_webFeeder.receiveXMLPacket(packet); |
50 |
> |
} catch (PropertyNotFoundException e) { |
51 |
> |
// we don't care, this means we shouldn't be active |
52 |
> |
} |
53 |
|
} |
54 |
|
|
55 |
|
public String getDescription() { |
60 |
|
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
61 |
|
* method to provide clean logging (every class should have this). |
62 |
|
* |
63 |
< |
* This uses the uk.ac.ukc.iscream.util.FormatName class |
63 |
> |
* This uses the uk.org.iscream.util.FormatName class |
64 |
|
* to format the toString() |
65 |
|
* |
66 |
|
* @return the name of this class and its CVS revision |
76 |
|
|
77 |
|
//---ACCESSOR/MUTATOR METHODS--- |
78 |
|
|
79 |
+ |
protected Queue getQueue() { |
80 |
+ |
return MonitorManager.getInstance().getAllQueue(); |
81 |
+ |
} |
82 |
+ |
|
83 |
+ |
protected int getQueueId() { |
84 |
+ |
if (_qID == -1) { |
85 |
+ |
_qID = getQueue().getQueue(); |
86 |
+ |
} |
87 |
+ |
return _qID; |
88 |
+ |
} |
89 |
+ |
|
90 |
|
//---ATTRIBUTES--- |
91 |
|
|
92 |
|
// reference to the WebFeeder |
108 |
|
* system logger that is being used. |
109 |
|
*/ |
110 |
|
private Logger _logger = ReferenceManager.getInstance().getLogger(); |
111 |
+ |
|
112 |
+ |
protected int _qID = -1; |
113 |
|
|
114 |
|
//---STATIC ATTRIBUTES--- |
115 |
|
|