diff options
-rw-r--r-- | OpenSim/ApplicationPlugins/GridInfo/GridInfoPlugin.cs | 122 |
1 files changed, 0 insertions, 122 deletions
diff --git a/OpenSim/ApplicationPlugins/GridInfo/GridInfoPlugin.cs b/OpenSim/ApplicationPlugins/GridInfo/GridInfoPlugin.cs deleted file mode 100644 index 000fa52..0000000 --- a/OpenSim/ApplicationPlugins/GridInfo/GridInfoPlugin.cs +++ /dev/null | |||
@@ -1,122 +0,0 @@ | |||
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 | using System; | ||
29 | using System.Collections; | ||
30 | using System.IO; | ||
31 | using System.Net; | ||
32 | using System.Reflection; | ||
33 | using System.Timers; | ||
34 | using libsecondlife; | ||
35 | using log4net; | ||
36 | using Nini.Config; | ||
37 | using Nwc.XmlRpc; | ||
38 | using OpenSim.Framework; | ||
39 | using OpenSim.Framework.Servers; | ||
40 | using OpenSim.Region.Environment.Modules.World.Terrain; | ||
41 | using OpenSim.Region.Environment.Scenes; | ||
42 | |||
43 | namespace 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 | _httpd.AddXmlRPCHandler("get_grid_info", XmlRpcGridInfoMethod); | ||
86 | |||
87 | IConfig gridInfoConfig = _app.ConfigSource.Source.Configs["GridInfo"]; | ||
88 | foreach (string k in gridInfoConfig.GetKeys()) | ||
89 | { | ||
90 | _info[k] = gridInfoConfig.GetString(k); | ||
91 | } | ||
92 | |||
93 | } | ||
94 | catch (NullReferenceException) | ||
95 | { | ||
96 | // Ignore. | ||
97 | } | ||
98 | } | ||
99 | |||
100 | |||
101 | |||
102 | public XmlRpcResponse XmlRpcGridInfoMethod(XmlRpcRequest request) | ||
103 | { | ||
104 | XmlRpcResponse response = new XmlRpcResponse(); | ||
105 | Hashtable responseData = new Hashtable(); | ||
106 | |||
107 | _log.Info("[GridInfo]: Request for grid info"); | ||
108 | |||
109 | foreach (string k in _info.Keys) | ||
110 | { | ||
111 | responseData[k] = _info[k]; | ||
112 | } | ||
113 | response.Value = responseData; | ||
114 | |||
115 | return response; | ||
116 | } | ||
117 | |||
118 | public void Dispose() | ||
119 | { | ||
120 | } | ||
121 | } | ||
122 | } | ||