Exemplo n.º 1
0
        /// <summary>
        /// Loads a specified Petra Module Instantiator DLL into a Client's AppDomain,
        /// initialises the main Class (an Instantiator) and remotes the resulting
        /// Instantiator Object.
        ///
        /// </summary>
        /// <param name="AClientID"></param>
        /// <param name="AAssemblyDLLName">name of the dll that contains ARemoteType</param>
        /// <param name="ARemoteType">name of the class that should be loaded</param>
        /// <param name="APetraModuleInstantiatorRemotingURL">The .NET Remoting URL which the
        /// Client needs to make calls to the Instantiator Object.
        /// </param>
        public void LoadPetraModuleAssembly(String AClientID,
                                            String AAssemblyDLLName,
                                            string ARemoteType,
                                            out String APetraModuleInstantiatorRemotingURL)
        {
            ICrossDomainService RemoteObject;

            FRemoteLoader.LoadPetraModuleAssembly(
                AAssemblyDLLName,
                ARemoteType,
                out APetraModuleInstantiatorRemotingURL,
                out RemoteObject);

            // register the remote url at the CrossDomainMarshaller
            TCrossDomainMarshaller.AddService(AClientID, APetraModuleInstantiatorRemotingURL, RemoteObject);

            if (TLogging.DL >= 10)
            {
                TLogging.Log(
                    "Loaded Assemblies in AppDomain " + AppDomain.CurrentDomain.FriendlyName +
                    ": (after instantiation of " + ARemoteType + ")",
                    TLoggingType.ToConsole | TLoggingType.ToLogfile);

                foreach (Assembly tmpAssembly in AppDomain.CurrentDomain.GetAssemblies())
                {
                    TLogging.Log(tmpAssembly.FullName, TLoggingType.ToConsole | TLoggingType.ToLogfile);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Loads the ClientDomain DLL into the Client's AppDomain, instantiates the
        /// main Class (TClientDomainManager) and initialises the AppDomain by calling
        /// several functions of that Class.
        ///
        /// </summary>
        /// <param name="AClientID">ClientID as assigned by the ClientManager</param>
        /// <param name="AClientServerConnectionType">Tells in which way the Client connected
        /// to the PetraServer</param>
        /// <param name="AClientManagerRef">A reference to the ClientManager object
        /// (Note: .NET Remoting will be working behind the scenes since calls to
        /// this Object will cross AppDomains!)</param>
        /// <param name="ASystemDefaultsCacheRef">A reference to the SystemDefaultsCache object
        /// (Note: .NET Remoting will be working behind the scenes since calls to
        /// this Object will cross AppDomains!)</param>
        /// <param name="ACacheableTablesManagerRef"></param>
        /// <param name="AUserInfo">An instantiated PetraPrincipal Object, containing User
        /// information</param>
        /// <param name="ARemotingURLPollClientTasks">the .NET Remoting URL of the
        /// TPollClientTasks Class which the Client needs to calls to retrieve
        /// ClientTasks.</param>
        /// <returns>void</returns>
        public void LoadDomainManagerAssembly(Int32 AClientID,
                                              TClientServerConnectionType AClientServerConnectionType,
                                              TClientManagerCallForwarder AClientManagerRef,
                                              object ASystemDefaultsCacheRef,
                                              object ACacheableTablesManagerRef,
                                              IPrincipal AUserInfo,
                                              out String ARemotingURLPollClientTasks)
        {
            ICrossDomainService RemoteObject;

            FRemoteLoader.LoadDomainManagerAssembly(AClientID,
                                                    AClientServerConnectionType,
                                                    AClientManagerRef,
                                                    ASystemDefaultsCacheRef,
                                                    ACacheableTablesManagerRef,
                                                    AUserInfo,
                                                    TSrvSetting.ServerSettings,
                                                    out ARemotingURLPollClientTasks,
                                                    out RemoteObject);

            // register the remote url at the CrossDomainMarshaller
            TCrossDomainMarshaller.AddService(AClientID.ToString(), ARemotingURLPollClientTasks, RemoteObject);

            // Load the CallForwinding DLL into the Client's AppDomain
            FRemoteLoader.LoadCallForwardingAssembly();

            // IMPORTANT: If the following code is uncommented, the ClientDomain DLL that is loaded only in the Client's AppDomain might get loaded into the Default AppDomain  that's what we don't want!!!
            // Use this therefore only to find out what DLL's are loaded in the Client's AppDomain!!!!!!
            if (TLogging.DL >= 10)
            {
                TLogging.Log(
                    "Loaded Assemblies in AppDomain " + AppDomain.CurrentDomain.FriendlyName + ": (after instantiation of TClientDomainManager)",
                    TLoggingType.ToConsole | TLoggingType.ToLogfile);

                foreach (Assembly tmpAssembly in AppDomain.CurrentDomain.GetAssemblies())
                {
                    TLogging.Log(tmpAssembly.FullName, TLoggingType.ToConsole | TLoggingType.ToLogfile);
                }
            }
        }