diff options
author | Diva Canto | 2010-01-14 06:36:39 -0800 |
---|---|---|
committer | Diva Canto | 2010-01-14 06:36:39 -0800 |
commit | 4bae547ecb67fcf74981ad85c02872dedc99f94a (patch) | |
tree | 3d842021400552d32d618f264556add6eecea649 /OpenSim | |
parent | Take the verbose debug messages in AgentHandler out again. (diff) | |
download | opensim-SC_OLD-4bae547ecb67fcf74981ad85c02872dedc99f94a.zip opensim-SC_OLD-4bae547ecb67fcf74981ad85c02872dedc99f94a.tar.gz opensim-SC_OLD-4bae547ecb67fcf74981ad85c02872dedc99f94a.tar.bz2 opensim-SC_OLD-4bae547ecb67fcf74981ad85c02872dedc99f94a.tar.xz |
Added the 2 missing methods in the grid service remote connections.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | 77 | ||||
-rw-r--r-- | OpenSim/Services/Connectors/Grid/GridServiceConnector.cs | 101 |
2 files changed, 174 insertions, 4 deletions
diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index d99b791..1601575 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | |||
@@ -103,6 +103,12 @@ namespace OpenSim.Server.Handlers.Grid | |||
103 | case "get_region_range": | 103 | case "get_region_range": |
104 | return GetRegionRange(request); | 104 | return GetRegionRange(request); |
105 | 105 | ||
106 | case "get_default_regions": | ||
107 | return GetDefaultRegions(request); | ||
108 | |||
109 | case "get_fallback_regions": | ||
110 | return GetFallbackRegions(request); | ||
111 | |||
106 | } | 112 | } |
107 | m_log.DebugFormat("[GRID HANDLER]: unknown method {0} request {1}", method.Length, method); | 113 | m_log.DebugFormat("[GRID HANDLER]: unknown method {0} request {1}", method.Length, method); |
108 | } | 114 | } |
@@ -404,6 +410,77 @@ namespace OpenSim.Server.Handlers.Grid | |||
404 | return encoding.GetBytes(xmlString); | 410 | return encoding.GetBytes(xmlString); |
405 | } | 411 | } |
406 | 412 | ||
413 | byte[] GetDefaultRegions(Dictionary<string, object> request) | ||
414 | { | ||
415 | //m_log.DebugFormat("[GRID HANDLER]: GetDefaultRegions"); | ||
416 | UUID scopeID = UUID.Zero; | ||
417 | if (request.ContainsKey("SCOPEID")) | ||
418 | UUID.TryParse(request["SCOPEID"].ToString(), out scopeID); | ||
419 | else | ||
420 | m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region range"); | ||
421 | |||
422 | List<GridRegion> rinfos = m_GridService.GetDefaultRegions(scopeID); | ||
423 | |||
424 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
425 | if ((rinfos == null) || ((rinfos != null) && (rinfos.Count == 0))) | ||
426 | result["result"] = "null"; | ||
427 | else | ||
428 | { | ||
429 | int i = 0; | ||
430 | foreach (GridRegion rinfo in rinfos) | ||
431 | { | ||
432 | Dictionary<string, object> rinfoDict = rinfo.ToKeyValuePairs(); | ||
433 | result["region" + i] = rinfoDict; | ||
434 | i++; | ||
435 | } | ||
436 | } | ||
437 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
438 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | ||
439 | UTF8Encoding encoding = new UTF8Encoding(); | ||
440 | return encoding.GetBytes(xmlString); | ||
441 | } | ||
442 | |||
443 | byte[] GetFallbackRegions(Dictionary<string, object> request) | ||
444 | { | ||
445 | //m_log.DebugFormat("[GRID HANDLER]: GetRegionRange"); | ||
446 | UUID scopeID = UUID.Zero; | ||
447 | if (request.ContainsKey("SCOPEID")) | ||
448 | UUID.TryParse(request["SCOPEID"].ToString(), out scopeID); | ||
449 | else | ||
450 | m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get fallback regions"); | ||
451 | |||
452 | int x = 0, y = 0; | ||
453 | if (request.ContainsKey("X")) | ||
454 | Int32.TryParse(request["X"].ToString(), out x); | ||
455 | else | ||
456 | m_log.WarnFormat("[GRID HANDLER]: no X in request to get fallback regions"); | ||
457 | if (request.ContainsKey("Y")) | ||
458 | Int32.TryParse(request["Y"].ToString(), out y); | ||
459 | else | ||
460 | m_log.WarnFormat("[GRID HANDLER]: no Y in request to get fallback regions"); | ||
461 | |||
462 | |||
463 | List<GridRegion> rinfos = m_GridService.GetFallbackRegions(scopeID, x, y); | ||
464 | |||
465 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
466 | if ((rinfos == null) || ((rinfos != null) && (rinfos.Count == 0))) | ||
467 | result["result"] = "null"; | ||
468 | else | ||
469 | { | ||
470 | int i = 0; | ||
471 | foreach (GridRegion rinfo in rinfos) | ||
472 | { | ||
473 | Dictionary<string, object> rinfoDict = rinfo.ToKeyValuePairs(); | ||
474 | result["region" + i] = rinfoDict; | ||
475 | i++; | ||
476 | } | ||
477 | } | ||
478 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
479 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | ||
480 | UTF8Encoding encoding = new UTF8Encoding(); | ||
481 | return encoding.GetBytes(xmlString); | ||
482 | } | ||
483 | |||
407 | #endregion | 484 | #endregion |
408 | 485 | ||
409 | #region Misc | 486 | #region Misc |
diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs index 7f1f2fd..cf112e1 100644 --- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs | |||
@@ -448,21 +448,114 @@ namespace OpenSim.Services.Connectors | |||
448 | return rinfos; | 448 | return rinfos; |
449 | } | 449 | } |
450 | 450 | ||
451 | #endregion | ||
452 | |||
453 | public List<GridRegion> GetDefaultRegions(UUID scopeID) | 451 | public List<GridRegion> GetDefaultRegions(UUID scopeID) |
454 | { | 452 | { |
455 | return null; | 453 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
454 | |||
455 | sendData["SCOPEID"] = scopeID.ToString(); | ||
456 | |||
457 | sendData["METHOD"] = "get_default_regions"; | ||
458 | |||
459 | List<GridRegion> rinfos = new List<GridRegion>(); | ||
460 | string reply = string.Empty; | ||
461 | try | ||
462 | { | ||
463 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
464 | m_ServerURI + "/grid", | ||
465 | ServerUtils.BuildQueryString(sendData)); | ||
466 | |||
467 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); | ||
468 | } | ||
469 | catch (Exception e) | ||
470 | { | ||
471 | m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message); | ||
472 | return rinfos; | ||
473 | } | ||
474 | |||
475 | if (reply != string.Empty) | ||
476 | { | ||
477 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
478 | |||
479 | if (replyData != null) | ||
480 | { | ||
481 | Dictionary<string, object>.ValueCollection rinfosList = replyData.Values; | ||
482 | foreach (object r in rinfosList) | ||
483 | { | ||
484 | if (r is Dictionary<string, object>) | ||
485 | { | ||
486 | GridRegion rinfo = new GridRegion((Dictionary<string, object>)r); | ||
487 | rinfos.Add(rinfo); | ||
488 | } | ||
489 | } | ||
490 | } | ||
491 | else | ||
492 | m_log.DebugFormat("[GRID CONNECTOR]: GetDefaultRegions {0} received null response", | ||
493 | scopeID); | ||
494 | } | ||
495 | else | ||
496 | m_log.DebugFormat("[GRID CONNECTOR]: GetDefaultRegions received null reply"); | ||
497 | |||
498 | return rinfos; | ||
456 | } | 499 | } |
457 | 500 | ||
458 | public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y) | 501 | public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y) |
459 | { | 502 | { |
460 | return null; | 503 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
504 | |||
505 | sendData["SCOPEID"] = scopeID.ToString(); | ||
506 | sendData["X"] = x.ToString(); | ||
507 | sendData["Y"] = y.ToString(); | ||
508 | |||
509 | sendData["METHOD"] = "get_fallback_regions"; | ||
510 | |||
511 | List<GridRegion> rinfos = new List<GridRegion>(); | ||
512 | string reply = string.Empty; | ||
513 | try | ||
514 | { | ||
515 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
516 | m_ServerURI + "/grid", | ||
517 | ServerUtils.BuildQueryString(sendData)); | ||
518 | |||
519 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); | ||
520 | } | ||
521 | catch (Exception e) | ||
522 | { | ||
523 | m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message); | ||
524 | return rinfos; | ||
525 | } | ||
526 | |||
527 | if (reply != string.Empty) | ||
528 | { | ||
529 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
530 | |||
531 | if (replyData != null) | ||
532 | { | ||
533 | Dictionary<string, object>.ValueCollection rinfosList = replyData.Values; | ||
534 | foreach (object r in rinfosList) | ||
535 | { | ||
536 | if (r is Dictionary<string, object>) | ||
537 | { | ||
538 | GridRegion rinfo = new GridRegion((Dictionary<string, object>)r); | ||
539 | rinfos.Add(rinfo); | ||
540 | } | ||
541 | } | ||
542 | } | ||
543 | else | ||
544 | m_log.DebugFormat("[GRID CONNECTOR]: GetFallbackRegions {0}, {1}-{2} received null response", | ||
545 | scopeID, x, y); | ||
546 | } | ||
547 | else | ||
548 | m_log.DebugFormat("[GRID CONNECTOR]: GetFallbackRegions received null reply"); | ||
549 | |||
550 | return rinfos; | ||
461 | } | 551 | } |
462 | 552 | ||
463 | public int GetRegionFlags(UUID scopeID, UUID regionID) | 553 | public int GetRegionFlags(UUID scopeID, UUID regionID) |
464 | { | 554 | { |
465 | return 0; | 555 | return 0; |
466 | } | 556 | } |
557 | |||
558 | #endregion | ||
559 | |||
467 | } | 560 | } |
468 | } | 561 | } |