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/CorbaClientListenerServant.java
Revision: 1.7
Committed: Tue Mar 13 18:37:08 2001 UTC (23 years, 2 months ago) by tdb
Branch: MAIN
Changes since 1.6: +4 -11 lines
Log Message:
Now makes use of the ConfigurationProxy.

File Contents

# User Rev Content
1 tdb 1.1 //---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 uk.ac.ukc.iscream.componentmanager.*;
8     import uk.ac.ukc.iscream.client.*;
9    
10     /**
11     * This class, a servant, listens for incoming connections from CORBA based
12 tdb 1.4 * clients. Once it receives a connection it creates and assigns a CorbaControlHandler
13     * object to it. The CorbaControlHandler will then handle all requests on behalf of the
14 tdb 1.1 * client, and will send the client data.
15     *
16 tdb 1.2 * @author $Author: tdb1 $
17 tdb 1.7 * @version $Id: CorbaClientListenerServant.java,v 1.6 2001/02/28 19:04:00 tdb1 Exp $
18 tdb 1.1 */
19     class CorbaClientListenerServant extends CorbaClientListenerPOA {
20    
21     //---FINAL ATTRIBUTES---
22    
23     /**
24     * The current CVS revision of this class
25     */
26 tdb 1.7 public final String REVISION = "$Revision: 1.6 $";
27 tdb 1.1
28     //---STATIC METHODS---
29    
30     //---CONSTRUCTORS---
31    
32     /**
33     * Creates a new CorbaClientListenerServant.
34     *
35     * @param packetSorter a reference to the PacketSorter object being used
36     */
37 tdb 1.7 public CorbaClientListenerServant(PacketSorter packetSorter) {
38 tdb 1.1 _packetSorter = packetSorter;
39     _logger.write(toString(), Logger.SYSINIT, "created");
40     }
41    
42     //---PUBLIC METHODS---
43    
44     /**
45     * Allows a CORBA client to connect to the server.
46     *
47     * @param client a reference to the "servant" part of the connecting client.
48 tdb 1.6 * @param name a name to identify the client.
49 tdb 1.4 * @return a CorbaControlHandler reference.
50 tdb 1.1 */
51 tdb 1.6 public CorbaControlHandler connect(Client client, String name) {
52 tdb 1.7 CorbaControlHandlerServant cchServant = new CorbaControlHandlerServant(_packetSorter, client, name);
53 tdb 1.1 org.omg.CORBA.Object objRef;
54     try {
55 tdb 1.4 objRef = _refman.getRootPOA().servant_to_reference(cchServant);
56 tdb 1.1 } catch (Exception e) {
57     objRef = null;
58 tdb 1.4 _logger.write(toString(), Logger.ERROR, "Error creating CorbaControlHandler: "+e);
59 tdb 1.1 }
60 tdb 1.4 CorbaControlHandler corbaHandler = CorbaControlHandlerHelper.narrow(objRef);
61 tdb 1.1 return corbaHandler;
62     }
63    
64     /**
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.ac.ukc.iscream.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 FormatName.getName(
75     _name,
76     getClass().getName(),
77     REVISION);
78     }
79    
80     //---PRIVATE METHODS---
81    
82     //---ACCESSOR/MUTATOR METHODS---
83    
84     //---ATTRIBUTES---
85    
86     /**
87     * This is the friendly identifier of the
88     * component this class is running in.
89     * eg, a Filter may be called "filter1",
90     * If this class does not have an owning
91     * component, a name from the configuration
92     * can be placed here. This name could also
93     * be changed to null for utility classes.
94     */
95     private String _name = ClientInterfaceMain.NAME;
96    
97     /**
98     * This holds a reference to the
99     * system logger that is being used.
100     */
101     private Logger _logger = ReferenceManager.getInstance().getLogger();
102    
103     /**
104     * A reference to the reference manager in use
105     */
106     private ReferenceManager _refman = ReferenceManager.getInstance();
107    
108     /**
109     * A reference to the PacketSorter.
110     */
111     private PacketSorter _packetSorter;
112    
113     //---STATIC ATTRIBUTES---
114    
115     }