1 |
|
//---PACKAGE DECLARATION--- |
2 |
< |
package uk.ac.ukc.iscream.rootfilter; |
2 |
> |
package uk.org.iscream.cms.server.rootfilter; |
3 |
|
|
4 |
|
//---IMPORTS--- |
5 |
< |
import uk.ac.ukc.iscream.core.*; |
6 |
< |
import uk.ac.ukc.iscream.clientinterface.*; |
7 |
< |
import uk.ac.ukc.iscream.util.*; |
5 |
> |
import uk.org.iscream.cms.server.core.*; |
6 |
> |
import uk.org.iscream.cms.server.componentmanager.*; |
7 |
> |
import uk.org.iscream.cms.server.clientinterface.*; |
8 |
> |
import uk.org.iscream.cms.server.util.*; |
9 |
|
|
10 |
|
/** |
11 |
|
* A ClientInterface wrapper - the CI objects are pushed data, |
35 |
|
* @param queue a reference to a queue to use |
36 |
|
*/ |
37 |
|
public CIWrapper(ClientInterface destination, Queue queue){ |
38 |
+ |
// set the Thread name |
39 |
+ |
setName("rootfilter.CIWrapper"); |
40 |
+ |
|
41 |
|
_destination = destination; |
42 |
|
_queue = queue; |
43 |
+ |
_queueID = queue.getQueue(); |
44 |
|
} |
45 |
|
|
46 |
|
//---PUBLIC METHODS--- |
49 |
|
* start the thread and thus gets and sends data |
50 |
|
*/ |
51 |
|
public void run() { |
52 |
< |
int n = _queue.getQueue(); |
52 |
> |
String xml = null; |
53 |
|
while(true) { |
54 |
|
try { |
55 |
< |
String xml = _queue.get(n) |
55 |
> |
xml = (String) _queue.get(_queueID); |
56 |
|
} |
57 |
|
catch (InvalidQueueException e) { |
58 |
|
_logger.write(toString(), Logger.ERROR, "Queue error: "+e); |
65 |
|
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
66 |
|
* method to provide clean logging (every class should have this). |
67 |
|
* |
68 |
+ |
* This uses the uk.org.iscream.cms.server.util.NameFormat class |
69 |
+ |
* to format the toString() |
70 |
+ |
* |
71 |
|
* @return the name of this class and its CVS revision |
72 |
|
*/ |
73 |
|
public String toString() { |
74 |
< |
return this.getClass().getName() + "{" + _name + "}(" + REVISION.substring(11, REVISION.length() - 2) + ")"; |
74 |
> |
return FormatName.getName( |
75 |
> |
_name, |
76 |
> |
getClass().getName(), |
77 |
> |
REVISION); |
78 |
|
} |
79 |
|
|
80 |
|
//---PRIVATE METHODS--- |
87 |
|
* A reference to a Queue object. |
88 |
|
*/ |
89 |
|
private Queue _queue; |
90 |
+ |
|
91 |
+ |
/** |
92 |
+ |
* Our Queue id. |
93 |
+ |
*/ |
94 |
+ |
private int _queueID; |
95 |
|
|
96 |
|
/** |
97 |
|
* the interface this thread is sending data to |