| 1 |
|
//---PACKAGE DECLARATION--- |
| 2 |
< |
package uk.ac.ukc.iscream.clientinterface; |
| 2 |
> |
package uk.org.iscream.cms.server.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.*; |
| 5 |
> |
import uk.org.iscream.cms.server.core.*; |
| 6 |
> |
import uk.org.iscream.cms.server.util.*; |
| 7 |
> |
import uk.org.iscream.cms.server.componentmanager.*; |
| 8 |
> |
import uk.org.iscream.cms.server.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 CorbaHandler |
| 13 |
< |
* object to it. The CorbaHandler will then handle all requests on behalf of the |
| 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$ |
| 44 |
|
/** |
| 45 |
|
* Allows a CORBA client to connect to the server. |
| 46 |
|
* |
| 47 |
– |
* @param name the name of the connecting client. |
| 47 |
|
* @param client a reference to the "servant" part of the connecting client. |
| 48 |
< |
* @return a CorbaHandler reference. |
| 48 |
> |
* @param name a name to identify the client. |
| 49 |
> |
* @return a CorbaControlHandler reference. |
| 50 |
|
*/ |
| 51 |
< |
public CorbaHandler connect(String name, Client client) { |
| 52 |
< |
CorbaHandlerServant chServant = new CorbaHandlerServant(_packetSorter, name, client); |
| 53 |
< |
CorbaHandlerPOATie chPOATie = new CorbaHandlerPOATie(chServant); |
| 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(chPOATie); |
| 55 |
> |
objRef = _refman.getRootPOA().servant_to_reference(cchServant); |
| 56 |
|
} catch (Exception e) { |
| 57 |
|
objRef = null; |
| 58 |
< |
_logger.write(toString(), Logger.ERROR, "Error creating CorbaHandler: "+e); |
| 58 |
> |
_logger.write(toString(), Logger.ERROR, "Error creating CorbaControlHandler: "+e); |
| 59 |
|
} |
| 60 |
< |
CorbaHandler corbaHandler = CorbaHandlerHelper.narrow(objRef); |
| 62 |
< |
((Thread) corbaHandler).start(); |
| 60 |
> |
CorbaControlHandler corbaHandler = CorbaControlHandlerHelper.narrow(objRef); |
| 61 |
|
return corbaHandler; |
| 62 |
|
} |
| 63 |
|
|
| 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 |
| 68 |
> |
* This uses the uk.org.iscream.cms.server.util.NameFormat class |
| 69 |
|
* to format the toString() |
| 70 |
|
* |
| 71 |
|
* @return the name of this class and its CVS revision |