public HGCommunicationsStandalone(
     ConfigSettings configSettings,                          
     NetworkServersInfo serversInfo,
     BaseHttpServer httpServer,
     HGGridServices gridService, 
     LibraryRootFolder libraryRootFolder, 
     bool dumpAssetsToFile)
     : base(serversInfo, libraryRootFolder)
 {           
     LocalUserServices localUserService =
         new LocalUserServices(
             serversInfo.DefaultHomeLocX, serversInfo.DefaultHomeLocY, this);
     localUserService.AddPlugin(configSettings.StandaloneUserPlugin, configSettings.StandaloneUserSource); 
     
     HGUserServices hgUserService = new HGUserServices(this, localUserService);
     // This plugin arrangement could eventually be configurable rather than hardcoded here.
     hgUserService.AddPlugin(new TemporaryUserProfilePlugin());
     hgUserService.AddPlugin(new HGUserDataPlugin(this, hgUserService));
     
     m_userService = hgUserService;            
     m_userAdminService = hgUserService;            
     m_avatarService = hgUserService;
     m_messageService = hgUserService;
     
     gridService.UserProfileCache = m_userProfileCacheService;
     m_gridService = gridService;                        
 }
Ejemplo n.º 2
0
 public HGGridServicesGridMode(NetworkServersInfo servers_info,
     SceneManager sman, UserProfileCacheService userv)
     : base(servers_info, sman)
 {
     m_remoteBackend = new OGS1GridServices(servers_info);
     m_userProfileCache = userv;
 }
Ejemplo n.º 3
0
        public CommunicationsOGS1(
            NetworkServersInfo serversInfo,
            LibraryRootFolder libraryRootFolder)
            : base(serversInfo, libraryRootFolder)
        {
            OGS1GridServices gridInterComms = new OGS1GridServices(serversInfo);
            m_gridService = gridInterComms;

            if (serversInfo.secureInventoryServer)
            {
                OGS1SecureInventoryService invService = new OGS1SecureInventoryService(serversInfo.InventoryURL);
                AddSecureInventoryService(invService);
                m_defaultInventoryHost = invService.Host;
            }
            else
            {
                OGS1InventoryService invService = new OGS1InventoryService(serversInfo.InventoryURL);
                AddInventoryService(invService);
                m_defaultInventoryHost = invService.Host;
            }

            // This plugin arrangement could eventually be configurable rather than hardcoded here.           
            OGS1UserServices userServices = new OGS1UserServices(this);
            userServices.AddPlugin(new TemporaryUserProfilePlugin());
            userServices.AddPlugin(new OGS1UserDataPlugin(this));
            
            m_userService = userServices;
            m_messageService = userServices;
            m_avatarService = (IAvatarService)m_userService;
        }
Ejemplo n.º 4
0
        public CommunicationsLocal(
            ConfigSettings configSettings,                                   
            NetworkServersInfo serversInfo,
            BaseHttpServer httpServer,
            IAssetCache assetCache,
            LibraryRootFolder libraryRootFolder) 
            : base(serversInfo, httpServer, assetCache, libraryRootFolder)
        {
            PluginLoader<IInventoryStoragePlugin> loader = new PluginLoader<IInventoryStoragePlugin>();
            loader.Add("/OpenSim/InventoryStorage", new PluginProviderFilter(configSettings.InventoryPlugin));
            loader.Load();

            loader.Plugin.Initialize(configSettings);
            

            LocalUserServices lus 
                = new LocalUserServices(
                    serversInfo.DefaultHomeLocX, serversInfo.DefaultHomeLocY, this);
            //lus.AddPlugin(new TemporaryUserProfilePlugin());
            lus.AddPlugin(configSettings.StandaloneUserPlugin, configSettings.StandaloneUserSource);            
            m_userService = lus;
            m_userAdminService = lus;            
            m_avatarService = lus;
            m_messageService = lus;

            m_gridService = new LocalBackEndServices();                   
        }
