* Added two new packet handler implementations for inventory ops. This is starting to work! - but can't be activated incrementally, the flip needs to be global for all inventory ops.

* Added a base inventory connector that does common processing of inventory among all reference connector implementations. E.g. AddItem requires additional processing before being forwarded to service.
* Added if (m_Enabled) upon RemoveRegion
arthursv
Diva Canto 2009-08-12 13:11:15 -07:00
parent b3b506cba2
commit 41ad610f3e
8 changed files with 323 additions and 77 deletions

View File

@ -68,5 +68,24 @@ namespace OpenSim.Framework
get { return _version; } get { return _version; }
set { _version = value; } set { _version = value; }
} }
public InventoryFolderBase()
{
}
public InventoryFolderBase(UUID id)
{
ID = id;
}
public InventoryFolderBase(UUID id, string name, UUID owner, short type, UUID parent, ushort version)
{
ID = id;
Name = name;
Owner = owner;
Type = type;
ParentID = parent;
Version = version;
}
} }
} }

View File

@ -0,0 +1,179 @@
using System;
using System.Collections.Generic;
using OpenMetaverse;
using Nini.Config;
using log4net;
using OpenSim.Framework;
using OpenSim.Services.Interfaces;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
{
public abstract class BaseInventoryConnector : IInventoryService
{
protected InventoryCache m_cache;
protected virtual void Init(IConfigSource source)
{
m_cache = new InventoryCache();
m_cache.Init(source, this);
}
/// <summary>
/// Create the entire inventory for a given user
/// </summary>
/// <param name="user"></param>
/// <returns></returns>
public abstract bool CreateUserInventory(UUID user);
/// <summary>
/// Gets the skeleton of the inventory -- folders only
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public abstract List<InventoryFolderBase> GetInventorySkeleton(UUID userId);
/// <summary>
/// Synchronous inventory fetch.
/// </summary>
/// <param name="userID"></param>
/// <returns></returns>
public abstract 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
/// </summary>
/// <param name="userID"></param>
/// <param name="callback"></param>
public abstract 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>
public abstract InventoryFolderBase GetRootFolder(UUID userID);
public abstract Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID);
/// <summary>
/// Gets the user folder for the given folder-type
/// </summary>
/// <param name="userID"></param>
/// <param name="type"></param>
/// <returns></returns>
public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
{
return m_cache.GetFolderForType(userID, type);
}
/// <summary>
/// Gets everything (folders and items) inside a folder
/// </summary>
/// <param name="userId"></param>
/// <param name="folderID"></param>
/// <returns></returns>
public abstract InventoryCollection GetFolderContent(UUID userID, UUID folderID);
/// <summary>
/// Gets the items inside a folder
/// </summary>
/// <param name="userID"></param>
/// <param name="folderID"></param>
/// <returns></returns>
public abstract List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID);
/// <summary>
/// Add a new folder to the user's inventory
/// </summary>
/// <param name="folder"></param>
/// <returns>true if the folder was successfully added</returns>
public abstract bool AddFolder(InventoryFolderBase folder);
/// <summary>
/// Update a folder in the user's inventory
/// </summary>
/// <param name="folder"></param>
/// <returns>true if the folder was successfully updated</returns>
public abstract bool UpdateFolder(InventoryFolderBase folder);
/// <summary>
/// Move an inventory folder to a new location
/// </summary>
/// <param name="folder">A folder containing the details of the new location</param>
/// <returns>true if the folder was successfully moved</returns>
public abstract bool MoveFolder(InventoryFolderBase folder);
/// <summary>
/// Purge an inventory folder of all its items and subfolders.
/// </summary>
/// <param name="folder"></param>
/// <returns>true if the folder was successfully purged</returns>
public abstract bool PurgeFolder(InventoryFolderBase folder);
/// <summary>
/// Add a new item to the user's inventory.
/// If the given item has to parent folder, it tries to find the most
/// suitable folder for it.
/// </summary>
/// <param name="item"></param>
/// <returns>true if the item was successfully added</returns>
public bool AddItem(InventoryItemBase item)
{
if (item.Folder == UUID.Zero)
{
InventoryFolderBase f = GetFolderForType(item.Owner, (AssetType)item.AssetType);
if (f != null)
item.Folder = f.ID;
else
{
f = GetRootFolder(item.Owner);
if (f != null)
item.Folder = f.ID;
else
return false;
}
}
return AddItemPlain(item);
}
protected abstract bool AddItemPlain(InventoryItemBase item);
/// <summary>
/// Update an item in the user's inventory
/// </summary>
/// <param name="item"></param>
/// <returns>true if the item was successfully updated</returns>
public abstract bool UpdateItem(InventoryItemBase item);
/// <summary>
/// Delete an item from the user's inventory
/// </summary>
/// <param name="item"></param>
/// <returns>true if the item was successfully deleted</returns>
public abstract bool DeleteItem(InventoryItemBase item);
public abstract InventoryItemBase QueryItem(InventoryItemBase item);
public abstract InventoryFolderBase QueryFolder(InventoryFolderBase folder);
/// <summary>
/// Does the given user have an inventory structure?
/// </summary>
/// <param name="userID"></param>
/// <returns></returns>
public abstract bool HasInventoryForUser(UUID userID);
/// <summary>
/// Get the active gestures of the agent.
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public abstract List<InventoryItemBase> GetActiveGestures(UUID userId);
}
}

