aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Application/OpenSimBase.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Application/OpenSimBase.cs')
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs159
1 files changed, 74 insertions, 85 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index d107b7a..7bef1aa 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -131,14 +131,6 @@ namespace OpenSim
131 get { return m_httpServerPort; } 131 get { return m_httpServerPort; }
132 } 132 }
133 133
134 public ModuleLoader ModuleLoader
135 {
136 get { return m_moduleLoader; }
137 set { m_moduleLoader = value; }
138 }
139
140 protected ModuleLoader m_moduleLoader;
141
142 protected IRegistryCore m_applicationRegistry = new RegistryCore(); 134 protected IRegistryCore m_applicationRegistry = new RegistryCore();
143 135
144 public IRegistryCore ApplicationRegistry 136 public IRegistryCore ApplicationRegistry
@@ -216,27 +208,36 @@ namespace OpenSim
216 IConfig simDataConfig = m_config.Source.Configs["SimulationDataStore"]; 208 IConfig simDataConfig = m_config.Source.Configs["SimulationDataStore"];
217 if (simDataConfig == null) 209 if (simDataConfig == null)
218 throw new Exception("Configuration file is missing the [SimulationDataStore] section. Have you copied OpenSim.ini.example to OpenSim.ini to reference config-include/ files?"); 210 throw new Exception("Configuration file is missing the [SimulationDataStore] section. Have you copied OpenSim.ini.example to OpenSim.ini to reference config-include/ files?");
211
219 string module = simDataConfig.GetString("LocalServiceModule", String.Empty); 212 string module = simDataConfig.GetString("LocalServiceModule", String.Empty);
220 if (String.IsNullOrEmpty(module)) 213 if (String.IsNullOrEmpty(module))
221 throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [SimulationDataStore] section."); 214 throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [SimulationDataStore] section.");
215
222 m_simulationDataService = ServerUtils.LoadPlugin<ISimulationDataService>(module, new object[] { m_config.Source }); 216 m_simulationDataService = ServerUtils.LoadPlugin<ISimulationDataService>(module, new object[] { m_config.Source });
217 if (m_simulationDataService == null)
218 throw new Exception(
219 string.Format(
220 "Could not load an ISimulationDataService implementation from {0}, as configured in the LocalServiceModule parameter of the [SimulationDataStore] config section.",
221 module));
223 222
224 // Load the estate data service 223 // Load the estate data service
225 IConfig estateDataConfig = m_config.Source.Configs["EstateDataStore"]; 224 IConfig estateDataConfig = m_config.Source.Configs["EstateDataStore"];
226 if (estateDataConfig == null) 225 if (estateDataConfig == null)
227 throw new Exception("Configuration file is missing the [EstateDataStore] section. Have you copied OpenSim.ini.example to OpenSim.ini to reference config-include/ files?"); 226 throw new Exception("Configuration file is missing the [EstateDataStore] section. Have you copied OpenSim.ini.example to OpenSim.ini to reference config-include/ files?");
227
228 module = estateDataConfig.GetString("LocalServiceModule", String.Empty); 228 module = estateDataConfig.GetString("LocalServiceModule", String.Empty);
229 if (String.IsNullOrEmpty(module)) 229 if (String.IsNullOrEmpty(module))
230 throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [EstateDataStore] section"); 230 throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [EstateDataStore] section");
231
231 m_estateDataService = ServerUtils.LoadPlugin<IEstateDataService>(module, new object[] { m_config.Source }); 232 m_estateDataService = ServerUtils.LoadPlugin<IEstateDataService>(module, new object[] { m_config.Source });
233 if (m_estateDataService == null)
234 throw new Exception(
235 string.Format(
236 "Could not load an IEstateDataService implementation from {0}, as configured in the LocalServiceModule parameter of the [EstateDataStore] config section.",
237 module));
232 238
233 base.StartupSpecific(); 239 base.StartupSpecific();
234 240
235 m_stats = StatsManager.SimExtraStats;
236
237 // Create a ModuleLoader instance
238 m_moduleLoader = new ModuleLoader(m_config.Source);
239
240 LoadPlugins(); 241 LoadPlugins();
241 242
242 if (m_plugins.Count == 0) // We failed to load any modules. Mono Addins glitch! 243 if (m_plugins.Count == 0) // We failed to load any modules. Mono Addins glitch!
@@ -249,51 +250,51 @@ namespace OpenSim
249 plugin.PostInitialise(); 250 plugin.PostInitialise();
250 } 251 }
251 252
252 AddPluginCommands(); 253 if (m_console != null)
254 {
255 StatsManager.RegisterConsoleCommands(m_console);
256 AddPluginCommands(m_console);
257 }
253 } 258 }
254 259
255 protected virtual void AddPluginCommands() 260 protected virtual void AddPluginCommands(CommandConsole console)
256 { 261 {
257 // If console exists add plugin commands. 262 List<string> topics = GetHelpTopics();
258 if (m_console != null)
259 {
260 List<string> topics = GetHelpTopics();
261 263
262 foreach (string topic in topics) 264 foreach (string topic in topics)
263 { 265 {
264 string capitalizedTopic = char.ToUpper(topic[0]) + topic.Substring(1); 266 string capitalizedTopic = char.ToUpper(topic[0]) + topic.Substring(1);
265 267
266 // This is a hack to allow the user to enter the help command in upper or lowercase. This will go 268 // This is a hack to allow the user to enter the help command in upper or lowercase. This will go
267 // away at some point. 269 // away at some point.
268 m_console.Commands.AddCommand(capitalizedTopic, false, "help " + topic, 270 console.Commands.AddCommand(capitalizedTopic, false, "help " + topic,
269 "help " + capitalizedTopic, 271 "help " + capitalizedTopic,
270 "Get help on plugin command '" + topic + "'", 272 "Get help on plugin command '" + topic + "'",
271 HandleCommanderHelp); 273 HandleCommanderHelp);
272 m_console.Commands.AddCommand(capitalizedTopic, false, "help " + capitalizedTopic, 274 console.Commands.AddCommand(capitalizedTopic, false, "help " + capitalizedTopic,
273 "help " + capitalizedTopic, 275 "help " + capitalizedTopic,
274 "Get help on plugin command '" + topic + "'", 276 "Get help on plugin command '" + topic + "'",
275 HandleCommanderHelp); 277 HandleCommanderHelp);
276 278
277 ICommander commander = null; 279 ICommander commander = null;
278 280
279 Scene s = SceneManager.CurrentOrFirstScene; 281 Scene s = SceneManager.CurrentOrFirstScene;
280 282
281 if (s != null && s.GetCommanders() != null) 283 if (s != null && s.GetCommanders() != null)
282 { 284 {
283 if (s.GetCommanders().ContainsKey(topic)) 285 if (s.GetCommanders().ContainsKey(topic))
284 commander = s.GetCommanders()[topic]; 286 commander = s.GetCommanders()[topic];
285 } 287 }
286 288
287 if (commander == null) 289 if (commander == null)
288 continue; 290 continue;
289 291
290 foreach (string command in commander.Commands.Keys) 292 foreach (string command in commander.Commands.Keys)
291 { 293 {
292 m_console.Commands.AddCommand(capitalizedTopic, false, 294 console.Commands.AddCommand(capitalizedTopic, false,
293 topic + " " + command, 295 topic + " " + command,
294 topic + " " + commander.Commands[command].ShortHelp(), 296 topic + " " + commander.Commands[command].ShortHelp(),
295 String.Empty, HandleCommanderCommand); 297 String.Empty, HandleCommanderCommand);
296 }
297 } 298 }
298 } 299 }
299 } 300 }
@@ -387,12 +388,6 @@ namespace OpenSim
387 388
388 m_log.Info("[MODULES]: Loading Region's modules (old style)"); 389 m_log.Info("[MODULES]: Loading Region's modules (old style)");
389 390
390 List<IRegionModule> modules = m_moduleLoader.PickupModules(scene, ".");
391
392 // This needs to be ahead of the script engine load, so the
393 // script module can pick up events exposed by a module
394 m_moduleLoader.InitialiseSharedModules(scene);
395
396 // Use this in the future, the line above will be deprecated soon 391 // Use this in the future, the line above will be deprecated soon
397 m_log.Info("[REGIONMODULES]: Loading Region's modules (new style)"); 392 m_log.Info("[REGIONMODULES]: Loading Region's modules (new style)");
398 IRegionModulesController controller; 393 IRegionModulesController controller;
@@ -402,28 +397,29 @@ namespace OpenSim
402 } 397 }
403 else m_log.Error("[REGIONMODULES]: The new RegionModulesController is missing..."); 398 else m_log.Error("[REGIONMODULES]: The new RegionModulesController is missing...");
404 399
405 if (m_securePermissionsLoading) 400 // XPTO: Fix this
406 { 401// if (m_securePermissionsLoading)
407 foreach (string s in m_permsModules) 402// {
408 { 403// foreach (string s in m_permsModules)
409 if (!scene.RegionModules.ContainsKey(s)) 404// {
410 { 405// if (!scene.RegionModules.ContainsKey(s))
411 bool found = false; 406// {
412 foreach (IRegionModule m in modules) 407// bool found = false;
413 { 408// foreach (IRegionModule m in modules)
414 if (m.Name == s) 409// {
415 { 410// if (m.Name == s)
416 found = true; 411// {
417 } 412// found = true;
418 } 413// }
419 if (!found) 414// }
420 { 415// if (!found)
421 m_log.Fatal("[MODULES]: Required module " + s + " not found."); 416// {
422 Environment.Exit(0); 417// m_log.Fatal("[MODULES]: Required module " + s + " not found.");
423 } 418// Environment.Exit(0);
424 } 419// }
425 } 420// }
426 } 421// }
422// }
427 423
428 scene.SetModuleInterfaces(); 424 scene.SetModuleInterfaces();
429// First Step of bootreport sequence 425// First Step of bootreport sequence
@@ -500,13 +496,6 @@ namespace OpenSim
500 { 496 {
501 scene.SnmpService.BootInfo("Initializing region modules", scene); 497 scene.SnmpService.BootInfo("Initializing region modules", scene);
502 } 498 }
503 if (do_post_init)
504 {
505 foreach (IRegionModule module in modules)
506 {
507 module.PostInitialise();
508 }
509 }
510 scene.EventManager.OnShutdown += delegate() { ShutdownRegion(scene); }; 499 scene.EventManager.OnShutdown += delegate() { ShutdownRegion(scene); };
511 500
512 mscene = scene; 501 mscene = scene;
@@ -623,7 +612,7 @@ namespace OpenSim
623 if (account == null) 612 if (account == null)
624 { 613 {
625 m_log.ErrorFormat( 614 m_log.ErrorFormat(
626 "[OPENSIM]: Unable to store account. If this simulator is connected to a grid, you must create the estate owner account first."); 615 "[OPENSIM]: Unable to store account. If this simulator is connected to a grid, you must create the estate owner account first at the grid level.");
627 } 616 }
628 else 617 else
629 { 618 {
@@ -807,7 +796,7 @@ namespace OpenSim
807 796
808 return new Scene( 797 return new Scene(
809 regionInfo, circuitManager, sceneGridService, 798 regionInfo, circuitManager, sceneGridService,
810 simDataService, estateDataService, m_moduleLoader, false, 799 simDataService, estateDataService, false,
811 m_config.Source, m_version); 800 m_config.Source, m_version);
812 } 801 }
813 802