From 54c6a920baa0ef02a9ea09e08cc1effcef3b0a3a Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 7 Feb 2009 12:25:39 +0000 Subject: Replace the console for all OpenSim apps with a new console featuring command line editing, context sensitive help (press ? at any time), command line history, a new plugin command system and new appender features thet let you type while the console is scrolling. Seamlessly integrates the ICommander interfaces. --- OpenSim/Grid/GridServer/GridServerBase.cs | 63 +++++++++++++++++-------------- 1 file changed, 34 insertions(+), 29 deletions(-) (limited to 'OpenSim/Grid/GridServer') diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs index 68edbd2..3fb07b5 100644 --- a/OpenSim/Grid/GridServer/GridServerBase.cs +++ b/OpenSim/Grid/GridServer/GridServerBase.cs @@ -39,7 +39,7 @@ namespace OpenSim.Grid.GridServer { /// /// - public class GridServerBase : BaseOpenSimServer, conscmd_callback + public class GridServerBase : BaseOpenSimServer { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -59,43 +59,34 @@ namespace OpenSim.Grid.GridServer public GridServerBase() { - m_console = new ConsoleBase("Grid", this); + m_console = new ConsoleBase("Grid"); MainConsole.Instance = m_console; } - public override void RunCmd(string cmd, string[] cmdparams) + private void HandleRegistration(string module, string[] cmd) { - base.RunCmd(cmd, cmdparams); - - switch (cmd) + switch (cmd[0]) { - case "disable-reg": - m_config.AllowRegionRegistration = false; - m_log.Info("Region registration disabled"); - break; - case "enable-reg": - m_config.AllowRegionRegistration = true; - m_log.Info("Region registration enabled"); - break; + case "enable": + m_config.AllowRegionRegistration = true; + m_log.Info("Region registration enabled"); + break; + case "disable": + m_config.AllowRegionRegistration = false; + m_log.Info("Region registration disabled"); + break; } } - - public override void Show(string[] showParams) - { - base.Show(showParams); - switch (showParams[0]) + private void HandleShowStatus(string module, string[] cmd) + { + if (m_config.AllowRegionRegistration) { - case "status": - if (m_config.AllowRegionRegistration) - { - m_log.Info("Region registration enabled."); - } - else - { - m_log.Info("Region registration disabled."); - } - break; + m_log.Info("Region registration enabled."); + } + else + { + m_log.Info("Region registration disabled."); } } @@ -120,6 +111,20 @@ namespace OpenSim.Grid.GridServer // Timer simCheckTimer = new Timer(3600000 * 3); // 3 Hours between updates. // simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims); // simCheckTimer.Enabled = true; + + base.StartupSpecific(); + + m_console.Commands.AddCommand("gridserver", "enable registration", + "enable registration", + "Enable new regions to register", HandleRegistration); + + m_console.Commands.AddCommand("gridserver", "disable registration", + "disable registration", + "Disable registering new regions", HandleRegistration); + + m_console.Commands.AddCommand("gridserver", "show status", + "show status", + "Show registration status", HandleShowStatus); } protected void AddHttpHandlers() -- cgit v1.1