From 99c7a43ffdb9c3b4dee984f7cd788742c6ee3e53 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 19 Aug 2009 04:39:02 +0100 Subject: Add rest console support to the user server. Will ask new questions at startup. To use, run it normally once, answering the questions, then run again with -console=rest. Also now supports -console=basic for a console that reads stdin --- OpenSim/Grid/UserServer/Main.cs | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'OpenSim/Grid/UserServer/Main.cs') diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index 86c2abb..f47a96e 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs @@ -43,6 +43,7 @@ using OpenSim.Framework.Statistics; using OpenSim.Grid.Communications.OGS1; using OpenSim.Grid.Framework; using OpenSim.Grid.UserServer.Modules; +using Nini.Config; namespace OpenSim.Grid.UserServer { @@ -73,8 +74,22 @@ namespace OpenSim.Grid.UserServer protected AvatarCreationModule m_appearanceModule; + protected static string m_consoleType = "local"; + protected static IConfigSource m_config = null; + public static void Main(string[] args) { + ArgvConfigSource argvSource = new ArgvConfigSource(args); + argvSource.AddSwitch("Startup", "console", "c"); + + IConfig startupConfig = argvSource.Configs["Startup"]; + if (startupConfig != null) + { + m_consoleType = startupConfig.GetString("console", "local"); + } + + m_config = argvSource; + XmlConfigurator.Configure(); m_log.Info("Launching UserServer..."); @@ -87,7 +102,18 @@ namespace OpenSim.Grid.UserServer public OpenUser_Main() { - m_console = new LocalConsole("User"); + switch (m_consoleType) + { + case "rest": + m_console = new RemoteConsole("User"); + break; + case "basic": + m_console = new CommandConsole("User"); + break; + default: + m_console = new LocalConsole("User"); + break; + } MainConsole.Instance = m_console; } @@ -129,6 +155,17 @@ namespace OpenSim.Grid.UserServer m_httpServer = new BaseHttpServer(Cfg.HttpPort); + if (m_console is RemoteConsole) + { + System.Console.WriteLine("Initialized REST console"); + RemoteConsole c = (RemoteConsole)m_console; + c.SetServer(m_httpServer); + IConfig netConfig = m_config.AddConfig("Network"); + netConfig.Set("ConsoleUser", Cfg.ConsoleUser); + netConfig.Set("ConsolePass", Cfg.ConsolePass); + c.ReadConfig(m_config); + } + RegisterInterface(m_console); RegisterInterface(Cfg); -- cgit v1.1 From dd0234f5005127c03760c2b9862ed1672f4a2e91 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 19 Aug 2009 05:15:25 +0100 Subject: Graft the REST console onto the grid server. Same procedure as with the user server. --- OpenSim/Grid/UserServer/Main.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Grid/UserServer/Main.cs') diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index f47a96e..1ee53ef 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs @@ -157,7 +157,6 @@ namespace OpenSim.Grid.UserServer if (m_console is RemoteConsole) { - System.Console.WriteLine("Initialized REST console"); RemoteConsole c = (RemoteConsole)m_console; c.SetServer(m_httpServer); IConfig netConfig = m_config.AddConfig("Network"); -- cgit v1.1