diff options
author | BlueWall | 2014-08-03 20:33:40 -0400 |
---|---|---|
committer | BlueWall | 2014-08-06 17:25:12 -0400 |
commit | 10a8d2852e529fddb029ae333a3ae6a0f06f0182 (patch) | |
tree | 53806e78ef6ef300a039ceebeea8ffa40838dd98 /OpenSim/Region | |
parent | Fixed crash when using Allowed/Denied Viewers, and the viewer's name is short... (diff) | |
download | opensim-SC-10a8d2852e529fddb029ae333a3ae6a0f06f0182.zip opensim-SC-10a8d2852e529fddb029ae333a3ae6a0f06f0182.tar.gz opensim-SC-10a8d2852e529fddb029ae333a3ae6a0f06f0182.tar.bz2 opensim-SC-10a8d2852e529fddb029ae333a3ae6a0f06f0182.tar.xz |
OpenSimExtras
Move the experimental extra features functionality into the GridService. This sends default values for map, search and destination guide, plus ExportSupported control to the region on startup. Please watch http://opensimulator.org/wiki/SimulatorFeatures_Extras for changes and documentation.
Diffstat (limited to 'OpenSim/Region')
4 files changed, 41 insertions, 179 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 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | ||
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | using log4net; | 32 | using log4net; |
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using Mono.Addins; | 34 | using Mono.Addins; |
34 | using OpenMetaverse; | 35 | using OpenMetaverse; |
35 | using OpenMetaverse.StructuredData; | 36 | using OpenMetaverse.StructuredData; |
36 | using OpenSim.Framework; | 37 | //using OpenSim.Framework; |
37 | using OpenSim.Framework.Servers.HttpServer; | 38 | using OpenSim.Framework.Servers.HttpServer; |
38 | using OpenSim.Region.Framework.Interfaces; | 39 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
40 | using OpenSim.Services.Interfaces; | 41 | // using OpenSim.Services.Interfaces; |
41 | using Caps = OpenSim.Framework.Capabilities.Caps; | 42 | using Caps = OpenSim.Framework.Capabilities.Caps; |
42 | 43 | ||
43 | namespace OpenSim.Region.ClientStack.Linden | 44 | namespace 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 | |||
28 | using System; | ||
29 | using System.Reflection; | ||
30 | using System.Collections.Generic; | ||
31 | using log4net; | ||
32 | using Mono.Addins; | ||
33 | using Nini.Config; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Framework.Servers; | ||
36 | using OpenSim.Region.Framework.Scenes; | ||
37 | using OpenSim.Region.Framework.Interfaces; | ||
38 | using OpenSim.Server.Base; | ||
39 | using OpenSim.Server.Handlers.Base; | ||
40 | using OpenSim.Server.Handlers.Grid; | ||
41 | using OpenSim.Services.Interfaces; | ||
42 | using OpenSim.Framework.Servers.HttpServer; | ||
43 | |||
44 | namespace 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 @@ | |||
28 | using log4net; | 28 | using log4net; |
29 | using Mono.Addins; | 29 | using Mono.Addins; |
30 | using System; | 30 | using System; |
31 | using System.Collections; | ||
31 | using System.Collections.Generic; | 32 | using System.Collections.Generic; |
32 | using System.Reflection; | 33 | using System.Reflection; |
33 | using Nini.Config; | 34 | using 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 | } |