aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorJeff Ames2009-05-05 09:32:30 +0000
committerJeff Ames2009-05-05 09:32:30 +0000
commit6ae88d129a2d85f57202e854f118dff047e65cf1 (patch)
treec063517af905ce778db5907a5dfa81dd2b313736 /OpenSim/Region/Framework
parentRemove bin directory from HttpServer. (diff)
downloadopensim-SC_OLD-6ae88d129a2d85f57202e854f118dff047e65cf1.zip
opensim-SC_OLD-6ae88d129a2d85f57202e854f118dff047e65cf1.tar.gz
opensim-SC_OLD-6ae88d129a2d85f57202e854f118dff047e65cf1.tar.bz2
opensim-SC_OLD-6ae88d129a2d85f57202e854f118dff047e65cf1.tar.xz
Update svn properties.
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs226
1 files changed, 113 insertions, 113 deletions
diff --git a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs
index f9076ab..3e7ec73 100644
--- a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs
+++ b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs
@@ -1,113 +1,113 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 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 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 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 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. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using System.IO; 29using System.IO;
30using System.Net; 30using System.Net;
31using System.Reflection; 31using System.Reflection;
32using System.Text; 32using System.Text;
33using log4net; 33using log4net;
34using Nini.Config; 34using Nini.Config;
35using OpenMetaverse; 35using OpenMetaverse;
36using OpenMetaverse.StructuredData; 36using OpenMetaverse.StructuredData;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Framework.Communications; 38using OpenSim.Framework.Communications;
39using OpenSim.Framework.Communications.Services; 39using OpenSim.Framework.Communications.Services;
40using OpenSim.Framework.Communications.Cache; 40using OpenSim.Framework.Communications.Cache;
41using OpenSim.Framework.Console; 41using OpenSim.Framework.Console;
42using OpenSim.Framework.Servers; 42using OpenSim.Framework.Servers;
43using OpenSim.Framework.Servers.HttpServer; 43using OpenSim.Framework.Servers.HttpServer;
44using OpenSim.Framework.Statistics; 44using OpenSim.Framework.Statistics;
45using OpenSim.Region.Framework; 45using OpenSim.Region.Framework;
46using OpenSim.Region.Framework.Interfaces; 46using OpenSim.Region.Framework.Interfaces;
47using OpenSim.Region.Framework.Scenes; 47using OpenSim.Region.Framework.Scenes;
48 48
49 49
50 50
51namespace OpenSim.Region.Framework.Scenes 51namespace OpenSim.Region.Framework.Scenes
52{ 52{
53 53
54 54
55 public class RegionStatsHandler : IStreamedRequestHandler 55 public class RegionStatsHandler : IStreamedRequestHandler
56 { 56 {
57 private string osRXStatsURI = String.Empty; 57 private string osRXStatsURI = String.Empty;
58 private string osXStatsURI = String.Empty; 58 private string osXStatsURI = String.Empty;
59 //private string osSecret = String.Empty; 59 //private string osSecret = String.Empty;
60 private OpenSim.Framework.RegionInfo regionInfo; 60 private OpenSim.Framework.RegionInfo regionInfo;
61 public string localZone = TimeZone.CurrentTimeZone.StandardName; 61 public string localZone = TimeZone.CurrentTimeZone.StandardName;
62 public TimeSpan utcOffset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now); 62 public TimeSpan utcOffset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now);
63 63
64 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 64 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
65 65
66 public RegionStatsHandler(OpenSim.Framework.RegionInfo region_info ) 66 public RegionStatsHandler(OpenSim.Framework.RegionInfo region_info )
67 { 67 {
68 regionInfo = region_info; 68 regionInfo = region_info;
69 osRXStatsURI = Util.SHA1Hash(regionInfo.regionSecret); 69 osRXStatsURI = Util.SHA1Hash(regionInfo.regionSecret);
70 osXStatsURI = Util.SHA1Hash(regionInfo.osSecret); 70 osXStatsURI = Util.SHA1Hash(regionInfo.osSecret);
71 71
72 } 72 }
73 73
74 public byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse) 74 public byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
75 { 75 {
76 return Encoding.UTF8.GetBytes(Report()); 76 return Encoding.UTF8.GetBytes(Report());
77 } 77 }
78 78
79 public string ContentType 79 public string ContentType
80 { 80 {
81 get { return "text/plain"; } 81 get { return "text/plain"; }
82 } 82 }
83 83
84 public string HttpMethod 84 public string HttpMethod
85 { 85 {
86 get { return "GET"; } 86 get { return "GET"; }
87 } 87 }
88 88
89 public string Path 89 public string Path
90 { 90 {
91 // This is for the region and is the regionSecret hashed 91 // This is for the region and is the regionSecret hashed
92 get { return "/" + osRXStatsURI + "/"; } 92 get { return "/" + osRXStatsURI + "/"; }
93 } 93 }
94 94
95 private string Report() 95 private string Report()
96 { 96 {
97 OSDMap args = new OSDMap(30); 97 OSDMap args = new OSDMap(30);
98 //int time = Util.ToUnixTime( DateTime.Now ); 98 //int time = Util.ToUnixTime( DateTime.Now );
99 args["OSStatsURI"] = OSD.FromString("http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "/" + osXStatsURI + "/"); 99 args["OSStatsURI"] = OSD.FromString("http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "/" + osXStatsURI + "/");
100 args["TimeZoneName"] = OSD.FromString(localZone); 100 args["TimeZoneName"] = OSD.FromString(localZone);
101 args["TimeZoneOffs"] = OSD.FromReal(utcOffset.TotalHours); 101 args["TimeZoneOffs"] = OSD.FromReal(utcOffset.TotalHours);
102 args["UxTime"] = OSD.FromInteger(Util.ToUnixTime(DateTime.Now)); 102 args["UxTime"] = OSD.FromInteger(Util.ToUnixTime(DateTime.Now));
103 args["Memory"] = OSD.FromReal(Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0)); 103 args["Memory"] = OSD.FromReal(Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0));
104 args["Version"] = OSD.FromString(VersionInfo.Version); 104 args["Version"] = OSD.FromString(VersionInfo.Version);
105 105
106 string strBuffer = ""; 106 string strBuffer = "";
107 strBuffer = OSDParser.SerializeJsonString(args); 107 strBuffer = OSDParser.SerializeJsonString(args);
108 108
109 return strBuffer; 109 return strBuffer;
110 110
111 } 111 }
112 } 112 }
113} 113}