14 |
|
* @author $Author$ |
15 |
|
* @version $Id$ |
16 |
|
*/ |
17 |
< |
public abstract class MonitorSkeleton implements PluginMonitor { |
17 |
> |
public abstract class MonitorSkeleton extends Thread implements PluginMonitor { |
18 |
|
|
19 |
|
//---FINAL ATTRIBUTES--- |
20 |
|
|
22 |
|
|
23 |
|
//---CONSTRUCTORS--- |
24 |
|
|
25 |
+ |
public MonitorSkeleton() { |
26 |
+ |
this.start(); |
27 |
+ |
} |
28 |
+ |
|
29 |
|
//---PUBLIC METHODS--- |
30 |
|
|
31 |
< |
public abstract void analysePacket(XMLPacket packet); |
31 |
> |
public void run() { |
32 |
> |
try { |
33 |
> |
analysePacket((XMLPacket) getQueue().get(getQueueId())); |
34 |
> |
} catch (InvalidQueueException e) { |
35 |
> |
_logger.write(this.toString(), Logger.ERROR, "Unable to get queue."); |
36 |
> |
} |
37 |
> |
} |
38 |
> |
|
39 |
> |
protected abstract void analysePacket(XMLPacket packet); |
40 |
|
|
41 |
< |
public void processAlert(int newThreshold, String attributeName, Register reg, String source, String currentValue) { |
41 |
> |
protected void processAlert(int newThreshold, String attributeName, Register reg, String source, String currentValue) { |
42 |
|
// decide what threshold level we're on, if we've changed, record that |
43 |
|
if (newThreshold != reg.getLastThresholdLevel()) { |
44 |
|
reg.setLastThresholdLevel(newThreshold); |
112 |
|
|
113 |
|
//---ACCESSOR/MUTATOR METHODS--- |
114 |
|
|
115 |
+ |
protected abstract Queue getQueue(); |
116 |
+ |
|
117 |
+ |
protected int getQueueId() { |
118 |
+ |
if (_qID == -1) { |
119 |
+ |
_qID = getQueue().getQueue(); |
120 |
+ |
} |
121 |
+ |
return _qID; |
122 |
+ |
} |
123 |
+ |
|
124 |
|
//---ATTRIBUTES--- |
125 |
|
|
126 |
|
protected Logger _logger = ReferenceManager.getInstance().getLogger(); |
127 |
|
|
128 |
|
protected Queue _alerterQueue = ClientMain._alerterQueue; |
129 |
+ |
|
130 |
+ |
protected int _qID = -1; |
131 |
|
|
132 |
|
//---STATIC ATTRIBUTES--- |
133 |
|
|