4 |
|
//---IMPORTS--- |
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; |
10 |
|
|
11 |
|
/** |
12 |
|
* A client interface servant |
13 |
< |
* This keeps a track of all connected clients to |
13 |
< |
* the system and passes data to their handlers. |
13 |
> |
* Adds data to a Queue as it's received over CORBA. |
14 |
|
* |
15 |
|
* Currently it has limited client management facilities. |
16 |
|
* |
33 |
|
/** |
34 |
|
* Creates a new ClientInterfaceServant. |
35 |
|
*/ |
36 |
< |
public ClientInterfaceServant() { |
37 |
< |
// here would be a nice place to pass in local clients |
38 |
< |
_clients = new LinkedList(); |
36 |
> |
public ClientInterfaceServant(Queue queue) { |
37 |
> |
_queue = queue; |
38 |
|
_logger.write(toString(), Logger.SYSINIT, "created"); |
39 |
|
} |
40 |
|
|
46 |
|
* @param xml the String of XML to print out |
47 |
|
*/ |
48 |
|
public void receiveXML(String xml) { |
49 |
< |
Iterator i = _clients.iterator(); |
51 |
< |
while(i.hasNext()) { |
52 |
< |
((ClientHandler) i.next()).receiveXML(xml); |
53 |
< |
} |
49 |
> |
_queue.add(xml); |
50 |
|
} |
51 |
|
|
52 |
|
/** |
57 |
– |
* Simply adds clients to a linked list |
58 |
– |
* |
59 |
– |
* @param newClient a reference to the client to add |
60 |
– |
*/ |
61 |
– |
public void register(ClientHandler newClient) { |
62 |
– |
_logger.write(toString(), Logger.SYSMSG, "registered client - " + newClient.toString()); |
63 |
– |
_clients.add(newClient); |
64 |
– |
} |
65 |
– |
|
66 |
– |
/** |
53 |
|
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
54 |
|
* method to provide clean logging (every class should have this). |
55 |
|
* |
88 |
|
*/ |
89 |
|
private Logger _logger = ReferenceManager.getInstance().getLogger(); |
90 |
|
|
91 |
< |
private LinkedList _clients; |
91 |
> |
private Queue _queue; |
92 |
|
|
93 |
|
//---STATIC ATTRIBUTES--- |
94 |
|
|