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/TypeChecker__Plugin.java
Revision: 1.2
Committed: Fri Jan 19 00:36:45 2001 UTC (23 years, 4 months ago) by tdb
Branch: MAIN
Changes since 1.1: +4 -4 lines
Log Message:
String checking needs to be done with String.equals() to succeed, at least in
this case :)

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 import uk.ac.ukc.iscream.componentmanager.*;
10
11 /**
12 * This plugin is designed to check the type of incoming packets.
13 *
14 * @author $Author: tdb1 $
15 * @version $Id: TypeChecker__Plugin.java,v 1.1 2001/01/19 00:08:32 tdb1 Exp $
16 */
17 public class TypeChecker__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.1 $";
25
26 public final String DESC = "Checks the type attribute in the packet attributes. This must be correctly specified to allow the packet through.";
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 one of the predetermined types is not set.
38 if(packet.getParam("packet.attributes.type") == null
39 || (!packet.getParam("packet.attributes.type").equals("heartbeat")
40 && !packet.getParam("packet.attributes.type").equals("data"))){
41 return false;
42 }
43
44 // otherwise return true!
45 return true;
46
47 }
48
49 /**
50 * Overrides the {@link java.lang.Object#toString() Object.toString()}
51 * method to provide clean logging (every class should have this).
52 *
53 * This uses the uk.ac.ukc.iscream.util.NameFormat class
54 * to format the toString()
55 *
56 * @return the name of this class and its CVS revision
57 */
58 public String toString() {
59 return FormatName.getName(
60 _name,
61 getClass().getName(),
62 REVISION);
63 }
64
65 /**
66 * return the String representation of what the filter does
67 */
68 public String getDescription(){
69 return DESC;
70 }
71
72 //---PRIVATE METHODS---
73
74 //---ACCESSOR/MUTATOR METHODS---
75
76 //---ATTRIBUTES---
77
78 /**
79 * This is the friendly identifier of the
80 * component this class is running in.
81 * eg, a Filter may be called "filter1",
82 * If this class does not have an owning
83 * component, a name from the configuration
84 * can be placed here. This name could also
85 * be changed to null for utility classes.
86 */
87 private String _name = FilterMain.NAME;
88
89 /**
90 * This holds a reference to the
91 * system logger that is being used.
92 */
93 private Logger _logger = ReferenceManager.getInstance().getLogger();
94
95 //---STATIC ATTRIBUTES---
96
97 }