From 10a8d2852e529fddb029ae333a3ae6a0f06f0182 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Sun, 3 Aug 2014 20:33:40 -0400 Subject: [PATCH] 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. --- .../Linden/Caps/SimulatorFeaturesModule.cs | 74 ++++------ .../LocalGridFeaturesServiceInConnector.cs | 129 ------------------ .../Grid/LocalGridServiceConnector.cs | 5 + .../Grid/RemoteGridServiceConnector.cs | 12 ++ .../Grid/GridExtraFeaturesHandlers.cs | 127 ----------------- .../GridExtraFeaturesServerInConnector.cs | 50 ------- .../Handlers/Grid/GridServerPostHandler.cs | 19 +++ .../Connectors/Grid/GridServicesConnector.cs | 39 ++++++ .../SimianGrid/SimianGridServiceConnector.cs | 7 + OpenSim/Services/GridService/GridService.cs | 43 ++++++ OpenSim/Services/Interfaces/IGridService.cs | 3 + bin/OpenSim.ini.example | 21 ++- bin/Robust.HG.ini.example | 40 +----- bin/Robust.ini.example | 40 +----- .../StandaloneCommon.ini.example | 7 + 15 files changed, 182 insertions(+), 434 deletions(-) delete mode 100644 OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/LocalGridFeaturesServiceInConnector.cs delete mode 100644 OpenSim/Server/Handlers/Grid/GridExtraFeaturesHandlers.cs delete mode 100644 OpenSim/Server/Handlers/Grid/GridExtraFeaturesServerInConnector.cs diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs index 9f1eb88885..1345bffbf4 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs @@ -27,17 +27,18 @@ using System; using System.Collections; +using System.Collections.Generic; using System.Reflection; using log4net; using Nini.Config; using Mono.Addins; using OpenMetaverse; using OpenMetaverse.StructuredData; -using OpenSim.Framework; +//using OpenSim.Framework; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Services.Interfaces; +// using OpenSim.Services.Interfaces; using Caps = OpenSim.Framework.Capabilities.Caps; namespace OpenSim.Region.ClientStack.Linden @@ -63,8 +64,6 @@ namespace OpenSim.Region.ClientStack.Linden private Scene m_scene; - bool m_AllowOverride = true; - /// /// Simulator features /// @@ -81,25 +80,11 @@ namespace OpenSim.Region.ClientStack.Linden IConfig config = source.Configs["SimulatorFeatures"]; if (config != null) - { - string featuresURI = config.GetString("ExtraFeaturesServiceURI", string.Empty); - - if (string.IsNullOrEmpty(featuresURI)) - { - m_log.Info("ExtraFeaturesServiceURI is undefined. The grid's ExtraFeatures will not be available to regions in this instance."); - } - else - { - GetGridExtraFeatures(featuresURI); - } - - if (m_AllowOverride) - { - m_SearchURL = config.GetString("SearchServerURI", m_SearchURL); - m_DestinationGuideURL = config.GetString ("DestinationGuideURI", m_DestinationGuideURL); - - m_ExportSupported = config.GetBoolean("ExportSupported", m_ExportSupported); - } + { + // These are normaly set in their respective modules + m_SearchURL = config.GetString("SearchServerURI", m_SearchURL); + m_DestinationGuideURL = config.GetString ("DestinationGuideURI", m_DestinationGuideURL); + m_ExportSupported = config.GetBoolean("ExportSupported", m_ExportSupported); } AddDefaultFeatures(); @@ -120,6 +105,7 @@ namespace OpenSim.Region.ClientStack.Linden public void RegionLoaded(Scene s) { + GetGridExtraFeatures(s); } public void PostInitialise() @@ -169,11 +155,11 @@ namespace OpenSim.Region.ClientStack.Linden else extrasMap = new OSDMap(); - if (m_SearchURL != string.Empty && m_AllowOverride == true) + if (m_SearchURL != string.Empty) extrasMap["search-server-url"] = m_SearchURL; - if (!string.IsNullOrEmpty(m_DestinationGuideURL) && m_AllowOverride == true) + if (!string.IsNullOrEmpty(m_DestinationGuideURL)) extrasMap["destination-guide-url"] = m_DestinationGuideURL; - if (m_ExportSupported && m_AllowOverride == true) + if (m_ExportSupported) extrasMap["ExportSupported"] = true; if (extrasMap.Count > 0) @@ -233,9 +219,7 @@ namespace OpenSim.Region.ClientStack.Linden SimulatorFeaturesRequestDelegate handlerOnSimulatorFeaturesRequest = OnSimulatorFeaturesRequest; - // We will not trigger the event if m_AllowOverride == False - // See Robust.ini/Robust.HG.ini [GridExtraFeatures] - AllowRegionOverride - if (handlerOnSimulatorFeaturesRequest != null && m_AllowOverride == true) + if (handlerOnSimulatorFeaturesRequest != null) handlerOnSimulatorFeaturesRequest(agentID, ref copy); //Send back data @@ -255,32 +239,22 @@ namespace OpenSim.Region.ClientStack.Linden /// /// The URI Robust uses to handle the get_extra_features request /// - private void GetGridExtraFeatures(string featuresURI) + private void GetGridExtraFeatures(Scene scene) { - JsonRpcRequestManager rpc = new JsonRpcRequestManager (); - - OSDMap parameters = new OSDMap (); - OSD Params = (OSD)parameters; - if (!rpc.JsonRpcRequest (ref Params, "get_extra_features", featuresURI, UUID.Random ().ToString ())) - { - m_log.Error("[SIMFEATURES]: Could not retrieve extra features from grid. Please check configuration."); - return; - } - parameters = (OSDMap)Params; - OSDMap features = (OSDMap)parameters ["result"]; - - if(features.ContainsKey("region_override")) - m_AllowOverride = features ["region_override"].AsBoolean () ; - else - m_AllowOverride = true; - - OSDMap test = (OSDMap)features ["extra_features"]; + Dictionary extraFeatures = scene.GridService.GetExtraFeatures(); + lock (m_features) { OSDMap extrasMap = new OSDMap(); - foreach (string key in test.Keys) + + foreach(string key in extraFeatures.Keys) { - extrasMap[key] = test[key]; + extrasMap[key] = (string)extraFeatures[key]; + + if (key == "ExportSupported") + { + bool.TryParse(extraFeatures[key].ToString(), out m_ExportSupported); + } } m_features["OpenSimExtras"] = extrasMap; } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/LocalGridFeaturesServiceInConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/LocalGridFeaturesServiceInConnector.cs deleted file mode 100644 index 6cfb099e83..0000000000 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/LocalGridFeaturesServiceInConnector.cs +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Reflection; -using System.Collections.Generic; -using log4net; -using Mono.Addins; -using Nini.Config; -using OpenSim.Framework; -using OpenSim.Framework.Servers; -using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Server.Base; -using OpenSim.Server.Handlers.Base; -using OpenSim.Server.Handlers.Grid; -using OpenSim.Services.Interfaces; -using OpenSim.Framework.Servers.HttpServer; - -namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid -{ - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalGridFeaturesServiceInConnector")] - public class LocalGridExtraFeaturesServiceInConnector : ISharedRegionModule - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private static bool m_Enabled = false; - - private IConfigSource m_Config; - bool m_Registered = false; - - #region Region Module interface - - public void Initialise(IConfigSource config) - { - m_Config = config; - IConfig moduleConfig = config.Configs["Modules"]; - if (moduleConfig != null) - { - string name = moduleConfig.GetString("GridExtraFeaturesServiceInConnector", ""); - if (name == Name) - { - m_log.Info("[GridExtraFeatures]: GridExtraFeatures Service In Connector enabled"); - InitializeService(config); - } - } - } - - public void InitializeService(IConfigSource config) - { - GridExtraFeaturesHandlers handler = new GridExtraFeaturesHandlers(config); - - IHttpServer Server = MainServer.Instance; - - Server.AddJsonRPCHandler("get_extra_features", handler.JsonGetGridFeaturesMethod); - - } - - public void PostInitialise() - { - } - - public void Close() - { - } - - public Type ReplaceableInterface - { - get { return null; } - } - - public string Name - { - get { return "LocalGridExtraFeaturesServiceInConnector"; } - } - - public void AddRegion(Scene scene) - { - if (!m_Enabled) - return; - } - - public void RemoveRegion(Scene scene) - { - if (!m_Enabled) - return; - } - - public void RegionLoaded(Scene scene) - { - if (!m_Enabled) - return; - - if (!m_Registered) - { - m_Registered = true; - - m_log.Info("[GRID EXTRA FEATURES]: Starting..."); - - new GridExtraFeaturesServerInConnector(m_Config, MainServer.Instance, "GridExtraFeaturesService"); - } - } -#endregion - - } -} \ 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 731bd2858f..8e995db9bf 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 return m_GridService.GetRegionFlags(scopeID, regionID); } + public Dictionary GetExtraFeatures() + { + return m_GridService.GetExtraFeatures(); + } + #endregion 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 ae5081cde4..f0c4926337 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs @@ -28,6 +28,7 @@ using log4net; using Mono.Addins; using System; +using System.Collections; using System.Collections.Generic; using System.Reflection; using Nini.Config; @@ -349,6 +350,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid return flags; } + + public Dictionary GetExtraFeatures() + { + Dictionary extraFeatures; + extraFeatures = m_LocalGridService.GetExtraFeatures(); + + if (extraFeatures.Count == 0) + extraFeatures = m_RemoteGridService.GetExtraFeatures(); + + return extraFeatures; + } #endregion } } diff --git a/OpenSim/Server/Handlers/Grid/GridExtraFeaturesHandlers.cs b/OpenSim/Server/Handlers/Grid/GridExtraFeaturesHandlers.cs deleted file mode 100644 index 6a62cfc279..0000000000 --- a/OpenSim/Server/Handlers/Grid/GridExtraFeaturesHandlers.cs +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections; -using System.IO; -using System.Net; -using System.Reflection; -using System.Security; -using System.Text; -using log4net; -using Nini.Config; -using Nwc.XmlRpc; -using OpenSim.Framework; -using OpenSim.Framework.Servers.HttpServer; -using OpenMetaverse.StructuredData; - - -namespace OpenSim.Server.Handlers.Grid -{ - /// - /// Grid extra features handlers. - /// Allows grid level configuration of OpenSimExtra items. - /// Option to control region override of these settings. - /// - public class GridExtraFeaturesHandlers - { - private static readonly ILog m_Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private Hashtable m_ExtraFeatures = new Hashtable(); - private bool m_AllowRegionOverride = true; - - public GridExtraFeaturesHandlers(IConfigSource configSource) - { - try - { - IConfig featuresCfg = configSource.Configs["GridExtraFeatures"]; - - foreach( string key in featuresCfg.GetKeys()) - { - if(key != "AllowRegionOverride") - { - string value = featuresCfg.GetString(key); - - // map the value to the viewer supported extra features - // add additional ones here as support is added in the viewer - // and place the configuration option in [GridExtraFeatures]. - switch(key) - { - case "SearchServerURI": - m_ExtraFeatures["search-server-url"] = value; - break; - case "MapImageServerURI": - m_ExtraFeatures["map-server-url"] = value; - break; - case "DestinationGuideURI": - m_ExtraFeatures["destination-guide-url"] = value; - break; - case "ExportSupported": - m_ExtraFeatures["ExportSupported"] = value; - break; - case "WhisperDistance": - m_ExtraFeatures["whisper-range"] = value; - break; - case "SayDistance": - m_ExtraFeatures["say-range"] = value; - break; - case "ShoutDistance": - m_ExtraFeatures["shout-range"] = value; - break; - default: - m_Log.InfoFormat("{0} not yet supported."); - break; - } - } - else - m_AllowRegionOverride = featuresCfg.GetBoolean(key); - } - } - catch (Exception) - { - m_Log.Warn("[GRID EXTRA FEATURES SERVICE]: Cannot get grid features from config source, allowing region override"); - } - } - - public bool JsonGetGridFeaturesMethod(OSDMap json, ref JsonRpcResponse response) - { - OSDMap features = new OSDMap(); - OSDMap json_map = new OSDMap(); - - foreach (string key in m_ExtraFeatures.Keys) - { - features[key] = OSD.FromString(m_ExtraFeatures[key].ToString()); - } - - json_map["extra_features"] = features; - json_map["region_override"] = m_AllowRegionOverride.ToString(); - - response.Result = json_map; - - return true; - } - } -} \ 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 f57a4b39a7..0000000000 --- a/OpenSim/Server/Handlers/Grid/GridExtraFeaturesServerInConnector.cs +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Reflection; -using log4net; -using OpenMetaverse; -using Nini.Config; -using OpenSim.Framework; -using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Server.Handlers.Base; - -namespace OpenSim.Server.Handlers.Grid -{ - public class GridExtraFeaturesServerInConnector : ServiceConnector - { - public GridExtraFeaturesServerInConnector(IConfigSource config, IHttpServer server, string configName) : - base(config, server, configName) - { - GridExtraFeaturesHandlers handler = new GridExtraFeaturesHandlers(config); - - server.AddJsonRPCHandler("get_extra_features", handler.JsonGetGridFeaturesMethod); - } - } -} diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index d5a9d67d1e..849fa94030 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs @@ -122,6 +122,9 @@ namespace OpenSim.Server.Handlers.Grid case "get_region_flags": return GetRegionFlags(request); + + case "get_grid_extra_features": + return GetGridExtraFeatures(request); } m_log.DebugFormat("[GRID HANDLER]: unknown method request {0}", method); @@ -578,6 +581,22 @@ namespace OpenSim.Server.Handlers.Grid //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); return Util.UTF8NoBomEncoding.GetBytes(xmlString); } + + byte[] GetGridExtraFeatures(Dictionary request) + { + + Dictionary result = new Dictionary (); + Dictionary extraFeatures = m_GridService.GetExtraFeatures (); + + foreach (string key in extraFeatures.Keys) + { + result [key] = extraFeatures [key]; + } + + string xmlString = ServerUtils.BuildXmlResponse(result); + + return Util.UTF8NoBomEncoding.GetBytes(xmlString); + } #endregion diff --git a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs index 7f86cffc5d..9e553568bd 100644 --- a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs @@ -719,6 +719,45 @@ namespace OpenSim.Services.Connectors return flags; } + public Dictionary GetExtraFeatures() + { + Dictionary sendData = new Dictionary(); + Dictionary extraFeatures = new Dictionary(); + + sendData["METHOD"] = "get_grid_extra_features"; + + string reply = string.Empty; + string uri = m_ServerURI + "/grid"; + + try + { + reply = SynchronousRestFormsRequester.MakeRequest("POST", + uri, + ServerUtils.BuildQueryString(sendData), m_Auth); + } + catch (Exception e) + { + m_log.DebugFormat("[GRID CONNECTOR]: GetExtraFeatures - Exception when contacting grid server at {0}: {1}", uri, e.Message); + return extraFeatures; + } + + if (reply != string.Empty) + { + Dictionary replyData = ServerUtils.ParseXmlResponse(reply); + + if ((replyData != null) && replyData.Count > 0) + { + foreach (string key in replyData.Keys) + { + extraFeatures[key] = replyData[key].ToString(); + } + } + } + else + m_log.DebugFormat("[GRID CONNECTOR]: GetExtraServiceURLs received null reply"); + + return extraFeatures; + } #endregion } diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 6b59f948e0..b031f217f3 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs @@ -402,6 +402,13 @@ namespace OpenSim.Services.Connectors.SimianGrid return -1; } } + + public Dictionary GetExtraFeatures() + { + /// See SimulatorFeaturesModule - Need to get map, search and destination guide + Dictionary extraFeatures = new Dictionary(); + return extraFeatures; + } #endregion IGridService diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 013cc53866..e8a545cf10 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -59,6 +59,8 @@ namespace OpenSim.Services.GridService protected bool m_SuppressVarregionOverlapCheckOnRegistration = false; + private static Dictionary m_ExtraFeatures = new Dictionary(); + public GridService(IConfigSource config) : base(config) { @@ -139,10 +141,38 @@ namespace OpenSim.Services.GridService HandleSetFlags); } + if (!suppressConsoleCommands) + SetExtraServiceURLs(config); + m_HypergridLinker = new HypergridLinker(m_config, this, m_Database); } } + private void SetExtraServiceURLs(IConfigSource config) + { + IConfig loginConfig = config.Configs["LoginService"]; + IConfig gridConfig = config.Configs["GridService"]; + + if (loginConfig == null || gridConfig == null) + return; + + string configVal; + + configVal = loginConfig.GetString("SearchURL", string.Empty); + if (!string.IsNullOrEmpty(configVal)) + m_ExtraFeatures["search-server-url"] = configVal; + + configVal = loginConfig.GetString("MapTileURL", string.Empty); + if (!string.IsNullOrEmpty(configVal)) + m_ExtraFeatures["map-server-url"] = configVal; + + configVal = loginConfig.GetString("DestinationGuide", string.Empty); + if (!string.IsNullOrEmpty(configVal)) + m_ExtraFeatures["destination-guide-url"] = configVal; + + m_ExtraFeatures["ExportSupported"] = gridConfig.GetString("ExportSupported", "true"); + } + #region IGridService public string RegisterRegion(UUID scopeID, GridRegion regionInfos) @@ -928,5 +958,18 @@ namespace OpenSim.Services.GridService m_Database.Store(r); } } + + /// + /// Gets the grid extra service URls we wish for the region to send in OpenSimExtras to dynamically refresh + /// parameters in the viewer used to access services like map, search and destination guides. + /// see "SimulatorFeaturesModule" + /// + /// + /// The grid extra service URls. + /// + public Dictionary GetExtraFeatures() + { + return m_ExtraFeatures; + } } } diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index b7bcd6bd51..c45ea76e2e 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -26,6 +26,7 @@ */ using System; +using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.Sockets; @@ -119,6 +120,8 @@ namespace OpenSim.Services.Interfaces /// /// int GetRegionFlags(UUID scopeID, UUID regionID); + + Dictionary GetExtraFeatures(); } public class GridRegion diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index f0e1a8a668..8c1a2c6673 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -538,21 +538,18 @@ [SimulatorFeatures] - ;# {ExtraFeaturesServiceURI} {} {URL to the grid ExtraFeatures Service} {} - ;; The grid can supply global values for extra simulator features to be - ;; passed to supporting viewers. The grid may choose to disallow local - ;; settings. - ; ExtraFeaturesServiceURI = "http://127.0.0.1:9000/" - ;# {MapImageServerURI} {} {URL for the map server} {} - ; Experimental new information sent in SimulatorFeatures cap for Kokua - ; viewers - ; meant to override the MapImage and search server url given at login, and varying - ; on a sim-basis. - ; Viewers that don't understand it, will ignore it - ;MapImageServerURI = "http://127.0.0.1:9000/" + ;# {SearchServerURI} {} {URL of the search server} {} + ;; This is identical to the Robust LoginService SearchURL setting + ;; and will override that value if set here. The Robust setting + ;; provides a working default for the grid and setting here is + ;; optional. ;SearchServerURI = "http://127.0.0.1:9000/" ;# {DestinationGuideURI} {} {URL of the destination guide} {} + ;; + ;; This serves the same purpose as the DestinationGuideURI in the + ;; LoginService setting in the Robust server. This will override + ;; the Robust setting if desired as an option. ;DestinationGuideURI = "http://127.0.0.1:9000/" diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index 2319117bae..fb6531e82b 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example @@ -45,7 +45,6 @@ InventoryInConnector = "8003/OpenSim.Server.Handlers.dll:XInventoryInConnector" ;VoiceConnector = "8004/OpenSim.Server.Handlers.dll:FreeswitchServerConnector" GridServiceConnector = "8003/OpenSim.Server.Handlers.dll:GridServiceConnector" GridInfoServerInConnector = "8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector" -GridExtraFeaturesServerInConnector = "8002/OpenSim.Server.Handlers.dll:GridExtraFeaturesServerInConnector" AuthenticationServiceConnector = "8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector" OpenIdServerConnector = "8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector" AvatarServiceConnector = "8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector" @@ -217,6 +216,10 @@ HGAssetServiceConnector = "HGAssetService@8002/OpenSim.Server.Handlers.dll:Asset ;; Allow Hyperlinks to be created at the console HypergridLinker = true + ;; Allow supporting viewers to export content + ;; Set to false to prevent export + ExportSupported = true + ;; If you have this set under [Hypergrid], no need to set it here, leave it commented ; GatekeeperURI = "http://127.0.0.1:8002" @@ -366,6 +369,9 @@ HGAssetServiceConnector = "HGAssetService@8002/OpenSim.Server.Handlers.dll:Asset ; For V2 map MapTileURL = "http://127.0.0.1:8002"; + ; Url to search service + ; SearchURL = "http://127.0.0.1:8002"; + ; For V2/3 Web Profiles ; Work in progress: The ProfileServerURL/OpenIDServerURL are ; being used in a development viewer as support for webprofiles @@ -485,38 +491,6 @@ HGAssetServiceConnector = "HGAssetService@8002/OpenSim.Server.Handlers.dll:Asset ; this is the entry point for all user-related HG services ; uas = http://127.0.0.1:8002/ - -[GridExtraFeatures] - ; These are propagated out to the regions as default settings for the - ; SimulatorFeatures to be sent to user's viewer when they teleport via - ; Hypergrid into this grid. - ; - - ; Allow regions to override our defaults. - ;AllowRegionOverride = true - - ; Search Server URI - ;SearchServerURI = "http://example.com:8200/" - - ; Map Server URI - ;MapImageServerURI = "http://example.com:8200/" - - ; Grid Destination Guide URI - ;DestinationGuideURI = "http://example.com:8200/" - - ; Chat Whisper Distance - ;WhisperDistance = 10 - - ; Chat Say Distance - ;SayDistance = 20 - - ; Chat Shout Distance - ;ShoutDistance = 100 - - ; Grid Allow Export - ;ExportSupported = true - - [GatekeeperService] LocalServiceModule = "OpenSim.Services.HypergridService.dll:GatekeeperService" ;; for the service diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example index 99a932d405..17c3dcd611 100644 --- a/bin/Robust.ini.example +++ b/bin/Robust.ini.example @@ -36,7 +36,6 @@ InventoryInConnector = "8003/OpenSim.Server.Handlers.dll:XInventoryInConnector" ;VoiceConnector = "8004/OpenSim.Server.Handlers.dll:FreeswitchServerConnector" GridServiceConnector = "8003/OpenSim.Server.Handlers.dll:GridServiceConnector" GridInfoServerInConnector = "8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector" -GridExtraFeaturesServerInConnector = "8002/OpenSim.Server.Handlers.dll:GridExtraFeaturesServerInConnector" AuthenticationServiceConnector = "8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector" OpenIdServerConnector = "8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector" AvatarServiceConnector = "8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector" @@ -178,6 +177,10 @@ MapGetServiceConnector = "8002/OpenSim.Server.Handlers.dll:MapGetServiceConnecto ; Region_Welcome_Area = "DefaultRegion, FallbackRegion" ; (replace spaces with underscore) + ;; Allow supporting viewers to export content + ;; Set to false to prevent export + ExportSupported = true + ; * This is the configuration for the freeswitch server in grid mode [FreeswitchService] LocalServiceModule = "OpenSim.Services.FreeswitchService.dll:FreeswitchService" @@ -325,6 +328,9 @@ MapGetServiceConnector = "8002/OpenSim.Server.Handlers.dll:MapGetServiceConnecto ; For V2 map MapTileURL = "http://127.0.0.1:8002"; + ; Url to search service + ; SearchURL = "http://127.0.0.1:8002"; + ; For V2/3 Web Profiles ; Work in progress: The ProfileServerURL/OpenIDServerURL are ; being used in a development viewer as support for webprofiles @@ -457,38 +463,6 @@ MapGetServiceConnector = "8002/OpenSim.Server.Handlers.dll:MapGetServiceConnecto ; password help: optional: page providing password assistance for users of your grid ;password = http://127.0.0.1/password - -[GridExtraFeatures] - ; These are propagated out to the regions as default settings for the - ; SimulatorFeatures to be sent to user's viewer when they teleport via - ; Hypergrid into this grid. - ; - - ; Allow regions to override our defaults. - ;AllowRegionOverride = true - - ; Search Server URI - ;SearchServerURI = "http://example.com:8200/" - - ; Map Server URI - ;MapImageServerURI = "http://example.com:8200/" - - ; Grid Destination Guide URI - ;DestinationGuideURI = "http://example.com:8200/" - - ; Chat Whisper Distance - ;WhisperDistance = 10 - - ; Chat Say Distance - ;SayDistance = 20 - - ; Chat Shout Distance - ;ShoutDistance = 100 - - ; Grid Allow Export - ;ExportSupported = true - - [UserProfilesService] LocalServiceModule = "OpenSim.Services.UserProfilesService.dll:UserProfilesService" Enabled = false diff --git a/bin/config-include/StandaloneCommon.ini.example b/bin/config-include/StandaloneCommon.ini.example index 2bbc316ec1..c4ece54c42 100644 --- a/bin/config-include/StandaloneCommon.ini.example +++ b/bin/config-include/StandaloneCommon.ini.example @@ -105,6 +105,10 @@ ;; For example: Region_Welcome_Area = "DefaultRegion, FallbackRegion" + ;; Allow supporting viewers to export content + ;; Set to false to prevent export + ExportSupported = true + ; === HG ONLY === ;; If you have this set under [Hypergrid], no need to set it here, leave it commented ; GatekeeperURI="http://127.0.0.1:9000" @@ -128,6 +132,9 @@ ;; For Viewer 2 MapTileURL = "http://127.0.0.1:9000/" + ; Url to search service + ; SearchURL = "http://127.0.0.1:8002"; + ; The minimum user level required for a user to be able to login. 0 by default ; If you disable a particular user's account then you can set their login level below this number. ; You can also change this level from the console though these changes will not be persisted.