aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDr Scofield2008-07-25 16:56:46 +0000
committerDr Scofield2008-07-25 16:56:46 +0000
commitb5f23b4c9ca33740830ae6637103c4f019bcd782 (patch)
treed04e497e7d331d4835608c02af25de7d60f98e20
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.
-rw-r--r--OpenSim/ApplicationPlugins/GridInfo/GridInfoPlugin.cs121
-rw-r--r--bin/OpenSim.ini.example20
-rw-r--r--prebuild.xml33
-rw-r--r--share/python/grid_info.py12
4 files changed, 186 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}
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example
index c6bf912..6622997 100644
--- a/bin/OpenSim.ini.example
+++ b/bin/OpenSim.ini.example
@@ -1,3 +1,23 @@
1[GridInfo]
2; login uri
3login = http://127.0.0.1:9000/
4; login page
5welcome = http://127.0.0.1/welcome
6; helper uri
7economy = http://127.0.0.1:9000/
8; web page of grid
9about = http://127.0.0.1/about/
10; account creation
11register = http://127.0.0.1/register
12; help
13help = http://127.0.0.1/help
14; password help
15password = http://127.0.0.1/password
16; long grid name
17gridname = "the lost continent of hippo"
18; short grid name
19gridnick = "hippogrid"
20
1[Startup] 21[Startup]
2 22
3; Set this to true if you are connecting your OpenSimulator regions to a grid 23; Set this to true if you are connecting your OpenSimulator regions to a grid
diff --git a/prebuild.xml b/prebuild.xml
index ec0b71f..c98fd17 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -1103,6 +1103,39 @@
1103 </Files> 1103 </Files>
1104 </Project> 1104 </Project>
1105 1105
1106 <Project name="OpenSim.ApplicationPlugins.GridInfo" path="OpenSim/ApplicationPlugins/GridInfo" type="Library">
1107 <Configuration name="Debug">
1108 <Options>
1109 <OutputPath>../../../bin/</OutputPath>
1110 </Options>
1111 </Configuration>
1112 <Configuration name="Release">
1113 <Options>
1114 <OutputPath>../../../bin/</OutputPath>
1115 </Options>
1116 </Configuration>
1117
1118 <ReferencePath>../../../bin/</ReferencePath>
1119 <Reference name="Mono.Addins.dll" />
1120 <Reference name="System"/>
1121 <Reference name="System.Xml"/>
1122 <Reference name="libsecondlife.dll" />
1123 <Reference name="Nini.dll" />
1124 <Reference name="XMLRPC.dll" />
1125 <Reference name="OpenSim"/>
1126 <Reference name="OpenSim.Region.ClientStack"/>
1127 <Reference name="OpenSim.Region.Environment"/>
1128 <Reference name="OpenSim.Framework.Communications"/>
1129 <Reference name="OpenSim.Framework"/>
1130 <Reference name="OpenSim.Framework.Servers"/>
1131 <Reference name="OpenSim.Framework.Console"/>
1132 <Reference name="log4net.dll"/>
1133
1134 <Files>
1135 <Match pattern="*.cs" recurse="true"/>
1136 </Files>
1137 </Project>
1138
1106 <!-- REST plugins --> 1139 <!-- REST plugins -->
1107 <Project name="OpenSim.ApplicationPlugins.Rest" 1140 <Project name="OpenSim.ApplicationPlugins.Rest"
1108 path="OpenSim/ApplicationPlugins/Rest" type="Library"> 1141 path="OpenSim/ApplicationPlugins/Rest" type="Library">
diff --git a/share/python/grid_info.py b/share/python/grid_info.py
new file mode 100644
index 0000000..8a89328
--- /dev/null
+++ b/share/python/grid_info.py
@@ -0,0 +1,12 @@
1#!/usr/bin/python
2# -*- encoding: utf-8 -*-
3import xmlrpclib
4
5# XML-RPC URL (http_listener_port)
6gridServerURL = 'http://127.0.0.1:9000'
7
8# instantiate server object
9gridServer = xmlrpclib.Server(gridServerURL)
10
11# invoke admin_alert: requires password and message
12print gridServer.get_grid_info({})