diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/HGInventoryBroker.cs index f4cd269f59..3a0011f128 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/HGInventoryBroker.cs @@ -159,6 +159,27 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory #region IInventoryService + public bool CreateUserInventory(UUID userID) + { + if (IsLocalGridUser(userID)) + return m_GridService.CreateUserInventory(userID); + else + return false; + } + + public List GetInventorySkeleton(UUID userId) + { + return new List(); + } + + public InventoryCollection GetUserInventory(UUID userID) + { + if (IsLocalGridUser(userID)) + return m_GridService.GetUserInventory(userID); + else + return null; + } + public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) { if (IsLocalGridUser(userID)) @@ -171,6 +192,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory } } + public List GetFolderItems(UUID folderID) + { + return new List(); + } + public bool AddFolder(InventoryFolderBase folder) { if (folder == null) @@ -316,6 +342,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory return null; } + public List GetActiveGestures(UUID userId) + { + return new List(); + } + #endregion private UUID GetSessionID(UUID userID) diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/LocalInventoryServiceConnector.cs index 3db08ebd51..c89f29556c 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/LocalInventoryServiceConnector.cs @@ -137,11 +137,33 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory } + #region IInventoryService + + public bool CreateUserInventory(UUID user) + { + return m_InventoryService.CreateUserInventory(user); + } + + public List GetInventorySkeleton(UUID userId) + { + return m_InventoryService.GetInventorySkeleton(userId); + } + + public InventoryCollection GetUserInventory(UUID id) + { + return m_InventoryService.GetUserInventory(id); + } + public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) { m_InventoryService.GetUserInventory(userID, callback); } + public List GetFolderItems(UUID folderID) + { + return m_InventoryService.GetFolderItems(folderID); + } + /// /// Add a new folder to the user's inventory /// @@ -242,5 +264,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory return m_InventoryService.RequestRootFolder(userID); } + public List GetActiveGestures(UUID userId) + { + return m_InventoryService.GetActiveGestures(userId); + } + #endregion IInventoryService } } diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/RemoteInventoryServiceConnector.cs index ddb6cffe30..b695fce466 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/RemoteInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/RemoteInventoryServiceConnector.cs @@ -122,6 +122,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory #region IInventoryService + public bool CreateUserInventory(UUID user) + { + return false; + } + + public List GetInventorySkeleton(UUID userId) + { + return new List(); + } + + public InventoryCollection GetUserInventory(UUID userID) + { + return null; + } + public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) { UUID sessionID = GetSessionID(userID); @@ -140,6 +155,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory } + public List GetFolderItems(UUID folderID) + { + return new List(); + } + public bool AddFolder(InventoryFolderBase folder) { if (folder == null) @@ -231,6 +251,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory return null; } + public List GetActiveGestures(UUID userId) + { + return new List(); + } + #endregion private UUID GetSessionID(UUID userID) diff --git a/OpenSim/Services/Interfaces/IInventoryService.cs b/OpenSim/Services/Interfaces/IInventoryService.cs index 9fe419fce4..8757744831 100644 --- a/OpenSim/Services/Interfaces/IInventoryService.cs +++ b/OpenSim/Services/Interfaces/IInventoryService.cs @@ -40,6 +40,27 @@ namespace OpenSim.Services.Interfaces public interface IInventoryService { + /// + /// Create the entire inventory for a given user + /// + /// + /// + bool CreateUserInventory(UUID user); + + /// + /// Gets the skeleton of the inventory -- folders only + /// + /// + /// + List GetInventorySkeleton(UUID userId); + + /// + /// Synchronous inventory fetch. + /// + /// + /// + InventoryCollection GetUserInventory(UUID userID); + /// /// Request the inventory for a user. This is an asynchronous operation that will call the callback when the /// inventory has been received @@ -48,6 +69,13 @@ namespace OpenSim.Services.Interfaces /// void GetUserInventory(UUID userID, InventoryReceiptCallback callback); + /// + /// Gets the items inside a folder + /// + /// + /// + List GetFolderItems(UUID folderID); + /// /// Add a new folder to the user's inventory /// @@ -114,5 +142,12 @@ namespace OpenSim.Services.Interfaces /// /// null if no root folder was found InventoryFolderBase RequestRootFolder(UUID userID); + + /// + /// Get the active gestures of the agent. + /// + /// + /// + List GetActiveGestures(UUID userId); } } diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs index b4e2549153..f2a7b4196f 100644 --- a/OpenSim/Services/InventoryService/InventoryService.cs +++ b/OpenSim/Services/InventoryService/InventoryService.cs @@ -85,7 +85,6 @@ namespace OpenSim.Services.InventoryService return userFolders; } - // See IInventoryServices public virtual bool HasInventoryForUser(UUID userID) { return false; @@ -107,7 +106,7 @@ namespace OpenSim.Services.InventoryService } // See IInventoryServices - public bool CreateNewUserInventory(UUID user) + public bool CreateUserInventory(UUID user) { InventoryFolderBase existingRootFolder = RequestRootFolder(user); @@ -131,6 +130,68 @@ namespace OpenSim.Services.InventoryService } // See IInventoryServices + + /// + /// Return a user's entire inventory synchronously + /// + /// + /// The user's inventory. If an inventory cannot be found then an empty collection is returned. + public InventoryCollection GetUserInventory(UUID userID) + { + m_log.InfoFormat("[LOCAL INVENTORY SERVICE]: Processing request for inventory of {0}", userID); + + // Uncomment me to simulate a slow responding inventory server + //Thread.Sleep(16000); + + InventoryCollection invCollection = new InventoryCollection(); + + List allFolders = GetInventorySkeleton(userID); + + if (null == allFolders) + { + m_log.WarnFormat("[LOCAL INVENTORY SERVICE]: No inventory found for user {0}", userID); + + return invCollection; + } + + List allItems = new List(); + + foreach (InventoryFolderBase folder in allFolders) + { + List items = GetFolderItems(folder.ID); + + if (items != null) + { + allItems.InsertRange(0, items); + } + } + + invCollection.UserID = userID; + invCollection.Folders = allFolders; + invCollection.Items = allItems; + + // foreach (InventoryFolderBase folder in invCollection.Folders) + // { + // m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back folder {0} {1}", folder.Name, folder.ID); + // } + // + // foreach (InventoryItemBase item in invCollection.Items) + // { + // m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back item {0} {1}, folder {2}", item.Name, item.ID, item.Folder); + // } + + m_log.InfoFormat( + "[LOCAL INVENTORY SERVICE]: Sending back inventory response to user {0} containing {1} folders and {2} items", + invCollection.UserID, invCollection.Folders.Count, invCollection.Items.Count); + + return invCollection; + } + + /// + /// Asynchronous inventory fetch. + /// + /// + /// public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) { m_log.InfoFormat("[LOCAL INVENTORY SERVICE]: Requesting inventory for user {0}", userID); @@ -152,7 +213,7 @@ namespace OpenSim.Services.InventoryService { rootFolder = new InventoryFolderImpl(folder); folders.Add(rootFolder); - items.AddRange(RequestFolderItems(rootFolder.ID)); + items.AddRange(GetFolderItems(rootFolder.ID)); break; // Only 1 root folder per user } } @@ -164,7 +225,7 @@ namespace OpenSim.Services.InventoryService if (folder.ID != rootFolder.ID) { folders.Add(new InventoryFolderImpl(folder)); - items.AddRange(RequestFolderItems(folder.ID)); + items.AddRange(GetFolderItems(folder.ID)); } } } @@ -208,7 +269,7 @@ namespace OpenSim.Services.InventoryService return inventoryList; } - public List RequestFolderItems(UUID folderID) + public List GetFolderItems(UUID folderID) { List itemsList = new List(); @@ -360,7 +421,7 @@ namespace OpenSim.Services.InventoryService } } - List items = RequestFolderItems(folder.ID); + List items = GetFolderItems(folder.ID); foreach (InventoryItemBase item in items) {