Exemplo n.º 1
0
        public Ice.ObjectPrx register(string Name, Ice.Object servant, bool icegrid = true)
        {
            // register an object to local Ice adapter and yellowpage service (IceGrid)

            Ice.Identity iceid = Communicator.stringToIdentity(Name);
            logger.Info("Registering: " + Name);//+ " with ice_id: " + iceid.ToString());
            Ice.ObjectPrx proxy;
            try
            {
                proxy = _Adapter.add(servant, iceid);
            }
            catch (Ice.AlreadyRegisteredException ex)
            {
                logger.Error("The name of this holon: " + iceid.ToString() + " is allready used in local adapter");
                //maybe I could try to change name but there is probably something wrong
                throw (ex);
            }

            // It is very important to deregister objects before closing!!
            // Otherwise ghost links are created
            IceGrid.AdminPrx admin = getIceGridAdmin();
            try
            {
                admin.addObjectWithType(proxy, servant.ice_id());
            }
            catch (IceGrid.ObjectExistsException)
            {
                admin.updateObject(proxy);
            }
            _ServantIds.Add(iceid);
            return(proxy);
        }
Exemplo n.º 2
0
 public void patch(Ice.Object v)
 {
     if (v != null && !typeof(T).IsAssignableFrom(v.GetType()))
     {
         IceInternal.Ex.throwUOE(_type, v.ice_id());
     }
     value = (T)v;
 }
Exemplo n.º 3
0
        public override void patch(Ice.Object v)
        {
            if (v != null && !typeof(T).IsAssignableFrom(v.GetType()))
            {
                IceInternal.Ex.throwUOE(type(), v.ice_id());
            }

            _seq[_index] = (T)v;
        }
Exemplo n.º 4
0
        public static DispatchStatus ice_id___(Ice.Object __obj, IceInternal.Incoming inS__, Current __current)
        {
            inS__.readEmptyParams();
            string       __ret = __obj.ice_id(__current);
            OutputStream os__  = inS__.startWriteParams__(FormatType.DefaultFormat);

            os__.writeString(__ret);
            inS__.endWriteParams__(true);
            return(DispatchStatus.DispatchOK);
        }
Exemplo n.º 5
0
        public static Task <Ice.OutputStream> ice_id___(Ice.Object __obj, IceInternal.Incoming inS__, Current __current)
        {
            inS__.readEmptyParams();
            var __ret = __obj.ice_id(__current);
            var os__  = inS__.startWriteParams();

            os__.writeString(__ret);
            inS__.endWriteParams(os__);
            inS__.setResult(os__);
            return(null);
        }
Exemplo n.º 6
0
        public static Task <Ice.OutputStream> iceD_ice_id(Ice.Object obj, IceInternal.Incoming inS, Current current)
        {
            inS.readEmptyParams();
            var ret  = obj.ice_id(current);
            var ostr = inS.startWriteParams();

            ostr.writeString(ret);
            inS.endWriteParams(ostr);
            inS.setResult(ostr);
            return(null);
        }
Exemplo n.º 7
0
 /// <summary>
 /// Sets the Ice object of the optional to the passed instance.
 /// </summary>
 /// <param name="v">The new object for the optional.</param>
 public void patch(Ice.Object v)
 {
     if (v == null || typeof(T).IsAssignableFrom(v.GetType()))
     {
         //
         // The line below must assign to the Value property. We could also
         // have written it this way:
         //
         // this.opt = (T)v;
         //
         // However, when v is null, the optional might be cleared, which
         // is not the result we want.
         //
         this.value = new Optional <T>((T)v);
     }
     else
     {
         IceInternal.Ex.throwUOE(_type, v.ice_id());
     }
 }
Exemplo n.º 8
0
        public void patch(Ice.Object v)
        {
            if (v != null && !typeof(T).IsAssignableFrom(v.GetType()))
            {
                IceInternal.Ex.throwUOE(_type, v.ice_id());
            }

            int count = _seq.Count;

            if (_index >= count) // Need to grow the sequence.
            {
                for (int i = count; i < _index; i++)
                {
                    _seq.Add(default(T));
                }
                _seq.Add((T)v);
            }
            else
            {
                _seq[_index] = (T)v;
            }
        }
Exemplo n.º 9
0
        public void patch(Ice.Object v)
        {
            if (v != null && !typeof(T).IsAssignableFrom(v.GetType()))
            {
                IceInternal.Ex.throwUOE(_type, v.ice_id());
            }

            InvokeInfo info  = getInvokeInfo(_seqType);
            int        count = info.getCount(_seq);

            if (_index >= count) // Need to grow the sequence.
            {
                for (int i = count; i < _index; i++)
                {
                    info.invokeAdd(_seq, default(T));
                }
                info.invokeAdd(_seq, (T)v);
            }
            else
            {
                info.invokeSet(_seq, _index, (T)v);
            }
        }