1 |
// A first plugin! ;-) |
2 |
// this one rejects packets that do not contain all of the 'essential' data. |
3 |
|
4 |
// Plugins must have a suffix of "__Plugin". |
5 |
|
6 |
// pjm2@ukc.ac.uk |
7 |
|
8 |
class EnforceEssentialData__Plugin implements PluginFilter { |
9 |
|
10 |
// apply the filter and return true if successful. |
11 |
public boolean runFilter(XMLPacket packet){ |
12 |
|
13 |
// return false if any of the essential data is not present. |
14 |
if (packet.getParam("machine_name") == null |
15 |
|| packet.getParam("ip") == null |
16 |
|| packet.getParam("seq_no") == null |
17 |
|| packet.getParam("machine_name") == null){ |
18 |
return false; |
19 |
} |
20 |
|
21 |
// otherwise return true! |
22 |
return true; |
23 |
|
24 |
} |
25 |
|
26 |
} |