From 0f367bd7bbc5d22d4834e1eb0f1671381485143e Mon Sep 17 00:00:00 2001
From: diva
Date: Wed, 10 Jun 2009 13:18:32 +0000
Subject: Heart surgery no.2: the inventory service hooks. Several improvements
in the connectors themselves. Several improvements in configurations. Needed
to add a hack in IUserService and UserManagerBase, to be removed when that
service is refactored.
---
.../Communications/Cache/CachedUserInfo.cs | 99 ++++------------------
.../Cache/UserProfileCacheService.cs | 10 ++-
2 files changed, 24 insertions(+), 85 deletions(-)
(limited to 'OpenSim/Framework/Communications/Cache')
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index 5181bdaea..10aff42 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
using System.Reflection;
using log4net;
using OpenMetaverse;
+using OpenSim.Services.Interfaces;
namespace OpenSim.Framework.Communications.Cache
{
@@ -62,7 +63,7 @@ namespace OpenSim.Framework.Communications.Cache
///
/// The comms manager holds references to services (user, grid, inventory, etc.)
///
- private readonly CommunicationsManager m_commsManager;
+ private readonly IInventoryService m_InventoryService;
public UserProfileData UserProfile { get { return m_userProfile; } }
private UserProfileData m_userProfile;
@@ -96,10 +97,10 @@ namespace OpenSim.Framework.Communications.Cache
///
///
///
- public CachedUserInfo(CommunicationsManager commsManager, UserProfileData userProfile)
+ public CachedUserInfo(IInventoryService invService, UserProfileData userProfile)
{
- m_commsManager = commsManager;
m_userProfile = userProfile;
+ m_InventoryService = invService;
}
///
@@ -213,15 +214,7 @@ namespace OpenSim.Framework.Communications.Cache
/// asynchronously otherwise.
public void FetchInventory()
{
- if (m_commsManager.SecureInventoryService != null)
- {
- m_commsManager.SecureInventoryService.RequestInventoryForUser(
- UserProfile.ID, SessionID, InventoryReceive);
- }
- else
- {
- m_commsManager.InventoryService.RequestInventoryForUser(UserProfile.ID, InventoryReceive);
- }
+ m_InventoryService.GetUserInventory(UserProfile.ID, InventoryReceive);
}
///
@@ -383,14 +376,8 @@ namespace OpenSim.Framework.Communications.Cache
createdBaseFolder.Type = createdFolder.Type;
createdBaseFolder.Version = createdFolder.Version;
- if (m_commsManager.SecureInventoryService != null)
- {
- m_commsManager.SecureInventoryService.AddFolder(createdBaseFolder, m_session_id);
- }
- else
- {
- m_commsManager.InventoryService.AddFolder(createdBaseFolder);
- }
+ m_InventoryService.AddFolder(createdBaseFolder);
+
return true;
}
else
@@ -449,14 +436,7 @@ namespace OpenSim.Framework.Communications.Cache
baseFolder.Type = (short)type;
baseFolder.Version = RootFolder.Version;
- if (m_commsManager.SecureInventoryService != null)
- {
- m_commsManager.SecureInventoryService.UpdateFolder(baseFolder, m_session_id);
- }
- else
- {
- m_commsManager.InventoryService.UpdateFolder(baseFolder);
- }
+ m_InventoryService.UpdateFolder(baseFolder);
folder.Name = name;
folder.Type = (short)type;
@@ -498,14 +478,7 @@ namespace OpenSim.Framework.Communications.Cache
baseFolder.ID = folderID;
baseFolder.ParentID = parentID;
- if (m_commsManager.SecureInventoryService != null)
- {
- m_commsManager.SecureInventoryService.MoveFolder(baseFolder, m_session_id);
- }
- else
- {
- m_commsManager.InventoryService.MoveFolder(baseFolder);
- }
+ m_InventoryService.MoveFolder(baseFolder);
InventoryFolderImpl folder = RootFolder.FindFolder(folderID);
InventoryFolderImpl parentFolder = RootFolder.FindFolder(parentID);
@@ -568,14 +541,7 @@ namespace OpenSim.Framework.Communications.Cache
purgedBaseFolder.Type = purgedFolder.Type;
purgedBaseFolder.Version = purgedFolder.Version;
- if (m_commsManager.SecureInventoryService != null)
- {
- m_commsManager.SecureInventoryService.PurgeFolder(purgedBaseFolder, m_session_id);
- }
- else
- {
- m_commsManager.InventoryService.PurgeFolder(purgedBaseFolder);
- }
+ m_InventoryService.PurgeFolder(purgedBaseFolder);
purgedFolder.Purge();
@@ -615,14 +581,7 @@ namespace OpenSim.Framework.Communications.Cache
}
ItemReceive(item, null);
- if (m_commsManager.SecureInventoryService != null)
- {
- m_commsManager.SecureInventoryService.AddItem(item, m_session_id);
- }
- else
- {
- m_commsManager.InventoryService.AddItem(item);
- }
+ m_InventoryService.AddItem(item);
}
else
{
@@ -642,14 +601,7 @@ namespace OpenSim.Framework.Communications.Cache
{
if (m_hasReceivedInventory)
{
- if (m_commsManager.SecureInventoryService != null)
- {
- m_commsManager.SecureInventoryService.UpdateItem(item, m_session_id);
- }
- else
- {
- m_commsManager.InventoryService.UpdateItem(item);
- }
+ m_InventoryService.UpdateItem(item);
}
else
{
@@ -688,14 +640,7 @@ namespace OpenSim.Framework.Communications.Cache
if (RootFolder.DeleteItem(item.ID))
{
- if (m_commsManager.SecureInventoryService != null)
- {
- return m_commsManager.SecureInventoryService.DeleteItem(item, m_session_id);
- }
- else
- {
- return m_commsManager.InventoryService.DeleteItem(item);
- }
+ return m_InventoryService.DeleteItem(item);
}
}
else
@@ -789,14 +734,7 @@ namespace OpenSim.Framework.Communications.Cache
InventoryItemBase itemInfo = null;
- if (m_commsManager.SecureInventoryService != null)
- {
- itemInfo = m_commsManager.SecureInventoryService.QueryItem(item, m_session_id);
- }
- else
- {
- itemInfo = m_commsManager.InventoryService.QueryItem(item);
- }
+ itemInfo = m_InventoryService.QueryItem(item);
if (itemInfo != null)
{
@@ -833,14 +771,7 @@ namespace OpenSim.Framework.Communications.Cache
InventoryFolderBase folderInfo = null;
- if (m_commsManager.SecureInventoryService != null)
- {
- folderInfo = m_commsManager.SecureInventoryService.QueryFolder(folder, m_session_id);
- }
- else
- {
- folderInfo = m_commsManager.InventoryService.QueryFolder(folder);
- }
+ folderInfo = m_InventoryService.QueryFolder(folder);
if (folderInfo != null)
{
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
index b7f209c..c9f5236 100644
--- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
+++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
@@ -29,6 +29,7 @@ using System.Collections.Generic;
using System.Reflection;
using log4net;
using OpenMetaverse;
+using OpenSim.Services.Interfaces;
namespace OpenSim.Framework.Communications.Cache
{
@@ -66,6 +67,8 @@ namespace OpenSim.Framework.Communications.Cache
///
public readonly InventoryFolderImpl LibraryRoot;
+ private IInventoryService m_InventoryService;
+
///
/// Constructor
///
@@ -77,6 +80,11 @@ namespace OpenSim.Framework.Communications.Cache
LibraryRoot = libraryRootFolder;
}
+ public void SetInventoryService(IInventoryService invService)
+ {
+ m_InventoryService = invService;
+ }
+
///
/// A new user has moved into a region in this instance so retrieve their profile from the user service.
///
@@ -200,7 +208,7 @@ namespace OpenSim.Framework.Communications.Cache
///
protected CachedUserInfo AddToCaches(UserProfileData userProfile)
{
- CachedUserInfo createdUserInfo = new CachedUserInfo(m_commsManager, userProfile);
+ CachedUserInfo createdUserInfo = new CachedUserInfo(m_InventoryService, userProfile);
lock (m_userProfilesById)
{
--
cgit v1.1