/// <summary>
        /// Initializes a new instance of the <see cref="AOPSinkProcessor" /> class.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="nextSink">The next sink.</param>
        /// <param name="messageDelegates">The message delegates.</param>
        public AOPSinkProcessor(MarshalByRefObject sender, IMessageSink nextSink, MessageProcessDelegates messageDelegates)
        {
            this.NextSink = nextSink;
            this.Sender = sender;

            this.messageDelegates = messageDelegates;
        }
Example #2
0
		public MockingProxy(MarshalByRefObject wrappedInstance, IInterceptor interceptor, IMockMixin mockMixin)
			: base(wrappedInstance.GetType())
		{
			this.WrappedInstance = wrappedInstance;
			this.interceptor = interceptor;
			this.mockMixin = mockMixin;
		}
Example #3
0
 internal RedirectionProxy(MarshalByRefObject proxy, Type serverType)
 {
     _proxy = proxy;
     _realProxy = RemotingServices.GetRealProxy(_proxy);
     _serverType = serverType;
     _objectMode = WellKnownObjectMode.Singleton;
 } // RedirectionProxy
Example #4
0
        public FixtureLibrary StartSystem(FixtureAssembly fixtureAssembly, MarshalByRefObject remotePublisher)
        {
            _publisher = (IEventPublisher)remotePublisher;

            // TODO -- if fails, do a Thread.Sleep and try again
            _system = fixtureAssembly.FindSystem();
            ProjectFileSystem.RootFolder = fixtureAssembly.RootFolder;

            Project.Current = new Project
            {
                Profile = fixtureAssembly.Profile
            };

            try
            {
                var library = FixtureGraph.Library;
                _runner = new TestRunner(_system, library);
                if (_listener != null)
                {
                    _runner.Listener = _listener;
                }

                return library;
            }
            catch (TestEngineFailureException)
            {
                throw;
            }
            catch (Exception e)
            {
                throw new TestEngineFailureException(e.ToString());
            }
        }
        public IMessageSink GetObjectSink(MarshalByRefObject obj, IMessageSink nextSink)
        {
            if (obj.GetType().GetCustomAttributes(typeof(ONContextAttribute), true).Length > 0)
                nextSink = new ONContextInterceptor(obj, nextSink, mOnContextClass);

            return nextSink;
        }
Example #6
0
		public MockServer(MarshalByRefObject mock, IChannel channel, string uri)
		{
			this.mock = mock;
			this.channel = channel;
			ChannelServices.RegisterChannel(channel, true);
			mockRef = RemotingServices.Marshal(mock, uri);
		}
 /// <summary>
 /// Constructs an instance of the LocalPerformer class.
 /// </summary>
 /// <param name="msg">The invocation to be executed.</param>
 /// <param name="resultCollector">The Result Collector.</param>
 /// <param name="mbr">The target.</param>
 public LocalPerformer(IMessage msg, ResultCollector resultCollector, MarshalByRefObject mbr)
 {
     this._msg = msg;
     this._resultCollector = resultCollector;
     this._mbr = mbr;
     this._mbrUri = RemotingServices.GetObjectUri(mbr);
 }
Example #8
0
 public void StartRunner(string runnerType, MarshalByRefObject remotePublisher)
 {
     // TODO -- if fails, do a Thread.Sleep and try again
     Type type = Type.GetType(runnerType);
     _runner = (TestRunner)Activator.CreateInstance(type);
     _publisher = (IEventPublisher)remotePublisher;
     _runner.FixtureObserver = new FixtureObserver(_publisher);
 }
