示例#1
0
        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;
        }
        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);
               }
            }
        }
示例#4
0
 public Servants(TerkUserPrx mainServantProxy,
                 ConnectionEventHandlerPrx connectionEventHandlerProxy,
                 List <ObjectPrx> secondaryServantProxies)
 {
     this.mainServantProxy            = mainServantProxy;
     this.connectionEventHandlerProxy = connectionEventHandlerProxy;
     if ((secondaryServantProxies != null) && (secondaryServantProxies.Count > 0))
     {
         this.secondaryServantProxies.AddRange(secondaryServantProxies);
     }
 }
示例#5
0
        public Servants createServants(DirectConnectCommunicator communicator)
        {
            Trace.TraceError("QwerkClientServantFactory.createServants()");

            TerkUserServant mainServant = new TerkUserServant(communicator.getCommunicator());

            ObjectAdapter adapter = communicator.addObjectAdapter(communicator.getObjectAdapterName());

            ObjectPrx mainServantProxy = adapter.add(mainServant, new Identity(DirectConnectCommunicator.MAIN_SERVANT_PROXY_IDENTITY_NAME, ""));

            TerkUserPrx mainServantPrx = TerkUserPrxHelper.uncheckedCast(mainServantProxy);

            return(new Servants(mainServantPrx, mainServantPrx));
        }
 private void notifyPeerOfConnection(TerkUserPrx peerTerkUserPrx)
 {
     if (servants == null)
     {
         peerTerkUserPrx.peerConnectedNoProxy(getMyUserId(peerTerkUserPrx),
                                              PeerAccessLevel.AccessLevelOwner);
     }
     else
     {
         peerTerkUserPrx.peerConnected(getMyUserId(peerTerkUserPrx),
                                       PeerAccessLevel.AccessLevelOwner,
                                       servants.getMainServantProxy());
     }
 }
 public override ServiceProvider createServiceProvider(string peerUserId, TerkUserPrx peerObjectPrx, TerkCommunicator communicator)
 {
     return(new TerkServiceProvider(peerUserId, peerObjectPrx, communicator));
 }
 public override ServiceProvider createServiceProvider(string peerUserId, TerkUserPrx peerObjectPrx, TerkCommunicator communicator)
 {
     return new TerkServiceProvider(peerUserId, peerObjectPrx, communicator);
 }
示例#9
0
 public Servants(TerkUserPrx mainServantProxy,
                 ConnectionEventHandlerPrx connectionEventHandlerProxy) :
     this(mainServantProxy, connectionEventHandlerProxy, null)
 {
 }
示例#10
0
 public abstract ServiceProvider createServiceProvider(string peerUserId, TerkUserPrx peerObjectPrx, TerkCommunicator communicator);
 private void notifyPeerOfConnection(TerkUserPrx peerTerkUserPrx)
 {
     if (servants == null)
     {
         peerTerkUserPrx.peerConnectedNoProxy(getMyUserId(peerTerkUserPrx),
                                              PeerAccessLevel.AccessLevelOwner);
     }
     else
     {
         peerTerkUserPrx.peerConnected(getMyUserId(peerTerkUserPrx),
                                       PeerAccessLevel.AccessLevelOwner,
                                       servants.getMainServantProxy());
     }
 }
 public abstract ServiceProvider createServiceProvider(string peerUserId, TerkUserPrx peerObjectPrx, TerkCommunicator communicator);