diff options
Diffstat (limited to 'OpenSim/Services/Connectors')
-rw-r--r-- | OpenSim/Services/Connectors/Grid/GridServiceConnector.cs | 277 |
1 files changed, 189 insertions, 88 deletions
diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs index 0a867db..748892a 100644 --- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs | |||
@@ -97,14 +97,27 @@ namespace OpenSim.Services.Connectors | |||
97 | 97 | ||
98 | sendData["METHOD"] = "register"; | 98 | sendData["METHOD"] = "register"; |
99 | 99 | ||
100 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 100 | string reqString = ServerUtils.BuildQueryString(sendData); |
101 | m_ServerURI + "/grid", | 101 | //m_log.DebugFormat("[GRID CONNECTOR]: queryString = {0}", reqString); |
102 | ServerUtils.BuildQueryString(sendData)); | 102 | try |
103 | 103 | { | |
104 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 104 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
105 | m_ServerURI + "/grid", | ||
106 | reqString); | ||
107 | if (reply != string.Empty) | ||
108 | { | ||
109 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
105 | 110 | ||
106 | if ((replyData["Result"] != null) && (replyData["Result"].ToString().ToLower() == "success")) | 111 | if ((replyData["Result"] != null) && (replyData["Result"].ToString().ToLower() == "success")) |
107 | return true; | 112 | return true; |
113 | } | ||
114 | else | ||
115 | m_log.DebugFormat("[GRID CONNECTOR]: RegisterRegion received null reply"); | ||
116 | } | ||
117 | catch (Exception e) | ||
118 | { | ||
119 | m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message); | ||
120 | } | ||
108 | 121 | ||
109 | return false; | 122 | return false; |
110 | } | 123 | } |
@@ -117,14 +130,26 @@ namespace OpenSim.Services.Connectors | |||
117 | 130 | ||
118 | sendData["METHOD"] = "deregister"; | 131 | sendData["METHOD"] = "deregister"; |
119 | 132 | ||
120 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 133 | try |
121 | m_ServerURI + "/grid", | 134 | { |
122 | ServerUtils.BuildQueryString(sendData)); | 135 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
136 | m_ServerURI + "/grid", | ||
137 | ServerUtils.BuildQueryString(sendData)); | ||
123 | 138 | ||
124 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 139 | if (reply != string.Empty) |
140 | { | ||
141 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
125 | 142 | ||
126 | if ((replyData["Result"] != null) && (replyData["Result"].ToString().ToLower() == "success")) | 143 | if ((replyData["Result"] != null) && (replyData["Result"].ToString().ToLower() == "success")) |
127 | return true; | 144 | return true; |
145 | } | ||
146 | else | ||
147 | m_log.DebugFormat("[GRID CONNECTOR]: DeregisterRegion received null reply"); | ||
148 | } | ||
149 | catch (Exception e) | ||
150 | { | ||
151 | m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message); | ||
152 | } | ||
128 | 153 | ||
129 | return false; | 154 | return false; |
130 | } | 155 | } |
@@ -138,16 +163,28 @@ namespace OpenSim.Services.Connectors | |||
138 | 163 | ||
139 | sendData["METHOD"] = "get_neighbours"; | 164 | sendData["METHOD"] = "get_neighbours"; |
140 | 165 | ||
141 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 166 | List<GridRegion> rinfos = new List<GridRegion>(); |
142 | m_ServerURI + "/grid", | 167 | |
143 | ServerUtils.BuildQueryString(sendData)); | 168 | string reqString = ServerUtils.BuildQueryString(sendData); |
169 | string reply = string.Empty; | ||
170 | try | ||
171 | { | ||
172 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
173 | m_ServerURI + "/grid", | ||
174 | reqString); | ||
175 | } | ||
176 | catch (Exception e) | ||
177 | { | ||
178 | m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message); | ||
179 | return rinfos; | ||
180 | } | ||
144 | 181 | ||
145 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 182 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
146 | 183 | ||
147 | List<GridRegion> rinfos = new List<GridRegion>(); | ||
148 | if (replyData != null) | 184 | if (replyData != null) |
149 | { | 185 | { |
150 | Dictionary<string, object>.ValueCollection rinfosList = replyData.Values; | 186 | Dictionary<string, object>.ValueCollection rinfosList = replyData.Values; |
187 | //m_log.DebugFormat("[GRID CONNECTOR]: get neighbours returned {0} elements", rinfosList.Count); | ||
151 | foreach (object r in rinfosList) | 188 | foreach (object r in rinfosList) |
152 | { | 189 | { |
153 | if (r is Dictionary<string, object>) | 190 | if (r is Dictionary<string, object>) |
@@ -156,8 +193,8 @@ namespace OpenSim.Services.Connectors | |||
156 | rinfos.Add(rinfo); | 193 | rinfos.Add(rinfo); |
157 | } | 194 | } |
158 | else | 195 | else |
159 | m_log.DebugFormat("[GRID CONNECTOR]: GetNeighbours {0}, {1} received invalid response", | 196 | m_log.DebugFormat("[GRID CONNECTOR]: GetNeighbours {0}, {1} received invalid response type {2}", |
160 | scopeID, regionID); | 197 | scopeID, regionID, r.GetType()); |
161 | } | 198 | } |
162 | } | 199 | } |
163 | else | 200 | else |
@@ -176,24 +213,39 @@ namespace OpenSim.Services.Connectors | |||
176 | 213 | ||
177 | sendData["METHOD"] = "get_region_by_uuid"; | 214 | sendData["METHOD"] = "get_region_by_uuid"; |
178 | 215 | ||
179 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 216 | string reply = string.Empty; |
180 | m_ServerURI + "/grid", | 217 | try |
181 | ServerUtils.BuildQueryString(sendData)); | 218 | { |
182 | 219 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | |
183 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 220 | m_ServerURI + "/grid", |
221 | ServerUtils.BuildQueryString(sendData)); | ||
222 | } | ||
223 | catch (Exception e) | ||
224 | { | ||
225 | m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message); | ||
226 | return null; | ||
227 | } | ||
184 | 228 | ||
185 | GridRegion rinfo = null; | 229 | GridRegion rinfo = null; |
186 | if ((replyData != null) && (replyData["result"] != null)) | 230 | |
231 | if (reply != string.Empty) | ||
187 | { | 232 | { |
188 | if (replyData["result"] is Dictionary<string, object>) | 233 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
189 | rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]); | 234 | |
235 | if ((replyData != null) && (replyData["result"] != null)) | ||
236 | { | ||
237 | if (replyData["result"] is Dictionary<string, object>) | ||
238 | rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]); | ||
239 | //else | ||
240 | // m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID {0}, {1} received null response", | ||
241 | // scopeID, regionID); | ||
242 | } | ||
190 | else | 243 | else |
191 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID {0}, {1} received invalid response", | 244 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID {0}, {1} received null response", |
192 | scopeID, regionID); | 245 | scopeID, regionID); |
193 | } | 246 | } |
194 | else | 247 | else |
195 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID {0}, {1} received null response", | 248 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByUUID received null reply"); |
196 | scopeID, regionID); | ||
197 | 249 | ||
198 | return rinfo; | 250 | return rinfo; |
199 | } | 251 | } |
@@ -207,25 +259,38 @@ namespace OpenSim.Services.Connectors | |||
207 | sendData["Y"] = y.ToString(); | 259 | sendData["Y"] = y.ToString(); |
208 | 260 | ||
209 | sendData["METHOD"] = "get_region_by_position"; | 261 | sendData["METHOD"] = "get_region_by_position"; |
210 | 262 | string reply = string.Empty; | |
211 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 263 | try |
212 | m_ServerURI + "/grid", | 264 | { |
213 | ServerUtils.BuildQueryString(sendData)); | 265 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
214 | 266 | m_ServerURI + "/grid", | |
215 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 267 | ServerUtils.BuildQueryString(sendData)); |
268 | } | ||
269 | catch (Exception e) | ||
270 | { | ||
271 | m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message); | ||
272 | return null; | ||
273 | } | ||
216 | 274 | ||
217 | GridRegion rinfo = null; | 275 | GridRegion rinfo = null; |
218 | if ((replyData != null) && (replyData["result"] != null)) | 276 | if (reply != string.Empty) |
219 | { | 277 | { |
220 | if (replyData["result"] is Dictionary<string, object>) | 278 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
221 | rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]); | 279 | |
280 | if ((replyData != null) && (replyData["result"] != null)) | ||
281 | { | ||
282 | if (replyData["result"] is Dictionary<string, object>) | ||
283 | rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]); | ||
284 | else | ||
285 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received invalid response", | ||
286 | scopeID, x, y); | ||
287 | } | ||
222 | else | 288 | else |
223 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received invalid response", | 289 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received null response", |
224 | scopeID, x, y); | 290 | scopeID, x, y); |
225 | } | 291 | } |
226 | else | 292 | else |
227 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received null response", | 293 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition received null reply"); |
228 | scopeID, x, y); | ||
229 | 294 | ||
230 | return rinfo; | 295 | return rinfo; |
231 | } | 296 | } |
@@ -238,25 +303,35 @@ namespace OpenSim.Services.Connectors | |||
238 | sendData["NAME"] = regionName; | 303 | sendData["NAME"] = regionName; |
239 | 304 | ||
240 | sendData["METHOD"] = "get_region_by_name"; | 305 | sendData["METHOD"] = "get_region_by_name"; |
241 | 306 | string reply = string.Empty; | |
242 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 307 | try |
243 | m_ServerURI + "/grid", | 308 | { |
244 | ServerUtils.BuildQueryString(sendData)); | 309 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
245 | 310 | m_ServerURI + "/grid", | |
246 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 311 | ServerUtils.BuildQueryString(sendData)); |
312 | } | ||
313 | catch (Exception e) | ||
314 | { | ||
315 | m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message); | ||
316 | return null; | ||
317 | } | ||
247 | 318 | ||
248 | GridRegion rinfo = null; | 319 | GridRegion rinfo = null; |
249 | if ((replyData != null) && (replyData["result"] != null)) | 320 | if (reply != string.Empty) |
250 | { | 321 | { |
251 | if (replyData["result"] is Dictionary<string, object>) | 322 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
252 | rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]); | 323 | |
324 | if ((replyData != null) && (replyData["result"] != null)) | ||
325 | { | ||
326 | if (replyData["result"] is Dictionary<string, object>) | ||
327 | rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]); | ||
328 | } | ||
253 | else | 329 | else |
254 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1} received invalid response", | 330 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1} received null response", |
255 | scopeID, regionName); | 331 | scopeID, regionName); |
256 | } | 332 | } |
257 | else | 333 | else |
258 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1} received null response", | 334 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByName received null reply"); |
259 | scopeID, regionName); | ||
260 | 335 | ||
261 | return rinfo; | 336 | return rinfo; |
262 | } | 337 | } |
@@ -270,32 +345,45 @@ namespace OpenSim.Services.Connectors | |||
270 | sendData["MAX"] = maxNumber.ToString(); | 345 | sendData["MAX"] = maxNumber.ToString(); |
271 | 346 | ||
272 | sendData["METHOD"] = "get_regions_by_name"; | 347 | sendData["METHOD"] = "get_regions_by_name"; |
273 | |||
274 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
275 | m_ServerURI + "/grid", | ||
276 | ServerUtils.BuildQueryString(sendData)); | ||
277 | |||
278 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
279 | |||
280 | List<GridRegion> rinfos = new List<GridRegion>(); | 348 | List<GridRegion> rinfos = new List<GridRegion>(); |
281 | if (replyData != null) | 349 | string reply = string.Empty; |
350 | try | ||
282 | { | 351 | { |
283 | Dictionary<string, object>.ValueCollection rinfosList = replyData.Values; | 352 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
284 | foreach (object r in rinfosList) | 353 | m_ServerURI + "/grid", |
354 | ServerUtils.BuildQueryString(sendData)); | ||
355 | } | ||
356 | catch (Exception e) | ||
357 | { | ||
358 | m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message); | ||
359 | return rinfos; | ||
360 | } | ||
361 | |||
362 | if (reply != string.Empty) | ||
363 | { | ||
364 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
365 | |||
366 | if (replyData != null) | ||
285 | { | 367 | { |
286 | if (r is Dictionary<string, object>) | 368 | Dictionary<string, object>.ValueCollection rinfosList = replyData.Values; |
369 | foreach (object r in rinfosList) | ||
287 | { | 370 | { |
288 | GridRegion rinfo = new GridRegion((Dictionary<string, object>)r); | 371 | if (r is Dictionary<string, object>) |
289 | rinfos.Add(rinfo); | 372 | { |
373 | GridRegion rinfo = new GridRegion((Dictionary<string, object>)r); | ||
374 | rinfos.Add(rinfo); | ||
375 | } | ||
376 | else | ||
377 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionsByName {0}, {1}, {2} received invalid response", | ||
378 | scopeID, name, maxNumber); | ||
290 | } | 379 | } |
291 | else | ||
292 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionsByName {0}, {1}, {2} received invalid response", | ||
293 | scopeID, name, maxNumber); | ||
294 | } | 380 | } |
381 | else | ||
382 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionsByName {0}, {1}, {2} received null response", | ||
383 | scopeID, name, maxNumber); | ||
295 | } | 384 | } |
296 | else | 385 | else |
297 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionsByName {0}, {1}, {2} received null response", | 386 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionsByName received null reply"); |
298 | scopeID, name, maxNumber); | ||
299 | 387 | ||
300 | return rinfos; | 388 | return rinfos; |
301 | } | 389 | } |
@@ -312,31 +400,44 @@ namespace OpenSim.Services.Connectors | |||
312 | 400 | ||
313 | sendData["METHOD"] = "get_region_range"; | 401 | sendData["METHOD"] = "get_region_range"; |
314 | 402 | ||
315 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 403 | List<GridRegion> rinfos = new List<GridRegion>(); |
316 | m_ServerURI + "/grid", | 404 | string reply = string.Empty; |
317 | ServerUtils.BuildQueryString(sendData)); | 405 | try |
406 | { | ||
407 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
408 | m_ServerURI + "/grid", | ||
409 | ServerUtils.BuildQueryString(sendData)); | ||
318 | 410 | ||
319 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 411 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); |
412 | } | ||
413 | catch (Exception e) | ||
414 | { | ||
415 | m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message); | ||
416 | return rinfos; | ||
417 | } | ||
320 | 418 | ||
321 | List<GridRegion> rinfos = new List<GridRegion>(); | 419 | if (reply != string.Empty) |
322 | if (replyData != null) | ||
323 | { | 420 | { |
324 | Dictionary<string, object>.ValueCollection rinfosList = replyData.Values; | 421 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
325 | foreach (object r in rinfosList) | 422 | |
423 | if (replyData != null) | ||
326 | { | 424 | { |
327 | if (r is Dictionary<string, object>) | 425 | Dictionary<string, object>.ValueCollection rinfosList = replyData.Values; |
426 | foreach (object r in rinfosList) | ||
328 | { | 427 | { |
329 | GridRegion rinfo = new GridRegion((Dictionary<string, object>)r); | 428 | if (r is Dictionary<string, object>) |
330 | rinfos.Add(rinfo); | 429 | { |
430 | GridRegion rinfo = new GridRegion((Dictionary<string, object>)r); | ||
431 | rinfos.Add(rinfo); | ||
432 | } | ||
331 | } | 433 | } |
332 | else | ||
333 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionRange {0}, {1}-{2} {3}-{4} received invalid response", | ||
334 | scopeID, xmin, xmax, ymin, ymax); | ||
335 | } | 434 | } |
435 | else | ||
436 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionRange {0}, {1}-{2} {3}-{4} received null response", | ||
437 | scopeID, xmin, xmax, ymin, ymax); | ||
336 | } | 438 | } |
337 | else | 439 | else |
338 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionRange {0}, {1}-{2} {3}-{4} received null response", | 440 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionRange received null reply"); |
339 | scopeID, xmin, xmax, ymin, ymax); | ||
340 | 441 | ||
341 | return rinfos; | 442 | return rinfos; |
342 | } | 443 | } |