Example #9
0
        /// <summary>
        /// Veröffentlicht ein beliebiges von MarshalByRef abgeleitetes Objekt über einen TCP-Kanal für entfernten Zugriff.
        ///
        /// Bei aktivierung der Sicherheit über den Parameter "enableSecurity", wird die Kommunikation 
        /// vom Absender signiert, um die Integrität sicherzustellen und zusätzlich verschlüsselt. 
        /// Über den Parameter "impersonate" kann Impersonierung eingeschaltet werden. Bei eingeschalteter
        /// Impersonierung, wird der Remoteaufruf im Kontext des Client-Benutzers ausgeführt.
        /// </summary>
        /// <remarks>
        /// Der TCP-Kanal wird automatisch konfiguriert und registriert. Die Kanal-Registrierung bleibt 
        /// über diesen Prozeduraufruf hinaus gültig. Wenn sie die selbe TCP-Anschlussnummer mehrmals an
        /// diese Methode übergeben, wird der bestehene Kanal verwendet. Die Sicherheitskonfiguration des 
        /// ersten Aufrufs ist deshalb entscheidend. Wenn sie für spätere Aufrufe andere Werte für die
        /// Parameter "enableSecurity" oder "impersonate" angeben, werden diese nicht berücksichtigt, 
        /// da der bestehende Kanal verwendet wird!
        /// </remarks>
        /// <param name="instance">Zu veröffentlichendes Objekt</param>
        /// <param name="publicName">Öffentlicher Name (Über diesen Namen greifen Clients entfernt auf das Objekt zu!)</param>
        /// <param name="tcpPort">TCP-Anschlussnummer</param>
        /// <param name="enableSecurity">Schalter für Sicherheit</param>
        /// <param name="impersonate">Schalter für Impersonierung</param>
        public static void PublishObjectOverTCP(MarshalByRefObject instance,string publicName,int tcpPort, bool enableSecurity,bool impersonate)
        {
            // Kanal einrichten (Falls dies noch nicht geschehen ist!)
            SetupServerChannel(tcpPort, enableSecurity, impersonate);

            // Objektinstanz über den TCP-Kanal für entfernten Zugriff veröffentlichen
            System.Runtime.Remoting.RemotingServices.Marshal(instance, publicName);
        }
        public void Exceptionprocess(MarshalByRefObject inst, IMessage msg, Exception exception)
        {
            // Extract Action
            ONAction lAction = inst as ONAction;

            // Pop the OID from Class Stack
            if (mInStack)
                lAction.OnContext.TransactionStack.Pop();
        }
Example #11
0
		public bool Register (MarshalByRefObject obj)
		{
			if (registered_objects.ContainsKey (obj)) return false;
			ILease lease = obj.GetLifetimeService () as ILease;
			if (lease == null) return false;
			lease.Register (this);
			registered_objects.Add (obj,obj);
			return true;
		}
        public MarshallableProxy(Type type1, MarshalByRefObject targetObject, InvocationDelegate invoker)
            : base(type1)
        {
            ProxyTargetTyped = targetObject;
            InvocationHandler = invoker;

            ObjRef myObjRef = RemotingServices.Marshal(ProxyTargetTyped);
            URI = myObjRef.URI;
        }
		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));
			}
		}
 protected void AttachServer(MarshalByRefObject s)
 {
     object transparentProxy = this.GetTransparentProxy();
     if (transparentProxy != null)
     {
         RemotingServices.ResetInterfaceCache(transparentProxy);
     }
     this.AttachServerHelper(s);
 }
        public void Exceptionprocess(MarshalByRefObject inst, IMessage msg, Exception exception)
        {
            // Extract Server
            ONServer lServer = inst as ONServer;

            // Pop the OID from Class Stack
            if (mInStack)
                lServer.OnContext.OperationStack.Pop();
        }
 internal void AttachServerHelper(MarshalByRefObject s)
 {
     if ((s == null) || (this._serverObject != null))
     {
         throw new ArgumentException(Environment.GetResourceString("ArgumentNull_Generic"), "s");
     }
     this._serverObject = s;
     this.SetupIdentity();
 }
 internal Lease(TimeSpan initialLeaseTime, TimeSpan renewOnCallTime, TimeSpan sponsorshipTimeout, MarshalByRefObject managedObject)
 {
     this.renewOnCallTime = renewOnCallTime;
     this.sponsorshipTimeout = sponsorshipTimeout;
     this.initialLeaseTime = initialLeaseTime;
     this.managedObject = managedObject;
     this.leaseManager = LeaseManager.GetLeaseManager();
     this.sponsorTable = new Hashtable(10);
     this.state = LeaseState.Initial;
 }
 internal static ILease GetLeaseInitial(MarshalByRefObject obj)
 {
     ILease lease = null;
     lease = LeaseManager.GetLeaseManager(LeaseManagerPollTime).GetLease(obj);
     if (lease == null)
     {
         lease = CreateLease(obj);
     }
     return lease;
 }