View File

@ -41,7 +41,7 @@ using OpenMetaverse;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
{ {
public class HGInventoryBroker : InventoryCache, ISharedRegionModule, IInventoryService public class HGInventoryBroker : BaseInventoryConnector, ISharedRegionModule, IInventoryService
{ {
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger( LogManager.GetLogger(
@ -138,7 +138,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
{ {
} }
public override void AddRegion(Scene scene) public void AddRegion(Scene scene)
{ {
if (!m_Enabled) if (!m_Enabled)
return; return;
@ -156,12 +156,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
} }
scene.RegisterModuleInterface<IInventoryService>(this); scene.RegisterModuleInterface<IInventoryService>(this);
base.AddRegion(scene); m_cache.AddRegion(scene);
} }
public override void RemoveRegion(Scene scene) public void RemoveRegion(Scene scene)
{ {
base.RemoveRegion(scene); if (!m_Enabled)
return;
m_cache.RemoveRegion(scene);
} }
public void RegionLoaded(Scene scene) public void RegionLoaded(Scene scene)
@ -175,17 +178,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
#region IInventoryService #region IInventoryService
public bool CreateUserInventory(UUID userID) public override bool CreateUserInventory(UUID userID)
{ {
return m_GridService.CreateUserInventory(userID); return m_GridService.CreateUserInventory(userID);
} }
public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) public override List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
{ {
return m_GridService.GetInventorySkeleton(userId); return m_GridService.GetInventorySkeleton(userId);
} }
public InventoryCollection GetUserInventory(UUID userID) public override InventoryCollection GetUserInventory(UUID userID)
{ {
if (IsLocalGridUser(userID)) if (IsLocalGridUser(userID))
return m_GridService.GetUserInventory(userID); return m_GridService.GetUserInventory(userID);
@ -193,7 +196,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return null; return null;
} }
public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) public override void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
{ {
if (IsLocalGridUser(userID)) if (IsLocalGridUser(userID))
m_GridService.GetUserInventory(userID, callback); m_GridService.GetUserInventory(userID, callback);
@ -220,7 +223,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
// } // }
//} //}
public InventoryCollection GetFolderContent(UUID userID, UUID folderID) public override InventoryCollection GetFolderContent(UUID userID, UUID folderID)
{ {
if (IsLocalGridUser(userID)) if (IsLocalGridUser(userID))
return m_GridService.GetFolderContent(userID, folderID); return m_GridService.GetFolderContent(userID, folderID);
@ -271,12 +274,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return new Dictionary<AssetType, InventoryFolderBase>(); return new Dictionary<AssetType, InventoryFolderBase>();
} }
public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) public override List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
{ {
return new List<InventoryItemBase>(); return new List<InventoryItemBase>();
} }
public bool AddFolder(InventoryFolderBase folder) public override bool AddFolder(InventoryFolderBase folder)
{ {
if (folder == null) if (folder == null)
return false; return false;
@ -291,7 +294,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
} }
} }
public bool UpdateFolder(InventoryFolderBase folder) public override bool UpdateFolder(InventoryFolderBase folder)
{ {
if (folder == null) if (folder == null)
return false; return false;
@ -306,7 +309,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
} }
} }
public bool MoveFolder(InventoryFolderBase folder) public override bool MoveFolder(InventoryFolderBase folder)
{ {
if (folder == null) if (folder == null)
return false; return false;
@ -321,7 +324,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
} }
} }
public bool PurgeFolder(InventoryFolderBase folder) public override bool PurgeFolder(InventoryFolderBase folder)
{ {
if (folder == null) if (folder == null)
return false; return false;
@ -336,7 +339,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
} }
} }
public bool AddItem(InventoryItemBase item) // public bool AddItem(InventoryItemBase item) inherited
// Uses AddItemPlain
protected override bool AddItemPlain(InventoryItemBase item)
{ {
if (item == null) if (item == null)
return false; return false;
@ -351,7 +357,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
} }
} }
public bool UpdateItem(InventoryItemBase item) public override bool UpdateItem(InventoryItemBase item)
{ {
if (item == null) if (item == null)
return false; return false;
@ -366,7 +372,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
} }
} }
public bool DeleteItem(InventoryItemBase item) public override bool DeleteItem(InventoryItemBase item)
{ {
if (item == null) if (item == null)
return false; return false;
@ -381,7 +387,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
} }
} }
public InventoryItemBase QueryItem(InventoryItemBase item) public override InventoryItemBase QueryItem(InventoryItemBase item)
{ {
if (item == null) if (item == null)
return null; return null;
@ -396,7 +402,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
} }
} }
public InventoryFolderBase QueryFolder(InventoryFolderBase folder) public override InventoryFolderBase QueryFolder(InventoryFolderBase folder)
{ {
if (folder == null) if (folder == null)
return null; return null;
@ -411,17 +417,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
} }
} }
public bool HasInventoryForUser(UUID userID) public override bool HasInventoryForUser(UUID userID)
{ {
return false; return false;
} }
public InventoryFolderBase GetRootFolder(UUID userID) public override InventoryFolderBase GetRootFolder(UUID userID)
{ {
return null; return null;
} }
public List<InventoryItemBase> GetActiveGestures(UUID userId) public override List<InventoryItemBase> GetActiveGestures(UUID userId)
{ {
return new List<InventoryItemBase>(); return new List<InventoryItemBase>();
} }

