Ejemplo n.º 1
0
        public IMessageSink GetObjectSink(MarshalByRefObject obj, IMessageSink nextSink)
        {
            if (obj.GetType().GetCustomAttributes(typeof(ONContextAttribute), true).Length > 0)
                nextSink = new ONContextInterceptor(obj, nextSink, mOnContextClass);

            return nextSink;
        }
Ejemplo n.º 2
0
		public MockingProxy(MarshalByRefObject wrappedInstance, IInterceptor interceptor, IMockMixin mockMixin)
			: base(wrappedInstance.GetType())
		{
			this.WrappedInstance = wrappedInstance;
			this.interceptor = interceptor;
			this.mockMixin = mockMixin;
		}
Ejemplo n.º 3
0
		public void Unregister(MarshalByRefObject obj) {
			ILease lease = (ILease)RemotingServices.GetLifetimeService(obj);
			Debug.Assert(lease.CurrentState == LeaseState.Active);
			lease.Unregister(this);
			lock(this._lock) {
				this._leaseList.Remove(lease);
				Logger.Debug(this, "Stopped sponsoring lease #" + lease.GetHashCode() + " for proxy to " + obj.GetType().Name + ", id = #" + obj.GetHashCode() + ", url = " + RemotingServices.GetObjectUri(obj));
			}
		}
Ejemplo n.º 4
0
        public void PostProcess(IMethodCallMessage callMsg, ref IMethodReturnMessage retMsg, MarshalByRefObject target)
        {
            Type type = target.GetType();
            MethodInfo mi = type.GetMethod("UpdateSetting");
            if (mi == null) return;
            Settings = (Dictionary<string, string>)callMsg.Properties["_settings"];
            if (Settings != null)
            {
                foreach (KeyValuePair<string, string> setting in Settings)
                {
                    mi.Invoke(target, new object[] { setting.Key, setting.Value });
                }

            }
        }
 internal ServerIdentity(MarshalByRefObject obj, Context serverCtx) : base(obj is ContextBoundObject)
 {
     if (obj != null)
     {
         if (!RemotingServices.IsTransparentProxy(obj))
         {
             this._srvType = obj.GetType();
         }
         else
         {
             this._srvType = RemotingServices.GetRealProxy(obj).GetProxiedType();
         }
     }
     this._srvCtx = serverCtx;
     this._serverObjectChain = null;
     this._stackBuilderSink = null;
 }
Ejemplo n.º 6
0
 //   Creates a new server identity. This form is used by RemotingServices.Wrap
 //
 internal ServerIdentity(MarshalByRefObject obj, Context serverCtx) : base(obj is ContextBoundObject)
 {            
     if(null != obj)
     {
         if(!RemotingServices.IsTransparentProxy(obj))
         {
             _srvType = obj.GetType();
         }
         else
         {
             RealProxy rp = RemotingServices.GetRealProxy(obj);
             _srvType =   rp.GetProxiedType();
         }
     }
     
     _srvCtx = serverCtx;
     _serverObjectChain = null; 
     _stackBuilderSink = null;
     _refCount = 0;
 }
Ejemplo n.º 7
0
 public MyProxy(MarshalByRefObject target)
     : base(target.GetType())
 {
     this.target = target;
 }
		public PrevalentSystemProxy(PrevalenceEngine engine, MarshalByRefObject system) : base(system.GetType())
		{
			_engine = engine;
			_system = system;
		}
Ejemplo n.º 9
0
 public MarshallableProxy(MarshalByRefObject targetObject, InvocationDelegate invoker)
     : this(targetObject.GetType(), targetObject, invoker)
 {
 }
Ejemplo n.º 10
0
        private Stream PrepareLocationFwdStream(string host, ushort port,
                                                MarshalByRefObject target) {
            // loc fwd ior
            byte[] objectKey = IorUtil.GetObjectKeyForObj(target);
            string repositoryID = Repository.GetRepositoryID(target.GetType());
            // this server support GIOP 1.2 --> create an GIOP 1.2 profile
            InternetIiopProfile profile = new InternetIiopProfile(new GiopVersion(1, 2), host,
                                                                  port, objectKey);
            profile.AddTaggedComponent(Services.CodeSetService.CreateDefaultCodesetComponent(m_codec));
            Ior locFwdTarget = new Ior(repositoryID, new IorProfile[] { profile });
            CdrOutputStreamImpl iorStream = new CdrOutputStreamImpl(new MemoryStream(),
                                                                    0, new GiopVersion(1, 2));
            locFwdTarget.WriteToStream(iorStream);
            uint encodedIorLength = (uint)iorStream.GetPosition();
 
            // create the location fwd reply
            MemoryStream sourceStream = new MemoryStream();
            CdrOutputStreamImpl cdrOut = new CdrOutputStreamImpl(sourceStream, 0, new GiopVersion(1, 2));
            cdrOut.WriteOpaque(m_giopMagic);
            // version
            cdrOut.WriteOctet(1);
            cdrOut.WriteOctet(2);
            // flags
            cdrOut.WriteOctet(0);
            // msg-type: reply
            cdrOut.WriteOctet(1);
 
            // msg-length
            cdrOut.WriteULong(28 + encodedIorLength);
            // request-id
            cdrOut.WriteULong(5);
            // reply-status: location fwd
            cdrOut.WriteULong(3);
            // one service context to enforce alignement requirement for giop 1.2
            cdrOut.WriteULong(1);
            cdrOut.WriteULong(162739); // service context id
            cdrOut.WriteULong(2); // length of svc context
            cdrOut.WriteBool(true);
            cdrOut.WriteBool(false);
            // svc context end
            // body: 8 aligned
            cdrOut.ForceWriteAlign(Aligns.Align8);

            locFwdTarget.WriteToStream(cdrOut);
 
            sourceStream.Seek(0, SeekOrigin.Begin);
            return sourceStream;
        }
Ejemplo n.º 11
0
 /// <summary>
 /// creates an IOR for an object hosted in the local appdomain.
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 internal static Ior CreateIorForObjectFromThisDomain(MarshalByRefObject obj) {
     return CreateIorForObjectFromThisDomain(obj, obj.GetType(), false);
 }
 private void Write174_MarshalByRefObject(string n, string ns, MarshalByRefObject o, bool isNullable, bool needType)
 {
     if (o == null)
     {
         if (isNullable)
         {
             base.WriteNullTagLiteral(n, ns);
         }
     }
     else if (!needType)
     {
         System.Type type = o.GetType();
         if (type != typeof(MarshalByRefObject))
         {
             if (type != typeof(Controller))
             {
                 throw base.CreateUnknownTypeException(o);
             }
             this.Write175_Controller(n, ns, (Controller) o, isNullable, true);
         }
     }
 }