1 |
|
//---PACKAGE DECLARATION--- |
2 |
< |
package uk.ac.ukc.iscream.filter.plugins; |
2 |
> |
package uk.org.iscream.filter.plugins; |
3 |
|
|
4 |
|
//---IMPORTS--- |
5 |
< |
import uk.ac.ukc.iscream.filter.PluginFilter; |
6 |
< |
import uk.ac.ukc.iscream.filter.*; |
7 |
< |
import uk.ac.ukc.iscream.core.*; |
8 |
< |
import uk.ac.ukc.iscream.util.*; |
5 |
> |
import uk.org.iscream.filter.PluginFilter; |
6 |
> |
import uk.org.iscream.filter.*; |
7 |
> |
import uk.org.iscream.core.*; |
8 |
> |
import uk.org.iscream.util.*; |
9 |
> |
import uk.org.iscream.componentmanager.*; |
10 |
|
|
11 |
|
/** |
12 |
|
* A first plugin! ;-) |
24 |
|
*/ |
25 |
|
public final String REVISION = "$Revision$"; |
26 |
|
|
27 |
< |
public final String DESC = "Rejects packets that do not have an ip, machine_name, seq_no and date specified as attributes of the root packet tag."; |
27 |
> |
public final String DESC = "Rejects packets that do not have an ip, machine_name, seq_no, date and type specified as attributes of the root packet tag."; |
28 |
|
|
29 |
|
//---STATIC METHODS--- |
30 |
|
|
35 |
|
// apply the filter and return true if successful. |
36 |
|
public boolean runFilter(XMLPacket packet){ |
37 |
|
|
38 |
< |
// return false if any of the essential data is not present. |
38 |
> |
// return true if a heartbeat packet seems ok |
39 |
> |
if (packet.getParam("packet.attributes.type").equals("heartbeat") |
40 |
> |
&& packet.getParam("packet.attributes.date") != null |
41 |
> |
&& packet.getParam("packet.attributes.ip") != null |
42 |
> |
&& packet.getParam("packet.attributes.machine_name") != null){ |
43 |
> |
return true; |
44 |
> |
} |
45 |
> |
|
46 |
> |
// return true if a queueStat packet seems ok |
47 |
> |
if (packet.getParam("packet.attributes.type").equals("queueStat") |
48 |
> |
&& packet.getParam("packet.attributes.date") != null |
49 |
> |
&& packet.getParam("packet.attributes.name") != null){ |
50 |
> |
return true; |
51 |
> |
} |
52 |
> |
|
53 |
> |
// return false if any of the essential data is not present |
54 |
> |
// in a "data" packet |
55 |
|
if (packet.getParam("packet.attributes.machine_name") == null |
56 |
|
|| packet.getParam("packet.attributes.ip") == null |
57 |
|
|| packet.getParam("packet.attributes.seq_no") == null |
58 |
< |
|| packet.getParam("packet.attributes.date") == null){ |
58 |
> |
|| packet.getParam("packet.attributes.date") == null |
59 |
> |
|| packet.getParam("packet.attributes.type") == null){ |
60 |
|
return false; |
61 |
|
} |
62 |
|
|
69 |
|
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
70 |
|
* method to provide clean logging (every class should have this). |
71 |
|
* |
72 |
< |
* This uses the uk.ac.ukc.iscream.util.NameFormat class |
72 |
> |
* This uses the uk.org.iscream.util.NameFormat class |
73 |
|
* to format the toString() |
74 |
|
* |
75 |
|
* @return the name of this class and its CVS revision |