aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMW2008-11-05 17:18:16 +0000
committerMW2008-11-05 17:18:16 +0000
commit2a249373d3f3bfc07bb2f959e6211c2e8926c63d (patch)
treec1038454e41839b125fbf1012f7eaf7c359dfd2c
parent* Apply second patch in http://opensimulator.org/mantis/view.php?id=2561 (diff)
downloadopensim-SC_OLD-2a249373d3f3bfc07bb2f959e6211c2e8926c63d.zip
opensim-SC_OLD-2a249373d3f3bfc07bb2f959e6211c2e8926c63d.tar.gz
opensim-SC_OLD-2a249373d3f3bfc07bb2f959e6211c2e8926c63d.tar.bz2
opensim-SC_OLD-2a249373d3f3bfc07bb2f959e6211c2e8926c63d.tar.xz
Moved most of the configuration fields from Opensimbase to their own Class... Framework/ConfigSettings.
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/ConfigSettings.cs136
-rw-r--r--OpenSim/Region/Application/OpenSim.cs4
-rw-r--r--OpenSim/Region/Application/OpenSimBackground.cs2
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs119
4 files changed, 193 insertions, 68 deletions
diff --git a/OpenSim/Framework/ConfigSettings.cs b/OpenSim/Framework/ConfigSettings.cs
new file mode 100644
index 0000000..3671b06
--- /dev/null
+++ b/OpenSim/Framework/ConfigSettings.cs
@@ -0,0 +1,136 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Framework
6{
7 public class ConfigSettings
8 {
9 private string m_physicsEngine;
10
11 public string PhysicsEngine
12 {
13 get { return m_physicsEngine; }
14 set { m_physicsEngine = value; }
15 }
16 private string m_meshEngineName;
17
18 public string MeshEngineName
19 {
20 get { return m_meshEngineName; }
21 set { m_meshEngineName = value; }
22 }
23
24 private bool m_sandbox;
25
26 public bool Sandbox
27 {
28 get { return m_sandbox; }
29 set { m_sandbox = value; }
30 }
31
32 private bool m_see_into_region_from_neighbor;
33
34 public bool See_into_region_from_neighbor
35 {
36 get { return m_see_into_region_from_neighbor; }
37 set { m_see_into_region_from_neighbor = value; }
38 }
39
40 private string m_storageDll;
41
42 public string StorageDll
43 {
44 get { return m_storageDll; }
45 set { m_storageDll = value; }
46 }
47
48 private string m_clientstackDll;
49
50 public string ClientstackDll
51 {
52 get { return m_clientstackDll; }
53 set { m_clientstackDll = value; }
54 }
55
56 private bool m_physicalPrim;
57
58 public bool PhysicalPrim
59 {
60 get { return m_physicalPrim; }
61 set { m_physicalPrim = value; }
62 }
63
64 private bool m_standaloneAuthenticate = false;
65
66 public bool StandaloneAuthenticate
67 {
68 get { return m_standaloneAuthenticate; }
69 set { m_standaloneAuthenticate = value; }
70 }
71
72 private string m_standaloneWelcomeMessage = null;
73
74 public string StandaloneWelcomeMessage
75 {
76 get { return m_standaloneWelcomeMessage; }
77 set { m_standaloneWelcomeMessage = value; }
78 }
79
80 private string m_standaloneInventoryPlugin;
81
82 public string StandaloneInventoryPlugin
83 {
84 get { return m_standaloneInventoryPlugin; }
85 set { m_standaloneInventoryPlugin = value; }
86 }
87
88 private string m_standaloneAssetPlugin;
89
90 public string StandaloneAssetPlugin
91 {
92 get { return m_standaloneAssetPlugin; }
93 set { m_standaloneAssetPlugin = value; }
94 }
95
96 private string m_standaloneUserPlugin;
97
98 public string StandaloneUserPlugin
99 {
100 get { return m_standaloneUserPlugin; }
101 set { m_standaloneUserPlugin = value; }
102 }
103
104 private string m_standaloneInventorySource;
105
106 public string StandaloneInventorySource
107 {
108 get { return m_standaloneInventorySource; }
109 set { m_standaloneInventorySource = value; }
110 }
111
112 private string m_standaloneAssetSource;
113
114 public string StandaloneAssetSource
115 {
116 get { return m_standaloneAssetSource; }
117 set { m_standaloneAssetSource = value; }
118 }
119
120 private string m_standaloneUserSource;
121
122 public string StandaloneUserSource
123 {
124 get { return m_standaloneUserSource; }
125 set { m_standaloneUserSource = value; }
126 }
127
128 private string m_assetStorage = "local";
129
130 public string AssetStorage
131 {
132 get { return m_assetStorage; }
133 set { m_assetStorage = value; }
134 }
135 }
136}
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 9d3bcda..d2af16f 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", (m_sandbox ? "sandbox" : "grid")); 93 m_log.InfoFormat("[OPENSIM MAIN]: Running in {0} mode", (ConfigurationSettings.Sandbox ? "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 (m_sandbox) 645 if (ConfigurationSettings.Sandbox)
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 bfecf3b..ed5680b 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", m_sandbox ? "sandbox" : "grid"); 59 m_log.InfoFormat("[OPENSIM MAIN]: Running in background {0} mode", ConfigurationSettings.Sandbox ? "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 200c7bf..39991dc 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -76,35 +76,19 @@ namespace OpenSim
76 /// </summary> 76 /// </summary>
77 protected const string DEFAULT_INV_BACKUP_FILENAME = "opensim_inv.tar.gz"; 77 protected const string DEFAULT_INV_BACKUP_FILENAME = "opensim_inv.tar.gz";
78 78
79 public string m_physicsEngine; 79 protected ConfigSettings m_configSettings = new ConfigSettings();
80 public string m_meshEngineName;
81 public bool m_sandbox;
82 public bool user_accounts;
83 public bool m_gridLocalAsset;
84 public bool m_see_into_region_from_neighbor;
85 80
86 protected GridInfoService m_gridInfoService; 81 public ConfigSettings ConfigurationSettings
82 {
83 get { return m_configSettings; }
84 set { m_configSettings = value; }
85 }
87 86
88 protected string m_storageDll; 87 protected GridInfoService m_gridInfoService;
89 protected string m_clientstackDll;
90 88
91 protected List<IClientNetworkServer> m_clientServers = new List<IClientNetworkServer>(); 89 protected List<IClientNetworkServer> m_clientServers = new List<IClientNetworkServer>();
92 protected List<RegionInfo> m_regionData = new List<RegionInfo>(); 90 protected List<RegionInfo> m_regionData = new List<RegionInfo>();
93 91
94 protected bool m_physicalPrim;
95
96 protected bool m_standaloneAuthenticate = false;
97 protected string m_standaloneWelcomeMessage = null;
98 protected string m_standaloneInventoryPlugin;
99 protected string m_standaloneAssetPlugin;
100 protected string m_standaloneUserPlugin;
101
102 private string m_standaloneInventorySource;
103 private string m_standaloneAssetSource;
104 private string m_standaloneUserSource;
105
106 protected string m_assetStorage = "local";
107
108 public ConsoleCommand CreateAccount = null; 92 public ConsoleCommand CreateAccount = null;
109 protected bool m_dumpAssetsToFile; 93 protected bool m_dumpAssetsToFile;
110 94
@@ -154,8 +138,13 @@ namespace OpenSim
154 /// <param name="configSource"></param> 138 /// <param name="configSource"></param>
155 public OpenSimBase(IConfigSource configSource) : base() 139 public OpenSimBase(IConfigSource configSource) : base()
156 { 140 {
141 LoadConfigSettings(configSource);
142 }
143
144 protected void LoadConfigSettings(IConfigSource configSource)
145 {
157 bool iniFileExists = false; 146 bool iniFileExists = false;
158 147
159 IConfig startupConfig = configSource.Configs["Startup"]; 148 IConfig startupConfig = configSource.Configs["Startup"];
160 149
161 string iniFileName = startupConfig.GetString("inifile", "OpenSim.ini"); 150 string iniFileName = startupConfig.GetString("inifile", "OpenSim.ini");
@@ -166,8 +155,8 @@ namespace OpenSim
166 155
167 m_config = new OpenSimConfigSource(); 156 m_config = new OpenSimConfigSource();
168 m_config.Source = new IniConfigSource(); 157 m_config.Source = new IniConfigSource();
169 m_config.Source.Merge(DefaultConfig()); 158 m_config.Source.Merge(DefaultConfig());
170 159
171 //check for .INI file (either default or name passed in command line) 160 //check for .INI file (either default or name passed in command line)
172 if (File.Exists(masterfilePath)) 161 if (File.Exists(masterfilePath))
173 { 162 {
@@ -177,24 +166,24 @@ namespace OpenSim
177 if (File.Exists(Application.iniFilePath)) 166 if (File.Exists(Application.iniFilePath))
178 { 167 {
179 iniFileExists = true; 168 iniFileExists = true;
180 169
181 // From reading Nini's code, it seems that later merged keys replace earlier ones. 170 // From reading Nini's code, it seems that later merged keys replace earlier ones.
182 m_config.Source.Merge(new IniConfigSource(Application.iniFilePath)); 171 m_config.Source.Merge(new IniConfigSource(Application.iniFilePath));
183 } 172 }
184 else 173 else
185 { 174 {
186 // check for a xml config file 175 // check for a xml config file
187 Application.iniFilePath = Path.Combine(Util.configDir(), "OpenSim.xml"); 176 Application.iniFilePath = Path.Combine(Util.configDir(), "OpenSim.xml");
188 177
189 if (File.Exists(Application.iniFilePath)) 178 if (File.Exists(Application.iniFilePath))
190 { 179 {
191 iniFileExists = true; 180 iniFileExists = true;
192 181
193 m_config.Source = new XmlConfigSource(); 182 m_config.Source = new XmlConfigSource();
194 m_config.Source.Merge(new XmlConfigSource(Application.iniFilePath)); 183 m_config.Source.Merge(new XmlConfigSource(Application.iniFilePath));
195 } 184 }
196 } 185 }
197 186
198 m_config.Source.Merge(configSource); 187 m_config.Source.Merge(configSource);
199 188
200 if (!iniFileExists) 189 if (!iniFileExists)
@@ -282,40 +271,40 @@ namespace OpenSim
282 271
283 if (startupConfig != null) 272 if (startupConfig != null)
284 { 273 {
285 m_sandbox = !startupConfig.GetBoolean("gridmode"); 274 m_configSettings.Sandbox = !startupConfig.GetBoolean("gridmode");
286 m_physicsEngine = startupConfig.GetString("physics"); 275 m_configSettings.PhysicsEngine = startupConfig.GetString("physics");
287 m_meshEngineName = startupConfig.GetString("meshing"); 276 m_configSettings.MeshEngineName = startupConfig.GetString("meshing");
288 277
289 m_physicalPrim = startupConfig.GetBoolean("physical_prim"); 278 m_configSettings.PhysicalPrim = startupConfig.GetBoolean("physical_prim");
290 279
291 m_see_into_region_from_neighbor = startupConfig.GetBoolean("see_into_this_sim_from_neighbor"); 280 m_configSettings.See_into_region_from_neighbor = startupConfig.GetBoolean("see_into_this_sim_from_neighbor");
292 281
293 m_storageDll = startupConfig.GetString("storage_plugin"); 282 m_configSettings.StorageDll = startupConfig.GetString("storage_plugin");
294 if (m_storageDll == "OpenSim.DataStore.MonoSqlite.dll") 283 if (m_configSettings.StorageDll == "OpenSim.DataStore.MonoSqlite.dll")
295 { 284 {
296 m_storageDll = "OpenSim.Data.SQLite.dll"; 285 m_configSettings.StorageDll = "OpenSim.Data.SQLite.dll";
297 Console.WriteLine("WARNING: OpenSim.DataStore.MonoSqlite.dll is deprecated. Set storage_plugin to OpenSim.Data.SQLite.dll."); 286 Console.WriteLine("WARNING: OpenSim.DataStore.MonoSqlite.dll is deprecated. Set storage_plugin to OpenSim.Data.SQLite.dll.");
298 Thread.Sleep(3000); 287 Thread.Sleep(3000);
299 } 288 }
300 289
301 m_storageConnectionString = startupConfig.GetString("storage_connection_string"); 290 m_storageConnectionString = startupConfig.GetString("storage_connection_string");
302 m_estateConnectionString = startupConfig.GetString("estate_connection_string", m_storageConnectionString); 291 m_estateConnectionString = startupConfig.GetString("estate_connection_string", m_storageConnectionString);
303 m_assetStorage = startupConfig.GetString("asset_database"); 292 m_configSettings.AssetStorage = startupConfig.GetString("asset_database");
304 m_clientstackDll = startupConfig.GetString("clientstack_plugin"); 293 m_configSettings.ClientstackDll = startupConfig.GetString("clientstack_plugin");
305 } 294 }
306 295
307 IConfig standaloneConfig = m_config.Source.Configs["StandAlone"]; 296 IConfig standaloneConfig = m_config.Source.Configs["StandAlone"];
308 if (standaloneConfig != null) 297 if (standaloneConfig != null)
309 { 298 {
310 m_standaloneAuthenticate = standaloneConfig.GetBoolean("accounts_authenticate"); 299 m_configSettings.StandaloneAuthenticate = standaloneConfig.GetBoolean("accounts_authenticate");
311 m_standaloneWelcomeMessage = standaloneConfig.GetString("welcome_message"); 300 m_configSettings.StandaloneWelcomeMessage = standaloneConfig.GetString("welcome_message");
312 301
313 m_standaloneInventoryPlugin = standaloneConfig.GetString("inventory_plugin"); 302 m_configSettings.StandaloneInventoryPlugin = standaloneConfig.GetString("inventory_plugin");
314 m_standaloneInventorySource = standaloneConfig.GetString("inventory_source"); 303 m_configSettings.StandaloneInventorySource = standaloneConfig.GetString("inventory_source");
315 m_standaloneUserPlugin = standaloneConfig.GetString("userDatabase_plugin"); 304 m_configSettings.StandaloneUserPlugin = standaloneConfig.GetString("userDatabase_plugin");
316 m_standaloneUserSource = standaloneConfig.GetString("user_source"); 305 m_configSettings.StandaloneUserSource = standaloneConfig.GetString("user_source");
317 m_standaloneAssetPlugin = standaloneConfig.GetString("asset_plugin"); 306 m_configSettings.StandaloneAssetPlugin = standaloneConfig.GetString("asset_plugin");
318 m_standaloneAssetSource = standaloneConfig.GetString("asset_source"); 307 m_configSettings.StandaloneAssetSource = standaloneConfig.GetString("asset_source");
319 308
320 m_dumpAssetsToFile = standaloneConfig.GetBoolean("dump_assets_to_file"); 309 m_dumpAssetsToFile = standaloneConfig.GetBoolean("dump_assets_to_file");
321 } 310 }
@@ -345,22 +334,22 @@ namespace OpenSim
345 LibraryRootFolder libraryRootFolder = new LibraryRootFolder(); 334 LibraryRootFolder libraryRootFolder = new LibraryRootFolder();
346 335
347 // StandAlone mode? m_sandbox is determined by !startupConfig.GetBoolean("gridmode", false) 336 // StandAlone mode? m_sandbox is determined by !startupConfig.GetBoolean("gridmode", false)
348 if (m_sandbox) 337 if (m_configSettings.Sandbox)
349 { 338 {
350 LocalInventoryService inventoryService = new LocalInventoryService(); 339 LocalInventoryService inventoryService = new LocalInventoryService();
351 inventoryService.AddPlugin(m_standaloneInventoryPlugin, m_standaloneInventorySource); 340 inventoryService.AddPlugin(m_configSettings.StandaloneInventoryPlugin, m_configSettings.StandaloneInventorySource);
352 341
353 LocalUserServices userService = 342 LocalUserServices userService =
354 new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX, 343 new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX,
355 m_networkServersInfo.DefaultHomeLocY, inventoryService); 344 m_networkServersInfo.DefaultHomeLocY, inventoryService);
356 userService.AddPlugin(m_standaloneUserPlugin, m_standaloneUserSource); 345 userService.AddPlugin(m_configSettings.StandaloneUserPlugin, m_configSettings.StandaloneUserSource);
357 346
358 LocalBackEndServices backendService = new LocalBackEndServices(); 347 LocalBackEndServices backendService = new LocalBackEndServices();
359 348
360 LocalLoginService loginService = 349 LocalLoginService loginService =
361 new LocalLoginService( 350 new LocalLoginService(
362 userService, m_standaloneWelcomeMessage, inventoryService, backendService, m_networkServersInfo, 351 userService, m_configSettings.StandaloneWelcomeMessage, inventoryService, backendService, m_networkServersInfo,
363 m_standaloneAuthenticate, libraryRootFolder); 352 m_configSettings.StandaloneAuthenticate, libraryRootFolder);
364 353
365 m_commsManager 354 m_commsManager
366 = new CommunicationsLocal( 355 = new CommunicationsLocal(
@@ -413,27 +402,27 @@ namespace OpenSim
413 m_httpServerPort = m_networkServersInfo.HttpListenerPort; 402 m_httpServerPort = m_networkServersInfo.HttpListenerPort;
414 403
415 IAssetServer assetServer; 404 IAssetServer assetServer;
416 if (m_assetStorage == "grid") 405 if (m_configSettings.AssetStorage == "grid")
417 { 406 {
418 assetServer = new GridAssetClient(m_networkServersInfo.AssetURL); 407 assetServer = new GridAssetClient(m_networkServersInfo.AssetURL);
419 } 408 }
420 else if (m_assetStorage == "cryptogrid") // Decrypt-Only 409 else if (m_configSettings.AssetStorage == "cryptogrid") // Decrypt-Only
421 { 410 {
422 assetServer = new CryptoGridAssetClient(m_networkServersInfo.AssetURL, 411 assetServer = new CryptoGridAssetClient(m_networkServersInfo.AssetURL,
423 Environment.CurrentDirectory, true); 412 Environment.CurrentDirectory, true);
424 } 413 }
425 else if (m_assetStorage == "cryptogrid_eou") // Encrypts All Assets 414 else if (m_configSettings.AssetStorage == "cryptogrid_eou") // Encrypts All Assets
426 { 415 {
427 assetServer = new CryptoGridAssetClient(m_networkServersInfo.AssetURL, 416 assetServer = new CryptoGridAssetClient(m_networkServersInfo.AssetURL,
428 Environment.CurrentDirectory, false); 417 Environment.CurrentDirectory, false);
429 } 418 }
430 else if (m_assetStorage == "file") 419 else if (m_configSettings.AssetStorage == "file")
431 { 420 {
432 assetServer = new FileAssetClient(m_networkServersInfo.AssetURL); 421 assetServer = new FileAssetClient(m_networkServersInfo.AssetURL);
433 } 422 }
434 else 423 else
435 { 424 {
436 SQLAssetServer sqlAssetServer = new SQLAssetServer(m_standaloneAssetPlugin, m_standaloneAssetSource); 425 SQLAssetServer sqlAssetServer = new SQLAssetServer(m_configSettings.StandaloneAssetPlugin, m_configSettings.StandaloneAssetSource);
437 sqlAssetServer.LoadDefaultAssets(); 426 sqlAssetServer.LoadDefaultAssets();
438 assetServer = sqlAssetServer; 427 assetServer = sqlAssetServer;
439 } 428 }
@@ -587,12 +576,12 @@ namespace OpenSim
587 576
588 protected override StorageManager CreateStorageManager(string connectionstring, string estateconnectionstring) 577 protected override StorageManager CreateStorageManager(string connectionstring, string estateconnectionstring)
589 { 578 {
590 return new StorageManager(m_storageDll, connectionstring, estateconnectionstring); 579 return new StorageManager(m_configSettings.StorageDll, connectionstring, estateconnectionstring);
591 } 580 }
592 581
593 protected override ClientStackManager CreateClientStackManager() 582 protected override ClientStackManager CreateClientStackManager()
594 { 583 {
595 return new ClientStackManager(m_clientstackDll); 584 return new ClientStackManager(m_configSettings.ClientstackDll);
596 } 585 }
597 586
598 protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, 587 protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
@@ -602,7 +591,7 @@ namespace OpenSim
602 return 591 return
603 new Scene(regionInfo, circuitManager, m_commsManager, sceneGridService, m_assetCache, 592 new Scene(regionInfo, circuitManager, m_commsManager, sceneGridService, m_assetCache,
604 storageManager, m_httpServer, 593 storageManager, m_httpServer,
605 m_moduleLoader, m_dumpAssetsToFile, m_physicalPrim, m_see_into_region_from_neighbor, m_config.Source, 594 m_moduleLoader, m_dumpAssetsToFile, m_configSettings.PhysicalPrim, m_configSettings.See_into_region_from_neighbor, m_config.Source,
606 m_version); 595 m_version);
607 } 596 }
608 597
@@ -650,7 +639,7 @@ namespace OpenSim
650 639
651 protected override PhysicsScene GetPhysicsScene() 640 protected override PhysicsScene GetPhysicsScene()
652 { 641 {
653 return GetPhysicsScene(m_physicsEngine, m_meshEngineName, m_config.Source); 642 return GetPhysicsScene(m_configSettings.PhysicsEngine, m_configSettings.MeshEngineName, m_config.Source);
654 } 643 }
655 644
656 /// <summary> 645 /// <summary>