diff options
More refactoring of the Grid/user/messaging servers.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Grid/UserServer/Main.cs | 30 | ||||
-rw-r--r-- | OpenSim/Grid/UserServer/UserServerCommandModule.cs | 31 |
2 files changed, 46 insertions, 15 deletions
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"); |