aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ApplicationPlugins/GridInfo
diff options
context:
space:
mode:
authorDr Scofield2008-07-25 16:56:46 +0000
committerDr Scofield2008-07-25 16:56:46 +0000
commitb5f23b4c9ca33740830ae6637103c4f019bcd782 (patch)
treed04e497e7d331d4835608c02af25de7d60f98e20 /OpenSim/ApplicationPlugins/GridInfo
parent* disabling ODE unit tests again.. until the dllnotfound exception is resolv... (diff)
downloadopensim-SC_OLD-b5f23b4c9ca33740830ae6637103c4f019bcd782.zip
opensim-SC_OLD-b5f23b4c9ca33740830ae6637103c4f019bcd782.tar.gz
opensim-SC_OLD-b5f23b4c9ca33740830ae6637103c4f019bcd782.tar.bz2
opensim-SC_OLD-b5f23b4c9ca33740830ae6637103c4f019bcd782.tar.xz
first cut at a GridInfo plugin (mantis #1825). Currently just spits
out everything in the [GridInfo] section :-D Also, not yet LLSD but XmlRpc, LLSD via GET will follow. OpenSim.ini.example contains sample values and explanation. Oh, and default values provided are platform: OpenSim mode: standalone | grid have fun.
Diffstat (limited to 'OpenSim/ApplicationPlugins/GridInfo')
-rw-r--r--OpenSim/ApplicationPlugins/GridInfo/GridInfoPlugin.cs121
1 files changed, 121 insertions, 0 deletions
diff --git a/OpenSim/ApplicationPlugins/GridInfo/GridInfoPlugin.cs b/OpenSim/ApplicationPlugins/GridInfo/GridInfoPlugin.cs
new file mode 100644
index 0000000..d8575d0b
--- /dev/null
+++ b/OpenSim/ApplicationPlugins/GridInfo/GridInfoPlugin.cs
@@ -0,0 +1,121 @@
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
28using System;
29using System.Collections;
30using System.IO;
31using System.Net;
32using System.Reflection;
33using System.Timers;
34using libsecondlife;
35using log4net;
36using Nini.Config;
37using Nwc.XmlRpc;
38using OpenSim.Framework;
39using OpenSim.Framework.Servers;
40using OpenSim.Region.Environment.Modules.World.Terrain;
41using OpenSim.Region.Environment.Scenes;
42
43namespace OpenSim.ApplicationPlugins.GridInfo
44{
45 public class GridInfoPlugin : IApplicationPlugin
46 {
47 private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48
49 private OpenSimBase _app;
50 private BaseHttpServer _httpd;
51
52 private string _name = "GridInfoPlugin";
53 private string _version = "0.1";
54 private Hashtable _info = new Hashtable();
55
56 public string Version { get { return _version; } }
57 public string Name { get { return _name; } }
58
59 public void Initialise()
60 {
61 _log.Info("[GridInfo]: " + Name + " cannot be default-initialized!");
62 throw new PluginNotInitialisedException (Name);
63 }
64
65 public void Initialise(OpenSimBase openSim)
66 {
67 try
68 {
69 _log.Info("[GridInfo]: Grid Info Plugin Enabled");
70
71 _app = openSim;
72 _httpd = openSim.HttpServer;
73
74 IConfig startupConfig = _app.ConfigSource.Source.Configs["Startup"];
75 if (!startupConfig.GetBoolean("gridmode", false))
76 {
77 _info["mode"] = "standalone";
78 }
79 else
80 {
81 _info["mode"] = "grid";
82 }
83 _info["platform"] = "OpenSim";
84
85 IConfig gridInfoConfig = _app.ConfigSource.Source.Configs["GridInfo"];
86 foreach (string k in gridInfoConfig.GetKeys())
87 {
88 _info[k] = gridInfoConfig.GetString(k);
89 }
90
91 _httpd.AddXmlRPCHandler("get_grid_info", XmlRpcGridInfoMethod);
92 }
93 catch (NullReferenceException)
94 {
95 // Ignore.
96 }
97 }
98
99
100
101 public XmlRpcResponse XmlRpcGridInfoMethod(XmlRpcRequest request)
102 {
103 XmlRpcResponse response = new XmlRpcResponse();
104 Hashtable responseData = new Hashtable();
105
106 _log.Info("[GridInfo]: Request for grid info");
107
108 foreach (string k in _info.Keys)
109 {
110 responseData[k] = _info[k];
111 }
112 response.Value = responseData;
113
114 return response;
115 }
116
117 public void Dispose()
118 {
119 }
120 }
121}