aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Application/OpenSimBase.cs
diff options
context:
space:
mode:
authorlbsa712009-03-10 20:27:41 +0000
committerlbsa712009-03-10 20:27:41 +0000
commit91a096dca6adc62bb6b185d391a8d2181291e9a3 (patch)
tree748fdbd1eee8a4bb907481241c0a19664b309b11 /OpenSim/Region/Application/OpenSimBase.cs
parent* Cleanup and CCC (Code Convention Conformance) (diff)
downloadopensim-SC-91a096dca6adc62bb6b185d391a8d2181291e9a3.zip
opensim-SC-91a096dca6adc62bb6b185d391a8d2181291e9a3.tar.gz
opensim-SC-91a096dca6adc62bb6b185d391a8d2181291e9a3.tar.bz2
opensim-SC-91a096dca6adc62bb6b185d391a8d2181291e9a3.tar.xz
* Cleanup and CCC (Code Convention Conformance)
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs153
1 files changed, 79 insertions, 74 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 32b1258..b979bdc 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -41,8 +41,6 @@ using OpenSim.Framework.Console;
41using OpenSim.Framework.Servers; 41using OpenSim.Framework.Servers;
42using OpenSim.Framework.Statistics; 42using OpenSim.Framework.Statistics;
43using OpenSim.Region.ClientStack; 43using OpenSim.Region.ClientStack;
44using OpenSim.Region.Communications.Local;
45using OpenSim.Region.Communications.OGS1;
46using OpenSim.Region.Framework; 44using OpenSim.Region.Framework;
47using OpenSim.Region.Framework.Interfaces; 45using OpenSim.Region.Framework.Interfaces;
48using OpenSim.Region.Framework.Scenes; 46using OpenSim.Region.Framework.Scenes;
@@ -60,7 +58,7 @@ namespace OpenSim
60 // These are the names of the plugin-points extended by this 58 // These are the names of the plugin-points extended by this
61 // class during system startup. 59 // class during system startup.
62 60
63 private const string PLUGIN_ASSET_CACHE = "/OpenSim/AssetCache"; 61 private const string PLUGIN_ASSET_CACHE = "/OpenSim/AssetCache";
64 private const string PLUGIN_ASSET_SERVER_CLIENT = "/OpenSim/AssetClient"; 62 private const string PLUGIN_ASSET_SERVER_CLIENT = "/OpenSim/AssetClient";
65 63
66 protected string proxyUrl; 64 protected string proxyUrl;
@@ -77,20 +75,21 @@ namespace OpenSim
77 /// The file used to load and save an opensim archive if no filename has been specified 75 /// The file used to load and save an opensim archive if no filename has been specified
78 /// </summary> 76 /// </summary>
79 protected const string DEFAULT_OAR_BACKUP_FILENAME = "scene.oar.tar.gz"; 77 protected const string DEFAULT_OAR_BACKUP_FILENAME = "scene.oar.tar.gz";
80 78
81 public ConfigSettings ConfigurationSettings 79 public ConfigSettings ConfigurationSettings
82 { 80 {
83 get { return m_configSettings; } 81 get { return m_configSettings; }
84 set { m_configSettings = value; } 82 set { m_configSettings = value; }
85 } 83 }
84
86 protected ConfigSettings m_configSettings; 85 protected ConfigSettings m_configSettings;
87 86
88 protected ConfigurationLoader m_configLoader; 87 protected ConfigurationLoader m_configLoader;
89 88
90 protected GridInfoService m_gridInfoService; 89 protected GridInfoService m_gridInfoService;
91 90
92 public ConsoleCommand CreateAccount = null; 91 public ConsoleCommand CreateAccount = null;
93 92
94 protected List<IApplicationPlugin> m_plugins = new List<IApplicationPlugin>(); 93 protected List<IApplicationPlugin> m_plugins = new List<IApplicationPlugin>();
95 94
96 /// <value> 95 /// <value>
@@ -101,13 +100,15 @@ namespace OpenSim
101 get { return m_config; } 100 get { return m_config; }
102 set { m_config = value; } 101 set { m_config = value; }
103 } 102 }
103
104 protected OpenSimConfigSource m_config; 104 protected OpenSimConfigSource m_config;
105 105
106 public List<IClientNetworkServer> ClientServers 106 public List<IClientNetworkServer> ClientServers
107 { 107 {
108 get { return m_clientServers; } 108 get { return m_clientServers; }
109 } 109 }
110 protected List<IClientNetworkServer> m_clientServers = new List<IClientNetworkServer>(); 110
111 protected List<IClientNetworkServer> m_clientServers = new List<IClientNetworkServer>();
111 112
112 public new BaseHttpServer HttpServer 113 public new BaseHttpServer HttpServer
113 { 114 {
@@ -117,13 +118,14 @@ namespace OpenSim
117 public uint HttpServerPort 118 public uint HttpServerPort
118 { 119 {
119 get { return m_httpServerPort; } 120 get { return m_httpServerPort; }
120 } 121 }
121 122
122 public ModuleLoader ModuleLoader 123 public ModuleLoader ModuleLoader
123 { 124 {
124 get { return m_moduleLoader; } 125 get { return m_moduleLoader; }
125 set { m_moduleLoader = value; } 126 set { m_moduleLoader = value; }
126 } 127 }
128
127 protected ModuleLoader m_moduleLoader; 129 protected ModuleLoader m_moduleLoader;
128 130
129 protected IRegistryCore m_applicationRegistry = new RegistryCore(); 131 protected IRegistryCore m_applicationRegistry = new RegistryCore();
@@ -167,17 +169,17 @@ namespace OpenSim
167 loader.Load("/OpenSim/Startup"); 169 loader.Load("/OpenSim/Startup");
168 m_plugins = loader.Plugins; 170 m_plugins = loader.Plugins;
169 } 171 }
170 172
171 protected override List<string> GetHelpTopics() 173 protected override List<string> GetHelpTopics()
172 { 174 {
173 List<string> topics = base.GetHelpTopics(); 175 List<string> topics = base.GetHelpTopics();
174 Scene s = SceneManager.CurrentOrFirstScene; 176 Scene s = SceneManager.CurrentOrFirstScene;
175 if (s != null && s.GetCommanders() != null) 177 if (s != null && s.GetCommanders() != null)
176 topics.AddRange(s.GetCommanders().Keys); 178 topics.AddRange(s.GetCommanders().Keys);
177 179
178 return topics; 180 return topics;
179 } 181 }
180 182
181 /// <summary> 183 /// <summary>
182 /// Performs startup specific to the region server, including initialization of the scene 184 /// Performs startup specific to the region server, including initialization of the scene
183 /// such as loading configuration from disk. 185 /// such as loading configuration from disk.
@@ -185,18 +187,18 @@ namespace OpenSim
185 protected override void StartupSpecific() 187 protected override void StartupSpecific()
186 { 188 {
187 base.StartupSpecific(); 189 base.StartupSpecific();
188 190
189 m_stats = StatsManager.StartCollectingSimExtraStats(); 191 m_stats = StatsManager.StartCollectingSimExtraStats();
190 192
191 // Create a ModuleLoader instance 193 // Create a ModuleLoader instance
192 m_moduleLoader = new ModuleLoader(m_config.Source); 194 m_moduleLoader = new ModuleLoader(m_config.Source);
193 195
194 LoadPlugins(); 196 LoadPlugins();
195 foreach (IApplicationPlugin plugin in m_plugins) 197 foreach (IApplicationPlugin plugin in m_plugins)
196 { 198 {
197 plugin.PostInitialise(); 199 plugin.PostInitialise();
198 } 200 }
199 201
200 // Only enable logins to the regions once we have completely finished starting up (apart from scripts) 202 // Only enable logins to the regions once we have completely finished starting up (apart from scripts)
201 if ((m_commsManager != null) && (m_commsManager.GridService != null)) 203 if ((m_commsManager != null) && (m_commsManager.GridService != null))
202 { 204 {
@@ -216,14 +218,14 @@ namespace OpenSim
216 foreach (string topic in topics) 218 foreach (string topic in topics)
217 { 219 {
218 m_console.Commands.AddCommand("plugin", false, "help " + topic, 220 m_console.Commands.AddCommand("plugin", false, "help " + topic,
219 "help " + topic, 221 "help " + topic,
220 "Get help on plugin command '" + topic + "'", 222 "Get help on plugin command '" + topic + "'",
221 HandleCommanderHelp); 223 HandleCommanderHelp);
222 224
223 m_console.Commands.AddCommand("plugin", false, topic, 225 m_console.Commands.AddCommand("plugin", false, topic,
224 topic, 226 topic,
225 "Execute subcommand for plugin '" + topic + "'", 227 "Execute subcommand for plugin '" + topic + "'",
226 null); 228 null);
227 229
228 ICommander commander = null; 230 ICommander commander = null;
229 231
@@ -241,9 +243,9 @@ namespace OpenSim
241 foreach (string command in commander.Commands.Keys) 243 foreach (string command in commander.Commands.Keys)
242 { 244 {
243 m_console.Commands.AddCommand(topic, false, 245 m_console.Commands.AddCommand(topic, false,
244 topic + " " + command, 246 topic + " " + command,
245 topic + " " + commander.Commands[command].ShortHelp(), 247 topic + " " + commander.Commands[command].ShortHelp(),
246 String.Empty, HandleCommanderCommand); 248 String.Empty, HandleCommanderCommand);
247 } 249 }
248 } 250 }
249 } 251 }
@@ -288,80 +290,82 @@ namespace OpenSim
288 { 290 {
289 LegacyAssetClientPluginInitialiser linit = null; 291 LegacyAssetClientPluginInitialiser linit = null;
290 CryptoAssetClientPluginInitialiser cinit = null; 292 CryptoAssetClientPluginInitialiser cinit = null;
291 AssetClientPluginInitialiser init = null; 293 AssetClientPluginInitialiser init = null;
292 294
293 IAssetServer assetServer = null; 295 IAssetServer assetServer = null;
294 string mode = m_configSettings.AssetStorage; 296 string mode = m_configSettings.AssetStorage;
295 297
296 if (mode == null | mode == String.Empty) 298 if (mode == null | mode == String.Empty)
297 mode = "default"; 299 mode = "default";
298 300
299 // If "default" is specified, then the value is adjusted 301 // If "default" is specified, then the value is adjusted
300 // according to whether or not the server is running in 302 // according to whether or not the server is running in
301 // standalone mode. 303 // standalone mode.
302 if (mode.ToLower() == "default") 304 if (mode.ToLower() == "default")
303 { 305 {
304 if (m_configSettings.Standalone == false) 306 if (m_configSettings.Standalone == false)
305 mode = "grid"; 307 mode = "grid";
306 else 308 else
307 mode = "local"; 309 mode = "local";
308 } 310 }
309 311
310 switch (mode.ToLower()) 312 switch (mode.ToLower())
311 { 313 {
312 // If grid is specified then the grid server is chose regardless 314 // If grid is specified then the grid server is chose regardless
313 // of whether the server is standalone. 315 // of whether the server is standalone.
314 case "grid" : 316 case "grid":
315 linit = new LegacyAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL); 317 linit = new LegacyAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL);
316 assetServer = loadAssetServer("Grid", linit); 318 assetServer = loadAssetServer("Grid", linit);
317 break; 319 break;
318 320
319 // If cryptogrid is specified then the cryptogrid server is chose regardless 321 // If cryptogrid is specified then the cryptogrid server is chose regardless
320 // of whether the server is standalone. 322 // of whether the server is standalone.
321 case "cryptogrid" : 323 case "cryptogrid":
322 cinit = new CryptoAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL, 324 cinit = new CryptoAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL,
323 Environment.CurrentDirectory, true); 325 Environment.CurrentDirectory, true);
324 assetServer = loadAssetServer("Crypto", cinit); 326 assetServer = loadAssetServer("Crypto", cinit);
325 break; 327 break;
326 328
327 // If cryptogrid_eou is specified then the cryptogrid_eou server is chose regardless 329 // If cryptogrid_eou is specified then the cryptogrid_eou server is chose regardless
328 // of whether the server is standalone. 330 // of whether the server is standalone.
329 case "cryptogrid_eou" : 331 case "cryptogrid_eou":
330 cinit = new CryptoAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL, 332 cinit = new CryptoAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL,
331 Environment.CurrentDirectory, false); 333 Environment.CurrentDirectory, false);
332 assetServer = loadAssetServer("Crypto", cinit); 334 assetServer = loadAssetServer("Crypto", cinit);
333 break; 335 break;
334 336
335 // If file is specified then the file server is chose regardless 337 // If file is specified then the file server is chose regardless
336 // of whether the server is standalone. 338 // of whether the server is standalone.
337 case "file" : 339 case "file":
338 linit = new LegacyAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL); 340 linit = new LegacyAssetClientPluginInitialiser(m_configSettings, m_networkServersInfo.AssetURL);
339 assetServer = loadAssetServer("File", linit); 341 assetServer = loadAssetServer("File", linit);
340 break; 342 break;
341 343
342 // If local is specified then we're going to use the local SQL server 344 // If local is specified then we're going to use the local SQL server
343 // implementation. We drop through, because that will be the fallback 345 // implementation. We drop through, because that will be the fallback
344 // for the following default clause too. 346 // for the following default clause too.
345 case "local" : 347 case "local":
346 break; 348 break;
347 349
348 // If the asset_database value is none of the previously mentioned strings, then we 350 // If the asset_database value is none of the previously mentioned strings, then we
349 // try to load a turnkey plugin that matches this value. If not we drop through to 351 // try to load a turnkey plugin that matches this value. If not we drop through to
350 // a local default. 352 // a local default.
351 default : 353 default:
352 try 354 try
353 { 355 {
354 init = new AssetClientPluginInitialiser(m_configSettings); 356 init = new AssetClientPluginInitialiser(m_configSettings);
355 assetServer = loadAssetServer(m_configSettings.AssetStorage, init); 357 assetServer = loadAssetServer(m_configSettings.AssetStorage, init);
356 break; 358 break;
357 } 359 }
358 catch {} 360 catch
361 {
362 }
359 m_log.Info("[OPENSIMBASE] Default assetserver will be used"); 363 m_log.Info("[OPENSIMBASE] Default assetserver will be used");
360 break; 364 break;
361 } 365 }
362 366
363 // Open the local SQL-based database asset server 367 // Open the local SQL-based database asset server
364 if (assetServer == null) 368 if (assetServer == null)
365 { 369 {
366 init = new AssetClientPluginInitialiser(m_configSettings); 370 init = new AssetClientPluginInitialiser(m_configSettings);
367 SQLAssetServer sqlAssetServer = (SQLAssetServer) loadAssetServer("SQL", init); 371 SQLAssetServer sqlAssetServer = (SQLAssetServer) loadAssetServer("SQL", init);
@@ -426,7 +430,7 @@ namespace OpenSim
426 loader.AddFilter(PLUGIN_ASSET_CACHE, new PluginProviderFilter(m_configSettings.AssetCache)); 430 loader.AddFilter(PLUGIN_ASSET_CACHE, new PluginProviderFilter(m_configSettings.AssetCache));
427 431
428 loader.Load(PLUGIN_ASSET_CACHE); 432 loader.Load(PLUGIN_ASSET_CACHE);
429 if (loader.Plugins.Count > 0) 433 if (loader.Plugins.Count > 0)
430 assetCache = (IAssetCache) loader.Plugins[0]; 434 assetCache = (IAssetCache) loader.Plugins[0];
431 } 435 }
432 catch (Exception e) 436 catch (Exception e)
@@ -450,8 +454,8 @@ namespace OpenSim
450 else 454 else
451 { 455 {
452 m_log.Info("[Login] Login are now disabled "); 456 m_log.Info("[Login] Login are now disabled ");
453 m_commsManager.GridService.RegionLoginsEnabled = false; 457 m_commsManager.GridService.RegionLoginsEnabled = false;
454 } 458 }
455 } 459 }
456 460
457 /// <summary> 461 /// <summary>
@@ -511,16 +515,16 @@ namespace OpenSim
511 m_log.Info("[MODULES]: Loading Region's modules"); 515 m_log.Info("[MODULES]: Loading Region's modules");
512 516
513 List<IRegionModule> modules = m_moduleLoader.PickupModules(scene, "."); 517 List<IRegionModule> modules = m_moduleLoader.PickupModules(scene, ".");
514 518
515 // This needs to be ahead of the script engine load, so the 519 // This needs to be ahead of the script engine load, so the
516 // script module can pick up events exposed by a module 520 // script module can pick up events exposed by a module
517 m_moduleLoader.InitialiseSharedModules(scene); 521 m_moduleLoader.InitialiseSharedModules(scene);
518 522
519 scene.SetModuleInterfaces(); 523 scene.SetModuleInterfaces();
520 524
521 // Prims have to be loaded after module configuration since some modules may be invoked during the load 525 // Prims have to be loaded after module configuration since some modules may be invoked during the load
522 scene.LoadPrimsFromStorage(regionInfo.originRegionID); 526 scene.LoadPrimsFromStorage(regionInfo.originRegionID);
523 527
524 scene.StartTimer(); 528 scene.StartTimer();
525 529
526 // moved these here as the terrain texture has to be created after the modules are initialized 530 // moved these here as the terrain texture has to be created after the modules are initialized
@@ -576,11 +580,11 @@ namespace OpenSim
576 { 580 {
577 m_sceneManager.TrySetCurrentScene(".."); 581 m_sceneManager.TrySetCurrentScene("..");
578 } 582 }
579 583
580 scene.DeleteAllSceneObjects(); 584 scene.DeleteAllSceneObjects();
581 m_sceneManager.CloseScene(scene); 585 m_sceneManager.CloseScene(scene);
582 586
583 if (!cleanup) 587 if (!cleanup)
584 return; 588 return;
585 589
586 if (!String.IsNullOrEmpty(scene.RegionInfo.RegionFile)) 590 if (!String.IsNullOrEmpty(scene.RegionInfo.RegionFile))
@@ -624,7 +628,7 @@ namespace OpenSim
624 //if (!IPAddress.TryParse(regionInfo.InternalEndPoint, out listenIP)) 628 //if (!IPAddress.TryParse(regionInfo.InternalEndPoint, out listenIP))
625 // listenIP = IPAddress.Parse("0.0.0.0"); 629 // listenIP = IPAddress.Parse("0.0.0.0");
626 630
627 uint port = (uint)regionInfo.InternalEndPoint.Port; 631 uint port = (uint) regionInfo.InternalEndPoint.Port;
628 632
629 if (m_autoCreateClientStack) 633 if (m_autoCreateClientStack)
630 { 634 {
@@ -638,7 +642,7 @@ namespace OpenSim
638 clientServer = null; 642 clientServer = null;
639 } 643 }
640 644
641 regionInfo.InternalEndPoint.Port = (int)port; 645 regionInfo.InternalEndPoint.Port = (int) port;
642 646
643 Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager); 647 Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager);
644 648
@@ -651,7 +655,7 @@ namespace OpenSim
651 655
652 scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName); 656 scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName);
653 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); 657 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
654 scene.PhysicsScene.SetWaterLevel((float)regionInfo.RegionSettings.WaterHeight); 658 scene.PhysicsScene.SetWaterLevel((float) regionInfo.RegionSettings.WaterHeight);
655 659
656 // TODO: Remove this cruft once MasterAvatar is fully deprecated 660 // TODO: Remove this cruft once MasterAvatar is fully deprecated
657 //Master Avatar Setup 661 //Master Avatar Setup
@@ -687,7 +691,8 @@ namespace OpenSim
687 691
688 protected override StorageManager CreateStorageManager() 692 protected override StorageManager CreateStorageManager()
689 { 693 {
690 return CreateStorageManager(m_configSettings.StorageConnectionString, m_configSettings.EstateConnectionString); 694 return
695 CreateStorageManager(m_configSettings.StorageConnectionString, m_configSettings.EstateConnectionString);
691 } 696 }
692 697
693 protected StorageManager CreateStorageManager(string connectionstring, string estateconnectionstring) 698 protected StorageManager CreateStorageManager(string connectionstring, string estateconnectionstring)
@@ -704,10 +709,10 @@ namespace OpenSim
704 AgentCircuitManager circuitManager) 709 AgentCircuitManager circuitManager)
705 { 710 {
706 SceneCommunicationService sceneGridService = new SceneCommunicationService(m_commsManager); 711 SceneCommunicationService sceneGridService = new SceneCommunicationService(m_commsManager);
707 712
708 return new Scene( 713 return new Scene(
709 regionInfo, circuitManager, m_commsManager, sceneGridService, 714 regionInfo, circuitManager, m_commsManager, sceneGridService,
710 storageManager, m_moduleLoader, m_configSettings.DumpAssetsToFile, m_configSettings.PhysicalPrim, 715 storageManager, m_moduleLoader, m_configSettings.DumpAssetsToFile, m_configSettings.PhysicalPrim,
711 m_configSettings.See_into_region_from_neighbor, m_config.Source, m_version); 716 m_configSettings.See_into_region_from_neighbor, m_config.Source, m_version);
712 } 717 }
713 718
@@ -728,7 +733,7 @@ namespace OpenSim
728 break; 733 break;
729 } 734 }
730 } 735 }
731 736
732 if (foundClientServer) 737 if (foundClientServer)
733 { 738 {
734 m_clientServers[clientServerElement].Server.Close(); 739 m_clientServers[clientServerElement].Server.Close();
@@ -793,7 +798,7 @@ namespace OpenSim
793 m_log.Info("[SHUTDOWN]: Closing console and terminating"); 798 m_log.Info("[SHUTDOWN]: Closing console and terminating");
794 799
795 try 800 try
796 { 801 {
797 m_sceneManager.Close(); 802 m_sceneManager.Close();
798 } 803 }
799 catch (Exception e) 804 catch (Exception e)
@@ -840,14 +845,14 @@ namespace OpenSim
840 { 845 {
841 if (Source is IniConfigSource) 846 if (Source is IniConfigSource)
842 { 847 {
843 IniConfigSource iniCon = (IniConfigSource)Source; 848 IniConfigSource iniCon = (IniConfigSource) Source;
844 iniCon.Save(path); 849 iniCon.Save(path);
845 } 850 }
846 else if (Source is XmlConfigSource) 851 else if (Source is XmlConfigSource)
847 { 852 {
848 XmlConfigSource xmlCon = (XmlConfigSource)Source; 853 XmlConfigSource xmlCon = (XmlConfigSource) Source;
849 xmlCon.Save(path); 854 xmlCon.Save(path);
850 } 855 }
851 } 856 }
852 } 857 }
853} 858} \ No newline at end of file