aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid
diff options
context:
space:
mode:
authorMW2009-02-24 17:57:26 +0000
committerMW2009-02-24 17:57:26 +0000
commit1e2835a10c104b049c5552c64f77309b88f5650e (patch)
treea81f400318476e3f34392eeea5f09b6e34fcc3ee /OpenSim/Grid
parentSame treatment for the MessagingServer... added OpenSim.Grid.MessagingServer.... (diff)
downloadopensim-SC-1e2835a10c104b049c5552c64f77309b88f5650e.zip
opensim-SC-1e2835a10c104b049c5552c64f77309b88f5650e.tar.gz
opensim-SC-1e2835a10c104b049c5552c64f77309b88f5650e.tar.bz2
opensim-SC-1e2835a10c104b049c5552c64f77309b88f5650e.tar.xz
More refactoring of the Grid/user/messaging servers.
Diffstat (limited to '')
-rw-r--r--OpenSim/Grid/Framework/IUGAIMCore.cs3
-rw-r--r--OpenSim/Grid/GridServer/GridServerBase.cs7
-rw-r--r--OpenSim/Grid/MessagingServer/Main.cs7
-rw-r--r--OpenSim/Grid/UserServer/Main.cs30
-rw-r--r--OpenSim/Grid/UserServer/UserServerCommandModule.cs31
5 files changed, 61 insertions, 17 deletions
diff --git a/OpenSim/Grid/Framework/IUGAIMCore.cs b/OpenSim/Grid/Framework/IUGAIMCore.cs
index a7df0d4..77245ce 100644
--- a/OpenSim/Grid/Framework/IUGAIMCore.cs
+++ b/OpenSim/Grid/Framework/IUGAIMCore.cs
@@ -30,11 +30,14 @@ using OpenSim.Framework.Servers;
30 30
31namespace OpenSim.Grid.Framework 31namespace OpenSim.Grid.Framework
32{ 32{
33 public delegate void ShowHelpDelegate(string[] helpArgs);
34
33 public interface IUGAIMCore 35 public interface IUGAIMCore
34 { 36 {
35 T Get<T>(); 37 T Get<T>();
36 void RegisterInterface<T>(T iface); 38 void RegisterInterface<T>(T iface);
37 bool TryGet<T>(out T iface); 39 bool TryGet<T>(out T iface);
38 BaseHttpServer GetHttpServer(); 40 BaseHttpServer GetHttpServer();
41 void RegisterConsoleHelpDelegate(ShowHelpDelegate showHelp);
39 } 42 }
40} 43}
diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs
index 3313591..70dd8a6 100644
--- a/OpenSim/Grid/GridServer/GridServerBase.cs
+++ b/OpenSim/Grid/GridServer/GridServerBase.cs
@@ -217,7 +217,7 @@ namespace OpenSim.Grid.GridServer
217 } 217 }
218 218
219 #region IUGAIMCore 219 #region IUGAIMCore
220 private readonly Dictionary<Type, object> m_moduleInterfaces = new Dictionary<Type, object>(); 220 protected Dictionary<Type, object> m_moduleInterfaces = new Dictionary<Type, object>();
221 221
222 /// <summary> 222 /// <summary>
223 /// Register an Module interface. 223 /// Register an Module interface.
@@ -255,6 +255,11 @@ namespace OpenSim.Grid.GridServer
255 { 255 {
256 return m_httpServer; 256 return m_httpServer;
257 } 257 }
258
259 public void RegisterConsoleHelpDelegate(ShowHelpDelegate showHelp)
260 {
261
262 }
258 #endregion 263 #endregion
259 } 264 }
260} 265}
diff --git a/OpenSim/Grid/MessagingServer/Main.cs b/OpenSim/Grid/MessagingServer/Main.cs
index 420e8d5..07d0580 100644
--- a/OpenSim/Grid/MessagingServer/Main.cs
+++ b/OpenSim/Grid/MessagingServer/Main.cs
@@ -207,7 +207,7 @@ namespace OpenSim.Grid.MessagingServer
207 } 207 }
208 208
209 #region IUGAIMCore 209 #region IUGAIMCore
210 private readonly Dictionary<Type, object> m_moduleInterfaces = new Dictionary<Type, object>(); 210 protected Dictionary<Type, object> m_moduleInterfaces = new Dictionary<Type, object>();
211 211
212 /// <summary> 212 /// <summary>
213 /// Register an Module interface. 213 /// Register an Module interface.
@@ -245,6 +245,11 @@ namespace OpenSim.Grid.MessagingServer
245 { 245 {
246 return m_httpServer; 246 return m_httpServer;
247 } 247 }
248
249 public void RegisterConsoleHelpDelegate(ShowHelpDelegate showHelp)
250 {
251
252 }
248 #endregion 253 #endregion
249 } 254 }
250} 255}
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index 61f9800..49b0071 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -67,8 +67,6 @@ namespace OpenSim.Grid.UserServer
67 67
68 protected UserServerCommandModule m_consoleCommandModule; 68 protected UserServerCommandModule m_consoleCommandModule;
69 69
70 private UUID m_lastCreatedUser = UUID.Random();
71
72 public static void Main(string[] args) 70 public static void Main(string[] args)
73 { 71 {
74 XmlConfigurator.Configure(); 72 XmlConfigurator.Configure();
@@ -127,7 +125,11 @@ namespace OpenSim.Grid.UserServer
127 125
128 m_messagesService = new MessageServersConnector(); 126 m_messagesService = new MessageServersConnector();
129 127
130 m_consoleCommandModule = new UserServerCommandModule(m_console, Cfg, m_userDataBaseService, m_loginService); 128 m_consoleCommandModule = new UserServerCommandModule(Cfg, m_userDataBaseService, m_loginService);
129 m_consoleCommandModule.Initialise(this);
130
131 //PostInitialise the modules
132 m_consoleCommandModule.PostInitialise();
131 133
132 //register event handlers 134 //register event handlers
133 RegisterEventHandlers(); 135 RegisterEventHandlers();
@@ -178,7 +180,7 @@ namespace OpenSim.Grid.UserServer
178 180
179 protected virtual void RegisterConsoleCommands() 181 protected virtual void RegisterConsoleCommands()
180 { 182 {
181 m_consoleCommandModule.RegisterConsoleCommands(); 183 m_consoleCommandModule.RegisterConsoleCommands(m_console);
182 } 184 }
183 185
184 protected virtual void RegisterHttpHandlers() 186 protected virtual void RegisterHttpHandlers()
@@ -201,7 +203,9 @@ namespace OpenSim.Grid.UserServer
201 } 203 }
202 204
203 #region IUGAIMCore 205 #region IUGAIMCore
204 private readonly Dictionary<Type, object> m_moduleInterfaces = new Dictionary<Type, object>(); 206 protected Dictionary<Type, object> m_moduleInterfaces = new Dictionary<Type, object>();
207 protected List<ShowHelpDelegate> m_showHelpDelegates = new List<ShowHelpDelegate>();
208
205 209
206 /// <summary> 210 /// <summary>
207 /// Register an Module interface. 211 /// Register an Module interface.
@@ -239,6 +243,14 @@ namespace OpenSim.Grid.UserServer
239 { 243 {
240 return m_httpServer; 244 return m_httpServer;
241 } 245 }
246
247 public void RegisterConsoleHelpDelegate(ShowHelpDelegate showHelp)
248 {
249 lock (m_showHelpDelegates)
250 {
251 m_showHelpDelegates.Add(showHelp);
252 }
253 }
242 #endregion 254 #endregion
243 255
244 #region Console Command Handlers 256 #region Console Command Handlers
@@ -247,7 +259,13 @@ namespace OpenSim.Grid.UserServer
247 { 259 {
248 base.ShowHelp(helpArgs); 260 base.ShowHelp(helpArgs);
249 261
250 m_consoleCommandModule.ShowHelp(helpArgs); 262 lock (m_showHelpDelegates)
263 {
264 foreach (ShowHelpDelegate d in m_showHelpDelegates)
265 {
266 d(helpArgs);
267 }
268 }
251 } 269 }
252 #endregion 270 #endregion
253 271
diff --git a/OpenSim/Grid/UserServer/UserServerCommandModule.cs b/OpenSim/Grid/UserServer/UserServerCommandModule.cs
index fbdd73f..f3dfc23 100644
--- a/OpenSim/Grid/UserServer/UserServerCommandModule.cs
+++ b/OpenSim/Grid/UserServer/UserServerCommandModule.cs
@@ -55,18 +55,35 @@ namespace OpenSim.Grid.UserServer
55 protected UserDataBaseService m_userDataBaseService; 55 protected UserDataBaseService m_userDataBaseService;
56 protected UserLoginService m_loginService; 56 protected UserLoginService m_loginService;
57 57
58 private UUID m_lastCreatedUser = UUID.Random(); 58 protected UUID m_lastCreatedUser = UUID.Random();
59 59
60 public UserServerCommandModule(ConsoleBase console, UserConfig cfg, UserDataBaseService userDBservice, UserLoginService loginService) 60 protected IUGAIMCore m_core;
61
62 public UserServerCommandModule(UserConfig cfg, UserDataBaseService userDBservice, UserLoginService loginService)
61 { 63 {
62 m_console = console;
63 Cfg = cfg; 64 Cfg = cfg;
64 m_userDataBaseService = userDBservice; 65 m_userDataBaseService = userDBservice;
65 m_loginService = loginService; 66 m_loginService = loginService;
66 } 67 }
67 68
68 public virtual void RegisterConsoleCommands() 69 public void Initialise(IUGAIMCore core)
70 {
71 m_core = core;
72 }
73
74 public void PostInitialise()
75 {
76 m_core.RegisterConsoleHelpDelegate(ShowHelp);
77 }
78
79 public void RegisterHandlers(BaseHttpServer httpServer)
69 { 80 {
81
82 }
83
84 public void RegisterConsoleCommands(ConsoleBase console)
85 {
86 m_console = console;
70 m_console.Commands.AddCommand("userserver", false, "create user", 87 m_console.Commands.AddCommand("userserver", false, "create user",
71 "create user [<first> [<last> [<x> <y> [email]]]]", 88 "create user [<first> [<last> [<x> <y> [email]]]]",
72 "Create a new user account", RunCommand); 89 "Create a new user account", RunCommand);
@@ -95,10 +112,6 @@ namespace OpenSim.Grid.UserServer
95 m_console.Commands.AddCommand("userserver", false, "logoff-user", 112 m_console.Commands.AddCommand("userserver", false, "logoff-user",
96 "logoff-user <first> <last> <message>", 113 "logoff-user <first> <last> <message>",
97 "Log off a named user", RunCommand); 114 "Log off a named user", RunCommand);
98
99 m_console.Commands.AddCommand("userserver", false, "test-command",
100 "test-command",
101 "test command", HandleTestCommand);
102 } 115 }
103 116
104 #region Console Command Handlers 117 #region Console Command Handlers
@@ -335,7 +348,7 @@ namespace OpenSim.Grid.UserServer
335 } 348 }
336 } 349 }
337 350
338 public virtual void ShowHelp(string[] helpArgs) 351 public void ShowHelp(string[] helpArgs)
339 { 352 {
340 m_console.Notice("create user - create a new user"); 353 m_console.Notice("create user - create a new user");
341 m_console.Notice("logoff-user <firstname> <lastname> <message> - logs off the specified user from the grid"); 354 m_console.Notice("logoff-user <firstname> <lastname> <message> - logs off the specified user from the grid");