Example #1
0
        public Ice.Object removeServant(Ice.Identity ident, string facet)
        {
            lock (this)
            {
                Debug.Assert(_instance != null); // Must not be called after destruction.

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

                Dictionary <string, Ice.Object> m;
                _servantMapMap.TryGetValue(ident, out m);
                Ice.Object obj = null;
                if (m == null || !m.ContainsKey(facet))
                {
                    Ice.NotRegisteredException ex = new Ice.NotRegisteredException();
                    ex.id           = Ice.Util.identityToString(ident, _instance.toStringMode());
                    ex.kindOfObject = "servant";
                    if (facet.Length > 0)
                    {
                        ex.id += " -f " + IceUtilInternal.StringUtil.escapeString(facet, "", _instance.toStringMode());
                    }
                    throw ex;
                }
                obj = m[facet];
                m.Remove(facet);

                if (m.Count == 0)
                {
                    _servantMapMap.Remove(ident);
                }
                return(obj);
            }
        }
Example #2
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);
            }
        }
 public void remove(string id)
 {
     object o = null;
     lock(this)
     {
         if(!_factoryMap.ContainsKey(id))
         {
             Ice.NotRegisteredException ex = new Ice.NotRegisteredException();
             ex.id = id;
             ex.kindOfObject = "object factory";
             throw ex;
         }
         _factoryMap.Remove(id);
     }
     ((Ice.ObjectFactory)o).destroy();
 }
Example #4
0
        public void remove(string id)
        {
            object o = null;

            lock (this)
            {
                if (!_factoryMap.ContainsKey(id))
                {
                    Ice.NotRegisteredException ex = new Ice.NotRegisteredException();
                    ex.id           = id;
                    ex.kindOfObject = "object factory";
                    throw ex;
                }
                _factoryMap.Remove(id);
            }
            ((Ice.ObjectFactory)o).destroy();
        }
Example #5
0
        public Ice.IServantLocator RemoveServantLocator(string category)
        {
            lock (this)
            {
                Debug.Assert(_communicator != null); // Must not be called after destruction.

                _locatorMap.TryGetValue(category, out Ice.IServantLocator l);
                if (l == null)
                {
                    var ex = new Ice.NotRegisteredException();
                    ex.Id           = IceUtilInternal.StringUtil.escapeString(category, "", _communicator.ToStringMode);
                    ex.KindOfObject = "servant locator";
                    throw ex;
                }
                _locatorMap.Remove(category);
                return(l);
            }
        }
Example #6
0
        public Ice.ServantLocator removeServantLocator(string category)
        {
            lock (this)
            {
                Debug.Assert(_instance != null); // Must not be called after destruction.

                Ice.ServantLocator l;
                _locatorMap.TryGetValue(category, out l);
                if (l == null)
                {
                    Ice.NotRegisteredException ex = new Ice.NotRegisteredException();
                    ex.id           = IceUtilInternal.StringUtil.escapeString(category, "", _instance.toStringMode());
                    ex.kindOfObject = "servant locator";
                    throw ex;
                }
                _locatorMap.Remove(category);
                return(l);
            }
        }
Example #7
0
        public Dictionary <string, Ice.Disp> RemoveAllFacets(Ice.Identity ident)
        {
            lock (this)
            {
                Debug.Assert(_communicator != null);

                _servantMapMap.TryGetValue(ident, out Dictionary <string, Ice.Disp> m);
                if (m == null)
                {
                    var ex = new Ice.NotRegisteredException();
                    ex.Id           = ident.ToString(_communicator.ToStringMode);
                    ex.KindOfObject = "servant";
                    throw ex;
                }
                _servantMapMap.Remove(ident);

                return(m);
            }
        }
Example #8
0
        public Dictionary <string, Ice.Object> removeAllFacets(Ice.Identity ident)
        {
            lock (this)
            {
                Debug.Assert(_instance != null);

                Dictionary <string, Ice.Object> m;
                _servantMapMap.TryGetValue(ident, out m);
                if (m == null)
                {
                    Ice.NotRegisteredException ex = new Ice.NotRegisteredException();
                    ex.id           = Ice.Util.identityToString(ident, _instance.toStringMode());
                    ex.kindOfObject = "servant";
                    throw ex;
                }
                _servantMapMap.Remove(ident);

                return(m);
            }
        }
