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/FilterThread.java
(Generate patch)

Comparing projects/cms/source/server/uk/org/iscream/cms/server/filter/FilterThread.java (file contents):
Revision 1.15 by tdb, Fri Jan 12 00:45:25 2001 UTC vs.
Revision 1.23 by tdb, Mon Feb 12 00:45:33 2001 UTC

# Line 6 | Line 6 | import java.io.*;
6   import java.net.*;
7   import java.util.*;
8   import uk.ac.ukc.iscream.core.*;
9 + import uk.ac.ukc.iscream.componentmanager.*;
10   import uk.ac.ukc.iscream.filter.*;
11   import uk.ac.ukc.iscream.util.*;
12  
# Line 34 | Line 35 | public class FilterThread extends Thread{
35   //---CONSTRUCTORS---
36    
37      /**
38 <     * Class constructor.
38 >     * Constructs an instance of a FilterThread
39 >     *
40 >     * @param queue the Queue this filter is using
41 >     * @param parent a CORBA reference to our parent filter
42       */
43      public FilterThread(Queue queue, Filter parent){
44          _parent = parent;
45          _queue = queue;
46 <        _logger.write(toString(), Logger.DEBUG, "created");
46 >        _logger.write(toString(), Logger.SYSINIT, "created");
47      }
48  
49   //---PUBLIC METHODS---
50  
51      /**
52 <     * Runs the thread
52 >     * Runs the thread, getting data from the Queue and
53 >     * sending it on to the parent filter.
54       */
55      public void run(){
56          // get a queue for ourselves
57          int n = _queue.getQueue();
58 <        // keep this out here, saves recreating the object
58 >        // keep these out here, saves recreating the object
59          String xml = null;
60          while(true) {
61              // get a String of xml
# Line 70 | Line 75 | public class FilterThread extends Thread{
75                  xml = xml.substring(0, xml.length());
76              }
77              
78 +            // Bundle the XML all on one line (saves space and simplifies
79 +            // the protocol between clientinterface and client).
80 +            StringTokenizer tokenizer = new StringTokenizer(new String(xml), "\n");
81 +            xml = "";
82 +            while (tokenizer.hasMoreTokens()) {
83 +                xml += tokenizer.nextToken();
84 +            }
85 +            
86              // Use XMLPacketMaker to make an XMLPacket object.
87              XMLPacketMaker xmlPacketMaker = new XMLPacketMaker(xml);
88              XMLPacket packet = xmlPacketMaker.createXMLPacket();
89                    
90 <            if(packet != null && PluginFilterManager.getInstance().runFilters(packet)) {
90 >            if(packet != null) {
91                  // packet is not null
92                  // packet was not dropped by a plugin
93                  // ... best pass it on !
94 <                _parent.receiveXML(xml);
94 >                if(PluginFilterManager.getInstance().runFilters(packet)) {
95 >                    _parent.receiveXML(xml);
96 >                }
97 >                else {
98 >                    // we filtered it
99 >                    _logger.write(toString(), Logger.DEBUG, "An XML packet was sucessfully filtered from the system.");
100 >                }
101              }
102              else {
103 <                // either we had a null, or a plugin dropped it
104 <                _logger.write(toString(), Logger.DEBUG, "An XML packet was sucessfully filtered from the system.");
103 >                // we had a null
104 >                _logger.write(toString(), Logger.DEBUG, "An packet containing ill-parsing XML was rejected.");
105              }
106          }
107      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines