1 |
+ |
/* |
2 |
+ |
* i-scream central monitoring system |
3 |
+ |
* http://www.i-scream.org.uk |
4 |
+ |
* Copyright (C) 2000-2002 i-scream |
5 |
+ |
* |
6 |
+ |
* This program is free software; you can redistribute it and/or |
7 |
+ |
* modify it under the terms of the GNU General Public License |
8 |
+ |
* as published by the Free Software Foundation; either version 2 |
9 |
+ |
* of the License, or (at your option) any later version. |
10 |
+ |
* |
11 |
+ |
* This program is distributed in the hope that it will be useful, |
12 |
+ |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
+ |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
+ |
* GNU General Public License for more details. |
15 |
+ |
* |
16 |
+ |
* You should have received a copy of the GNU General Public License |
17 |
+ |
* along with this program; if not, write to the Free Software |
18 |
+ |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 |
+ |
*/ |
20 |
+ |
|
21 |
|
//---PACKAGE DECLARATION--- |
22 |
< |
package uk.ac.ukc.iscream.clientinterface; |
22 |
> |
package uk.org.iscream.cms.server.clientinterface; |
23 |
|
|
24 |
|
//---IMPORTS--- |
25 |
< |
import uk.ac.ukc.iscream.core.*; |
26 |
< |
import uk.ac.ukc.iscream.util.*; |
27 |
< |
import uk.ac.ukc.iscream.componentmanager.*; |
8 |
< |
import uk.ac.ukc.iscream.client.*; |
25 |
> |
import uk.org.iscream.cms.server.core.*; |
26 |
> |
import uk.org.iscream.cms.util.*; |
27 |
> |
import uk.org.iscream.cms.server.componentmanager.*; |
28 |
|
|
29 |
|
/** |
30 |
|
* This class, a servant, listens for incoming connections from CORBA based |
31 |
< |
* clients. Once it receives a connection it creates and assigns a CorbaHandler |
32 |
< |
* object to it. The CorbaHandler will then handle all requests on behalf of the |
31 |
> |
* clients. Once it receives a connection it creates and assigns a CorbaControlHandler |
32 |
> |
* object to it. The CorbaControlHandler will then handle all requests on behalf of the |
33 |
|
* client, and will send the client data. |
34 |
|
* |
35 |
|
* @author $Author$ |
63 |
|
/** |
64 |
|
* Allows a CORBA client to connect to the server. |
65 |
|
* |
47 |
– |
* @param name the name of the connecting client. |
66 |
|
* @param client a reference to the "servant" part of the connecting client. |
67 |
< |
* @return a CorbaHandler reference. |
67 |
> |
* @param name a name to identify the client. |
68 |
> |
* @return a CorbaControlHandler reference. |
69 |
|
*/ |
70 |
< |
public CorbaHandler connect(String name, Client client) { |
71 |
< |
CorbaHandlerServant chServant = new CorbaHandlerServant(_packetSorter, name, client); |
53 |
< |
CorbaHandlerPOATie chPOATie = new CorbaHandlerPOATie(chServant); |
70 |
> |
public CorbaControlHandler connect(Client client, String name) { |
71 |
> |
CorbaControlHandlerServant cchServant = new CorbaControlHandlerServant(_packetSorter, client, name); |
72 |
|
org.omg.CORBA.Object objRef; |
73 |
|
try { |
74 |
< |
objRef = _refman.getRootPOA().servant_to_reference(chPOATie); |
74 |
> |
objRef = _refman.getRootPOA().servant_to_reference(cchServant); |
75 |
|
} catch (Exception e) { |
76 |
|
objRef = null; |
77 |
< |
_logger.write(toString(), Logger.ERROR, "Error creating CorbaHandler: "+e); |
77 |
> |
_logger.write(toString(), Logger.ERROR, "Error creating CorbaControlHandler: "+e); |
78 |
|
} |
79 |
< |
CorbaHandler corbaHandler = CorbaHandlerHelper.narrow(objRef); |
62 |
< |
((Thread) corbaHandler).start(); |
79 |
> |
CorbaControlHandler corbaHandler = CorbaControlHandlerHelper.narrow(objRef); |
80 |
|
return corbaHandler; |
81 |
|
} |
82 |
|
|
84 |
|
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
85 |
|
* method to provide clean logging (every class should have this). |
86 |
|
* |
87 |
< |
* This uses the uk.ac.ukc.iscream.util.NameFormat class |
87 |
> |
* This uses the uk.org.iscream.cms.util.NameFormat class |
88 |
|
* to format the toString() |
89 |
|
* |
90 |
|
* @return the name of this class and its CVS revision |