diff options
Diffstat (limited to 'OpenSim/Services/Connectors/Grid/GridServiceConnector.cs')
-rw-r--r-- | OpenSim/Services/Connectors/Grid/GridServiceConnector.cs | 152 |
1 files changed, 148 insertions, 4 deletions
diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs index 04c7c53..0ec8912 100644 --- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs | |||
@@ -300,7 +300,7 @@ namespace OpenSim.Services.Connectors | |||
300 | if (replyData["result"] is Dictionary<string, object>) | 300 | if (replyData["result"] is Dictionary<string, object>) |
301 | rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]); | 301 | rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]); |
302 | else | 302 | else |
303 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received invalid response", | 303 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received no region", |
304 | scopeID, x, y); | 304 | scopeID, x, y); |
305 | } | 305 | } |
306 | else | 306 | else |
@@ -391,9 +391,6 @@ namespace OpenSim.Services.Connectors | |||
391 | GridRegion rinfo = new GridRegion((Dictionary<string, object>)r); | 391 | GridRegion rinfo = new GridRegion((Dictionary<string, object>)r); |
392 | rinfos.Add(rinfo); | 392 | rinfos.Add(rinfo); |
393 | } | 393 | } |
394 | else | ||
395 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionsByName {0}, {1}, {2} received invalid response", | ||
396 | scopeID, name, maxNumber); | ||
397 | } | 394 | } |
398 | } | 395 | } |
399 | else | 396 | else |
@@ -460,6 +457,153 @@ namespace OpenSim.Services.Connectors | |||
460 | return rinfos; | 457 | return rinfos; |
461 | } | 458 | } |
462 | 459 | ||
460 | public List<GridRegion> GetDefaultRegions(UUID scopeID) | ||
461 | { | ||
462 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
463 | |||
464 | sendData["SCOPEID"] = scopeID.ToString(); | ||
465 | |||
466 | sendData["METHOD"] = "get_default_regions"; | ||
467 | |||
468 | List<GridRegion> rinfos = new List<GridRegion>(); | ||
469 | string reply = string.Empty; | ||
470 | try | ||
471 | { | ||
472 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
473 | m_ServerURI + "/grid", | ||
474 | ServerUtils.BuildQueryString(sendData)); | ||
475 | |||
476 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); | ||
477 | } | ||
478 | catch (Exception e) | ||
479 | { | ||
480 | m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message); | ||
481 | return rinfos; | ||
482 | } | ||
483 | |||
484 | if (reply != string.Empty) | ||
485 | { | ||
486 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
487 | |||
488 | if (replyData != null) | ||
489 | { | ||
490 | Dictionary<string, object>.ValueCollection rinfosList = replyData.Values; | ||
491 | foreach (object r in rinfosList) | ||
492 | { | ||
493 | if (r is Dictionary<string, object>) | ||
494 | { | ||
495 | GridRegion rinfo = new GridRegion((Dictionary<string, object>)r); | ||
496 | rinfos.Add(rinfo); | ||
497 | } | ||
498 | } | ||
499 | } | ||
500 | else | ||
501 | m_log.DebugFormat("[GRID CONNECTOR]: GetDefaultRegions {0} received null response", | ||
502 | scopeID); | ||
503 | } | ||
504 | else | ||
505 | m_log.DebugFormat("[GRID CONNECTOR]: GetDefaultRegions received null reply"); | ||
506 | |||
507 | return rinfos; | ||
508 | } | ||
509 | |||
510 | public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y) | ||
511 | { | ||
512 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
513 | |||
514 | sendData["SCOPEID"] = scopeID.ToString(); | ||
515 | sendData["X"] = x.ToString(); | ||
516 | sendData["Y"] = y.ToString(); | ||
517 | |||
518 | sendData["METHOD"] = "get_fallback_regions"; | ||
519 | |||
520 | List<GridRegion> rinfos = new List<GridRegion>(); | ||
521 | string reply = string.Empty; | ||
522 | try | ||
523 | { | ||
524 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
525 | m_ServerURI + "/grid", | ||
526 | ServerUtils.BuildQueryString(sendData)); | ||
527 | |||
528 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); | ||
529 | } | ||
530 | catch (Exception e) | ||
531 | { | ||
532 | m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message); | ||
533 | return rinfos; | ||
534 | } | ||
535 | |||
536 | if (reply != string.Empty) | ||
537 | { | ||
538 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
539 | |||
540 | if (replyData != null) | ||
541 | { | ||
542 | Dictionary<string, object>.ValueCollection rinfosList = replyData.Values; | ||
543 | foreach (object r in rinfosList) | ||
544 | { | ||
545 | if (r is Dictionary<string, object>) | ||
546 | { | ||
547 | GridRegion rinfo = new GridRegion((Dictionary<string, object>)r); | ||
548 | rinfos.Add(rinfo); | ||
549 | } | ||
550 | } | ||
551 | } | ||
552 | else | ||
553 | m_log.DebugFormat("[GRID CONNECTOR]: GetFallbackRegions {0}, {1}-{2} received null response", | ||
554 | scopeID, x, y); | ||
555 | } | ||
556 | else | ||
557 | m_log.DebugFormat("[GRID CONNECTOR]: GetFallbackRegions received null reply"); | ||
558 | |||
559 | return rinfos; | ||
560 | } | ||
561 | |||
562 | public virtual int GetRegionFlags(UUID scopeID, UUID regionID) | ||
563 | { | ||
564 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
565 | |||
566 | sendData["SCOPEID"] = scopeID.ToString(); | ||
567 | sendData["REGIONID"] = regionID.ToString(); | ||
568 | |||
569 | sendData["METHOD"] = "get_region_flags"; | ||
570 | |||
571 | string reply = string.Empty; | ||
572 | try | ||
573 | { | ||
574 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
575 | m_ServerURI + "/grid", | ||
576 | ServerUtils.BuildQueryString(sendData)); | ||
577 | } | ||
578 | catch (Exception e) | ||
579 | { | ||
580 | m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message); | ||
581 | return -1; | ||
582 | } | ||
583 | |||
584 | int flags = -1; | ||
585 | |||
586 | if (reply != string.Empty) | ||
587 | { | ||
588 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
589 | |||
590 | if ((replyData != null) && replyData.ContainsKey("result") && (replyData["result"] != null)) | ||
591 | { | ||
592 | Int32.TryParse((string)replyData["result"], out flags); | ||
593 | //else | ||
594 | // m_log.DebugFormat("[GRID CONNECTOR]: GetRegionFlags {0}, {1} received wrong type {2}", | ||
595 | // scopeID, regionID, replyData["result"].GetType()); | ||
596 | } | ||
597 | else | ||
598 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionFlags {0}, {1} received null response", | ||
599 | scopeID, regionID); | ||
600 | } | ||
601 | else | ||
602 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionFlags received null reply"); | ||
603 | |||
604 | return flags; | ||
605 | } | ||
606 | |||
463 | #endregion | 607 | #endregion |
464 | 608 | ||
465 | } | 609 | } |