Added more functions to IInventoryService. Unsure about whether all of these are really necessary.
parent
1ad237a8a7
commit
16d5003274
|
@ -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<InventoryFolderBase> GetInventorySkeleton(UUID userId)
|
||||
{
|
||||
return new List<InventoryFolderBase>();
|
||||
}
|
||||
|
||||
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<InventoryItemBase> GetFolderItems(UUID folderID)
|
||||
{
|
||||
return new List<InventoryItemBase>();
|
||||
}
|
||||
|
||||
public bool AddFolder(InventoryFolderBase folder)
|
||||
{
|
||||
if (folder == null)
|
||||
|
@ -316,6 +342,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
|
|||
return null;
|
||||
}
|
||||
|
||||
public List<InventoryItemBase> GetActiveGestures(UUID userId)
|
||||
{
|
||||
return new List<InventoryItemBase>();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private UUID GetSessionID(UUID userID)
|
||||
|
|
|
@ -137,11 +137,33 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
|
|||
|
||||
}
|
||||
|
||||
#region IInventoryService
|
||||
|
||||
public bool CreateUserInventory(UUID user)
|
||||
{
|
||||
return m_InventoryService.CreateUserInventory(user);
|
||||
}
|
||||
|
||||
public List<InventoryFolderBase> 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<InventoryItemBase> GetFolderItems(UUID folderID)
|
||||
{
|
||||
return m_InventoryService.GetFolderItems(folderID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a new folder to the user's inventory
|
||||
/// </summary>
|
||||
|
@ -242,5 +264,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
|
|||
return m_InventoryService.RequestRootFolder(userID);
|
||||
}
|
||||
|
||||
public List<InventoryItemBase> GetActiveGestures(UUID userId)
|
||||
{
|
||||
return m_InventoryService.GetActiveGestures(userId);
|
||||
}
|
||||
#endregion IInventoryService
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,6 +122,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
|
|||
|
||||
#region IInventoryService
|
||||
|
||||
public bool CreateUserInventory(UUID user)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
|
||||
{
|
||||
return new List<InventoryFolderBase>();
|
||||
}
|
||||
|
||||
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<InventoryItemBase> GetFolderItems(UUID folderID)
|
||||
{
|
||||
return new List<InventoryItemBase>();
|
||||
}
|
||||
|
||||
public bool AddFolder(InventoryFolderBase folder)
|
||||
{
|
||||
if (folder == null)
|
||||
|
@ -231,6 +251,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
|
|||
return null;
|
||||
}
|
||||
|
||||
public List<InventoryItemBase> GetActiveGestures(UUID userId)
|
||||
{
|
||||
return new List<InventoryItemBase>();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private UUID GetSessionID(UUID userID)
|
||||
|
|
|
@ -40,6 +40,27 @@ namespace OpenSim.Services.Interfaces
|
|||
|
||||
public interface IInventoryService
|
||||
{
|
||||
/// <summary>
|
||||
/// Create the entire inventory for a given user
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <returns></returns>
|
||||
bool CreateUserInventory(UUID user);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the skeleton of the inventory -- folders only
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
List<InventoryFolderBase> GetInventorySkeleton(UUID userId);
|
||||
|
||||
/// <summary>
|
||||
/// Synchronous inventory fetch.
|
||||
/// </summary>
|
||||
/// <param name="userID"></param>
|
||||
/// <returns></returns>
|
||||
InventoryCollection GetUserInventory(UUID userID);
|
||||
|
||||
/// <summary>
|
||||
/// 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
|
|||
/// <param name="callback"></param>
|
||||
void GetUserInventory(UUID userID, InventoryReceiptCallback callback);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the items inside a folder
|
||||
/// </summary>
|
||||
/// <param name="folderID"></param>
|
||||
/// <returns></returns>
|
||||
List<InventoryItemBase> GetFolderItems(UUID folderID);
|
||||
|
||||
/// <summary>
|
||||
/// Add a new folder to the user's inventory
|
||||
/// </summary>
|
||||
|
@ -114,5 +142,12 @@ namespace OpenSim.Services.Interfaces
|
|||
/// <param name="userID"></param>
|
||||
/// <returns>null if no root folder was found</returns>
|
||||
InventoryFolderBase RequestRootFolder(UUID userID);
|
||||
|
||||
/// <summary>
|
||||
/// Get the active gestures of the agent.
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
List<InventoryItemBase> GetActiveGestures(UUID userId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
/// <summary>
|
||||
/// Return a user's entire inventory synchronously
|
||||
/// </summary>
|
||||
/// <param name="rawUserID"></param>
|
||||
/// <returns>The user's inventory. If an inventory cannot be found then an empty collection is returned.</returns>
|
||||
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<InventoryFolderBase> allFolders = GetInventorySkeleton(userID);
|
||||
|
||||
if (null == allFolders)
|
||||
{
|
||||
m_log.WarnFormat("[LOCAL INVENTORY SERVICE]: No inventory found for user {0}", userID);
|
||||
|
||||
return invCollection;
|
||||
}
|
||||
|
||||
List<InventoryItemBase> allItems = new List<InventoryItemBase>();
|
||||
|
||||
foreach (InventoryFolderBase folder in allFolders)
|
||||
{
|
||||
List<InventoryItemBase> 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronous inventory fetch.
|
||||
/// </summary>
|
||||
/// <param name="userID"></param>
|
||||
/// <param name="callback"></param>
|
||||
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<InventoryItemBase> RequestFolderItems(UUID folderID)
|
||||
public List<InventoryItemBase> GetFolderItems(UUID folderID)
|
||||
{
|
||||
List<InventoryItemBase> itemsList = new List<InventoryItemBase>();
|
||||
|
||||
|
@ -360,7 +421,7 @@ namespace OpenSim.Services.InventoryService
|
|||
}
|
||||
}
|
||||
|
||||
List<InventoryItemBase> items = RequestFolderItems(folder.ID);
|
||||
List<InventoryItemBase> items = GetFolderItems(folder.ID);
|
||||
|
||||
foreach (InventoryItemBase item in items)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue