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.4
Committed: Wed Mar 14 23:25:29 2001 UTC (23 years, 2 months ago) by tdb
Branch: MAIN
CVS Tags: PROJECT_COMPLETION
Changes since 1.3: +9 -9 lines
Log Message:
The whole server package structure has been changed.
Old Package: uk.ac.ukc.iscream.*
New Package: uk.org.iscream.*

File Contents

# User Rev Content
1 tdb 1.1 //---PACKAGE DECLARATION---
2 tdb 1.4 package uk.org.iscream.filter.plugins;
3 tdb 1.1
4     //---IMPORTS---
5 tdb 1.4 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 tdb 1.1
11     /**
12     * This plugin is designed to check the type of incoming packets.
13     *
14 tdb 1.2 * @author $Author: tdb1 $
15 tdb 1.4 * @version $Id: TypeChecker__Plugin.java,v 1.3 2001/02/12 02:23:14 tdb1 Exp $
16 tdb 1.1 */
17     public class TypeChecker__Plugin implements PluginFilter {
18    
19     //---FINAL ATTRIBUTES---
20    
21     /**
22     * The current CVS revision of this class
23     */
24 tdb 1.4 public final String REVISION = "$Revision: 1.3 $";
25 tdb 1.1
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 tdb 1.2 || (!packet.getParam("packet.attributes.type").equals("heartbeat")
40 tdb 1.3 && !packet.getParam("packet.attributes.type").equals("queueStat")
41 tdb 1.2 && !packet.getParam("packet.attributes.type").equals("data"))){
42 tdb 1.1 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 tdb 1.4 * This uses the uk.org.iscream.util.NameFormat class
55 tdb 1.1 * 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     }