public TerkServiceProvider(string peerUserId, TerkUserPrx peerObjectPrx, TerkCommunicator communicator) { this.peerUserId = peerUserId; this.communicator = communicator; // get the collection of supported services from the peer's proxy // // Ugly hack to handle peers who don't support the getSupportedServices() method in the API. This hack assumes // that the peer is a Qwerk, but that's ok for now since all non-qwerk TerkUsers already do support the new API. // TODO: remove this ugliness once we can assume that all TerkUsers support the new API. ProxyTypeIdToIdentityMap typeIdToProxyIdentityMap; try { typeIdToProxyIdentityMap = peerObjectPrx.getSupportedServices(); } catch (Exception e) { Trace.TraceError("Exception while calling getSupportedServices()--maybe this TerkUser doesn't support the new API?", e); // assume we're dealing with a qwerk typeIdToProxyIdentityMap = QwerkPrxHelper.uncheckedCast(peerObjectPrx).getCommandControllerTypeToProxyIdentityMap(); } if (typeIdToProxyIdentityMap != null) { foreach (DictionaryEntry entry in typeIdToProxyIdentityMap) { string key = (string)entry.Key; Identity value = (Identity)entry.Value; supportedServices.Add(key, value); } } }
public IEnumerator <ITask> DirectLoginHandler(DirectLogin login) { if (trace) { LogInfo("DirectLogin Received"); } try { TerkUserPrx terkUserPrx = directCommunicator.connectToPeer(login.Body.PeerIdentifier); if (trace) { LogInfo("Connect complete!"); } QwerkPrx qwerkPrx = QwerkPrxHelper.uncheckedCast(terkUserPrx); this.qwerkController = new QwerkController(login.Body.PeerIdentifier, qwerkPrx, directCommunicator); } catch (Exception e) { string failure = "Failed to connect to Qwerk '" + login.Body.PeerIdentifier + "': " + e; LogInfo(failure); login.ResponsePort.Post(generateFault(failure)); yield break; } login.ResponsePort.Post(DefaultUpdateResponseType.Instance); yield break; }