/**
* INTERNAL:
* Create and return a wrapper of a CORBA remote connection to the specified service
*/
public RemoteConnection createConnection(ServiceId connectionServiceId) {
RemoteConnection connection = null;
Object[] args = { connectionServiceId.getId(), connectionServiceId.getURL() };
rcm.logDebug("looking_up_remote_conn_in_jndi", args);
try {
Context context = getRemoteHostContext(connectionServiceId.getURL());
// look up the distributed connection from JNDI
CORBAConnection connectionImpl = narrow((org.omg.CORBA.Object)context.lookup(connectionServiceId.getId()));
// create the wrapper of the distributed connection
connection = new CORBARemoteCommandConnection(connectionImpl);
connection.setServiceId(connectionServiceId);
} catch (Exception e) {
rcm.handleException(RemoteCommandManagerException.errorLookingUpRemoteConnection(connectionServiceId.getId(), connectionServiceId.getURL(), e));
}
return connection;