Example #9
0
        public Ice.Object removeDefaultServant(string category)
        {
            lock (this)
            {
                Debug.Assert(_instance != null); // Must not be called after destruction.

                Ice.Object obj = null;
                _defaultServantMap.TryGetValue(category, out obj);
                if (obj == null)
                {
                    Ice.NotRegisteredException ex = new Ice.NotRegisteredException();
                    ex.kindOfObject = "default servant";
                    ex.id           = category;
                    throw ex;
                }

                _defaultServantMap.Remove(category);
                return(obj);
            }
        }
Example #10
0
        private void getEndpointsException(Reference @ref, System.Exception exc)
        {
            try
            {
                throw exc;
            }
            catch (Ice.AdapterNotFoundException ex)
            {
                Instance instance = @ref.getInstance();
                if (instance.traceLevels().location >= 1)
                {
                    System.Text.StringBuilder s = new System.Text.StringBuilder();
                    s.Append("adapter not found\n");
                    s.Append("adapter = " + @ref.getAdapterId());
                    instance.initializationData().logger.trace(instance.traceLevels().locationCat, s.ToString());
                }

                Ice.NotRegisteredException e = new Ice.NotRegisteredException(ex);
                e.kindOfObject = "object adapter";
                e.id           = @ref.getAdapterId();
                throw e;
            }
            catch (Ice.ObjectNotFoundException ex)
            {
                Instance instance = @ref.getInstance();
                if (instance.traceLevels().location >= 1)
                {
                    System.Text.StringBuilder s = new System.Text.StringBuilder();
                    s.Append("object not found\n");
                    s.Append("object = " + Ice.Util.identityToString(@ref.getIdentity(), instance.toStringMode()));
                    instance.initializationData().logger.trace(instance.traceLevels().locationCat, s.ToString());
                }

                Ice.NotRegisteredException e = new Ice.NotRegisteredException(ex);
                e.kindOfObject = "object";
                e.id           = Ice.Util.identityToString(@ref.getIdentity(), instance.toStringMode());
                throw e;
            }
            catch (Ice.NotRegisteredException)
            {
                throw;
            }
            catch (Ice.LocalException ex)
            {
                Instance instance = @ref.getInstance();
                if (instance.traceLevels().location >= 1)
                {
                    System.Text.StringBuilder s = new System.Text.StringBuilder();
                    s.Append("couldn't contact the locator to retrieve endpoints\n");
                    if (@ref.getAdapterId().Length > 0)
                    {
                        s.Append("adapter = " + @ref.getAdapterId() + "\n");
                    }
                    else
                    {
                        s.Append("well-known proxy = " + @ref.ToString() + "\n");
                    }
                    s.Append("reason = " + ex);
                    instance.initializationData().logger.trace(instance.traceLevels().locationCat, s.ToString());
                }
                throw;
            }
            catch (System.Exception)
            {
                Debug.Assert(false);
            }
        }
