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.7
Committed: Tue May 21 16:47:18 2002 UTC (22 years ago) by tdb
Branch: MAIN
Changes since 1.6: +3 -2 lines
Log Message:
Added URL to GPL headers.

File Contents

# Content
1 /*
2 * i-scream central monitoring system
3 * http://www.i-scream.org.uk
4 * Copyright (C) 2000-2002 i-scream
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */
20
21 //---PACKAGE DECLARATION---
22 package uk.org.iscream.cms.server.filter.plugins;
23
24 //---IMPORTS---
25 import uk.org.iscream.cms.server.filter.PluginFilter;
26 import uk.org.iscream.cms.server.filter.*;
27 import uk.org.iscream.cms.server.core.*;
28 import uk.org.iscream.cms.server.util.*;
29 import uk.org.iscream.cms.server.componentmanager.*;
30
31 /**
32 * This plugin is designed to check the type of incoming packets.
33 *
34 * @author $Author: tdb $
35 * @version $Id: TypeChecker__Plugin.java,v 1.6 2002/05/18 18:16:02 tdb Exp $
36 */
37 public class TypeChecker__Plugin implements PluginFilter {
38
39 //---FINAL ATTRIBUTES---
40
41 /**
42 * The current CVS revision of this class
43 */
44 public final String REVISION = "$Revision: 1.6 $";
45
46 public final String DESC = "Checks the type attribute in the packet attributes. This must be correctly specified to allow the packet through.";
47
48 //---STATIC METHODS---
49
50 //---CONSTRUCTORS---
51
52 //---PUBLIC METHODS---
53
54 // apply the filter and return true if successful.
55 public boolean runFilter(XMLPacket packet){
56
57 // return false if one of the predetermined types is not set.
58 if(packet.getParam("packet.attributes.type") == null
59 || (!packet.getParam("packet.attributes.type").equals("heartbeat")
60 && !packet.getParam("packet.attributes.type").equals("queueStat")
61 && !packet.getParam("packet.attributes.type").equals("data"))){
62 return false;
63 }
64
65 // otherwise return true!
66 return true;
67
68 }
69
70 /**
71 * Overrides the {@link java.lang.Object#toString() Object.toString()}
72 * method to provide clean logging (every class should have this).
73 *
74 * This uses the uk.org.iscream.cms.server.util.NameFormat class
75 * to format the toString()
76 *
77 * @return the name of this class and its CVS revision
78 */
79 public String toString() {
80 return FormatName.getName(
81 _name,
82 getClass().getName(),
83 REVISION);
84 }
85
86 /**
87 * return the String representation of what the filter does
88 */
89 public String getDescription(){
90 return DESC;
91 }
92
93 //---PRIVATE METHODS---
94
95 //---ACCESSOR/MUTATOR METHODS---
96
97 //---ATTRIBUTES---
98
99 /**
100 * This is the friendly identifier of the
101 * component this class is running in.
102 * eg, a Filter may be called "filter1",
103 * If this class does not have an owning
104 * component, a name from the configuration
105 * can be placed here. This name could also
106 * be changed to null for utility classes.
107 */
108 private String _name = FilterMain.NAME;
109
110 /**
111 * This holds a reference to the
112 * system logger that is being used.
113 */
114 private Logger _logger = ReferenceManager.getInstance().getLogger();
115
116 //---STATIC ATTRIBUTES---
117
118 }