aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid
diff options
context:
space:
mode:
authorMelanie Thielker2009-02-07 12:25:39 +0000
committerMelanie Thielker2009-02-07 12:25:39 +0000
commit54c6a920baa0ef02a9ea09e08cc1effcef3b0a3a (patch)
treef606cbdbc383ec21fee28f0a1454140a1c714278 /OpenSim/Grid
parentThank you dslake for a patch that: (diff)
downloadopensim-SC-54c6a920baa0ef02a9ea09e08cc1effcef3b0a3a.zip
opensim-SC-54c6a920baa0ef02a9ea09e08cc1effcef3b0a3a.tar.gz
opensim-SC-54c6a920baa0ef02a9ea09e08cc1effcef3b0a3a.tar.bz2
opensim-SC-54c6a920baa0ef02a9ea09e08cc1effcef3b0a3a.tar.xz
Replace the console for all OpenSim apps with a new console featuring command
line editing, context sensitive help (press ? at any time), command line history, a new plugin command system and new appender features thet let you type while the console is scrolling. Seamlessly integrates the ICommander interfaces.
Diffstat (limited to '')
-rw-r--r--OpenSim/Grid/AssetServer/Main.cs6
-rw-r--r--OpenSim/Grid/GridServer/GridServerBase.cs63
-rw-r--r--OpenSim/Grid/InventoryServer/Main.cs21
-rw-r--r--OpenSim/Grid/MessagingServer/Main.cs42
-rw-r--r--OpenSim/Grid/UserServer/Main.cs94
5 files changed, 138 insertions, 88 deletions
diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs
index 060c473..c71e53f 100644
--- a/OpenSim/Grid/AssetServer/Main.cs
+++ b/OpenSim/Grid/AssetServer/Main.cs
@@ -43,7 +43,7 @@ namespace OpenSim.Grid.AssetServer
43 /// <summary> 43 /// <summary>
44 /// An asset server 44 /// An asset server
45 /// </summary> 45 /// </summary>
46 public class OpenAsset_Main : BaseOpenSimServer, conscmd_callback 46 public class OpenAsset_Main : BaseOpenSimServer
47 { 47 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 49
@@ -76,7 +76,7 @@ namespace OpenSim.Grid.AssetServer
76 76
77 public OpenAsset_Main() 77 public OpenAsset_Main()
78 { 78 {
79 m_console = new ConsoleBase("Asset", this); 79 m_console = new ConsoleBase("Asset");
80 80
81 MainConsole.Instance = m_console; 81 MainConsole.Instance = m_console;
82 } 82 }
@@ -99,6 +99,8 @@ namespace OpenSim.Grid.AssetServer
99 AddHttpHandlers(); 99 AddHttpHandlers();
100 100
101 m_httpServer.Start(); 101 m_httpServer.Start();
102
103 base.StartupSpecific();
102 } 104 }
103 105
104 protected void AddHttpHandlers() 106 protected void AddHttpHandlers()
diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs
index 68edbd2..3fb07b5 100644
--- a/OpenSim/Grid/GridServer/GridServerBase.cs
+++ b/OpenSim/Grid/GridServer/GridServerBase.cs
@@ -39,7 +39,7 @@ namespace OpenSim.Grid.GridServer
39{ 39{
40 /// <summary> 40 /// <summary>
41 /// </summary> 41 /// </summary>
42 public class GridServerBase : BaseOpenSimServer, conscmd_callback 42 public class GridServerBase : BaseOpenSimServer
43 { 43 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 45
@@ -59,43 +59,34 @@ namespace OpenSim.Grid.GridServer
59 59
60 public GridServerBase() 60 public GridServerBase()
61 { 61 {
62 m_console = new ConsoleBase("Grid", this); 62 m_console = new ConsoleBase("Grid");
63 MainConsole.Instance = m_console; 63 MainConsole.Instance = m_console;
64 } 64 }
65 65
66 public override void RunCmd(string cmd, string[] cmdparams) 66 private void HandleRegistration(string module, string[] cmd)
67 { 67 {
68 base.RunCmd(cmd, cmdparams); 68 switch (cmd[0])
69
70 switch (cmd)
71 { 69 {
72 case "disable-reg": 70 case "enable":
73 m_config.AllowRegionRegistration = false; 71 m_config.AllowRegionRegistration = true;
74 m_log.Info("Region registration disabled"); 72 m_log.Info("Region registration enabled");
75 break; 73 break;
76 case "enable-reg": 74 case "disable":
77 m_config.AllowRegionRegistration = true; 75 m_config.AllowRegionRegistration = false;
78 m_log.Info("Region registration enabled"); 76 m_log.Info("Region registration disabled");
79 break; 77 break;
80 } 78 }
81 } 79 }
82
83 public override void Show(string[] showParams)
84 {
85 base.Show(showParams);
86 80
87 switch (showParams[0]) 81 private void HandleShowStatus(string module, string[] cmd)
82 {
83 if (m_config.AllowRegionRegistration)
88 { 84 {
89 case "status": 85 m_log.Info("Region registration enabled.");
90 if (m_config.AllowRegionRegistration) 86 }
91 { 87 else
92 m_log.Info("Region registration enabled."); 88 {
93 } 89 m_log.Info("Region registration disabled.");
94 else
95 {
96 m_log.Info("Region registration disabled.");
97 }
98 break;
99 } 90 }
100 } 91 }
101 92
@@ -120,6 +111,20 @@ namespace OpenSim.Grid.GridServer
120// Timer simCheckTimer = new Timer(3600000 * 3); // 3 Hours between updates. 111// Timer simCheckTimer = new Timer(3600000 * 3); // 3 Hours between updates.
121// simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims); 112// simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims);
122// simCheckTimer.Enabled = true; 113// simCheckTimer.Enabled = true;
114
115 base.StartupSpecific();
116
117 m_console.Commands.AddCommand("gridserver", "enable registration",
118 "enable registration",
119 "Enable new regions to register", HandleRegistration);
120
121 m_console.Commands.AddCommand("gridserver", "disable registration",
122 "disable registration",
123 "Disable registering new regions", HandleRegistration);
124
125 m_console.Commands.AddCommand("gridserver", "show status",
126 "show status",
127 "Show registration status", HandleShowStatus);
123 } 128 }
124 129
125 protected void AddHttpHandlers() 130 protected void AddHttpHandlers()
diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs
index 81a6a03..4727f6e 100644
--- a/OpenSim/Grid/InventoryServer/Main.cs
+++ b/OpenSim/Grid/InventoryServer/Main.cs
@@ -38,7 +38,7 @@ using OpenSim.Framework.Servers;
38 38
39namespace OpenSim.Grid.InventoryServer 39namespace OpenSim.Grid.InventoryServer
40{ 40{
41 public class OpenInventory_Main : BaseOpenSimServer, conscmd_callback 41 public class OpenInventory_Main : BaseOpenSimServer
42 { 42 {
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 44
@@ -58,7 +58,7 @@ namespace OpenSim.Grid.InventoryServer
58 58
59 public OpenInventory_Main() 59 public OpenInventory_Main()
60 { 60 {
61 m_console = new ConsoleBase("Inventory", this); 61 m_console = new ConsoleBase("Inventory");
62 MainConsole.Instance = m_console; 62 MainConsole.Instance = m_console;
63 } 63 }
64 64
@@ -77,6 +77,12 @@ namespace OpenSim.Grid.InventoryServer
77 m_httpServer.Start(); 77 m_httpServer.Start();
78 78
79 m_log.Info("[" + LogName + "]: Started HTTP server"); 79 m_log.Info("[" + LogName + "]: Started HTTP server");
80
81 base.StartupSpecific();
82
83 m_console.Commands.AddCommand("inventoryserver", "add user",
84 "add user",
85 "Add a random user inventory", HandleAddUser);
80 } 86 }
81 87
82 protected void AddHttpHandlers() 88 protected void AddHttpHandlers()
@@ -146,16 +152,9 @@ namespace OpenSim.Grid.InventoryServer
146 } 152 }
147 } 153 }
148 154
149 public override void RunCmd(string cmd, string[] cmdparams) 155 private void HandleAddUser(string module, string[] args)
150 { 156 {
151 base.RunCmd(cmd, cmdparams); 157 m_inventoryService.CreateUsersInventory(UUID.Random().Guid);
152
153 switch (cmd)
154 {
155 case "add-user":
156 m_inventoryService.CreateUsersInventory(UUID.Random().Guid);
157 break;
158 }
159 } 158 }
160 } 159 }
161} 160}
diff --git a/OpenSim/Grid/MessagingServer/Main.cs b/OpenSim/Grid/MessagingServer/Main.cs
index e83da7a..9b7e731 100644
--- a/OpenSim/Grid/MessagingServer/Main.cs
+++ b/OpenSim/Grid/MessagingServer/Main.cs
@@ -41,7 +41,7 @@ namespace OpenSim.Grid.MessagingServer
41{ 41{
42 /// <summary> 42 /// <summary>
43 /// </summary> 43 /// </summary>
44 public class OpenMessage_Main : BaseOpenSimServer, conscmd_callback 44 public class OpenMessage_Main : BaseOpenSimServer
45 { 45 {
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
@@ -64,7 +64,7 @@ namespace OpenSim.Grid.MessagingServer
64 64
65 public OpenMessage_Main() 65 public OpenMessage_Main()
66 { 66 {
67 m_console = new ConsoleBase("Messaging", this); 67 m_console = new ConsoleBase("Messaging");
68 MainConsole.Instance = m_console; 68 MainConsole.Instance = m_console;
69 } 69 }
70 70
@@ -124,6 +124,16 @@ namespace OpenSim.Grid.MessagingServer
124 registerWithUserServer(); 124 registerWithUserServer();
125 125
126 m_log.Info("[SERVER]: Messageserver 0.5 - Startup complete"); 126 m_log.Info("[SERVER]: Messageserver 0.5 - Startup complete");
127
128 base.StartupSpecific();
129
130 m_console.Commands.AddCommand("messageserver", "clear cache",
131 "clear cache",
132 "Clear presence cache", HandleClearCache);
133
134 m_console.Commands.AddCommand("messageserver", "register",
135 "register",
136 "Re-register with user server(s)", HandleRegister);
127 } 137 }
128 138
129 public void do_create(string what) 139 public void do_create(string what)
@@ -154,29 +164,17 @@ namespace OpenSim.Grid.MessagingServer
154 } 164 }
155 } 165 }
156 166
157 public override void RunCmd(string cmd, string[] cmdparams) 167 private void HandleClearCache(string module, string[] cmd)
158 { 168 {
159 base.RunCmd(cmd, cmdparams); 169 int entries = msgsvc.ClearRegionCache();
160 170 m_console.Notice("Region cache cleared! Cleared " +
161 switch (cmd) 171 entries.ToString() + " entries");
162 {
163 case "clear-cache":
164 int entries = msgsvc.ClearRegionCache();
165 m_console.Notice("Region cache cleared! Cleared " + entries.ToString() + " entries");
166 break;
167 case "register":
168 deregisterFromUserServer();
169 registerWithUserServer();
170 break;
171 }
172 } 172 }
173 173
174 protected override void ShowHelp(string[] helpArgs) 174 private void HandleRegister(string module, string[] cmd)
175 { 175 {
176 base.ShowHelp(helpArgs); 176 deregisterFromUserServer();
177 177 registerWithUserServer();
178 m_console.Notice("clear-cache - Clears region cache. Should be done when regions change position. The region cache gets stale after a while.");
179 m_console.Notice("register - (Re-)registers with user-server. This might be necessary if the userserver crashed/restarted");
180 } 178 }
181 179
182 public override void ShutdownSpecific() 180 public override void ShutdownSpecific()
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index be26ab3..0b0bee1 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -46,7 +46,7 @@ namespace OpenSim.Grid.UserServer
46 /// <summary> 46 /// <summary>
47 /// Grid user server main class 47 /// Grid user server main class
48 /// </summary> 48 /// </summary>
49 public class OpenUser_Main : BaseOpenSimServer, conscmd_callback 49 public class OpenUser_Main : BaseOpenSimServer
50 { 50 {
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 52
@@ -73,7 +73,7 @@ namespace OpenSim.Grid.UserServer
73 73
74 public OpenUser_Main() 74 public OpenUser_Main()
75 { 75 {
76 m_console = new ConsoleBase("User", this); 76 m_console = new ConsoleBase("User");
77 MainConsole.Instance = m_console; 77 MainConsole.Instance = m_console;
78 } 78 }
79 79
@@ -119,6 +119,37 @@ namespace OpenSim.Grid.UserServer
119 m_httpServer = new BaseHttpServer(Cfg.HttpPort); 119 m_httpServer = new BaseHttpServer(Cfg.HttpPort);
120 AddHttpHandlers(); 120 AddHttpHandlers();
121 m_httpServer.Start(); 121 m_httpServer.Start();
122
123 base.StartupSpecific();
124
125 m_console.Commands.AddCommand("userserver", "create user",
126 "create user [<first> [<last> [<x> <y> [email]]]]",
127 "Create a new user account", RunCommand);
128
129 m_console.Commands.AddCommand("userserver", "reset user password",
130 "reset user password [<first> [<last> [<new password>]]]",
131 "Reset a user's password", RunCommand);
132
133 m_console.Commands.AddCommand("userserver", "login level",
134 "login level <level>",
135 "Set the minimum user level to log in", HandleLoginCommand);
136
137 m_console.Commands.AddCommand("userserver", "login reset",
138 "login reset",
139 "Reset the login level to allow all users",
140 HandleLoginCommand);
141
142 m_console.Commands.AddCommand("userserver", "login text",
143 "login text <text>",
144 "Set the text users will see on login", HandleLoginCommand);
145
146 m_console.Commands.AddCommand("userserver", "test-inventory",
147 "test-inventory",
148 "Perform a test inventory transaction", RunCommand);
149
150 m_console.Commands.AddCommand("userserver", "logoff-user",
151 "logoff-user <first> <last> <message>",
152 "Log off a named user", RunCommand);
122 } 153 }
123 154
124 /// <summary> 155 /// <summary>
@@ -301,39 +332,54 @@ namespace OpenSim.Grid.UserServer
301 m_userManager.ResetUserPassword(firstName, lastName, newPassword); 332 m_userManager.ResetUserPassword(firstName, lastName, newPassword);
302 } 333 }
303 334
304 public override void RunCmd(string cmd, string[] cmdparams) 335 private void HandleLoginCommand(string module, string[] cmd)
305 { 336 {
306 base.RunCmd(cmd, cmdparams); 337 string subcommand = cmd[1];
307 switch (cmd) 338
339 switch (subcommand)
308 { 340 {
309 case "create": 341 case "level":
310 do_create(cmdparams); 342 // Set the minimal level to allow login
311 break; 343 // Useful to allow grid update without worrying about users.
312 344 // or fixing critical issues
313 case "reset": 345 //
314 Reset(cmdparams); 346 if (cmd.Length > 2)
315 break;
316
317
318 case "login-level":
319 // Set the minimal level to allow login
320 // Usefull to allow grid update without worrying about users.
321 // or fixing critical issue
322 if (cmdparams.Length == 1)
323 { 347 {
324 int level = Convert.ToInt32(cmdparams[0]); 348 int level = Convert.ToInt32(cmd[2]);
325 m_loginService.setloginlevel(level); 349 m_loginService.setloginlevel(level);
326 } 350 }
327 break; 351 break;
328 case "login-reset": 352 case "reset":
329 m_loginService.setloginlevel(0); 353 m_loginService.setloginlevel(0);
330 break; 354 break;
331 case "login-text": 355 case "text":
332 if (cmdparams.Length == 1) 356 if (cmd.Length > 2)
333 { 357 {
334 m_loginService.setwelcometext(cmdparams[0]); 358 m_loginService.setwelcometext(cmd[2]);
335 } 359 }
336 break; 360 break;
361 }
362 }
363
364 public void RunCommand(string module, string[] cmd)
365 {
366 List<string> args = new List<string>(cmd);
367 string command = cmd[0];
368
369 args.RemoveAt(0);
370
371 string[] cmdparams = args.ToArray();
372
373 switch (command)
374 {
375 case "create":
376 do_create(cmdparams);
377 break;
378
379 case "reset":
380 Reset(cmdparams);
381 break;
382
337 383
338 case "test-inventory": 384 case "test-inventory":
339 // RestObjectPosterResponse<List<InventoryFolderBase>> requester = new RestObjectPosterResponse<List<InventoryFolderBase>>(); 385 // RestObjectPosterResponse<List<InventoryFolderBase>> requester = new RestObjectPosterResponse<List<InventoryFolderBase>>();