public virtual RealProxy CreateProxy(ObjRef objRef, Type serverType,
										 Object serverObject,
										 Context serverContext)
			{
				// TODO
				return null;
			}
 public bool IsNewContextOK(Context newCtx)
 {
     InterceptProperty p = newCtx.GetProperty("Intercept") as InterceptProperty;
     if(p == null)
         return false;
     return true;
 }
Esempio n. 3
0
		public void TestDoCallback ()
		{
			otherCtx = cbo.GetContext ();
			Assert.IsTrue (Thread.CurrentContext != otherCtx, "New context not created");
			
			otherCtx.DoCallBack (new CrossContextDelegate (DelegateTarget));
		}
Esempio n. 4
0
        [System.Security.SecurityCritical]  // auto-generated 
        public virtual RealProxy CreateProxy(ObjRef objRef,
                                             Type serverType, 
                                             Object serverObject,
                                             Context serverContext)
        {
            RemotingProxy rp =  new RemotingProxy(serverType); 

            // If this is a serverID, set the native context field in the TP 
            if (null != serverContext) 
            {
                RealProxy.SetStubData(rp, serverContext.InternalContextID); 
            }

            if (objRef != null && objRef.GetServerIdentity().IsAllocated)
            { 
                rp.SetSrvInfo(objRef.GetServerIdentity(), objRef.GetDomainID());
            } 
 
            // Set the flag indicating that the fields of the proxy
            // have been initialized 
            rp.Initialized = true;

            // Sanity check
            Type t = serverType; 
            if (!t.IsContextful &&
                !t.IsMarshalByRef && 
                (null != serverContext)) 
            {
                throw new RemotingException( 
                    Environment.GetResourceString(
                        "Remoting_Activation_MBR_ProxyAttribute"));
            }
 
            return rp;
        } 
		public bool IsNewContextOK(Context newCtx)
		{
			var p = newCtx.GetProperty("Reporting") as ReportingProperty;
			if (p == null)
				return false;
			return true;
		}
Esempio n. 6
0
 public override bool IsContextOK(Context ctx, System.Runtime.Remoting.Activation.IConstructionCallMessage ctorMsg)
 {
     InterceptProperty p = ctx.GetProperty("Intercept") as InterceptProperty;
     if (p == null)
         return false;
     return true;
 }
 internal static bool AddDynamicProperty(Context ctx, IDynamicProperty prop)
 {
     if (ctx != null)
     {
         return ctx.AddPerContextDynamicProperty(prop);
     }
     return AddGlobalDynamicProperty(prop);
 }
 internal AsyncWorkItem(IMessage reqMsg, IMessageSink replySink, Context oldCtx, ServerIdentity srvID)
 {
     this._reqMsg = reqMsg;
     this._replySink = replySink;
     this._oldCtx = oldCtx;
     this._callCtx = CallContext.GetLogicalCallContext();
     this._srvID = srvID;
 }
        /// <summary>
        /// permet de vérifier que le context est ok apres son initialisation
        /// </summary>
        /// <param name="newCtx">le context qui vient d'etre créé</param>
        /// <returns>True : le contexte contient bien une propriété appelé "ValidationData". False sinon.</returns>
        public bool IsNewContextOK(Context newCtx)
        {
            DataValidationProperty prop=newCtx.GetProperty("DataValidation") as DataValidationProperty;
            if (prop!=null)	// on a une propriété appelé ValidationData dans le contexte ?
                return true;	// Oui -> on accepte le contexte

            return false;	// Non -> on refuse le contexte
        }
Esempio n. 10
0
 public override bool IsContextOK(Context ctx, IConstructionCallMessage ctorMsg)
 {
     var p = ctx.GetProperty("Reporting") as ReportingProperty;
     if (p == null)
     {
         return false;
     }
     return true;
 }
        //Le runtime .NET interroge pour savoir si le contexte courant est valide.
        //Si cette fonction false, le runtime créé un nouveau contexte et appelle GetPropertiesForNewContext()
        // pour vérifier si le context est valid, on vérifie la présence (et la validité si besoin) d'un propriété
        public override bool IsContextOK(Context ctx,IConstructionCallMessage ctorMsg)
        {
            //return false;	// Seulement si vous souhaitez un contexte par instance !
            DataValidationProperty prop=ctx.GetProperty("DataValidation") as DataValidationProperty;
            if (prop!=null)	// on a une propriété appelé ValidationData dans le contexte ?
                return true;	// Oui -> on accepte le contexte

            return false;	// Non -> on refuse le contexte
        }
		public SynchRes CheckContext (Context ctx)
		{
			object otherp = ctx.GetProperty ("Synchronization");
			object thisp = Thread.CurrentContext.GetProperty ("Synchronization");

			if (thisp == null) return SynchRes.NoSync;
			if (thisp == otherp) return SynchRes.SameSync;
			return SynchRes.NewSync;
		}
