From 079469b3f5e6b8a8b20115312d0bfd89841b3338 Mon Sep 17 00:00:00 2001 From: MW Date: Wed, 5 Nov 2008 17:45:56 +0000 Subject: more startup/initialisation refactoring --- OpenSim/Framework/ConfigSettings.cs | 8 +- OpenSim/Region/Application/OpenSim.cs | 4 +- OpenSim/Region/Application/OpenSimBackground.cs | 2 +- OpenSim/Region/Application/OpenSimBase.cs | 97 +++++++++++++++---------- 4 files changed, 64 insertions(+), 47 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/ConfigSettings.cs b/OpenSim/Framework/ConfigSettings.cs index 3671b06..7efc778 100644 --- a/OpenSim/Framework/ConfigSettings.cs +++ b/OpenSim/Framework/ConfigSettings.cs @@ -21,12 +21,12 @@ namespace OpenSim.Framework set { m_meshEngineName = value; } } - private bool m_sandbox; + private bool m_standalone; - public bool Sandbox + public bool Standalone { - get { return m_sandbox; } - set { m_sandbox = value; } + get { return m_standalone; } + set { m_standalone = value; } } private bool m_see_into_region_from_neighbor; diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index d2af16f..ded7508 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -90,7 +90,7 @@ namespace OpenSim m_log.Info("===================================================================="); m_log.Info("========================= STARTING OPENSIM ========================="); m_log.Info("===================================================================="); - m_log.InfoFormat("[OPENSIM MAIN]: Running in {0} mode", (ConfigurationSettings.Sandbox ? "sandbox" : "grid")); + m_log.InfoFormat("[OPENSIM MAIN]: Running in {0} mode", (ConfigurationSettings.Standalone ? "sandbox" : "grid")); m_console = new ConsoleBase("Region", this); MainConsole.Instance = m_console; @@ -642,7 +642,7 @@ namespace OpenSim ShowPluginCommandsHelp(CombineParams(helpArgs, 0), m_console); - if (ConfigurationSettings.Sandbox) + if (ConfigurationSettings.Standalone) { m_console.Notice(""); m_console.Notice("create user - adds a new user."); diff --git a/OpenSim/Region/Application/OpenSimBackground.cs b/OpenSim/Region/Application/OpenSimBackground.cs index ed5680b..4a2c161 100644 --- a/OpenSim/Region/Application/OpenSimBackground.cs +++ b/OpenSim/Region/Application/OpenSimBackground.cs @@ -56,7 +56,7 @@ namespace OpenSim m_log.Info("===================================================================="); m_log.Info("========================= STARTING OPENSIM ========================="); m_log.Info("===================================================================="); - m_log.InfoFormat("[OPENSIM MAIN]: Running in background {0} mode", ConfigurationSettings.Sandbox ? "sandbox" : "grid"); + m_log.InfoFormat("[OPENSIM MAIN]: Running in background {0} mode", ConfigurationSettings.Standalone ? "sandbox" : "grid"); base.Startup(); diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 39991dc..a3b557d 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -271,7 +271,7 @@ namespace OpenSim if (startupConfig != null) { - m_configSettings.Sandbox = !startupConfig.GetBoolean("gridmode"); + m_configSettings.Standalone = !startupConfig.GetBoolean("gridmode"); m_configSettings.PhysicsEngine = startupConfig.GetString("physics"); m_configSettings.MeshEngineName = startupConfig.GetString("meshing"); @@ -333,44 +333,10 @@ namespace OpenSim LibraryRootFolder libraryRootFolder = new LibraryRootFolder(); - // StandAlone mode? m_sandbox is determined by !startupConfig.GetBoolean("gridmode", false) - if (m_configSettings.Sandbox) + // StandAlone mode? is determined by !startupConfig.GetBoolean("gridmode", false) + if (m_configSettings.Standalone) { - LocalInventoryService inventoryService = new LocalInventoryService(); - inventoryService.AddPlugin(m_configSettings.StandaloneInventoryPlugin, m_configSettings.StandaloneInventorySource); - - LocalUserServices userService = - new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX, - m_networkServersInfo.DefaultHomeLocY, inventoryService); - userService.AddPlugin(m_configSettings.StandaloneUserPlugin, m_configSettings.StandaloneUserSource); - - LocalBackEndServices backendService = new LocalBackEndServices(); - - LocalLoginService loginService = - new LocalLoginService( - userService, m_configSettings.StandaloneWelcomeMessage, inventoryService, backendService, m_networkServersInfo, - m_configSettings.StandaloneAuthenticate, libraryRootFolder); - - m_commsManager - = new CommunicationsLocal( - m_networkServersInfo, m_httpServer, m_assetCache, userService, userService, - inventoryService, backendService, backendService, userService, - libraryRootFolder, m_dumpAssetsToFile); - - // set up XMLRPC handler for client's initial login request message - m_httpServer.AddXmlRPCHandler("login_to_simulator", loginService.XmlRpcLoginMethod); - - // provides the web form login - m_httpServer.AddHTTPHandler("login", loginService.ProcessHTMLLogin); - - // Provides the LLSD login - m_httpServer.SetDefaultLLSDHandler(loginService.LLSDLoginMethod); - - // provide grid info - // m_gridInfoService = new GridInfoService(m_config.Source.Configs["Startup"].GetString("inifile", Path.Combine(Util.configDir(), "OpenSim.ini"))); - m_gridInfoService = new GridInfoService(m_config.Source); - m_httpServer.AddXmlRPCHandler("get_grid_info", m_gridInfoService.XmlRpcGridInfoMethod); - m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/get_grid_info", m_gridInfoService.RestGetGridInfoMethod)); + InitialiseStandaloneServices(libraryRootFolder); } else { @@ -393,6 +359,49 @@ namespace OpenSim m_commsManager.GridService.RegionLoginsEnabled = true; } + /// + /// Initialises the backend services for standalone mode, and registers some http handlers + /// + /// + protected void InitialiseStandaloneServices(LibraryRootFolder libraryRootFolder) + { + LocalInventoryService inventoryService = new LocalInventoryService(); + inventoryService.AddPlugin(m_configSettings.StandaloneInventoryPlugin, m_configSettings.StandaloneInventorySource); + + LocalUserServices userService = + new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX, + m_networkServersInfo.DefaultHomeLocY, inventoryService); + userService.AddPlugin(m_configSettings.StandaloneUserPlugin, m_configSettings.StandaloneUserSource); + + LocalBackEndServices backendService = new LocalBackEndServices(); + + LocalLoginService loginService = + new LocalLoginService( + userService, m_configSettings.StandaloneWelcomeMessage, inventoryService, backendService, m_networkServersInfo, + m_configSettings.StandaloneAuthenticate, libraryRootFolder); + + m_commsManager + = new CommunicationsLocal( + m_networkServersInfo, m_httpServer, m_assetCache, userService, userService, + inventoryService, backendService, backendService, userService, + libraryRootFolder, m_dumpAssetsToFile); + + // set up XMLRPC handler for client's initial login request message + m_httpServer.AddXmlRPCHandler("login_to_simulator", loginService.XmlRpcLoginMethod); + + // provides the web form login + m_httpServer.AddHTTPHandler("login", loginService.ProcessHTMLLogin); + + // Provides the LLSD login + m_httpServer.SetDefaultLLSDHandler(loginService.LLSDLoginMethod); + + // provide grid info + // m_gridInfoService = new GridInfoService(m_config.Source.Configs["Startup"].GetString("inifile", Path.Combine(Util.configDir(), "OpenSim.ini"))); + m_gridInfoService = new GridInfoService(m_config.Source); + m_httpServer.AddXmlRPCHandler("get_grid_info", m_gridInfoService.XmlRpcGridInfoMethod); + m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/get_grid_info", m_gridInfoService.RestGetGridInfoMethod)); + } + protected override void Initialize() { // @@ -401,6 +410,16 @@ namespace OpenSim m_httpServerPort = m_networkServersInfo.HttpListenerPort; + InitialiseAssetCache(); + + m_sceneManager.OnRestartSim += handleRestartRegion; + } + + /// + /// Initialises the assetcache + /// + protected void InitialiseAssetCache() + { IAssetServer assetServer; if (m_configSettings.AssetStorage == "grid") { @@ -428,8 +447,6 @@ namespace OpenSim } m_assetCache = new AssetCache(assetServer); - - m_sceneManager.OnRestartSim += handleRestartRegion; } public UUID CreateUser(string tempfirstname, string templastname, string tempPasswd, uint regX, uint regY) -- cgit v1.1