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/GridServer/GridServerBase.cs | 27 +++++++++++++++++++++++++-- OpenSim/Grid/GridServer/Program.cs | 12 ++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) (limited to 'OpenSim/Grid/GridServer') diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs index c41a728..e3ad52a 100644 --- a/OpenSim/Grid/GridServer/GridServerBase.cs +++ b/OpenSim/Grid/GridServer/GridServerBase.cs @@ -31,6 +31,7 @@ using System.IO; using System.Reflection; using System.Timers; using log4net; +using Nini.Config; using OpenSim.Framework; using OpenSim.Framework.Console; using OpenSim.Framework.Servers; @@ -46,6 +47,8 @@ namespace OpenSim.Grid.GridServer private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected GridConfig m_config; + public string m_consoleType = "local"; + public IConfigSource m_configSource = null; public GridConfig Config { @@ -71,16 +74,36 @@ namespace OpenSim.Grid.GridServer public GridServerBase() { - m_console = new LocalConsole("Grid"); - MainConsole.Instance = m_console; } protected override void StartupSpecific() { + switch (m_consoleType) + { + case "rest": + m_console = new RemoteConsole("Grid"); + break; + case "basic": + m_console = new CommandConsole("Grid"); + break; + default: + m_console = new LocalConsole("Grid"); + break; + } + MainConsole.Instance = m_console; m_config = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml"))); m_log.Info("[GRID]: Starting HTTP process"); m_httpServer = new BaseHttpServer(m_config.HttpPort); + if (m_console is RemoteConsole) + { + RemoteConsole c = (RemoteConsole)m_console; + c.SetServer(m_httpServer); + IConfig netConfig = m_configSource.AddConfig("Network"); + netConfig.Set("ConsoleUser", m_config.ConsoleUser); + netConfig.Set("ConsolePass", m_config.ConsolePass); + c.ReadConfig(m_configSource); + } LoadPlugins(); diff --git a/OpenSim/Grid/GridServer/Program.cs b/OpenSim/Grid/GridServer/Program.cs index 9618b85..c7ba897 100644 --- a/OpenSim/Grid/GridServer/Program.cs +++ b/OpenSim/Grid/GridServer/Program.cs @@ -26,6 +26,7 @@ */ using log4net.Config; +using Nini.Config; namespace OpenSim.Grid.GridServer { @@ -33,10 +34,21 @@ namespace OpenSim.Grid.GridServer { public static void Main(string[] args) { + ArgvConfigSource argvSource = new ArgvConfigSource(args); + argvSource.AddSwitch("Startup", "console", "c"); + XmlConfigurator.Configure(); GridServerBase app = new GridServerBase(); + IConfig startupConfig = argvSource.Configs["Startup"]; + if (startupConfig != null) + { + app.m_consoleType = startupConfig.GetString("console", "local"); + } + + app.m_configSource = argvSource; + // if (args.Length > 0 && args[0] == "-setuponly") // { // app.Config(); -- cgit v1.1