ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/server/uk/org/iscream/cms/server/clientinterface/ClientInterfaceServant.java
Revision: 1.4
Committed: Wed Dec 13 16:17:58 2000 UTC (23 years, 5 months ago) by ajm
Branch: MAIN
Changes since 1.3: +2 -3 lines
Log Message:
removed annoying debug line

File Contents

# User Rev Content
1 ajm 1.3 //---PACKAGE DECLARATION---
2     package uk.ac.ukc.iscream.clientinterface;
3    
4     //---IMPORTS---
5     import uk.ac.ukc.iscream.core.*;
6     import uk.ac.ukc.iscream.util.*;
7     import java.util.LinkedList;
8     import java.util.Iterator;
9    
10     /**
11     * A client interface servant
12     * This keeps a track of all connected clients to
13     * the system and passes data to their handlers.
14     *
15     * Currently it has limited client management facilities.
16     *
17     * @author $Author: ajm4 $
18 ajm 1.4 * @version $Id: ClientInterfaceServant.java,v 1.3 2000/12/13 12:57:38 ajm4 Exp $
19 ajm 1.3 */
20     class ClientInterfaceServant extends ClientInterfacePOA {
21    
22     //---FINAL ATTRIBUTES---
23    
24     /**
25     * The current CVS revision of this class
26     */
27 ajm 1.4 public final String REVISION = "$Revision: 1.3 $";
28 ajm 1.3
29     //---STATIC METHODS---
30    
31     //---CONSTRUCTORS---
32    
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();
39     _logger.write(toString(), Logger.SYSINIT, "created");
40     }
41    
42     //---PUBLIC METHODS---
43    
44     /**
45     * Method to receive a string over corba.
46     *
47     * @param xml the String of XML to print out
48     */
49     public void receiveXML(String xml) {
50     Iterator i = _clients.iterator();
51     while(i.hasNext()) {
52     ((ClientHandler) i.next()).receiveXML(xml);
53     }
54     }
55    
56     /**
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     /**
67     * Overrides the {@link java.lang.Object#toString() Object.toString()}
68     * method to provide clean logging (every class should have this).
69     *
70     * This uses the uk.ac.ukc.iscream.util.NameFormat class
71     * to format the toString()
72     *
73     * @return the name of this class and its CVS revision
74     */
75     public String toString() {
76     return FormatName.getName(
77     _name,
78     getClass().getName(),
79     REVISION);
80     }
81    
82     //---PRIVATE METHODS---
83    
84     //---ACCESSOR/MUTATOR METHODS---
85    
86     //---ATTRIBUTES---
87    
88     /**
89     * This is the friendly identifier of the
90     * component this class is running in.
91     * eg, a Filter may be called "filter1",
92     * If this class does not have an owning
93     * component, a name from the configuration
94     * can be placed here. This name could also
95     * be changed to null for utility classes.
96     */
97     private String _name = ClientInterfaceMain.NAME;
98    
99     /**
100     * This holds a reference to the
101     * system logger that is being used.
102     */
103     private Logger _logger = ReferenceManager.getInstance().getLogger();
104    
105     private LinkedList _clients;
106    
107     //---STATIC ATTRIBUTES---
108    
109     }