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/Server/Handlers | |
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/Server/Handlers')
3 files changed, 19 insertions, 177 deletions
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 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.IO; | ||
31 | using System.Net; | ||
32 | using System.Reflection; | ||
33 | using System.Security; | ||
34 | using System.Text; | ||
35 | using log4net; | ||
36 | using Nini.Config; | ||
37 | using Nwc.XmlRpc; | ||
38 | using OpenSim.Framework; | ||
39 | using OpenSim.Framework.Servers.HttpServer; | ||
40 | using OpenMetaverse.StructuredData; | ||
41 | |||
42 | |||
43 | namespace 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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using log4net; | ||
32 | using OpenMetaverse; | ||
33 | using Nini.Config; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Framework.Servers.HttpServer; | ||
36 | using OpenSim.Server.Handlers.Base; | ||
37 | |||
38 | namespace 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 | ||