aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors/SimianGrid
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/Connectors/SimianGrid')
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs6
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs90
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs5
3 files changed, 100 insertions, 1 deletions
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
index 3bd11d9..c402907 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
@@ -102,6 +102,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
102 m_log.Info("[SIMIAN AUTH CONNECTOR]: No AuthenticationServerURI specified, disabling connector"); 102 m_log.Info("[SIMIAN AUTH CONNECTOR]: No AuthenticationServerURI specified, disabling connector");
103 } 103 }
104 104
105 public string Authenticate(UUID principalID, string password, int lifetime, out UUID realID)
106 {
107 realID = UUID.Zero;
108 return Authenticate(principalID, password, lifetime);
109 }
110
105 public string Authenticate(UUID principalID, string password, int lifetime) 111 public string Authenticate(UUID principalID, string password, int lifetime)
106 { 112 {
107 NameValueCollection requestArgs = new NameValueCollection 113 NameValueCollection requestArgs = new NameValueCollection
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
index c928f16..3cf3416 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
@@ -28,6 +28,8 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Collections.Specialized; 30using System.Collections.Specialized;
31using System.Drawing;
32using System.Drawing.Imaging;
31using System.IO; 33using System.IO;
32using System.Net; 34using System.Net;
33using System.Reflection; 35using System.Reflection;
@@ -100,6 +102,15 @@ namespace OpenSim.Services.Connectors.SimianGrid
100 102
101 public string RegisterRegion(UUID scopeID, GridRegion regionInfo) 103 public string RegisterRegion(UUID scopeID, GridRegion regionInfo)
102 { 104 {
105 IPEndPoint ext = regionInfo.ExternalEndPoint;
106 if (ext == null) return "Region registration for " + regionInfo.RegionName + " failed: Could not resolve EndPoint";
107 // Generate and upload our map tile in PNG format to the SimianGrid AddMapTile service
108// Scene scene;
109// if (m_scenes.TryGetValue(regionInfo.RegionID, out scene))
110// UploadMapTile(scene);
111// else
112// m_log.Warn("Registering region " + regionInfo.RegionName + " (" + regionInfo.RegionID + ") that we are not tracking");
113
103 Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); 114 Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0);
104 Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight); 115 Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight);
105 116
@@ -108,7 +119,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
108 { "ServerURI", OSD.FromString(regionInfo.ServerURI) }, 119 { "ServerURI", OSD.FromString(regionInfo.ServerURI) },
109 { "InternalAddress", OSD.FromString(regionInfo.InternalEndPoint.Address.ToString()) }, 120 { "InternalAddress", OSD.FromString(regionInfo.InternalEndPoint.Address.ToString()) },
110 { "InternalPort", OSD.FromInteger(regionInfo.InternalEndPoint.Port) }, 121 { "InternalPort", OSD.FromInteger(regionInfo.InternalEndPoint.Port) },
111 { "ExternalAddress", OSD.FromString(regionInfo.ExternalEndPoint.Address.ToString()) }, 122 { "ExternalAddress", OSD.FromString(ext.Address.ToString()) },
112 { "ExternalPort", OSD.FromInteger(regionInfo.ExternalEndPoint.Port) }, 123 { "ExternalPort", OSD.FromInteger(regionInfo.ExternalEndPoint.Port) },
113 { "MapTexture", OSD.FromUUID(regionInfo.TerrainImage) }, 124 { "MapTexture", OSD.FromUUID(regionInfo.TerrainImage) },
114 { "Access", OSD.FromInteger(regionInfo.Access) }, 125 { "Access", OSD.FromInteger(regionInfo.Access) },
@@ -405,6 +416,83 @@ namespace OpenSim.Services.Connectors.SimianGrid
405 416
406 #endregion IGridService 417 #endregion IGridService
407 418
419 private void UploadMapTile(IScene scene)
420 {
421 string errorMessage = null;
422
423 // Create a PNG map tile and upload it to the AddMapTile API
424 byte[] pngData = Utils.EmptyBytes;
425 IMapImageGenerator tileGenerator = scene.RequestModuleInterface<IMapImageGenerator>();
426 if (tileGenerator == null)
427 {
428 m_log.Warn("[SIMIAN GRID CONNECTOR]: Cannot upload PNG map tile without an IMapImageGenerator");
429 return;
430 }
431
432 using (Image mapTile = tileGenerator.CreateMapTile())
433 {
434 using (MemoryStream stream = new MemoryStream())
435 {
436 mapTile.Save(stream, ImageFormat.Png);
437 pngData = stream.ToArray();
438 }
439 }
440
441 List<MultipartForm.Element> postParameters = new List<MultipartForm.Element>()
442 {
443 new MultipartForm.Parameter("X", scene.RegionInfo.RegionLocX.ToString()),
444 new MultipartForm.Parameter("Y", scene.RegionInfo.RegionLocY.ToString()),
445 new MultipartForm.File("Tile", "tile.png", "image/png", pngData)
446 };
447
448 // Make the remote storage request
449 try
450 {
451 HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI);
452
453 HttpWebResponse response = MultipartForm.Post(request, postParameters);
454 using (Stream responseStream = response.GetResponseStream())
455 {
456 string responseStr = null;
457
458 try
459 {
460 responseStr = responseStream.GetStreamString();
461 OSD responseOSD = OSDParser.Deserialize(responseStr);
462 if (responseOSD.Type == OSDType.Map)
463 {
464 OSDMap responseMap = (OSDMap)responseOSD;
465 if (responseMap["Success"].AsBoolean())
466 m_log.Info("[SIMIAN GRID CONNECTOR]: Uploaded " + pngData.Length + " byte PNG map tile to AddMapTile");
467 else
468 errorMessage = "Upload failed: " + responseMap["Message"].AsString();
469 }
470 else
471 {
472 errorMessage = "Response format was invalid:\n" + responseStr;
473 }
474 }
475 catch (Exception ex)
476 {
477 if (!String.IsNullOrEmpty(responseStr))
478 errorMessage = "Failed to parse the response:\n" + responseStr;
479 else
480 errorMessage = "Failed to retrieve the response: " + ex.Message;
481 }
482 }
483 }
484 catch (WebException ex)
485 {
486 errorMessage = ex.Message;
487 }
488
489 if (!String.IsNullOrEmpty(errorMessage))
490 {
491 m_log.WarnFormat("[SIMIAN GRID CONNECTOR]: Failed to store {0} byte PNG map tile for {1}: {2}",
492 pngData.Length, scene.RegionInfo.RegionName, errorMessage.Replace('\n', ' '));
493 }
494 }
495
408 private GridRegion GetNearestRegion(Vector3d position, bool onlyEnabled) 496 private GridRegion GetNearestRegion(Vector3d position, bool onlyEnabled)
409 { 497 {
410 NameValueCollection requestArgs = new NameValueCollection 498 NameValueCollection requestArgs = new NameValueCollection
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
index 7e36c69..fdc8697 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
@@ -191,6 +191,11 @@ namespace OpenSim.Services.Connectors.SimianGrid
191 return accounts; 191 return accounts;
192 } 192 }
193 193
194 public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string query)
195 {
196 return null;
197 }
198
194 public bool StoreUserAccount(UserAccount data) 199 public bool StoreUserAccount(UserAccount data)
195 { 200 {
196// m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Storing user account for " + data.Name); 201// m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Storing user account for " + data.Name);