示例#1
0
        finishRequest(Reference @ref, List <Reference> wellKnownRefs, Ice.ObjectPrx proxy, bool notRegistered)
        {
            Ice.ObjectPrxHelperBase @base = proxy as Ice.ObjectPrxHelperBase;
            if (proxy == null || @base.reference__().isIndirect())
            {
                //
                // Remove the cached references of well-known objects for which we tried
                // to resolved the endpoints if these endpoints are empty.
                //
                foreach (Reference r in wellKnownRefs)
                {
                    _table.removeObjectReference(r.getIdentity());
                }
            }

            if ([email protected]())
            {
                if (proxy != null && [email protected]__().isIndirect())
                {
                    // Cache the adapter endpoints.
                    _table.addAdapterEndpoints(@ref.getAdapterId(), @base.reference__().getEndpoints());
                }
                else if (notRegistered) // If the adapter isn't registered anymore, remove it from the cache.
                {
                    _table.removeAdapterEndpoints(@ref.getAdapterId());
                }

                lock (this)
                {
                    Debug.Assert(_adapterRequests.ContainsKey(@ref.getAdapterId()));
                    _adapterRequests.Remove(@ref.getAdapterId());
                }
            }
            else
            {
                if (proxy != null && [email protected]__().isWellKnown())
                {
                    // Cache the well-known object reference.
                    _table.addObjectReference(@ref.getIdentity(), @base.reference__());
                }
                else if (notRegistered) // If the well-known object isn't registered anymore, remove it from the cache.
                {
                    _table.removeObjectReference(@ref.getIdentity());
                }

                lock (this)
                {
                    Debug.Assert(_objectRequests.ContainsKey(@ref.getIdentity()));
                    _objectRequests.Remove(@ref.getIdentity());
                }
            }
        }
示例#2
0
 protected ProxyOutgoingAsyncBase(Ice.ObjectPrxHelperBase prx, string op, object cookie, BasicStream os) :
     base(prx.ice_getCommunicator(), prx.reference__().getInstance(), op, cookie, os)
 {
     proxy_ = prx;
     mode_  = Ice.OperationMode.Normal;
     _cnt   = 0;
     _sent  = false;
 }
示例#3
0
 proxyToProperty(Ice.ObjectPrx proxy, string prefix)
 {
     if (proxy != null)
     {
         Ice.ObjectPrxHelperBase h = (Ice.ObjectPrxHelperBase)proxy;
         return(h.reference__().toProperty(prefix));
     }
     else
     {
         return(new Dictionary <string, string>());
     }
 }
示例#4
0
 public string proxyToString(Ice.ObjectPrx proxy)
 {
     if (proxy != null)
     {
         Ice.ObjectPrxHelperBase h = (Ice.ObjectPrxHelperBase)proxy;
         return(h.reference__().ToString());
     }
     else
     {
         return("");
     }
 }
示例#5
0
 public void proxyToStream(Ice.ObjectPrx proxy, BasicStream s)
 {
     if (proxy != null)
     {
         Ice.ObjectPrxHelperBase h = (Ice.ObjectPrxHelperBase)proxy;
         Reference r = h.reference__();
         r.getIdentity().write__(s);
         r.streamWrite(s);
     }
     else
     {
         Ice.Identity ident = new Ice.Identity();
         ident.name     = "";
         ident.category = "";
         ident.write__(s);
     }
 }
示例#6
0
 private static void writeValue(string name, object val, Dictionary <Ice.Object, object> objectTable, OutputBase output)
 {
     if (val == null)
     {
         writeName(name, output);
         output.print("(null)");
     }
     else
     {
         System.Type c = val.GetType();
         if (c.Equals(typeof(byte)) || c.Equals(typeof(short)) || c.Equals(typeof(int)) ||
             c.Equals(typeof(long)) || c.Equals(typeof(double)) || c.Equals(typeof(float)) ||
             c.Equals(typeof(bool)))
         {
             writeName(name, output);
             output.print(val.ToString());
         }
         else if (c.Equals(typeof(string)))
         {
             writeName(name, output);
             output.print("\"");
             output.print(val.ToString());
             output.print("\"");
         }
         else if (val is IList)
         {
             int         n = 0;
             IEnumerator i = ((IList)val).GetEnumerator();
             while (i.MoveNext())
             {
                 string elem = (name != null ? name : "");
                 elem += "[" + n++ + "]";
                 writeValue(elem, i.Current, objectTable, output);
             }
         }
         else if (val is IDictionary)
         {
             foreach (DictionaryEntry entry in (IDictionary)val)
             {
                 string elem = name != null ? name + "." : "";
                 writeValue(elem + "key", entry.Key, objectTable, output);
                 writeValue(elem + "value", entry.Value, objectTable, output);
             }
         }
         else if (val is Ice.ObjectPrxHelperBase)
         {
             writeName(name, output);
             Ice.ObjectPrxHelperBase proxy = (Ice.ObjectPrxHelperBase)val;
             output.print(proxy.reference__().ToString());
         }
         else if (val is Ice.Object)
         {
             //
             // Check for recursion.
             //
             if (objectTable != null && objectTable.ContainsKey((Ice.Object)val))
             {
                 writeName(name, output);
                 output.print("(recursive)");
             }
             else
             {
                 if (objectTable == null)
                 {
                     objectTable = new Dictionary <Ice.Object, object>();
                 }
                 objectTable[(Ice.Object)val] = null;
                 writeFields(name, val, c, objectTable, output);
             }
         }
         else if (c.IsEnum)
         {
             writeName(name, output);
             output.print(val.ToString());
         }
         else
         {
             //
             // Must be struct.
             //
             writeFields(name, val, c, objectTable, output);
         }
     }
 }