View File

@ -12,21 +12,23 @@ using log4net;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
{ {
public abstract class InventoryCache public class InventoryCache
{ {
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger( LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType); MethodBase.GetCurrentMethod().DeclaringType);
protected BaseInventoryConnector m_Connector;
protected List<Scene> m_Scenes; protected List<Scene> m_Scenes;
// The cache proper // The cache proper
protected Dictionary<UUID, Dictionary<AssetType, InventoryFolderBase>> m_InventoryCache; protected Dictionary<UUID, Dictionary<AssetType, InventoryFolderBase>> m_InventoryCache;
protected virtual void Init(IConfigSource source) public virtual void Init(IConfigSource source, BaseInventoryConnector connector)
{ {
m_Scenes = new List<Scene>(); m_Scenes = new List<Scene>();
m_InventoryCache = new Dictionary<UUID, Dictionary<AssetType, InventoryFolderBase>>(); m_InventoryCache = new Dictionary<UUID, Dictionary<AssetType, InventoryFolderBase>>();
m_Connector = connector;
} }
public virtual void AddRegion(Scene scene) public virtual void AddRegion(Scene scene)
@ -59,7 +61,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
} }
// If not, go get them and place them in the cache // If not, go get them and place them in the cache
Dictionary<AssetType, InventoryFolderBase> folders = GetSystemFolders(presence.UUID); Dictionary<AssetType, InventoryFolderBase> folders = m_Connector.GetSystemFolders(presence.UUID);
m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}", m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}",
presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count); presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count);
if (folders.Count > 0) if (folders.Count > 0)
@ -95,7 +97,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
} }
} }
public abstract Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID);
public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
{ {

View File

@ -41,7 +41,7 @@ using OpenMetaverse;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
{ {
public class LocalInventoryServicesConnector : InventoryCache, ISharedRegionModule, IInventoryService public class LocalInventoryServicesConnector : BaseInventoryConnector, ISharedRegionModule, IInventoryService
{ {
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger( LogManager.GetLogger(
@ -124,7 +124,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
{ {
} }
public override void AddRegion(Scene scene) public void AddRegion(Scene scene)
{ {
if (!m_Enabled) if (!m_Enabled)
return; return;
@ -141,12 +141,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
// "[INVENTORY CONNECTOR]: Registering IInventoryService to scene {0}", scene.RegionInfo.RegionName); // "[INVENTORY CONNECTOR]: Registering IInventoryService to scene {0}", scene.RegionInfo.RegionName);
scene.RegisterModuleInterface<IInventoryService>(this); scene.RegisterModuleInterface<IInventoryService>(this);
base.AddRegion(scene); m_cache.AddRegion(scene);
} }
public override void RemoveRegion(Scene scene) public void RemoveRegion(Scene scene)
{ {
base.RemoveRegion(scene); if (!m_Enabled)
return;
m_cache.RemoveRegion(scene);
} }
public void RegionLoaded(Scene scene) public void RegionLoaded(Scene scene)
@ -160,22 +163,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
#region IInventoryService #region IInventoryService
public bool CreateUserInventory(UUID user) public override bool CreateUserInventory(UUID user)
{ {
return m_InventoryService.CreateUserInventory(user); return m_InventoryService.CreateUserInventory(user);
} }
public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) public override List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
{ {
return m_InventoryService.GetInventorySkeleton(userId); return m_InventoryService.GetInventorySkeleton(userId);
} }
public InventoryCollection GetUserInventory(UUID id) public override InventoryCollection GetUserInventory(UUID id)
{ {
return m_InventoryService.GetUserInventory(id); return m_InventoryService.GetUserInventory(id);
} }
public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) public override void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
{ {
m_InventoryService.GetUserInventory(userID, callback); m_InventoryService.GetUserInventory(userID, callback);
} }
@ -207,13 +210,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return new Dictionary<AssetType, InventoryFolderBase>(); return new Dictionary<AssetType, InventoryFolderBase>();
} }
public InventoryCollection GetFolderContent(UUID userID, UUID folderID) public override InventoryCollection GetFolderContent(UUID userID, UUID folderID)
{ {
return m_InventoryService.GetFolderContent(userID, folderID); return m_InventoryService.GetFolderContent(userID, folderID);
} }
public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) public override List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
{ {
return m_InventoryService.GetFolderItems(userID, folderID); return m_InventoryService.GetFolderItems(userID, folderID);
} }
@ -223,7 +226,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
/// </summary> /// </summary>
/// <param name="folder"></param> /// <param name="folder"></param>
/// <returns>true if the folder was successfully added</returns> /// <returns>true if the folder was successfully added</returns>
public bool AddFolder(InventoryFolderBase folder) public override bool AddFolder(InventoryFolderBase folder)
{ {
return m_InventoryService.AddFolder(folder); return m_InventoryService.AddFolder(folder);
} }
@ -233,7 +236,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
/// </summary> /// </summary>
/// <param name="folder"></param> /// <param name="folder"></param>
/// <returns>true if the folder was successfully updated</returns> /// <returns>true if the folder was successfully updated</returns>
public bool UpdateFolder(InventoryFolderBase folder) public override bool UpdateFolder(InventoryFolderBase folder)
{ {
return m_InventoryService.UpdateFolder(folder); return m_InventoryService.UpdateFolder(folder);
} }
@ -243,7 +246,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
/// </summary> /// </summary>
/// <param name="folder">A folder containing the details of the new location</param> /// <param name="folder">A folder containing the details of the new location</param>
/// <returns>true if the folder was successfully moved</returns> /// <returns>true if the folder was successfully moved</returns>
public bool MoveFolder(InventoryFolderBase folder) public override bool MoveFolder(InventoryFolderBase folder)
{ {
return m_InventoryService.MoveFolder(folder); return m_InventoryService.MoveFolder(folder);
} }
@ -253,17 +256,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
/// </summary> /// </summary>
/// <param name="folder"></param> /// <param name="folder"></param>
/// <returns>true if the folder was successfully purged</returns> /// <returns>true if the folder was successfully purged</returns>
public bool PurgeFolder(InventoryFolderBase folder) public override bool PurgeFolder(InventoryFolderBase folder)
{ {
return m_InventoryService.PurgeFolder(folder); return m_InventoryService.PurgeFolder(folder);
} }
/// <summary> /// <summary>
/// Add a new item to the user's inventory /// Add a new item to the user's inventory, plain
/// Called by base class AddItem
/// </summary> /// </summary>
/// <param name="item"></param> /// <param name="item"></param>
/// <returns>true if the item was successfully added</returns> /// <returns>true if the item was successfully added</returns>
public bool AddItem(InventoryItemBase item) protected override bool AddItemPlain(InventoryItemBase item)
{ {
return m_InventoryService.AddItem(item); return m_InventoryService.AddItem(item);
} }
@ -273,7 +277,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
/// </summary> /// </summary>
/// <param name="item"></param> /// <param name="item"></param>
/// <returns>true if the item was successfully updated</returns> /// <returns>true if the item was successfully updated</returns>
public bool UpdateItem(InventoryItemBase item) public override bool UpdateItem(InventoryItemBase item)
{ {
return m_InventoryService.UpdateItem(item); return m_InventoryService.UpdateItem(item);
} }
@ -283,17 +287,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
/// </summary> /// </summary>
/// <param name="item"></param> /// <param name="item"></param>
/// <returns>true if the item was successfully deleted</returns> /// <returns>true if the item was successfully deleted</returns>
public bool DeleteItem(InventoryItemBase item) public override bool DeleteItem(InventoryItemBase item)
{ {
return m_InventoryService.DeleteItem(item); return m_InventoryService.DeleteItem(item);
} }
public InventoryItemBase QueryItem(InventoryItemBase item) public override InventoryItemBase QueryItem(InventoryItemBase item)
{ {
return m_InventoryService.QueryItem(item); return m_InventoryService.QueryItem(item);
} }
public InventoryFolderBase QueryFolder(InventoryFolderBase folder) public override InventoryFolderBase QueryFolder(InventoryFolderBase folder)
{ {
return m_InventoryService.QueryFolder(folder); return m_InventoryService.QueryFolder(folder);
} }
@ -303,7 +307,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
/// </summary> /// </summary>
/// <param name="userID"></param> /// <param name="userID"></param>
/// <returns></returns> /// <returns></returns>
public bool HasInventoryForUser(UUID userID) public override bool HasInventoryForUser(UUID userID)
{ {
return m_InventoryService.HasInventoryForUser(userID); return m_InventoryService.HasInventoryForUser(userID);
} }
@ -313,12 +317,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
/// </summary> /// </summary>
/// <param name="userID"></param> /// <param name="userID"></param>
/// <returns>null if no root folder was found</returns> /// <returns>null if no root folder was found</returns>
public InventoryFolderBase GetRootFolder(UUID userID) public override InventoryFolderBase GetRootFolder(UUID userID)
{ {
return m_InventoryService.GetRootFolder(userID); return m_InventoryService.GetRootFolder(userID);
} }
public List<InventoryItemBase> GetActiveGestures(UUID userId) public override List<InventoryItemBase> GetActiveGestures(UUID userId)
{ {
return m_InventoryService.GetActiveGestures(userId); return m_InventoryService.GetActiveGestures(userId);
} }

View File

@ -40,7 +40,7 @@ using OpenMetaverse;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
{ {
public class RemoteInventoryServicesConnector : InventoryCache, ISharedRegionModule, IInventoryService public class RemoteInventoryServicesConnector : BaseInventoryConnector, ISharedRegionModule, IInventoryService
{ {
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
{ {
} }
public override void AddRegion(Scene scene) public void AddRegion(Scene scene)
{ {
if (!m_Enabled) if (!m_Enabled)
return; return;
@ -117,12 +117,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
} }
scene.RegisterModuleInterface<IInventoryService>(this); scene.RegisterModuleInterface<IInventoryService>(this);
base.AddRegion(scene); m_cache.AddRegion(scene);
} }
public override void RemoveRegion(Scene scene) public void RemoveRegion(Scene scene)
{ {
base.RemoveRegion(scene); if (!m_Enabled)
return;
m_cache.RemoveRegion(scene);
} }
public void RegionLoaded(Scene scene) public void RegionLoaded(Scene scene)
@ -138,22 +141,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
#region IInventoryService #region IInventoryService
public bool CreateUserInventory(UUID user) public override bool CreateUserInventory(UUID user)
{ {
return false; return false;
} }
public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) public override List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
{ {
return new List<InventoryFolderBase>(); return new List<InventoryFolderBase>();
} }
public InventoryCollection GetUserInventory(UUID userID) public override InventoryCollection GetUserInventory(UUID userID)
{ {
return null; return null;
} }
public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) public override void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
{ {
UUID sessionID = GetSessionID(userID); UUID sessionID = GetSessionID(userID);
try try
@ -180,7 +183,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_RemoteConnector.GetSystemFolders(userID.ToString(), sessionID); return m_RemoteConnector.GetSystemFolders(userID.ToString(), sessionID);
} }
public InventoryCollection GetFolderContent(UUID userID, UUID folderID) public override InventoryCollection GetFolderContent(UUID userID, UUID folderID)
{ {
UUID sessionID = GetSessionID(userID); UUID sessionID = GetSessionID(userID);
try try
@ -199,12 +202,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return nullCollection; return nullCollection;
} }
public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) public override List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
{ {
return new List<InventoryItemBase>(); return new List<InventoryItemBase>();
} }
public bool AddFolder(InventoryFolderBase folder) public override bool AddFolder(InventoryFolderBase folder)
{ {
if (folder == null) if (folder == null)
return false; return false;
@ -213,7 +216,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_RemoteConnector.AddFolder(folder.Owner.ToString(), folder, sessionID); return m_RemoteConnector.AddFolder(folder.Owner.ToString(), folder, sessionID);
} }
public bool UpdateFolder(InventoryFolderBase folder) public override bool UpdateFolder(InventoryFolderBase folder)
{ {
if (folder == null) if (folder == null)
return false; return false;
@ -222,7 +225,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_RemoteConnector.UpdateFolder(folder.Owner.ToString(), folder, sessionID); return m_RemoteConnector.UpdateFolder(folder.Owner.ToString(), folder, sessionID);
} }
public bool MoveFolder(InventoryFolderBase folder) public override bool MoveFolder(InventoryFolderBase folder)
{ {
if (folder == null) if (folder == null)
return false; return false;
@ -231,7 +234,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_RemoteConnector.MoveFolder(folder.Owner.ToString(), folder, sessionID); return m_RemoteConnector.MoveFolder(folder.Owner.ToString(), folder, sessionID);
} }
public bool PurgeFolder(InventoryFolderBase folder) public override bool PurgeFolder(InventoryFolderBase folder)
{ {
if (folder == null) if (folder == null)
return false; return false;
@ -240,7 +243,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_RemoteConnector.PurgeFolder(folder.Owner.ToString(), folder, sessionID); return m_RemoteConnector.PurgeFolder(folder.Owner.ToString(), folder, sessionID);
} }
public bool AddItem(InventoryItemBase item) // public bool AddItem(InventoryItemBase item) inherited
// Uses AddItemPlain
protected override bool AddItemPlain(InventoryItemBase item)
{ {
if (item == null) if (item == null)
return false; return false;
@ -249,7 +255,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_RemoteConnector.AddItem(item.Owner.ToString(), item, sessionID); return m_RemoteConnector.AddItem(item.Owner.ToString(), item, sessionID);
} }
public bool UpdateItem(InventoryItemBase item) public override bool UpdateItem(InventoryItemBase item)
{ {
if (item == null) if (item == null)
return false; return false;
@ -258,7 +264,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_RemoteConnector.UpdateItem(item.Owner.ToString(), item, sessionID); return m_RemoteConnector.UpdateItem(item.Owner.ToString(), item, sessionID);
} }
public bool DeleteItem(InventoryItemBase item) public override bool DeleteItem(InventoryItemBase item)
{ {
if (item == null) if (item == null)
return false; return false;
@ -267,7 +273,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_RemoteConnector.DeleteItem(item.Owner.ToString(), item, sessionID); return m_RemoteConnector.DeleteItem(item.Owner.ToString(), item, sessionID);
} }
public InventoryItemBase QueryItem(InventoryItemBase item) public override InventoryItemBase QueryItem(InventoryItemBase item)
{ {
if (item == null) if (item == null)
return null; return null;
@ -276,7 +282,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_RemoteConnector.QueryItem(item.Owner.ToString(), item, sessionID); return m_RemoteConnector.QueryItem(item.Owner.ToString(), item, sessionID);
} }
public InventoryFolderBase QueryFolder(InventoryFolderBase folder) public override InventoryFolderBase QueryFolder(InventoryFolderBase folder)
{ {
if (folder == null) if (folder == null)
return null; return null;
@ -285,17 +291,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_RemoteConnector.QueryFolder(folder.Owner.ToString(), folder, sessionID); return m_RemoteConnector.QueryFolder(folder.Owner.ToString(), folder, sessionID);
} }
public bool HasInventoryForUser(UUID userID) public override bool HasInventoryForUser(UUID userID)
{ {
return false; return false;
} }
public InventoryFolderBase GetRootFolder(UUID userID) public override InventoryFolderBase GetRootFolder(UUID userID)
{ {
return null; return null;
} }
public List<InventoryItemBase> GetActiveGestures(UUID userId) public override List<InventoryItemBase> GetActiveGestures(UUID userId)
{ {
return new List<InventoryItemBase>(); return new List<InventoryItemBase>();
} }

View File

@ -622,8 +622,26 @@ namespace OpenSim.Region.Framework.Scenes
"[AGENT INVENTORY]: Failed to move folder {0} to {1} for user {2}", "[AGENT INVENTORY]: Failed to move folder {0} to {1} for user {2}",
folderID, parentID, remoteClient.Name); folderID, parentID, remoteClient.Name);
} }
}
public void HandleMoveInventoryFolder2(IClientAPI remoteClient, UUID folderID, UUID parentID)
{
InventoryFolderBase folder = new InventoryFolderBase(folderID);
folder = InventoryService.QueryFolder(folder);
if (folder != null)
{
folder.ParentID = parentID;
if (!InventoryService.MoveFolder(folder))
m_log.WarnFormat("[AGENT INVENTORY]: could not move folder {0}", folderID);
else
m_log.DebugFormat("[AGENT INVENTORY]: folder {0} moved to parent {1}", folderID, parentID);
}
else
{
m_log.WarnFormat("[AGENT INVENTORY]: request to move folder {0} but folder not found", folderID);
}
} }
/// <summary> /// <summary>
/// This should delete all the items and folders in the given directory. /// This should delete all the items and folders in the given directory.
/// </summary> /// </summary>
@ -647,6 +665,17 @@ namespace OpenSim.Region.Framework.Scenes
"[AGENT INVENTORY]: Failed to purge folder for user {0} {1}", "[AGENT INVENTORY]: Failed to purge folder for user {0} {1}",
remoteClient.Name, remoteClient.AgentId); remoteClient.Name, remoteClient.AgentId);
} }
}
public void HandlePurgeInventoryDescendents2(IClientAPI remoteClient, UUID folderID)
{
InventoryFolderBase folder = new InventoryFolderBase(folderID);
if (InventoryService.PurgeFolder(folder))
m_log.DebugFormat("[AGENT INVENTORY]: folder {0} purged successfully", folderID);
else
m_log.WarnFormat("[AGENT INVENTORY]: could not purge folder {0}", folderID);
} }
} }
} }

