aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs74
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/LocalGridFeaturesServiceInConnector.cs129
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs5
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs12
-rw-r--r--OpenSim/Server/Handlers/Grid/GridExtraFeaturesHandlers.cs127
-rw-r--r--OpenSim/Server/Handlers/Grid/GridExtraFeaturesServerInConnector.cs50
-rw-r--r--OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs19
-rw-r--r--OpenSim/Services/Connectors/Grid/GridServicesConnector.cs39
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs7
-rw-r--r--OpenSim/Services/GridService/GridService.cs43
-rw-r--r--OpenSim/Services/Interfaces/IGridService.cs3
11 files changed, 152 insertions, 356 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
index 9f1eb88..1345bff 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
@@ -27,17 +27,18 @@
27 27
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic;
30using System.Reflection; 31using System.Reflection;
31using log4net; 32using log4net;
32using Nini.Config; 33using Nini.Config;
33using Mono.Addins; 34using Mono.Addins;
34using OpenMetaverse; 35using OpenMetaverse;
35using OpenMetaverse.StructuredData; 36using OpenMetaverse.StructuredData;
36using OpenSim.Framework; 37//using OpenSim.Framework;
37using OpenSim.Framework.Servers.HttpServer; 38using OpenSim.Framework.Servers.HttpServer;
38using OpenSim.Region.Framework.Interfaces; 39using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
40using OpenSim.Services.Interfaces; 41// using OpenSim.Services.Interfaces;
41using Caps = OpenSim.Framework.Capabilities.Caps; 42using Caps = OpenSim.Framework.Capabilities.Caps;
42 43
43namespace OpenSim.Region.ClientStack.Linden 44namespace OpenSim.Region.ClientStack.Linden
@@ -63,8 +64,6 @@ namespace OpenSim.Region.ClientStack.Linden
63 64
64 private Scene m_scene; 65 private Scene m_scene;
65 66
66 bool m_AllowOverride = true;
67
68 /// <summary> 67 /// <summary>
69 /// Simulator features 68 /// Simulator features
70 /// </summary> 69 /// </summary>
@@ -81,25 +80,11 @@ namespace OpenSim.Region.ClientStack.Linden
81 IConfig config = source.Configs["SimulatorFeatures"]; 80 IConfig config = source.Configs["SimulatorFeatures"];
82 81
83 if (config != null) 82 if (config != null)
84 { 83 {
85 string featuresURI = config.GetString("ExtraFeaturesServiceURI", string.Empty); 84 // These are normaly set in their respective modules
86 85 m_SearchURL = config.GetString("SearchServerURI", m_SearchURL);
87 if (string.IsNullOrEmpty(featuresURI)) 86 m_DestinationGuideURL = config.GetString ("DestinationGuideURI", m_DestinationGuideURL);
88 { 87 m_ExportSupported = config.GetBoolean("ExportSupported", m_ExportSupported);
89 m_log.Info("ExtraFeaturesServiceURI is undefined. The grid's ExtraFeatures will not be available to regions in this instance.");
90 }
91 else
92 {
93 GetGridExtraFeatures(featuresURI);
94 }
95
96 if (m_AllowOverride)
97 {
98 m_SearchURL = config.GetString("SearchServerURI", m_SearchURL);
99 m_DestinationGuideURL = config.GetString ("DestinationGuideURI", m_DestinationGuideURL);
100
101 m_ExportSupported = config.GetBoolean("ExportSupported", m_ExportSupported);
102 }
103 } 88 }
104 89
105 AddDefaultFeatures(); 90 AddDefaultFeatures();
@@ -120,6 +105,7 @@ namespace OpenSim.Region.ClientStack.Linden
120 105
121 public void RegionLoaded(Scene s) 106 public void RegionLoaded(Scene s)
122 { 107 {
108 GetGridExtraFeatures(s);
123 } 109 }
124 110
125 public void PostInitialise() 111 public void PostInitialise()
@@ -169,11 +155,11 @@ namespace OpenSim.Region.ClientStack.Linden
169 else 155 else
170 extrasMap = new OSDMap(); 156 extrasMap = new OSDMap();
171 157
172 if (m_SearchURL != string.Empty && m_AllowOverride == true) 158 if (m_SearchURL != string.Empty)
173 extrasMap["search-server-url"] = m_SearchURL; 159 extrasMap["search-server-url"] = m_SearchURL;
174 if (!string.IsNullOrEmpty(m_DestinationGuideURL) && m_AllowOverride == true) 160 if (!string.IsNullOrEmpty(m_DestinationGuideURL))
175 extrasMap["destination-guide-url"] = m_DestinationGuideURL; 161 extrasMap["destination-guide-url"] = m_DestinationGuideURL;
176 if (m_ExportSupported && m_AllowOverride == true) 162 if (m_ExportSupported)
177 extrasMap["ExportSupported"] = true; 163 extrasMap["ExportSupported"] = true;
178 164
179 if (extrasMap.Count > 0) 165 if (extrasMap.Count > 0)
@@ -233,9 +219,7 @@ namespace OpenSim.Region.ClientStack.Linden
233 219
234 SimulatorFeaturesRequestDelegate handlerOnSimulatorFeaturesRequest = OnSimulatorFeaturesRequest; 220 SimulatorFeaturesRequestDelegate handlerOnSimulatorFeaturesRequest = OnSimulatorFeaturesRequest;
235 221
236 // We will not trigger the event if m_AllowOverride == False 222 if (handlerOnSimulatorFeaturesRequest != null)
237 // See Robust.ini/Robust.HG.ini [GridExtraFeatures] - AllowRegionOverride
238 if (handlerOnSimulatorFeaturesRequest != null && m_AllowOverride == true)
239 handlerOnSimulatorFeaturesRequest(agentID, ref copy); 223 handlerOnSimulatorFeaturesRequest(agentID, ref copy);
240 224
241 //Send back data 225 //Send back data
@@ -255,32 +239,22 @@ namespace OpenSim.Region.ClientStack.Linden
255 /// <param name='featuresURI'> 239 /// <param name='featuresURI'>
256 /// The URI Robust uses to handle the get_extra_features request 240 /// The URI Robust uses to handle the get_extra_features request
257 /// </param> 241 /// </param>
258 private void GetGridExtraFeatures(string featuresURI) 242 private void GetGridExtraFeatures(Scene scene)
259 { 243 {
260 JsonRpcRequestManager rpc = new JsonRpcRequestManager (); 244 Dictionary<string, object> extraFeatures = scene.GridService.GetExtraFeatures();
261 245
262 OSDMap parameters = new OSDMap ();
263 OSD Params = (OSD)parameters;
264 if (!rpc.JsonRpcRequest (ref Params, "get_extra_features", featuresURI, UUID.Random ().ToString ()))
265 {
266 m_log.Error("[SIMFEATURES]: Could not retrieve extra features from grid. Please check configuration.");
267 return;
268 }
269 parameters = (OSDMap)Params;
270 OSDMap features = (OSDMap)parameters ["result"];
271
272 if(features.ContainsKey("region_override"))
273 m_AllowOverride = features ["region_override"].AsBoolean () ;
274 else
275 m_AllowOverride = true;
276
277 OSDMap test = (OSDMap)features ["extra_features"];
278 lock (m_features) 246 lock (m_features)
279 { 247 {
280 OSDMap extrasMap = new OSDMap(); 248 OSDMap extrasMap = new OSDMap();
281 foreach (string key in test.Keys) 249
250 foreach(string key in extraFeatures.Keys)
282 { 251 {
283 extrasMap[key] = test[key]; 252 extrasMap[key] = (string)extraFeatures[key];
253
254 if (key == "ExportSupported")
255 {
256 bool.TryParse(extraFeatures[key].ToString(), out m_ExportSupported);
257 }
284 } 258 }
285 m_features["OpenSimExtras"] = extrasMap; 259 m_features["OpenSimExtras"] = extrasMap;
286 } 260 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/LocalGridFeaturesServiceInConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/LocalGridFeaturesServiceInConnector.cs
deleted file mode 100644
index 6cfb099..0000000
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/LocalGridFeaturesServiceInConnector.cs
+++ /dev/null
@@ -1,129 +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 OpenSimulator 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.Reflection;
30using System.Collections.Generic;
31using log4net;
32using Mono.Addins;
33using Nini.Config;
34using OpenSim.Framework;
35using OpenSim.Framework.Servers;
36using OpenSim.Region.Framework.Scenes;
37using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Server.Base;
39using OpenSim.Server.Handlers.Base;
40using OpenSim.Server.Handlers.Grid;
41using OpenSim.Services.Interfaces;
42using OpenSim.Framework.Servers.HttpServer;
43
44namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid
45{
46 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalGridFeaturesServiceInConnector")]
47 public class LocalGridExtraFeaturesServiceInConnector : ISharedRegionModule
48 {
49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50 private static bool m_Enabled = false;
51
52 private IConfigSource m_Config;
53 bool m_Registered = false;
54
55 #region Region Module interface
56
57 public void Initialise(IConfigSource config)
58 {
59 m_Config = config;
60 IConfig moduleConfig = config.Configs["Modules"];
61 if (moduleConfig != null)
62 {
63 string name = moduleConfig.GetString("GridExtraFeaturesServiceInConnector", "");
64 if (name == Name)
65 {
66 m_log.Info("[GridExtraFeatures]: GridExtraFeatures Service In Connector enabled");
67 InitializeService(config);
68 }
69 }
70 }
71
72 public void InitializeService(IConfigSource config)
73 {
74 GridExtraFeaturesHandlers handler = new GridExtraFeaturesHandlers(config);
75
76 IHttpServer Server = MainServer.Instance;
77
78 Server.AddJsonRPCHandler("get_extra_features", handler.JsonGetGridFeaturesMethod);
79
80 }
81
82 public void PostInitialise()
83 {
84 }
85
86 public void Close()
87 {
88 }
89
90 public Type ReplaceableInterface
91 {
92 get { return null; }
93 }
94
95 public string Name
96 {
97 get { return "LocalGridExtraFeaturesServiceInConnector"; }
98 }
99
100 public void AddRegion(Scene scene)
101 {
102 if (!m_Enabled)
103 return;
104 }
105
106 public void RemoveRegion(Scene scene)
107 {
108 if (!m_Enabled)
109 return;
110 }
111
112 public void RegionLoaded(Scene scene)
113 {
114 if (!m_Enabled)
115 return;
116
117 if (!m_Registered)
118 {
119 m_Registered = true;
120
121 m_log.Info("[GRID EXTRA FEATURES]: Starting...");
122
123 new GridExtraFeaturesServerInConnector(m_Config, MainServer.Instance, "GridExtraFeaturesService");
124 }
125 }
126#endregion
127
128 }
129} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
index 731bd28..8e995db 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
@@ -278,6 +278,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
278 return m_GridService.GetRegionFlags(scopeID, regionID); 278 return m_GridService.GetRegionFlags(scopeID, regionID);
279 } 279 }
280 280
281 public Dictionary<string, object> GetExtraFeatures()
282 {
283 return m_GridService.GetExtraFeatures();
284 }
285
281 #endregion 286 #endregion
282 287
283 public void HandleShowNeighboursCommand(string module, string[] cmdparams) 288 public void HandleShowNeighboursCommand(string module, string[] cmdparams)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
index ae5081c..f0c4926 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
@@ -28,6 +28,7 @@
28using log4net; 28using log4net;
29using Mono.Addins; 29using Mono.Addins;
30using System; 30using System;
31using System.Collections;
31using System.Collections.Generic; 32using System.Collections.Generic;
32using System.Reflection; 33using System.Reflection;
33using Nini.Config; 34using Nini.Config;
@@ -349,6 +350,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
349 350
350 return flags; 351 return flags;
351 } 352 }
353
354 public Dictionary<string, object> GetExtraFeatures()
355 {
356 Dictionary<string, object> extraFeatures;
357 extraFeatures = m_LocalGridService.GetExtraFeatures();
358
359 if (extraFeatures.Count == 0)
360 extraFeatures = m_RemoteGridService.GetExtraFeatures();
361
362 return extraFeatures;
363 }
352 #endregion 364 #endregion
353 } 365 }
354} 366}
diff --git a/OpenSim/Server/Handlers/Grid/GridExtraFeaturesHandlers.cs b/OpenSim/Server/Handlers/Grid/GridExtraFeaturesHandlers.cs
deleted file mode 100644
index 6a62cfc..0000000
--- a/OpenSim/Server/Handlers/Grid/GridExtraFeaturesHandlers.cs
+++ /dev/null
@@ -1,127 +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 OpenSimulator 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.Security;
34using System.Text;
35using log4net;
36using Nini.Config;
37using Nwc.XmlRpc;
38using OpenSim.Framework;
39using OpenSim.Framework.Servers.HttpServer;
40using OpenMetaverse.StructuredData;
41
42
43namespace OpenSim.Server.Handlers.Grid
44{
45 /// <summary>
46 /// Grid extra features handlers.
47 /// <para>Allows grid level configuration of OpenSimExtra items.</para>
48 /// <para>Option to control region override of these settings.</para>
49 /// </summary>
50 public class GridExtraFeaturesHandlers
51 {
52 private static readonly ILog m_Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
53 private Hashtable m_ExtraFeatures = new Hashtable();
54 private bool m_AllowRegionOverride = true;
55
56 public GridExtraFeaturesHandlers(IConfigSource configSource)
57 {
58 try
59 {
60 IConfig featuresCfg = configSource.Configs["GridExtraFeatures"];
61
62 foreach( string key in featuresCfg.GetKeys())
63 {
64 if(key != "AllowRegionOverride")
65 {
66 string value = featuresCfg.GetString(key);
67
68 // map the value to the viewer supported extra features
69 // add additional ones here as support is added in the viewer
70 // and place the configuration option in [GridExtraFeatures].
71 switch(key)
72 {
73 case "SearchServerURI":
74 m_ExtraFeatures["search-server-url"] = value;
75 break;
76 case "MapImageServerURI":
77 m_ExtraFeatures["map-server-url"] = value;
78 break;
79 case "DestinationGuideURI":
80 m_ExtraFeatures["destination-guide-url"] = value;
81 break;
82 case "ExportSupported":
83 m_ExtraFeatures["ExportSupported"] = value;
84 break;
85 case "WhisperDistance":
86 m_ExtraFeatures["whisper-range"] = value;
87 break;
88 case "SayDistance":
89 m_ExtraFeatures["say-range"] = value;
90 break;
91 case "ShoutDistance":
92 m_ExtraFeatures["shout-range"] = value;
93 break;
94 default:
95 m_Log.InfoFormat("{0} not yet supported.");
96 break;
97 }
98 }
99 else
100 m_AllowRegionOverride = featuresCfg.GetBoolean(key);
101 }
102 }
103 catch (Exception)
104 {
105 m_Log.Warn("[GRID EXTRA FEATURES SERVICE]: Cannot get grid features from config source, allowing region override");
106 }
107 }
108
109 public bool JsonGetGridFeaturesMethod(OSDMap json, ref JsonRpcResponse response)
110 {
111 OSDMap features = new OSDMap();
112 OSDMap json_map = new OSDMap();
113
114 foreach (string key in m_ExtraFeatures.Keys)
115 {
116 features[key] = OSD.FromString(m_ExtraFeatures[key].ToString());
117 }
118
119 json_map["extra_features"] = features;
120 json_map["region_override"] = m_AllowRegionOverride.ToString();
121
122 response.Result = json_map;
123
124 return true;
125 }
126 }
127} \ No newline at end of file
diff --git a/OpenSim/Server/Handlers/Grid/GridExtraFeaturesServerInConnector.cs b/OpenSim/Server/Handlers/Grid/GridExtraFeaturesServerInConnector.cs
deleted file mode 100644
index f57a4b3..0000000
--- a/OpenSim/Server/Handlers/Grid/GridExtraFeaturesServerInConnector.cs
+++ /dev/null
@@ -1,50 +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 OpenSimulator 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.Generic;
30using System.Reflection;
31using log4net;
32using OpenMetaverse;
33using Nini.Config;
34using OpenSim.Framework;
35using OpenSim.Framework.Servers.HttpServer;
36using OpenSim.Server.Handlers.Base;
37
38namespace OpenSim.Server.Handlers.Grid
39{
40 public class GridExtraFeaturesServerInConnector : ServiceConnector
41 {
42 public GridExtraFeaturesServerInConnector(IConfigSource config, IHttpServer server, string configName) :
43 base(config, server, configName)
44 {
45 GridExtraFeaturesHandlers handler = new GridExtraFeaturesHandlers(config);
46
47 server.AddJsonRPCHandler("get_extra_features", handler.JsonGetGridFeaturesMethod);
48 }
49 }
50}
diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
index d5a9d67..849fa94 100644
--- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
@@ -122,6 +122,9 @@ namespace OpenSim.Server.Handlers.Grid
122 122
123 case "get_region_flags": 123 case "get_region_flags":
124 return GetRegionFlags(request); 124 return GetRegionFlags(request);
125
126 case "get_grid_extra_features":
127 return GetGridExtraFeatures(request);
125 } 128 }
126 129
127 m_log.DebugFormat("[GRID HANDLER]: unknown method request {0}", method); 130 m_log.DebugFormat("[GRID HANDLER]: unknown method request {0}", method);
@@ -578,6 +581,22 @@ namespace OpenSim.Server.Handlers.Grid
578 //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); 581 //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
579 return Util.UTF8NoBomEncoding.GetBytes(xmlString); 582 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
580 } 583 }
584
585 byte[] GetGridExtraFeatures(Dictionary<string, object> request)
586 {
587
588 Dictionary<string, object> result = new Dictionary<string, object> ();
589 Dictionary<string, object> extraFeatures = m_GridService.GetExtraFeatures ();
590
591 foreach (string key in extraFeatures.Keys)
592 {
593 result [key] = extraFeatures [key];
594 }
595
596 string xmlString = ServerUtils.BuildXmlResponse(result);
597
598 return Util.UTF8NoBomEncoding.GetBytes(xmlString);
599 }
581 600
582 #endregion 601 #endregion
583 602
diff --git a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs
index 7f86cff..9e55356 100644
--- a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs
@@ -719,6 +719,45 @@ namespace OpenSim.Services.Connectors
719 return flags; 719 return flags;
720 } 720 }
721 721
722 public Dictionary<string, object> GetExtraFeatures()
723 {
724 Dictionary<string, object> sendData = new Dictionary<string, object>();
725 Dictionary<string, object> extraFeatures = new Dictionary<string, object>();
726
727 sendData["METHOD"] = "get_grid_extra_features";
728
729 string reply = string.Empty;
730 string uri = m_ServerURI + "/grid";
731
732 try
733 {
734 reply = SynchronousRestFormsRequester.MakeRequest("POST",
735 uri,
736 ServerUtils.BuildQueryString(sendData), m_Auth);
737 }
738 catch (Exception e)
739 {
740 m_log.DebugFormat("[GRID CONNECTOR]: GetExtraFeatures - Exception when contacting grid server at {0}: {1}", uri, e.Message);
741 return extraFeatures;
742 }
743
744 if (reply != string.Empty)
745 {
746 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
747
748 if ((replyData != null) && replyData.Count > 0)
749 {
750 foreach (string key in replyData.Keys)
751 {
752 extraFeatures[key] = replyData[key].ToString();
753 }
754 }
755 }
756 else
757 m_log.DebugFormat("[GRID CONNECTOR]: GetExtraServiceURLs received null reply");
758
759 return extraFeatures;
760 }
722 #endregion 761 #endregion
723 762
724 } 763 }
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
index 6b59f94..b031f21 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
@@ -402,6 +402,13 @@ namespace OpenSim.Services.Connectors.SimianGrid
402 return -1; 402 return -1;
403 } 403 }
404 } 404 }
405
406 public Dictionary<string, object> GetExtraFeatures()
407 {
408 /// See SimulatorFeaturesModule - Need to get map, search and destination guide
409 Dictionary<string, object> extraFeatures = new Dictionary<string, object>();
410 return extraFeatures;
411 }
405 412
406 #endregion IGridService 413 #endregion IGridService
407 414
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index 013cc53..e8a545c 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -59,6 +59,8 @@ namespace OpenSim.Services.GridService
59 59
60 protected bool m_SuppressVarregionOverlapCheckOnRegistration = false; 60 protected bool m_SuppressVarregionOverlapCheckOnRegistration = false;
61 61
62 private static Dictionary<string,object> m_ExtraFeatures = new Dictionary<string, object>();
63
62 public GridService(IConfigSource config) 64 public GridService(IConfigSource config)
63 : base(config) 65 : base(config)
64 { 66 {
@@ -139,10 +141,38 @@ namespace OpenSim.Services.GridService
139 HandleSetFlags); 141 HandleSetFlags);
140 } 142 }
141 143
144 if (!suppressConsoleCommands)
145 SetExtraServiceURLs(config);
146
142 m_HypergridLinker = new HypergridLinker(m_config, this, m_Database); 147 m_HypergridLinker = new HypergridLinker(m_config, this, m_Database);
143 } 148 }
144 } 149 }
145 150
151 private void SetExtraServiceURLs(IConfigSource config)
152 {
153 IConfig loginConfig = config.Configs["LoginService"];
154 IConfig gridConfig = config.Configs["GridService"];
155
156 if (loginConfig == null || gridConfig == null)
157 return;
158
159 string configVal;
160
161 configVal = loginConfig.GetString("SearchURL", string.Empty);
162 if (!string.IsNullOrEmpty(configVal))
163 m_ExtraFeatures["search-server-url"] = configVal;
164
165 configVal = loginConfig.GetString("MapTileURL", string.Empty);
166 if (!string.IsNullOrEmpty(configVal))
167 m_ExtraFeatures["map-server-url"] = configVal;
168
169 configVal = loginConfig.GetString("DestinationGuide", string.Empty);
170 if (!string.IsNullOrEmpty(configVal))
171 m_ExtraFeatures["destination-guide-url"] = configVal;
172
173 m_ExtraFeatures["ExportSupported"] = gridConfig.GetString("ExportSupported", "true");
174 }
175
146 #region IGridService 176 #region IGridService
147 177
148 public string RegisterRegion(UUID scopeID, GridRegion regionInfos) 178 public string RegisterRegion(UUID scopeID, GridRegion regionInfos)
@@ -928,5 +958,18 @@ namespace OpenSim.Services.GridService
928 m_Database.Store(r); 958 m_Database.Store(r);
929 } 959 }
930 } 960 }
961
962 /// <summary>
963 /// Gets the grid extra service URls we wish for the region to send in OpenSimExtras to dynamically refresh
964 /// parameters in the viewer used to access services like map, search and destination guides.
965 /// <para>see "SimulatorFeaturesModule" </para>
966 /// </summary>
967 /// <returns>
968 /// The grid extra service URls.
969 /// </returns>
970 public Dictionary<string,object> GetExtraFeatures()
971 {
972 return m_ExtraFeatures;
973 }
931 } 974 }
932} 975}
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs
index b7bcd6b..c45ea76 100644
--- a/OpenSim/Services/Interfaces/IGridService.cs
+++ b/OpenSim/Services/Interfaces/IGridService.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections;
29using System.Collections.Generic; 30using System.Collections.Generic;
30using System.Net; 31using System.Net;
31using System.Net.Sockets; 32using System.Net.Sockets;
@@ -119,6 +120,8 @@ namespace OpenSim.Services.Interfaces
119 /// <param name='scopeID'></param> 120 /// <param name='scopeID'></param>
120 /// <param name='regionID'></param> 121 /// <param name='regionID'></param>
121 int GetRegionFlags(UUID scopeID, UUID regionID); 122 int GetRegionFlags(UUID scopeID, UUID regionID);
123
124 Dictionary<string,object> GetExtraFeatures();
122 } 125 }
123 126
124 public class GridRegion 127 public class GridRegion