Ejemplo n.º 5
0
        public HGCommunicationsGridMode(
            NetworkServersInfo serversInfo,
            SceneManager sman, LibraryRootFolder libraryRootFolder)
            : base(serversInfo, libraryRootFolder)
        {
            // From constructor at CommunicationsOGS1
            HGGridServices gridInterComms = new HGGridServicesGridMode(serversInfo, sman, m_userProfileCacheService);
            m_gridService = gridInterComms;
            m_osw = gridInterComms;

            // The HG InventoryService always uses secure handlers
            HGInventoryServiceClient invService = new HGInventoryServiceClient(serversInfo.InventoryURL, this.m_userProfileCacheService, true);
            invService.UserProfileCache = m_userProfileCacheService; 
            AddSecureInventoryService(invService);
            m_defaultInventoryHost = invService.Host;
            if (SecureInventoryService != null)
                m_log.Info("[HG]: SecureInventoryService.");
            else
                m_log.Info("[HG]: Non-secureInventoryService.");

            HGUserServices userServices = new HGUserServices(this);
            // This plugin arrangement could eventually be configurable rather than hardcoded here.
            userServices.AddPlugin(new TemporaryUserProfilePlugin());
            userServices.AddPlugin(new OGS1UserDataPlugin(this));            
            
            m_userService = userServices;
            m_messageService = userServices;
            m_avatarService = userServices;           
        }
Ejemplo n.º 6
0
        public HGGridServicesStandalone(NetworkServersInfo servers_info, BaseHttpServer httpServe, IAssetCache asscache, SceneManager sman)
            : base(servers_info, sman)
        {
            //Respond to Grid Services requests
            MainServer.Instance.AddXmlRPCHandler("logoff_user", LogOffUser);
            MainServer.Instance.AddXmlRPCHandler("check", PingCheckReply);
            MainServer.Instance.AddXmlRPCHandler("land_data", LandData);

        }
Ejemplo n.º 7
0
        public LLStandaloneLoginService(
            UserManagerBase userManager, string welcomeMess, string mapServerURI,
            NetworkServersInfo serversInfo,
            bool authenticate, LibraryRootFolder libraryRootFolder, ILoginServiceToRegionsConnector regionsConnector)
            : base(userManager, libraryRootFolder, welcomeMess, mapServerURI)
        {
            this.m_serversInfo = serversInfo;
            m_defaultHomeX = this.m_serversInfo.DefaultHomeLocX;
            m_defaultHomeY = this.m_serversInfo.DefaultHomeLocY;
            m_authUsers = authenticate;

            m_regionsConnector = regionsConnector;
        }
        public TestCommunicationsManager(NetworkServersInfo serversInfo)
            : base(serversInfo, null)
        {                        

            LocalUserServices lus = new LocalUserServices(991, 992, this);
            lus.AddPlugin(new TemporaryUserProfilePlugin());
            m_userDataPlugin = new TestUserDataPlugin();
            lus.AddPlugin(m_userDataPlugin);
            m_userService = lus;
            m_userAdminService = lus;

            LocalBackEndServices gs = new LocalBackEndServices();
            m_gridService = gs;
        }
Ejemplo n.º 9
0
        public CommunicationsOGS1(
            NetworkServersInfo serversInfo,
            LibraryRootFolder libraryRootFolder)
            : base(serversInfo, libraryRootFolder)
        {

            // This plugin arrangement could eventually be configurable rather than hardcoded here.
            OGS1UserServices userServices = new OGS1UserServices(this);
            userServices.AddPlugin(new TemporaryUserProfilePlugin());
            userServices.AddPlugin(new OGS1UserDataPlugin(this));
            
            m_userService = userServices;
            m_messageService = userServices;
            m_avatarService = (IAvatarService)m_userService;
        }
