From 8cb5ec5fdd21ac3ace385d67145dad8d462ebcb6 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Sat, 31 May 2008 20:35:12 +0000
Subject: * Make version information common to all servers * Now all servers
respond to the "show version" command on the console
---
OpenSim/Framework/Servers/BaseOpenSimServer.cs | 82 ++++++++++++++++++++++
OpenSim/Framework/Servers/VersionInfo.cs | 37 ++++++++++
OpenSim/Region/Application/Application.cs | 1 +
OpenSim/Region/Application/OpenSimMain.cs | 71 +------------------
OpenSim/Region/Application/OpenSimMainConsole.cs | 12 ----
OpenSim/Region/Application/VersionInfo.cs | 37 ----------
.../Region/ClientStack/LindenUDP/LLClientView.cs | 2 +-
7 files changed, 124 insertions(+), 118 deletions(-)
create mode 100644 OpenSim/Framework/Servers/VersionInfo.cs
delete mode 100644 OpenSim/Region/Application/VersionInfo.cs
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 @@
*/
using System;
+using System.IO;
using OpenSim.Framework.Console;
using OpenSim.Framework.Statistics;
@@ -37,7 +38,16 @@ namespace OpenSim.Framework.Servers
public abstract class BaseOpenSimServer
{
protected ConsoleBase m_console;
+
+ ///
+ /// Time at which this server was started
+ ///
protected DateTime m_startuptime;
+
+ ///
+ /// Server version information. Usually VersionInfo + information about svn revision, operating system, etc.
+ ///
+ protected string m_version;
protected BaseHttpServer m_httpServer;
public BaseHttpServer HttpServer
@@ -53,6 +63,11 @@ namespace OpenSim.Framework.Servers
public BaseOpenSimServer()
{
m_startuptime = DateTime.Now;
+
+ m_version = VersionInfo.Version;
+
+ // FIXME: This should probably occur in a startup method common for all the servers.
+ EnhanceVersionInformation();
}
///
@@ -64,6 +79,7 @@ namespace OpenSim.Framework.Servers
{
m_console.Close();
}
+
Environment.Exit(0);
}
@@ -120,6 +136,10 @@ namespace OpenSim.Framework.Servers
Notice("Server has been running since " + m_startuptime.DayOfWeek + ", " + m_startuptime.ToString());
Notice("That is an elapsed time of " + (DateTime.Now - m_startuptime).ToString());
break;
+
+ case "version":
+ m_console.Notice("This is " + m_version);
+ break;
}
}
@@ -136,5 +156,67 @@ namespace OpenSim.Framework.Servers
}
}
+ ///
+ /// Enhance the version string with extra information if it's available.
+ ///
+ protected void EnhanceVersionInformation()
+ {
+ string buildVersion = string.Empty;
+
+ // Add subversion revision information if available
+ // FIXME: Making an assumption about the directory we're currently in - we do this all over the place
+ // elsewhere as well
+ string svnFileName = "../.svn/entries";
+ string inputLine;
+ int strcmp;
+
+ if (File.Exists(svnFileName))
+ {
+ StreamReader EntriesFile = File.OpenText(svnFileName);
+ inputLine = EntriesFile.ReadLine();
+ while (inputLine != null)
+ {
+ // using the dir svn revision at the top of entries file
+ strcmp = String.Compare(inputLine, "dir");
+ if (strcmp == 0)
+ {
+ buildVersion = EntriesFile.ReadLine();
+ break;
+ }
+ else
+ {
+ inputLine = EntriesFile.ReadLine();
+ }
+ }
+ EntriesFile.Close();
+ }
+
+ if (!string.IsNullOrEmpty(buildVersion))
+ {
+ m_version += ", SVN build r" + buildVersion;
+ }
+ else
+ {
+ m_version += ", SVN build revision not available";
+ }
+
+ // Add operating system information if available
+ string OSString = "";
+
+ if (System.Environment.OSVersion.Platform != PlatformID.Unix)
+ {
+ OSString = System.Environment.OSVersion.ToString();
+ }
+ else
+ {
+ OSString = Util.ReadEtcIssue();
+ }
+ if (OSString.Length > 45)
+ {
+ OSString = OSString.Substring(0, 45);
+ }
+
+ m_version += ", OS " + OSString;
+ }
}
}
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 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSim Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+namespace OpenSim
+{
+ ///
+ /// This is the OpenSim version string. Change this if you are releasing a new OpenSim version.
+ ///
+ public class VersionInfo
+ {
+ public readonly static string Version = "OpenSimulator trunk (post 0.5.7)";
+ }
+}
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs
index b2c710a..9aa885f 100644
--- a/OpenSim/Region/Application/Application.cs
+++ b/OpenSim/Region/Application/Application.cs
@@ -98,6 +98,7 @@ namespace OpenSim
}
private static bool _IsHandlingException = false; // Make sure we don't go recursive on ourself
+
///
/// Global exception handler -- all unhandlet exceptions end up here :)
///
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index d790e41..03dbf78 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -54,11 +54,6 @@ namespace OpenSim
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
- ///
- /// Holds a human readable build version for this server.
- ///
- protected string buildVersion;
-
protected string proxyUrl;
protected int proxyOffset = 0;
@@ -359,72 +354,11 @@ namespace OpenSim
}
///
- /// Enhance the version string with extra information if it's available.
- ///
- protected void EnhanceVersionInformation()
- {
- // Add subversion revision information if available
- string svnFileName = "../.svn/entries";
- string inputLine;
- int strcmp;
-
- if (File.Exists(svnFileName))
- {
- StreamReader EntriesFile = File.OpenText(svnFileName);
- inputLine = EntriesFile.ReadLine();
- while (inputLine != null)
- {
- // using the dir svn revision at the top of entries file
- strcmp = String.Compare(inputLine, "dir");
- if (strcmp == 0)
- {
- buildVersion = EntriesFile.ReadLine();
- break;
- }
- else
- {
- inputLine = EntriesFile.ReadLine();
- }
- }
- EntriesFile.Close();
- }
-
- if (!string.IsNullOrEmpty(buildVersion))
- {
- VersionInfo.Version += ", SVN build r" + buildVersion;
- }
- else
- {
- VersionInfo.Version += ", SVN build revision not available";
- }
-
- // Add operating system information if available
- string OSString = "";
-
- if (System.Environment.OSVersion.Platform != PlatformID.Unix)
- {
- OSString = System.Environment.OSVersion.ToString();
- }
- else
- {
- OSString = Util.ReadEtcIssue();
- }
- if (OSString.Length > 45)
- {
- OSString = OSString.Substring(0, 45);
- }
-
- VersionInfo.Version += ", OS " + OSString;
- }
-
- ///
/// Performs initialisation of the scene, such as loading configuration from disk.
///
protected void InternalStartUp()
{
- EnhanceVersionInformation();
-
- m_log.Info("[STARTUP]: OpenSim version: " + VersionInfo.Version + "\n");
+ m_log.Info("[STARTUP]: Version " + m_version + "\n");
m_stats = StatsManager.StartCollectingSimExtraStats();
@@ -658,13 +592,14 @@ namespace OpenSim
new Scene(regionInfo, circuitManager, m_commsManager, sceneGridService, m_assetCache,
storageManager, m_httpServer,
m_moduleLoader, m_dumpAssetsToFile, m_physicalPrim, m_see_into_region_from_neighbor, m_config,
- VersionInfo.Version);
+ m_version);
}
public void handleRestartRegion(RegionInfo whichRegion)
{
m_log.Error("[OPENSIM MAIN]: Got restart signal from SceneManager");
+
// Shutting down the client server
bool foundClientServer = false;
int clientServerElement = 0;
diff --git a/OpenSim/Region/Application/OpenSimMainConsole.cs b/OpenSim/Region/Application/OpenSimMainConsole.cs
index 7b1b477..467db14 100644
--- a/OpenSim/Region/Application/OpenSimMainConsole.cs
+++ b/OpenSim/Region/Application/OpenSimMainConsole.cs
@@ -253,7 +253,6 @@ namespace OpenSim
m_console.Notice("show assets - show state of asset cache.");
m_console.Notice("show users - show info about connected users.");
m_console.Notice("show modules - shows info about loaded modules.");
- m_console.Notice("show version - show the running build version.");
m_console.Notice("show regions - show running region information.");
m_console.Notice("threads - list threads");
m_console.Notice("config set section field value - set a config value");
@@ -661,17 +660,6 @@ namespace OpenSim
scene.RegionInfo.RegionLocY);
});
break;
-
- case "version":
- if (!string.IsNullOrEmpty(buildVersion))
- {
- m_console.Notice("The build version is: r" + buildVersion);
- }
- else
- {
- m_console.Notice("The build version is not available");
- }
- break;
}
}
diff --git a/OpenSim/Region/Application/VersionInfo.cs b/OpenSim/Region/Application/VersionInfo.cs
deleted file mode 100644
index 5e291f1..0000000
--- a/OpenSim/Region/Application/VersionInfo.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSim Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-namespace OpenSim
-{
- ///
- /// Exists purely to hold version information.
- ///
- public class VersionInfo
- {
- public static string Version = "trunk (post 0.5.7)";
- }
-}
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 6a912e5..8b5ecb7 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -366,7 +366,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
m_moneyBalance = 1000;
- m_channelVersion = Helpers.StringToField("OpenSimulator Server " + scene.GetSimulatorVersion());
+ m_channelVersion = Helpers.StringToField(scene.GetSimulatorVersion());
InitDefaultAnimations();
--
cgit v1.1