Esempio n. 13
0
 public bool IsNewContextOK(Context ctx)
 {
     AOPProperty newContextLogProperty = ctx.GetProperty("AOP") as AOPProperty;
     if (newContextLogProperty == null) {
         Debug.Assert(false);
         return false;
     }
     return (true);
 }
        public ProviderValidationProxy(Type type, Type connectionType, bool schemaNameSupported)
            : base(type)
        {
            context = new Context();
            context.Freeze();

            this.connectionType = connectionType;
            this.schemaNameSupported = schemaNameSupported;
        }
Esempio n. 15
0
        public static bool toIdle(Context context)
        {
            // check for parent modes

            MetaWatchService.WatchModes.IDLE = true;
            MetaWatchService.watchState = MetaWatchService.WatchStates.IDLE;

            sendLcdIdle();
            //Protocol.updateDisplay(0);

            return true;
        }
		public override bool IsContextOK (Context ctx, IConstructionCallMessage msg)
		{
			SyncContext sctx = SyncContext.GetContext ();
			if (sctx == null || (sctx.GetType() != contextType)) {
				syncContext = (SyncContext) Activator.CreateInstance (contextType);
				return false;
			}
			else {
				syncContext = sctx;
				return true;
			}
		}
        //Le runtime .NET interroge l'attribut pour savoir si le contexte courant est valide.
        //Si cette fonction renvoi false, le runtime créé un nouveau contexte et appelle GetPropertiesForNewContext()
        // pour vérifier si le context est valid, on vérifie la présence (et la validité si besoin) d'une propriété
        public override bool IsContextOK(Context ctx,IConstructionCallMessage ctorMsg)
        {
            //le return false permet de forcer systématiquement un nouveau contexte pour chaqueinstance
            // utilise si une instance d'un type créé des instance de ce meme type : vous pouvez intercepter
            // les appels entre instance d'un meme type ( car il y aura changement de contexte )
            //return false;

            InterceptionAppelProperty prop=ctx.GetProperty("InterceptionAppelProperty") as InterceptionAppelProperty;
            if (prop!=null)	// on a une propriété appelé InterceptionAppelProperty dans le contexte ?
                return true;	// Oui -> on accepte le contexte

            return false;	// Non -> on refuse le contexte
        }
		public override RealProxy CreateProxy(ObjRef objRef, Type serverType, Object serverObject, Context serverContext)
		{
			var proxy = new InterceptionRealProxy(serverType);

			if (serverContext != null)
			{
				RealProxy.SetStubData(proxy, serverContext);
			}

			if ((serverType.IsMarshalByRef == false) && (serverContext == null))
			{
				throw new RemotingException("Bad Type for CreateProxy");
			}

			return (proxy);
		}
 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;
 }
 public virtual RealProxy CreateProxy(ObjRef objRef, Type serverType, object serverObject, Context serverContext)
 {
     RemotingProxy rp = new RemotingProxy(serverType);
     if (serverContext != null)
     {
         RealProxy.SetStubData(rp, serverContext.InternalContextID);
     }
     if ((objRef != null) && objRef.GetServerIdentity().IsAllocated)
     {
         rp.SetSrvInfo(objRef.GetServerIdentity(), objRef.GetDomainID());
     }
     rp.Initialized = true;
     Type type = serverType;
     if ((!type.IsContextful && !type.IsMarshalByRef) && (serverContext != null))
     {
         throw new RemotingException(Environment.GetResourceString("Remoting_Activation_MBR_ProxyAttribute"));
     }
     return rp;
 }
Esempio n. 21
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;
 }
