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.13 by tdb, Wed Dec 6 22:57:45 2000 UTC vs.
Revision 1.14 by ajm, Wed Dec 13 13:36:46 2000 UTC

# Line 10 | Line 10 | import uk.ac.ukc.iscream.filter.*;
10   import uk.ac.ukc.iscream.util.*;
11  
12   /**
13 < * Handle an incoming UDP packet as a separate thread.
13 > * Handle an incoming packet as a separate thread.
14 > * Passes the data through various plugins, then
15 > * passes it on to the parent filter.
16   *
17   * @author  $Author$
18   * @version $Id$
# Line 28 | Line 30 | public class FilterThread extends Thread{
30  
31   //---CONSTRUCTORS---
32  
33 <    // Class constructor. Obtains the byte[] from a DatagramPacket.
33 >    /**
34 >     * Class constructor. Obtains the byte[] from a DatagramPacket.
35 >     */
36      public FilterThread(DatagramPacket packet, Filter parent){
37          _parent = parent;
38          _rawPacket = packet.getData();
39 <        _logger.write(this.toString(), Logger.DEBUG, "created");
39 >        _logger.write(toString(), Logger.DEBUG, "created");
40          
41      }
42      
43 <    // Class constructor for passing XML Strings.
43 >    /**
44 >     * Class constructor for passing XML Strings.
45 >     */
46      public FilterThread(String xml, Filter parent){
47          _parent = parent;
48          _rawPacket = xml.getBytes();
49 <        _logger.write(this.toString(), Logger.DEBUG, "created");
49 >        _logger.write(toString(), Logger.DEBUG, "created");
50      }
51  
52   //---PUBLIC METHODS---
53  
54 +    /**
55 +     * Runs the thread
56 +     */
57      public void run(){
58  
59          // Get a string without any null characters in it.
# Line 69 | Line 78 | public class FilterThread extends Thread{
78          }
79          else {
80              // either we had a null, or a plugin dropped it
81 <            _logger.write(this.toString(), Logger.DEBUG, "An XML packet was sucessfully filtered from the system.");
81 >            _logger.write(toString(), Logger.DEBUG, "An XML packet was sucessfully filtered from the system.");
82          }
83          
84      }
# Line 78 | Line 87 | public class FilterThread extends Thread{
87       * Overrides the {@link java.lang.Object#toString() Object.toString()}
88       * method to provide clean logging (every class should have this).
89       *
90 +     * This uses the uk.ac.ukc.iscream.util.NameFormat class
91 +     * to format the toString()
92 +     *
93       * @return the name of this class and its CVS revision
94       */
95      public String toString() {
96 <        return this.getClass().getName() + "{" + _name + "}(" + REVISION.substring(11, REVISION.length() - 2) + ")";
96 >        return FormatName.getName(
97 >            _name,
98 >            getClass().getName(),
99 >            REVISION);
100      }
101  
102   //---PRIVATE METHODS---
# Line 90 | Line 105 | public class FilterThread extends Thread{
105  
106   //---ATTRIBUTES---
107  
108 +    /**
109 +     * Our parent filter
110 +     */
111      Filter _parent;
112 +    
113 +    /**
114 +     * The raw packet data
115 +     */
116      byte[] _rawPacket;
117 <    Logger _logger = ReferenceManager.getInstance().getLogger();
118 <    String _name = ReferenceManager.getInstance().getName();
117 >    
118 >    /**
119 >     * This is the friendly identifier of the
120 >     * component this class is running in.
121 >     * eg, a Filter may be called "filter1",
122 >     * If this class does not have an owning
123 >     * component,  a name from the configuration
124 >     * can be placed here.  This name could also
125 >     * be changed to null for utility classes.
126 >     */
127 >    private String _name = FilterMain.NAME;
128 >
129 >    /**
130 >     * This holds a reference to the
131 >     * system logger that is being used.
132 >     */
133 >    private Logger _logger = ReferenceManager.getInstance().getLogger();
134  
135   //---STATIC ATTRIBUTES---
136  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines