aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server/Handlers/Grid
diff options
context:
space:
mode:
authorBlueWall2014-07-30 11:19:34 -0400
committerBlueWall2014-07-30 11:24:39 -0400
commite0d8f42e6be70974c1cdbf6ba3ff80c2eea7294d (patch)
tree7c84f3b616b287fc26d44f04f10201d5c3c06af4 /OpenSim/Server/Handlers/Grid
parentIn TerrainModule, lock m_perClientPatchUpdates when removing entries. (diff)
downloadopensim-SC_OLD-e0d8f42e6be70974c1cdbf6ba3ff80c2eea7294d.zip
opensim-SC_OLD-e0d8f42e6be70974c1cdbf6ba3ff80c2eea7294d.tar.gz
opensim-SC_OLD-e0d8f42e6be70974c1cdbf6ba3ff80c2eea7294d.tar.bz2
opensim-SC_OLD-e0d8f42e6be70974c1cdbf6ba3ff80c2eea7294d.tar.xz
Simulator Extra Features Service
Provide a means for regions to fetch extra features supported by modern viewers from a central location .
Diffstat (limited to 'OpenSim/Server/Handlers/Grid')
-rw-r--r--OpenSim/Server/Handlers/Grid/GridExtraFeaturesHandlers.cs118
-rw-r--r--OpenSim/Server/Handlers/Grid/GridExtraFeaturesServerInConnector.cs50
2 files changed, 168 insertions, 0 deletions
diff --git a/OpenSim/Server/Handlers/Grid/GridExtraFeaturesHandlers.cs b/OpenSim/Server/Handlers/Grid/GridExtraFeaturesHandlers.cs
new file mode 100644
index 0000000..8b9890c
--- /dev/null
+++ b/OpenSim/Server/Handlers/Grid/GridExtraFeaturesHandlers.cs
@@ -0,0 +1,118 @@
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
28using System;
29using System.Collections;
30using System.IO;
31using System.Net;
32using System.Reflection;
33using System.Security;
34using System.Text;
35using log4net;
36using Nini.Config;
37using Nwc.XmlRpc;
38using OpenSim.Framework;
39using OpenSim.Framework.Servers.HttpServer;
40using OpenMetaverse.StructuredData;
41
42
43namespace 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 default:
86 m_Log.InfoFormat("{0} not yet supported.");
87 break;
88 }
89 }
90 else
91 m_AllowRegionOverride = featuresCfg.GetBoolean(key);
92 }
93 }
94 catch (Exception)
95 {
96 m_Log.Warn("[GRID EXTRA FEATURES SERVICE]: Cannot get grid features from config source, allowing region override");
97 }
98 }
99
100 public bool JsonGetGridFeaturesMethod(OSDMap json, ref JsonRpcResponse response)
101 {
102 OSDMap features = new OSDMap();
103 OSDMap json_map = new OSDMap();
104
105 foreach (string key in m_ExtraFeatures.Keys)
106 {
107 features[key] = OSD.FromString(m_ExtraFeatures[key].ToString());
108 }
109
110 json_map["extra_features"] = features;
111 json_map["region_override"] = m_AllowRegionOverride.ToString();
112
113 response.Result = json_map;
114
115 return true;
116 }
117 }
118} \ No newline at end of file
diff --git a/OpenSim/Server/Handlers/Grid/GridExtraFeaturesServerInConnector.cs b/OpenSim/Server/Handlers/Grid/GridExtraFeaturesServerInConnector.cs
new file mode 100644
index 0000000..f57a4b3
--- /dev/null
+++ b/OpenSim/Server/Handlers/Grid/GridExtraFeaturesServerInConnector.cs
@@ -0,0 +1,50 @@
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
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using log4net;
32using OpenMetaverse;
33using Nini.Config;
34using OpenSim.Framework;
35using OpenSim.Framework.Servers.HttpServer;
36using OpenSim.Server.Handlers.Base;
37
38namespace 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}