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