ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/server/uk/org/iscream/cms/server/filter/plugins/EnforceEssentialData__Plugin.java
Revision: 1.3
Committed: Wed Dec 13 15:08:01 2000 UTC (23 years, 5 months ago) by ajm
Branch: MAIN
Changes since 1.2: +6 -4 lines
Log Message:
fixed imports

File Contents

# Content
1 //---PACKAGE DECLARATION---
2 package uk.ac.ukc.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.*;
9
10 /**
11 * A first plugin! ;-)
12 * this one rejects packets that do not contain all of the 'essential' data.
13 *
14 * @author $Author: ajm4 $
15 * @version $Id: EnforceEssentialData__Plugin.java,v 1.2 2000/12/13 13:37:18 ajm4 Exp $
16 */
17 public class EnforceEssentialData__Plugin implements PluginFilter {
18
19 //---FINAL ATTRIBUTES---
20
21 /**
22 * The current CVS revision of this class
23 */
24 public final String REVISION = "$Revision: 1.2 $";
25
26 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
28 //---STATIC METHODS---
29
30 //---CONSTRUCTORS---
31
32 //---PUBLIC METHODS---
33
34 // apply the filter and return true if successful.
35 public boolean runFilter(XMLPacket packet){
36
37 // return false if any of the essential data is not present.
38 if (packet.getParam("packet.attributes.machine_name") == null
39 || packet.getParam("packet.attributes.ip") == null
40 || packet.getParam("packet.attributes.seq_no") == null
41 || packet.getParam("packet.attributes.date") == null){
42 return false;
43 }
44
45 // otherwise return true!
46 return true;
47
48 }
49
50 /**
51 * Overrides the {@link java.lang.Object#toString() Object.toString()}
52 * method to provide clean logging (every class should have this).
53 *
54 * This uses the uk.ac.ukc.iscream.util.NameFormat class
55 * to format the toString()
56 *
57 * @return the name of this class and its CVS revision
58 */
59 public String toString() {
60 return FormatName.getName(
61 _name,
62 getClass().getName(),
63 REVISION);
64 }
65
66 /**
67 * return the String representation of what the filter does
68 */
69 public String getDescription(){
70 return DESC;
71 }
72
73 //---PRIVATE METHODS---
74
75 //---ACCESSOR/MUTATOR METHODS---
76
77 //---ATTRIBUTES---
78
79 /**
80 * This is the friendly identifier of the
81 * component this class is running in.
82 * eg, a Filter may be called "filter1",
83 * If this class does not have an owning
84 * component, a name from the configuration
85 * can be placed here. This name could also
86 * be changed to null for utility classes.
87 */
88 private String _name = FilterMain.NAME;
89
90 /**
91 * This holds a reference to the
92 * system logger that is being used.
93 */
94 private Logger _logger = ReferenceManager.getInstance().getLogger();
95
96 //---STATIC ATTRIBUTES---
97
98 }