Example #11
0
        private void getEndpointsException(Reference @ref, System.Exception exc)
        {
            try
            {
                throw exc;
            }
            catch(Ice.AdapterNotFoundException ex)
            {
                Instance instance = @ref.getInstance();
                if(instance.traceLevels().location >= 1)
                {
                    System.Text.StringBuilder s = new System.Text.StringBuilder();
                    s.Append("adapter not found\n");
                    s.Append("adapter = " + @ref.getAdapterId());
                    instance.initializationData().logger.trace(instance.traceLevels().locationCat, s.ToString());
                }

                Ice.NotRegisteredException e = new Ice.NotRegisteredException(ex);
                e.kindOfObject = "object adapter";
                e.id = @ref.getAdapterId();
                throw e;
            }
            catch(Ice.ObjectNotFoundException ex)
            {
                Instance instance = @ref.getInstance();
                if(instance.traceLevels().location >= 1)
                {
                    System.Text.StringBuilder s = new System.Text.StringBuilder();
                    s.Append("object not found\n");
                    s.Append("object = " + instance.identityToString(@ref.getIdentity()));
                    instance.initializationData().logger.trace(instance.traceLevels().locationCat, s.ToString());
                }

                Ice.NotRegisteredException e = new Ice.NotRegisteredException(ex);
                e.kindOfObject = "object";
                e.id = instance.identityToString(@ref.getIdentity());
                throw e;
            }
            catch(Ice.NotRegisteredException)
            {
                throw;
            }
            catch(Ice.LocalException ex)
            {
                Instance instance = @ref.getInstance();
                if(instance.traceLevels().location >= 1)
                {
                    System.Text.StringBuilder s = new System.Text.StringBuilder();
                    s.Append("couldn't contact the locator to retrieve adapter endpoints\n");
                    if(@ref.getAdapterId().Length > 0)
                    {
                        s.Append("adapter = " + @ref.getAdapterId() + "\n");
                    }
                    else
                    {
                        s.Append("object = " + instance.identityToString(@ref.getIdentity()) + "\n");
                    }
                    s.Append("reason = " + ex);
                    instance.initializationData().logger.trace(instance.traceLevels().locationCat, s.ToString());
                }
                throw;
            }
            catch(System.Exception)
            {
                Debug.Assert(false);
            }
        }
Example #12
0
    public Ice.Object removeServant(Ice.Identity ident, string facet)
    {
        lock(this)
        {
            Debug.Assert(instance_ != null); // Must not be called after destruction.
            
            if(facet == null)
            {
                facet = "";
            }

            Dictionary<string, Ice.Object> m;
            _servantMapMap.TryGetValue(ident, out m);
            Ice.Object obj = null;
            if(m == null || !m.ContainsKey(facet))
            {
                Ice.NotRegisteredException ex = new Ice.NotRegisteredException();
                ex.id = Ice.Util.identityToString(ident);
                ex.kindOfObject = "servant";
                if(facet.Length > 0)
                {
                    ex.id += " -f " + IceUtilInternal.StringUtil.escapeString(facet, "");
                }
                throw ex;
            }
            obj = m[facet];
            m.Remove(facet);
            
            if(m.Count == 0)
            {
                _servantMapMap.Remove(ident);
            }
            return obj;
        }
    }
Example #13
0
 public Ice.ServantLocator removeServantLocator(string category)
 {
     lock(this)
     {
         Debug.Assert(instance_ != null); // Must not be called after destruction.
         
         Ice.ServantLocator l;
         _locatorMap.TryGetValue(category, out l);
         if(l == null)
         {
             Ice.NotRegisteredException ex = new Ice.NotRegisteredException();
             ex.id = IceUtilInternal.StringUtil.escapeString(category, "");
             ex.kindOfObject = "servant locator";
             throw ex;
         }
         _locatorMap.Remove(category);
         return l;
     }
 }
Example #14
0
    public Dictionary<string, Ice.Object> removeAllFacets(Ice.Identity ident)
    {
        lock(this)
        {
            Debug.Assert(instance_ != null);

            Dictionary<string, Ice.Object> m;
            _servantMapMap.TryGetValue(ident, out m);
            if(m == null)
            {
                Ice.NotRegisteredException ex = new Ice.NotRegisteredException();
                ex.id = Ice.Util.identityToString(ident);
                ex.kindOfObject = "servant";
                throw ex;
            }
            _servantMapMap.Remove(ident);

            return m;
        }
    }
Example #15
0
    public Ice.Object removeDefaultServant(string category)
    {
        lock(this)
        {
            Debug.Assert(instance_ != null); // Must not be called after destruction.

            Ice.Object obj = null;
            _defaultServantMap.TryGetValue(category, out obj);
            if(obj == null)
            {
                Ice.NotRegisteredException ex = new Ice.NotRegisteredException();
                ex.kindOfObject = "default servant";
                ex.id = category;
                throw ex;
            }

            _defaultServantMap.Remove(category);
            return obj;
        }
    }