Example #19
0
		public void SetUp ()
		{
			if (!SecurityManager.SecurityEnabled)
				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");

			// we do this in SetUp because we want the security 
			// stack to be "normal/empty" so each unit test can 
			// mess with it as it wishes
			mbro = (MarshalByRefObject) AppDomain.CurrentDomain;
		}
 internal ILease GetLease(MarshalByRefObject obj)
 {
     bool fServer = true;
     Identity identity = MarshalByRefObject.GetIdentity(obj, out fServer);
     if (identity == null)
     {
         return null;
     }
     return identity.Lease;
 }
Example #21
0
 /// <summary>
 /// Parameteraize Constructor.
 /// </summary>
 /// <param name="type"></param>
 /// <param name="url"></param>
 public DiaSoftProxy(Type type, string url)
     : base(type)
 {
     _serverType = type;
     BuildTcpURL(url);
     BuildHttpURL(url);
     _targetTcp = (MarshalByRefObject)Activator.GetObject(type, _TcpUrl);
     _targetHttp = (MarshalByRefObject)Activator.GetObject(type, _HttpUrl);
     _messageSinks = GetMessageSinks();
 }
        public static IConstructionReturnMessage CreateConstructionReturnMessage(IConstructionCallMessage ctorMsg, MarshalByRefObject retObj) 
        {
            IConstructionReturnMessage ctorRetMsg = null; 

            // Create the return message
            ctorRetMsg = new ConstructorReturnMessage(retObj, null, 0, null, ctorMsg);
 
            // NOTE: WE ALLOW ONLY DEFAULT CTORs on SERVICEDCOMPONENTS
 
            return ctorRetMsg; 
        }
Example #23
0
        [System.Security.SecurityCritical]  // auto-generated 
        public void Unregister(MarshalByRefObject obj) 
        {
            BCLDebug.Trace("REMOTE", "ClientSponsor Unregister "+obj); 

            ILease lease = null;
            lock(sponsorTable)
            { 
                lease = (ILease)sponsorTable[obj];
            } 
            if (lease != null) 
                lease.Unregister(this);
        } 
        public void Start(string bootstrapperName, MarshalByRefObject remoteListener)
        {
            var domainSetup = AppDomain.CurrentDomain.SetupInformation;
            System.Environment.CurrentDirectory = domainSetup.ApplicationBase;
             
            // TODO -- need to handle exceptions gracefully here
            EventAggregator.Start((IRemoteListener) remoteListener);

            var application = new BottleServiceApplication();
            _runner = application.Bootstrap(bootstrapperName);
            _runner.Start();
        }
