Ejemplo n.º 1
0
        public object GetObject(Type type, string bus_name, ObjectPath path)
        {
            if (!CheckBusNameExists(bus_name))
            {
                return(null);
            }

            //if the requested type is an interface, we can implement it efficiently
            //otherwise we fall back to using a transparent proxy
            if (type.IsInterface || type.IsAbstract)
            {
                return(BusObject.GetObject(this, bus_name, path, type));
            }
            else
            {
                if (ProtocolInformation.Verbose)
                {
                    Console.Error.WriteLine("Warning: Note that MarshalByRefObject use is not recommended; for best performance, define interfaces");
                }

                BusObject busObject = new BusObject(this, bus_name, path);
                DProxy    prox      = new DProxy(busObject, type);
                return(prox.GetTransparentProxy());
            }
        }
Ejemplo n.º 2
0
        public static object GetObject(Connection conn, string bus_name, ObjectPath object_path, Type declType)
        {
            Type proxyType = TypeImplementer.Root.GetImplementation(declType);

            object    instObj = Activator.CreateInstance(proxyType);
            BusObject inst    = GetBusObject(instObj);

            inst.conn        = conn;
            inst.bus_name    = bus_name;
            inst.object_path = object_path;

            return(instObj);
        }
Ejemplo n.º 3
0
        public static BusObject GetBusObject(object instObj)
        {
            if (instObj is BusObject)
                return (BusObject)instObj;

            BusObject inst;
            if (boCache.TryGetValue (instObj, out inst))
                return inst;

            inst = new BusObject ();
            boCache[instObj] = inst;

            return inst;
        }
Ejemplo n.º 4
0
        public object GetObject(Type type, string bus_name, ObjectPath path)
        {
            if (!CheckBusNameExists(bus_name))
            {
                return(null);
            }

            //if the requested type is an interface, we can implement it efficiently
            //otherwise we fall back to using a transparent proxy
            if (type.IsInterface || type.IsAbstract)
            {
                return(BusObject.GetObject(this, bus_name, path, type));
            }
            else
            {
                throw new ApplicationException("Warning: Note that MarshalByRefObject use is not available");
            }
        }
Ejemplo n.º 5
0
        public static BusObject GetBusObject(object instObj)
        {
            if (instObj is BusObject)
            {
                return((BusObject)instObj);
            }

            BusObject inst;

            if (boCache.TryGetValue(instObj, out inst))
            {
                return(inst);
            }

            inst             = new BusObject();
            boCache[instObj] = inst;

            return(inst);
        }
Ejemplo n.º 6
0
        public void WriteObject(Type type, object val)
        {
            ObjectPath path;

            BusObject bobj = val as BusObject;

            if (bobj == null && val is MarshalByRefObject)
            {
                bobj = ((MarshalByRefObject)val).GetLifetimeService() as BusObject;
            }

            if (bobj == null)
            {
                throw new Exception("No object reference to write");
            }

            path = bobj.Path;

            Write(path);
        }
Ejemplo n.º 7
0
		public DProxy (BusObject busObject, Type type) : base(type)
		{
			this.busObject = busObject;
		}
Ejemplo n.º 8
0
 public DProxy(BusObject busObject, Type type) : base(type)
 {
     this.busObject = busObject;
 }