aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Application
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Application/Application.cs33
-rw-r--r--OpenSim/Region/Application/ConfigurationLoader.cs45
-rw-r--r--OpenSim/Region/Application/IApplicationPlugin.cs12
-rw-r--r--OpenSim/Region/Application/OpenSim.cs95
4 files changed, 181 insertions, 4 deletions
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs
index ad157c6..df80290 100644
--- a/OpenSim/Region/Application/Application.cs
+++ b/OpenSim/Region/Application/Application.cs
@@ -36,25 +36,47 @@ using OpenSim.Framework.Console;
36 36
37namespace OpenSim 37namespace OpenSim
38{ 38{
39 /// <summary>
40 /// Starting class for the OpenSimulator Region
41 /// </summary>
39 public class Application 42 public class Application
40 { 43 {
44 /// <summary>
45 /// Text Console Logger
46 /// </summary>
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42 48
49 /// <summary>
50 /// Path to the main ini Configuration file
51 /// </summary>
43 public static string iniFilePath = ""; 52 public static string iniFilePath = "";
44 53
54 /// <summary>
55 /// Save Crashes in the bin/crashes folder. Configurable with m_crashDir
56 /// </summary>
45 public static bool m_saveCrashDumps = false; 57 public static bool m_saveCrashDumps = false;
58
59 /// <summary>
60 /// Directory to save crash reports to. Relative to bin/
61 /// </summary>
46 public static string m_crashDir = "crashes"; 62 public static string m_crashDir = "crashes";
47 63
64 /// <summary>
65 /// Instance of the OpenSim class. This could be OpenSim or OpenSimBackground depending on the configuration
66 /// </summary>
48 protected static OpenSimBase m_sim = null; 67 protected static OpenSimBase m_sim = null;
49 68
50 //could move our main function into OpenSimMain and kill this class 69 //could move our main function into OpenSimMain and kill this class
51 public static void Main(string[] args) 70 public static void Main(string[] args)
52 { 71 {
53 // First line 72 // First line, hook the appdomain to the crash reporter
54 AppDomain.CurrentDomain.UnhandledException += 73 AppDomain.CurrentDomain.UnhandledException +=
55 new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); 74 new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
56 75
76 // Add the arguments supplied when running the application to the configuration
57 ArgvConfigSource configSource = new ArgvConfigSource(args); 77 ArgvConfigSource configSource = new ArgvConfigSource(args);
78
79 // Configure Log4Net
58 configSource.AddSwitch("Startup", "logconfig"); 80 configSource.AddSwitch("Startup", "logconfig");
59 string logConfigFile = configSource.Configs["Startup"].GetString("logconfig", String.Empty); 81 string logConfigFile = configSource.Configs["Startup"].GetString("logconfig", String.Empty);
60 if (logConfigFile != String.Empty) 82 if (logConfigFile != String.Empty)
@@ -69,6 +91,8 @@ namespace OpenSim
69 m_log.Info("[OPENSIM MAIN]: configured log4net using default OpenSim.exe.config"); 91 m_log.Info("[OPENSIM MAIN]: configured log4net using default OpenSim.exe.config");
70 } 92 }
71 93
94 // Check if the system is compatible with OpenSimulator.
95 // Ensures that the minimum system requirements are met
72 m_log.Info("Performing compatibility checks... "); 96 m_log.Info("Performing compatibility checks... ");
73 string supported = String.Empty; 97 string supported = String.Empty;
74 if (Util.IsEnvironmentSupported(ref supported)) 98 if (Util.IsEnvironmentSupported(ref supported))
@@ -80,6 +104,7 @@ namespace OpenSim
80 m_log.Warn("Environment is unsupported (" + supported + ")\n"); 104 m_log.Warn("Environment is unsupported (" + supported + ")\n");
81 } 105 }
82 106
107 // Configure nIni aliases and localles
83 Culture.SetCurrentCulture(); 108 Culture.SetCurrentCulture();
84 109
85 110
@@ -99,8 +124,13 @@ namespace OpenSim
99 configSource.AddConfig("StandAlone"); 124 configSource.AddConfig("StandAlone");
100 configSource.AddConfig("Network"); 125 configSource.AddConfig("Network");
101 126
127 // Check if we're running in the background or not
102 bool background = configSource.Configs["Startup"].GetBoolean("background", false); 128 bool background = configSource.Configs["Startup"].GetBoolean("background", false);
129
130 // Check if we're saving crashes
103 m_saveCrashDumps = configSource.Configs["Startup"].GetBoolean("save_crashes", false); 131 m_saveCrashDumps = configSource.Configs["Startup"].GetBoolean("save_crashes", false);
132
133 // load Crash directory config
104 m_crashDir = configSource.Configs["Startup"].GetString("crash_dir", m_crashDir); 134 m_crashDir = configSource.Configs["Startup"].GetString("crash_dir", m_crashDir);
105 135
106 if (background) 136 if (background)
@@ -118,6 +148,7 @@ namespace OpenSim
118 { 148 {
119 try 149 try
120 { 150 {
151 // Block thread here for input
121 MainConsole.Instance.Prompt(); 152 MainConsole.Instance.Prompt();
122 } 153 }
123 catch (Exception e) 154 catch (Exception e)
diff --git a/OpenSim/Region/Application/ConfigurationLoader.cs b/OpenSim/Region/Application/ConfigurationLoader.cs
index 3a65242..c3e7b86 100644
--- a/OpenSim/Region/Application/ConfigurationLoader.cs
+++ b/OpenSim/Region/Application/ConfigurationLoader.cs
@@ -37,12 +37,32 @@ using OpenSim.Framework;
37 37
38namespace OpenSim 38namespace OpenSim
39{ 39{
40 /// <summary>
41 /// Loads the Configuration files into nIni
42 /// </summary>
40 public class ConfigurationLoader 43 public class ConfigurationLoader
41 { 44 {
45 /// <summary>
46 /// Various Config settings the region needs to start
47 /// Physics Engine, Mesh Engine, GridMode, PhysicsPrim allowed, Neighbor,
48 /// StorageDLL, Storage Connection String, Estate connection String, Client Stack
49 /// Standalone settings.
50 /// </summary>
42 protected ConfigSettings m_configSettings; 51 protected ConfigSettings m_configSettings;
52
53 /// <summary>
54 /// A source of Configuration data
55 /// </summary>
43 protected OpenSimConfigSource m_config; 56 protected OpenSimConfigSource m_config;
57
58 /// <summary>
59 /// Grid Service Information. This refers to classes and addresses of the grid service
60 /// </summary>
44 protected NetworkServersInfo m_networkServersInfo; 61 protected NetworkServersInfo m_networkServersInfo;
45 62
63 /// <summary>
64 /// Console logger
65 /// </summary>
46 private static readonly ILog m_log = 66 private static readonly ILog m_log =
47 LogManager.GetLogger( 67 LogManager.GetLogger(
48 MethodBase.GetCurrentMethod().DeclaringType); 68 MethodBase.GetCurrentMethod().DeclaringType);
@@ -51,6 +71,13 @@ namespace OpenSim
51 { 71 {
52 } 72 }
53 73
74 /// <summary>
75 /// Loads the region configuration
76 /// </summary>
77 /// <param name="argvSource">Parameters passed into the process when started</param>
78 /// <param name="configSettings"></param>
79 /// <param name="networkInfo"></param>
80 /// <returns>A configuration that gets passed to modules</returns>
54 public OpenSimConfigSource LoadConfigSettings( 81 public OpenSimConfigSource LoadConfigSettings(
55 IConfigSource argvSource, out ConfigSettings configSettings, 82 IConfigSource argvSource, out ConfigSettings configSettings,
56 out NetworkServersInfo networkInfo) 83 out NetworkServersInfo networkInfo)
@@ -169,15 +196,22 @@ namespace OpenSim
169 return m_config; 196 return m_config;
170 } 197 }
171 198
199 /// <summary>
200 /// Adds the included files as ini configuration files
201 /// </summary>
202 /// <param name="sources">List of URL strings or filename strings</param>
172 private void AddIncludes(List<string> sources) 203 private void AddIncludes(List<string> sources)
173 { 204 {
205 //loop over config sources
174 foreach (IConfig config in m_config.Source.Configs) 206 foreach (IConfig config in m_config.Source.Configs)
175 { 207 {
208 // Look for Include-* in the key name
176 string[] keys = config.GetKeys(); 209 string[] keys = config.GetKeys();
177 foreach (string k in keys) 210 foreach (string k in keys)
178 { 211 {
179 if (k.StartsWith("Include-")) 212 if (k.StartsWith("Include-"))
180 { 213 {
214 // read the config file to be included.
181 string file = config.GetString(k); 215 string file = config.GetString(k);
182 if (IsUri(file)) 216 if (IsUri(file))
183 { 217 {
@@ -199,7 +233,11 @@ namespace OpenSim
199 } 233 }
200 } 234 }
201 } 235 }
202 236 /// <summary>
237 /// Check if we can convert the string to a URI
238 /// </summary>
239 /// <param name="file">String uri to the remote resource</param>
240 /// <returns>true if we can convert the string to a Uri object</returns>
203 bool IsUri(string file) 241 bool IsUri(string file)
204 { 242 {
205 Uri configUri; 243 Uri configUri;
@@ -253,7 +291,7 @@ namespace OpenSim
253 /// <summary> 291 /// <summary>
254 /// Setup a default config values in case they aren't present in the ini file 292 /// Setup a default config values in case they aren't present in the ini file
255 /// </summary> 293 /// </summary>
256 /// <returns></returns> 294 /// <returns>A Configuration source containing the default configuration</returns>
257 private static IConfigSource DefaultConfig() 295 private static IConfigSource DefaultConfig()
258 { 296 {
259 IConfigSource defaultConfig = new IniConfigSource(); 297 IConfigSource defaultConfig = new IniConfigSource();
@@ -322,6 +360,9 @@ namespace OpenSim
322 return defaultConfig; 360 return defaultConfig;
323 } 361 }
324 362
363 /// <summary>
364 /// Read initial region settings from the ConfigSource
365 /// </summary>
325 protected virtual void ReadConfigSettings() 366 protected virtual void ReadConfigSettings()
326 { 367 {
327 IConfig startupConfig = m_config.Source.Configs["Startup"]; 368 IConfig startupConfig = m_config.Source.Configs["Startup"];
diff --git a/OpenSim/Region/Application/IApplicationPlugin.cs b/OpenSim/Region/Application/IApplicationPlugin.cs
index 1e1dae0..6e6d48c 100644
--- a/OpenSim/Region/Application/IApplicationPlugin.cs
+++ b/OpenSim/Region/Application/IApplicationPlugin.cs
@@ -29,12 +29,24 @@ using OpenSim.Framework;
29 29
30namespace OpenSim 30namespace OpenSim
31{ 31{
32 /// <summary>
33 /// OpenSimulator Application Plugin framework interface
34 /// </summary>
32 public interface IApplicationPlugin : IPlugin 35 public interface IApplicationPlugin : IPlugin
33 { 36 {
37 /// <summary>
38 /// Initialize the Plugin
39 /// </summary>
40 /// <param name="openSim">The Application instance</param>
34 void Initialise(OpenSimBase openSim); 41 void Initialise(OpenSimBase openSim);
42
43 /// <summary>
44 /// Called when the application loading is completed
45 /// </summary>
35 void PostInitialise(); 46 void PostInitialise();
36 } 47 }
37 48
49
38 public class ApplicationPluginInitialiser : PluginInitialiserBase 50 public class ApplicationPluginInitialiser : PluginInitialiserBase
39 { 51 {
40 private OpenSimBase server; 52 private OpenSimBase server;
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index aeb6f57..390cfcd 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -146,6 +146,9 @@ namespace OpenSim
146 ChangeSelectedRegion("region", new string[] {"change", "region", "root"}); 146 ChangeSelectedRegion("region", new string[] {"change", "region", "root"});
147 } 147 }
148 148
149 /// <summary>
150 /// Register standard set of region console commands
151 /// </summary>
149 private void RegisterConsoleCommands() 152 private void RegisterConsoleCommands()
150 { 153 {
151 m_console.Commands.AddCommand("region", false, "clear assets", 154 m_console.Commands.AddCommand("region", false, "clear assets",
@@ -332,6 +335,11 @@ namespace OpenSim
332 base.ShutdownSpecific(); 335 base.ShutdownSpecific();
333 } 336 }
334 337
338 /// <summary>
339 /// Timer to run a specific text file as console commands. Configured in in the main ini file
340 /// </summary>
341 /// <param name="sender"></param>
342 /// <param name="e"></param>
335 private void RunAutoTimerScript(object sender, EventArgs e) 343 private void RunAutoTimerScript(object sender, EventArgs e)
336 { 344 {
337 if (m_timedScript != "disabled") 345 if (m_timedScript != "disabled")
@@ -342,6 +350,11 @@ namespace OpenSim
342 350
343 #region Console Commands 351 #region Console Commands
344 352
353 /// <summary>
354 /// Kicks users off the region
355 /// </summary>
356 /// <param name="module"></param>
357 /// <param name="cmdparams">name of avatar to kick</param>
345 private void KickUserCommand(string module, string[] cmdparams) 358 private void KickUserCommand(string module, string[] cmdparams)
346 { 359 {
347 if (cmdparams.Length < 4) 360 if (cmdparams.Length < 4)
@@ -401,6 +414,10 @@ namespace OpenSim
401 } 414 }
402 } 415 }
403 416
417 /// <summary>
418 /// Opens a file and uses it as input to the console command parser.
419 /// </summary>
420 /// <param name="fileName">name of file to use as input to the console</param>
404 private static void PrintFileToConsole(string fileName) 421 private static void PrintFileToConsole(string fileName)
405 { 422 {
406 if (File.Exists(fileName)) 423 if (File.Exists(fileName))
@@ -419,12 +436,22 @@ namespace OpenSim
419 m_log.Info("Not implemented."); 436 m_log.Info("Not implemented.");
420 } 437 }
421 438
439 /// <summary>
440 /// Force resending of all updates to all clients in active region(s)
441 /// </summary>
442 /// <param name="module"></param>
443 /// <param name="args"></param>
422 private void HandleForceUpdate(string module, string[] args) 444 private void HandleForceUpdate(string module, string[] args)
423 { 445 {
424 m_log.Info("Updating all clients"); 446 m_log.Info("Updating all clients");
425 m_sceneManager.ForceCurrentSceneClientUpdate(); 447 m_sceneManager.ForceCurrentSceneClientUpdate();
426 } 448 }
427 449
450 /// <summary>
451 /// Edits the scale of a primative with the name specified
452 /// </summary>
453 /// <param name="module"></param>
454 /// <param name="args">0,1, name, x, y, z</param>
428 private void HandleEditScale(string module, string[] args) 455 private void HandleEditScale(string module, string[] args)
429 { 456 {
430 if (args.Length == 6) 457 if (args.Length == 6)
@@ -437,6 +464,11 @@ namespace OpenSim
437 } 464 }
438 } 465 }
439 466
467 /// <summary>
468 /// Creates a new region based on the parameters specified. This will ask the user questions on the console
469 /// </summary>
470 /// <param name="module"></param>
471 /// <param name="cmd">0,1,region name, region XML file</param>
440 private void HandleCreateRegion(string module, string[] cmd) 472 private void HandleCreateRegion(string module, string[] cmd)
441 { 473 {
442 if (cmd.Length < 4) 474 if (cmd.Length < 4)
@@ -473,16 +505,32 @@ namespace OpenSim
473 } 505 }
474 } 506 }
475 507
508 /// <summary>
509 /// Enable logins
510 /// </summary>
511 /// <param name="module"></param>
512 /// <param name="cmd"></param>
476 private void HandleLoginEnable(string module, string[] cmd) 513 private void HandleLoginEnable(string module, string[] cmd)
477 { 514 {
478 ProcessLogin(true); 515 ProcessLogin(true);
479 } 516 }
480 517
518
519 /// <summary>
520 /// Disable logins
521 /// </summary>
522 /// <param name="module"></param>
523 /// <param name="cmd"></param>
481 private void HandleLoginDisable(string module, string[] cmd) 524 private void HandleLoginDisable(string module, string[] cmd)
482 { 525 {
483 ProcessLogin(false); 526 ProcessLogin(false);
484 } 527 }
485 528
529 /// <summary>
530 /// Log login status to the console
531 /// </summary>
532 /// <param name="module"></param>
533 /// <param name="cmd"></param>
486 private void HandleLoginStatus(string module, string[] cmd) 534 private void HandleLoginStatus(string module, string[] cmd)
487 { 535 {
488 if (m_commsManager.GridService.RegionLoginsEnabled == false) 536 if (m_commsManager.GridService.RegionLoginsEnabled == false)
@@ -492,6 +540,12 @@ namespace OpenSim
492 m_log.Info("[ Login ] Login are enabled"); 540 m_log.Info("[ Login ] Login are enabled");
493 } 541 }
494 542
543
544 /// <summary>
545 /// Change and load configuration file data.
546 /// </summary>
547 /// <param name="module"></param>
548 /// <param name="cmd"></param>
495 private void HandleConfig(string module, string[] cmd) 549 private void HandleConfig(string module, string[] cmd)
496 { 550 {
497 List<string> args = new List<string>(cmd); 551 List<string> args = new List<string>(cmd);
@@ -557,6 +611,12 @@ namespace OpenSim
557 } 611 }
558 } 612 }
559 613
614
615 /// <summary>
616 /// Load, Unload, and list Region modules in use
617 /// </summary>
618 /// <param name="module"></param>
619 /// <param name="cmd"></param>
560 private void HandleModules(string module, string[] cmd) 620 private void HandleModules(string module, string[] cmd)
561 { 621 {
562 List<string> args = new List<string>(cmd); 622 List<string> args = new List<string>(cmd);
@@ -797,6 +857,11 @@ namespace OpenSim
797 } 857 }
798 858
799 // see BaseOpenSimServer 859 // see BaseOpenSimServer
860 /// <summary>
861 /// Many commands list objects for debugging. Some of the types are listed here
862 /// </summary>
863 /// <param name="mod"></param>
864 /// <param name="cmd"></param>
800 public override void HandleShow(string mod, string[] cmd) 865 public override void HandleShow(string mod, string[] cmd)
801 { 866 {
802 base.HandleShow(mod, cmd); 867 base.HandleShow(mod, cmd);
@@ -902,6 +967,10 @@ namespace OpenSim
902 } 967 }
903 } 968 }
904 969
970 /// <summary>
971 /// print UDP Queue data for each client
972 /// </summary>
973 /// <returns></returns>
905 private string GetQueuesReport() 974 private string GetQueuesReport()
906 { 975 {
907 string report = String.Empty; 976 string report = String.Empty;
@@ -1010,6 +1079,11 @@ namespace OpenSim
1010 m_commsManager.UserAdminService.ResetUserPassword(firstName, lastName, newPassword); 1079 m_commsManager.UserAdminService.ResetUserPassword(firstName, lastName, newPassword);
1011 } 1080 }
1012 1081
1082 /// <summary>
1083 /// Use XML2 format to serialize data to a file
1084 /// </summary>
1085 /// <param name="module"></param>
1086 /// <param name="cmdparams"></param>
1013 protected void SavePrimsXml2(string module, string[] cmdparams) 1087 protected void SavePrimsXml2(string module, string[] cmdparams)
1014 { 1088 {
1015 if (cmdparams.Length > 5) 1089 if (cmdparams.Length > 5)
@@ -1022,6 +1096,11 @@ namespace OpenSim
1022 } 1096 }
1023 } 1097 }
1024 1098
1099 /// <summary>
1100 /// Use XML format to serialize data to a file
1101 /// </summary>
1102 /// <param name="module"></param>
1103 /// <param name="cmdparams"></param>
1025 protected void SaveXml(string module, string[] cmdparams) 1104 protected void SaveXml(string module, string[] cmdparams)
1026 { 1105 {
1027 m_log.Error("[CONSOLE]: PLEASE NOTE, save-xml is DEPRECATED and may be REMOVED soon. If you are using this and there is some reason you can't use save-xml2, please file a mantis detailing the reason."); 1106 m_log.Error("[CONSOLE]: PLEASE NOTE, save-xml is DEPRECATED and may be REMOVED soon. If you are using this and there is some reason you can't use save-xml2, please file a mantis detailing the reason.");
@@ -1036,6 +1115,11 @@ namespace OpenSim
1036 } 1115 }
1037 } 1116 }
1038 1117
1118 /// <summary>
1119 /// Loads data and region objects from XML format.
1120 /// </summary>
1121 /// <param name="module"></param>
1122 /// <param name="cmdparams"></param>
1039 protected void LoadXml(string module, string[] cmdparams) 1123 protected void LoadXml(string module, string[] cmdparams)
1040 { 1124 {
1041 m_log.Error("[CONSOLE]: PLEASE NOTE, load-xml is DEPRECATED and may be REMOVED soon. If you are using this and there is some reason you can't use load-xml2, please file a mantis detailing the reason."); 1125 m_log.Error("[CONSOLE]: PLEASE NOTE, load-xml is DEPRECATED and may be REMOVED soon. If you are using this and there is some reason you can't use load-xml2, please file a mantis detailing the reason.");
@@ -1079,7 +1163,11 @@ namespace OpenSim
1079 } 1163 }
1080 } 1164 }
1081 } 1165 }
1082 1166 /// <summary>
1167 /// Serialize region data to XML2Format
1168 /// </summary>
1169 /// <param name="module"></param>
1170 /// <param name="cmdparams"></param>
1083 protected void SaveXml2(string module, string[] cmdparams) 1171 protected void SaveXml2(string module, string[] cmdparams)
1084 { 1172 {
1085 if (cmdparams.Length > 2) 1173 if (cmdparams.Length > 2)
@@ -1092,6 +1180,11 @@ namespace OpenSim
1092 } 1180 }
1093 } 1181 }
1094 1182
1183 /// <summary>
1184 /// Load region data from Xml2Format
1185 /// </summary>
1186 /// <param name="module"></param>
1187 /// <param name="cmdparams"></param>
1095 protected void LoadXml2(string module, string[] cmdparams) 1188 protected void LoadXml2(string module, string[] cmdparams)
1096 { 1189 {
1097 if (cmdparams.Length > 2) 1190 if (cmdparams.Length > 2)