diff options
Diffstat (limited to 'OpenSim/Region/Application/OpenSimBase.cs')
-rw-r--r-- | OpenSim/Region/Application/OpenSimBase.cs | 67 |
1 files changed, 24 insertions, 43 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 7bef1aa..eb4326e 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -104,13 +104,7 @@ namespace OpenSim | |||
104 | /// <value> | 104 | /// <value> |
105 | /// The config information passed into the OpenSimulator region server. | 105 | /// The config information passed into the OpenSimulator region server. |
106 | /// </value> | 106 | /// </value> |
107 | public OpenSimConfigSource ConfigSource | 107 | public OpenSimConfigSource ConfigSource { get; private set; } |
108 | { | ||
109 | get { return m_config; } | ||
110 | set { m_config = value; } | ||
111 | } | ||
112 | |||
113 | protected OpenSimConfigSource m_config; | ||
114 | 108 | ||
115 | public List<IClientNetworkServer> ClientServers | 109 | public List<IClientNetworkServer> ClientServers |
116 | { | 110 | { |
@@ -150,13 +144,14 @@ namespace OpenSim | |||
150 | protected virtual void LoadConfigSettings(IConfigSource configSource) | 144 | protected virtual void LoadConfigSettings(IConfigSource configSource) |
151 | { | 145 | { |
152 | m_configLoader = new ConfigurationLoader(); | 146 | m_configLoader = new ConfigurationLoader(); |
153 | m_config = m_configLoader.LoadConfigSettings(configSource, envConfigSource, out m_configSettings, out m_networkServersInfo); | 147 | ConfigSource = m_configLoader.LoadConfigSettings(configSource, envConfigSource, out m_configSettings, out m_networkServersInfo); |
148 | Config = ConfigSource.Source; | ||
154 | ReadExtraConfigSettings(); | 149 | ReadExtraConfigSettings(); |
155 | } | 150 | } |
156 | 151 | ||
157 | protected virtual void ReadExtraConfigSettings() | 152 | protected virtual void ReadExtraConfigSettings() |
158 | { | 153 | { |
159 | IConfig networkConfig = m_config.Source.Configs["Network"]; | 154 | IConfig networkConfig = Config.Configs["Network"]; |
160 | if (networkConfig != null) | 155 | if (networkConfig != null) |
161 | { | 156 | { |
162 | proxyUrl = networkConfig.GetString("proxy_url", ""); | 157 | proxyUrl = networkConfig.GetString("proxy_url", ""); |
@@ -189,7 +184,7 @@ namespace OpenSim | |||
189 | /// </summary> | 184 | /// </summary> |
190 | protected override void StartupSpecific() | 185 | protected override void StartupSpecific() |
191 | { | 186 | { |
192 | IConfig startupConfig = m_config.Source.Configs["Startup"]; | 187 | IConfig startupConfig = Config.Configs["Startup"]; |
193 | if (startupConfig != null) | 188 | if (startupConfig != null) |
194 | { | 189 | { |
195 | string pidFile = startupConfig.GetString("PIDFile", String.Empty); | 190 | string pidFile = startupConfig.GetString("PIDFile", String.Empty); |
@@ -205,7 +200,7 @@ namespace OpenSim | |||
205 | } | 200 | } |
206 | 201 | ||
207 | // Load the simulation data service | 202 | // Load the simulation data service |
208 | IConfig simDataConfig = m_config.Source.Configs["SimulationDataStore"]; | 203 | IConfig simDataConfig = Config.Configs["SimulationDataStore"]; |
209 | if (simDataConfig == null) | 204 | if (simDataConfig == null) |
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?"); | 205 | 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 | 206 | ||
@@ -213,7 +208,7 @@ namespace OpenSim | |||
213 | if (String.IsNullOrEmpty(module)) | 208 | if (String.IsNullOrEmpty(module)) |
214 | throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [SimulationDataStore] section."); | 209 | throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [SimulationDataStore] section."); |
215 | 210 | ||
216 | m_simulationDataService = ServerUtils.LoadPlugin<ISimulationDataService>(module, new object[] { m_config.Source }); | 211 | m_simulationDataService = ServerUtils.LoadPlugin<ISimulationDataService>(module, new object[] { Config }); |
217 | if (m_simulationDataService == null) | 212 | if (m_simulationDataService == null) |
218 | throw new Exception( | 213 | throw new Exception( |
219 | string.Format( | 214 | string.Format( |
@@ -221,7 +216,7 @@ namespace OpenSim | |||
221 | module)); | 216 | module)); |
222 | 217 | ||
223 | // Load the estate data service | 218 | // Load the estate data service |
224 | IConfig estateDataConfig = m_config.Source.Configs["EstateDataStore"]; | 219 | IConfig estateDataConfig = Config.Configs["EstateDataStore"]; |
225 | if (estateDataConfig == null) | 220 | if (estateDataConfig == null) |
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?"); | 221 | 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 | 222 | ||
@@ -229,7 +224,7 @@ namespace OpenSim | |||
229 | if (String.IsNullOrEmpty(module)) | 224 | if (String.IsNullOrEmpty(module)) |
230 | throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [EstateDataStore] section"); | 225 | throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [EstateDataStore] section"); |
231 | 226 | ||
232 | m_estateDataService = ServerUtils.LoadPlugin<IEstateDataService>(module, new object[] { m_config.Source }); | 227 | m_estateDataService = ServerUtils.LoadPlugin<IEstateDataService>(module, new object[] { Config }); |
233 | if (m_estateDataService == null) | 228 | if (m_estateDataService == null) |
234 | throw new Exception( | 229 | throw new Exception( |
235 | string.Format( | 230 | string.Format( |
@@ -257,7 +252,7 @@ namespace OpenSim | |||
257 | } | 252 | } |
258 | } | 253 | } |
259 | 254 | ||
260 | protected virtual void AddPluginCommands(CommandConsole console) | 255 | protected virtual void AddPluginCommands(ICommandConsole console) |
261 | { | 256 | { |
262 | List<string> topics = GetHelpTopics(); | 257 | List<string> topics = GetHelpTopics(); |
263 | 258 | ||
@@ -384,7 +379,7 @@ namespace OpenSim | |||
384 | } | 379 | } |
385 | 380 | ||
386 | IClientNetworkServer clientServer; | 381 | IClientNetworkServer clientServer; |
387 | Scene scene = SetupScene(regionInfo, proxyOffset, m_config.Source, out clientServer); | 382 | Scene scene = SetupScene(regionInfo, proxyOffset, Config, out clientServer); |
388 | 383 | ||
389 | m_log.Info("[MODULES]: Loading Region's modules (old style)"); | 384 | m_log.Info("[MODULES]: Loading Region's modules (old style)"); |
390 | 385 | ||
@@ -530,10 +525,10 @@ namespace OpenSim | |||
530 | string estateOwnerPassword = null; | 525 | string estateOwnerPassword = null; |
531 | string rawEstateOwnerUuid = null; | 526 | string rawEstateOwnerUuid = null; |
532 | 527 | ||
533 | if (m_config.Source.Configs[ESTATE_SECTION_NAME] != null) | 528 | if (Config.Configs[ESTATE_SECTION_NAME] != null) |
534 | { | 529 | { |
535 | string defaultEstateOwnerName | 530 | string defaultEstateOwnerName |
536 | = m_config.Source.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerName", "").Trim(); | 531 | = Config.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerName", "").Trim(); |
537 | string[] ownerNames = defaultEstateOwnerName.Split(' '); | 532 | string[] ownerNames = defaultEstateOwnerName.Split(' '); |
538 | 533 | ||
539 | if (ownerNames.Length >= 2) | 534 | if (ownerNames.Length >= 2) |
@@ -543,9 +538,9 @@ namespace OpenSim | |||
543 | } | 538 | } |
544 | 539 | ||
545 | // Info to be used only on Standalone Mode | 540 | // Info to be used only on Standalone Mode |
546 | rawEstateOwnerUuid = m_config.Source.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerUUID", null); | 541 | rawEstateOwnerUuid = Config.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerUUID", null); |
547 | estateOwnerEMail = m_config.Source.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerEMail", null); | 542 | estateOwnerEMail = Config.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerEMail", null); |
548 | estateOwnerPassword = m_config.Source.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerPassword", null); | 543 | estateOwnerPassword = Config.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateOwnerPassword", null); |
549 | } | 544 | } |
550 | 545 | ||
551 | MainConsole.Instance.OutputFormat("Estate {0} has no owner set.", regionInfo.EstateSettings.EstateName); | 546 | MainConsole.Instance.OutputFormat("Estate {0} has no owner set.", regionInfo.EstateSettings.EstateName); |
@@ -797,7 +792,7 @@ namespace OpenSim | |||
797 | return new Scene( | 792 | return new Scene( |
798 | regionInfo, circuitManager, sceneGridService, | 793 | regionInfo, circuitManager, sceneGridService, |
799 | simDataService, estateDataService, false, | 794 | simDataService, estateDataService, false, |
800 | m_config.Source, m_version); | 795 | Config, m_version); |
801 | } | 796 | } |
802 | 797 | ||
803 | protected void ShutdownClientServer(RegionInfo whichRegion) | 798 | protected void ShutdownClientServer(RegionInfo whichRegion) |
@@ -838,7 +833,7 @@ namespace OpenSim | |||
838 | protected override PhysicsScene GetPhysicsScene(string osSceneIdentifier) | 833 | protected override PhysicsScene GetPhysicsScene(string osSceneIdentifier) |
839 | { | 834 | { |
840 | return GetPhysicsScene( | 835 | return GetPhysicsScene( |
841 | m_configSettings.PhysicsEngine, m_configSettings.MeshEngineName, m_config.Source, osSceneIdentifier); | 836 | m_configSettings.PhysicsEngine, m_configSettings.MeshEngineName, Config, osSceneIdentifier); |
842 | } | 837 | } |
843 | 838 | ||
844 | /// <summary> | 839 | /// <summary> |
@@ -1075,9 +1070,9 @@ namespace OpenSim | |||
1075 | 1070 | ||
1076 | string defaultEstateName = null; | 1071 | string defaultEstateName = null; |
1077 | 1072 | ||
1078 | if (m_config.Source.Configs[ESTATE_SECTION_NAME] != null) | 1073 | if (Config.Configs[ESTATE_SECTION_NAME] != null) |
1079 | { | 1074 | { |
1080 | defaultEstateName = m_config.Source.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateName", null); | 1075 | defaultEstateName = Config.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateName", null); |
1081 | 1076 | ||
1082 | if (defaultEstateName != null) | 1077 | if (defaultEstateName != null) |
1083 | { | 1078 | { |
@@ -1160,28 +1155,14 @@ namespace OpenSim | |||
1160 | MainConsole.Instance.Output("Joining the estate failed. Please try again."); | 1155 | MainConsole.Instance.Output("Joining the estate failed. Please try again."); |
1161 | } | 1156 | } |
1162 | } | 1157 | } |
1163 | } | 1158 | } |
1164 | 1159 | ||
1165 | return true; // need to update the database | 1160 | return true; // need to update the database |
1166 | } | 1161 | } |
1167 | } | 1162 | } |
1168 | 1163 | ||
1169 | public class OpenSimConfigSource | 1164 | public class OpenSimConfigSource |
1170 | { | 1165 | { |
1171 | public IConfigSource Source; | 1166 | public IConfigSource Source; |
1172 | |||
1173 | public void Save(string path) | ||
1174 | { | ||
1175 | if (Source is IniConfigSource) | ||
1176 | { | ||
1177 | IniConfigSource iniCon = (IniConfigSource) Source; | ||
1178 | iniCon.Save(path); | ||
1179 | } | ||
1180 | else if (Source is XmlConfigSource) | ||
1181 | { | ||
1182 | XmlConfigSource xmlCon = (XmlConfigSource) Source; | ||
1183 | xmlCon.Save(path); | ||
1184 | } | ||
1185 | } | ||
1186 | } | 1167 | } |
1187 | } | 1168 | } \ No newline at end of file |