diff options
more startup/initialisation refactoring
Diffstat (limited to 'OpenSim/Region/Application')
-rw-r--r-- | OpenSim/Region/Application/OpenSim.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSimBackground.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSimBase.cs | 97 |
3 files changed, 60 insertions, 43 deletions
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 | |||
90 | m_log.Info("===================================================================="); | 90 | m_log.Info("===================================================================="); |
91 | m_log.Info("========================= STARTING OPENSIM ========================="); | 91 | m_log.Info("========================= STARTING OPENSIM ========================="); |
92 | m_log.Info("===================================================================="); | 92 | m_log.Info("===================================================================="); |
93 | m_log.InfoFormat("[OPENSIM MAIN]: Running in {0} mode", (ConfigurationSettings.Sandbox ? "sandbox" : "grid")); | 93 | m_log.InfoFormat("[OPENSIM MAIN]: Running in {0} mode", (ConfigurationSettings.Standalone ? "sandbox" : "grid")); |
94 | 94 | ||
95 | m_console = new ConsoleBase("Region", this); | 95 | m_console = new ConsoleBase("Region", this); |
96 | MainConsole.Instance = m_console; | 96 | MainConsole.Instance = m_console; |
@@ -642,7 +642,7 @@ namespace OpenSim | |||
642 | 642 | ||
643 | ShowPluginCommandsHelp(CombineParams(helpArgs, 0), m_console); | 643 | ShowPluginCommandsHelp(CombineParams(helpArgs, 0), m_console); |
644 | 644 | ||
645 | if (ConfigurationSettings.Sandbox) | 645 | if (ConfigurationSettings.Standalone) |
646 | { | 646 | { |
647 | m_console.Notice(""); | 647 | m_console.Notice(""); |
648 | m_console.Notice("create user - adds a new user."); | 648 | 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 | |||
56 | m_log.Info("===================================================================="); | 56 | m_log.Info("===================================================================="); |
57 | m_log.Info("========================= STARTING OPENSIM ========================="); | 57 | m_log.Info("========================= STARTING OPENSIM ========================="); |
58 | m_log.Info("===================================================================="); | 58 | m_log.Info("===================================================================="); |
59 | m_log.InfoFormat("[OPENSIM MAIN]: Running in background {0} mode", ConfigurationSettings.Sandbox ? "sandbox" : "grid"); | 59 | m_log.InfoFormat("[OPENSIM MAIN]: Running in background {0} mode", ConfigurationSettings.Standalone ? "sandbox" : "grid"); |
60 | 60 | ||
61 | base.Startup(); | 61 | base.Startup(); |
62 | 62 | ||
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 | |||
271 | 271 | ||
272 | if (startupConfig != null) | 272 | if (startupConfig != null) |
273 | { | 273 | { |
274 | m_configSettings.Sandbox = !startupConfig.GetBoolean("gridmode"); | 274 | m_configSettings.Standalone = !startupConfig.GetBoolean("gridmode"); |
275 | m_configSettings.PhysicsEngine = startupConfig.GetString("physics"); | 275 | m_configSettings.PhysicsEngine = startupConfig.GetString("physics"); |
276 | m_configSettings.MeshEngineName = startupConfig.GetString("meshing"); | 276 | m_configSettings.MeshEngineName = startupConfig.GetString("meshing"); |
277 | 277 | ||
@@ -333,44 +333,10 @@ namespace OpenSim | |||
333 | 333 | ||
334 | LibraryRootFolder libraryRootFolder = new LibraryRootFolder(); | 334 | LibraryRootFolder libraryRootFolder = new LibraryRootFolder(); |
335 | 335 | ||
336 | // StandAlone mode? m_sandbox is determined by !startupConfig.GetBoolean("gridmode", false) | 336 | // StandAlone mode? is determined by !startupConfig.GetBoolean("gridmode", false) |
337 | if (m_configSettings.Sandbox) | 337 | if (m_configSettings.Standalone) |
338 | { | 338 | { |
339 | LocalInventoryService inventoryService = new LocalInventoryService(); | 339 | InitialiseStandaloneServices(libraryRootFolder); |
340 | inventoryService.AddPlugin(m_configSettings.StandaloneInventoryPlugin, m_configSettings.StandaloneInventorySource); | ||
341 | |||
342 | LocalUserServices userService = | ||
343 | new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX, | ||
344 | m_networkServersInfo.DefaultHomeLocY, inventoryService); | ||
345 | userService.AddPlugin(m_configSettings.StandaloneUserPlugin, m_configSettings.StandaloneUserSource); | ||
346 | |||
347 | LocalBackEndServices backendService = new LocalBackEndServices(); | ||
348 | |||
349 | LocalLoginService loginService = | ||
350 | new LocalLoginService( | ||
351 | userService, m_configSettings.StandaloneWelcomeMessage, inventoryService, backendService, m_networkServersInfo, | ||
352 | m_configSettings.StandaloneAuthenticate, libraryRootFolder); | ||
353 | |||
354 | m_commsManager | ||
355 | = new CommunicationsLocal( | ||
356 | m_networkServersInfo, m_httpServer, m_assetCache, userService, userService, | ||
357 | inventoryService, backendService, backendService, userService, | ||
358 | libraryRootFolder, m_dumpAssetsToFile); | ||
359 | |||
360 | // set up XMLRPC handler for client's initial login request message | ||
361 | m_httpServer.AddXmlRPCHandler("login_to_simulator", loginService.XmlRpcLoginMethod); | ||
362 | |||
363 | // provides the web form login | ||
364 | m_httpServer.AddHTTPHandler("login", loginService.ProcessHTMLLogin); | ||
365 | |||
366 | // Provides the LLSD login | ||
367 | m_httpServer.SetDefaultLLSDHandler(loginService.LLSDLoginMethod); | ||
368 | |||
369 | // provide grid info | ||
370 | // m_gridInfoService = new GridInfoService(m_config.Source.Configs["Startup"].GetString("inifile", Path.Combine(Util.configDir(), "OpenSim.ini"))); | ||
371 | m_gridInfoService = new GridInfoService(m_config.Source); | ||
372 | m_httpServer.AddXmlRPCHandler("get_grid_info", m_gridInfoService.XmlRpcGridInfoMethod); | ||
373 | m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/get_grid_info", m_gridInfoService.RestGetGridInfoMethod)); | ||
374 | } | 340 | } |
375 | else | 341 | else |
376 | { | 342 | { |
@@ -393,6 +359,49 @@ namespace OpenSim | |||
393 | m_commsManager.GridService.RegionLoginsEnabled = true; | 359 | m_commsManager.GridService.RegionLoginsEnabled = true; |
394 | } | 360 | } |
395 | 361 | ||
362 | /// <summary> | ||
363 | /// Initialises the backend services for standalone mode, and registers some http handlers | ||
364 | /// </summary> | ||
365 | /// <param name="libraryRootFolder"></param> | ||
366 | protected void InitialiseStandaloneServices(LibraryRootFolder libraryRootFolder) | ||
367 | { | ||
368 | LocalInventoryService inventoryService = new LocalInventoryService(); | ||
369 | inventoryService.AddPlugin(m_configSettings.StandaloneInventoryPlugin, m_configSettings.StandaloneInventorySource); | ||
370 | |||
371 | LocalUserServices userService = | ||
372 | new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX, | ||
373 | m_networkServersInfo.DefaultHomeLocY, inventoryService); | ||
374 | userService.AddPlugin(m_configSettings.StandaloneUserPlugin, m_configSettings.StandaloneUserSource); | ||
375 | |||
376 | LocalBackEndServices backendService = new LocalBackEndServices(); | ||
377 | |||
378 | LocalLoginService loginService = | ||
379 | new LocalLoginService( | ||
380 | userService, m_configSettings.StandaloneWelcomeMessage, inventoryService, backendService, m_networkServersInfo, | ||
381 | m_configSettings.StandaloneAuthenticate, libraryRootFolder); | ||
382 | |||
383 | m_commsManager | ||
384 | = new CommunicationsLocal( | ||
385 | m_networkServersInfo, m_httpServer, m_assetCache, userService, userService, | ||
386 | inventoryService, backendService, backendService, userService, | ||
387 | libraryRootFolder, m_dumpAssetsToFile); | ||
388 | |||
389 | // set up XMLRPC handler for client's initial login request message | ||
390 | m_httpServer.AddXmlRPCHandler("login_to_simulator", loginService.XmlRpcLoginMethod); | ||
391 | |||
392 | // provides the web form login | ||
393 | m_httpServer.AddHTTPHandler("login", loginService.ProcessHTMLLogin); | ||
394 | |||
395 | // Provides the LLSD login | ||
396 | m_httpServer.SetDefaultLLSDHandler(loginService.LLSDLoginMethod); | ||
397 | |||
398 | // provide grid info | ||
399 | // m_gridInfoService = new GridInfoService(m_config.Source.Configs["Startup"].GetString("inifile", Path.Combine(Util.configDir(), "OpenSim.ini"))); | ||
400 | m_gridInfoService = new GridInfoService(m_config.Source); | ||
401 | m_httpServer.AddXmlRPCHandler("get_grid_info", m_gridInfoService.XmlRpcGridInfoMethod); | ||
402 | m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/get_grid_info", m_gridInfoService.RestGetGridInfoMethod)); | ||
403 | } | ||
404 | |||
396 | protected override void Initialize() | 405 | protected override void Initialize() |
397 | { | 406 | { |
398 | // | 407 | // |
@@ -401,6 +410,16 @@ namespace OpenSim | |||
401 | 410 | ||
402 | m_httpServerPort = m_networkServersInfo.HttpListenerPort; | 411 | m_httpServerPort = m_networkServersInfo.HttpListenerPort; |
403 | 412 | ||
413 | InitialiseAssetCache(); | ||
414 | |||
415 | m_sceneManager.OnRestartSim += handleRestartRegion; | ||
416 | } | ||
417 | |||
418 | /// <summary> | ||
419 | /// Initialises the assetcache | ||
420 | /// </summary> | ||
421 | protected void InitialiseAssetCache() | ||
422 | { | ||
404 | IAssetServer assetServer; | 423 | IAssetServer assetServer; |
405 | if (m_configSettings.AssetStorage == "grid") | 424 | if (m_configSettings.AssetStorage == "grid") |
406 | { | 425 | { |
@@ -428,8 +447,6 @@ namespace OpenSim | |||
428 | } | 447 | } |
429 | 448 | ||
430 | m_assetCache = new AssetCache(assetServer); | 449 | m_assetCache = new AssetCache(assetServer); |
431 | |||
432 | m_sceneManager.OnRestartSim += handleRestartRegion; | ||
433 | } | 450 | } |
434 | 451 | ||
435 | public UUID CreateUser(string tempfirstname, string templastname, string tempPasswd, uint regX, uint regY) | 452 | public UUID CreateUser(string tempfirstname, string templastname, string tempPasswd, uint regX, uint regY) |