diff options
author | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
---|---|---|
committer | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
commit | 134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch) | |
tree | 216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Services/Connectors/Grid | |
parent | More changing to production grid. Double oops. (diff) | |
download | opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2 opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz |
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to 'OpenSim/Services/Connectors/Grid')
-rw-r--r-- | OpenSim/Services/Connectors/Grid/GridServicesConnector.cs | 121 |
1 files changed, 107 insertions, 14 deletions
diff --git a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs index 34ed0d7..596f867 100644 --- a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs | |||
@@ -32,7 +32,8 @@ using System.IO; | |||
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 35 | |
36 | using OpenSim.Framework.ServiceAuth; | ||
36 | using OpenSim.Services.Interfaces; | 37 | using OpenSim.Services.Interfaces; |
37 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 38 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
38 | using OpenSim.Server.Base; | 39 | using OpenSim.Server.Base; |
@@ -40,7 +41,7 @@ using OpenMetaverse; | |||
40 | 41 | ||
41 | namespace OpenSim.Services.Connectors | 42 | namespace OpenSim.Services.Connectors |
42 | { | 43 | { |
43 | public class GridServicesConnector : IGridService | 44 | public class GridServicesConnector : BaseServiceConnector, IGridService |
44 | { | 45 | { |
45 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
46 | LogManager.GetLogger( | 47 | LogManager.GetLogger( |
@@ -80,6 +81,8 @@ namespace OpenSim.Services.Connectors | |||
80 | throw new Exception("Grid connector init error"); | 81 | throw new Exception("Grid connector init error"); |
81 | } | 82 | } |
82 | m_ServerURI = serviceURI; | 83 | m_ServerURI = serviceURI; |
84 | |||
85 | base.Initialise(source, "GridService"); | ||
83 | } | 86 | } |
84 | 87 | ||
85 | 88 | ||
@@ -102,7 +105,7 @@ namespace OpenSim.Services.Connectors | |||
102 | // m_log.DebugFormat("[GRID CONNECTOR]: queryString = {0}", reqString); | 105 | // m_log.DebugFormat("[GRID CONNECTOR]: queryString = {0}", reqString); |
103 | try | 106 | try |
104 | { | 107 | { |
105 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); | 108 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); |
106 | if (reply != string.Empty) | 109 | if (reply != string.Empty) |
107 | { | 110 | { |
108 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 111 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -158,7 +161,7 @@ namespace OpenSim.Services.Connectors | |||
158 | try | 161 | try |
159 | { | 162 | { |
160 | string reply | 163 | string reply |
161 | = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData)); | 164 | = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth); |
162 | 165 | ||
163 | if (reply != string.Empty) | 166 | if (reply != string.Empty) |
164 | { | 167 | { |
@@ -195,7 +198,7 @@ namespace OpenSim.Services.Connectors | |||
195 | 198 | ||
196 | try | 199 | try |
197 | { | 200 | { |
198 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); | 201 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); |
199 | } | 202 | } |
200 | catch (Exception e) | 203 | catch (Exception e) |
201 | { | 204 | { |
@@ -238,7 +241,7 @@ namespace OpenSim.Services.Connectors | |||
238 | string uri = m_ServerURI + "/grid"; | 241 | string uri = m_ServerURI + "/grid"; |
239 | try | 242 | try |
240 | { | 243 | { |
241 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData)); | 244 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth); |
242 | } | 245 | } |
243 | catch (Exception e) | 246 | catch (Exception e) |
244 | { | 247 | { |
@@ -285,7 +288,7 @@ namespace OpenSim.Services.Connectors | |||
285 | { | 288 | { |
286 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 289 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
287 | uri, | 290 | uri, |
288 | ServerUtils.BuildQueryString(sendData)); | 291 | ServerUtils.BuildQueryString(sendData), m_Auth); |
289 | } | 292 | } |
290 | catch (Exception e) | 293 | catch (Exception e) |
291 | { | 294 | { |
@@ -330,7 +333,7 @@ namespace OpenSim.Services.Connectors | |||
330 | { | 333 | { |
331 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 334 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
332 | uri, | 335 | uri, |
333 | ServerUtils.BuildQueryString(sendData)); | 336 | ServerUtils.BuildQueryString(sendData), m_Auth); |
334 | } | 337 | } |
335 | catch (Exception e) | 338 | catch (Exception e) |
336 | { | 339 | { |
@@ -374,7 +377,7 @@ namespace OpenSim.Services.Connectors | |||
374 | { | 377 | { |
375 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 378 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
376 | uri, | 379 | uri, |
377 | ServerUtils.BuildQueryString(sendData)); | 380 | ServerUtils.BuildQueryString(sendData), m_Auth); |
378 | } | 381 | } |
379 | catch (Exception e) | 382 | catch (Exception e) |
380 | { | 383 | { |
@@ -428,7 +431,7 @@ namespace OpenSim.Services.Connectors | |||
428 | { | 431 | { |
429 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 432 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
430 | uri, | 433 | uri, |
431 | ServerUtils.BuildQueryString(sendData)); | 434 | ServerUtils.BuildQueryString(sendData), m_Auth); |
432 | 435 | ||
433 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); | 436 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); |
434 | } | 437 | } |
@@ -479,7 +482,7 @@ namespace OpenSim.Services.Connectors | |||
479 | { | 482 | { |
480 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 483 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
481 | uri, | 484 | uri, |
482 | ServerUtils.BuildQueryString(sendData)); | 485 | ServerUtils.BuildQueryString(sendData), m_Auth); |
483 | 486 | ||
484 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); | 487 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); |
485 | } | 488 | } |
@@ -515,6 +518,57 @@ namespace OpenSim.Services.Connectors | |||
515 | return rinfos; | 518 | return rinfos; |
516 | } | 519 | } |
517 | 520 | ||
521 | public List<GridRegion> GetDefaultHypergridRegions(UUID scopeID) | ||
522 | { | ||
523 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
524 | |||
525 | sendData["SCOPEID"] = scopeID.ToString(); | ||
526 | |||
527 | sendData["METHOD"] = "get_default_hypergrid_regions"; | ||
528 | |||
529 | List<GridRegion> rinfos = new List<GridRegion>(); | ||
530 | string reply = string.Empty; | ||
531 | string uri = m_ServerURI + "/grid"; | ||
532 | try | ||
533 | { | ||
534 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
535 | uri, | ||
536 | ServerUtils.BuildQueryString(sendData), m_Auth); | ||
537 | |||
538 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); | ||
539 | } | ||
540 | catch (Exception e) | ||
541 | { | ||
542 | m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", uri, e.Message); | ||
543 | return rinfos; | ||
544 | } | ||
545 | |||
546 | if (reply != string.Empty) | ||
547 | { | ||
548 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
549 | |||
550 | if (replyData != null) | ||
551 | { | ||
552 | Dictionary<string, object>.ValueCollection rinfosList = replyData.Values; | ||
553 | foreach (object r in rinfosList) | ||
554 | { | ||
555 | if (r is Dictionary<string, object>) | ||
556 | { | ||
557 | GridRegion rinfo = new GridRegion((Dictionary<string, object>)r); | ||
558 | rinfos.Add(rinfo); | ||
559 | } | ||
560 | } | ||
561 | } | ||
562 | else | ||
563 | m_log.DebugFormat("[GRID CONNECTOR]: GetDefaultHypergridRegions {0} received null response", | ||
564 | scopeID); | ||
565 | } | ||
566 | else | ||
567 | m_log.DebugFormat("[GRID CONNECTOR]: GetDefaultHypergridRegions received null reply"); | ||
568 | |||
569 | return rinfos; | ||
570 | } | ||
571 | |||
518 | public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y) | 572 | public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y) |
519 | { | 573 | { |
520 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 574 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
@@ -532,7 +586,7 @@ namespace OpenSim.Services.Connectors | |||
532 | { | 586 | { |
533 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 587 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
534 | uri, | 588 | uri, |
535 | ServerUtils.BuildQueryString(sendData)); | 589 | ServerUtils.BuildQueryString(sendData), m_Auth); |
536 | 590 | ||
537 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); | 591 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); |
538 | } | 592 | } |
@@ -583,7 +637,7 @@ namespace OpenSim.Services.Connectors | |||
583 | { | 637 | { |
584 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 638 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
585 | uri, | 639 | uri, |
586 | ServerUtils.BuildQueryString(sendData)); | 640 | ServerUtils.BuildQueryString(sendData), m_Auth); |
587 | 641 | ||
588 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); | 642 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); |
589 | } | 643 | } |
@@ -634,7 +688,7 @@ namespace OpenSim.Services.Connectors | |||
634 | { | 688 | { |
635 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 689 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
636 | uri, | 690 | uri, |
637 | ServerUtils.BuildQueryString(sendData)); | 691 | ServerUtils.BuildQueryString(sendData), m_Auth); |
638 | } | 692 | } |
639 | catch (Exception e) | 693 | catch (Exception e) |
640 | { | 694 | { |
@@ -665,6 +719,45 @@ namespace OpenSim.Services.Connectors | |||
665 | return flags; | 719 | return flags; |
666 | } | 720 | } |
667 | 721 | ||
722 | public Dictionary<string, object> GetExtraFeatures() | ||
723 | { | ||
724 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
725 | Dictionary<string, object> extraFeatures = new Dictionary<string, object>(); | ||
726 | |||
727 | sendData["METHOD"] = "get_grid_extra_features"; | ||
728 | |||
729 | string reply = string.Empty; | ||
730 | string uri = m_ServerURI + "/grid"; | ||
731 | |||
732 | try | ||
733 | { | ||
734 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
735 | uri, | ||
736 | ServerUtils.BuildQueryString(sendData), m_Auth); | ||
737 | } | ||
738 | catch (Exception e) | ||
739 | { | ||
740 | m_log.DebugFormat("[GRID CONNECTOR]: GetExtraFeatures - Exception when contacting grid server at {0}: {1}", uri, e.Message); | ||
741 | return extraFeatures; | ||
742 | } | ||
743 | |||
744 | if (reply != string.Empty) | ||
745 | { | ||
746 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
747 | |||
748 | if ((replyData != null) && replyData.Count > 0) | ||
749 | { | ||
750 | foreach (string key in replyData.Keys) | ||
751 | { | ||
752 | extraFeatures[key] = replyData[key].ToString(); | ||
753 | } | ||
754 | } | ||
755 | } | ||
756 | else | ||
757 | m_log.DebugFormat("[GRID CONNECTOR]: GetExtraServiceURLs received null reply"); | ||
758 | |||
759 | return extraFeatures; | ||
760 | } | ||
668 | #endregion | 761 | #endregion |
669 | 762 | ||
670 | } | 763 | } |