aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-02-06 18:18:01 +0000
committerJustin Clarke Casey2009-02-06 18:18:01 +0000
commit00a3cbd6fa9d84fe28b3a7f033e2452d6a3f1d69 (patch)
treef70297e039ebd6fc1c69e226e5f28683476d61d6 /OpenSim/Region/Framework
parentThis changeset is the step 1 of 2 in refactoring (diff)
downloadopensim-SC-00a3cbd6fa9d84fe28b3a7f033e2452d6a3f1d69.zip
opensim-SC-00a3cbd6fa9d84fe28b3a7f033e2452d6a3f1d69.tar.gz
opensim-SC-00a3cbd6fa9d84fe28b3a7f033e2452d6a3f1d69.tar.bz2
opensim-SC-00a3cbd6fa9d84fe28b3a7f033e2452d6a3f1d69.tar.xz
* Implement help <command> from the region console
* So at the moment once can type 'help terrain fill' as well as 'terrain fill help' * Current implementation is a transient hack that should be tidied up soon
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/ICommander.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs51
2 files changed, 54 insertions, 4 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/ICommander.cs b/OpenSim/Region/Framework/Interfaces/ICommander.cs
index 17a2e4a..f94e8e8 100644
--- a/OpenSim/Region/Framework/Interfaces/ICommander.cs
+++ b/OpenSim/Region/Framework/Interfaces/ICommander.cs
@@ -25,6 +25,8 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System.Collections.Generic;
29
28namespace OpenSim.Region.Framework.Interfaces 30namespace OpenSim.Region.Framework.Interfaces
29{ 31{
30 public interface ICommander 32 public interface ICommander
@@ -39,6 +41,11 @@ namespace OpenSim.Region.Framework.Interfaces
39 /// </value> 41 /// </value>
40 string Help { get; } 42 string Help { get; }
41 43
44 /// <summary>
45 /// The commands available for this commander
46 /// </summary>
47 Dictionary<string, ICommand> Commands { get; }
48
42 void ProcessConsoleCommand(string function, string[] args); 49 void ProcessConsoleCommand(string function, string[] args);
43 void RegisterCommand(string commandName, ICommand command); 50 void RegisterCommand(string commandName, ICommand command);
44 void Run(string function, object[] args); 51 void Run(string function, object[] args);
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index 6d61e9f..e58d3ce 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -61,17 +61,24 @@ namespace OpenSim.Region.Framework.Scenes
61 /// <value> 61 /// <value>
62 /// The module interfaces available from this scene. 62 /// The module interfaces available from this scene.
63 /// </value> 63 /// </value>
64 protected Dictionary<Type, List<object> > ModuleInterfaces = new Dictionary<Type, List<object> >(); 64 protected Dictionary<Type, List<object>> ModuleInterfaces = new Dictionary<Type, List<object>>();
65 65
66 protected Dictionary<string, object> ModuleAPIMethods = new Dictionary<string, object>(); 66 protected Dictionary<string, object> ModuleAPIMethods = new Dictionary<string, object>();
67
68 /// <value>
69 /// The module commanders available from this scene
70 /// </value>
67 protected Dictionary<string, ICommander> m_moduleCommanders = new Dictionary<string, ICommander>(); 71 protected Dictionary<string, ICommander> m_moduleCommanders = new Dictionary<string, ICommander>();
68 72
69 /// <value> 73 /// <value>
74 /// The module commands available for this scene
75 /// </value>
76 protected Dictionary<string, ICommand> m_moduleCommands = new Dictionary<string, ICommand>();
77
78 /// <value>
70 /// Registered classes that are capable of creating entities. 79 /// Registered classes that are capable of creating entities.
71 /// </value> 80 /// </value>
72 protected Dictionary<PCode, IEntityCreator> m_entityCreators = new Dictionary<PCode, IEntityCreator>(); 81 protected Dictionary<PCode, IEntityCreator> m_entityCreators = new Dictionary<PCode, IEntityCreator>();
73
74 //API module interfaces
75 82
76 /// <summary> 83 /// <summary>
77 /// The last allocated local prim id. When a new local id is requested, the next number in the sequence is 84 /// The last allocated local prim id. When a new local id is requested, the next number in the sequence is
@@ -278,11 +285,47 @@ namespace OpenSim.Region.Framework.Scenes
278 } 285 }
279 } 286 }
280 287
288 /// <summary>
289 /// Register a module commander.
290 /// </summary>
291 /// <param name="commander"></param>
281 public void RegisterModuleCommander(ICommander commander) 292 public void RegisterModuleCommander(ICommander commander)
282 { 293 {
283 lock (m_moduleCommanders) 294 lock (m_moduleCommanders)
284 { 295 {
285 m_moduleCommanders.Add(commander.Name, commander); 296 m_moduleCommanders.Add(commander.Name, commander);
297
298 lock (m_moduleCommands)
299 {
300 foreach (ICommand command in commander.Commands.Values)
301 {
302 if (m_moduleCommands.ContainsKey(command.Name))
303 {
304 m_log.ErrorFormat(
305 "[MODULES]: Module commander {0} tried to register the command {1} which has already been registered",
306 commander.Name, command.Name);
307 continue;
308 }
309
310 m_moduleCommands[command.Name] = command;
311 }
312 }
313 }
314 }
315
316 /// <summary>
317 /// Get an available module command
318 /// </summary>
319 /// <param name="commandName"></param>
320 /// <returns>The command if it was found, null if no command is available with that name</returns>
321 public ICommand GetCommand(string commandName)
322 {
323 lock (m_moduleCommands)
324 {
325 if (m_moduleCommands.ContainsKey(commandName))
326 return m_moduleCommands[commandName];
327 else
328 return null;
286 } 329 }
287 } 330 }
288 331