--- projects/cms/source/server/uk/org/iscream/cms/server/filter/FilterThread.java 2000/12/06 22:57:45 1.13 +++ projects/cms/source/server/uk/org/iscream/cms/server/filter/FilterThread.java 2000/12/13 13:36:46 1.14 @@ -10,10 +10,12 @@ import uk.ac.ukc.iscream.filter.*; import uk.ac.ukc.iscream.util.*; /** - * Handle an incoming UDP packet as a separate thread. + * Handle an incoming packet as a separate thread. + * Passes the data through various plugins, then + * passes it on to the parent filter. * - * @author $Author: tdb $ - * @version $Id: FilterThread.java,v 1.13 2000/12/06 22:57:45 tdb Exp $ + * @author $Author: ajm $ + * @version $Id: FilterThread.java,v 1.14 2000/12/13 13:36:46 ajm Exp $ */ public class FilterThread extends Thread{ @@ -22,29 +24,36 @@ public class FilterThread extends Thread{ /** * The current CVS revision of this class */ - public final String REVISION = "$Revision: 1.13 $"; + public final String REVISION = "$Revision: 1.14 $"; //---STATIC METHODS--- //---CONSTRUCTORS--- - // Class constructor. Obtains the byte[] from a DatagramPacket. + /** + * Class constructor. Obtains the byte[] from a DatagramPacket. + */ public FilterThread(DatagramPacket packet, Filter parent){ _parent = parent; _rawPacket = packet.getData(); - _logger.write(this.toString(), Logger.DEBUG, "created"); + _logger.write(toString(), Logger.DEBUG, "created"); } - // Class constructor for passing XML Strings. + /** + * Class constructor for passing XML Strings. + */ public FilterThread(String xml, Filter parent){ _parent = parent; _rawPacket = xml.getBytes(); - _logger.write(this.toString(), Logger.DEBUG, "created"); + _logger.write(toString(), Logger.DEBUG, "created"); } //---PUBLIC METHODS--- + /** + * Runs the thread + */ public void run(){ // Get a string without any null characters in it. @@ -69,7 +78,7 @@ public class FilterThread extends Thread{ } else { // either we had a null, or a plugin dropped it - _logger.write(this.toString(), Logger.DEBUG, "An XML packet was sucessfully filtered from the system."); + _logger.write(toString(), Logger.DEBUG, "An XML packet was sucessfully filtered from the system."); } } @@ -78,10 +87,16 @@ public class FilterThread extends Thread{ * Overrides the {@link java.lang.Object#toString() Object.toString()} * method to provide clean logging (every class should have this). * + * This uses the uk.ac.ukc.iscream.util.NameFormat class + * to format the toString() + * * @return the name of this class and its CVS revision */ public String toString() { - return this.getClass().getName() + "{" + _name + "}(" + REVISION.substring(11, REVISION.length() - 2) + ")"; + return FormatName.getName( + _name, + getClass().getName(), + REVISION); } //---PRIVATE METHODS--- @@ -90,10 +105,32 @@ public class FilterThread extends Thread{ //---ATTRIBUTES--- + /** + * Our parent filter + */ Filter _parent; + + /** + * The raw packet data + */ byte[] _rawPacket; - Logger _logger = ReferenceManager.getInstance().getLogger(); - String _name = ReferenceManager.getInstance().getName(); + + /** + * This is the friendly identifier of the + * component this class is running in. + * eg, a Filter may be called "filter1", + * If this class does not have an owning + * component, a name from the configuration + * can be placed here. This name could also + * be changed to null for utility classes. + */ + private String _name = FilterMain.NAME; + + /** + * This holds a reference to the + * system logger that is being used. + */ + private Logger _logger = ReferenceManager.getInstance().getLogger(); //---STATIC ATTRIBUTES---