diff options
Diffstat (limited to 'OpenSim/Server/Handlers/Grid/GridExtraFeaturesHandlers.cs')
-rw-r--r-- | OpenSim/Server/Handlers/Grid/GridExtraFeaturesHandlers.cs | 127 |
1 files changed, 0 insertions, 127 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 | ||