ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/experimental/server/PluginManager/EnforceEssentialData__Plugin.java
Revision: 1.2
Committed: Fri Dec 1 14:29:29 2000 UTC (23 years, 5 months ago) by pjm2
Branch: MAIN
CVS Tags: PROJECT_COMPLETION, HEAD
Changes since 1.1: +9 -4 lines
Log Message:
Added a getDescription method to the class.  Now also using the full
packet.attributes.blablalba parameter names.

File Contents

# User Rev Content
1 pjm2 1.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 pjm2 1.2 if (packet.getParam("packet.attributes.machine_name") == null
15     || packet.getParam("packet.attributes.ip") == null
16     || packet.getParam("packet.attributes.seq_no") == null
17     || packet.getParam("packet.attributes.date") == null){
18 pjm2 1.1 return false;
19     }
20    
21     // otherwise return true!
22     return true;
23    
24 pjm2 1.2 }
25    
26     // return the String representation of what the filter does
27     public String getDescription(){
28     return "Rejects packets that do not have an ip, machine_name, seq_no and date specified as attributes of the root packet tag.";
29 pjm2 1.1 }
30    
31     }