Esempio n. 22
0
		public void TestDatastore ()
		{
			otherCtx = cbo.GetContext ();
			
			slot = Context.AllocateDataSlot ();
			LocalDataStoreSlot namedSlot1 = Context.AllocateNamedDataSlot ("slot1");
			LocalDataStoreSlot namedSlot2 = Context.GetNamedDataSlot ("slot2");
			
			Context.SetData (slot, "data");
			Context.SetData (namedSlot1, "data1");
			Context.SetData (namedSlot2, "data2");
			
			otherCtx.DoCallBack (new CrossContextDelegate (CheckOtherContextDatastore));
			
			Assert.IsTrue (Context.GetData (slot).Equals ("data"), "Wrong data 1");
			Assert.IsTrue (Context.GetData (namedSlot1).Equals ("data1"), "Wrong data 2");
			Assert.IsTrue (Context.GetData (namedSlot2).Equals ("data2"), "Wrong data 3");
			
			try
			{
				namedSlot1 = Context.AllocateNamedDataSlot ("slot1");
				Assert.Fail ("Exception expected");
			}
			catch {}
			
			Context.FreeNamedDataSlot ("slot1");
			Context.FreeNamedDataSlot ("slot2");
			
			try
			{
				namedSlot1 = Context.AllocateNamedDataSlot ("slot1");
			}
			catch 
			{
				Assert.Fail ("Exception not expected");
			}
			
			Context.FreeNamedDataSlot ("slot1");
		}
 internal static IMessage CallProcessMessage(IMessageSink ms, IMessage reqMsg, ArrayWithSize proxySinks, Thread currentThread, Context currentContext, bool bSkippingContextChain)
 {
     if (proxySinks != null)
     {
         DynamicPropertyHolder.NotifyDynamicSinks(reqMsg, proxySinks, true, true, false);
     }
     bool flag = false;
     if (bSkippingContextChain)
     {
         flag = currentContext.NotifyDynamicSinks(reqMsg, true, true, false, true);
         ChannelServices.NotifyProfiler(reqMsg, RemotingProfilerEvent.ClientSend);
     }
     if (ms == null)
     {
         throw new RemotingException(Environment.GetResourceString("Remoting_Proxy_NoChannelSink"));
     }
     IMessage msg = ms.SyncProcessMessage(reqMsg);
     if (bSkippingContextChain)
     {
         ChannelServices.NotifyProfiler(msg, RemotingProfilerEvent.ClientReceive);
         if (flag)
         {
             currentContext.NotifyDynamicSinks(msg, true, false, false, true);
         }
     }
     IMethodReturnMessage message2 = msg as IMethodReturnMessage;
     if ((msg == null) || (message2 == null))
     {
         throw new RemotingException(Environment.GetResourceString("Remoting_Message_BadType"));
     }
     if (proxySinks != null)
     {
         DynamicPropertyHolder.NotifyDynamicSinks(msg, proxySinks, true, false, false);
     }
     return msg;
 }
Esempio n. 24
0
 public bool IsNewContextOK(Context newCtx)
 {
     return true;
 }
		internal static extern Context InternalSetContext (Context context);
Esempio n. 26
0
File: Context.cs Progetto: psni/mono
		extern static void RegisterContext (Context ctx);
Esempio n. 27
0
 public void Freeze(Context newContext)
 {
 }
Esempio n. 28
0
File: Context.cs Progetto: psni/mono
		internal static Context CreateNewContext (IConstructionCallMessage msg)
		{
			// Create the new context

			Context newContext = new Context();

			foreach (IContextProperty prop in msg.ContextProperties)
			{
				if (newContext.GetProperty (prop.Name) == null)
					newContext.SetProperty (prop);
			}
			newContext.Freeze();


			// Ask each context property whether the new context is OK

			foreach (IContextProperty prop in msg.ContextProperties)
				if (!prop.IsNewContextOK (newContext)) 
					throw new RemotingException("A context property did not approve the candidate context for activating the object");

			return newContext;
		}
Esempio n. 29
0
File: Context.cs Progetto: psni/mono
		internal static Context SwitchToContext (Context newContext)
		{
			return AppDomain.InternalSetContext (newContext);
		}
Esempio n. 30
0
File: Context.cs Progetto: psni/mono
		static DynamicPropertyCollection GetDynamicPropertyCollection(ContextBoundObject obj, Context ctx)
		{
			if (ctx == null && obj != null)
			{
				if (RemotingServices.IsTransparentProxy(obj))
				{
					RealProxy rp = RemotingServices.GetRealProxy (obj);
					return rp.ObjectIdentity.ClientDynamicProperties;
				}
				else
				{
#if FEATURE_REMOTING
					return obj.ObjectIdentity.ServerDynamicProperties;
#else
					throw new NotSupportedException ();
#endif					
				}
			}
			else if (ctx != null && obj == null)
			{
				if (ctx.context_dynamic_properties == null) ctx.context_dynamic_properties = new DynamicPropertyCollection ();
				return ctx.context_dynamic_properties;
			}
			else if (ctx == null && obj == null)
			{
				if (global_dynamic_properties == null) global_dynamic_properties = new DynamicPropertyCollection ();
				return global_dynamic_properties;
			}
			else
				throw new ArgumentException ("Either obj or ctx must be null");
		}
Esempio n. 31
0
 public bool IsNewContextOK(System.Runtime.Remoting.Contexts.Context newCtx)
 {
     return(true);
 }
Esempio n. 32
0
 public void Freeze(System.Runtime.Remoting.Contexts.Context newContext)
 {
     // nothing to do
 }