diff options
Diffstat (limited to 'OpenSim/Framework/Servers')
-rw-r--r-- | OpenSim/Framework/Servers/BaseOpenSimServer.cs | 39 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/ServerBase.cs | 50 |
2 files changed, 55 insertions, 34 deletions
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 6346279..4f9ac08 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs | |||
@@ -62,7 +62,6 @@ namespace OpenSim.Framework.Servers | |||
62 | /// </summary> | 62 | /// </summary> |
63 | private Timer m_periodicDiagnosticsTimer = new Timer(60 * 60 * 1000); | 63 | private Timer m_periodicDiagnosticsTimer = new Timer(60 * 60 * 1000); |
64 | 64 | ||
65 | protected CommandConsole m_console; | ||
66 | protected OpenSimAppender m_consoleAppender; | 65 | protected OpenSimAppender m_consoleAppender; |
67 | protected IAppender m_logFileAppender = null; | 66 | protected IAppender m_logFileAppender = null; |
68 | 67 | ||
@@ -139,7 +138,8 @@ namespace OpenSim.Framework.Servers | |||
139 | } | 138 | } |
140 | else | 139 | else |
141 | { | 140 | { |
142 | m_consoleAppender.Console = m_console; | 141 | // FIXME: This should be done through an interface rather than casting. |
142 | m_consoleAppender.Console = (ConsoleBase)m_console; | ||
143 | 143 | ||
144 | // If there is no threshold set then the threshold is effectively everything. | 144 | // If there is no threshold set then the threshold is effectively everything. |
145 | if (null == m_consoleAppender.Threshold) | 145 | if (null == m_consoleAppender.Threshold) |
@@ -367,8 +367,10 @@ namespace OpenSim.Framework.Servers | |||
367 | } | 367 | } |
368 | } | 368 | } |
369 | 369 | ||
370 | public virtual void HandleShow(string module, string[] cmd) | 370 | public override void HandleShow(string module, string[] cmd) |
371 | { | 371 | { |
372 | base.HandleShow(module, cmd); | ||
373 | |||
372 | List<string> args = new List<string>(cmd); | 374 | List<string> args = new List<string>(cmd); |
373 | 375 | ||
374 | args.RemoveAt(0); | 376 | args.RemoveAt(0); |
@@ -385,10 +387,6 @@ namespace OpenSim.Framework.Servers | |||
385 | Notice(GetThreadsReport()); | 387 | Notice(GetThreadsReport()); |
386 | break; | 388 | break; |
387 | 389 | ||
388 | case "uptime": | ||
389 | Notice(GetUptimeReport()); | ||
390 | break; | ||
391 | |||
392 | case "version": | 390 | case "version": |
393 | Notice(GetVersionText()); | 391 | Notice(GetVersionText()); |
394 | break; | 392 | break; |
@@ -430,33 +428,6 @@ namespace OpenSim.Framework.Servers | |||
430 | } | 428 | } |
431 | 429 | ||
432 | /// <summary> | 430 | /// <summary> |
433 | /// Console output is only possible if a console has been established. | ||
434 | /// That is something that cannot be determined within this class. So | ||
435 | /// all attempts to use the console MUST be verified. | ||
436 | /// </summary> | ||
437 | /// <param name="msg"></param> | ||
438 | protected void Notice(string msg) | ||
439 | { | ||
440 | if (m_console != null) | ||
441 | { | ||
442 | m_console.Output(msg); | ||
443 | } | ||
444 | } | ||
445 | |||
446 | /// <summary> | ||
447 | /// Console output is only possible if a console has been established. | ||
448 | /// That is something that cannot be determined within this class. So | ||
449 | /// all attempts to use the console MUST be verified. | ||
450 | /// </summary> | ||
451 | /// <param name="format"></param> | ||
452 | /// <param name="components"></param> | ||
453 | protected void Notice(string format, params string[] components) | ||
454 | { | ||
455 | if (m_console != null) | ||
456 | m_console.OutputFormat(format, components); | ||
457 | } | ||
458 | |||
459 | /// <summary> | ||
460 | /// Enhance the version string with extra information if it's available. | 431 | /// Enhance the version string with extra information if it's available. |
461 | /// </summary> | 432 | /// </summary> |
462 | protected void EnhanceVersionInformation() | 433 | protected void EnhanceVersionInformation() |
diff --git a/OpenSim/Framework/Servers/ServerBase.cs b/OpenSim/Framework/Servers/ServerBase.cs index d19234b..afe1f73 100644 --- a/OpenSim/Framework/Servers/ServerBase.cs +++ b/OpenSim/Framework/Servers/ServerBase.cs | |||
@@ -26,13 +26,20 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | using System.Text; | 30 | using System.Text; |
31 | using OpenSim.Framework.Console; | ||
30 | 32 | ||
31 | namespace OpenSim.Framework.Servers | 33 | namespace OpenSim.Framework.Servers |
32 | { | 34 | { |
33 | public class ServerBase | 35 | public class ServerBase |
34 | { | 36 | { |
35 | /// <summary> | 37 | /// <summary> |
38 | /// Console to be used for any command line output. Can be null, in which case there should be no output. | ||
39 | /// </summary> | ||
40 | protected ICommandConsole m_console; | ||
41 | |||
42 | /// <summary> | ||
36 | /// Time at which this server was started | 43 | /// Time at which this server was started |
37 | /// </summary> | 44 | /// </summary> |
38 | protected DateTime m_startuptime; | 45 | protected DateTime m_startuptime; |
@@ -42,6 +49,22 @@ namespace OpenSim.Framework.Servers | |||
42 | m_startuptime = DateTime.Now; | 49 | m_startuptime = DateTime.Now; |
43 | } | 50 | } |
44 | 51 | ||
52 | public virtual void HandleShow(string module, string[] cmd) | ||
53 | { | ||
54 | List<string> args = new List<string>(cmd); | ||
55 | |||
56 | args.RemoveAt(0); | ||
57 | |||
58 | string[] showParams = args.ToArray(); | ||
59 | |||
60 | switch (showParams[0]) | ||
61 | { | ||
62 | case "uptime": | ||
63 | Notice(GetUptimeReport()); | ||
64 | break; | ||
65 | } | ||
66 | } | ||
67 | |||
45 | /// <summary> | 68 | /// <summary> |
46 | /// Return a report about the uptime of this server | 69 | /// Return a report about the uptime of this server |
47 | /// </summary> | 70 | /// </summary> |
@@ -54,5 +77,32 @@ namespace OpenSim.Framework.Servers | |||
54 | 77 | ||
55 | return sb.ToString(); | 78 | return sb.ToString(); |
56 | } | 79 | } |
80 | |||
81 | /// <summary> | ||
82 | /// Console output is only possible if a console has been established. | ||
83 | /// That is something that cannot be determined within this class. So | ||
84 | /// all attempts to use the console MUST be verified. | ||
85 | /// </summary> | ||
86 | /// <param name="msg"></param> | ||
87 | protected void Notice(string msg) | ||
88 | { | ||
89 | if (m_console != null) | ||
90 | { | ||
91 | m_console.Output(msg); | ||
92 | } | ||
93 | } | ||
94 | |||
95 | /// <summary> | ||
96 | /// Console output is only possible if a console has been established. | ||
97 | /// That is something that cannot be determined within this class. So | ||
98 | /// all attempts to use the console MUST be verified. | ||
99 | /// </summary> | ||
100 | /// <param name="format"></param> | ||
101 | /// <param name="components"></param> | ||
102 | protected void Notice(string format, params string[] components) | ||
103 | { | ||
104 | if (m_console != null) | ||
105 | m_console.OutputFormat(format, components); | ||
106 | } | ||
57 | } | 107 | } |
58 | } \ No newline at end of file | 108 | } \ No newline at end of file |