| 1 |
+ |
//---PACKAGE DECLARATION--- |
| 2 |
+ |
package uk.ac.ukc.iscream.filter; |
| 3 |
+ |
|
| 4 |
+ |
//---IMPORTS--- |
| 5 |
|
import java.io.*; |
| 6 |
|
import java.net.*; |
| 7 |
|
import java.util.*; |
| 8 |
|
import uk.ac.ukc.iscream.core.*; |
| 9 |
|
import uk.ac.ukc.iscream.filter.*; |
| 10 |
+ |
import uk.ac.ukc.iscream.xml.*; |
| 11 |
|
|
| 12 |
< |
// Handle an incoming UDP packet as a separate thread. |
| 12 |
> |
/** |
| 13 |
> |
* Handle an incoming UDP packet as a separate thread. |
| 14 |
> |
* |
| 15 |
> |
* @author $Author$ |
| 16 |
> |
* @version $Id$ |
| 17 |
> |
*/ |
| 18 |
|
public class FilterThread extends Thread{ |
| 19 |
|
|
| 20 |
+ |
//---FINAL ATTRIBUTES--- |
| 21 |
+ |
|
| 22 |
+ |
/** |
| 23 |
+ |
* The current CVS revision of this class |
| 24 |
+ |
*/ |
| 25 |
+ |
public final String REVISION = "$Revision$"; |
| 26 |
+ |
|
| 27 |
+ |
//---STATIC METHODS--- |
| 28 |
+ |
|
| 29 |
+ |
//---CONSTRUCTORS--- |
| 30 |
+ |
|
| 31 |
|
// Class constructor. Obtains the byte[] from a DatagramPacket. |
| 32 |
|
public FilterThread(DatagramPacket packet, Filter parent, Logger logger){ |
| 33 |
|
this.parent = parent; |
| 40 |
|
this.parent = parent; |
| 41 |
|
this.rawPacket = xml.getBytes(); |
| 42 |
|
} |
| 43 |
< |
|
| 43 |
> |
|
| 44 |
> |
//---PUBLIC METHODS--- |
| 45 |
> |
|
| 46 |
|
public void run(){ |
| 47 |
|
|
| 48 |
|
// Get a string without any null characters in it. |
| 70 |
|
parent.receiveXML(xml); |
| 71 |
|
|
| 72 |
|
} |
| 73 |
< |
|
| 73 |
> |
|
| 74 |
> |
/** |
| 75 |
> |
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
| 76 |
> |
* method to provide clean logging (every class should have this). |
| 77 |
> |
* |
| 78 |
> |
* @return the name of this class and its CVS revision |
| 79 |
> |
*/ |
| 80 |
> |
public String toString() { |
| 81 |
> |
return this.getClass().getName() + "(" + REVISION.substring(11, REVISION.length() - 2) + ")"; |
| 82 |
> |
} |
| 83 |
> |
|
| 84 |
> |
//---PRIVATE METHODS--- |
| 85 |
> |
|
| 86 |
> |
//---ACCESSOR/MUTATOR METHODS--- |
| 87 |
> |
|
| 88 |
> |
//---ATTRIBUTES--- |
| 89 |
> |
|
| 90 |
|
Filter parent; |
| 91 |
|
byte[] rawPacket; |
| 92 |
|
Logger logger; |
| 93 |
+ |
|
| 94 |
+ |
//---STATIC ATTRIBUTES--- |
| 95 |
+ |
|
| 96 |
|
} |