diff options
Diffstat (limited to 'OpenSim/Region/Application/OpenSimBase.cs')
-rw-r--r-- | OpenSim/Region/Application/OpenSimBase.cs | 78 |
1 files changed, 30 insertions, 48 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 808c760..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 | { |
@@ -146,13 +140,14 @@ namespace OpenSim | |||
146 | protected virtual void LoadConfigSettings(IConfigSource configSource) | 140 | protected virtual void LoadConfigSettings(IConfigSource configSource) |
147 | { | 141 | { |
148 | m_configLoader = new ConfigurationLoader(); | 142 | m_configLoader = new ConfigurationLoader(); |
149 | 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; | ||
150 | ReadExtraConfigSettings(); | 145 | ReadExtraConfigSettings(); |
151 | } | 146 | } |
152 | 147 | ||
153 | protected virtual void ReadExtraConfigSettings() | 148 | protected virtual void ReadExtraConfigSettings() |
154 | { | 149 | { |
155 | IConfig networkConfig = m_config.Source.Configs["Network"]; | 150 | IConfig networkConfig = Config.Configs["Network"]; |
156 | if (networkConfig != null) | 151 | if (networkConfig != null) |
157 | { | 152 | { |
158 | proxyUrl = networkConfig.GetString("proxy_url", ""); | 153 | proxyUrl = networkConfig.GetString("proxy_url", ""); |
@@ -185,7 +180,7 @@ namespace OpenSim | |||
185 | /// </summary> | 180 | /// </summary> |
186 | protected override void StartupSpecific() | 181 | protected override void StartupSpecific() |
187 | { | 182 | { |
188 | IConfig startupConfig = m_config.Source.Configs["Startup"]; | 183 | IConfig startupConfig = Config.Configs["Startup"]; |
189 | if (startupConfig != null) | 184 | if (startupConfig != null) |
190 | { | 185 | { |
191 | string pidFile = startupConfig.GetString("PIDFile", String.Empty); | 186 | string pidFile = startupConfig.GetString("PIDFile", String.Empty); |
@@ -196,7 +191,7 @@ namespace OpenSim | |||
196 | } | 191 | } |
197 | 192 | ||
198 | // Load the simulation data service | 193 | // Load the simulation data service |
199 | IConfig simDataConfig = m_config.Source.Configs["SimulationDataStore"]; | 194 | IConfig simDataConfig = Config.Configs["SimulationDataStore"]; |
200 | if (simDataConfig == null) | 195 | if (simDataConfig == null) |
201 | 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?"); |
202 | 197 | ||
@@ -204,7 +199,7 @@ namespace OpenSim | |||
204 | if (String.IsNullOrEmpty(module)) | 199 | if (String.IsNullOrEmpty(module)) |
205 | 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."); |
206 | 201 | ||
207 | m_simulationDataService = ServerUtils.LoadPlugin<ISimulationDataService>(module, new object[] { m_config.Source }); | 202 | m_simulationDataService = ServerUtils.LoadPlugin<ISimulationDataService>(module, new object[] { Config }); |
208 | if (m_simulationDataService == null) | 203 | if (m_simulationDataService == null) |
209 | throw new Exception( | 204 | throw new Exception( |
210 | string.Format( | 205 | string.Format( |
@@ -212,7 +207,7 @@ namespace OpenSim | |||
212 | module)); | 207 | module)); |
213 | 208 | ||
214 | // Load the estate data service | 209 | // Load the estate data service |
215 | IConfig estateDataConfig = m_config.Source.Configs["EstateDataStore"]; | 210 | IConfig estateDataConfig = Config.Configs["EstateDataStore"]; |
216 | if (estateDataConfig == null) | 211 | if (estateDataConfig == null) |
217 | 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?"); |
218 | 213 | ||
@@ -220,7 +215,7 @@ namespace OpenSim | |||
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 | 217 | ||
223 | m_estateDataService = ServerUtils.LoadPlugin<IEstateDataService>(module, new object[] { m_config.Source }); | 218 | m_estateDataService = ServerUtils.LoadPlugin<IEstateDataService>(module, new object[] { Config }); |
224 | if (m_estateDataService == null) | 219 | if (m_estateDataService == null) |
225 | throw new Exception( | 220 | throw new Exception( |
226 | string.Format( | 221 | string.Format( |
@@ -242,7 +237,7 @@ namespace OpenSim | |||
242 | } | 237 | } |
243 | } | 238 | } |
244 | 239 | ||
245 | protected virtual void AddPluginCommands(CommandConsole console) | 240 | protected virtual void AddPluginCommands(ICommandConsole console) |
246 | { | 241 | { |
247 | List<string> topics = GetHelpTopics(); | 242 | List<string> topics = GetHelpTopics(); |
248 | 243 | ||
@@ -304,7 +299,7 @@ namespace OpenSim | |||
304 | // Called from base.StartUp() | 299 | // Called from base.StartUp() |
305 | 300 | ||
306 | m_httpServerPort = m_networkServersInfo.HttpListenerPort; | 301 | m_httpServerPort = m_networkServersInfo.HttpListenerPort; |
307 | SceneManager.OnRestartSim += handleRestartRegion; | 302 | SceneManager.OnRestartSim += HandleRestartRegion; |
308 | 303 | ||
309 | // 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 |
310 | // heavily used during initial startup. | 305 | // heavily used during initial startup. |
@@ -369,7 +364,7 @@ namespace OpenSim | |||
369 | } | 364 | } |
370 | 365 | ||
371 | IClientNetworkServer clientServer; | 366 | IClientNetworkServer clientServer; |
372 | Scene scene = SetupScene(regionInfo, proxyOffset, m_config.Source, out clientServer); | 367 | Scene scene = SetupScene(regionInfo, proxyOffset, Config, out clientServer); |
373 | 368 | ||
374 | m_log.Info("[MODULES]: Loading Region's modules (old style)"); | 369 | m_log.Info("[MODULES]: Loading Region's modules (old style)"); |
375 | 370 | ||
@@ -451,10 +446,10 @@ namespace OpenSim | |||
451 | string estateOwnerPassword = null; | 446 | string estateOwnerPassword = null; |
452 | string rawEstateOwnerUuid = null; | 447 | string rawEstateOwnerUuid = null; |
453 | 448 | ||
454 | if (m_config.Source.Configs[ESTATE_SECTION_NAME] != null) | 449 | if (Config.Configs[ESTATE_SECTION_NAME] != null) |
455 | { | 450 | { |
456 | string defaultEstateOwnerName | 451 | string defaultEstateOwnerName |
457 | = m_config.Source.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerName", "").Trim(); | 452 | = Config.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerName", "").Trim(); |
458 | string[] ownerNames = defaultEstateOwnerName.Split(' '); | 453 | string[] ownerNames = defaultEstateOwnerName.Split(' '); |
459 | 454 | ||
460 | if (ownerNames.Length >= 2) | 455 | if (ownerNames.Length >= 2) |
@@ -464,9 +459,9 @@ namespace OpenSim | |||
464 | } | 459 | } |
465 | 460 | ||
466 | // Info to be used only on Standalone Mode | 461 | // Info to be used only on Standalone Mode |
467 | rawEstateOwnerUuid = m_config.Source.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerUUID", null); | 462 | rawEstateOwnerUuid = Config.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerUUID", null); |
468 | estateOwnerEMail = m_config.Source.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerEMail", null); | 463 | estateOwnerEMail = Config.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerEMail", null); |
469 | estateOwnerPassword = m_config.Source.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerPassword", null); | 464 | estateOwnerPassword = Config.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerPassword", null); |
470 | } | 465 | } |
471 | 466 | ||
472 | 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); |
@@ -713,7 +708,7 @@ namespace OpenSim | |||
713 | return new Scene( | 708 | return new Scene( |
714 | regionInfo, circuitManager, sceneGridService, | 709 | regionInfo, circuitManager, sceneGridService, |
715 | simDataService, estateDataService, false, | 710 | simDataService, estateDataService, false, |
716 | m_config.Source, m_version); | 711 | Config, m_version); |
717 | } | 712 | } |
718 | 713 | ||
719 | protected void ShutdownClientServer(RegionInfo whichRegion) | 714 | protected void ShutdownClientServer(RegionInfo whichRegion) |
@@ -740,9 +735,11 @@ namespace OpenSim | |||
740 | } | 735 | } |
741 | } | 736 | } |
742 | 737 | ||
743 | public void handleRestartRegion(RegionInfo whichRegion) | 738 | protected virtual void HandleRestartRegion(RegionInfo whichRegion) |
744 | { | 739 | { |
745 | 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); | ||
746 | 743 | ||
747 | ShutdownClientServer(whichRegion); | 744 | ShutdownClientServer(whichRegion); |
748 | IScene scene; | 745 | IScene scene; |
@@ -754,7 +751,7 @@ namespace OpenSim | |||
754 | protected override PhysicsScene GetPhysicsScene(string osSceneIdentifier) | 751 | protected override PhysicsScene GetPhysicsScene(string osSceneIdentifier) |
755 | { | 752 | { |
756 | return GetPhysicsScene( | 753 | return GetPhysicsScene( |
757 | m_configSettings.PhysicsEngine, m_configSettings.MeshEngineName, m_config.Source, osSceneIdentifier); | 754 | m_configSettings.PhysicsEngine, m_configSettings.MeshEngineName, Config, osSceneIdentifier); |
758 | } | 755 | } |
759 | 756 | ||
760 | /// <summary> | 757 | /// <summary> |
@@ -888,7 +885,6 @@ namespace OpenSim | |||
888 | m_log.Info("[SHUTDOWN]: Closing all threads"); | 885 | m_log.Info("[SHUTDOWN]: Closing all threads"); |
889 | m_log.Info("[SHUTDOWN]: Killing listener thread"); | 886 | m_log.Info("[SHUTDOWN]: Killing listener thread"); |
890 | m_log.Info("[SHUTDOWN]: Killing clients"); | 887 | m_log.Info("[SHUTDOWN]: Killing clients"); |
891 | // TODO: implement this | ||
892 | m_log.Info("[SHUTDOWN]: Closing console and terminating"); | 888 | m_log.Info("[SHUTDOWN]: Closing console and terminating"); |
893 | 889 | ||
894 | try | 890 | try |
@@ -897,7 +893,7 @@ namespace OpenSim | |||
897 | } | 893 | } |
898 | catch (Exception e) | 894 | catch (Exception e) |
899 | { | 895 | { |
900 | m_log.ErrorFormat("[SHUTDOWN]: Ignoring failure during shutdown - {0}", e); | 896 | m_log.Error("[SHUTDOWN]: Ignoring failure during shutdown - ", e); |
901 | } | 897 | } |
902 | } | 898 | } |
903 | 899 | ||
@@ -991,9 +987,9 @@ namespace OpenSim | |||
991 | 987 | ||
992 | string defaultEstateName = null; | 988 | string defaultEstateName = null; |
993 | 989 | ||
994 | if (m_config.Source.Configs[ESTATE_SECTION_NAME] != null) | 990 | if (Config.Configs[ESTATE_SECTION_NAME] != null) |
995 | { | 991 | { |
996 | defaultEstateName = m_config.Source.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateName", null); | 992 | defaultEstateName = Config.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateName", null); |
997 | 993 | ||
998 | if (defaultEstateName != null) | 994 | if (defaultEstateName != null) |
999 | { | 995 | { |
@@ -1076,28 +1072,14 @@ namespace OpenSim | |||
1076 | MainConsole.Instance.Output("Joining the estate failed. Please try again."); | 1072 | MainConsole.Instance.Output("Joining the estate failed. Please try again."); |
1077 | } | 1073 | } |
1078 | } | 1074 | } |
1079 | } | 1075 | } |
1080 | 1076 | ||
1081 | return true; // need to update the database | 1077 | return true; // need to update the database |
1082 | } | 1078 | } |
1083 | } | 1079 | } |
1084 | 1080 | ||
1085 | public class OpenSimConfigSource | 1081 | public class OpenSimConfigSource |
1086 | { | 1082 | { |
1087 | public IConfigSource Source; | 1083 | public IConfigSource Source; |
1088 | |||
1089 | public void Save(string path) | ||
1090 | { | ||
1091 | if (Source is IniConfigSource) | ||
1092 | { | ||
1093 | IniConfigSource iniCon = (IniConfigSource) Source; | ||
1094 | iniCon.Save(path); | ||
1095 | } | ||
1096 | else if (Source is XmlConfigSource) | ||
1097 | { | ||
1098 | XmlConfigSource xmlCon = (XmlConfigSource) Source; | ||
1099 | xmlCon.Save(path); | ||
1100 | } | ||
1101 | } | ||
1102 | } | 1084 | } |
1103 | } | 1085 | } \ No newline at end of file |