More refactoring of the Grid/user/messaging servers.
parent
98178b4e9f
commit
1e2835a10c
|
@ -30,11 +30,14 @@ using OpenSim.Framework.Servers;
|
||||||
|
|
||||||
namespace OpenSim.Grid.Framework
|
namespace OpenSim.Grid.Framework
|
||||||
{
|
{
|
||||||
|
public delegate void ShowHelpDelegate(string[] helpArgs);
|
||||||
|
|
||||||
public interface IUGAIMCore
|
public interface IUGAIMCore
|
||||||
{
|
{
|
||||||
T Get<T>();
|
T Get<T>();
|
||||||
void RegisterInterface<T>(T iface);
|
void RegisterInterface<T>(T iface);
|
||||||
bool TryGet<T>(out T iface);
|
bool TryGet<T>(out T iface);
|
||||||
BaseHttpServer GetHttpServer();
|
BaseHttpServer GetHttpServer();
|
||||||
|
void RegisterConsoleHelpDelegate(ShowHelpDelegate showHelp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -217,7 +217,7 @@ namespace OpenSim.Grid.GridServer
|
||||||
}
|
}
|
||||||
|
|
||||||
#region IUGAIMCore
|
#region IUGAIMCore
|
||||||
private readonly Dictionary<Type, object> m_moduleInterfaces = new Dictionary<Type, object>();
|
protected Dictionary<Type, object> m_moduleInterfaces = new Dictionary<Type, object>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Register an Module interface.
|
/// Register an Module interface.
|
||||||
|
@ -255,6 +255,11 @@ namespace OpenSim.Grid.GridServer
|
||||||
{
|
{
|
||||||
return m_httpServer;
|
return m_httpServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RegisterConsoleHelpDelegate(ShowHelpDelegate showHelp)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,7 +207,7 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
}
|
}
|
||||||
|
|
||||||
#region IUGAIMCore
|
#region IUGAIMCore
|
||||||
private readonly Dictionary<Type, object> m_moduleInterfaces = new Dictionary<Type, object>();
|
protected Dictionary<Type, object> m_moduleInterfaces = new Dictionary<Type, object>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Register an Module interface.
|
/// Register an Module interface.
|
||||||
|
@ -245,6 +245,11 @@ namespace OpenSim.Grid.MessagingServer
|
||||||
{
|
{
|
||||||
return m_httpServer;
|
return m_httpServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RegisterConsoleHelpDelegate(ShowHelpDelegate showHelp)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,8 +67,6 @@ namespace OpenSim.Grid.UserServer
|
||||||
|
|
||||||
protected UserServerCommandModule m_consoleCommandModule;
|
protected UserServerCommandModule m_consoleCommandModule;
|
||||||
|
|
||||||
private UUID m_lastCreatedUser = UUID.Random();
|
|
||||||
|
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
XmlConfigurator.Configure();
|
XmlConfigurator.Configure();
|
||||||
|
@ -127,7 +125,11 @@ namespace OpenSim.Grid.UserServer
|
||||||
|
|
||||||
m_messagesService = new MessageServersConnector();
|
m_messagesService = new MessageServersConnector();
|
||||||
|
|
||||||
m_consoleCommandModule = new UserServerCommandModule(m_console, Cfg, m_userDataBaseService, m_loginService);
|
m_consoleCommandModule = new UserServerCommandModule(Cfg, m_userDataBaseService, m_loginService);
|
||||||
|
m_consoleCommandModule.Initialise(this);
|
||||||
|
|
||||||
|
//PostInitialise the modules
|
||||||
|
m_consoleCommandModule.PostInitialise();
|
||||||
|
|
||||||
//register event handlers
|
//register event handlers
|
||||||
RegisterEventHandlers();
|
RegisterEventHandlers();
|
||||||
|
@ -178,7 +180,7 @@ namespace OpenSim.Grid.UserServer
|
||||||
|
|
||||||
protected virtual void RegisterConsoleCommands()
|
protected virtual void RegisterConsoleCommands()
|
||||||
{
|
{
|
||||||
m_consoleCommandModule.RegisterConsoleCommands();
|
m_consoleCommandModule.RegisterConsoleCommands(m_console);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void RegisterHttpHandlers()
|
protected virtual void RegisterHttpHandlers()
|
||||||
|
@ -201,7 +203,9 @@ namespace OpenSim.Grid.UserServer
|
||||||
}
|
}
|
||||||
|
|
||||||
#region IUGAIMCore
|
#region IUGAIMCore
|
||||||
private readonly Dictionary<Type, object> m_moduleInterfaces = new Dictionary<Type, object>();
|
protected Dictionary<Type, object> m_moduleInterfaces = new Dictionary<Type, object>();
|
||||||
|
protected List<ShowHelpDelegate> m_showHelpDelegates = new List<ShowHelpDelegate>();
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Register an Module interface.
|
/// Register an Module interface.
|
||||||
|
@ -239,6 +243,14 @@ namespace OpenSim.Grid.UserServer
|
||||||
{
|
{
|
||||||
return m_httpServer;
|
return m_httpServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RegisterConsoleHelpDelegate(ShowHelpDelegate showHelp)
|
||||||
|
{
|
||||||
|
lock (m_showHelpDelegates)
|
||||||
|
{
|
||||||
|
m_showHelpDelegates.Add(showHelp);
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Console Command Handlers
|
#region Console Command Handlers
|
||||||
|
@ -247,7 +259,13 @@ namespace OpenSim.Grid.UserServer
|
||||||
{
|
{
|
||||||
base.ShowHelp(helpArgs);
|
base.ShowHelp(helpArgs);
|
||||||
|
|
||||||
m_consoleCommandModule.ShowHelp(helpArgs);
|
lock (m_showHelpDelegates)
|
||||||
|
{
|
||||||
|
foreach (ShowHelpDelegate d in m_showHelpDelegates)
|
||||||
|
{
|
||||||
|
d(helpArgs);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
|
@ -55,18 +55,35 @@ namespace OpenSim.Grid.UserServer
|
||||||
protected UserDataBaseService m_userDataBaseService;
|
protected UserDataBaseService m_userDataBaseService;
|
||||||
protected UserLoginService m_loginService;
|
protected UserLoginService m_loginService;
|
||||||
|
|
||||||
private UUID m_lastCreatedUser = UUID.Random();
|
protected UUID m_lastCreatedUser = UUID.Random();
|
||||||
|
|
||||||
public UserServerCommandModule(ConsoleBase console, UserConfig cfg, UserDataBaseService userDBservice, UserLoginService loginService)
|
protected IUGAIMCore m_core;
|
||||||
|
|
||||||
|
public UserServerCommandModule(UserConfig cfg, UserDataBaseService userDBservice, UserLoginService loginService)
|
||||||
{
|
{
|
||||||
m_console = console;
|
|
||||||
Cfg = cfg;
|
Cfg = cfg;
|
||||||
m_userDataBaseService = userDBservice;
|
m_userDataBaseService = userDBservice;
|
||||||
m_loginService = loginService;
|
m_loginService = loginService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void RegisterConsoleCommands()
|
public void Initialise(IUGAIMCore core)
|
||||||
{
|
{
|
||||||
|
m_core = core;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PostInitialise()
|
||||||
|
{
|
||||||
|
m_core.RegisterConsoleHelpDelegate(ShowHelp);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RegisterHandlers(BaseHttpServer httpServer)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RegisterConsoleCommands(ConsoleBase console)
|
||||||
|
{
|
||||||
|
m_console = console;
|
||||||
m_console.Commands.AddCommand("userserver", false, "create user",
|
m_console.Commands.AddCommand("userserver", false, "create user",
|
||||||
"create user [<first> [<last> [<x> <y> [email]]]]",
|
"create user [<first> [<last> [<x> <y> [email]]]]",
|
||||||
"Create a new user account", RunCommand);
|
"Create a new user account", RunCommand);
|
||||||
|
@ -95,10 +112,6 @@ namespace OpenSim.Grid.UserServer
|
||||||
m_console.Commands.AddCommand("userserver", false, "logoff-user",
|
m_console.Commands.AddCommand("userserver", false, "logoff-user",
|
||||||
"logoff-user <first> <last> <message>",
|
"logoff-user <first> <last> <message>",
|
||||||
"Log off a named user", RunCommand);
|
"Log off a named user", RunCommand);
|
||||||
|
|
||||||
m_console.Commands.AddCommand("userserver", false, "test-command",
|
|
||||||
"test-command",
|
|
||||||
"test command", HandleTestCommand);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Console Command Handlers
|
#region Console Command Handlers
|
||||||
|
@ -335,7 +348,7 @@ namespace OpenSim.Grid.UserServer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void ShowHelp(string[] helpArgs)
|
public void ShowHelp(string[] helpArgs)
|
||||||
{
|
{
|
||||||
m_console.Notice("create user - create a new user");
|
m_console.Notice("create user - create a new user");
|
||||||
m_console.Notice("logoff-user <firstname> <lastname> <message> - logs off the specified user from the grid");
|
m_console.Notice("logoff-user <firstname> <lastname> <message> - logs off the specified user from the grid");
|
||||||
|
|
Loading…
Reference in New Issue