diff options
author | Justin Clark-Casey (justincc) | 2009-09-25 19:19:01 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2009-09-25 19:19:01 +0100 |
commit | 0bdf75637ff67ee443fa5c4d335c76ca594c254a (patch) | |
tree | 52c546b2118101b7bb82ccc7dee273573c8fa0a2 /OpenSim/Server | |
parent | Don't preserve full user profile details within iars for now (diff) | |
parent | More small changes to FlotsamAssetCache as per mcortez' request. (diff) | |
download | opensim-SC-0bdf75637ff67ee443fa5c4d335c76ca594c254a.zip opensim-SC-0bdf75637ff67ee443fa5c4d335c76ca594c254a.tar.gz opensim-SC-0bdf75637ff67ee443fa5c4d335c76ca594c254a.tar.bz2 opensim-SC-0bdf75637ff67ee443fa5c4d335c76ca594c254a.tar.xz |
Merge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Server')
-rw-r--r-- | OpenSim/Server/Base/ServerUtils.cs | 4 | ||||
-rw-r--r-- | OpenSim/Server/Handlers/Grid/GridServerConnector.cs | 2 | ||||
-rw-r--r-- | OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | 203 |
3 files changed, 187 insertions, 22 deletions
diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 6c2b3ed..656fcf5 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs | |||
@@ -258,6 +258,8 @@ namespace OpenSim.Server.Base | |||
258 | 258 | ||
259 | public static Dictionary<string, object> ParseXmlResponse(string data) | 259 | public static Dictionary<string, object> ParseXmlResponse(string data) |
260 | { | 260 | { |
261 | //m_log.DebugFormat("[XXX]: received xml string: {0}", data); | ||
262 | |||
261 | Dictionary<string, object> ret = new Dictionary<string, object>(); | 263 | Dictionary<string, object> ret = new Dictionary<string, object>(); |
262 | 264 | ||
263 | XmlDocument doc = new XmlDocument(); | 265 | XmlDocument doc = new XmlDocument(); |
@@ -284,7 +286,7 @@ namespace OpenSim.Server.Base | |||
284 | 286 | ||
285 | foreach (XmlNode part in partL) | 287 | foreach (XmlNode part in partL) |
286 | { | 288 | { |
287 | XmlNode type = part.Attributes.GetNamedItem("Type"); | 289 | XmlNode type = part.Attributes.GetNamedItem("type"); |
288 | if (type == null || type.Value != "List") | 290 | if (type == null || type.Value != "List") |
289 | { | 291 | { |
290 | ret[part.Name] = part.InnerText; | 292 | ret[part.Name] = part.InnerText; |
diff --git a/OpenSim/Server/Handlers/Grid/GridServerConnector.cs b/OpenSim/Server/Handlers/Grid/GridServerConnector.cs index 7bf2e66..ebdf489 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerConnector.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerConnector.cs | |||
@@ -45,7 +45,7 @@ namespace OpenSim.Server.Handlers.Grid | |||
45 | if (serverConfig == null) | 45 | if (serverConfig == null) |
46 | throw new Exception("No section 'Server' in config file"); | 46 | throw new Exception("No section 'Server' in config file"); |
47 | 47 | ||
48 | string gridService = serverConfig.GetString("GridServiceModule", | 48 | string gridService = serverConfig.GetString("LocalServiceModule", |
49 | String.Empty); | 49 | String.Empty); |
50 | 50 | ||
51 | if (gridService == String.Empty) | 51 | if (gridService == String.Empty) |
diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index e72c2eb..711639f 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | |||
@@ -63,7 +63,10 @@ namespace OpenSim.Server.Handlers.Grid | |||
63 | StreamReader sr = new StreamReader(requestData); | 63 | StreamReader sr = new StreamReader(requestData); |
64 | string body = sr.ReadToEnd(); | 64 | string body = sr.ReadToEnd(); |
65 | sr.Close(); | 65 | sr.Close(); |
66 | 66 | body = body.Trim(); | |
67 | |||
68 | //m_log.DebugFormat("[XXX]: query String: {0}", body); | ||
69 | |||
67 | Dictionary<string, string> request = | 70 | Dictionary<string, string> request = |
68 | ServerUtils.ParseQueryString(body); | 71 | ServerUtils.ParseQueryString(body); |
69 | 72 | ||
@@ -98,11 +101,11 @@ namespace OpenSim.Server.Handlers.Grid | |||
98 | case "get_region_range": | 101 | case "get_region_range": |
99 | return GetRegionRange(request); | 102 | return GetRegionRange(request); |
100 | 103 | ||
101 | default: | ||
102 | m_log.DebugFormat("[GRID HANDLER]: unknown method request {0}", method); | ||
103 | return FailureResult(); | ||
104 | } | 104 | } |
105 | 105 | ||
106 | m_log.DebugFormat("[GRID HANDLER]: unknown method {0} request {1}", method.Length, method); | ||
107 | return FailureResult(); | ||
108 | |||
106 | } | 109 | } |
107 | 110 | ||
108 | #region Method-specific handlers | 111 | #region Method-specific handlers |
@@ -155,22 +158,29 @@ namespace OpenSim.Server.Handlers.Grid | |||
155 | 158 | ||
156 | UUID regionID = UUID.Zero; | 159 | UUID regionID = UUID.Zero; |
157 | if (request["REGIONID"] != null) | 160 | if (request["REGIONID"] != null) |
158 | UUID.TryParse(request["REGIONID"], out scopeID); | 161 | UUID.TryParse(request["REGIONID"], out regionID); |
159 | else | 162 | else |
160 | m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get neighbours"); | 163 | m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get neighbours"); |
161 | 164 | ||
162 | List<GridRegion> rinfos = m_GridService.GetNeighbours(scopeID, regionID); | 165 | List<GridRegion> rinfos = m_GridService.GetNeighbours(scopeID, regionID); |
166 | //m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); | ||
163 | 167 | ||
164 | Dictionary<string, object> result = new Dictionary<string, object>(); | 168 | Dictionary<string, object> result = new Dictionary<string, object>(); |
165 | int i = 0; | 169 | if ((rinfos == null) || ((rinfos != null) && (rinfos.Count == 0))) |
166 | foreach (GridRegion rinfo in rinfos) | 170 | result["result"] = "null"; |
171 | else | ||
167 | { | 172 | { |
168 | Dictionary<string, object> rinfoDict = rinfo.ToKeyValuePairs(); | 173 | int i = 0; |
169 | result["region" + i] = rinfoDict; | 174 | foreach (GridRegion rinfo in rinfos) |
170 | i++; | 175 | { |
176 | Dictionary<string, object> rinfoDict = rinfo.ToKeyValuePairs(); | ||
177 | result["region" + i] = rinfoDict; | ||
178 | i++; | ||
179 | } | ||
171 | } | 180 | } |
172 | 181 | ||
173 | string xmlString = ServerUtils.BuildXmlResponse(result); | 182 | string xmlString = ServerUtils.BuildXmlResponse(result); |
183 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | ||
174 | UTF8Encoding encoding = new UTF8Encoding(); | 184 | UTF8Encoding encoding = new UTF8Encoding(); |
175 | return encoding.GetBytes(xmlString); | 185 | return encoding.GetBytes(xmlString); |
176 | 186 | ||
@@ -178,32 +188,185 @@ namespace OpenSim.Server.Handlers.Grid | |||
178 | 188 | ||
179 | byte[] GetRegionByUUID(Dictionary<string, string> request) | 189 | byte[] GetRegionByUUID(Dictionary<string, string> request) |
180 | { | 190 | { |
181 | // TODO | 191 | UUID scopeID = UUID.Zero; |
182 | return new byte[0]; | 192 | if (request["SCOPEID"] != null) |
193 | UUID.TryParse(request["SCOPEID"], out scopeID); | ||
194 | else | ||
195 | m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get neighbours"); | ||
196 | |||
197 | UUID regionID = UUID.Zero; | ||
198 | if (request["REGIONID"] != null) | ||
199 | UUID.TryParse(request["REGIONID"], out regionID); | ||
200 | else | ||
201 | m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get neighbours"); | ||
202 | |||
203 | GridRegion rinfo = m_GridService.GetRegionByUUID(scopeID, regionID); | ||
204 | //m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); | ||
205 | |||
206 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
207 | if (rinfo == null) | ||
208 | result["result"] = "null"; | ||
209 | else | ||
210 | result["result"] = rinfo.ToKeyValuePairs(); | ||
211 | |||
212 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
213 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | ||
214 | UTF8Encoding encoding = new UTF8Encoding(); | ||
215 | return encoding.GetBytes(xmlString); | ||
183 | } | 216 | } |
184 | 217 | ||
185 | byte[] GetRegionByPosition(Dictionary<string, string> request) | 218 | byte[] GetRegionByPosition(Dictionary<string, string> request) |
186 | { | 219 | { |
187 | // TODO | 220 | UUID scopeID = UUID.Zero; |
188 | return new byte[0]; | 221 | if (request["SCOPEID"] != null) |
222 | UUID.TryParse(request["SCOPEID"], out scopeID); | ||
223 | else | ||
224 | m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region by position"); | ||
225 | |||
226 | int x = 0, y = 0; | ||
227 | if (request["X"] != null) | ||
228 | Int32.TryParse(request["X"], out x); | ||
229 | else | ||
230 | m_log.WarnFormat("[GRID HANDLER]: no X in request to get region by position"); | ||
231 | if (request["Y"] != null) | ||
232 | Int32.TryParse(request["Y"], out y); | ||
233 | else | ||
234 | m_log.WarnFormat("[GRID HANDLER]: no Y in request to get region by position"); | ||
235 | |||
236 | GridRegion rinfo = m_GridService.GetRegionByPosition(scopeID, x, y); | ||
237 | //m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); | ||
238 | |||
239 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
240 | if (rinfo == null) | ||
241 | result["result"] = "null"; | ||
242 | else | ||
243 | result["result"] = rinfo.ToKeyValuePairs(); | ||
244 | |||
245 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
246 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | ||
247 | UTF8Encoding encoding = new UTF8Encoding(); | ||
248 | return encoding.GetBytes(xmlString); | ||
189 | } | 249 | } |
190 | 250 | ||
191 | byte[] GetRegionByName(Dictionary<string, string> request) | 251 | byte[] GetRegionByName(Dictionary<string, string> request) |
192 | { | 252 | { |
193 | // TODO | 253 | UUID scopeID = UUID.Zero; |
194 | return new byte[0]; | 254 | if (request["SCOPEID"] != null) |
255 | UUID.TryParse(request["SCOPEID"], out scopeID); | ||
256 | else | ||
257 | m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region by name"); | ||
258 | |||
259 | string regionName = string.Empty; | ||
260 | if (request["NAME"] != null) | ||
261 | regionName = request["NAME"]; | ||
262 | else | ||
263 | m_log.WarnFormat("[GRID HANDLER]: no name in request to get region by name"); | ||
264 | |||
265 | GridRegion rinfo = m_GridService.GetRegionByName(scopeID, regionName); | ||
266 | //m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); | ||
267 | |||
268 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
269 | if (rinfo == null) | ||
270 | result["result"] = "null"; | ||
271 | else | ||
272 | result["result"] = rinfo.ToKeyValuePairs(); | ||
273 | |||
274 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
275 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | ||
276 | UTF8Encoding encoding = new UTF8Encoding(); | ||
277 | return encoding.GetBytes(xmlString); | ||
195 | } | 278 | } |
196 | 279 | ||
197 | byte[] GetRegionsByName(Dictionary<string, string> request) | 280 | byte[] GetRegionsByName(Dictionary<string, string> request) |
198 | { | 281 | { |
199 | // TODO | 282 | UUID scopeID = UUID.Zero; |
200 | return new byte[0]; | 283 | if (request["SCOPEID"] != null) |
284 | UUID.TryParse(request["SCOPEID"], out scopeID); | ||
285 | else | ||
286 | m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get regions by name"); | ||
287 | |||
288 | string regionName = string.Empty; | ||
289 | if (request["NAME"] != null) | ||
290 | regionName = request["NAME"]; | ||
291 | else | ||
292 | m_log.WarnFormat("[GRID HANDLER]: no NAME in request to get regions by name"); | ||
293 | |||
294 | int max = 0; | ||
295 | if (request["MAX"] != null) | ||
296 | Int32.TryParse(request["MAX"], out max); | ||
297 | else | ||
298 | m_log.WarnFormat("[GRID HANDLER]: no MAX in request to get regions by name"); | ||
299 | |||
300 | List<GridRegion> rinfos = m_GridService.GetRegionsByName(scopeID, regionName, max); | ||
301 | //m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); | ||
302 | |||
303 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
304 | if ((rinfos == null) || ((rinfos != null) && (rinfos.Count == 0))) | ||
305 | result["result"] = "null"; | ||
306 | else | ||
307 | { | ||
308 | int i = 0; | ||
309 | foreach (GridRegion rinfo in rinfos) | ||
310 | { | ||
311 | Dictionary<string, object> rinfoDict = rinfo.ToKeyValuePairs(); | ||
312 | result["region" + i] = rinfoDict; | ||
313 | i++; | ||
314 | } | ||
315 | } | ||
316 | |||
317 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
318 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | ||
319 | UTF8Encoding encoding = new UTF8Encoding(); | ||
320 | return encoding.GetBytes(xmlString); | ||
201 | } | 321 | } |
202 | 322 | ||
203 | byte[] GetRegionRange(Dictionary<string, string> request) | 323 | byte[] GetRegionRange(Dictionary<string, string> request) |
204 | { | 324 | { |
205 | // TODO | 325 | //m_log.DebugFormat("[GRID HANDLER]: GetRegionRange"); |
206 | return new byte[0]; | 326 | UUID scopeID = UUID.Zero; |
327 | if (request.ContainsKey("SCOPEID")) | ||
328 | UUID.TryParse(request["SCOPEID"], out scopeID); | ||
329 | else | ||
330 | m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region range"); | ||
331 | |||
332 | int xmin = 0, xmax = 0, ymin = 0, ymax = 0; | ||
333 | if (request.ContainsKey("XMIN")) | ||
334 | Int32.TryParse(request["XMIN"], out xmin); | ||
335 | else | ||
336 | m_log.WarnFormat("[GRID HANDLER]: no XMIN in request to get region range"); | ||
337 | if (request.ContainsKey("XMAX")) | ||
338 | Int32.TryParse(request["XMAX"], out xmax); | ||
339 | else | ||
340 | m_log.WarnFormat("[GRID HANDLER]: no XMAX in request to get region range"); | ||
341 | if (request.ContainsKey("YMIN")) | ||
342 | Int32.TryParse(request["YMIN"], out ymin); | ||
343 | else | ||
344 | m_log.WarnFormat("[GRID HANDLER]: no YMIN in request to get region range"); | ||
345 | if (request.ContainsKey("YMAX")) | ||
346 | Int32.TryParse(request["YMAX"], out ymax); | ||
347 | else | ||
348 | m_log.WarnFormat("[GRID HANDLER]: no YMAX in request to get region range"); | ||
349 | |||
350 | |||
351 | List<GridRegion> rinfos = m_GridService.GetRegionRange(scopeID, xmin, xmax, ymin, ymax); | ||
352 | |||
353 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
354 | if ((rinfos == null) || ((rinfos != null) && (rinfos.Count == 0))) | ||
355 | result["result"] = "null"; | ||
356 | else | ||
357 | { | ||
358 | int i = 0; | ||
359 | foreach (GridRegion rinfo in rinfos) | ||
360 | { | ||
361 | Dictionary<string, object> rinfoDict = rinfo.ToKeyValuePairs(); | ||
362 | result["region" + i] = rinfoDict; | ||
363 | i++; | ||
364 | } | ||
365 | } | ||
366 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
367 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | ||
368 | UTF8Encoding encoding = new UTF8Encoding(); | ||
369 | return encoding.GetBytes(xmlString); | ||
207 | } | 370 | } |
208 | 371 | ||
209 | #endregion | 372 | #endregion |