Ejemplo n.º 10
0
        public HGCommunicationsGridMode(
            NetworkServersInfo serversInfo,
            SceneManager sman, LibraryRootFolder libraryRootFolder)
            : base(serversInfo, libraryRootFolder)
        {

            HGUserServices userServices = new HGUserServices(this);
            // This plugin arrangement could eventually be configurable rather than hardcoded here.
            userServices.AddPlugin(new TemporaryUserProfilePlugin());
            userServices.AddPlugin(new HGUserDataPlugin(this, userServices));
            
            m_userService = userServices;
            m_messageService = userServices;
            m_avatarService = userServices;
        }
        public LLStandaloneLoginService(
            UserManagerBase userManager, string welcomeMess,
            IInventoryService interServiceInventoryService,
            NetworkServersInfo serversInfo,
            bool authenticate, LibraryRootFolder libraryRootFolder, ILoginServiceToRegionsConnector regionsConnector)
            : base(userManager, libraryRootFolder, welcomeMess)
        {
            this.m_serversInfo = serversInfo;
            m_defaultHomeX = this.m_serversInfo.DefaultHomeLocX;
            m_defaultHomeY = this.m_serversInfo.DefaultHomeLocY;
            m_authUsers = authenticate;

            m_InventoryService = interServiceInventoryService;
            m_regionsConnector = regionsConnector;
            // Standard behavior: In StandAlone, silent logout of last hung session
            m_warn_already_logged = false;
        }
Ejemplo n.º 12
0
        public HGLoginAuthService(
            UserManagerBase userManager, string welcomeMess,
            IInterServiceInventoryServices interServiceInventoryService,
            NetworkServersInfo serversInfo,
            bool authenticate, LibraryRootFolder libraryRootFolder, ILoginServiceToRegionsConnector regionsConnector)
            : base(userManager, libraryRootFolder, welcomeMess)
        {
            this.m_serversInfo = serversInfo;
            if (m_serversInfo != null)
            {
                m_defaultHomeX = this.m_serversInfo.DefaultHomeLocX;
                m_defaultHomeY = this.m_serversInfo.DefaultHomeLocY;
            }
            m_authUsers = authenticate;

            m_interServiceInventoryService = interServiceInventoryService;
            m_regionsConnector = regionsConnector;
            m_interInventoryService = interServiceInventoryService;
        }
Ejemplo n.º 13
0
        public CommunicationsLocal(
            ConfigSettings configSettings,
            NetworkServersInfo serversInfo,
            LibraryRootFolder libraryRootFolder)
            : base(serversInfo, libraryRootFolder)
        {
                       
            LocalUserServices lus 
                = new LocalUserServices(
                    serversInfo.DefaultHomeLocX, serversInfo.DefaultHomeLocY, this);
            lus.AddPlugin(new TemporaryUserProfilePlugin());
            lus.AddPlugin(configSettings.StandaloneUserPlugin, configSettings.StandaloneUserSource);
            m_userService = lus;
            m_userAdminService = lus;
            m_avatarService = lus;
            m_messageService = lus;

            //LocalLoginService loginService = CreateLoginService(libraryRootFolder, inventoryService, userService, backendService);
        }
        public HGCommunicationsGridMode(
            NetworkServersInfo serversInfo,
            SceneManager sman, LibraryRootFolder libraryRootFolder)
            : base(serversInfo, libraryRootFolder)
        {
            // From constructor at CommunicationsOGS1
            HGGridServices gridInterComms = new HGGridServicesGridMode(serversInfo, sman, m_userProfileCacheService);
            m_gridService = gridInterComms;
            m_osw = gridInterComms;

            HGUserServices userServices = new HGUserServices(this);
            // This plugin arrangement could eventually be configurable rather than hardcoded here.
            userServices.AddPlugin(new TemporaryUserProfilePlugin());
            userServices.AddPlugin(new OGS1UserDataPlugin(this));            
            
            m_userService = userServices;
            m_messageService = userServices;
            m_avatarService = userServices;           
        }
