aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-02-05 21:35:59 +0000
committerJustin Clarke Casey2009-02-05 21:35:59 +0000
commit732cd838b1ce2bc5d2c312f510818fd63db76be4 (patch)
tree66617238b33626990d7eb2d9f5da041f3e57eaa6 /OpenSim
parent* Use the commander name to register module commanders instead of providing t... (diff)
downloadopensim-SC-732cd838b1ce2bc5d2c312f510818fd63db76be4.zip
opensim-SC-732cd838b1ce2bc5d2c312f510818fd63db76be4.tar.gz
opensim-SC-732cd838b1ce2bc5d2c312f510818fd63db76be4.tar.bz2
opensim-SC-732cd838b1ce2bc5d2c312f510818fd63db76be4.tar.xz
* Make existing module commanders register as help topics
* Typing help will now give a list of these topics at the top (as well as the rest of the current help stuff) * Typing help <topic> will give information about commands specific to that topic
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs28
-rw-r--r--OpenSim/Region/Application/OpenSim.cs102
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs12
-rw-r--r--OpenSim/Region/Environment/Interfaces/ICommander.cs9
-rw-r--r--OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/Commander.cs34
-rw-r--r--OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/CommanderTestModule.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneBase.cs10
10 files changed, 133 insertions, 70 deletions
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index 4d82020..473991a 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -104,6 +104,16 @@ namespace OpenSim.Framework.Servers
104 /// Should be overriden and referenced by descendents if they need to perform extra shutdown processing 104 /// Should be overriden and referenced by descendents if they need to perform extra shutdown processing
105 /// </summary> 105 /// </summary>
106 public virtual void ShutdownSpecific() {} 106 public virtual void ShutdownSpecific() {}
107
108 /// <summary>
109 /// Provides a list of help topics that are available. Overriding classes should append their topics to the
110 /// information returned when the base method is called.
111 /// </summary>
112 ///
113 /// <returns>
114 /// A list of strings that represent different help topics on which more information is available
115 /// </returns>
116 protected virtual List<string> GetHelpTopics() { return new List<string>(); }
107 117
108 /// <summary> 118 /// <summary>
109 /// Print statistics to the logfile, if they are active 119 /// Print statistics to the logfile, if they are active
@@ -310,11 +320,20 @@ namespace OpenSim.Framework.Servers
310 /// <param name="helpArgs"></param> 320 /// <param name="helpArgs"></param>
311 protected virtual void ShowHelp(string[] helpArgs) 321 protected virtual void ShowHelp(string[] helpArgs)
312 { 322 {
323 Notice("");
324
313 if (helpArgs.Length == 0) 325 if (helpArgs.Length == 0)
314 { 326 {
315 Notice(""); 327 List<string> helpTopics = GetHelpTopics();
316 // TODO: not yet implemented 328
317 //Notice("help [command] - display general help or specific command help. Try help help for more info."); 329 if (helpTopics.Count > 0)
330 {
331 Notice(
332 "As well as the help information below, you can also type help <topic> to get more information on the following areas:");
333 Notice(string.Format(" {0}", string.Join(", ", helpTopics.ToArray())));
334 Notice("");
335 }
336
318 Notice("quit - equivalent to shutdown."); 337 Notice("quit - equivalent to shutdown.");
319 338
320 Notice("set log level [level] - change the console logging level only. For example, off or debug."); 339 Notice("set log level [level] - change the console logging level only. For example, off or debug.");
@@ -326,7 +345,8 @@ namespace OpenSim.Framework.Servers
326 Notice("show threads - list tracked threads"); 345 Notice("show threads - list tracked threads");
327 Notice("show uptime - show server startup time and uptime."); 346 Notice("show uptime - show server startup time and uptime.");
328 Notice("show version - show server version."); 347 Notice("show version - show server version.");
329 Notice("shutdown - shutdown the server.\n"); 348 Notice("shutdown - shutdown the server.");
349 Notice("");
330 350
331 return; 351 return;
332 } 352 }
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index ac6a5c1..33621a9 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -496,6 +496,7 @@ namespace OpenSim
496 case "reset": 496 case "reset":
497 Reset(cmdparams); 497 Reset(cmdparams);
498 break; 498 break;
499
499 case "predecode-j2k": 500 case "predecode-j2k":
500 if (cmdparams.Length > 0) 501 if (cmdparams.Length > 0)
501 { 502 {
@@ -661,53 +662,62 @@ namespace OpenSim
661 { 662 {
662 base.ShowHelp(helpArgs); 663 base.ShowHelp(helpArgs);
663 664
664 m_console.Notice("alert - send alert to a designated user or all users."); 665 if (helpArgs.Length == 0)
665 m_console.Notice(" alert [First] [Last] [Message] - send an alert to a user. Case sensitive."); 666 {
666 m_console.Notice(" alert general [Message] - send an alert to all users."); 667 m_console.Notice("alert - send alert to a designated user or all users.");
667 m_console.Notice("backup - persist simulator objects to the database ahead of the normal schedule."); 668 m_console.Notice(" alert [First] [Last] [Message] - send an alert to a user. Case sensitive.");
668 m_console.Notice("clear-assets - clear the asset cache"); 669 m_console.Notice(" alert general [Message] - send an alert to all users.");
669 m_console.Notice("create-region <name> <regionfile.xml> - create a new region"); 670 m_console.Notice("backup - persist simulator objects to the database ahead of the normal schedule.");
670 m_console.Notice("change-region <name> - select the region that single region commands operate upon."); 671 m_console.Notice("clear-assets - clear the asset cache");
671 m_console.Notice("command-script [filename] - Execute command in a file."); 672 m_console.Notice("create-region <name> <regionfile.xml> - create a new region");
672 m_console.Notice("debug - debugging commands"); 673 m_console.Notice("change-region <name> - select the region that single region commands operate upon.");
673 m_console.Notice(" debug packet 0..255 - print incoming/outgoing packets (0=off)"); 674 m_console.Notice("command-script [filename] - Execute command in a file.");
674 m_console.Notice(" debug scene [scripting] [collision] [physics] - Enable/Disable debug stuff, each can be True/False"); 675 m_console.Notice("debug - debugging commands");
675 m_console.Notice("edit-scale [prim name] [x] [y] [z] - resize given prim"); 676 m_console.Notice(" debug packet 0..255 - print incoming/outgoing packets (0=off)");
676 m_console.Notice("export-map [filename] - save image of world map"); 677 m_console.Notice(" debug scene [scripting] [collision] [physics] - Enable/Disable debug stuff, each can be True/False");
677 m_console.Notice("force-update - force an update of prims in the scene"); 678 m_console.Notice("edit-scale [prim name] [x] [y] [z] - resize given prim");
678 m_console.Notice("restart - disconnects all clients and restarts the sims in the instance."); 679 m_console.Notice("export-map [filename] - save image of world map");
679 m_console.Notice("remove-region [name] - remove a region"); 680 m_console.Notice("force-update - force an update of prims in the scene");
680 m_console.Notice("delete-region [name] - delete a region and its associated region file"); 681 m_console.Notice("restart - disconnects all clients and restarts the sims in the instance.");
681 m_console.Notice("load-xml [filename] - load prims from XML (DEPRECATED)"); 682 m_console.Notice("remove-region [name] - remove a region");
682 m_console.Notice("save-xml [filename] - save prims to XML (DEPRECATED)"); 683 m_console.Notice("delete-region [name] - delete a region and its associated region file");
683 m_console.Notice("save-xml2 [filename] - save prims to XML using version 2 format"); 684 m_console.Notice("load-xml [filename] - load prims from XML (DEPRECATED)");
684 m_console.Notice("load-xml2 [filename] - load prims from XML using version 2 format"); 685 m_console.Notice("save-xml [filename] - save prims to XML (DEPRECATED)");
685 m_console.Notice("load-oar [filename] - load an OpenSimulator region archive. This replaces everything in the current region."); 686 m_console.Notice("save-xml2 [filename] - save prims to XML using version 2 format");
686 m_console.Notice("save-oar [filename] - Save the current region to an OpenSimulator region archive."); 687 m_console.Notice("load-xml2 [filename] - load prims from XML using version 2 format");
687 m_console.Notice("script - manually trigger scripts? or script commands?"); 688 m_console.Notice("load-oar [filename] - load an OpenSimulator region archive. This replaces everything in the current region.");
688 m_console.Notice("show assets - show state of asset cache."); 689 m_console.Notice("save-oar [filename] - Save the current region to an OpenSimulator region archive.");
689 m_console.Notice("show modules - shows info about loaded modules."); 690 m_console.Notice("script - manually trigger scripts? or script commands?");
690 m_console.Notice("show queues - show packet queues length for all clients."); 691 m_console.Notice("show assets - show state of asset cache.");
691 m_console.Notice("show regions - show running region information."); 692 m_console.Notice("show modules - shows info about loaded modules.");
692 m_console.Notice("show users - show info about connected users (only root agents)."); 693 m_console.Notice("show queues - show packet queues length for all clients.");
693 m_console.Notice("show users full - show info about connected users (root and child agents)."); 694 m_console.Notice("show regions - show running region information.");
694 m_console.Notice("config set section field value - set a config value"); 695 m_console.Notice("show users - show info about connected users (only root agents).");
695 m_console.Notice("config get section field - get a config value"); 696 m_console.Notice("show users full - show info about connected users (root and child agents).");
696 m_console.Notice("config save - save OpenSim.ini"); 697 m_console.Notice("config set section field value - set a config value");
697 m_console.Notice("terrain help - show help for terrain commands."); 698 m_console.Notice("config get section field - get a config value");
698 m_console.Notice("login-enable - Allows login at sim level"); 699 m_console.Notice("config save - save OpenSim.ini");
699 m_console.Notice("login-disable - Disable login at sim level"); 700 m_console.Notice("login-enable - Allows login at sim level");
700 m_console.Notice("login-status - Show the actual login status"); 701 m_console.Notice("login-disable - Disable login at sim level");
701 m_console.Notice("predecode-j2k - Precache assets,decode j2k layerdata, First parameter is threads to use"); 702 m_console.Notice("login-status - Show the actual login status");
702 703 m_console.Notice("predecode-j2k - Precache assets,decode j2k layerdata, First parameter is threads to use");
703 ShowPluginCommandsHelp(CombineParams(helpArgs, 0), m_console); 704 ShowPluginCommandsHelp(CombineParams(helpArgs, 0), m_console);
704 705
705 if (ConfigurationSettings.Standalone) 706 if (ConfigurationSettings.Standalone)
706 { 707 {
707 m_console.Notice(""); 708 m_console.Notice("");
708 m_console.Notice("create user - adds a new user."); 709 m_console.Notice("create user - adds a new user.");
709 m_console.Notice("reset user password - reset a user's password."); 710 m_console.Notice("reset user password - reset a user's password.");
711 }
710 } 712 }
713 else
714 {
715 ICommander moduleCommander = SceneManager.CurrentOrFirstScene.GetCommander(helpArgs[0]);
716 if (moduleCommander != null)
717 {
718 m_console.Notice(moduleCommander.Help);
719 }
720 }
711 } 721 }
712 722
713 // see BaseOpenSimServer 723 // see BaseOpenSimServer
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index aca1829..89f16d6 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -59,7 +59,7 @@ namespace OpenSim
59 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 59 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
60 60
61 protected string proxyUrl; 61 protected string proxyUrl;
62 protected int proxyOffset = 0; 62 protected int proxyOffset = 0;
63 63
64 /// <summary> 64 /// <summary>
65 /// The file used to load and save prim backup xml if no filename has been specified 65 /// The file used to load and save prim backup xml if no filename has been specified
@@ -158,7 +158,15 @@ namespace OpenSim
158 loader.Load("/OpenSim/Startup"); 158 loader.Load("/OpenSim/Startup");
159 m_plugins = loader.Plugins; 159 m_plugins = loader.Plugins;
160 } 160 }
161 161
162 protected override List<string> GetHelpTopics()
163 {
164 List<string> topics = base.GetHelpTopics();
165 topics.AddRange(SceneManager.CurrentOrFirstScene.GetCommanders().Keys);
166
167 return topics;
168 }
169
162 /// <summary> 170 /// <summary>
163 /// Performs startup specific to this region server, including initialization of the scene 171 /// Performs startup specific to this region server, including initialization of the scene
164 /// such as loading configuration from disk. 172 /// such as loading configuration from disk.
diff --git a/OpenSim/Region/Environment/Interfaces/ICommander.cs b/OpenSim/Region/Environment/Interfaces/ICommander.cs
index a267115..a61ce490 100644
--- a/OpenSim/Region/Environment/Interfaces/ICommander.cs
+++ b/OpenSim/Region/Environment/Interfaces/ICommander.cs
@@ -29,10 +29,15 @@ namespace OpenSim.Region.Environment.Interfaces
29{ 29{
30 public interface ICommander 30 public interface ICommander
31 { 31 {
32 /// <summary> 32 /// <value>
33 /// The name of this commander 33 /// The name of this commander
34 /// </summary> 34 /// </value>
35 string Name { get; } 35 string Name { get; }
36
37 /// <value>
38 /// Provide general help information about this commander.
39 /// </value>
40 string Help { get; }
36 41
37 void ProcessConsoleCommand(string function, string[] args); 42 void ProcessConsoleCommand(string function, string[] args);
38 void RegisterCommand(string commandName, ICommand command); 43 void RegisterCommand(string commandName, ICommand command);
diff --git a/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/Commander.cs b/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/Commander.cs
index caaa808..d5f4c80 100644
--- a/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/Commander.cs
+++ b/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/Commander.cs
@@ -52,6 +52,23 @@ namespace OpenSim.Region.Environment.Modules.Framework.InterfaceCommander
52 get { return m_name; } 52 get { return m_name; }
53 } 53 }
54 private string m_name; 54 private string m_name;
55
56 public string Help
57 {
58 get
59 {
60 StringBuilder sb = new StringBuilder();
61
62 sb.AppendLine("===" + m_name + "===");
63
64 foreach (ICommand com in m_commands.Values)
65 {
66 sb.AppendLine("* " + com.Name + " - " + com.Help);
67 }
68
69 return sb.ToString();
70 }
71 }
55 72
56 /// <summary> 73 /// <summary>
57 /// Constructor 74 /// Constructor
@@ -60,7 +77,10 @@ namespace OpenSim.Region.Environment.Modules.Framework.InterfaceCommander
60 public Commander(string name) 77 public Commander(string name)
61 { 78 {
62 m_name = name; 79 m_name = name;
63 m_generatedApiClassName = m_name; 80 m_generatedApiClassName = m_name[0].ToString().ToUpper();
81
82 if (m_name.Length > 1)
83 m_generatedApiClassName += m_name.Substring(1);
64 } 84 }
65 85
66 /// <value> 86 /// <value>
@@ -145,22 +165,14 @@ namespace OpenSim.Region.Environment.Modules.Framework.InterfaceCommander
145 { 165 {
146 if (function != "help") 166 if (function != "help")
147 Console.WriteLine("ERROR: Invalid command - No such command exists"); 167 Console.WriteLine("ERROR: Invalid command - No such command exists");
148 ShowConsoleHelp(); 168
169 Console.Write(Help);
149 } 170 }
150 } 171 }
151 } 172 }
152 173
153 #endregion 174 #endregion
154 175
155 private void ShowConsoleHelp()
156 {
157 Console.WriteLine("===" + m_name + "===");
158 foreach (ICommand com in m_commands.Values)
159 {
160 Console.WriteLine("* " + com.Name + " - " + com.Help);
161 }
162 }
163
164 private string EscapeRuntimeAPICommand(string command) 176 private string EscapeRuntimeAPICommand(string command)
165 { 177 {
166 command = command.Replace('-', '_'); 178 command = command.Replace('-', '_');
diff --git a/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/CommanderTestModule.cs b/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/CommanderTestModule.cs
index f4b56b7..e368f51 100644
--- a/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/CommanderTestModule.cs
+++ b/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/CommanderTestModule.cs
@@ -35,7 +35,7 @@ namespace OpenSim.Region.Environment.Modules.Framework.InterfaceCommander
35{ 35{
36 public class CommanderTestModule : IRegionModule, ICommandableModule 36 public class CommanderTestModule : IRegionModule, ICommandableModule
37 { 37 {
38 private readonly Commander m_commander = new Commander("CommanderTest"); 38 private readonly Commander m_commander = new Commander("commandertest");
39 private Scene m_scene; 39 private Scene m_scene;
40 40
41 #region ICommandableModule Members 41 #region ICommandableModule Members
diff --git a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
index 0fac278..f086396 100644
--- a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
@@ -46,7 +46,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 47
48 protected Scene m_scene; 48 protected Scene m_scene;
49 private readonly Commander m_commander = new Commander("Permissions"); 49 private readonly Commander m_commander = new Commander("permissions");
50 50
51 #region Constants 51 #region Constants
52 // These are here for testing. They will be taken out 52 // These are here for testing. They will be taken out
diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs
index 885dbae..f939adf 100644
--- a/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs
@@ -38,7 +38,7 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
38{ 38{
39 public class SerialiserModule : IRegionModule, IRegionSerialiserModule 39 public class SerialiserModule : IRegionModule, IRegionSerialiserModule
40 { 40 {
41 private Commander m_commander = new Commander("Export"); 41 private Commander m_commander = new Commander("export");
42 private List<Scene> m_regions = new List<Scene>(); 42 private List<Scene> m_regions = new List<Scene>();
43 private string m_savedir = "exports" + "/"; 43 private string m_savedir = "exports" + "/";
44 private List<IFileSerialiser> m_serialisers = new List<IFileSerialiser>(); 44 private List<IFileSerialiser> m_serialisers = new List<IFileSerialiser>();
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs
index cc9b4d2..3c27872 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs
@@ -68,7 +68,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
68 68
69 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 69 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
70 70
71 private readonly Commander m_commander = new Commander("Terrain"); 71 private readonly Commander m_commander = new Commander("terrain");
72 72
73 private readonly Dictionary<StandardTerrainEffects, ITerrainFloodEffect> m_floodeffects = 73 private readonly Dictionary<StandardTerrainEffects, ITerrainFloodEffect> m_floodeffects =
74 new Dictionary<StandardTerrainEffects, ITerrainFloodEffect>(); 74 new Dictionary<StandardTerrainEffects, ITerrainFloodEffect>();
diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs
index 5e7eae5..5b78617 100644
--- a/OpenSim/Region/Environment/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs
@@ -286,12 +286,20 @@ namespace OpenSim.Region.Environment.Scenes
286 } 286 }
287 } 287 }
288 288
289 /// <summary>
290 /// Get a module commander
291 /// </summary>
292 /// <param name="name"></param>
293 /// <returns>The module commander, null if no module commander with that name was found</returns>
289 public ICommander GetCommander(string name) 294 public ICommander GetCommander(string name)
290 { 295 {
291 lock (m_moduleCommanders) 296 lock (m_moduleCommanders)
292 { 297 {
293 return m_moduleCommanders[name]; 298 if (m_moduleCommanders.ContainsKey(name))
299 return m_moduleCommanders[name];
294 } 300 }
301
302 return null;
295 } 303 }
296 304
297 public Dictionary<string, ICommander> GetCommanders() 305 public Dictionary<string, ICommander> GetCommanders()