diff options
author | Justin Clark-Casey (justincc) | 2012-11-22 05:48:41 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-11-22 05:48:41 +0000 |
commit | 9fcf3f1a3f3457debf0f59ba7659492b44172b99 (patch) | |
tree | 472df16756b48e774c83ab9402a3a3c95b3d4601 | |
parent | Factor out common pid file creation and removal code. (diff) | |
download | opensim-SC_OLD-9fcf3f1a3f3457debf0f59ba7659492b44172b99.zip opensim-SC_OLD-9fcf3f1a3f3457debf0f59ba7659492b44172b99.tar.gz opensim-SC_OLD-9fcf3f1a3f3457debf0f59ba7659492b44172b99.tar.bz2 opensim-SC_OLD-9fcf3f1a3f3457debf0f59ba7659492b44172b99.tar.xz |
Make "config show/set/get/save" console commands available on all servers
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Servers/ServerBase.cs | 140 | ||||
-rw-r--r-- | OpenSim/Region/Application/ConfigurationLoader.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSim.cs | 134 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSimBase.cs | 65 | ||||
-rw-r--r-- | OpenSim/Server/Base/HttpServerBase.cs | 2 | ||||
-rw-r--r-- | OpenSim/Server/Base/ServicesServerBase.cs | 19 |
6 files changed, 172 insertions, 189 deletions
diff --git a/OpenSim/Framework/Servers/ServerBase.cs b/OpenSim/Framework/Servers/ServerBase.cs index 645b43a..27cfc9b 100644 --- a/OpenSim/Framework/Servers/ServerBase.cs +++ b/OpenSim/Framework/Servers/ServerBase.cs | |||
@@ -44,6 +44,8 @@ namespace OpenSim.Framework.Servers | |||
44 | { | 44 | { |
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 46 | ||
47 | public IConfigSource Config { get; protected set; } | ||
48 | |||
47 | /// <summary> | 49 | /// <summary> |
48 | /// Console to be used for any command line output. Can be null, in which case there should be no output. | 50 | /// Console to be used for any command line output. Can be null, in which case there should be no output. |
49 | /// </summary> | 51 | /// </summary> |
@@ -175,6 +177,30 @@ namespace OpenSim.Framework.Servers | |||
175 | m_console.Commands.AddCommand( | 177 | m_console.Commands.AddCommand( |
176 | "General", false, "set log level", "set log level <level>", | 178 | "General", false, "set log level", "set log level <level>", |
177 | "Set the console logging level for this session.", HandleSetLogLevel); | 179 | "Set the console logging level for this session.", HandleSetLogLevel); |
180 | |||
181 | m_console.Commands.AddCommand( | ||
182 | "General", false, "config set", | ||
183 | "config set <section> <key> <value>", | ||
184 | "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); | ||
185 | |||
186 | m_console.Commands.AddCommand( | ||
187 | "General", false, "config get", | ||
188 | "config get [<section>] [<key>]", | ||
189 | "Synonym for config show", | ||
190 | HandleConfig); | ||
191 | |||
192 | m_console.Commands.AddCommand( | ||
193 | "General", false, "config show", | ||
194 | "config show [<section>] [<key>]", | ||
195 | "Show config information", | ||
196 | "If neither section nor field are specified, then the whole current configuration is printed." + Environment.NewLine | ||
197 | + "If a section is given but not a field, then all fields in that section are printed.", | ||
198 | HandleConfig); | ||
199 | |||
200 | m_console.Commands.AddCommand( | ||
201 | "General", false, "config save", | ||
202 | "config save <path>", | ||
203 | "Save current configuration to a file at the given path", HandleConfig); | ||
178 | } | 204 | } |
179 | 205 | ||
180 | public virtual void HandleShow(string module, string[] cmd) | 206 | public virtual void HandleShow(string module, string[] cmd) |
@@ -197,6 +223,115 @@ namespace OpenSim.Framework.Servers | |||
197 | } | 223 | } |
198 | } | 224 | } |
199 | 225 | ||
226 | /// <summary> | ||
227 | /// Change and load configuration file data. | ||
228 | /// </summary> | ||
229 | /// <param name="module"></param> | ||
230 | /// <param name="cmd"></param> | ||
231 | private void HandleConfig(string module, string[] cmd) | ||
232 | { | ||
233 | List<string> args = new List<string>(cmd); | ||
234 | args.RemoveAt(0); | ||
235 | string[] cmdparams = args.ToArray(); | ||
236 | |||
237 | if (cmdparams.Length > 0) | ||
238 | { | ||
239 | string firstParam = cmdparams[0].ToLower(); | ||
240 | |||
241 | switch (firstParam) | ||
242 | { | ||
243 | case "set": | ||
244 | if (cmdparams.Length < 4) | ||
245 | { | ||
246 | Notice("Syntax: config set <section> <key> <value>"); | ||
247 | Notice("Example: config set ScriptEngine.DotNetEngine NumberOfScriptThreads 5"); | ||
248 | } | ||
249 | else | ||
250 | { | ||
251 | IConfig c; | ||
252 | IConfigSource source = new IniConfigSource(); | ||
253 | c = source.AddConfig(cmdparams[1]); | ||
254 | if (c != null) | ||
255 | { | ||
256 | string _value = String.Join(" ", cmdparams, 3, cmdparams.Length - 3); | ||
257 | c.Set(cmdparams[2], _value); | ||
258 | Config.Merge(source); | ||
259 | |||
260 | Notice("In section [{0}], set {1} = {2}", c.Name, cmdparams[2], _value); | ||
261 | } | ||
262 | } | ||
263 | break; | ||
264 | |||
265 | case "get": | ||
266 | case "show": | ||
267 | if (cmdparams.Length == 1) | ||
268 | { | ||
269 | foreach (IConfig config in Config.Configs) | ||
270 | { | ||
271 | Notice("[{0}]", config.Name); | ||
272 | string[] keys = config.GetKeys(); | ||
273 | foreach (string key in keys) | ||
274 | Notice(" {0} = {1}", key, config.GetString(key)); | ||
275 | } | ||
276 | } | ||
277 | else if (cmdparams.Length == 2 || cmdparams.Length == 3) | ||
278 | { | ||
279 | IConfig config = Config.Configs[cmdparams[1]]; | ||
280 | if (config == null) | ||
281 | { | ||
282 | Notice("Section \"{0}\" does not exist.",cmdparams[1]); | ||
283 | break; | ||
284 | } | ||
285 | else | ||
286 | { | ||
287 | if (cmdparams.Length == 2) | ||
288 | { | ||
289 | Notice("[{0}]", config.Name); | ||
290 | foreach (string key in config.GetKeys()) | ||
291 | Notice(" {0} = {1}", key, config.GetString(key)); | ||
292 | } | ||
293 | else | ||
294 | { | ||
295 | Notice( | ||
296 | "config get {0} {1} : {2}", | ||
297 | cmdparams[1], cmdparams[2], config.GetString(cmdparams[2])); | ||
298 | } | ||
299 | } | ||
300 | } | ||
301 | else | ||
302 | { | ||
303 | Notice("Syntax: config {0} [<section>] [<key>]", firstParam); | ||
304 | Notice("Example: config {0} ScriptEngine.DotNetEngine NumberOfScriptThreads", firstParam); | ||
305 | } | ||
306 | |||
307 | break; | ||
308 | |||
309 | case "save": | ||
310 | if (cmdparams.Length < 2) | ||
311 | { | ||
312 | Notice("Syntax: config save <path>"); | ||
313 | return; | ||
314 | } | ||
315 | |||
316 | string path = cmdparams[1]; | ||
317 | Notice("Saving configuration file: {0}", path); | ||
318 | |||
319 | if (Config is IniConfigSource) | ||
320 | { | ||
321 | IniConfigSource iniCon = (IniConfigSource)Config; | ||
322 | iniCon.Save(path); | ||
323 | } | ||
324 | else if (Config is XmlConfigSource) | ||
325 | { | ||
326 | XmlConfigSource xmlCon = (XmlConfigSource)Config; | ||
327 | xmlCon.Save(path); | ||
328 | } | ||
329 | |||
330 | break; | ||
331 | } | ||
332 | } | ||
333 | } | ||
334 | |||
200 | private void HandleSetLogLevel(string module, string[] cmd) | 335 | private void HandleSetLogLevel(string module, string[] cmd) |
201 | { | 336 | { |
202 | if (cmd.Length != 4) | 337 | if (cmd.Length != 4) |
@@ -220,9 +355,8 @@ namespace OpenSim.Framework.Servers | |||
220 | m_consoleAppender.Threshold = consoleLevel; | 355 | m_consoleAppender.Threshold = consoleLevel; |
221 | else | 356 | else |
222 | Notice( | 357 | Notice( |
223 | String.Format( | 358 | "{0} is not a valid logging level. Valid logging levels are ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF", |
224 | "{0} is not a valid logging level. Valid logging levels are ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF", | 359 | rawLevel); |
225 | rawLevel)); | ||
226 | 360 | ||
227 | ShowLogLevel(); | 361 | ShowLogLevel(); |
228 | } | 362 | } |
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 e5aecbc..e654cf7 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 | ||
@@ -148,7 +148,7 @@ namespace OpenSim | |||
148 | break; | 148 | break; |
149 | case "rest": | 149 | case "rest": |
150 | m_console = new RemoteConsole("Region"); | 150 | m_console = new RemoteConsole("Region"); |
151 | ((RemoteConsole)m_console).ReadConfig(m_config.Source); | 151 | ((RemoteConsole)m_console).ReadConfig(Config); |
152 | break; | 152 | break; |
153 | default: | 153 | default: |
154 | m_console = new LocalConsole("Region"); | 154 | m_console = new LocalConsole("Region"); |
@@ -158,7 +158,7 @@ namespace OpenSim | |||
158 | 158 | ||
159 | MainConsole.Instance = m_console; | 159 | MainConsole.Instance = m_console; |
160 | 160 | ||
161 | RegisterCommonAppenders(m_config.Source.Configs["Startup"]); | 161 | RegisterCommonAppenders(Config.Configs["Startup"]); |
162 | RegisterConsoleCommands(); | 162 | RegisterConsoleCommands(); |
163 | 163 | ||
164 | base.StartupSpecific(); | 164 | base.StartupSpecific(); |
@@ -357,26 +357,6 @@ namespace OpenSim | |||
357 | "restart", | 357 | "restart", |
358 | "Restart all sims in this instance", RunCommand); | 358 | "Restart all sims in this instance", RunCommand); |
359 | 359 | ||
360 | m_console.Commands.AddCommand("General", false, "config set", | ||
361 | "config set <section> <key> <value>", | ||
362 | "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); | ||
363 | |||
364 | m_console.Commands.AddCommand("General", false, "config get", | ||
365 | "config get [<section>] [<key>]", | ||
366 | "Synonym for config show", | ||
367 | HandleConfig); | ||
368 | |||
369 | m_console.Commands.AddCommand("General", false, "config show", | ||
370 | "config show [<section>] [<key>]", | ||
371 | "Show config information", | ||
372 | "If neither section nor field are specified, then the whole current configuration is printed." + Environment.NewLine | ||
373 | + "If a section is given but not a field, then all fields in that section are printed.", | ||
374 | HandleConfig); | ||
375 | |||
376 | m_console.Commands.AddCommand("General", false, "config save", | ||
377 | "config save <path>", | ||
378 | "Save current configuration to a file at the given path", HandleConfig); | ||
379 | |||
380 | m_console.Commands.AddCommand("General", false, "command-script", | 360 | m_console.Commands.AddCommand("General", false, "command-script", |
381 | "command-script <script>", | 361 | "command-script <script>", |
382 | "Run a command script from file", RunCommand); | 362 | "Run a command script from file", RunCommand); |
@@ -619,111 +599,9 @@ namespace OpenSim | |||
619 | bool changed = PopulateRegionEstateInfo(regInfo); | 599 | bool changed = PopulateRegionEstateInfo(regInfo); |
620 | IScene scene; | 600 | IScene scene; |
621 | CreateRegion(regInfo, true, out scene); | 601 | CreateRegion(regInfo, true, out scene); |
622 | if (changed) | ||
623 | regInfo.EstateSettings.Save(); | ||
624 | } | ||
625 | |||
626 | /// <summary> | ||
627 | /// Change and load configuration file data. | ||
628 | /// </summary> | ||
629 | /// <param name="module"></param> | ||
630 | /// <param name="cmd"></param> | ||
631 | private void HandleConfig(string module, string[] cmd) | ||
632 | { | ||
633 | List<string> args = new List<string>(cmd); | ||
634 | args.RemoveAt(0); | ||
635 | string[] cmdparams = args.ToArray(); | ||
636 | 602 | ||
637 | if (cmdparams.Length > 0) | 603 | if (changed) |
638 | { | 604 | regInfo.EstateSettings.Save(); |
639 | string firstParam = cmdparams[0].ToLower(); | ||
640 | |||
641 | switch (firstParam) | ||
642 | { | ||
643 | case "set": | ||
644 | if (cmdparams.Length < 4) | ||
645 | { | ||
646 | Notice("Syntax: config set <section> <key> <value>"); | ||
647 | Notice("Example: config set ScriptEngine.DotNetEngine NumberOfScriptThreads 5"); | ||
648 | } | ||
649 | else | ||
650 | { | ||
651 | IConfig c; | ||
652 | IConfigSource source = new IniConfigSource(); | ||
653 | c = source.AddConfig(cmdparams[1]); | ||
654 | if (c != null) | ||
655 | { | ||
656 | string _value = String.Join(" ", cmdparams, 3, cmdparams.Length - 3); | ||
657 | c.Set(cmdparams[2], _value); | ||
658 | m_config.Source.Merge(source); | ||
659 | |||
660 | Notice("In section [{0}], set {1} = {2}", c.Name, cmdparams[2], _value); | ||
661 | } | ||
662 | } | ||
663 | break; | ||
664 | |||
665 | case "get": | ||
666 | case "show": | ||
667 | if (cmdparams.Length == 1) | ||
668 | { | ||
669 | foreach (IConfig config in m_config.Source.Configs) | ||
670 | { | ||
671 | Notice("[{0}]", config.Name); | ||
672 | string[] keys = config.GetKeys(); | ||
673 | foreach (string key in keys) | ||
674 | Notice(" {0} = {1}", key, config.GetString(key)); | ||
675 | } | ||
676 | } | ||
677 | else if (cmdparams.Length == 2 || cmdparams.Length == 3) | ||
678 | { | ||
679 | IConfig config = m_config.Source.Configs[cmdparams[1]]; | ||
680 | if (config == null) | ||
681 | { | ||
682 | Notice("Section \"{0}\" does not exist.",cmdparams[1]); | ||
683 | break; | ||
684 | } | ||
685 | else | ||
686 | { | ||
687 | if (cmdparams.Length == 2) | ||
688 | { | ||
689 | Notice("[{0}]", config.Name); | ||
690 | foreach (string key in config.GetKeys()) | ||
691 | Notice(" {0} = {1}", key, config.GetString(key)); | ||
692 | } | ||
693 | else | ||
694 | { | ||
695 | Notice( | ||
696 | "config get {0} {1} : {2}", | ||
697 | cmdparams[1], cmdparams[2], config.GetString(cmdparams[2])); | ||
698 | } | ||
699 | } | ||
700 | } | ||
701 | else | ||
702 | { | ||
703 | Notice("Syntax: config {0} [<section>] [<key>]", firstParam); | ||
704 | Notice("Example: config {0} ScriptEngine.DotNetEngine NumberOfScriptThreads", firstParam); | ||
705 | } | ||
706 | |||
707 | break; | ||
708 | |||
709 | case "save": | ||
710 | if (cmdparams.Length < 2) | ||
711 | { | ||
712 | Notice("Syntax: config save <path>"); | ||
713 | return; | ||
714 | } | ||
715 | |||
716 | if (Application.iniFilePath == cmdparams[1]) | ||
717 | { | ||
718 | Notice("Path can not be " + Application.iniFilePath); | ||
719 | return; | ||
720 | } | ||
721 | |||
722 | Notice("Saving configuration file: " + cmdparams[1]); | ||
723 | m_config.Save(cmdparams[1]); | ||
724 | break; | ||
725 | } | ||
726 | } | ||
727 | } | 605 | } |
728 | 606 | ||
729 | /// <summary> | 607 | /// <summary> |
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 618ce0a..b40aa4b 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( |
@@ -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) |
@@ -754,7 +749,7 @@ namespace OpenSim | |||
754 | protected override PhysicsScene GetPhysicsScene(string osSceneIdentifier) | 749 | protected override PhysicsScene GetPhysicsScene(string osSceneIdentifier) |
755 | { | 750 | { |
756 | return GetPhysicsScene( | 751 | return GetPhysicsScene( |
757 | m_configSettings.PhysicsEngine, m_configSettings.MeshEngineName, m_config.Source, osSceneIdentifier); | 752 | m_configSettings.PhysicsEngine, m_configSettings.MeshEngineName, Config, osSceneIdentifier); |
758 | } | 753 | } |
759 | 754 | ||
760 | /// <summary> | 755 | /// <summary> |
@@ -991,9 +986,9 @@ namespace OpenSim | |||
991 | 986 | ||
992 | string defaultEstateName = null; | 987 | string defaultEstateName = null; |
993 | 988 | ||
994 | if (m_config.Source.Configs[ESTATE_SECTION_NAME] != null) | 989 | if (Config.Configs[ESTATE_SECTION_NAME] != null) |
995 | { | 990 | { |
996 | defaultEstateName = m_config.Source.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateName", null); | 991 | defaultEstateName = Config.Configs[ESTATE_SECTION_NAME].GetString("DefaultEstateName", null); |
997 | 992 | ||
998 | if (defaultEstateName != null) | 993 | if (defaultEstateName != null) |
999 | { | 994 | { |
@@ -1076,28 +1071,14 @@ namespace OpenSim | |||
1076 | MainConsole.Instance.Output("Joining the estate failed. Please try again."); | 1071 | MainConsole.Instance.Output("Joining the estate failed. Please try again."); |
1077 | } | 1072 | } |
1078 | } | 1073 | } |
1079 | } | 1074 | } |
1080 | 1075 | ||
1081 | return true; // need to update the database | 1076 | return true; // need to update the database |
1082 | } | 1077 | } |
1083 | } | 1078 | } |
1084 | 1079 | ||
1085 | public class OpenSimConfigSource | 1080 | public class OpenSimConfigSource |
1086 | { | 1081 | { |
1087 | public IConfigSource Source; | 1082 | 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 | } | 1083 | } |
1103 | } | 1084 | } \ No newline at end of file |
diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs index 29b1c00..954783c 100644 --- a/OpenSim/Server/Base/HttpServerBase.cs +++ b/OpenSim/Server/Base/HttpServerBase.cs | |||
@@ -52,7 +52,7 @@ namespace OpenSim.Server.Base | |||
52 | 52 | ||
53 | protected override void ReadConfig() | 53 | protected override void ReadConfig() |
54 | { | 54 | { |
55 | IConfig networkConfig = m_Config.Configs["Network"]; | 55 | IConfig networkConfig = Config.Configs["Network"]; |
56 | 56 | ||
57 | if (networkConfig == null) | 57 | if (networkConfig == null) |
58 | { | 58 | { |
diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index ade4bab..2c2b8ed 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs | |||
@@ -56,15 +56,6 @@ namespace OpenSim.Server.Base | |||
56 | // | 56 | // |
57 | protected string[] m_Arguments; | 57 | protected string[] m_Arguments; |
58 | 58 | ||
59 | // Configuration | ||
60 | // | ||
61 | protected IConfigSource m_Config = null; | ||
62 | |||
63 | public IConfigSource Config | ||
64 | { | ||
65 | get { return m_Config; } | ||
66 | } | ||
67 | |||
68 | // Run flag | 59 | // Run flag |
69 | // | 60 | // |
70 | private bool m_Running = true; | 61 | private bool m_Running = true; |
@@ -118,11 +109,11 @@ namespace OpenSim.Server.Base | |||
118 | configUri.Scheme == Uri.UriSchemeHttp) | 109 | configUri.Scheme == Uri.UriSchemeHttp) |
119 | { | 110 | { |
120 | XmlReader r = XmlReader.Create(iniFile); | 111 | XmlReader r = XmlReader.Create(iniFile); |
121 | m_Config = new XmlConfigSource(r); | 112 | Config = new XmlConfigSource(r); |
122 | } | 113 | } |
123 | else | 114 | else |
124 | { | 115 | { |
125 | m_Config = new IniConfigSource(iniFile); | 116 | Config = new IniConfigSource(iniFile); |
126 | } | 117 | } |
127 | } | 118 | } |
128 | catch (Exception e) | 119 | catch (Exception e) |
@@ -134,13 +125,13 @@ namespace OpenSim.Server.Base | |||
134 | // Merge the configuration from the command line into the | 125 | // Merge the configuration from the command line into the |
135 | // loaded file | 126 | // loaded file |
136 | // | 127 | // |
137 | m_Config.Merge(argvConfig); | 128 | Config.Merge(argvConfig); |
138 | 129 | ||
139 | // Refresh the startupConfig post merge | 130 | // Refresh the startupConfig post merge |
140 | // | 131 | // |
141 | if (m_Config.Configs["Startup"] != null) | 132 | if (Config.Configs["Startup"] != null) |
142 | { | 133 | { |
143 | startupConfig = m_Config.Configs["Startup"]; | 134 | startupConfig = Config.Configs["Startup"]; |
144 | } | 135 | } |
145 | 136 | ||
146 | prompt = startupConfig.GetString("Prompt", prompt); | 137 | prompt = startupConfig.GetString("Prompt", prompt); |