Ejemplo n.º 15
0
        public UserLoginAuthService(
            UserManagerBase userManager, IInterServiceInventoryServices inventoryService,
            LibraryRootFolder libraryRootFolder,
            UserConfig config, string welcomeMess, IRegionProfileRouter regionProfileService)
            : base(userManager, welcomeMess, inventoryService, null, true, libraryRootFolder, null)
        {
            m_config = config;
            m_defaultHomeX = m_config.DefaultX;
            m_defaultHomeY = m_config.DefaultY;
            m_interInventoryService = inventoryService;
            m_regionProfileService = regionProfileService;

            NetworkServersInfo serversinfo = new NetworkServersInfo(1000, 1000);
            serversinfo.GridRecvKey = m_config.GridRecvKey;
            serversinfo.GridSendKey = m_config.GridSendKey;
            serversinfo.GridURL = m_config.GridServerURL.ToString();
            serversinfo.InventoryURL = m_config.InventoryUrl.ToString();
            serversinfo.UserURL = m_config.AuthUrl.ToString();
            SetServersInfo(serversinfo);
        }
Ejemplo n.º 16
0
        public CommunicationsOGS1(
            NetworkServersInfo serversInfo, BaseHttpServer httpServer, 
            IAssetCache assetCache, LibraryRootFolder libraryRootFolder,
            ConfigSettings configSettings)
            : base(serversInfo, httpServer, assetCache, libraryRootFolder)
        {
            OGS1GridServices gridInterComms = new OGS1GridServices(serversInfo, httpServer);
            m_gridService = gridInterComms;

            // This plugin arrangement could eventually be configurable rather than hardcoded here.           
            OGS1UserServices userServices = new OGS1UserServices(this);
            //userServices.AddPlugin(new TemporaryUserProfilePlugin());
            userServices.AddPlugin(new OGS1UserDataPlugin(this, configSettings));
            
            m_userService = userServices;
            m_messageService = userServices;
            m_avatarService = (IAvatarService)m_userService;

            PluginLoader<IInventoryStoragePlugin> loader = new PluginLoader<IInventoryStoragePlugin>();
            loader.Add("/OpenSim/InventoryStorage", new PluginProviderFilter(configSettings.InventoryPlugin));
            loader.Load();

            loader.Plugin.Initialize(configSettings);
        }
