aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorDiva Canto2011-06-13 10:21:29 -0700
committerDiva Canto2011-06-13 10:21:29 -0700
commit822b9e085fca9dcf04e61b29b98daeecf7893d85 (patch)
tree1ce33b7869845d54d4d3fab4b9fe7e5941777a04 /OpenSim
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-822b9e085fca9dcf04e61b29b98daeecf7893d85.zip
opensim-SC_OLD-822b9e085fca9dcf04e61b29b98daeecf7893d85.tar.gz
opensim-SC_OLD-822b9e085fca9dcf04e61b29b98daeecf7893d85.tar.bz2
opensim-SC_OLD-822b9e085fca9dcf04e61b29b98daeecf7893d85.tar.xz
Added SimulatorFeatures capability. Thanks Aurora devs for the bootstrap on the contents of the response.
Changed the experimental capability introduced a couple of commits ago: now sending that extra information as part of the response in the SimulatorFeatures cap.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs (renamed from OpenSim/Region/ClientStack/Linden/Caps/MiscCapsModule.cs)71
1 files changed, 49 insertions, 22 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/MiscCapsModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
index 3dcd1e3..9f78948 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/MiscCapsModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
@@ -32,71 +32,67 @@ using log4net;
32using Nini.Config; 32using Nini.Config;
33using Mono.Addins; 33using Mono.Addins;
34using OpenMetaverse; 34using OpenMetaverse;
35using OpenMetaverse.StructuredData;
35using OpenSim.Framework; 36using OpenSim.Framework;
36using OpenSim.Framework.Servers.HttpServer; 37using OpenSim.Framework.Servers.HttpServer;
37using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
39using OpenSim.Services.Interfaces; 40using OpenSim.Services.Interfaces;
40using Caps = OpenSim.Framework.Capabilities.Caps; 41using Caps = OpenSim.Framework.Capabilities.Caps;
41using OpenSim.Capabilities.Handlers;
42 42
43namespace OpenSim.Region.ClientStack.Linden 43namespace OpenSim.Region.ClientStack.Linden
44{ 44{
45 /// <summary> 45 /// <summary>
46 /// A module to place miscellaneous capabilities 46 /// SimulatorFeatures capability. This is required for uploading Mesh.
47 /// Since is accepts an open-ended response, we also send more information
48 /// for viewers that care to interpret it.
49 ///
50 /// NOTE: Part of this code was adapted from the Aurora project, specifically
51 /// the normal part of the response in the capability handler.
47 /// </summary> 52 /// </summary>
48 /// 53 ///
49 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 54 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
50 public class MiscCapsModule : INonSharedRegionModule 55 public class SimulatorFeaturesModule : ISharedRegionModule
51 { 56 {
52 private static readonly ILog m_log = 57 private static readonly ILog m_log =
53 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 58 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54 private Scene m_scene; 59 private Scene m_scene;
55 60
56 private bool m_Enabled = false; 61 private string m_MapImageServerURL = string.Empty;
57 private string m_MapImageServerURL; 62 private string m_SearchURL = string.Empty;
58 63
59 #region ISharedRegionModule Members 64 #region ISharedRegionModule Members
60 65
61 public void Initialise(IConfigSource source) 66 public void Initialise(IConfigSource source)
62 { 67 {
63 m_Enabled = true; 68 IConfig config = source.Configs["SimulatorFeatures"];
64 IConfig config = source.Configs["ClientStack.LindenCaps"];
65 if (config == null) 69 if (config == null)
66 return; 70 return;
67 71
68 m_MapImageServerURL = config.GetString("Cap_MapImageService", string.Empty); 72 m_MapImageServerURL = config.GetString("MapImageServerURI", string.Empty);
69 if (m_MapImageServerURL != string.Empty) 73 if (m_MapImageServerURL != string.Empty)
70 { 74 {
71 m_MapImageServerURL = m_MapImageServerURL.Trim(); 75 m_MapImageServerURL = m_MapImageServerURL.Trim();
72 if (!m_MapImageServerURL.EndsWith("/")) 76 if (!m_MapImageServerURL.EndsWith("/"))
73 m_MapImageServerURL = m_MapImageServerURL + "/"; 77 m_MapImageServerURL = m_MapImageServerURL + "/";
74 } 78 }
79
80 m_SearchURL = config.GetString("SearchServerURI", string.Empty);
75 } 81 }
76 82
77 public void AddRegion(Scene s) 83 public void AddRegion(Scene s)
78 { 84 {
79 if (!m_Enabled)
80 return;
81
82 m_scene = s; 85 m_scene = s;
86 m_scene.EventManager.OnRegisterCaps += RegisterCaps;
83 } 87 }
84 88
85 public void RemoveRegion(Scene s) 89 public void RemoveRegion(Scene s)
86 { 90 {
87 if (!m_Enabled)
88 return;
89
90 m_scene.EventManager.OnRegisterCaps -= RegisterCaps; 91 m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
91 m_scene = null;
92 } 92 }
93 93
94 public void RegionLoaded(Scene s) 94 public void RegionLoaded(Scene s)
95 { 95 {
96 if (!m_Enabled)
97 return;
98
99 m_scene.EventManager.OnRegisterCaps += RegisterCaps;
100 } 96 }
101 97
102 public void PostInitialise() 98 public void PostInitialise()
@@ -105,7 +101,7 @@ namespace OpenSim.Region.ClientStack.Linden
105 101
106 public void Close() { } 102 public void Close() { }
107 103
108 public string Name { get { return "MiscCapsModule"; } } 104 public string Name { get { return "SimulatorFeaturesModule"; } }
109 105
110 public Type ReplaceableInterface 106 public Type ReplaceableInterface
111 { 107 {
@@ -116,9 +112,40 @@ namespace OpenSim.Region.ClientStack.Linden
116 112
117 public void RegisterCaps(UUID agentID, Caps caps) 113 public void RegisterCaps(UUID agentID, Caps caps)
118 { 114 {
119 m_log.InfoFormat("[MISC CAPS MODULE]: {0} in region {1}", m_MapImageServerURL, m_scene.RegionInfo.RegionName); 115 IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), SimulatorFeatures);
116 caps.RegisterHandler("SimulatorFeatures", reqHandler);
117 }
118
119 private Hashtable SimulatorFeatures(Hashtable mDhttpMethod)
120 {
121 m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: SimulatorFeatures request");
122 OSDMap data = new OSDMap();
123 data["MeshRezEnabled"] = true;
124 data["MeshUploadEnabled"] = true;
125 data["MeshXferEnabled"] = true;
126 data["PhysicsMaterialsEnabled"] = true;
127
128 OSDMap typesMap = new OSDMap();
129 typesMap["convex"] = true;
130 typesMap["none"] = true;
131 typesMap["prim"] = true;
132 data["PhysicsShapeTypes"] = typesMap;
133
134 // Extra information for viewers that want to use it
135 OSDMap gridServicesMap = new OSDMap();
120 if (m_MapImageServerURL != string.Empty) 136 if (m_MapImageServerURL != string.Empty)
121 caps.RegisterHandler("MapImageService", m_MapImageServerURL); 137 gridServicesMap["map-server-url"] = m_MapImageServerURL;
138 if (m_SearchURL != string.Empty)
139 gridServicesMap["search"] = m_SearchURL;
140 data["GridServices"] = gridServicesMap;
141
142 //Send back data
143 Hashtable responsedata = new Hashtable();
144 responsedata["int_response_code"] = 200;
145 responsedata["content_type"] = "text/plain";
146 responsedata["keepalive"] = false;
147 responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(data);
148 return responsedata;
122 } 149 }
123 150
124 } 151 }