Exemplo n.º 1
0
        /// <summary>
        /// Creates a Manager.
        /// </summary>
        private Manager()
        {
            // configure
            SimiasLogManager.Configure(Store.StorePath);

            // Get an event subscriber to handle shutdown events.
            subscriber              = new DefaultSubscriber();
            subscriber.SimiasEvent += new SimiasEventHandler(OnSimiasEvent);

            lock (this)
            {
                // Add the Change Log Service and Local Domain Service by default.
                serviceList.Add(new ThreadServiceCtl("Simias Change Log Service", "SimiasLib", "Simias.Storage.ChangeLog"));
                serviceList.Add(new ThreadServiceCtl("Simias Local Domain Provider", "SimiasLib", "Simias.LocalProvider"));

                // Check if there is an overriding modules directory in the simias data area.
                string[] confFileList = null;
                string   modulesDir   = Path.Combine(Store.StorePath, ModulesDirectory);
                if (Directory.Exists(modulesDir))
                {
                    confFileList = Directory.GetFiles(modulesDir, ServiceConfigFiles);
                }

                // Check if there are any service configuration files.
                if ((confFileList == null) || (confFileList.Length == 0))
                {
                    // There is no overriding directory, use the default one.
                    modulesDir   = SimiasSetup.modulesdir;
                    confFileList = Directory.GetFiles(modulesDir, ServiceConfigFiles);
                }

                // Get all of the configuration files from the modules directory.
                foreach (string confFile in confFileList)
                {
                    string      assembly = Path.GetFileNameWithoutExtension(confFile);
                    XmlDocument confDoc  = new XmlDocument();
                    confDoc.Load(confFile);

                    if (String.Compare(assembly, LdapModuleName) == 0)
                    {
                        ldapserviceenabled = true;
                    }
                    if (String.Compare(assembly, UserMovementModuleName) == 0)
                    {
                        usermoveserviceenabled = true;
                    }

                    // Get the XmlElement for the Services.
                    foreach (XmlElement serviceNode in confDoc.DocumentElement)
                    {
                        serviceList.Add(new ThreadServiceCtl(assembly, serviceNode));
                    }
                }
            }

            // reset the log4net configurations after a lock on Flaim was obtained
            SimiasLogManager.ResetConfiguration();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public BaseProcessService()
        {
            string confPath = Environment.GetCommandLineArgs()[1];

            if (confPath == null || confPath.Length == 0 || !Directory.Exists(confPath))
            {
                Console.WriteLine("Usage: (service) (Configuration Path)");
                throw new ApplicationException("Invalid Service Arguments");
            }

            // configure logging
            SimiasLogManager.Configure(Store.StorePath);
        }