aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Application
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Application')
-rw-r--r--OpenSim/Region/Application/ConfigurationLoader.cs1
-rw-r--r--OpenSim/Region/Application/OpenSim.cs254
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs120
3 files changed, 77 insertions, 298 deletions
diff --git a/OpenSim/Region/Application/ConfigurationLoader.cs b/OpenSim/Region/Application/ConfigurationLoader.cs
index 8d95c41..fc3999f 100644
--- a/OpenSim/Region/Application/ConfigurationLoader.cs
+++ b/OpenSim/Region/Application/ConfigurationLoader.cs
@@ -188,7 +188,6 @@ namespace OpenSim
188 // Make sure command line options take precedence 188 // Make sure command line options take precedence
189 m_config.Source.Merge(argvSource); 189 m_config.Source.Merge(argvSource);
190 190
191
192 IConfig enVars = m_config.Source.Configs["Environment"]; 191 IConfig enVars = m_config.Source.Configs["Environment"];
193 192
194 if( enVars != null ) 193 if( enVars != null )
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index b24641a..cffbb3b 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -82,8 +82,8 @@ namespace OpenSim
82 { 82 {
83 base.ReadExtraConfigSettings(); 83 base.ReadExtraConfigSettings();
84 84
85 IConfig startupConfig = m_config.Source.Configs["Startup"]; 85 IConfig startupConfig = Config.Configs["Startup"];
86 IConfig networkConfig = m_config.Source.Configs["Network"]; 86 IConfig networkConfig = Config.Configs["Network"];
87 87
88 int stpMaxThreads = 15; 88 int stpMaxThreads = 15;
89 89
@@ -106,22 +106,6 @@ namespace OpenSim
106 m_timeInterval = startupConfig.GetInt("timer_Interval", 1200); 106 m_timeInterval = startupConfig.GetInt("timer_Interval", 1200);
107 } 107 }
108 108
109 if (m_logFileAppender != null)
110 {
111 if (m_logFileAppender is log4net.Appender.FileAppender)
112 {
113 log4net.Appender.FileAppender appender =
114 (log4net.Appender.FileAppender)m_logFileAppender;
115 string fileName = startupConfig.GetString("LogFile", String.Empty);
116 if (fileName != String.Empty)
117 {
118 appender.File = fileName;
119 appender.ActivateOptions();
120 }
121 m_log.InfoFormat("[LOGGING]: Logging started to file {0}", appender.File);
122 }
123 }
124
125 string asyncCallMethodStr = startupConfig.GetString("async_call_method", String.Empty); 109 string asyncCallMethodStr = startupConfig.GetString("async_call_method", String.Empty);
126 FireAndForgetMethod asyncCallMethod; 110 FireAndForgetMethod asyncCallMethod;
127 if (!String.IsNullOrEmpty(asyncCallMethodStr) && Utils.EnumTryParse<FireAndForgetMethod>(asyncCallMethodStr, out asyncCallMethod)) 111 if (!String.IsNullOrEmpty(asyncCallMethodStr) && Utils.EnumTryParse<FireAndForgetMethod>(asyncCallMethodStr, out asyncCallMethod))
@@ -164,7 +148,7 @@ namespace OpenSim
164 break; 148 break;
165 case "rest": 149 case "rest":
166 m_console = new RemoteConsole("Region"); 150 m_console = new RemoteConsole("Region");
167 ((RemoteConsole)m_console).ReadConfig(m_config.Source); 151 ((RemoteConsole)m_console).ReadConfig(Config);
168 break; 152 break;
169 default: 153 default:
170 m_console = new LocalConsole("Region"); 154 m_console = new LocalConsole("Region");
@@ -174,6 +158,7 @@ namespace OpenSim
174 158
175 MainConsole.Instance = m_console; 159 MainConsole.Instance = m_console;
176 160
161 RegisterCommonAppenders(Config.Configs["Startup"]);
177 RegisterConsoleCommands(); 162 RegisterConsoleCommands();
178 163
179 base.StartupSpecific(); 164 base.StartupSpecific();
@@ -372,26 +357,6 @@ namespace OpenSim
372 "restart", 357 "restart",
373 "Restart all sims in this instance", RunCommand); 358 "Restart all sims in this instance", RunCommand);
374 359
375 m_console.Commands.AddCommand("General", false, "config set",
376 "config set <section> <key> <value>",
377 "Set a config option. In most cases this is not useful since changed parameters are not dynamically reloaded. Neither do changed parameters persist - you will have to change a config file manually and restart.", HandleConfig);
378
379 m_console.Commands.AddCommand("General", false, "config get",
380 "config get [<section>] [<key>]",
381 "Synonym for config show",
382 HandleConfig);
383
384 m_console.Commands.AddCommand("General", false, "config show",
385 "config show [<section>] [<key>]",
386 "Show config information",
387 "If neither section nor field are specified, then the whole current configuration is printed." + Environment.NewLine
388 + "If a section is given but not a field, then all fields in that section are printed.",
389 HandleConfig);
390
391 m_console.Commands.AddCommand("General", false, "config save",
392 "config save <path>",
393 "Save current configuration to a file at the given path", HandleConfig);
394
395 m_console.Commands.AddCommand("General", false, "command-script", 360 m_console.Commands.AddCommand("General", false, "command-script",
396 "command-script <script>", 361 "command-script <script>",
397 "Run a command script from file", RunCommand); 362 "Run a command script from file", RunCommand);
@@ -502,35 +467,6 @@ namespace OpenSim
502 } 467 }
503 468
504 /// <summary> 469 /// <summary>
505 /// Run an optional startup list of commands
506 /// </summary>
507 /// <param name="fileName"></param>
508 private void RunCommandScript(string fileName)
509 {
510 if (File.Exists(fileName))
511 {
512 m_log.Info("[COMMANDFILE]: Running " + fileName);
513
514 using (StreamReader readFile = File.OpenText(fileName))
515 {
516 string currentCommand;
517 while ((currentCommand = readFile.ReadLine()) != null)
518 {
519 currentCommand = currentCommand.Trim();
520 if (!(currentCommand == ""
521 || currentCommand.StartsWith(";")
522 || currentCommand.StartsWith("//")
523 || currentCommand.StartsWith("#")))
524 {
525 m_log.Info("[COMMANDFILE]: Running '" + currentCommand + "'");
526 m_console.RunCommand(currentCommand);
527 }
528 }
529 }
530 }
531 }
532
533 /// <summary>
534 /// Opens a file and uses it as input to the console command parser. 470 /// Opens a file and uses it as input to the console command parser.
535 /// </summary> 471 /// </summary>
536 /// <param name="fileName">name of file to use as input to the console</param> 472 /// <param name="fileName">name of file to use as input to the console</param>
@@ -634,111 +570,9 @@ namespace OpenSim
634 bool changed = PopulateRegionEstateInfo(regInfo); 570 bool changed = PopulateRegionEstateInfo(regInfo);
635 IScene scene; 571 IScene scene;
636 CreateRegion(regInfo, true, out scene); 572 CreateRegion(regInfo, true, out scene);
637 if (changed)
638 regInfo.EstateSettings.Save();
639 }
640
641 /// <summary>
642 /// Change and load configuration file data.
643 /// </summary>
644 /// <param name="module"></param>
645 /// <param name="cmd"></param>
646 private void HandleConfig(string module, string[] cmd)
647 {
648 List<string> args = new List<string>(cmd);
649 args.RemoveAt(0);
650 string[] cmdparams = args.ToArray();
651
652 if (cmdparams.Length > 0)
653 {
654 string firstParam = cmdparams[0].ToLower();
655
656 switch (firstParam)
657 {
658 case "set":
659 if (cmdparams.Length < 4)
660 {
661 Notice("Syntax: config set <section> <key> <value>");
662 Notice("Example: config set ScriptEngine.DotNetEngine NumberOfScriptThreads 5");
663 }
664 else
665 {
666 IConfig c;
667 IConfigSource source = new IniConfigSource();
668 c = source.AddConfig(cmdparams[1]);
669 if (c != null)
670 {
671 string _value = String.Join(" ", cmdparams, 3, cmdparams.Length - 3);
672 c.Set(cmdparams[2], _value);
673 m_config.Source.Merge(source);
674
675 Notice("In section [{0}], set {1} = {2}", c.Name, cmdparams[2], _value);
676 }
677 }
678 break;
679
680 case "get":
681 case "show":
682 if (cmdparams.Length == 1)
683 {
684 foreach (IConfig config in m_config.Source.Configs)
685 {
686 Notice("[{0}]", config.Name);
687 string[] keys = config.GetKeys();
688 foreach (string key in keys)
689 Notice(" {0} = {1}", key, config.GetString(key));
690 }
691 }
692 else if (cmdparams.Length == 2 || cmdparams.Length == 3)
693 {
694 IConfig config = m_config.Source.Configs[cmdparams[1]];
695 if (config == null)
696 {
697 Notice("Section \"{0}\" does not exist.",cmdparams[1]);
698 break;
699 }
700 else
701 {
702 if (cmdparams.Length == 2)
703 {
704 Notice("[{0}]", config.Name);
705 foreach (string key in config.GetKeys())
706 Notice(" {0} = {1}", key, config.GetString(key));
707 }
708 else
709 {
710 Notice(
711 "config get {0} {1} : {2}",
712 cmdparams[1], cmdparams[2], config.GetString(cmdparams[2]));
713 }
714 }
715 }
716 else
717 {
718 Notice("Syntax: config {0} [<section>] [<key>]", firstParam);
719 Notice("Example: config {0} ScriptEngine.DotNetEngine NumberOfScriptThreads", firstParam);
720 }
721
722 break;
723
724 case "save":
725 if (cmdparams.Length < 2)
726 {
727 Notice("Syntax: config save <path>");
728 return;
729 }
730
731 if (Application.iniFilePath == cmdparams[1])
732 {
733 Notice("Path can not be " + Application.iniFilePath);
734 return;
735 }
736 573
737 Notice("Saving configuration file: " + cmdparams[1]); 574 if (changed)
738 m_config.Save(cmdparams[1]); 575 regInfo.EstateSettings.Save();
739 break;
740 }
741 }
742 } 576 }
743 577
744 /// <summary> 578 /// <summary>
@@ -757,33 +591,13 @@ namespace OpenSim
757 switch (cmdparams[0].ToLower()) 591 switch (cmdparams[0].ToLower())
758 { 592 {
759 case "list": 593 case "list":
760 foreach (IRegionModule irm in m_moduleLoader.GetLoadedSharedModules) 594 //TODO: Convert to new region modules
761 {
762 MainConsole.Instance.Output(String.Format("Shared region module: {0}", irm.Name));
763 }
764 break; 595 break;
765 case "unload": 596 case "unload":
766 if (cmdparams.Length > 1) 597 //TODO: Convert to new region modules
767 {
768 foreach (IRegionModule rm in new ArrayList(m_moduleLoader.GetLoadedSharedModules))
769 {
770 if (rm.Name.ToLower() == cmdparams[1].ToLower())
771 {
772 MainConsole.Instance.Output(String.Format("Unloading module: {0}", rm.Name));
773 m_moduleLoader.UnloadModule(rm);
774 }
775 }
776 }
777 break; 598 break;
778 case "load": 599 case "load":
779 if (cmdparams.Length > 1) 600 //TODO: Convert to new region modules
780 {
781 foreach (Scene s in new ArrayList(SceneManager.Scenes))
782 {
783 MainConsole.Instance.Output(String.Format("Loading module: {0}", cmdparams[1]));
784 m_moduleLoader.LoadRegionModules(cmdparams[1], s);
785 }
786 }
787 break; 601 break;
788 } 602 }
789 } 603 }
@@ -807,13 +621,6 @@ namespace OpenSim
807 621
808 switch (command) 622 switch (command)
809 { 623 {
810 case "command-script":
811 if (cmdparams.Length > 0)
812 {
813 RunCommandScript(cmdparams[0]);
814 }
815 break;
816
817 case "backup": 624 case "backup":
818 MainConsole.Instance.Output("Triggering save of pending object updates to persistent store"); 625 MainConsole.Instance.Output("Triggering save of pending object updates to persistent store");
819 SceneManager.BackupCurrentScene(); 626 SceneManager.BackupCurrentScene();
@@ -857,12 +664,20 @@ namespace OpenSim
857 664
858 if (!SceneManager.TrySetCurrentScene(newRegionName)) 665 if (!SceneManager.TrySetCurrentScene(newRegionName))
859 MainConsole.Instance.Output(String.Format("Couldn't select region {0}", newRegionName)); 666 MainConsole.Instance.Output(String.Format("Couldn't select region {0}", newRegionName));
667 else
668 RefreshPrompt();
860 } 669 }
861 else 670 else
862 { 671 {
863 MainConsole.Instance.Output("Usage: change region <region name>"); 672 MainConsole.Instance.Output("Usage: change region <region name>");
864 } 673 }
674 }
865 675
676 /// <summary>
677 /// Refreshs prompt with the current selection details.
678 /// </summary>
679 private void RefreshPrompt()
680 {
866 string regionName = (SceneManager.CurrentScene == null ? "root" : SceneManager.CurrentScene.RegionInfo.RegionName); 681 string regionName = (SceneManager.CurrentScene == null ? "root" : SceneManager.CurrentScene.RegionInfo.RegionName);
867 MainConsole.Instance.Output(String.Format("Currently selected region is {0}", regionName)); 682 MainConsole.Instance.Output(String.Format("Currently selected region is {0}", regionName));
868 683
@@ -884,6 +699,18 @@ namespace OpenSim
884 m_console.ConsoleScene = SceneManager.CurrentScene; 699 m_console.ConsoleScene = SceneManager.CurrentScene;
885 } 700 }
886 701
702 protected override void HandleRestartRegion(RegionInfo whichRegion)
703 {
704 base.HandleRestartRegion(whichRegion);
705
706 // Where we are restarting multiple scenes at once, a previous call to RefreshPrompt may have set the
707 // m_console.ConsoleScene to null (indicating all scenes).
708 if (m_console.ConsoleScene != null && whichRegion.RegionName == ((Scene)m_console.ConsoleScene).Name)
709 SceneManager.TrySetCurrentScene(whichRegion.RegionName);
710
711 RefreshPrompt();
712 }
713
887 /// <summary> 714 /// <summary>
888 /// Turn on some debugging values for OpenSim. 715 /// Turn on some debugging values for OpenSim.
889 /// </summary> 716 /// </summary>
@@ -1018,28 +845,9 @@ namespace OpenSim
1018 break; 845 break;
1019 846
1020 case "modules": 847 case "modules":
1021 MainConsole.Instance.Output("The currently loaded shared modules are:");
1022 foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules)
1023 {
1024 MainConsole.Instance.Output("Shared Module: " + module.Name);
1025 }
1026
1027 SceneManager.ForEachScene(
1028 delegate(Scene scene) {
1029 m_log.Error("The currently loaded modules in " + scene.RegionInfo.RegionName + " are:");
1030 foreach (IRegionModule module in scene.Modules.Values)
1031 {
1032 if (!module.IsSharedModule)
1033 {
1034 m_log.Error("Region Module: " + module.Name);
1035 }
1036 }
1037 }
1038 );
1039
1040 SceneManager.ForEachScene( 848 SceneManager.ForEachScene(
1041 delegate(Scene scene) { 849 delegate(Scene scene) {
1042 MainConsole.Instance.Output("Loaded new region modules in" + scene.RegionInfo.RegionName + " are:"); 850 MainConsole.Instance.Output("Loaded region modules in" + scene.RegionInfo.RegionName + " are:");
1043 foreach (IRegionModuleBase module in scene.RegionModules.Values) 851 foreach (IRegionModuleBase module in scene.RegionModules.Values)
1044 { 852 {
1045 Type type = module.GetType().GetInterface("ISharedRegionModule"); 853 Type type = module.GetType().GetInterface("ISharedRegionModule");
@@ -1111,7 +919,7 @@ namespace OpenSim
1111 aCircuit.Name, 919 aCircuit.Name,
1112 aCircuit.child ? "child" : "root", 920 aCircuit.child ? "child" : "root",
1113 aCircuit.circuitcode.ToString(), 921 aCircuit.circuitcode.ToString(),
1114 aCircuit.IPAddress.ToString(), 922 aCircuit.IPAddress != null ? aCircuit.IPAddress.ToString() : "not set",
1115 aCircuit.Viewer); 923 aCircuit.Viewer);
1116 }); 924 });
1117 925
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 4f1b439..c3c87e7 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -100,13 +100,7 @@ namespace OpenSim
100 /// <value> 100 /// <value>
101 /// The config information passed into the OpenSimulator region server. 101 /// The config information passed into the OpenSimulator region server.
102 /// </value> 102 /// </value>
103 public OpenSimConfigSource ConfigSource 103 public OpenSimConfigSource ConfigSource { get; private set; }
104 {
105 get { return m_config; }
106 set { m_config = value; }
107 }
108
109 protected OpenSimConfigSource m_config;
110 104
111 public List<IClientNetworkServer> ClientServers 105 public List<IClientNetworkServer> ClientServers
112 { 106 {
@@ -127,14 +121,6 @@ namespace OpenSim
127 get { return m_httpServerPort; } 121 get { return m_httpServerPort; }
128 } 122 }
129 123
130 public ModuleLoader ModuleLoader
131 {
132 get { return m_moduleLoader; }
133 set { m_moduleLoader = value; }
134 }
135
136 protected ModuleLoader m_moduleLoader;
137
138 protected IRegistryCore m_applicationRegistry = new RegistryCore(); 124 protected IRegistryCore m_applicationRegistry = new RegistryCore();
139 125
140 public IRegistryCore ApplicationRegistry 126 public IRegistryCore ApplicationRegistry
@@ -154,13 +140,14 @@ namespace OpenSim
154 protected virtual void LoadConfigSettings(IConfigSource configSource) 140 protected virtual void LoadConfigSettings(IConfigSource configSource)
155 { 141 {
156 m_configLoader = new ConfigurationLoader(); 142 m_configLoader = new ConfigurationLoader();
157 m_config = m_configLoader.LoadConfigSettings(configSource, envConfigSource, out m_configSettings, out m_networkServersInfo); 143 ConfigSource = m_configLoader.LoadConfigSettings(configSource, envConfigSource, out m_configSettings, out m_networkServersInfo);
144 Config = ConfigSource.Source;
158 ReadExtraConfigSettings(); 145 ReadExtraConfigSettings();
159 } 146 }
160 147
161 protected virtual void ReadExtraConfigSettings() 148 protected virtual void ReadExtraConfigSettings()
162 { 149 {
163 IConfig networkConfig = m_config.Source.Configs["Network"]; 150 IConfig networkConfig = Config.Configs["Network"];
164 if (networkConfig != null) 151 if (networkConfig != null)
165 { 152 {
166 proxyUrl = networkConfig.GetString("proxy_url", ""); 153 proxyUrl = networkConfig.GetString("proxy_url", "");
@@ -193,7 +180,7 @@ namespace OpenSim
193 /// </summary> 180 /// </summary>
194 protected override void StartupSpecific() 181 protected override void StartupSpecific()
195 { 182 {
196 IConfig startupConfig = m_config.Source.Configs["Startup"]; 183 IConfig startupConfig = Config.Configs["Startup"];
197 if (startupConfig != null) 184 if (startupConfig != null)
198 { 185 {
199 string pidFile = startupConfig.GetString("PIDFile", String.Empty); 186 string pidFile = startupConfig.GetString("PIDFile", String.Empty);
@@ -204,27 +191,38 @@ namespace OpenSim
204 } 191 }
205 192
206 // Load the simulation data service 193 // Load the simulation data service
207 IConfig simDataConfig = m_config.Source.Configs["SimulationDataStore"]; 194 IConfig simDataConfig = Config.Configs["SimulationDataStore"];
208 if (simDataConfig == null) 195 if (simDataConfig == null)
209 throw new Exception("Configuration file is missing the [SimulationDataStore] section. Have you copied OpenSim.ini.example to OpenSim.ini to reference config-include/ files?"); 196 throw new Exception("Configuration file is missing the [SimulationDataStore] section. Have you copied OpenSim.ini.example to OpenSim.ini to reference config-include/ files?");
197
210 string module = simDataConfig.GetString("LocalServiceModule", String.Empty); 198 string module = simDataConfig.GetString("LocalServiceModule", String.Empty);
211 if (String.IsNullOrEmpty(module)) 199 if (String.IsNullOrEmpty(module))
212 throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [SimulationDataStore] section."); 200 throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [SimulationDataStore] section.");
213 m_simulationDataService = ServerUtils.LoadPlugin<ISimulationDataService>(module, new object[] { m_config.Source }); 201
202 m_simulationDataService = ServerUtils.LoadPlugin<ISimulationDataService>(module, new object[] { Config });
203 if (m_simulationDataService == null)
204 throw new Exception(
205 string.Format(
206 "Could not load an ISimulationDataService implementation from {0}, as configured in the LocalServiceModule parameter of the [SimulationDataStore] config section.",
207 module));
214 208
215 // Load the estate data service 209 // Load the estate data service
216 IConfig estateDataConfig = m_config.Source.Configs["EstateDataStore"]; 210 IConfig estateDataConfig = Config.Configs["EstateDataStore"];
217 if (estateDataConfig == null) 211 if (estateDataConfig == null)
218 throw new Exception("Configuration file is missing the [EstateDataStore] section. Have you copied OpenSim.ini.example to OpenSim.ini to reference config-include/ files?"); 212 throw new Exception("Configuration file is missing the [EstateDataStore] section. Have you copied OpenSim.ini.example to OpenSim.ini to reference config-include/ files?");
213
219 module = estateDataConfig.GetString("LocalServiceModule", String.Empty); 214 module = estateDataConfig.GetString("LocalServiceModule", String.Empty);
220 if (String.IsNullOrEmpty(module)) 215 if (String.IsNullOrEmpty(module))
221 throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [EstateDataStore] section"); 216 throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [EstateDataStore] section");
222 m_estateDataService = ServerUtils.LoadPlugin<IEstateDataService>(module, new object[] { m_config.Source });
223 217
224 base.StartupSpecific(); 218 m_estateDataService = ServerUtils.LoadPlugin<IEstateDataService>(module, new object[] { Config });
219 if (m_estateDataService == null)
220 throw new Exception(
221 string.Format(
222 "Could not load an IEstateDataService implementation from {0}, as configured in the LocalServiceModule parameter of the [EstateDataStore] config section.",
223 module));
225 224
226 // Create a ModuleLoader instance 225 base.StartupSpecific();
227 m_moduleLoader = new ModuleLoader(m_config.Source);
228 226
229 LoadPlugins(); 227 LoadPlugins();
230 foreach (IApplicationPlugin plugin in m_plugins) 228 foreach (IApplicationPlugin plugin in m_plugins)
@@ -239,7 +237,7 @@ namespace OpenSim
239 } 237 }
240 } 238 }
241 239
242 protected virtual void AddPluginCommands(CommandConsole console) 240 protected virtual void AddPluginCommands(ICommandConsole console)
243 { 241 {
244 List<string> topics = GetHelpTopics(); 242 List<string> topics = GetHelpTopics();
245 243
@@ -301,7 +299,7 @@ namespace OpenSim
301 // Called from base.StartUp() 299 // Called from base.StartUp()
302 300
303 m_httpServerPort = m_networkServersInfo.HttpListenerPort; 301 m_httpServerPort = m_networkServersInfo.HttpListenerPort;
304 SceneManager.OnRestartSim += handleRestartRegion; 302 SceneManager.OnRestartSim += HandleRestartRegion;
305 303
306 // Only enable the watchdogs when all regions are ready. Otherwise we get false positives when cpu is 304 // Only enable the watchdogs when all regions are ready. Otherwise we get false positives when cpu is
307 // heavily used during initial startup. 305 // heavily used during initial startup.
@@ -366,16 +364,10 @@ namespace OpenSim
366 } 364 }
367 365
368 IClientNetworkServer clientServer; 366 IClientNetworkServer clientServer;
369 Scene scene = SetupScene(regionInfo, proxyOffset, m_config.Source, out clientServer); 367 Scene scene = SetupScene(regionInfo, proxyOffset, Config, out clientServer);
370 368
371 m_log.Info("[MODULES]: Loading Region's modules (old style)"); 369 m_log.Info("[MODULES]: Loading Region's modules (old style)");
372 370
373 List<IRegionModule> modules = m_moduleLoader.PickupModules(scene, ".");
374
375 // This needs to be ahead of the script engine load, so the
376 // script module can pick up events exposed by a module
377 m_moduleLoader.InitialiseSharedModules(scene);
378
379 // Use this in the future, the line above will be deprecated soon 371 // Use this in the future, the line above will be deprecated soon
380 m_log.Info("[REGIONMODULES]: Loading Region's modules (new style)"); 372 m_log.Info("[REGIONMODULES]: Loading Region's modules (new style)");
381 IRegionModulesController controller; 373 IRegionModulesController controller;
@@ -426,13 +418,6 @@ namespace OpenSim
426 clientServer.Start(); 418 clientServer.Start();
427 } 419 }
428 420
429 if (do_post_init)
430 {
431 foreach (IRegionModule module in modules)
432 {
433 module.PostInitialise();
434 }
435 }
436 scene.EventManager.OnShutdown += delegate() { ShutdownRegion(scene); }; 421 scene.EventManager.OnShutdown += delegate() { ShutdownRegion(scene); };
437 422
438 mscene = scene; 423 mscene = scene;
@@ -461,10 +446,10 @@ namespace OpenSim
461 string estateOwnerPassword = null; 446 string estateOwnerPassword = null;
462 string rawEstateOwnerUuid = null; 447 string rawEstateOwnerUuid = null;
463 448
464 if (m_config.Source.Configs[ESTATE_SECTION_NAME] != null) 449 if (Config.Configs[ESTATE_SECTION_NAME] != null)
465 { 450 {
466 string defaultEstateOwnerName 451 string defaultEstateOwnerName
467 = m_config.Source.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerName", "").Trim(); 452 = Config.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerName", "").Trim();
468 string[] ownerNames = defaultEstateOwnerName.Split(' '); 453 string[] ownerNames = defaultEstateOwnerName.Split(' ');
469 454
470 if (ownerNames.Length >= 2) 455 if (ownerNames.Length >= 2)
@@ -474,9 +459,9 @@ namespace OpenSim
474 } 459 }
475 460
476 // Info to be used only on Standalone Mode 461 // Info to be used only on Standalone Mode
477 rawEstateOwnerUuid = m_config.Source.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerUUID", null); 462 rawEstateOwnerUuid = Config.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerUUID", null);
478 estateOwnerEMail = m_config.Source.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerEMail", null); 463 estateOwnerEMail = Config.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerEMail", null);
479 estateOwnerPassword = m_config.Source.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerPassword", null); 464 estateOwnerPassword = Config.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerPassword", null);
480 } 465 }
481 466
482 MainConsole.Instance.OutputFormat("Estate {0} has no owner set.", regionInfo.EstateSettings.EstateName); 467 MainConsole.Instance.OutputFormat("Estate {0} has no owner set.", regionInfo.EstateSettings.EstateName);
@@ -543,7 +528,7 @@ namespace OpenSim
543 if (account == null) 528 if (account == null)
544 { 529 {
545 m_log.ErrorFormat( 530 m_log.ErrorFormat(
546 "[OPENSIM]: Unable to store account. If this simulator is connected to a grid, you must create the estate owner account first."); 531 "[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.");
547 } 532 }
548 else 533 else
549 { 534 {
@@ -722,8 +707,8 @@ namespace OpenSim
722 707
723 return new Scene( 708 return new Scene(
724 regionInfo, circuitManager, sceneGridService, 709 regionInfo, circuitManager, sceneGridService,
725 simDataService, estateDataService, m_moduleLoader, false, 710 simDataService, estateDataService, false,
726 m_config.Source, m_version); 711 Config, m_version);
727 } 712 }
728 713
729 protected void ShutdownClientServer(RegionInfo whichRegion) 714 protected void ShutdownClientServer(RegionInfo whichRegion)
@@ -750,9 +735,11 @@ namespace OpenSim
750 } 735 }
751 } 736 }
752 737
753 public void handleRestartRegion(RegionInfo whichRegion) 738 protected virtual void HandleRestartRegion(RegionInfo whichRegion)
754 { 739 {
755 m_log.Info("[OPENSIM]: Got restart signal from SceneManager"); 740 m_log.InfoFormat(
741 "[OPENSIM]: Got restart signal from SceneManager for region {0} ({1},{2})",
742 whichRegion.RegionName, whichRegion.RegionLocX, whichRegion.RegionLocY);
756 743
757 ShutdownClientServer(whichRegion); 744 ShutdownClientServer(whichRegion);
758 IScene scene; 745 IScene scene;
@@ -764,7 +751,7 @@ namespace OpenSim
764 protected override PhysicsScene GetPhysicsScene(string osSceneIdentifier) 751 protected override PhysicsScene GetPhysicsScene(string osSceneIdentifier)
765 { 752 {
766 return GetPhysicsScene( 753 return GetPhysicsScene(
767 m_configSettings.PhysicsEngine, m_configSettings.MeshEngineName, m_config.Source, osSceneIdentifier); 754 m_configSettings.PhysicsEngine, m_configSettings.MeshEngineName, Config, osSceneIdentifier);
768 } 755 }
769 756
770 /// <summary> 757 /// <summary>
@@ -898,7 +885,6 @@ namespace OpenSim
898 m_log.Info("[SHUTDOWN]: Closing all threads"); 885 m_log.Info("[SHUTDOWN]: Closing all threads");
899 m_log.Info("[SHUTDOWN]: Killing listener thread"); 886 m_log.Info("[SHUTDOWN]: Killing listener thread");
900 m_log.Info("[SHUTDOWN]: Killing clients"); 887 m_log.Info("[SHUTDOWN]: Killing clients");
901 // TODO: implement this
902 m_log.Info("[SHUTDOWN]: Closing console and terminating"); 888 m_log.Info("[SHUTDOWN]: Closing console and terminating");
903 889
904 try 890 try
@@ -907,7 +893,7 @@ namespace OpenSim
907 } 893 }
908 catch (Exception e) 894 catch (Exception e)
909 { 895 {
910 m_log.ErrorFormat("[SHUTDOWN]: Ignoring failure during shutdown - {0}", e); 896 m_log.Error("[SHUTDOWN]: Ignoring failure during shutdown - ", e);
911 } 897 }
912 } 898 }
913 899
@@ -1001,9 +987,9 @@ namespace OpenSim
1001 987
1002 string defaultEstateName = null; 988 string defaultEstateName = null;
1003 989
1004 if (m_config.Source.Configs[ESTATE_SECTION_NAME] != null) 990 if (Config.Configs[ESTATE_SECTION_NAME] != null)
1005 { 991 {
1006 defaultEstateName = m_config.Source.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateName", null); 992 defaultEstateName = Config.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateName", null);
1007 993
1008 if (defaultEstateName != null) 994 if (defaultEstateName != null)
1009 { 995 {
@@ -1086,28 +1072,14 @@ namespace OpenSim
1086 MainConsole.Instance.Output("Joining the estate failed. Please try again."); 1072 MainConsole.Instance.Output("Joining the estate failed. Please try again.");
1087 } 1073 }
1088 } 1074 }
1089 } 1075 }
1090 1076
1091 return true; // need to update the database 1077 return true; // need to update the database
1092 } 1078 }
1093 } 1079 }
1094 1080
1095 public class OpenSimConfigSource 1081 public class OpenSimConfigSource
1096 { 1082 {
1097 public IConfigSource Source; 1083 public IConfigSource Source;
1098
1099 public void Save(string path)
1100 {
1101 if (Source is IniConfigSource)
1102 {
1103 IniConfigSource iniCon = (IniConfigSource) Source;
1104 iniCon.Save(path);
1105 }
1106 else if (Source is XmlConfigSource)
1107 {
1108 XmlConfigSource xmlCon = (XmlConfigSource) Source;
1109 xmlCon.Save(path);
1110 }
1111 }
1112 } 1084 }
1113} 1085} \ No newline at end of file