From 1a16a92a62069a50efd618b8fd6cbc0d530c7654 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 11 Jun 2010 21:18:09 +0100
Subject: create inactive test for iar folders/items merged with existing paths
add various helper functions for simplifying test readability
---
.../Archiver/InventoryArchiveReadRequest.cs | 34 ---------------
.../Archiver/Tests/InventoryArchiverTests.cs | 50 +++++++++++++++++++++-
OpenSim/Tests/Common/Setup/AssetHelpers.cs | 46 ++++++++++++++------
.../Tests/Common/Setup/UserInventoryTestUtils.cs | 18 ++++++++
4 files changed, 100 insertions(+), 48 deletions(-)
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 60d1720..b4f1ed6 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -219,40 +219,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
CreateFoldersForPath(destFolder, archivePathSectionToCreate, resolvedFolders, loadedNodes);
return destFolder;
-
- /*
- string[] rawFolders = filePath.Split(new char[] { '/' });
-
- // Find the folders that do exist along the path given
- int i = 0;
- bool noFolder = false;
- InventoryFolderImpl foundFolder = rootDestinationFolder;
- while (!noFolder && i < rawFolders.Length)
- {
- InventoryFolderImpl folder = foundFolder.FindFolderByPath(rawFolders[i]);
- if (null != folder)
- {
- m_log.DebugFormat("[INVENTORY ARCHIVER]: Found folder {0}", folder.Name);
- foundFolder = folder;
- i++;
- }
- else
- {
- noFolder = true;
- }
- }
-
- // Create any folders that did not previously exist
- while (i < rawFolders.Length)
- {
- m_log.DebugFormat("[INVENTORY ARCHIVER]: Creating folder {0}", rawFolders[i]);
-
- UUID newFolderId = UUID.Random();
- m_userInfo.CreateFolder(
- rawFolders[i++], newFolderId, (ushort)AssetType.Folder, foundFolder.ID);
- foundFolder = foundFolder.GetChildFolder(newFolderId);
- }
- */
}
///
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index 59cd386..00bd27a 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -279,7 +279,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
public void TestIarV0_1WithEscapedChars()
{
TestHelper.InMethod();
- log4net.Config.XmlConfigurator.Configure();
+// log4net.Config.XmlConfigurator.Configure();
string itemName = "You & you are a mean/man/";
string humanEscapedItemName = @"You & you are a mean\/man\/";
@@ -505,7 +505,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
/// Test replication of an archive path to the user's inventory.
///
[Test]
- public void TestReplicateArchivePathToUserInventory()
+ public void TestNewIarPath()
{
TestHelper.InMethod();
//log4net.Config.XmlConfigurator.Configure();
@@ -540,5 +540,51 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
InventoryFolderBase folder2 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, "b");
Assert.That(folder2, Is.Not.Null, "Could not find folder b");
}
+
+ ///
+ /// Test replication of a partly existing archive path to the user's inventory.
+ ///
+ [Test]
+ public void TestPartExistingIarPath()
+ {
+ TestHelper.InMethod();
+ //log4net.Config.XmlConfigurator.Configure();
+
+ Scene scene = SceneSetupHelpers.SetupScene("inventory");
+ UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
+
+ string folder1ExistingName = "a";
+ string folder2Name = "b";
+ string itemName = "c.lsl";
+
+ InventoryFolderBase folder1
+ = UserInventoryTestUtils.CreateInventoryFolder(
+ scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
+
+ string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
+ string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
+ string itemArchiveName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random());
+
+ string itemArchivePath
+ = string.Format(
+ "{0}{1}{2}{3}",
+ ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemArchiveName);
+
+ new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null)
+ .ReplicateArchivePathToUserInventory(
+ itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
+ new Dictionary(), new List());
+
+ InventoryFolderBase folder1Post
+ = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
+ Assert.That(folder1Post.ID, Is.EqualTo(folder1.ID));
+ /*
+ InventoryFolderBase folder2
+ = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1Post, "b");
+ Assert.That(folder2, Is.Not.Null);
+ InventoryItemBase item = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, folder2, itemName);
+ Assert.That(item, Is.Not.Null);
+ */
+ }
}
}
\ No newline at end of file
diff --git a/OpenSim/Tests/Common/Setup/AssetHelpers.cs b/OpenSim/Tests/Common/Setup/AssetHelpers.cs
index 6dc993f..f9a80b0 100644
--- a/OpenSim/Tests/Common/Setup/AssetHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/AssetHelpers.cs
@@ -36,25 +36,29 @@ namespace OpenSim.Tests.Common
public class AssetHelpers
{
///
- /// Create an asset from the given data
+ /// Create a notecard asset with a random uuid and dummy text.
///
- public static AssetBase CreateAsset(UUID assetUuid, AssetType assetType, byte[] data, UUID creatorID)
+ /// /param>
+ ///
+ public static AssetBase CreateAsset(UUID creatorId)
{
- AssetBase asset = new AssetBase(assetUuid, assetUuid.ToString(), (sbyte)assetType, creatorID.ToString());
- asset.Data = data;
- return asset;
+ return CreateAsset(UUID.Random(), AssetType.Notecard, "hello", creatorId);
}
-
+
///
- /// Create an asset from the given data
+ /// Create and store a notecard asset with a random uuid and dummy text.
///
- public static AssetBase CreateAsset(UUID assetUuid, AssetType assetType, string data, UUID creatorID)
+ /// /param>
+ ///
+ public static AssetBase CreateAsset(Scene scene, UUID creatorId)
{
- return CreateAsset(assetUuid, assetType, Encoding.ASCII.GetBytes(data), creatorID);
- }
-
+ AssetBase asset = CreateAsset(UUID.Random(), AssetType.Notecard, "hello", creatorId);
+ scene.AssetService.Store(asset);
+ return asset;
+ }
+
///
- /// Create an asset from the given scene object
+ /// Create an asset from the given scene object.
///
///
///
@@ -67,5 +71,23 @@ namespace OpenSim.Tests.Common
Encoding.ASCII.GetBytes(SceneObjectSerializer.ToXml2Format(sog)),
sog.OwnerID);
}
+
+ ///
+ /// Create an asset from the given data.
+ ///
+ public static AssetBase CreateAsset(UUID assetUuid, AssetType assetType, string data, UUID creatorID)
+ {
+ return CreateAsset(assetUuid, assetType, Encoding.ASCII.GetBytes(data), creatorID);
+ }
+
+ ///
+ /// Create an asset from the given data.
+ ///
+ public static AssetBase CreateAsset(UUID assetUuid, AssetType assetType, byte[] data, UUID creatorID)
+ {
+ AssetBase asset = new AssetBase(assetUuid, assetUuid.ToString(), (sbyte)assetType, creatorID.ToString());
+ asset.Data = data;
+ return asset;
+ }
}
}
diff --git a/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs b/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs
index 7e0c567..c57363a 100644
--- a/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs
+++ b/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs
@@ -28,6 +28,7 @@
using System;
using OpenMetaverse;
using OpenSim.Framework;
+using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
namespace OpenSim.Tests.Common
@@ -39,6 +40,23 @@ namespace OpenSim.Tests.Common
{
public static readonly string PATH_DELIMITER = "/";
+ public static InventoryItemBase CreateInventoryItem(
+ Scene scene, string itemName, UUID itemId, string folderPath, UUID userId)
+ {
+ InventoryItemBase item = new InventoryItemBase();
+ item.Name = itemName;
+ item.AssetID = AssetHelpers.CreateAsset(scene, userId).FullID;
+ item.ID = itemId;
+
+ // Really quite bad since the objs folder could be moved in the future and confuse the tests
+ InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object);
+
+ item.Folder = objsFolder.ID;
+ scene.AddInventoryItem(userId, item);
+
+ return item;
+ }
+
///
/// Create inventory folders starting from the user's root folder.
///
--
cgit v1.1
From 3525195bc9b5fdfd9799411edd452981ef1f4ebd Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 11 Jun 2010 21:52:43 +0100
Subject: Allow IInventoryService.GetFolder(folderId, userId) as well as
GetFolder(InventoryFolderBase folder)
This involves no wire changes since the methods often just construct an InventoryFolderBase under the hood.
This is in line with other methods that alraedy allow requests via uuid
---
.../Inventory/Archiver/Tests/InventoryArchiverTests.cs | 4 ++--
.../Framework/Library/LocalInventoryService.cs | 6 ++++--
.../Inventory/BaseInventoryConnector.cs | 2 ++
.../ServiceConnectorsOut/Inventory/HGInventoryBroker.cs | 15 ++++++++++-----
.../Inventory/LocalInventoryServiceConnector.cs | 5 +++++
.../Inventory/RemoteInventoryServiceConnector.cs | 5 +++++
.../Inventory/RemoteXInventoryServiceConnector.cs | 17 +++++++++++------
.../Inventory/QuickAndDirtyInventoryServiceConnector.cs | 5 +++++
.../Connectors/Inventory/XInventoryConnector.cs | 5 +++++
.../SimianGrid/SimianInventoryServiceConnector.cs | 7 ++++++-
OpenSim/Services/Interfaces/IInventoryService.cs | 8 ++++++++
OpenSim/Services/InventoryService/InventoryService.cs | 17 +++++++++++------
OpenSim/Services/InventoryService/XInventoryService.cs | 5 +++++
OpenSim/Tests/Common/Mock/MockInventoryService.cs | 5 +++++
14 files changed, 84 insertions(+), 22 deletions(-)
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index 00bd27a..d003d2d 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -575,9 +575,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
new Dictionary(), new List());
- InventoryFolderBase folder1Post
- = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
+ InventoryFolderBase folder1Post = scene.InventoryService.GetFolder(folder1.ID, ua1.PrincipalID);
Assert.That(folder1Post.ID, Is.EqualTo(folder1.ID));
+
/*
InventoryFolderBase folder2
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1Post, "b");
diff --git a/OpenSim/Region/CoreModules/Framework/Library/LocalInventoryService.cs b/OpenSim/Region/CoreModules/Framework/Library/LocalInventoryService.cs
index 49589fd..112ccd8 100644
--- a/OpenSim/Region/CoreModules/Framework/Library/LocalInventoryService.cs
+++ b/OpenSim/Region/CoreModules/Framework/Library/LocalInventoryService.cs
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
@@ -229,12 +229,14 @@ namespace OpenSim.Region.CoreModules.Framework.Library
///
public InventoryItemBase GetItem(InventoryItemBase item) { return null; }
+ public InventoryFolderBase GetFolder(UUID folderId, UUID userId) { return null; }
+
///
/// Get a folder, given by its UUID
///
///
///
- public InventoryFolderBase GetFolder(InventoryFolderBase folder) { return null; }
+ public InventoryFolderBase GetFolder(InventoryFolderBase folder) { return null; }
///
/// Does the given user have an inventory structure?
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
index 1e51187..5b13d58 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
@@ -205,6 +205,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
public abstract InventoryItemBase GetItem(InventoryItemBase item);
+ public abstract InventoryFolderBase GetFolder(UUID folderId, UUID userId);
+
public abstract InventoryFolderBase GetFolder(InventoryFolderBase folder);
///
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index e09db15..fc30347 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
@@ -470,7 +470,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return connector.DeleteItems(ownerID, itemIDs);
}
- public InventoryItemBase GetItem(InventoryItemBase item)
+ public InventoryItemBase GetItem(InventoryItemBase item)
{
if (item == null)
return null;
@@ -486,7 +486,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return connector.GetItem(item);
}
- public InventoryFolderBase GetFolder(InventoryFolderBase folder)
+ public InventoryFolderBase GetFolder(UUID folderId, UUID userId)
+ {
+ return GetFolder(new InventoryFolderBase(folderId, userId));
+ }
+
+ public InventoryFolderBase GetFolder(InventoryFolderBase folder)
{
if (folder == null)
return null;
@@ -503,12 +508,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return connector.GetFolder(folder);
}
- public bool HasInventoryForUser(UUID userID)
+ public bool HasInventoryForUser(UUID userID)
{
return false;
}
- public List GetActiveGestures(UUID userId)
+ public List GetActiveGestures(UUID userId)
{
return new List();
}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
index 22bd04c..76be791 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
@@ -267,6 +267,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return item;
}
+ public InventoryFolderBase GetFolder(UUID folderId, UUID userId)
+ {
+ return GetFolder(new InventoryFolderBase(folderId, userId));
+ }
+
public InventoryFolderBase GetFolder(InventoryFolderBase folder)
{
return m_InventoryService.GetFolder(folder);
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
index aa3b30d..6d43280 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
@@ -307,6 +307,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_RemoteConnector.QueryItem(item.Owner.ToString(), item, sessionID);
}
+ public override InventoryFolderBase GetFolder(UUID folderId, UUID userId)
+ {
+ return GetFolder(new InventoryFolderBase(folderId, userId));
+ }
+
public override InventoryFolderBase GetFolder(InventoryFolderBase folder)
{
if (folder == null)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
index 277060d..b1e21a1 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
@@ -250,7 +250,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
}
- public bool DeleteItems(UUID ownerID, List itemIDs)
+ public bool DeleteItems(UUID ownerID, List itemIDs)
{
if (itemIDs == null)
return false;
@@ -260,7 +260,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_RemoteConnector.DeleteItems(ownerID, itemIDs);
}
- public InventoryItemBase GetItem(InventoryItemBase item)
+ public InventoryItemBase GetItem(InventoryItemBase item)
{
m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetItem {0}", item.ID);
if (item == null)
@@ -271,7 +271,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_RemoteConnector.GetItem(item);
}
- public InventoryFolderBase GetFolder(InventoryFolderBase folder)
+ public InventoryFolderBase GetFolder(UUID folderId, UUID userId)
+ {
+ return GetFolder(new InventoryFolderBase(folderId, userId));
+ }
+
+ public InventoryFolderBase GetFolder(InventoryFolderBase folder)
{
m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetFolder {0}", folder.ID);
if (folder == null)
@@ -280,17 +285,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_RemoteConnector.GetFolder(folder);
}
- public bool HasInventoryForUser(UUID userID)
+ public bool HasInventoryForUser(UUID userID)
{
return false;
}
- public List GetActiveGestures(UUID userId)
+ public List GetActiveGestures(UUID userId)
{
return new List();
}
- public int GetAssetPermissions(UUID userID, UUID assetID)
+ public int GetAssetPermissions(UUID userID, UUID assetID)
{
return m_RemoteConnector.GetAssetPermissions(userID, assetID);
}
diff --git a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs
index a7aa138..5a23687 100644
--- a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs
@@ -171,6 +171,11 @@ namespace OpenSim.Services.Connectors
{
return null;
}
+
+ public InventoryFolderBase GetFolder(UUID folderId, UUID userId)
+ {
+ return null;
+ }
public InventoryFolderBase GetFolder(InventoryFolderBase folder)
{
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
index e25e7eb..e7acb59 100644
--- a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
@@ -431,6 +431,11 @@ namespace OpenSim.Services.Connectors
return null;
}
+ public InventoryFolderBase GetFolder(UUID folderId, UUID userId)
+ {
+ return GetFolder(new InventoryFolderBase(folderId, userId));
+ }
+
public InventoryFolderBase GetFolder(InventoryFolderBase folder)
{
try
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
index dc68259..6bf43d5 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
@@ -314,6 +314,11 @@ namespace OpenSim.Services.Connectors.SimianGrid
m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Item " + item.ID + " owned by " + item.Owner + " not found");
return null;
}
+
+ public InventoryFolderBase GetFolder(UUID folderId, UUID userId)
+ {
+ return GetFolder(new InventoryFolderBase(folderId, userId));
+ }
///
/// Get a folder, given by its UUID
diff --git a/OpenSim/Services/Interfaces/IInventoryService.cs b/OpenSim/Services/Interfaces/IInventoryService.cs
index 1b78fb3..b0ffd8f 100644
--- a/OpenSim/Services/Interfaces/IInventoryService.cs
+++ b/OpenSim/Services/Interfaces/IInventoryService.cs
@@ -170,6 +170,14 @@ namespace OpenSim.Services.Interfaces
InventoryItemBase GetItem(InventoryItemBase item);
///
+ /// Get a folder.
+ ///
+ ///
+ ///
+ ///
+ InventoryFolderBase GetFolder(UUID folderId, UUID userId);
+
+ ///
/// Get a folder, given by its UUID
///
///
diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs
index fbcd663..9f1c4a4 100644
--- a/OpenSim/Services/InventoryService/InventoryService.cs
+++ b/OpenSim/Services/InventoryService/InventoryService.cs
@@ -439,15 +439,20 @@ namespace OpenSim.Services.InventoryService
m_log.DebugFormat("[INVENTORY SERVICE]: GetItem failed to find item {0}", item.ID);
return null;
}
-
- public virtual InventoryFolderBase GetFolder(InventoryFolderBase folder)
- {
- InventoryFolderBase result = m_Database.getInventoryFolder(folder.ID);
+
+ public virtual InventoryFolderBase GetFolder(UUID folderId, UUID userId)
+ {
+ InventoryFolderBase result = m_Database.getInventoryFolder(folderId);
if (result != null)
return result;
- m_log.DebugFormat("[INVENTORY SERVICE]: GetFolder failed to find folder {0}", folder.ID);
- return null;
+ m_log.DebugFormat("[INVENTORY SERVICE]: GetFolder failed to find folder {0}", folderId);
+ return null;
+ }
+
+ public virtual InventoryFolderBase GetFolder(InventoryFolderBase folder)
+ {
+ return GetFolder(folder.ID, folder.Owner);
}
public virtual bool DeleteFolders(UUID ownerID, List folderIDs)
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs
index af831fd..00aadc5 100644
--- a/OpenSim/Services/InventoryService/XInventoryService.cs
+++ b/OpenSim/Services/InventoryService/XInventoryService.cs
@@ -368,6 +368,11 @@ namespace OpenSim.Services.InventoryService
return ConvertToOpenSim(items[0]);
}
+
+ public virtual InventoryFolderBase GetFolder(UUID folderId, UUID userId)
+ {
+ return GetFolder(new InventoryFolderBase(folderId, userId));
+ }
public virtual InventoryFolderBase GetFolder(InventoryFolderBase folder)
{
diff --git a/OpenSim/Tests/Common/Mock/MockInventoryService.cs b/OpenSim/Tests/Common/Mock/MockInventoryService.cs
index 1ea4bc1..fc27487 100644
--- a/OpenSim/Tests/Common/Mock/MockInventoryService.cs
+++ b/OpenSim/Tests/Common/Mock/MockInventoryService.cs
@@ -162,6 +162,11 @@ namespace OpenSim.Tests.Common.Mock
{
return null;
}
+
+ public InventoryFolderBase GetFolder(UUID folderId, UUID userId)
+ {
+ return null;
+ }
public InventoryFolderBase GetFolder(InventoryFolderBase folder)
{
--
cgit v1.1
From 694c8ab588b1d9a94c1cdba5e05ef4e0492f0354 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Fri, 11 Jun 2010 22:08:43 +0100
Subject: Remove the lastmap stuff from the map module, also remove a bunch of
comments that no longer reflect actual conditions
---
.../CoreModules/World/WorldMap/WorldMapModule.cs | 28 +---------------------
1 file changed, 1 insertion(+), 27 deletions(-)
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index c6fb18d..0e849e5 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -1002,41 +1002,15 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
public void RegenerateMaptile(byte[] data)
{
- // Overwrites the local Asset cache with new maptile data
- // Assets are single write, this causes the asset server to ignore this update,
- // but the local asset cache does not
-
- // this is on purpose! The net result of this is the region always has the most up to date
- // map tile while protecting the (grid) asset database from bloat caused by a new asset each
- // time a mapimage is generated!
-
UUID lastMapRegionUUID = m_scene.RegionInfo.RegionSettings.TerrainImageID;
- int lastMapRefresh = 0;
- int twoDays = 172800;
-// int RefreshSeconds = twoDays;
-
- try
- {
- lastMapRefresh = Convert.ToInt32(m_scene.RegionInfo.lastMapRefresh);
- }
- catch (ArgumentException)
- {
- }
- catch (FormatException)
- {
- }
- catch (OverflowException)
- {
- }
-
m_log.Debug("[MAPTILE]: STORING MAPTILE IMAGE");
m_scene.RegionInfo.RegionSettings.TerrainImageID = UUID.Random();
AssetBase asset = new AssetBase(
m_scene.RegionInfo.RegionSettings.TerrainImageID,
- "terrainImage_" + m_scene.RegionInfo.RegionID.ToString() + "_" + lastMapRefresh.ToString(),
+ "terrainImage_" + m_scene.RegionInfo.RegionID.ToString(),
(sbyte)AssetType.Texture,
m_scene.RegionInfo.RegionID.ToString());
asset.Data = data;
--
cgit v1.1
From 0dce4f1997c57cbdf6bc1f322182c318d3838e40 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 11 Jun 2010 22:11:33 +0100
Subject: Revert "Allow IInventoryService.GetFolder(folderId, userId) as well
as GetFolder(InventoryFolderBase folder)"
This reverts commit 3525195bc9b5fdfd9799411edd452981ef1f4ebd.
---
.../Inventory/Archiver/Tests/InventoryArchiverTests.cs | 4 ++--
.../Framework/Library/LocalInventoryService.cs | 6 ++----
.../Inventory/BaseInventoryConnector.cs | 2 --
.../ServiceConnectorsOut/Inventory/HGInventoryBroker.cs | 15 +++++----------
.../Inventory/LocalInventoryServiceConnector.cs | 5 -----
.../Inventory/RemoteInventoryServiceConnector.cs | 5 -----
.../Inventory/RemoteXInventoryServiceConnector.cs | 17 ++++++-----------
.../Inventory/QuickAndDirtyInventoryServiceConnector.cs | 5 -----
.../Connectors/Inventory/XInventoryConnector.cs | 5 -----
.../SimianGrid/SimianInventoryServiceConnector.cs | 7 +------
OpenSim/Services/Interfaces/IInventoryService.cs | 8 --------
OpenSim/Services/InventoryService/InventoryService.cs | 17 ++++++-----------
OpenSim/Services/InventoryService/XInventoryService.cs | 5 -----
OpenSim/Tests/Common/Mock/MockInventoryService.cs | 5 -----
14 files changed, 22 insertions(+), 84 deletions(-)
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index d003d2d..00bd27a 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -575,9 +575,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
new Dictionary(), new List());
- InventoryFolderBase folder1Post = scene.InventoryService.GetFolder(folder1.ID, ua1.PrincipalID);
+ InventoryFolderBase folder1Post
+ = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
Assert.That(folder1Post.ID, Is.EqualTo(folder1.ID));
-
/*
InventoryFolderBase folder2
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1Post, "b");
diff --git a/OpenSim/Region/CoreModules/Framework/Library/LocalInventoryService.cs b/OpenSim/Region/CoreModules/Framework/Library/LocalInventoryService.cs
index 112ccd8..49589fd 100644
--- a/OpenSim/Region/CoreModules/Framework/Library/LocalInventoryService.cs
+++ b/OpenSim/Region/CoreModules/Framework/Library/LocalInventoryService.cs
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
@@ -229,14 +229,12 @@ namespace OpenSim.Region.CoreModules.Framework.Library
///
public InventoryItemBase GetItem(InventoryItemBase item) { return null; }
- public InventoryFolderBase GetFolder(UUID folderId, UUID userId) { return null; }
-
///
/// Get a folder, given by its UUID
///
///
///
- public InventoryFolderBase GetFolder(InventoryFolderBase folder) { return null; }
+ public InventoryFolderBase GetFolder(InventoryFolderBase folder) { return null; }
///
/// Does the given user have an inventory structure?
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
index 5b13d58..1e51187 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
@@ -205,8 +205,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
public abstract InventoryItemBase GetItem(InventoryItemBase item);
- public abstract InventoryFolderBase GetFolder(UUID folderId, UUID userId);
-
public abstract InventoryFolderBase GetFolder(InventoryFolderBase folder);
///
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index fc30347..e09db15 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
@@ -470,7 +470,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return connector.DeleteItems(ownerID, itemIDs);
}
- public InventoryItemBase GetItem(InventoryItemBase item)
+ public InventoryItemBase GetItem(InventoryItemBase item)
{
if (item == null)
return null;
@@ -486,12 +486,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return connector.GetItem(item);
}
- public InventoryFolderBase GetFolder(UUID folderId, UUID userId)
- {
- return GetFolder(new InventoryFolderBase(folderId, userId));
- }
-
- public InventoryFolderBase GetFolder(InventoryFolderBase folder)
+ public InventoryFolderBase GetFolder(InventoryFolderBase folder)
{
if (folder == null)
return null;
@@ -508,12 +503,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return connector.GetFolder(folder);
}
- public bool HasInventoryForUser(UUID userID)
+ public bool HasInventoryForUser(UUID userID)
{
return false;
}
- public List GetActiveGestures(UUID userId)
+ public List GetActiveGestures(UUID userId)
{
return new List();
}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
index 76be791..22bd04c 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
@@ -267,11 +267,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return item;
}
- public InventoryFolderBase GetFolder(UUID folderId, UUID userId)
- {
- return GetFolder(new InventoryFolderBase(folderId, userId));
- }
-
public InventoryFolderBase GetFolder(InventoryFolderBase folder)
{
return m_InventoryService.GetFolder(folder);
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
index 6d43280..aa3b30d 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
@@ -307,11 +307,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_RemoteConnector.QueryItem(item.Owner.ToString(), item, sessionID);
}
- public override InventoryFolderBase GetFolder(UUID folderId, UUID userId)
- {
- return GetFolder(new InventoryFolderBase(folderId, userId));
- }
-
public override InventoryFolderBase GetFolder(InventoryFolderBase folder)
{
if (folder == null)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
index b1e21a1..277060d 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
@@ -250,7 +250,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
}
- public bool DeleteItems(UUID ownerID, List itemIDs)
+ public bool DeleteItems(UUID ownerID, List itemIDs)
{
if (itemIDs == null)
return false;
@@ -260,7 +260,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_RemoteConnector.DeleteItems(ownerID, itemIDs);
}
- public InventoryItemBase GetItem(InventoryItemBase item)
+ public InventoryItemBase GetItem(InventoryItemBase item)
{
m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetItem {0}", item.ID);
if (item == null)
@@ -271,12 +271,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_RemoteConnector.GetItem(item);
}
- public InventoryFolderBase GetFolder(UUID folderId, UUID userId)
- {
- return GetFolder(new InventoryFolderBase(folderId, userId));
- }
-
- public InventoryFolderBase GetFolder(InventoryFolderBase folder)
+ public InventoryFolderBase GetFolder(InventoryFolderBase folder)
{
m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetFolder {0}", folder.ID);
if (folder == null)
@@ -285,17 +280,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_RemoteConnector.GetFolder(folder);
}
- public bool HasInventoryForUser(UUID userID)
+ public bool HasInventoryForUser(UUID userID)
{
return false;
}
- public List GetActiveGestures(UUID userId)
+ public List GetActiveGestures(UUID userId)
{
return new List();
}
- public int GetAssetPermissions(UUID userID, UUID assetID)
+ public int GetAssetPermissions(UUID userID, UUID assetID)
{
return m_RemoteConnector.GetAssetPermissions(userID, assetID);
}
diff --git a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs
index 5a23687..a7aa138 100644
--- a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs
@@ -171,11 +171,6 @@ namespace OpenSim.Services.Connectors
{
return null;
}
-
- public InventoryFolderBase GetFolder(UUID folderId, UUID userId)
- {
- return null;
- }
public InventoryFolderBase GetFolder(InventoryFolderBase folder)
{
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
index e7acb59..e25e7eb 100644
--- a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
@@ -431,11 +431,6 @@ namespace OpenSim.Services.Connectors
return null;
}
- public InventoryFolderBase GetFolder(UUID folderId, UUID userId)
- {
- return GetFolder(new InventoryFolderBase(folderId, userId));
- }
-
public InventoryFolderBase GetFolder(InventoryFolderBase folder)
{
try
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
index 6bf43d5..dc68259 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
@@ -314,11 +314,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Item " + item.ID + " owned by " + item.Owner + " not found");
return null;
}
-
- public InventoryFolderBase GetFolder(UUID folderId, UUID userId)
- {
- return GetFolder(new InventoryFolderBase(folderId, userId));
- }
///
/// Get a folder, given by its UUID
diff --git a/OpenSim/Services/Interfaces/IInventoryService.cs b/OpenSim/Services/Interfaces/IInventoryService.cs
index b0ffd8f..1b78fb3 100644
--- a/OpenSim/Services/Interfaces/IInventoryService.cs
+++ b/OpenSim/Services/Interfaces/IInventoryService.cs
@@ -170,14 +170,6 @@ namespace OpenSim.Services.Interfaces
InventoryItemBase GetItem(InventoryItemBase item);
///
- /// Get a folder.
- ///
- ///
- ///
- ///
- InventoryFolderBase GetFolder(UUID folderId, UUID userId);
-
- ///
/// Get a folder, given by its UUID
///
///
diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs
index 9f1c4a4..fbcd663 100644
--- a/OpenSim/Services/InventoryService/InventoryService.cs
+++ b/OpenSim/Services/InventoryService/InventoryService.cs
@@ -439,20 +439,15 @@ namespace OpenSim.Services.InventoryService
m_log.DebugFormat("[INVENTORY SERVICE]: GetItem failed to find item {0}", item.ID);
return null;
}
-
- public virtual InventoryFolderBase GetFolder(UUID folderId, UUID userId)
- {
- InventoryFolderBase result = m_Database.getInventoryFolder(folderId);
- if (result != null)
- return result;
-
- m_log.DebugFormat("[INVENTORY SERVICE]: GetFolder failed to find folder {0}", folderId);
- return null;
- }
public virtual InventoryFolderBase GetFolder(InventoryFolderBase folder)
{
- return GetFolder(folder.ID, folder.Owner);
+ InventoryFolderBase result = m_Database.getInventoryFolder(folder.ID);
+ if (result != null)
+ return result;
+
+ m_log.DebugFormat("[INVENTORY SERVICE]: GetFolder failed to find folder {0}", folder.ID);
+ return null;
}
public virtual bool DeleteFolders(UUID ownerID, List folderIDs)
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs
index 00aadc5..af831fd 100644
--- a/OpenSim/Services/InventoryService/XInventoryService.cs
+++ b/OpenSim/Services/InventoryService/XInventoryService.cs
@@ -368,11 +368,6 @@ namespace OpenSim.Services.InventoryService
return ConvertToOpenSim(items[0]);
}
-
- public virtual InventoryFolderBase GetFolder(UUID folderId, UUID userId)
- {
- return GetFolder(new InventoryFolderBase(folderId, userId));
- }
public virtual InventoryFolderBase GetFolder(InventoryFolderBase folder)
{
diff --git a/OpenSim/Tests/Common/Mock/MockInventoryService.cs b/OpenSim/Tests/Common/Mock/MockInventoryService.cs
index fc27487..1ea4bc1 100644
--- a/OpenSim/Tests/Common/Mock/MockInventoryService.cs
+++ b/OpenSim/Tests/Common/Mock/MockInventoryService.cs
@@ -162,11 +162,6 @@ namespace OpenSim.Tests.Common.Mock
{
return null;
}
-
- public InventoryFolderBase GetFolder(UUID folderId, UUID userId)
- {
- return null;
- }
public InventoryFolderBase GetFolder(InventoryFolderBase folder)
{
--
cgit v1.1
From d1a324888be2a0db247999928dff12d0bb62cddd Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Fri, 11 Jun 2010 15:37:25 -0700
Subject: * Added a new method to IMapImageGenerator for getting the map tile
before it is JPEG2000 compressed * Aesthetically improved map tile water *
SimianGrid connector now uploads a PNG tile to the AddMapTile API
---
.../CoreModules/World/WorldMap/MapImageModule.cs | 50 ++++++-------
.../World/WorldMap/ShadedMapTileRenderer.cs | 5 +-
.../World/WorldMap/TexturedMapTileRenderer.cs | 5 +-
OpenSim/Region/Framework/Interfaces/ITerrain.cs | 1 +
.../SimianGrid/SimianGridServiceConnector.cs | 84 +++++++++++++++++++++-
5 files changed, 114 insertions(+), 31 deletions(-)
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
index b71b5f6..b96d95a 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
@@ -70,10 +70,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
#region IMapImageGenerator Members
- public byte[] WriteJpeg2000Image(string gradientmap)
+ public Bitmap CreateMapTile(string gradientmap)
{
- byte[] imageData = null;
-
bool drawPrimVolume = true;
bool textureTerrain = false;
@@ -98,32 +96,36 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
}
terrainRenderer.Initialise(m_scene, m_config);
- using (Bitmap mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize))
- {
- //long t = System.Environment.TickCount;
- //for (int i = 0; i < 10; ++i) {
- terrainRenderer.TerrainToBitmap(mapbmp);
- //}
- //t = System.Environment.TickCount - t;
- //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t);
+ Bitmap mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
+ //long t = System.Environment.TickCount;
+ //for (int i = 0; i < 10; ++i) {
+ terrainRenderer.TerrainToBitmap(mapbmp);
+ //}
+ //t = System.Environment.TickCount - t;
+ //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t);
- if (drawPrimVolume)
- {
- DrawObjectVolume(m_scene, mapbmp);
- }
+ if (drawPrimVolume)
+ {
+ DrawObjectVolume(m_scene, mapbmp);
+ }
- try
- {
- imageData = OpenJPEG.EncodeFromImage(mapbmp, true);
- }
- catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke
- {
- m_log.Error("Failed generating terrain map: " + e);
- }
+ return mapbmp;
+ }
+
+ public byte[] WriteJpeg2000Image(string gradientmap)
+ {
+ try
+ {
+ using (Bitmap mapbmp = CreateMapTile(gradientmap))
+ return OpenJPEG.EncodeFromImage(mapbmp, true);
+ }
+ catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke
+ {
+ m_log.Error("Failed generating terrain map: " + e);
}
- return imageData;
+ return null;
}
#endregion
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/ShadedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/WorldMap/ShadedMapTileRenderer.cs
index a297cf3..fef2ef3 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/ShadedMapTileRenderer.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/ShadedMapTileRenderer.cs
@@ -37,6 +37,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
{
public class ShadedMapTileRenderer : IMapTileTerrainRenderer
{
+ private static readonly Color WATER_COLOR = Color.FromArgb(29, 71, 95);
+
private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -221,8 +223,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
try
{
- Color water = Color.FromArgb((int)heightvalue, (int)heightvalue, 255);
- mapbmp.SetPixel(x, yr, water);
+ mapbmp.SetPixel(x, yr, WATER_COLOR);
}
catch (ArgumentException)
{
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/TexturedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/WorldMap/TexturedMapTileRenderer.cs
index 4ecad74..8b34f6e 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/TexturedMapTileRenderer.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/TexturedMapTileRenderer.cs
@@ -136,6 +136,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
private static readonly UUID defaultTerrainTexture4 = new UUID("53a2f406-4895-1d13-d541-d2e3b86bc19c");
private static readonly Color defaultColor4 = Color.FromArgb(200, 200, 200);
+ private static readonly Color WATER_COLOR = Color.FromArgb(29, 71, 95);
+
#endregion
@@ -406,8 +408,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
heightvalue = 100f - (heightvalue * 100f) / 19f; // 0 - 19 => 100 - 0
- Color water = Color.FromArgb((int)heightvalue, (int)heightvalue, 255);
- mapbmp.SetPixel(x, yr, water);
+ mapbmp.SetPixel(x, yr, WATER_COLOR);
}
}
}
diff --git a/OpenSim/Region/Framework/Interfaces/ITerrain.cs b/OpenSim/Region/Framework/Interfaces/ITerrain.cs
index f5662cb..b42e872 100644
--- a/OpenSim/Region/Framework/Interfaces/ITerrain.cs
+++ b/OpenSim/Region/Framework/Interfaces/ITerrain.cs
@@ -73,6 +73,7 @@ namespace OpenSim.Region.Framework.Interfaces
public interface IMapImageGenerator
{
+ System.Drawing.Bitmap CreateMapTile(string gradientmap);
byte[] WriteJpeg2000Image(string gradientmap);
}
}
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
index 3a61226..cc8080f 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
@@ -28,17 +28,18 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.IO;
using System.Net;
using System.Reflection;
using log4net;
using Mono.Addins;
using Nini.Config;
using OpenSim.Framework;
-using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
-using OpenSim.Server.Base;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
@@ -62,7 +63,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
#region ISharedRegionModule
public Type ReplaceableInterface { get { return null; } }
- public void RegionLoaded(Scene scene) { }
+ public void RegionLoaded(Scene scene) { UploadMapTile(scene); }
public void PostInitialise() { }
public void Close() { }
@@ -356,6 +357,83 @@ namespace OpenSim.Services.Connectors.SimianGrid
#endregion IGridService
+ private void UploadMapTile(IScene scene)
+ {
+ string errorMessage = null;
+
+ // Create a PNG map tile and upload it to the AddMapTile API
+ byte[] pngData = Utils.EmptyBytes;
+ IMapImageGenerator tileGenerator = scene.RequestModuleInterface();
+ if (tileGenerator == null)
+ {
+ m_log.Warn("[SIMIAN GRID CONNECTOR]: Cannot upload PNG map tile without an IMapImageGenerator");
+ return;
+ }
+
+ using (Image mapTile = tileGenerator.CreateMapTile("defaultstripe.png"))
+ {
+ using (MemoryStream stream = new MemoryStream())
+ {
+ mapTile.Save(stream, ImageFormat.Png);
+ pngData = stream.ToArray();
+ }
+ }
+
+ List postParameters = new List()
+ {
+ new MultipartForm.Parameter("X", scene.RegionInfo.RegionLocX.ToString()),
+ new MultipartForm.Parameter("Y", scene.RegionInfo.RegionLocY.ToString()),
+ new MultipartForm.File("Tile", "tile.png", "image/png", pngData)
+ };
+
+ // Make the remote storage request
+ try
+ {
+ HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl);
+
+ HttpWebResponse response = MultipartForm.Post(request, postParameters);
+ using (Stream responseStream = response.GetResponseStream())
+ {
+ string responseStr = null;
+
+ try
+ {
+ responseStr = responseStream.GetStreamString();
+ OSD responseOSD = OSDParser.Deserialize(responseStr);
+ if (responseOSD.Type == OSDType.Map)
+ {
+ OSDMap responseMap = (OSDMap)responseOSD;
+ if (responseMap["Success"].AsBoolean())
+ m_log.Info("[SIMIAN GRID CONNECTOR]: Uploaded " + pngData.Length + " byte PNG map tile to AddMapTile");
+ else
+ errorMessage = "Upload failed: " + responseMap["Message"].AsString();
+ }
+ else
+ {
+ errorMessage = "Response format was invalid:\n" + responseStr;
+ }
+ }
+ catch (Exception ex)
+ {
+ if (!String.IsNullOrEmpty(responseStr))
+ errorMessage = "Failed to parse the response:\n" + responseStr;
+ else
+ errorMessage = "Failed to retrieve the response: " + ex.Message;
+ }
+ }
+ }
+ catch (WebException ex)
+ {
+ errorMessage = ex.Message;
+ }
+
+ if (!String.IsNullOrEmpty(errorMessage))
+ {
+ m_log.WarnFormat("[SIMIAN GRID CONNECTOR]: Failed to store {0} byte PNG map tile for {1}: {2}",
+ pngData.Length, scene.RegionInfo.RegionName, errorMessage);
+ }
+ }
+
private GridRegion GetNearestRegion(Vector3d position, bool onlyEnabled)
{
NameValueCollection requestArgs = new NameValueCollection
--
cgit v1.1