From 10a8d2852e529fddb029ae333a3ae6a0f06f0182 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Sun, 3 Aug 2014 20:33:40 -0400 Subject: 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. --- .../Handlers/Grid/GridExtraFeaturesHandlers.cs | 127 --------------------- .../Grid/GridExtraFeaturesServerInConnector.cs | 50 -------- .../Server/Handlers/Grid/GridServerPostHandler.cs | 19 +++ 3 files changed, 19 insertions(+), 177 deletions(-) delete mode 100644 OpenSim/Server/Handlers/Grid/GridExtraFeaturesHandlers.cs delete mode 100644 OpenSim/Server/Handlers/Grid/GridExtraFeaturesServerInConnector.cs (limited to 'OpenSim/Server/Handlers') 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 @@ -/* - * 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 f57a4b3..0000000 --- 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 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 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 -- cgit v1.1