aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMW2008-06-26 17:20:08 +0000
committerMW2008-06-26 17:20:08 +0000
commit682ec53420ffac9918febc12b7140363602812e5 (patch)
treea3d45436d19e0388c9f52f7e4bc8058f52d71ec5 /OpenSim
parentWORK-IN-PRGRESS: beware of falling pieces and shifting (diff)
downloadopensim-SC_OLD-682ec53420ffac9918febc12b7140363602812e5.zip
opensim-SC_OLD-682ec53420ffac9918febc12b7140363602812e5.tar.gz
opensim-SC_OLD-682ec53420ffac9918febc12b7140363602812e5.tar.bz2
opensim-SC_OLD-682ec53420ffac9918febc12b7140363602812e5.tar.xz
As per the suggestion on the mailing list, added support for a OpenSim.xml config file, instead of a ini file. INI files still work the same as they did before, just now if a ini file isn't found, it looks for a OpenSim.xml file (of course in xml format) and if found uses that.
Includes a OpenSim.Example.xml for reference (the default settings saved as a xml file).
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs8
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs6
-rw-r--r--OpenSim/ApplicationPlugins/Rest/RestPlugin.cs4
-rw-r--r--OpenSim/Framework/IRegionLoader.cs2
-rw-r--r--OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs6
-rw-r--r--OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs6
-rw-r--r--OpenSim/Region/Application/OpenSim.cs4
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs74
8 files changed, 73 insertions, 37 deletions
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
index 8dde28c..01ea3eb 100644
--- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
+++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
@@ -51,7 +51,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
51 m_log.Info("[LOADREGIONS]: Load Regions addin being initialised"); 51 m_log.Info("[LOADREGIONS]: Load Regions addin being initialised");
52 52
53 IRegionLoader regionLoader; 53 IRegionLoader regionLoader;
54 if (openSim.ConfigSource.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem") 54 if (openSim.ConfigSource.ConfigSource.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem")
55 { 55 {
56 m_log.Info("[LOADREGIONS]: Loading Region Info from filesystem"); 56 m_log.Info("[LOADREGIONS]: Loading Region Info from filesystem");
57 regionLoader = new RegionLoaderFileSystem(); 57 regionLoader = new RegionLoaderFileSystem();
@@ -62,7 +62,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
62 regionLoader = new RegionLoaderWebServer(); 62 regionLoader = new RegionLoaderWebServer();
63 } 63 }
64 64
65 regionLoader.SetIniConfigSource(openSim.ConfigSource); 65 regionLoader.SetIniConfigSource(openSim.ConfigSource.ConfigSource);
66 RegionInfo[] regionsToLoad = regionLoader.LoadRegions(); 66 RegionInfo[] regionsToLoad = regionLoader.LoadRegions();
67 67
68 openSim.ModuleLoader.LoadDefaultSharedModules(); 68 openSim.ModuleLoader.LoadDefaultSharedModules();
@@ -89,7 +89,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
89 m_log.Info("[LOADREGIONS]: Load Regions addin being initialised"); 89 m_log.Info("[LOADREGIONS]: Load Regions addin being initialised");
90 90
91 IRegionLoader regionLoader; 91 IRegionLoader regionLoader;
92 if (openSim.ConfigSource.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem") 92 if (openSim.ConfigSource.ConfigSource.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem")
93 { 93 {
94 m_log.Info("[LOADREGIONS]: Loading Region Info from filesystem"); 94 m_log.Info("[LOADREGIONS]: Loading Region Info from filesystem");
95 regionLoader = new RegionLoaderFileSystem(); 95 regionLoader = new RegionLoaderFileSystem();
@@ -100,7 +100,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
100 regionLoader = new RegionLoaderWebServer(); 100 regionLoader = new RegionLoaderWebServer();
101 } 101 }
102 102
103 regionLoader.SetIniConfigSource(openSim.ConfigSource); 103 regionLoader.SetIniConfigSource(openSim.ConfigSource.ConfigSource);
104 RegionInfo[] regionsToLoad = regionLoader.LoadRegions(); 104 RegionInfo[] regionsToLoad = regionLoader.LoadRegions();
105 for (int i = 0; i < regionsToLoad.Length; i++) 105 for (int i = 0; i < regionsToLoad.Length; i++)
106 { 106 {
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 232fd09..947f833 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -58,11 +58,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
58 { 58 {
59 try 59 try
60 { 60 {
61 if (openSim.ConfigSource.Configs["RemoteAdmin"] != null && 61 if (openSim.ConfigSource.ConfigSource.Configs["RemoteAdmin"] != null &&
62 openSim.ConfigSource.Configs["RemoteAdmin"].GetBoolean("enabled", false)) 62 openSim.ConfigSource.ConfigSource.Configs["RemoteAdmin"].GetBoolean("enabled", false))
63 { 63 {
64 m_log.Info("[RADMIN]: Remote Admin Plugin Enabled"); 64 m_log.Info("[RADMIN]: Remote Admin Plugin Enabled");
65 requiredPassword = openSim.ConfigSource.Configs["RemoteAdmin"].GetString("access_password", String.Empty); 65 requiredPassword = openSim.ConfigSource.ConfigSource.Configs["RemoteAdmin"].GetString("access_password", String.Empty);
66 66
67 m_app = openSim; 67 m_app = openSim;
68 m_httpd = openSim.HttpServer; 68 m_httpd = openSim.HttpServer;
diff --git a/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs b/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs
index e4bd544..60a7d27 100644
--- a/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs
+++ b/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs
@@ -203,7 +203,7 @@ namespace OpenSim.ApplicationPlugins.Rest
203 203
204 try 204 try
205 { 205 {
206 if ((_config = openSim.ConfigSource.Configs["RestPlugins"]) == null) 206 if ((_config = openSim.ConfigSource.ConfigSource.Configs["RestPlugins"]) == null)
207 { 207 {
208 m_log.WarnFormat("{0} Rest Plugins not configured", MsgID); 208 m_log.WarnFormat("{0} Rest Plugins not configured", MsgID);
209 return; 209 return;
@@ -225,7 +225,7 @@ namespace OpenSim.ApplicationPlugins.Rest
225 _prefix = _config.GetString("prefix", "/admin"); 225 _prefix = _config.GetString("prefix", "/admin");
226 226
227 // Get plugin specific config 227 // Get plugin specific config
228 _pluginConfig = openSim.ConfigSource.Configs[ConfigName]; 228 _pluginConfig = openSim.ConfigSource.ConfigSource.Configs[ConfigName];
229 229
230 230
231 m_log.InfoFormat("{0} Rest Plugins Enabled", MsgID); 231 m_log.InfoFormat("{0} Rest Plugins Enabled", MsgID);
diff --git a/OpenSim/Framework/IRegionLoader.cs b/OpenSim/Framework/IRegionLoader.cs
index 87638a9..0a952b7 100644
--- a/OpenSim/Framework/IRegionLoader.cs
+++ b/OpenSim/Framework/IRegionLoader.cs
@@ -31,7 +31,7 @@ namespace OpenSim.Framework
31{ 31{
32 public interface IRegionLoader 32 public interface IRegionLoader
33 { 33 {
34 void SetIniConfigSource(IniConfigSource configSource); 34 void SetIniConfigSource(IConfigSource configSource);
35 RegionInfo[] LoadRegions(); 35 RegionInfo[] LoadRegions();
36 } 36 }
37} \ No newline at end of file 37} \ No newline at end of file
diff --git a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs b/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs
index 0c01c5a..c345fce 100644
--- a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs
+++ b/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs
@@ -33,9 +33,9 @@ namespace OpenSim.Framework.RegionLoader.Filesystem
33{ 33{
34 public class RegionLoaderFileSystem : IRegionLoader 34 public class RegionLoaderFileSystem : IRegionLoader
35 { 35 {
36 private IniConfigSource m_configSouce; 36 private IConfigSource m_configSouce;
37 37
38 public void SetIniConfigSource(IniConfigSource configSource) 38 public void SetIniConfigSource(IConfigSource configSource)
39 { 39 {
40 m_configSouce = configSource; 40 m_configSouce = configSource;
41 } 41 }
@@ -46,7 +46,7 @@ namespace OpenSim.Framework.RegionLoader.Filesystem
46 46
47 try 47 try
48 { 48 {
49 IniConfig startupConfig = (IniConfig)m_configSouce.Configs["Startup"]; 49 IConfig startupConfig = (IConfig)m_configSouce.Configs["Startup"];
50 regionConfigPath = startupConfig.GetString("regionload_regionsdir", regionConfigPath).Trim(); 50 regionConfigPath = startupConfig.GetString("regionload_regionsdir", regionConfigPath).Trim();
51 } 51 }
52 catch (Exception) 52 catch (Exception)
diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
index 17077e7..029d396 100644
--- a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
+++ b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
@@ -39,9 +39,9 @@ namespace OpenSim.Framework.RegionLoader.Web
39 { 39 {
40 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 40 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
41 41
42 private IniConfigSource m_configSouce; 42 private IConfigSource m_configSouce;
43 43
44 public void SetIniConfigSource(IniConfigSource configSource) 44 public void SetIniConfigSource(IConfigSource configSource)
45 { 45 {
46 m_configSouce = configSource; 46 m_configSouce = configSource;
47 } 47 }
@@ -55,7 +55,7 @@ namespace OpenSim.Framework.RegionLoader.Web
55 } 55 }
56 else 56 else
57 { 57 {
58 IniConfig startupConfig = (IniConfig) m_configSouce.Configs["Startup"]; 58 IConfig startupConfig = (IConfig) m_configSouce.Configs["Startup"];
59 string url = startupConfig.GetString("regionload_webserver_url", String.Empty).Trim(); 59 string url = startupConfig.GetString("regionload_webserver_url", String.Empty).Trim();
60 if (url == String.Empty) 60 if (url == String.Empty)
61 { 61 {
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 6f1a3cb..4738dfc 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -69,7 +69,7 @@ namespace OpenSim
69 69
70 protected override void ReadConfigSettings() 70 protected override void ReadConfigSettings()
71 { 71 {
72 IConfig startupConfig = m_config.Configs["Startup"]; 72 IConfig startupConfig = m_config.ConfigSource.Configs["Startup"];
73 73
74 if (startupConfig != null) 74 if (startupConfig != null)
75 { 75 {
@@ -528,7 +528,7 @@ namespace OpenSim
528 c = DefaultConfig().AddConfig(cmdparams[1]); 528 c = DefaultConfig().AddConfig(cmdparams[1]);
529 string _value = String.Join(" ", cmdparams, 3, cmdparams.Length - 3); 529 string _value = String.Join(" ", cmdparams, 3, cmdparams.Length - 3);
530 c.Set(cmdparams[2], _value); 530 c.Set(cmdparams[2], _value);
531 m_config.Merge(c.ConfigSource); 531 m_config.ConfigSource.Merge(c.ConfigSource);
532 532
533 m_console.Error(n, n + " " + n + " " + cmdparams[1] + " " + cmdparams[2] + " " + 533 m_console.Error(n, n + " " + n + " " + cmdparams[1] + " " + cmdparams[2] + " " +
534 _value); 534 _value);
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index f205686..255a125 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -107,9 +107,10 @@ namespace OpenSim
107 107
108 protected IConfigSource m_finalConfig = null; 108 protected IConfigSource m_finalConfig = null;
109 109
110 protected IniConfigSource m_config; 110 //protected IniConfigSource m_config;
111 protected OpenSimConfigSource m_config;
111 112
112 public IniConfigSource ConfigSource 113 public OpenSimConfigSource ConfigSource
113 { 114 {
114 get { return m_config; } 115 get { return m_config; }
115 set { m_config = value; } 116 set { m_config = value; }
@@ -168,27 +169,43 @@ namespace OpenSim
168 169
169 Application.iniFilePath = startupConfig.GetString("inifile", "OpenSim.ini"); 170 Application.iniFilePath = startupConfig.GetString("inifile", "OpenSim.ini");
170 171
171 m_config = new IniConfigSource(); 172 m_config = new OpenSimConfigSource();
173 m_config.ConfigSource = new IniConfigSource();
174 IConfigSource icong;
175
172 //check for .INI file (either default or name passed in command line) 176 //check for .INI file (either default or name passed in command line)
173 if (File.Exists(Application.iniFilePath)) 177 if (File.Exists(Application.iniFilePath))
174 { 178 {
175 m_config.Merge(new IniConfigSource(Application.iniFilePath)); 179 m_config.ConfigSource.Merge(new IniConfigSource(Application.iniFilePath));
176 m_config.Merge(configSource); 180 m_config.ConfigSource.Merge(configSource);
177 } 181 }
178 else 182 else
179 { 183 {
180 Application.iniFilePath = Path.Combine(Util.configDir(), Application.iniFilePath); 184 Application.iniFilePath = Path.Combine(Util.configDir(), Application.iniFilePath);
181 if (File.Exists(Application.iniFilePath)) 185 if (File.Exists(Application.iniFilePath))
182 { 186 {
183 m_config.Merge(new IniConfigSource(Application.iniFilePath)); 187 m_config.ConfigSource.Merge(new IniConfigSource(Application.iniFilePath));
184 m_config.Merge(configSource); 188 m_config.ConfigSource.Merge(configSource);
185 } 189 }
186 else 190 else
187 { 191 {
188 // no default config files, so set default values, and save it 192 if (File.Exists("OpenSim.xml"))
189 m_config.Merge(DefaultConfig()); 193 {
190 m_config.Merge(configSource); 194 //chech for a xml config file
191 m_config.Save(Application.iniFilePath); 195 Application.iniFilePath = "OpenSim.xml";
196 m_config.ConfigSource = new XmlConfigSource();
197 m_config.ConfigSource.Merge(new XmlConfigSource(Application.iniFilePath));
198 m_config.ConfigSource.Merge(configSource);
199 }
200 else
201 {
202 //Application.iniFilePath = "OpenSim.xml";
203 // m_config.ConfigSource = new XmlConfigSource();
204 // no default config files, so set default values, and save it
205 m_config.ConfigSource.Merge(DefaultConfig());
206 m_config.ConfigSource.Merge(configSource);
207 m_config.Save(Application.iniFilePath);
208 }
192 } 209 }
193 } 210 }
194 211
@@ -277,7 +294,7 @@ namespace OpenSim
277 { 294 {
278 m_networkServersInfo = new NetworkServersInfo(); 295 m_networkServersInfo = new NetworkServersInfo();
279 296
280 IConfig startupConfig = m_config.Configs["Startup"]; 297 IConfig startupConfig = m_config.ConfigSource.Configs["Startup"];
281 298
282 if (startupConfig != null) 299 if (startupConfig != null)
283 { 300 {
@@ -306,7 +323,7 @@ namespace OpenSim
306 m_clientstackDll = startupConfig.GetString("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll"); 323 m_clientstackDll = startupConfig.GetString("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll");
307 } 324 }
308 325
309 IConfig standaloneConfig = m_config.Configs["StandAlone"]; 326 IConfig standaloneConfig = m_config.ConfigSource.Configs["StandAlone"];
310 if (standaloneConfig != null) 327 if (standaloneConfig != null)
311 { 328 {
312 m_standaloneAuthenticate = standaloneConfig.GetBoolean("accounts_authenticate", false); 329 m_standaloneAuthenticate = standaloneConfig.GetBoolean("accounts_authenticate", false);
@@ -327,7 +344,7 @@ namespace OpenSim
327 m_dumpAssetsToFile = standaloneConfig.GetBoolean("dump_assets_to_file", false); 344 m_dumpAssetsToFile = standaloneConfig.GetBoolean("dump_assets_to_file", false);
328 } 345 }
329 346
330 m_networkServersInfo.loadFromConfiguration(m_config); 347 m_networkServersInfo.loadFromConfiguration(m_config.ConfigSource);
331 } 348 }
332 349
333 /// <summary> 350 /// <summary>
@@ -380,11 +397,11 @@ namespace OpenSim
380 m_httpServer.AddStreamHandler(new SimStatusHandler()); 397 m_httpServer.AddStreamHandler(new SimStatusHandler());
381 } 398 }
382 399
383 proxyUrl = ConfigSource.Configs["Network"].GetString("proxy_url", ""); 400 proxyUrl = ConfigSource.ConfigSource.Configs["Network"].GetString("proxy_url", "");
384 proxyOffset = Int32.Parse(ConfigSource.Configs["Network"].GetString("proxy_offset", "0")); 401 proxyOffset = Int32.Parse(ConfigSource.ConfigSource.Configs["Network"].GetString("proxy_offset", "0"));
385 402
386 // Create a ModuleLoader instance 403 // Create a ModuleLoader instance
387 m_moduleLoader = new ModuleLoader(m_config); 404 m_moduleLoader = new ModuleLoader(m_config.ConfigSource);
388 405
389 ExtensionNodeList nodes = AddinManager.GetExtensionNodes("/OpenSim/Startup"); 406 ExtensionNodeList nodes = AddinManager.GetExtensionNodes("/OpenSim/Startup");
390 foreach (TypeExtensionNode node in nodes) 407 foreach (TypeExtensionNode node in nodes)
@@ -569,7 +586,7 @@ namespace OpenSim
569 return 586 return
570 new Scene(regionInfo, circuitManager, m_commsManager, sceneGridService, m_assetCache, 587 new Scene(regionInfo, circuitManager, m_commsManager, sceneGridService, m_assetCache,
571 storageManager, m_httpServer, 588 storageManager, m_httpServer,
572 m_moduleLoader, m_dumpAssetsToFile, m_physicalPrim, m_see_into_region_from_neighbor, m_config, 589 m_moduleLoader, m_dumpAssetsToFile, m_physicalPrim, m_see_into_region_from_neighbor, m_config.ConfigSource,
573 m_version); 590 m_version);
574 591
575 } 592 }
@@ -618,7 +635,7 @@ namespace OpenSim
618 635
619 protected override PhysicsScene GetPhysicsScene() 636 protected override PhysicsScene GetPhysicsScene()
620 { 637 {
621 return GetPhysicsScene(m_physicsEngine, m_meshEngineName, m_config); 638 return GetPhysicsScene(m_physicsEngine, m_meshEngineName, m_config.ConfigSource);
622 } 639 }
623 640
624 /// <summary> 641 /// <summary>
@@ -702,5 +719,24 @@ namespace OpenSim
702 regionnum = m_sceneManager.Scenes.Count; 719 regionnum = m_sceneManager.Scenes.Count;
703 } 720 }
704 } 721 }
722
723 public class OpenSimConfigSource
724 {
725 public IConfigSource ConfigSource;
726
727 public void Save(string path)
728 {
729 if (ConfigSource is IniConfigSource)
730 {
731 IniConfigSource iniCon = (IniConfigSource)ConfigSource;
732 iniCon.Save(path);
733 }
734 else if (ConfigSource is XmlConfigSource)
735 {
736 XmlConfigSource xmlCon = (XmlConfigSource)ConfigSource;
737 xmlCon.Save(path);
738 }
739 }
740 }
705} 741}
706 742