ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/experimental/server/PluginManager/PluginDemo.java
Revision: 1.3
Committed: Fri Dec 1 14:38:47 2000 UTC (23 years, 11 months ago) by pjm2
Branch: MAIN
CVS Tags: PROJECT_COMPLETION, HEAD
Changes since 1.2: +1 -1 lines
Log Message:
Altered the PluginFilterManager such that when it successfully adds each
plugin filter to the plugin filter pipeline, it prints a description of
what each plugin filter does.

There is now a single getInstance() method on the PluginFilterManager that
returns a reference to itself.  If an instance of it does not already
exist, then it calls its own private constructor.

File Contents

# User Rev Content
1 pjm2 1.1 // a demo program to make and use a plugin filter manager
2    
3     // pjm2@ukc.ac.uk
4    
5     class PluginDemo {
6    
7    
8     // Test the PluginFilterManager with some XMLPackets.
9     public static void main(String[] args){
10    
11 pjm2 1.3 PluginFilterManager pfm = PluginFilterManager.getInstance();
12 pjm2 1.1
13     // Some XMLPackets to test with...
14     XMLPacket validPacket = new XMLPacket();
15     XMLPacket emptyPacket = new XMLPacket();
16     XMLPacket nearlyEmptyPacket = new XMLPacket();
17    
18     // Add some stuff to the valid packet (i.e. all essential info)
19 pjm2 1.2 validPacket.addParam("packet.attributes.machine_name", "raptor");
20     validPacket.addParam("packet.attributes.ip", "129.12.225.53");
21     validPacket.addParam("packet.attributes.seq_no", "552");
22     validPacket.addParam("packet.attributes.date", "934999665636");
23 pjm2 1.1
24     // Add nothing to the empty packet
25    
26     // Add just the machine name to the nearly empty packet.
27 pjm2 1.2 nearlyEmptyPacket.addParam("packet.attributes.machine_name", "craptor");
28 pjm2 1.1
29     // Run the XMLPackets through the filter pipeline.
30     System.out.println("");
31     System.out.println("Well, did they make it through the filter pipeline?!");
32     System.out.println("validPacket: "+pfm.runFilters(validPacket));
33     System.out.println("emptyPacket: "+pfm.runFilters(emptyPacket));
34     System.out.println("nearlyEmptyPacket: "+pfm.runFilters(nearlyEmptyPacket));
35    
36     }
37    
38     }