5 |
|
import uk.ac.ukc.iscream.core.*; |
6 |
|
import uk.ac.ukc.iscream.util.*; |
7 |
|
import uk.ac.ukc.iscream.componentmanager.*; |
8 |
– |
import java.util.LinkedList; |
9 |
– |
import java.util.Iterator; |
8 |
|
|
9 |
|
/** |
10 |
|
* A client interface servant |
11 |
< |
* This keeps a track of all connected clients to |
14 |
< |
* the system and passes data to their handlers. |
11 |
> |
* Adds data to a Queue as it's received over CORBA. |
12 |
|
* |
16 |
– |
* Currently it has limited client management facilities. |
17 |
– |
* |
13 |
|
* @author $Author$ |
14 |
|
* @version $Id$ |
15 |
|
*/ |
29 |
|
/** |
30 |
|
* Creates a new ClientInterfaceServant. |
31 |
|
*/ |
32 |
< |
public ClientInterfaceServant() { |
33 |
< |
// here would be a nice place to pass in local clients |
39 |
< |
_clients = new LinkedList(); |
32 |
> |
public ClientInterfaceServant(PacketSorter ps) { |
33 |
> |
_queue = ps.getQueue(); |
34 |
|
_logger.write(toString(), Logger.SYSINIT, "created"); |
35 |
|
} |
36 |
|
|
42 |
|
* @param xml the String of XML to print out |
43 |
|
*/ |
44 |
|
public void receiveXML(String xml) { |
45 |
< |
Iterator i = _clients.iterator(); |
52 |
< |
while(i.hasNext()) { |
53 |
< |
((ClientHandler) i.next()).receiveXML(xml); |
54 |
< |
} |
45 |
> |
_queue.add(xml); |
46 |
|
} |
47 |
|
|
48 |
|
/** |
58 |
– |
* Simply adds clients to a linked list |
59 |
– |
* |
60 |
– |
* @param newClient a reference to the client to add |
61 |
– |
*/ |
62 |
– |
public void register(ClientHandler newClient) { |
63 |
– |
_logger.write(toString(), Logger.SYSMSG, "registered client - " + newClient.toString()); |
64 |
– |
_clients.add(newClient); |
65 |
– |
} |
66 |
– |
|
67 |
– |
/** |
49 |
|
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
50 |
|
* method to provide clean logging (every class should have this). |
51 |
|
* |
84 |
|
*/ |
85 |
|
private Logger _logger = ReferenceManager.getInstance().getLogger(); |
86 |
|
|
87 |
< |
private LinkedList _clients; |
87 |
> |
private Queue _queue; |
88 |
|
|
89 |
|
//---STATIC ATTRIBUTES--- |
90 |
|
|