From baefa05b575b28e1ed08670e9c937ca307f09269 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Mon, 4 Feb 2008 18:52:24 +0000 Subject: * Rebase all current servers on common abstract BaseOpenSimServer class * The immediate upshot is that "show uptime" from the console will now show uptime on all server types (user, asset, grid, etc) * DEV: This refactoring is far from complete - only just enough to makes the "show uptime" command common accross the servers. More is needed, but in this case it's somewhat like eating cabbage, which I prefer not to do all at once --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 47 ++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index d04dbd7..3016715 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -28,16 +28,59 @@ using System; +using OpenSim.Framework.Console; + namespace OpenSim.Framework.Servers { /// /// Common base for the main OpenSimServers (user, grid, inventory, region, etc) - /// XXX Not yet implemented, may not grow up for some time /// - public class BaseOpenSimServer + public abstract class BaseOpenSimServer { + protected LogBase m_log; + + protected DateTime m_startuptime; + public BaseOpenSimServer() { + m_startuptime = DateTime.Now; + } + + /// + /// Runs commands issued by the server console from the operator + /// + /// The first argument of the parameter (the command) + /// Additional arguments passed to the command + public virtual void RunCmd(string command, string[] cmdparams) + { + switch (command) + { + case "help": + m_log.Notice("show uptime - show server startup and uptime."); + break; + + case "show": + if (cmdparams.Length > 0) + { + Show(cmdparams[0]); + } + break; + } + } + + /// + /// Outputs to the console information about the region + /// + /// What information to display (valid arguments are "uptime", "users") + public virtual void Show(string ShowWhat) + { + switch (ShowWhat) + { + case "uptime": + m_log.Notice("Server has been running since " + m_startuptime.ToString()); + m_log.Notice("That is " + (DateTime.Now - m_startuptime).ToString()); + break; + } } } } -- cgit v1.1