diff options
author | Justin Clarke Casey | 2008-05-31 20:35:12 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-05-31 20:35:12 +0000 |
commit | 8cb5ec5fdd21ac3ace385d67145dad8d462ebcb6 (patch) | |
tree | c19c5ea998f73ea195542ce3650782baa226e972 /OpenSim/Framework/Servers | |
parent | * Made UpdateUserCurrentRegion a bit more forgiving. (diff) | |
download | opensim-SC_OLD-8cb5ec5fdd21ac3ace385d67145dad8d462ebcb6.zip opensim-SC_OLD-8cb5ec5fdd21ac3ace385d67145dad8d462ebcb6.tar.gz opensim-SC_OLD-8cb5ec5fdd21ac3ace385d67145dad8d462ebcb6.tar.bz2 opensim-SC_OLD-8cb5ec5fdd21ac3ace385d67145dad8d462ebcb6.tar.xz |
* Make version information common to all servers
* Now all servers respond to the "show version" command on the console
Diffstat (limited to 'OpenSim/Framework/Servers')
-rw-r--r-- | OpenSim/Framework/Servers/BaseOpenSimServer.cs | 82 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/VersionInfo.cs | 37 |
2 files changed, 119 insertions, 0 deletions
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 60c6883..0205e38 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.IO; | ||
29 | using OpenSim.Framework.Console; | 30 | using OpenSim.Framework.Console; |
30 | using OpenSim.Framework.Statistics; | 31 | using OpenSim.Framework.Statistics; |
31 | 32 | ||
@@ -37,7 +38,16 @@ namespace OpenSim.Framework.Servers | |||
37 | public abstract class BaseOpenSimServer | 38 | public abstract class BaseOpenSimServer |
38 | { | 39 | { |
39 | protected ConsoleBase m_console; | 40 | protected ConsoleBase m_console; |
41 | |||
42 | /// <summary> | ||
43 | /// Time at which this server was started | ||
44 | /// </summary> | ||
40 | protected DateTime m_startuptime; | 45 | protected DateTime m_startuptime; |
46 | |||
47 | /// <summary> | ||
48 | /// Server version information. Usually VersionInfo + information about svn revision, operating system, etc. | ||
49 | /// </summary> | ||
50 | protected string m_version; | ||
41 | 51 | ||
42 | protected BaseHttpServer m_httpServer; | 52 | protected BaseHttpServer m_httpServer; |
43 | public BaseHttpServer HttpServer | 53 | public BaseHttpServer HttpServer |
@@ -53,6 +63,11 @@ namespace OpenSim.Framework.Servers | |||
53 | public BaseOpenSimServer() | 63 | public BaseOpenSimServer() |
54 | { | 64 | { |
55 | m_startuptime = DateTime.Now; | 65 | m_startuptime = DateTime.Now; |
66 | |||
67 | m_version = VersionInfo.Version; | ||
68 | |||
69 | // FIXME: This should probably occur in a startup method common for all the servers. | ||
70 | EnhanceVersionInformation(); | ||
56 | } | 71 | } |
57 | 72 | ||
58 | /// <summary> | 73 | /// <summary> |
@@ -64,6 +79,7 @@ namespace OpenSim.Framework.Servers | |||
64 | { | 79 | { |
65 | m_console.Close(); | 80 | m_console.Close(); |
66 | } | 81 | } |
82 | |||
67 | Environment.Exit(0); | 83 | Environment.Exit(0); |
68 | } | 84 | } |
69 | 85 | ||
@@ -120,6 +136,10 @@ namespace OpenSim.Framework.Servers | |||
120 | Notice("Server has been running since " + m_startuptime.DayOfWeek + ", " + m_startuptime.ToString()); | 136 | Notice("Server has been running since " + m_startuptime.DayOfWeek + ", " + m_startuptime.ToString()); |
121 | Notice("That is an elapsed time of " + (DateTime.Now - m_startuptime).ToString()); | 137 | Notice("That is an elapsed time of " + (DateTime.Now - m_startuptime).ToString()); |
122 | break; | 138 | break; |
139 | |||
140 | case "version": | ||
141 | m_console.Notice("This is " + m_version); | ||
142 | break; | ||
123 | } | 143 | } |
124 | } | 144 | } |
125 | 145 | ||
@@ -136,5 +156,67 @@ namespace OpenSim.Framework.Servers | |||
136 | } | 156 | } |
137 | } | 157 | } |
138 | 158 | ||
159 | /// <summary> | ||
160 | /// Enhance the version string with extra information if it's available. | ||
161 | /// </summary> | ||
162 | protected void EnhanceVersionInformation() | ||
163 | { | ||
164 | string buildVersion = string.Empty; | ||
165 | |||
166 | // Add subversion revision information if available | ||
167 | // FIXME: Making an assumption about the directory we're currently in - we do this all over the place | ||
168 | // elsewhere as well | ||
169 | string svnFileName = "../.svn/entries"; | ||
170 | string inputLine; | ||
171 | int strcmp; | ||
172 | |||
173 | if (File.Exists(svnFileName)) | ||
174 | { | ||
175 | StreamReader EntriesFile = File.OpenText(svnFileName); | ||
176 | inputLine = EntriesFile.ReadLine(); | ||
177 | while (inputLine != null) | ||
178 | { | ||
179 | // using the dir svn revision at the top of entries file | ||
180 | strcmp = String.Compare(inputLine, "dir"); | ||
181 | if (strcmp == 0) | ||
182 | { | ||
183 | buildVersion = EntriesFile.ReadLine(); | ||
184 | break; | ||
185 | } | ||
186 | else | ||
187 | { | ||
188 | inputLine = EntriesFile.ReadLine(); | ||
189 | } | ||
190 | } | ||
191 | EntriesFile.Close(); | ||
192 | } | ||
193 | |||
194 | if (!string.IsNullOrEmpty(buildVersion)) | ||
195 | { | ||
196 | m_version += ", SVN build r" + buildVersion; | ||
197 | } | ||
198 | else | ||
199 | { | ||
200 | m_version += ", SVN build revision not available"; | ||
201 | } | ||
202 | |||
203 | // Add operating system information if available | ||
204 | string OSString = ""; | ||
205 | |||
206 | if (System.Environment.OSVersion.Platform != PlatformID.Unix) | ||
207 | { | ||
208 | OSString = System.Environment.OSVersion.ToString(); | ||
209 | } | ||
210 | else | ||
211 | { | ||
212 | OSString = Util.ReadEtcIssue(); | ||
213 | } | ||
214 | if (OSString.Length > 45) | ||
215 | { | ||
216 | OSString = OSString.Substring(0, 45); | ||
217 | } | ||
218 | |||
219 | m_version += ", OS " + OSString; | ||
220 | } | ||
139 | } | 221 | } |
140 | } | 222 | } |
diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs new file mode 100644 index 0000000..5bd78e7 --- /dev/null +++ b/OpenSim/Framework/Servers/VersionInfo.cs | |||
@@ -0,0 +1,37 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | namespace OpenSim | ||
29 | { | ||
30 | /// <summary> | ||
31 | /// This is the OpenSim version string. Change this if you are releasing a new OpenSim version. | ||
32 | /// </summary> | ||
33 | public class VersionInfo | ||
34 | { | ||
35 | public readonly static string Version = "OpenSimulator trunk (post 0.5.7)"; | ||
36 | } | ||
37 | } | ||