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.8
Committed: Wed Mar 14 23:25:29 2001 UTC (23 years, 2 months ago) by tdb
Branch: MAIN
CVS Tags: PROJECT_COMPLETION
Changes since 1.7: +8 -8 lines
Log Message:
The whole server package structure has been changed.
Old Package: uk.ac.ukc.iscream.*
New Package: uk.org.iscream.*

File Contents

# Content
1 //---PACKAGE DECLARATION---
2 package uk.org.iscream.clientinterface;
3
4 //---IMPORTS---
5 import uk.org.iscream.core.*;
6 import uk.org.iscream.util.*;
7 import uk.org.iscream.componentmanager.*;
8 import uk.org.iscream.client.*;
9
10 /**
11 * This class, a servant, listens for incoming connections from CORBA based
12 * 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 * client, and will send the client data.
15 *
16 * @author $Author: tdb1 $
17 * @version $Id: CorbaClientListenerServant.java,v 1.7 2001/03/13 18:37:08 tdb1 Exp $
18 */
19 class CorbaClientListenerServant extends CorbaClientListenerPOA {
20
21 //---FINAL ATTRIBUTES---
22
23 /**
24 * The current CVS revision of this class
25 */
26 public final String REVISION = "$Revision: 1.7 $";
27
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 public CorbaClientListenerServant(PacketSorter packetSorter) {
38 _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 * @param name a name to identify the client.
49 * @return a CorbaControlHandler reference.
50 */
51 public CorbaControlHandler connect(Client client, String name) {
52 CorbaControlHandlerServant cchServant = new CorbaControlHandlerServant(_packetSorter, client, name);
53 org.omg.CORBA.Object objRef;
54 try {
55 objRef = _refman.getRootPOA().servant_to_reference(cchServant);
56 } catch (Exception e) {
57 objRef = null;
58 _logger.write(toString(), Logger.ERROR, "Error creating CorbaControlHandler: "+e);
59 }
60 CorbaControlHandler corbaHandler = CorbaControlHandlerHelper.narrow(objRef);
61 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.org.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 }