View File

@ -2019,12 +2019,13 @@ namespace OpenSim.Region.Framework.Scenes
client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags; client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags;
client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily;
client.OnObjectPermissions += HandleObjectPermissionsUpdate; client.OnObjectPermissions += HandleObjectPermissionsUpdate;
client.OnCreateNewInventoryItem += CreateNewInventoryItem; client.OnCreateNewInventoryItem += CreateNewInventoryItem;
client.OnCreateNewInventoryFolder += HandleCreateInventoryFolder; client.OnCreateNewInventoryFolder += HandleCreateInventoryFolder;
client.OnUpdateInventoryFolder += HandleUpdateInventoryFolder; client.OnUpdateInventoryFolder += HandleUpdateInventoryFolder;
client.OnMoveInventoryFolder += HandleMoveInventoryFolder; client.OnMoveInventoryFolder += HandleMoveInventoryFolder; // 2; //!!
client.OnFetchInventoryDescendents += HandleFetchInventoryDescendents; client.OnFetchInventoryDescendents += HandleFetchInventoryDescendents;
client.OnPurgeInventoryDescendents += HandlePurgeInventoryDescendents; client.OnPurgeInventoryDescendents += HandlePurgeInventoryDescendents; // 2; //!!
client.OnFetchInventory += HandleFetchInventory; client.OnFetchInventory += HandleFetchInventory;
client.OnUpdateInventoryItem += UpdateInventoryItemAsset; client.OnUpdateInventoryItem += UpdateInventoryItemAsset;
client.OnCopyInventoryItem += CopyInventoryItem; client.OnCopyInventoryItem += CopyInventoryItem;
@ -2036,6 +2037,7 @@ namespace OpenSim.Region.Framework.Scenes
client.OnRemoveTaskItem += RemoveTaskInventory; client.OnRemoveTaskItem += RemoveTaskInventory;
client.OnUpdateTaskInventory += UpdateTaskInventory; client.OnUpdateTaskInventory += UpdateTaskInventory;
client.OnMoveTaskItem += ClientMoveTaskInventoryItem; client.OnMoveTaskItem += ClientMoveTaskInventoryItem;
client.OnGrabObject += ProcessObjectGrab; client.OnGrabObject += ProcessObjectGrab;
client.OnDeGrabObject += ProcessObjectDeGrab; client.OnDeGrabObject += ProcessObjectDeGrab;
client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; client.OnMoneyTransferRequest += ProcessMoneyTransferRequest;