1 |
pjm2 |
1.1 |
// a demo program to make and use a plugin filter manager |
2 |
|
|
|
3 |
|
|
// pjm2@ukc.ac.uk |
4 |
|
|
|
5 |
|
|
class PluginDemo { |
6 |
|
|
|
7 |
|
|
|
8 |
|
|
// Test the PluginFilterManager with some XMLPackets. |
9 |
|
|
public static void main(String[] args){ |
10 |
|
|
|
11 |
pjm2 |
1.3 |
PluginFilterManager pfm = PluginFilterManager.getInstance(); |
12 |
pjm2 |
1.1 |
|
13 |
|
|
// Some XMLPackets to test with... |
14 |
|
|
XMLPacket validPacket = new XMLPacket(); |
15 |
|
|
XMLPacket emptyPacket = new XMLPacket(); |
16 |
|
|
XMLPacket nearlyEmptyPacket = new XMLPacket(); |
17 |
|
|
|
18 |
|
|
// Add some stuff to the valid packet (i.e. all essential info) |
19 |
pjm2 |
1.2 |
validPacket.addParam("packet.attributes.machine_name", "raptor"); |
20 |
|
|
validPacket.addParam("packet.attributes.ip", "129.12.225.53"); |
21 |
|
|
validPacket.addParam("packet.attributes.seq_no", "552"); |
22 |
|
|
validPacket.addParam("packet.attributes.date", "934999665636"); |
23 |
pjm2 |
1.1 |
|
24 |
|
|
// Add nothing to the empty packet |
25 |
|
|
|
26 |
|
|
// Add just the machine name to the nearly empty packet. |
27 |
pjm2 |
1.2 |
nearlyEmptyPacket.addParam("packet.attributes.machine_name", "craptor"); |
28 |
pjm2 |
1.1 |
|
29 |
|
|
// Run the XMLPackets through the filter pipeline. |
30 |
|
|
System.out.println(""); |
31 |
|
|
System.out.println("Well, did they make it through the filter pipeline?!"); |
32 |
|
|
System.out.println("validPacket: "+pfm.runFilters(validPacket)); |
33 |
|
|
System.out.println("emptyPacket: "+pfm.runFilters(emptyPacket)); |
34 |
|
|
System.out.println("nearlyEmptyPacket: "+pfm.runFilters(nearlyEmptyPacket)); |
35 |
|
|
|
36 |
|
|
} |
37 |
|
|
|
38 |
|
|
} |