Added two new methods to IIventoryService -- GetFolderForType and GetFolderContent. Some meat to it, but not completed. None of this code is called anywhere yet.
parent
9f95ec4998
commit
cdcbc48534
|
@ -497,6 +497,16 @@ namespace OpenSim.Framework.Communications.Tests
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
|
public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -201,6 +201,32 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
|
||||||
|
{
|
||||||
|
if (IsLocalGridUser(userID))
|
||||||
|
return m_GridService.GetFolderForType(userID, type);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UUID sessionID = GetSessionID(userID);
|
||||||
|
string uri = GetUserInventoryURI(userID) + "/" + userID.ToString();
|
||||||
|
// !!!!!!
|
||||||
|
return null;
|
||||||
|
//return m_HGService.GetFolderForType(uri, sessionID, type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
|
||||||
|
{
|
||||||
|
if (IsLocalGridUser(userID))
|
||||||
|
return m_GridService.GetFolderContent(userID, folderID);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UUID sessionID = GetSessionID(userID);
|
||||||
|
string uri = GetUserInventoryURI(userID) + "/" + userID.ToString();
|
||||||
|
return m_HGService.GetFolderContent(uri, folderID, sessionID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
|
public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
|
||||||
{
|
{
|
||||||
return new List<InventoryItemBase>();
|
return new List<InventoryItemBase>();
|
||||||
|
|
|
@ -176,6 +176,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
m_InventoryService.GetUserInventory(userID, callback);
|
m_InventoryService.GetUserInventory(userID, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
|
||||||
|
{
|
||||||
|
return m_InventoryService.GetFolderForType(userID, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
|
||||||
|
{
|
||||||
|
return m_InventoryService.GetFolderContent(userID, folderID);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
|
public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
|
||||||
{
|
{
|
||||||
return m_InventoryService.GetFolderItems(userID, folderID);
|
return m_InventoryService.GetFolderItems(userID, folderID);
|
||||||
|
|
|
@ -168,6 +168,44 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
|
||||||
|
{
|
||||||
|
//UUID sessionID = GetSessionID(userID);
|
||||||
|
//List<InventoryFolderBase> sysFolders;
|
||||||
|
//try
|
||||||
|
//{
|
||||||
|
// sysFolders = m_RemoteConnector.GetSystemFolders(userID.ToString(), sessionID);
|
||||||
|
//}
|
||||||
|
//catch (Exception e)
|
||||||
|
//{
|
||||||
|
// m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderForType operation failed, {0} {1}",
|
||||||
|
// e.Source, e.Message);
|
||||||
|
//}
|
||||||
|
|
||||||
|
// PLACEHOLDER UNTIL CACHE IS DONE
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
|
||||||
|
{
|
||||||
|
UUID sessionID = GetSessionID(userID);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return m_RemoteConnector.GetFolderContent(userID.ToString(), folderID, sessionID);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderContent operation failed, {0} {1}",
|
||||||
|
e.Source, e.Message);
|
||||||
|
}
|
||||||
|
InventoryCollection nullCollection = new InventoryCollection();
|
||||||
|
nullCollection.Folders = new List<InventoryFolderBase>();
|
||||||
|
nullCollection.Items = new List<InventoryItemBase>();
|
||||||
|
nullCollection.UserID = userID;
|
||||||
|
return nullCollection;
|
||||||
|
}
|
||||||
|
|
||||||
public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
|
public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
|
||||||
{
|
{
|
||||||
return new List<InventoryItemBase>();
|
return new List<InventoryItemBase>();
|
||||||
|
|
|
@ -120,6 +120,48 @@ namespace OpenSim.Services.Connectors.Inventory
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the user folder for the given folder-type
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userID"></param>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public List<InventoryFolderBase> 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<InventoryFolderBase>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets everything (folders and items) inside a folder
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId"></param>
|
||||||
|
/// <param name="folderID"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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)
|
public bool AddFolder(string id, InventoryFolderBase folder, UUID sessionID)
|
||||||
{
|
{
|
||||||
string url = string.Empty;
|
string url = string.Empty;
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
@ -50,6 +51,22 @@ namespace OpenSim.Services.Connectors
|
||||||
/// <param name="callback"></param>
|
/// <param name="callback"></param>
|
||||||
void GetUserInventory(string userID, UUID session_id, InventoryReceiptCallback callback);
|
void GetUserInventory(string userID, UUID session_id, InventoryReceiptCallback callback);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the user folder for the given folder-type
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userID"></param>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
List<InventoryFolderBase> GetSystemFolders(string userID, UUID session_id);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets everything (folders and items) inside a folder
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId"></param>
|
||||||
|
/// <param name="folderID"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
InventoryCollection GetFolderContent(string userID, UUID folderID, UUID session_id);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add a new folder to the user's inventory
|
/// Add a new folder to the user's inventory
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -155,6 +155,50 @@ namespace OpenSim.Services.Connectors
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the user folder for the given folder-type
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userID"></param>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public List<InventoryFolderBase> GetSystemFolders(string userID, UUID sessionID)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return SynchronousRestSessionObjectPoster<string, List<InventoryFolderBase>>.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<InventoryFolderBase>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets everything (folders and items) inside a folder
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId"></param>
|
||||||
|
/// <param name="folderID"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public InventoryCollection GetFolderContent(string userID, UUID folderID, UUID sessionID)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return SynchronousRestSessionObjectPoster<UUID, InventoryCollection>.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)
|
public bool AddFolder(string userID, InventoryFolderBase folder, UUID sessionID)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -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<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
|
public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -69,6 +69,29 @@ namespace OpenSim.Services.Interfaces
|
||||||
/// <param name="callback"></param>
|
/// <param name="callback"></param>
|
||||||
void GetUserInventory(UUID userID, InventoryReceiptCallback callback);
|
void GetUserInventory(UUID userID, InventoryReceiptCallback callback);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve the root inventory folder for the given user.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userID"></param>
|
||||||
|
/// <returns>null if no root folder was found</returns>
|
||||||
|
InventoryFolderBase GetRootFolder(UUID userID);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the user folder for the given folder-type
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userID"></param>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
InventoryFolderBase GetFolderForType(UUID userID, AssetType type);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets everything (folders and items) inside a folder
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId"></param>
|
||||||
|
/// <param name="folderID"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
InventoryCollection GetFolderContent(UUID userID, UUID folderID);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the items inside a folder
|
/// Gets the items inside a folder
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -137,13 +160,6 @@ namespace OpenSim.Services.Interfaces
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
bool HasInventoryForUser(UUID userID);
|
bool HasInventoryForUser(UUID userID);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Retrieve the root inventory folder for the given user.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="userID"></param>
|
|
||||||
/// <returns>null if no root folder was found</returns>
|
|
||||||
InventoryFolderBase GetRootFolder(UUID userID);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the active gestures of the agent.
|
/// Get the active gestures of the agent.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -233,6 +233,46 @@ namespace OpenSim.Services.InventoryService
|
||||||
callback.BeginInvoke(folders, items, null, null);
|
callback.BeginInvoke(folders, items, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
|
||||||
|
{
|
||||||
|
m_log.Info("[INVENTORY SERVICE]: Processing request for folder " + folderID);
|
||||||
|
|
||||||
|
// Uncomment me to simulate a slow responding inventory server
|
||||||
|
//Thread.Sleep(16000);
|
||||||
|
|
||||||
|
InventoryCollection invCollection = new InventoryCollection();
|
||||||
|
|
||||||
|
List<InventoryItemBase> items = GetFolderItems(userID, folderID);
|
||||||
|
List<InventoryFolderBase> folders = RequestSubFolders(folderID);
|
||||||
|
|
||||||
|
invCollection.UserID = userID;
|
||||||
|
invCollection.Folders = folders;
|
||||||
|
invCollection.Items = items;
|
||||||
|
|
||||||
|
m_log.DebugFormat("[INVENTORY SERVICE]: Found {0} items and {1} folders", items.Count, folders.Count);
|
||||||
|
|
||||||
|
return invCollection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
|
||||||
|
{
|
||||||
|
InventoryFolderBase root = m_Database.getUserRootFolder(userID);
|
||||||
|
if (root != null)
|
||||||
|
{
|
||||||
|
List<InventoryFolderBase> folders = RequestSubFolders(root.ID);
|
||||||
|
|
||||||
|
foreach (InventoryFolderBase folder in folders)
|
||||||
|
{
|
||||||
|
if (folder.Type == (short)type)
|
||||||
|
return folder;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// we didn't find any folder of that type. Return the root folder
|
||||||
|
// hopefully the root folder is not null. If it is, too bad
|
||||||
|
return root;
|
||||||
|
}
|
||||||
|
|
||||||
public List<InventoryItemBase> GetActiveGestures(UUID userId)
|
public List<InventoryItemBase> GetActiveGestures(UUID userId)
|
||||||
{
|
{
|
||||||
List<InventoryItemBase> activeGestures = new List<InventoryItemBase>();
|
List<InventoryItemBase> activeGestures = new List<InventoryItemBase>();
|
||||||
|
|
Loading…
Reference in New Issue