diff options
Diffstat (limited to 'OpenSim/Services/Connectors/Grid/GridServicesConnector.cs')
-rw-r--r-- | OpenSim/Services/Connectors/Grid/GridServicesConnector.cs | 70 |
1 files changed, 56 insertions, 14 deletions
diff --git a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs index af91cdb..d208f1e 100644 --- a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs | |||
@@ -33,6 +33,7 @@ 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 | using OpenSim.Framework.Communications; |
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( |
@@ -83,6 +84,8 @@ namespace OpenSim.Services.Connectors | |||
83 | throw new Exception("Grid connector init error"); | 84 | throw new Exception("Grid connector init error"); |
84 | } | 85 | } |
85 | m_ServerURI = serviceURI; | 86 | m_ServerURI = serviceURI; |
87 | |||
88 | base.Initialise(source, "GridService"); | ||
86 | } | 89 | } |
87 | 90 | ||
88 | 91 | ||
@@ -105,7 +108,7 @@ namespace OpenSim.Services.Connectors | |||
105 | // m_log.DebugFormat("[GRID CONNECTOR]: queryString = {0}", reqString); | 108 | // m_log.DebugFormat("[GRID CONNECTOR]: queryString = {0}", reqString); |
106 | try | 109 | try |
107 | { | 110 | { |
108 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); | 111 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); |
109 | if (reply != string.Empty) | 112 | if (reply != string.Empty) |
110 | { | 113 | { |
111 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 114 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -161,7 +164,7 @@ namespace OpenSim.Services.Connectors | |||
161 | try | 164 | try |
162 | { | 165 | { |
163 | string reply | 166 | string reply |
164 | = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData)); | 167 | = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth); |
165 | 168 | ||
166 | if (reply != string.Empty) | 169 | if (reply != string.Empty) |
167 | { | 170 | { |
@@ -198,7 +201,7 @@ namespace OpenSim.Services.Connectors | |||
198 | 201 | ||
199 | try | 202 | try |
200 | { | 203 | { |
201 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); | 204 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth); |
202 | } | 205 | } |
203 | catch (Exception e) | 206 | catch (Exception e) |
204 | { | 207 | { |
@@ -241,7 +244,7 @@ namespace OpenSim.Services.Connectors | |||
241 | string uri = m_ServerURI + "/grid"; | 244 | string uri = m_ServerURI + "/grid"; |
242 | try | 245 | try |
243 | { | 246 | { |
244 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData)); | 247 | reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth); |
245 | } | 248 | } |
246 | catch (Exception e) | 249 | catch (Exception e) |
247 | { | 250 | { |
@@ -293,7 +296,7 @@ namespace OpenSim.Services.Connectors | |||
293 | { | 296 | { |
294 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 297 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
295 | uri, | 298 | uri, |
296 | ServerUtils.BuildQueryString(sendData)); | 299 | ServerUtils.BuildQueryString(sendData), m_Auth); |
297 | } | 300 | } |
298 | catch (Exception e) | 301 | catch (Exception e) |
299 | { | 302 | { |
@@ -340,7 +343,7 @@ namespace OpenSim.Services.Connectors | |||
340 | { | 343 | { |
341 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 344 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
342 | uri, | 345 | uri, |
343 | ServerUtils.BuildQueryString(sendData)); | 346 | ServerUtils.BuildQueryString(sendData), m_Auth); |
344 | } | 347 | } |
345 | catch (Exception e) | 348 | catch (Exception e) |
346 | { | 349 | { |
@@ -384,7 +387,7 @@ namespace OpenSim.Services.Connectors | |||
384 | { | 387 | { |
385 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 388 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
386 | uri, | 389 | uri, |
387 | ServerUtils.BuildQueryString(sendData)); | 390 | ServerUtils.BuildQueryString(sendData), m_Auth); |
388 | } | 391 | } |
389 | catch (Exception e) | 392 | catch (Exception e) |
390 | { | 393 | { |
@@ -438,7 +441,7 @@ namespace OpenSim.Services.Connectors | |||
438 | { | 441 | { |
439 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 442 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
440 | uri, | 443 | uri, |
441 | ServerUtils.BuildQueryString(sendData)); | 444 | ServerUtils.BuildQueryString(sendData), m_Auth); |
442 | 445 | ||
443 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); | 446 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); |
444 | } | 447 | } |
@@ -489,7 +492,7 @@ namespace OpenSim.Services.Connectors | |||
489 | { | 492 | { |
490 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 493 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
491 | uri, | 494 | uri, |
492 | ServerUtils.BuildQueryString(sendData)); | 495 | ServerUtils.BuildQueryString(sendData), m_Auth); |
493 | 496 | ||
494 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); | 497 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); |
495 | } | 498 | } |
@@ -540,7 +543,7 @@ namespace OpenSim.Services.Connectors | |||
540 | { | 543 | { |
541 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 544 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
542 | uri, | 545 | uri, |
543 | ServerUtils.BuildQueryString(sendData)); | 546 | ServerUtils.BuildQueryString(sendData), m_Auth); |
544 | 547 | ||
545 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); | 548 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); |
546 | } | 549 | } |
@@ -593,7 +596,7 @@ namespace OpenSim.Services.Connectors | |||
593 | { | 596 | { |
594 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 597 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
595 | uri, | 598 | uri, |
596 | ServerUtils.BuildQueryString(sendData)); | 599 | ServerUtils.BuildQueryString(sendData), m_Auth); |
597 | 600 | ||
598 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); | 601 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); |
599 | } | 602 | } |
@@ -644,7 +647,7 @@ namespace OpenSim.Services.Connectors | |||
644 | { | 647 | { |
645 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 648 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
646 | uri, | 649 | uri, |
647 | ServerUtils.BuildQueryString(sendData)); | 650 | ServerUtils.BuildQueryString(sendData), m_Auth); |
648 | 651 | ||
649 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); | 652 | //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); |
650 | } | 653 | } |
@@ -695,7 +698,7 @@ namespace OpenSim.Services.Connectors | |||
695 | { | 698 | { |
696 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 699 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
697 | uri, | 700 | uri, |
698 | ServerUtils.BuildQueryString(sendData)); | 701 | ServerUtils.BuildQueryString(sendData), m_Auth); |
699 | } | 702 | } |
700 | catch (Exception e) | 703 | catch (Exception e) |
701 | { | 704 | { |
@@ -726,6 +729,45 @@ namespace OpenSim.Services.Connectors | |||
726 | return flags; | 729 | return flags; |
727 | } | 730 | } |
728 | 731 | ||
732 | public Dictionary<string, object> GetExtraFeatures() | ||
733 | { | ||
734 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
735 | Dictionary<string, object> extraFeatures = new Dictionary<string, object>(); | ||
736 | |||
737 | sendData["METHOD"] = "get_grid_extra_features"; | ||
738 | |||
739 | string reply = string.Empty; | ||
740 | string uri = m_ServerURI + "/grid"; | ||
741 | |||
742 | try | ||
743 | { | ||
744 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
745 | uri, | ||
746 | ServerUtils.BuildQueryString(sendData), m_Auth); | ||
747 | } | ||
748 | catch (Exception e) | ||
749 | { | ||
750 | m_log.DebugFormat("[GRID CONNECTOR]: GetExtraFeatures - Exception when contacting grid server at {0}: {1}", uri, e.Message); | ||
751 | return extraFeatures; | ||
752 | } | ||
753 | |||
754 | if (reply != string.Empty) | ||
755 | { | ||
756 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
757 | |||
758 | if ((replyData != null) && replyData.Count > 0) | ||
759 | { | ||
760 | foreach (string key in replyData.Keys) | ||
761 | { | ||
762 | extraFeatures[key] = replyData[key].ToString(); | ||
763 | } | ||
764 | } | ||
765 | } | ||
766 | else | ||
767 | m_log.DebugFormat("[GRID CONNECTOR]: GetExtraServiceURLs received null reply"); | ||
768 | |||
769 | return extraFeatures; | ||
770 | } | ||
729 | #endregion | 771 | #endregion |
730 | 772 | ||
731 | } | 773 | } |