From e5f33e75055a8f83cf4e11a6120774cb90dbc3be Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 18 Aug 2009 22:36:03 -0700 Subject: GetFolderItems implemented. It's not being called, but it might. --- .../ServiceConnectorsOut/Inventory/HGInventoryBroker.cs | 11 +++++++++-- .../Inventory/RemoteInventoryServiceConnector.cs | 3 ++- .../Connectors/Inventory/HGInventoryServiceConnector.cs | 13 +++++++++++++ .../Inventory/ISessionAuthInventoryService.cs | 7 +++++++ .../Connectors/Inventory/InventoryServiceConnector.cs | 17 +++++++++++++++++ 5 files changed, 48 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index 492598e..3649097 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs @@ -290,7 +290,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory public override List GetFolderItems(UUID userID, UUID folderID) { - return new List(); + if (IsLocalGridUser(userID)) + return m_GridService.GetFolderItems(userID, folderID); + else + { + UUID sessionID = GetSessionID(userID); + string uri = GetUserInventoryURI(userID) + "/" + userID; + return m_HGService.GetFolderItems(uri, folderID, sessionID); + } } public override bool AddFolder(InventoryFolderBase folder) @@ -487,7 +494,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory { return true; } - m_log.DebugFormat("[HG INVENTORY CONNECTOR]: user is foreign({0} - {1})", userInventoryServerURI, uri); + m_log.DebugFormat("[HG INVENTORY CONNECTOR]: user {0} is foreign({1} - {2})", userID, userInventoryServerURI, uri); return false; } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs index bef716b..522f680 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs @@ -212,7 +212,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory public override List GetFolderItems(UUID userID, UUID folderID) { - return new List(); + UUID sessionID = GetSessionID(userID); + return m_RemoteConnector.GetFolderItems(userID.ToString(), folderID, sessionID); } public override bool AddFolder(InventoryFolderBase folder) diff --git a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs index 94b4ad9..75fa516 100644 --- a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs @@ -214,6 +214,19 @@ namespace OpenSim.Services.Connectors.Inventory return false; } + public List GetFolderItems(string id, UUID folderID, UUID sessionID) + { + string url = string.Empty; + string userID = string.Empty; + + if (StringToUrlAndUserID(id, out url, out userID)) + { + ISessionAuthInventoryService connector = GetConnector(url); + return connector.GetFolderItems(userID, folderID, sessionID); + } + return new List(); + } + public bool AddItem(string id, InventoryItemBase item, UUID sessionID) { string url = string.Empty; diff --git a/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs b/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs index f50bcf5..7f051f3 100644 --- a/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs +++ b/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs @@ -96,6 +96,13 @@ namespace OpenSim.Services.Connectors bool PurgeFolder(string userID, InventoryFolderBase folder, UUID session_id); /// + /// Get items from a folder. + /// + /// + /// true if the folder was successfully purged + List GetFolderItems(string userID, UUID folderID, UUID session_id); + + /// /// Add a new item to the user's inventory /// /// diff --git a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs index 5d94eac..5aa4b30 100644 --- a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs @@ -334,6 +334,23 @@ namespace OpenSim.Services.Connectors return false; } + public List GetFolderItems(string userID, UUID folderID, UUID sessionID) + { + try + { + InventoryFolderBase folder = new InventoryFolderBase(folderID, new UUID(userID)); + return SynchronousRestSessionObjectPoster>.BeginPostObject( + "POST", m_ServerURI + "/GetItems/", folder, sessionID.ToString(), userID); + } + catch (Exception e) + { + m_log.ErrorFormat("[INVENTORY CONNECTOR]: Get folder items operation failed, {0} {1}", + e.Source, e.Message); + } + + return null; + } + public bool AddItem(string userID, InventoryItemBase item, UUID sessionID) { try -- cgit v1.1