From 16d50032741925c34176da0cca153e7b7de6e325 Mon Sep 17 00:00:00 2001
From: diva
Date: Mon, 8 Jun 2009 03:09:24 +0000
Subject: Added more functions to IInventoryService. Unsure about whether all
of these are really necessary.
---
.../Services/InventoryService/InventoryService.cs | 73 ++++++++++++++++++++--
1 file changed, 67 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Services/InventoryService')
diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs
index b4e2549..f2a7b41 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)
{
--
cgit v1.1