Ejemplo n.º 17
0
        public CommunicationsLocal(
            ConfigSettings configSettings,                                   
            NetworkServersInfo serversInfo,
            LibraryRootFolder libraryRootFolder)
            : base(serversInfo, libraryRootFolder)
        {
            LocalInventoryService inventoryService = new LocalInventoryService();
            List<IInventoryDataPlugin> plugins 
                = DataPluginFactory.LoadDataPlugins<IInventoryDataPlugin>(
                    configSettings.StandaloneInventoryPlugin, 
                    configSettings.StandaloneInventorySource);

            foreach (IInventoryDataPlugin plugin in plugins)
            {
                // Using the OSP wrapper plugin for database plugins should be made configurable at some point
                inventoryService.AddPlugin(new OspInventoryWrapperPlugin(plugin, this));
            }
            
            AddInventoryService(inventoryService);
            m_defaultInventoryHost = inventoryService.Host;
            m_interServiceInventoryService = inventoryService;
                        
            LocalUserServices lus 
                = new LocalUserServices(
                    serversInfo.DefaultHomeLocX, serversInfo.DefaultHomeLocY, this);
            lus.AddPlugin(new TemporaryUserProfilePlugin());
            lus.AddPlugin(configSettings.StandaloneUserPlugin, configSettings.StandaloneUserSource);            
            m_userService = lus;
            m_userAdminService = lus;            
            m_avatarService = lus;
            m_messageService = lus;

            m_gridService = new LocalBackEndServices();

            //LocalLoginService loginService = CreateLoginService(libraryRootFolder, inventoryService, userService, backendService);                      
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Contructor.  Adds "expect_hg_user" and "check" xmlrpc method handlers
        /// </summary>
        /// <param name="servers_info"></param>
        public HGGridServices(NetworkServersInfo servers_info, SceneManager sman)
        {
            serversInfo = servers_info;
            m_sceneman = sman;

            random = new Random();

            MainServer.Instance.AddXmlRPCHandler("link_region", LinkRegionRequest);
            MainServer.Instance.AddXmlRPCHandler("expect_hg_user", ExpectHGUser);

            HGNetworkServersInfo.Init(servers_info.AssetURL, servers_info.InventoryURL, servers_info.UserURL);
        }
Ejemplo n.º 19
0
 public void SetServersInfo(NetworkServersInfo sinfo)
 {
     m_serversInfo = sinfo;
 }
        /// <summary>
        /// Loads the region configuration
        /// </summary>
        /// <param name="argvSource">Parameters passed into the process when started</param>
        /// <param name="configSettings"></param>
        /// <param name="networkInfo"></param>
        /// <returns>A configuration that gets passed to modules</returns>
        public OpenSimConfigSource LoadConfigSettings(
                IConfigSource argvSource, EnvConfigSource envConfigSource, out ConfigSettings configSettings,
                out NetworkServersInfo networkInfo)
        {
            m_configSettings = configSettings = new ConfigSettings();
            m_networkServersInfo = networkInfo = new NetworkServersInfo();

            bool iniFileExists = false;

            IConfig startupConfig = argvSource.Configs["Startup"];

            List<string> sources = new List<string>();

            string masterFileName = startupConfig.GetString("inimaster", "OpenSimDefaults.ini");

            if (masterFileName == "none")
                masterFileName = String.Empty;

            if (IsUri(masterFileName))
            {
                if (!sources.Contains(masterFileName))
                    sources.Add(masterFileName);
            }
            else
            {
                string masterFilePath = Path.GetFullPath(
                        Path.Combine(Util.configDir(), masterFileName));

                if (masterFileName != String.Empty)
                {
                    if (File.Exists(masterFilePath))
                    {
                        if (!sources.Contains(masterFilePath))
                            sources.Add(masterFilePath);
                    }
                    else
                    {
                        m_log.ErrorFormat("Master ini file {0} not found", Path.GetFullPath(masterFilePath));
                        Environment.Exit(1);
                    }
                }
            }

            string iniFileName = startupConfig.GetString("inifile", "OpenSim.ini");

            if (IsUri(iniFileName))
            {
                if (!sources.Contains(iniFileName))
                    sources.Add(iniFileName);
                Application.iniFilePath = iniFileName;
            }
            else
            {
                Application.iniFilePath = Path.GetFullPath(
                    Path.Combine(Util.configDir(), iniFileName));

                if (!File.Exists(Application.iniFilePath))
                {
                    iniFileName = "OpenSim.xml";
                    Application.iniFilePath = Path.GetFullPath(Path.Combine(Util.configDir(), iniFileName));
                }

                if (File.Exists(Application.iniFilePath))
                {
                    if (!sources.Contains(Application.iniFilePath))
                        sources.Add(Application.iniFilePath);
                }
            }

            m_config = new OpenSimConfigSource();
            m_config.Source = new IniConfigSource();
            m_config.Source.Merge(DefaultConfig());

            m_log.Info("[CONFIG]: Reading configuration settings");

            for (int i = 0 ; i < sources.Count ; i++)
            {
                if (ReadConfig(m_config, sources[i]))
                {
                    iniFileExists = true;
                    AddIncludes(m_config, sources);
                }
            }

            // Override distro settings with contents of inidirectory
            string iniDirName = startupConfig.GetString("inidirectory", "config");
            string iniDirPath = Path.Combine(Util.configDir(), iniDirName);

            if (Directory.Exists(iniDirPath))
            {
                m_log.InfoFormat("[CONFIG]: Searching folder {0} for config ini files", iniDirPath);
                List<string> overrideSources = new List<string>();

                string[] fileEntries = Directory.GetFiles(iniDirName);
                foreach (string filePath in fileEntries)
                {
                    if (Path.GetExtension(filePath).ToLower() == ".ini")
                    {
                        if (!sources.Contains(Path.GetFullPath(filePath)))
                        {
                            overrideSources.Add(Path.GetFullPath(filePath));
                            // put it in sources too, to avoid circularity
                            sources.Add(Path.GetFullPath(filePath));
                        }
                    }
                }


                if (overrideSources.Count > 0)
                {
                    OpenSimConfigSource overrideConfig = new OpenSimConfigSource();
                    overrideConfig.Source = new IniConfigSource();

                    for (int i = 0 ; i < overrideSources.Count ; i++)
                    {
                        if (ReadConfig(overrideConfig, overrideSources[i]))
                        {
                            iniFileExists = true;
                            AddIncludes(overrideConfig, overrideSources);
                        } 
                    }
                    m_config.Source.Merge(overrideConfig.Source);
                }
            }

            if (sources.Count == 0)
            {
                m_log.FatalFormat("[CONFIG]: Could not load any configuration");
                Environment.Exit(1);
            } 
            else if (!iniFileExists)
            {
                m_log.FatalFormat("[CONFIG]: Could not load any configuration");
                m_log.FatalFormat("[CONFIG]: Configuration exists, but there was an error loading it!");
                Environment.Exit(1);
            }

            // Merge OpSys env vars
            m_log.Info("[CONFIG]: Loading environment variables for Config");
            Util.MergeEnvironmentToConfig(m_config.Source);

            // Make sure command line options take precedence
            m_config.Source.Merge(argvSource);

            m_config.Source.ReplaceKeyValues();

            ReadConfigSettings();

            return m_config;
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Loads the region configuration
        /// </summary>
        /// <param name="argvSource">Parameters passed into the process when started</param>
        /// <param name="configSettings"></param>
        /// <param name="networkInfo"></param>
        /// <returns>A configuration that gets passed to modules</returns>
        public OpenSimConfigSource LoadConfigSettings(
                IConfigSource argvSource, EnvConfigSource envConfigSource, out ConfigSettings configSettings,
                out NetworkServersInfo networkInfo)
        {
            m_configSettings = configSettings = new ConfigSettings();
            m_networkServersInfo = networkInfo = new NetworkServersInfo();

            bool iniFileExists = false;

            IConfig startupConfig = argvSource.Configs["Startup"];

            List<string> sources = new List<string>();

            string masterFileName =
                    startupConfig.GetString("inimaster", "OpenSimDefaults.ini");

            if (masterFileName == "none")
                masterFileName = String.Empty;

            if (IsUri(masterFileName))
            {
                if (!sources.Contains(masterFileName))
                    sources.Add(masterFileName);
            }
            else
            {
                string masterFilePath = Path.GetFullPath(
                        Path.Combine(Util.configDir(), masterFileName));

                if (masterFileName != String.Empty)
                {
                    if (File.Exists(masterFilePath))
                    {
                        if (!sources.Contains(masterFilePath))
                            sources.Add(masterFilePath);
                    }
                    else
                    {
                        m_log.ErrorFormat("Master ini file {0} not found", masterFilePath);
                        Environment.Exit(1);
                    }
                }
            }


            string iniFileName =
                    startupConfig.GetString("inifile", "OpenSim.ini");

            if (IsUri(iniFileName))
            {
                if (!sources.Contains(iniFileName))
                    sources.Add(iniFileName);
                Application.iniFilePath = iniFileName;
            }
            else
            {
                Application.iniFilePath = Path.GetFullPath(
                        Path.Combine(Util.configDir(), iniFileName));

                if (!File.Exists(Application.iniFilePath))
                {
                    iniFileName = "OpenSim.xml";
                    Application.iniFilePath = Path.GetFullPath(
                            Path.Combine(Util.configDir(), iniFileName));
                }

                if (File.Exists(Application.iniFilePath))
                {
                    if (!sources.Contains(Application.iniFilePath))
                        sources.Add(Application.iniFilePath);
                }
            }

            string iniDirName =
                    startupConfig.GetString("inidirectory", "config");
            string iniDirPath =
                    Path.Combine(Util.configDir(), iniDirName);

            if (Directory.Exists(iniDirPath))
            {
                m_log.InfoFormat("Searching folder {0} for config ini files",
                        iniDirPath);

                string[] fileEntries = Directory.GetFiles(iniDirName);
                foreach (string filePath in fileEntries)
                {
                    if (Path.GetExtension(filePath).ToLower() == ".ini")
                    {
                        if (!sources.Contains(Path.GetFullPath(filePath)))
                            sources.Add(Path.GetFullPath(filePath));
                    }
                }
            }

            m_config = new OpenSimConfigSource();
            m_config.Source = new IniConfigSource();
            m_config.Source.Merge(DefaultConfig());

            m_log.Info("[CONFIG]: Reading configuration settings");

            if (sources.Count == 0)
            {
                m_log.FatalFormat("[CONFIG]: Could not load any configuration");
                m_log.FatalFormat("[CONFIG]: Did you copy the OpenSimDefaults.ini.example file to OpenSimDefaults.ini?");
                Environment.Exit(1);
            }

            for (int i = 0 ; i < sources.Count ; i++)
            {
                if (ReadConfig(sources[i]))
                {
                    iniFileExists = true;
                    AddIncludes(sources);
                }
            }

            if (!iniFileExists)
            {
                m_log.FatalFormat("[CONFIG]: Could not load any configuration");
                m_log.FatalFormat("[CONFIG]: Configuration exists, but there was an error loading it!");
                Environment.Exit(1);
            }

            // Make sure command line options take precedence
            m_config.Source.Merge(argvSource);


            IConfig enVars = m_config.Source.Configs["Environment"];

            if( enVars != null )
            {
                string[] env_keys = enVars.GetKeys();

                foreach ( string key in env_keys )
                {
                    envConfigSource.AddEnv(key, string.Empty);
                }

                envConfigSource.LoadEnv();
                m_config.Source.Merge(envConfigSource);
                m_config.Source.ExpandKeyValues();
            }


            ReadConfigSettings();

            return m_config;
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Contructor.  Adds "expect_user" and "check" xmlrpc method handlers
        /// </summary>
        /// <param name="servers_info"></param>
        /// <param name="httpServe"></param>
        public OGS1GridServices(NetworkServersInfo servers_info, BaseHttpServer httpServe)
        {
            serversInfo = servers_info;
            httpServer = httpServe;

            //Respond to Grid Services requests
            httpServer.AddXmlRPCHandler("check", PingCheckReply);
            httpServer.AddXmlRPCHandler("land_data", LandData);

            // New Style
            httpServer.AddStreamHandler(new XmlRpcStreamHandler("POST", Util.XmlRpcRequestPrefix("check"), PingCheckReply));
            httpServer.AddStreamHandler(new XmlRpcStreamHandler("POST", Util.XmlRpcRequestPrefix("land_data"), LandData));
        }
Ejemplo n.º 23
0
        public OpenSimConfigSource LoadConfigSettings(IConfigSource configSource, out ConfigSettings configSettings,
                                                      out NetworkServersInfo networkInfo)
        {
            m_configSettings = configSettings = new ConfigSettings();
            m_networkServersInfo = networkInfo = new NetworkServersInfo();
            bool iniFileExists = false;

            IConfig startupConfig = configSource.Configs["Startup"];

            //old style or new style settings?
            string iniFileName = startupConfig.GetString("inifile", "Halcyon.ini");
            ApplicationBase.iniFilePath = Path.Combine(Util.configDir(), iniFileName);

            string masterFileName = startupConfig.GetString("inimaster", String.Empty);
            string masterfilePath = Path.Combine(Util.configDir(), masterFileName);

            string iniDirName = startupConfig.GetString("inidirectory", "config");
            //string iniDirPath = Path.Combine(Util.configDir(), iniDirName);

            m_config = new OpenSimConfigSource();
            m_config.Source = new IniConfigSource();
            m_config.Source.Merge(DefaultConfig());

            m_log.Info("[CONFIG] Reading configuration settings");

            Uri configUri;
            
            String xmlPath = Path.Combine(Util.configDir(), "Halcyon.xml");

            //check for master .INI file (name passed in command line, no default), or XML over http
            if (!String.IsNullOrEmpty(masterFileName)) // If a master file name is given ...
            {
                m_log.InfoFormat("[CONFIG] Reading config master file {0}", masterfilePath);

                bool isMasterUri = Uri.TryCreate(masterFileName, UriKind.Absolute, out configUri) &&
                                   configUri.Scheme == Uri.UriSchemeHttp;

                if (!ReadConfig(masterFileName, masterfilePath, m_config, isMasterUri))
                {
                    m_log.FatalFormat("[CONFIG] Could not open master config file {0}", masterfilePath);
                }
            }

            if (Directory.Exists(iniDirName))
            {
                m_log.InfoFormat("Searching folder: {0} , for config ini files", iniDirName);
                string[] fileEntries = Directory.GetFiles(iniDirName);
                foreach (string filePath in fileEntries)
                {
                    if (Path.GetExtension(filePath).ToLower() == ".ini")
                    {
                        // m_log.InfoFormat("reading ini file < {0} > from config dir", filePath);
                        ReadConfig(Path.GetFileName(filePath), filePath, m_config, false);
                    }
                }
            }

            // Check for .INI file (either default or name passed on command
            // line) or XML config source over http
            bool isIniUri = Uri.TryCreate(iniFileName, UriKind.Absolute, out configUri) &&
                            configUri.Scheme == Uri.UriSchemeHttp;
            iniFileExists = ReadConfig(iniFileName, ApplicationBase.iniFilePath, m_config, isIniUri);

            if (!iniFileExists)
            {
                // check for a xml config file                                
                if (File.Exists(xmlPath))
                {
                    ApplicationBase.iniFilePath = xmlPath;

                    m_log.InfoFormat("Reading XML configuration from {0}", Path.GetFullPath(xmlPath));
                    iniFileExists = true;

                    m_config.Source = new XmlConfigSource();
                    m_config.Source.Merge(new XmlConfigSource(ApplicationBase.iniFilePath));
                }
            }

            m_config.Source.Merge(configSource);

            if (!iniFileExists)
            {
                m_log.FatalFormat("[CONFIG] Could not load any configuration");
                if (!isIniUri)
                    m_log.FatalFormat("[CONFIG] Tried to load {0}, ", Path.GetFullPath(ApplicationBase.iniFilePath));
                else
                    m_log.FatalFormat("[CONFIG] Tried to load from URI {0}, ", iniFileName);
                m_log.FatalFormat("[CONFIG] and XML source {0}", Path.GetFullPath(xmlPath));

                string sampleName = Path.GetFileNameWithoutExtension(ApplicationBase.iniFilePath) + ".sample.ini";

                m_log.FatalFormat("[CONFIG] Did you copy the {0} file to {1}?", sampleName, ApplicationBase.iniFilePath);
                Environment.Exit(1);
            }

            ReadConfigSettings();

            return m_config;
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Contructor.  Adds "expect_user" and "check" xmlrpc method handlers
        /// </summary>
        /// <param name="servers_info"></param>
        /// <param name="httpServe"></param>
        public OGS1GridServices(NetworkServersInfo servers_info)
        {
            serversInfo = servers_info;

            //Respond to Grid Services requests
            MainServer.Instance.AddXmlRPCHandler("check", PingCheckReply);
        }