From cdcbc48534f19afe7cbdeb6c690e6b7d9f2ff099 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 10 Aug 2009 20:31:51 -0700 Subject: Added two new methods to IIventoryService -- GetFolderForType and GetFolderContent. Some meat to it, but not completed. None of this code is called anywhere yet. --- .../Inventory/HGInventoryServiceConnector.cs | 42 +++++++++++++++++++++ .../Inventory/ISessionAuthInventoryService.cs | 17 +++++++++ .../Inventory/InventoryServiceConnector.cs | 44 ++++++++++++++++++++++ .../QuickAndDirtyInventoryServiceConnector.cs | 10 +++++ 4 files changed, 113 insertions(+) (limited to 'OpenSim/Services/Connectors/Inventory') diff --git a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs index 01e517c..b168871 100644 --- a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs @@ -120,6 +120,48 @@ namespace OpenSim.Services.Connectors.Inventory } + /// + /// Gets the user folder for the given folder-type + /// + /// + /// + /// + public List GetSystemFolders(string id, UUID sessionID) + { + m_log.Debug("[HGInventory]: GetSystemFolders " + id); + string url = string.Empty; + string userID = string.Empty; + + if (StringToUrlAndUserID(id, out url, out userID)) + { + ISessionAuthInventoryService connector = GetConnector(url); + return connector.GetSystemFolders(userID, sessionID); + } + + return new List(); + } + + /// + /// Gets everything (folders and items) inside a folder + /// + /// + /// + /// + public InventoryCollection GetFolderContent(string id, UUID folderID, UUID sessionID) + { + m_log.Debug("[HGInventory]: GetSystemFolders " + id); + string url = string.Empty; + string userID = string.Empty; + + if (StringToUrlAndUserID(id, out url, out userID)) + { + ISessionAuthInventoryService connector = GetConnector(url); + return connector.GetFolderContent(userID, folderID, sessionID); + } + + return null; + } + public bool AddFolder(string id, InventoryFolderBase folder, UUID sessionID) { string url = string.Empty; diff --git a/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs b/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs index 4fc4363..98fd680 100644 --- a/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs +++ b/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using System.Collections.Generic; using OpenSim.Framework; using OpenSim.Services.Interfaces; using OpenMetaverse; @@ -51,6 +52,22 @@ namespace OpenSim.Services.Connectors void GetUserInventory(string userID, UUID session_id, InventoryReceiptCallback callback); /// + /// Gets the user folder for the given folder-type + /// + /// + /// + /// + List GetSystemFolders(string userID, UUID session_id); + + /// + /// Gets everything (folders and items) inside a folder + /// + /// + /// + /// + InventoryCollection GetFolderContent(string userID, UUID folderID, UUID session_id); + + /// /// Add a new folder to the user's inventory /// /// diff --git a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs index ae15cfb..1a6826e 100644 --- a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs @@ -155,6 +155,50 @@ namespace OpenSim.Services.Connectors } } + /// + /// Gets the user folder for the given folder-type + /// + /// + /// + /// + public List GetSystemFolders(string userID, UUID sessionID) + { + try + { + return SynchronousRestSessionObjectPoster>.BeginPostObject( + "GET", m_ServerURI + "/SystemFolders/", userID, sessionID.ToString(), userID.ToString()); + } + catch (Exception e) + { + m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderForType operation failed, {0} {1}", + e.Source, e.Message); + } + + return new List(); + } + + /// + /// Gets everything (folders and items) inside a folder + /// + /// + /// + /// + public InventoryCollection GetFolderContent(string userID, UUID folderID, UUID sessionID) + { + try + { + return SynchronousRestSessionObjectPoster.BeginPostObject( + "GET", m_ServerURI + "/GetFolderContents/", folderID, sessionID.ToString(), userID.ToString()); + } + catch (Exception e) + { + m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderForType operation failed, {0} {1}", + e.Source, e.Message); + } + + return null; + } + public bool AddFolder(string userID, InventoryFolderBase folder, UUID sessionID) { try diff --git a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs index a804973..22289aa 100644 --- a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs @@ -106,6 +106,16 @@ namespace OpenSim.Services.Connectors { } + public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) + { + return null; + } + + public InventoryCollection GetFolderContent(UUID userID, UUID folderID) + { + return null; + } + public List GetFolderItems(UUID userID, UUID folderID) { return null; -- cgit v1.1