Example #25
0
        /// <summary>
        /// Parameteraize Constructor.
        /// </summary>
        /// <param name="type"></param>
        /// <param name="target"></param>
        public DiaSoftProxy(Type type, MarshalByRefObject target)
            : base(type)
        {
            _serverType = type;
            BuildTcpURL(RemotingServices.GetObjectUri((MarshalByRefObject)target));
            BuildHttpURL(RemotingServices.GetObjectUri((MarshalByRefObject)target));
            _targetTcp = target;
            _targetHttp = (MarshalByRefObject)Activator.GetObject(type, _HttpUrl);

            objRef = RemotingServices.Marshal(target);
            _messageSinks = GetMessageSinks();
        }
        public virtual void PostProcess(IMethodCallMessage callMsg, ref IMethodReturnMessage retMsg, MarshalByRefObject target)
        {
            Exception e = retMsg.Exception;
            if (e != null)
            {
                this.HandleException(e);

                Exception newException = this.GetNewException(e);
                if (!object.ReferenceEquals(e, newException))
                    retMsg = new ReturnMessage(newException, callMsg);
            }
        }
 public void Unregister(MarshalByRefObject obj)
 {
     ILease lease = null;
     lock (this.sponsorTable)
     {
         lease = (ILease) this.sponsorTable[obj];
     }
     if (lease != null)
     {
         lease.Unregister(this);
     }
 }
        /// <inheritdoc />
        public void RegisterService(string serviceName, MarshalByRefObject component)
        {
            if (serviceName == null)
                throw new ArgumentNullException("serviceName");
            if (component == null)
                throw new ArgumentNullException("component");

            RemotingServices.Marshal(component, serviceName);

            lock (remoteComponents)
                remoteComponents.Add(component);
        }
        public void Postprocess(MarshalByRefObject inst, IMessage msg, ref IMessage msgReturn)
        {
            IMethodCallMessage lMsgIn = msg as IMethodCallMessage;
            IMethodReturnMessage lMsgOut = msgReturn as IMethodReturnMessage;

            // Extract Action
            ONAction lAction = inst as ONAction;

            if ((lAction.Instance != null) && (lAction.Instance.ModifiedInTransaction))
            {
                foreach (string lActiveFacet in lAction.Instance.LeafActiveFacets())
                {
                    ONInstance lInstanceToModify;
                    if(lActiveFacet == lAction.ClassName)
                        lInstanceToModify = lAction.Instance;
                    else
                        lInstanceToModify = lAction.Instance.GetFacet(lActiveFacet);
                    // Update Instance
                    if (lInstanceToModify.ModifiedInTransaction)
                    {
                        ONData lData = ONContext.GetComponent_Data(lInstanceToModify.ClassName, lInstanceToModify.OnContext);
                        lData.UpdateEdited(lInstanceToModify);
                    }
                }
                foreach (ONInstance lInstance in lAction.Instance.GetFacets())
                    if(lInstance != null)
                        lInstance.ModifiedInTransaction = false;

                lAction.Instance.ModifiedInTransaction = false;
            }

            // Calculate OutputArgumets
            object[] lArgs = lMsgOut.Args;
            mServiceCacheItem.InvoqueOutboundArguments(lAction, lArgs);

            // Pop the OID from Class Stack
            lAction.OnContext.TransactionStack.Pop();
            mInStack = false;

            // Restoing the old context of the This instance
            if (mThisOnContext != null)
                lAction.Instance.OnContext = mThisOnContext;

            msgReturn = new ReturnMessage(lMsgOut.ReturnValue, lArgs, lArgs.Length, lMsgOut.LogicalCallContext, lMsgIn);
            if (lAction.OnContext.TransactionStack.Count == 0)
            {
                // Check triggers
                lAction.OnContext.CheckTriggers();

                // Check integrity constraints
                lAction.OnContext.CheckIntegrityConstraints();
            }
        }
 public RealProxySample(Type myType, object actual)
     : base(myType)
 {
     // RealProxy uses the Type to generate a transparent proxy.
     //myMarshalByRefObject = (MarshalByRefObject)Activator.CreateInstance((myType));
     myMarshalByRefObject = (MarshalByRefObject)actual;
     // Get 'ObjRef', for transmission serialization between application domains.
     ObjRef myObjRef = RemotingServices.Marshal(myMarshalByRefObject);
     // Get the 'URI' property of 'ObjRef' and store it.
     myURIString = myObjRef.URI;
     Console.WriteLine("URI :{0}", myObjRef.URI);
 }
