예제 #1
0
        public Ice.Disp RemoveServant(Ice.Identity ident, string facet)
        {
            lock (this)
            {
                Debug.Assert(_communicator != null); // Must not be called after destruction.

                if (facet == null)
                {
                    facet = "";
                }

                _servantMapMap.TryGetValue(ident, out Dictionary <string, Ice.Disp> m);
                if (m == null || !m.ContainsKey(facet))
                {
                    var ex = new Ice.NotRegisteredException();
                    ex.Id           = ident.ToString(_communicator.ToStringMode);
                    ex.KindOfObject = "servant";
                    if (facet.Length > 0)
                    {
                        ex.Id += " -f " + IceUtilInternal.StringUtil.escapeString(facet, "", _communicator.ToStringMode);
                    }
                    throw ex;
                }
                Ice.Disp obj = m[facet];
                m.Remove(facet);

                if (m.Count == 0)
                {
                    _servantMapMap.Remove(ident);
                }
                return(obj);
            }
        }
예제 #2
0
        public void AddServant(Ice.Disp servant, Ice.Identity ident, string facet)
        {
            lock (this)
            {
                Debug.Assert(_communicator != null); // Must not be called after destruction.

                if (facet == null)
                {
                    facet = "";
                }

                _servantMapMap.TryGetValue(ident, out Dictionary <string, Ice.Disp> m);
                if (m == null)
                {
                    _servantMapMap[ident] = m = new Dictionary <string, Ice.Disp>();
                }
                else
                {
                    if (m.ContainsKey(facet))
                    {
                        throw new ArgumentException(
                                  $"Servant `{ident.ToString(_communicator.ToStringMode)}' already has a facet named `{facet}'",
                                  nameof(facet));
                    }
                }

                m[facet] = servant;
            }
        }
예제 #3
0
        public void addServant(Ice.Disp servant, Ice.Identity ident, string facet)
        {
            lock (this)
            {
                Debug.Assert(_communicator != null); // Must not be called after destruction.

                if (facet == null)
                {
                    facet = "";
                }

                Dictionary <string, Ice.Disp> m;
                _servantMapMap.TryGetValue(ident, out m);
                if (m == null)
                {
                    _servantMapMap[ident] = (m = new Dictionary <string, Ice.Disp>());
                }
                else
                {
                    if (m.ContainsKey(facet))
                    {
                        Ice.AlreadyRegisteredException ex = new Ice.AlreadyRegisteredException();
                        ex.id           = Ice.Util.identityToString(ident, _communicator.toStringMode());
                        ex.kindOfObject = "servant";
                        if (facet.Length > 0)
                        {
                            ex.id += " -f " + IceUtilInternal.StringUtil.escapeString(facet, "", _communicator.toStringMode());
                        }
                        throw ex;
                    }
                }

                m[facet] = servant;
            }
        }
예제 #4
0
 public void addDefaultServant(Ice.Disp servant, string category)
 {
     lock (this)
     {
         Debug.Assert(_communicator != null); // Must not be called after destruction.
         if (_defaultServantMap.ContainsKey(category))
         {
             throw new Ice.AlreadyRegisteredException("default servant", category);
         }
         _defaultServantMap[category] = servant;
     }
 }
예제 #5
0
 public void AddDefaultServant(Ice.Disp servant, string category)
 {
     lock (this)
     {
         Debug.Assert(_communicator != null); // Must not be called after destruction.
         if (_defaultServantMap.ContainsKey(category))
         {
             throw new ArgumentException($"A default servant for category `{category}' is already registered",
                                         nameof(category));
         }
         _defaultServantMap[category] = servant;
     }
 }