Esempio n. 1
0
        /// <summary>
        /// Sets up .NET Remoting Lifetime Services and TCP Channel for this AppDomain.
        ///
        /// @comment WARNING: If you need to change the parameters of the Constructor,
        /// you also need to change the parameters in the .NET Reflection call in
        /// TClientAppDomainConnection!
        ///
        /// </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>
        public TClientDomainManager(String AClientID,
                                    TClientServerConnectionType AClientServerConnectionType,
                                    TClientManagerCallForwarder AClientManagerRef,
                                    TSystemDefaultsCache ASystemDefaultsCacheRef,
                                    TCacheableTablesManager ACacheableTablesManagerRef,
                                    IPrincipal AUserInfo) :
            base(AClientID,
                 AClientServerConnectionType, AClientManagerRef,
                 ((TPetraPrincipal)AUserInfo).UserID)
        {
            TCacheableTablesManager.GCacheableTablesManager = ACacheableTablesManagerRef;
            TSystemDefaultsCache.GSystemDefaultsCache       = ASystemDefaultsCacheRef;

            TLanguageCulture.Init();

            UserInfo.GUserInfo     = (TPetraPrincipal)AUserInfo;
            DomainManager.GSiteKey = TSystemDefaultsCache.GSystemDefaultsCache.GetInt64Default(SharedConstants.SYSDEFAULT_SITEKEY);

            if (DomainManager.GSiteKey <= 0)
            {
                // this is for connecting to legacy database format
                // we cannot add SiteKey to SystemDefaults, because Petra 2.3 would have a conflict since it adds it on startup already to the in-memory defaults, but not to the database
                // see also https://sourceforge.net/apps/mantisbt/openpetraorg/view.php?id=114
                DomainManager.GSiteKey = TSystemDefaultsCache.GSystemDefaultsCache.GetInt64Default("SiteKeyPetra2");
            }

            if (DomainManager.GSiteKey <= 0)
            {
                // this can happen either with a legacy Petra 2.x database or with a fresh OpenPetra database without any ledger yet
                Console.WriteLine("there is no SiteKey or SiteKeyPetra2 record in s_system_defaults");
                DomainManager.GSiteKey = 99000000;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Sets up .NET Remoting Lifetime Services and TCP Channel for this AppDomain.
        ///
        /// @comment WARNING: If you need to change the parameters of the Constructor,
        /// you also need to change the parameters in the .NET Reflection call in
        /// TClientAppDomainConnection!
        ///
        /// </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>
        public TClientDomainManager(String AClientID,
            TClientServerConnectionType AClientServerConnectionType,
            TClientManagerCallForwarder AClientManagerRef,
            TSystemDefaultsCache ASystemDefaultsCacheRef,
            TCacheableTablesManager ACacheableTablesManagerRef,
            IPrincipal AUserInfo) :
            base(AClientID,
                AClientServerConnectionType, AClientManagerRef,
                ((TPetraPrincipal)AUserInfo).UserID)
        {
            TCacheableTablesManager.GCacheableTablesManager = ACacheableTablesManagerRef;
            TSystemDefaultsCache.GSystemDefaultsCache = ASystemDefaultsCacheRef;

            TLanguageCulture.Init();

            UserInfo.GUserInfo = (TPetraPrincipal)AUserInfo;
            DomainManager.GSiteKey = TSystemDefaultsCache.GSystemDefaultsCache.GetInt64Default(SharedConstants.SYSDEFAULT_SITEKEY);

            if (DomainManager.GSiteKey <= 0)
            {
                // this is for connecting to legacy database format
                // we cannot add SiteKey to SystemDefaults, because Petra 2.3 would have a conflict since it adds it on startup already to the in-memory defaults, but not to the database
                // see also https://sourceforge.net/apps/mantisbt/openpetraorg/view.php?id=114
                DomainManager.GSiteKey = TSystemDefaultsCache.GSystemDefaultsCache.GetInt64Default("SiteKeyPetra2");
            }

            if (DomainManager.GSiteKey <= 0)
            {
                // this can happen either with a legacy Petra 2.x database or with a fresh OpenPetra database without any ledger yet
                Console.WriteLine("there is no SiteKey or SiteKeyPetra2 record in s_system_defaults");
                DomainManager.GSiteKey = 99000000;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Initialises Logging and parses Server settings from different sources.
        /// </summary>
        public TServerManager() : base()
        {
            // Create SystemDefaults Cache
            FSystemDefaultsCache = new TSystemDefaultsCache();

            TCacheableTablesManager.InitializeUnit();
            TCacheableTablesManager.GCacheableTablesManager = new TCacheableTablesManager(new TDelegateSendClientTask(TClientManager.QueueClientTask));

            Assembly SysManAssembly = Assembly.Load("Ict.Petra.Server.lib.MSysMan");
            Type ImportExportType = SysManAssembly.GetType("Ict.Petra.Server.MSysMan.ImportExport.TImportExportManager");
            FImportExportManager = (IImportExportManager)Activator.CreateInstance(ImportExportType,
                (BindingFlags.Public | BindingFlags.Instance | BindingFlags.InvokeMethod),
                null,
                null,
                null);

            Assembly DBUpgradesAssembly = Assembly.Load("Ict.Petra.Server.lib.MSysMan.DBUpgrades");
            Type DatabaseUpgradeType = DBUpgradesAssembly.GetType("Ict.Petra.Server.MSysMan.DBUpgrades.TDBUpgrades");
            FDBUpgrades = (IDBUpgrades)Activator.CreateInstance(DatabaseUpgradeType,
                (BindingFlags.Public | BindingFlags.Instance | BindingFlags.InvokeMethod),
                null,
                null,
                null);

            Type UserManagement = SysManAssembly.GetType("Ict.Petra.Server.MSysMan.Maintenance.UserManagement.TUserManager");
            FUserManager = (IUserManager)Activator.CreateInstance(UserManagement,
                (BindingFlags.Public | BindingFlags.Instance | BindingFlags.InvokeMethod),
                null,
                null,
                null);

            TClientManager.InitializeStaticVariables(FSystemDefaultsCache,
                FUserManager,
                new TErrorLog(),
                new TMaintenanceLogonMessage());

            TTimedProcessing.DailyStartTime24Hrs = TAppSettingsManager.GetValue("Server.Processing.DailyStartTime24Hrs", "00:30");

            if (TAppSettingsManager.GetBoolean("Server.Processing.PartnerReminders.Enabled", true))
            {
                Assembly PartnerProcessingAssembly = Assembly.Load("Ict.Petra.Server.lib.MPartner.processing");
                Type PartnerReminderClass = PartnerProcessingAssembly.GetType("Ict.Petra.Server.MPartner.Processing.TProcessPartnerReminders");
                TTimedProcessing.AddProcessingJob(
                    "TProcessPartnerReminders",
                    (TTimedProcessing.TProcessDelegate)Delegate.CreateDelegate(
                        typeof(TTimedProcessing.TProcessDelegate),
                        PartnerReminderClass,
                        "Process"));
            }

            if (TAppSettingsManager.GetBoolean("Server.Processing.AutomatedIntranetExport.Enabled", false))
            {
                Assembly CommonProcessingAssembly = Assembly.Load("Ict.Petra.Server.lib.MCommon.processing");
                Type IntranetExportClass = CommonProcessingAssembly.GetType("Ict.Petra.Server.MCommon.Processing.TProcessAutomatedIntranetExport");
                TTimedProcessing.AddProcessingJob(
                    "TProcessAutomatedIntranetExport",
                    (TTimedProcessing.TProcessDelegate)Delegate.CreateDelegate(
                        typeof(TTimedProcessing.TProcessDelegate),
                        IntranetExportClass,
                        "Process"));
            }

            if (TAppSettingsManager.GetBoolean("Server.Processing.DataChecks.Enabled", false))
            {
                Assembly CommonProcessingAssembly = Assembly.Load("Ict.Petra.Server.lib.MCommon.processing");
                Type ProcessDataChecksClass = CommonProcessingAssembly.GetType("Ict.Petra.Server.MCommon.Processing.TProcessDataChecks");
                TTimedProcessing.AddProcessingJob(
                    "TProcessDataChecks",
                    (TTimedProcessing.TProcessDelegate)Delegate.CreateDelegate(
                        typeof(TTimedProcessing.TProcessDelegate),
                        ProcessDataChecksClass,
                        "Process"));
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Initialises Logging and parses Server settings from different sources.
        /// </summary>
        public TServerManager() : base()
        {
            // Create SystemDefaults Cache
            FSystemDefaultsCache = new TSystemDefaultsCache();

            TCacheableTablesManager.InitializeUnit();
            TCacheableTablesManager.GCacheableTablesManager = new TCacheableTablesManager(new TDelegateSendClientTask(TClientManager.QueueClientTask));

            Assembly SysManAssembly   = Assembly.Load("Ict.Petra.Server.lib.MSysMan");
            Type     ImportExportType = SysManAssembly.GetType("Ict.Petra.Server.MSysMan.ImportExport.TImportExportManager");

            FImportExportManager = (IImportExportManager)Activator.CreateInstance(ImportExportType,
                                                                                  (BindingFlags.Public | BindingFlags.Instance | BindingFlags.InvokeMethod),
                                                                                  null,
                                                                                  null,
                                                                                  null);

            Assembly DBUpgradesAssembly  = Assembly.Load("Ict.Petra.Server.lib.MSysMan.DBUpgrades");
            Type     DatabaseUpgradeType = DBUpgradesAssembly.GetType("Ict.Petra.Server.MSysMan.DBUpgrades.TDBUpgrades");

            FDBUpgrades = (IDBUpgrades)Activator.CreateInstance(DatabaseUpgradeType,
                                                                (BindingFlags.Public | BindingFlags.Instance | BindingFlags.InvokeMethod),
                                                                null,
                                                                null,
                                                                null);

            Type UserManagement = SysManAssembly.GetType("Ict.Petra.Server.MSysMan.Maintenance.UserManagement.TUserManager");

            FUserManager = (IUserManager)Activator.CreateInstance(UserManagement,
                                                                  (BindingFlags.Public | BindingFlags.Instance | BindingFlags.InvokeMethod),
                                                                  null,
                                                                  null,
                                                                  null);

            TClientManager.InitializeStaticVariables(FSystemDefaultsCache,
                                                     FUserManager,
                                                     new TErrorLog(),
                                                     new TMaintenanceLogonMessage());

            TTimedProcessing.DailyStartTime24Hrs = TAppSettingsManager.GetValue("Server.Processing.DailyStartTime24Hrs", "00:30");

            if (TAppSettingsManager.GetBoolean("Server.Processing.PartnerReminders.Enabled", true))
            {
                Assembly PartnerProcessingAssembly = Assembly.Load("Ict.Petra.Server.lib.MPartner.processing");
                Type     PartnerReminderClass      = PartnerProcessingAssembly.GetType("Ict.Petra.Server.MPartner.Processing.TProcessPartnerReminders");
                TTimedProcessing.AddProcessingJob(
                    "TProcessPartnerReminders",
                    (TTimedProcessing.TProcessDelegate)Delegate.CreateDelegate(
                        typeof(TTimedProcessing.TProcessDelegate),
                        PartnerReminderClass,
                        "Process"));
            }

            if (TAppSettingsManager.GetBoolean("Server.Processing.AutomatedIntranetExport.Enabled", false))
            {
                Assembly CommonProcessingAssembly = Assembly.Load("Ict.Petra.Server.lib.MCommon.processing");
                Type     IntranetExportClass      = CommonProcessingAssembly.GetType("Ict.Petra.Server.MCommon.Processing.TProcessAutomatedIntranetExport");
                TTimedProcessing.AddProcessingJob(
                    "TProcessAutomatedIntranetExport",
                    (TTimedProcessing.TProcessDelegate)Delegate.CreateDelegate(
                        typeof(TTimedProcessing.TProcessDelegate),
                        IntranetExportClass,
                        "Process"));
            }

            if (TAppSettingsManager.GetBoolean("Server.Processing.DataChecks.Enabled", false))
            {
                Assembly CommonProcessingAssembly = Assembly.Load("Ict.Petra.Server.lib.MCommon.processing");
                Type     ProcessDataChecksClass   = CommonProcessingAssembly.GetType("Ict.Petra.Server.MCommon.Processing.TProcessDataChecks");
                TTimedProcessing.AddProcessingJob(
                    "TProcessDataChecks",
                    (TTimedProcessing.TProcessDelegate)Delegate.CreateDelegate(
                        typeof(TTimedProcessing.TProcessDelegate),
                        ProcessDataChecksClass,
                        "Process"));
            }
        }