Example #31
0
 static int InitializeLifetimeService(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         System.MarshalByRefObject obj = (System.MarshalByRefObject)ToLua.CheckObject(L, 1, typeof(System.MarshalByRefObject));
         object o = obj.InitializeLifetimeService();
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #32
0
 static int CreateObjRef(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         System.MarshalByRefObject obj = (System.MarshalByRefObject)ToLua.CheckObject(L, 1, typeof(System.MarshalByRefObject));
         System.Type arg0 = (System.Type)ToLua.CheckObject(L, 2, typeof(System.Type));
         System.Runtime.Remoting.ObjRef o = obj.CreateObjRef(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #33
0
 public void write_Object(System.MarshalByRefObject val)
 {
     Marshal(ReflectionHelper.MarshalByRefObjectType,
             AttributeExtCollection.EmptyCollection,
             val, m_cdrOut);
 }
Example #34
0
 System.Runtime.Remoting.Messaging.IMessageSink System.Runtime.Remoting.Contexts.IContributeObjectSink.GetObjectSink(System.MarshalByRefObject obj, System.Runtime.Remoting.Messaging.IMessageSink nextSink)
 {
     return(new MyMessageSink(nextSink));
 }
Example #35
0
 public abstract void CopyFile(string sourcePath, string destinationPath, RequestImpl requestImpl);
Example #36
0
 public abstract void SetEnvironmentVariable(string variable, string value, int context, RequestImpl requestImpl);
Example #37
0
 public abstract object SelectProviders(string providerName, IRequestObject requestObject);
Example #38
0
 /* Synced/Generated code =================================================== */
 public abstract void DownloadFile(Uri remoteLocation, string localFilename, RequestImpl requestImpl);
Example #39
0
 public abstract bool IsSupportedArchive(string localFilename, RequestImpl requestImpl);
Example #40
0
 public abstract bool IsSignedAndTrusted(string filename, RequestImpl requestImpl);
Example #41
0
 public abstract bool Install(string fileName, string additionalArgs, RequestImpl requestImpl);
Example #42
0
 public abstract string GetKnownFolder(string knownFolder, RequestImpl requestImpl);
Example #43
0
 public abstract void DeleteFile(string filename, RequestImpl requestImpl);
Example #44
0
 public abstract void CreateFolder(string folder, RequestImpl requestImpl);
Example #45
0
 public abstract void Delete(string path, RequestImpl requestImpl);
Example #46
0
 public abstract void AddPinnedItemToTaskbar(string item, RequestImpl requestImpl);
Example #47
0
 public abstract IEnumerable <string> UnpackArchive(string localFilename, string destinationFolder, RequestImpl requestImpl);
Example #48
0
 public abstract void RemovePinnedItemFromTaskbar(string item, RequestImpl requestImpl);
Example #49
0
 /// <summary>
 /// Função que realiza a Intercepção do metodo que tem este atributo
 /// </summary>
 /// <param name="obj"></param>
 /// <param name="nextSink"></param>
 /// <returns></returns>
 public IMessageSink GetObjectSink(System.MarshalByRefObject obj, IMessageSink nextSink)
 {
     return(new TransactionMessageSink(nextSink));
 }
Example #50
0
 public abstract bool IsElevated(RequestImpl requestImpl);
Example #51
0
 public abstract bool RequirePackageProvider(string requestor, string packageProviderName, string minimumVersion, IRequestObject requestObject);
Example #52
0
 internal static extern IntPtr GetComIUnknown(MarshalByRefObject o);
Example #53
0
 public abstract bool ExecuteElevatedAction(string provider, string payload, IRequestObject requestObject);
Example #54
0
        internal static System.Runtime.Remoting.Identity GetIdentity(MarshalByRefObject obj)
        {
            bool flag;

            return(GetIdentity(obj, out flag));
        }
Example #55
0
 public abstract bool ExecuteElevatedAction(string provider, string payload, RequestImpl requestImpl);
Example #56
0
 public abstract void RemoveEnvironmentVariable(string variable, string context, RequestImpl requestImpl);
Example #57
0
        protected MarshalByRefObject MemberwiseClone(bool cloneIdentity)
        {
            MarshalByRefObject mbr = (MarshalByRefObject)base.MemberwiseClone();

            return(mbr);
        }
        // Token: 0x06000FF4 RID: 4084 RVA: 0x000309B4 File Offset: 0x0002EBB4
        internal static Identity GetIdentity(MarshalByRefObject obj)
        {
            bool flag;

            return(MarshalByRefObject.GetIdentity(obj, out flag));
        }
Example #59
0
 public abstract void CreateShortcutLink(string linkPath, string targetPath, string description, string workingDirectory, string arguments, RequestImpl requestImpl);
Example #60
0
 /// <summary>
 ///     Returns a reference to the PackageManagementService API
 ///     The consumer of this function should either use this as a dynamic object
 ///     Or DuckType it to an interface that resembles IPacakgeManagementService
 /// </summary>
 /// <param name="requestImpl"></param>
 /// <returns></returns>
 public abstract object GetPackageManagementService(RequestImpl requestImpl);