From 51488ee7f415950583ba389582692900a2c32831 Mon Sep 17 00:00:00 2001 From: mingchen Date: Sat, 3 Nov 2007 15:09:21 +0000 Subject: *Moved region loading into its own interface IRegionLoader *Added ability to load regioninfo remotely from a webserver from a single file. See share/RegionLoading/HOWTO_REMOTE_REGION_LOADING.txt for more info and an example file. --- OpenSim/Region/Application/OpenSimMain.cs | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/Application') diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 16bb69e..e9151b5 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -35,6 +35,8 @@ using OpenSim.Framework; using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Console; using OpenSim.Framework.Servers; +using OpenSim.Framework.RegionLoader.Filesystem; +using OpenSim.Framework.RegionLoader.Web; using OpenSim.Region.ClientStack; using OpenSim.Region.Communications.Local; using OpenSim.Region.Communications.OGS1; @@ -43,6 +45,7 @@ using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Physics.Manager; + namespace OpenSim { public delegate void ConsoleCommand(string[] comParams); @@ -272,21 +275,21 @@ namespace OpenSim m_httpServer.AddStreamHandler(new SimStatusHandler()); } - string regionConfigPath = Path.Combine(Util.configDir(), "Regions"); - - if (!Directory.Exists(regionConfigPath)) + IRegionLoader regionLoader; + if (m_config.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem") { - Directory.CreateDirectory(regionConfigPath); + MainLog.Instance.Notice("Loading Region Info from filesystem"); + regionLoader = new RegionLoaderFileSystem(); } - - string[] configFiles = Directory.GetFiles(regionConfigPath, "*.xml"); - - if (configFiles.Length == 0) + else { - CreateDefaultRegionInfoXml(Path.Combine(regionConfigPath, "default.xml")); - configFiles = Directory.GetFiles(regionConfigPath, "*.xml"); + MainLog.Instance.Notice("Loading Region Info from web"); + regionLoader = new RegionLoaderWebServer(); } + regionLoader.SetIniConfigSource(m_config); + RegionInfo[] regionsToLoad = regionLoader.LoadRegions(); + m_moduleLoader = new ModuleLoader(m_log, m_config); MainLog.Instance.Verbose("Loading Shared Modules"); m_moduleLoader.LoadDefaultSharedModules(); @@ -294,12 +297,10 @@ namespace OpenSim // Load all script engines found (scripting engine is now a IRegionModule so loaded in the module loader // OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineLoader ScriptEngineLoader = new OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineLoader(m_log); - for (int i = 0; i < configFiles.Length; i++) + for (int i = 0; i < regionsToLoad.Length; i++) { - //Console.WriteLine("Loading region config file"); - RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), configFiles[i]); - - CreateRegion(regionInfo); + MainLog.Instance.Debug("Creating Region: " + regionsToLoad[i].RegionName); + CreateRegion(regionsToLoad[i]); } m_moduleLoader.PostInitialise(); -- cgit v1.1