diff options
author | Justin Clarke Casey | 2008-02-04 18:52:24 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-02-04 18:52:24 +0000 |
commit | baefa05b575b28e1ed08670e9c937ca307f09269 (patch) | |
tree | 8f9703391fe86df4ecc1008a140e1ea760c1ae1b /OpenSim/Framework/Servers | |
parent | Change sim command from "stats" to "show stats" for consistency (diff) | |
download | opensim-SC_OLD-baefa05b575b28e1ed08670e9c937ca307f09269.zip opensim-SC_OLD-baefa05b575b28e1ed08670e9c937ca307f09269.tar.gz opensim-SC_OLD-baefa05b575b28e1ed08670e9c937ca307f09269.tar.bz2 opensim-SC_OLD-baefa05b575b28e1ed08670e9c937ca307f09269.tar.xz |
* 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
Diffstat (limited to 'OpenSim/Framework/Servers')
-rw-r--r-- | OpenSim/Framework/Servers/BaseOpenSimServer.cs | 47 |
1 files changed, 45 insertions, 2 deletions
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 @@ | |||
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | 30 | ||
31 | using OpenSim.Framework.Console; | ||
32 | |||
31 | namespace OpenSim.Framework.Servers | 33 | namespace OpenSim.Framework.Servers |
32 | { | 34 | { |
33 | /// <summary> | 35 | /// <summary> |
34 | /// Common base for the main OpenSimServers (user, grid, inventory, region, etc) | 36 | /// Common base for the main OpenSimServers (user, grid, inventory, region, etc) |
35 | /// XXX Not yet implemented, may not grow up for some time | ||
36 | /// </summary> | 37 | /// </summary> |
37 | public class BaseOpenSimServer | 38 | public abstract class BaseOpenSimServer |
38 | { | 39 | { |
40 | protected LogBase m_log; | ||
41 | |||
42 | protected DateTime m_startuptime; | ||
43 | |||
39 | public BaseOpenSimServer() | 44 | public BaseOpenSimServer() |
40 | { | 45 | { |
46 | m_startuptime = DateTime.Now; | ||
47 | } | ||
48 | |||
49 | /// <summary> | ||
50 | /// Runs commands issued by the server console from the operator | ||
51 | /// </summary> | ||
52 | /// <param name="command">The first argument of the parameter (the command)</param> | ||
53 | /// <param name="cmdparams">Additional arguments passed to the command</param> | ||
54 | public virtual void RunCmd(string command, string[] cmdparams) | ||
55 | { | ||
56 | switch (command) | ||
57 | { | ||
58 | case "help": | ||
59 | m_log.Notice("show uptime - show server startup and uptime."); | ||
60 | break; | ||
61 | |||
62 | case "show": | ||
63 | if (cmdparams.Length > 0) | ||
64 | { | ||
65 | Show(cmdparams[0]); | ||
66 | } | ||
67 | break; | ||
68 | } | ||
69 | } | ||
70 | |||
71 | /// <summary> | ||
72 | /// Outputs to the console information about the region | ||
73 | /// </summary> | ||
74 | /// <param name="ShowWhat">What information to display (valid arguments are "uptime", "users")</param> | ||
75 | public virtual void Show(string ShowWhat) | ||
76 | { | ||
77 | switch (ShowWhat) | ||
78 | { | ||
79 | case "uptime": | ||
80 | m_log.Notice("Server has been running since " + m_startuptime.ToString()); | ||
81 | m_log.Notice("That is " + (DateTime.Now - m_startuptime).ToString()); | ||
82 | break; | ||
83 | } | ||
41 | } | 84 | } |
42 | } | 85 | } |
43 | } | 86 | } |