* minor documenting, cleanup, renaming in user profile cache service

0.6.0-stable
Justin Clarke Casey 2008-04-11 16:49:20 +00:00
parent 576db5b72a
commit 205b95f2e8
2 changed files with 29 additions and 12 deletions

View File

@ -32,16 +32,24 @@ using libsecondlife;
namespace OpenSim.Framework.Communications.Cache namespace OpenSim.Framework.Communications.Cache
{ {
/// <summary>
/// Stores user profile and inventory data received from backend services for a particular user.
/// </summary>
public class CachedUserInfo public class CachedUserInfo
{ {
private static readonly log4net.ILog m_log private static readonly log4net.ILog m_log
= log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private readonly CommunicationsManager m_parentCommsManager; /// <summary>
/// The comms manager holds references to services (user, grid, inventory, etc.)
/// </summary>
private readonly CommunicationsManager m_commsManager;
private UserProfileData m_userProfile;
public UserProfileData UserProfile { get { return m_userProfile; } }
// FIXME: These need to be hidden behind accessors // FIXME: These need to be hidden behind accessors
public InventoryFolderImpl RootFolder = null; public InventoryFolderImpl RootFolder = null;
public UserProfileData UserProfile = null;
/// <summary> /// <summary>
/// Stores received folders for which we have not yet received the parents. /// Stores received folders for which we have not yet received the parents.
@ -49,9 +57,15 @@ namespace OpenSim.Framework.Communications.Cache
private IDictionary<LLUUID, IList<InventoryFolderImpl>> pendingCategorizationFolders private IDictionary<LLUUID, IList<InventoryFolderImpl>> pendingCategorizationFolders
= new Dictionary<LLUUID, IList<InventoryFolderImpl>>(); = new Dictionary<LLUUID, IList<InventoryFolderImpl>>();
public CachedUserInfo(CommunicationsManager commsManager) /// <summary>
/// Constructor
/// </summary>
/// <param name="commsManager"></param>
/// <param name="userProfile"></param>
public CachedUserInfo(CommunicationsManager commsManager, UserProfileData userProfile)
{ {
m_parentCommsManager = commsManager; m_commsManager = commsManager;
m_userProfile = userProfile;
} }
/// <summary> /// <summary>
@ -197,7 +211,7 @@ namespace OpenSim.Framework.Communications.Cache
if ((userID == UserProfile.ID) && (RootFolder != null)) if ((userID == UserProfile.ID) && (RootFolder != null))
{ {
ItemReceive(userID, itemInfo); ItemReceive(userID, itemInfo);
m_parentCommsManager.InventoryService.AddNewInventoryItem(userID, itemInfo); m_commsManager.InventoryService.AddNewInventoryItem(userID, itemInfo);
} }
} }
@ -205,7 +219,7 @@ namespace OpenSim.Framework.Communications.Cache
{ {
if ((userID == UserProfile.ID) && (RootFolder != null)) if ((userID == UserProfile.ID) && (RootFolder != null))
{ {
m_parentCommsManager.InventoryService.AddNewInventoryItem(userID, itemInfo); m_commsManager.InventoryService.AddNewInventoryItem(userID, itemInfo);
} }
} }
@ -217,7 +231,7 @@ namespace OpenSim.Framework.Communications.Cache
result = RootFolder.DeleteItem(item.ID); result = RootFolder.DeleteItem(item.ID);
if (result) if (result)
{ {
m_parentCommsManager.InventoryService.DeleteInventoryItem(userID, item); m_commsManager.InventoryService.DeleteInventoryItem(userID, item);
} }
} }
return result; return result;

View File

@ -35,12 +35,15 @@ using OpenSim.Framework.Console;
namespace OpenSim.Framework.Communications.Cache namespace OpenSim.Framework.Communications.Cache
{ {
/// <summary>
/// Holds user profile information and retrieves it from backend services.
/// </summary>
public class UserProfileCacheService public class UserProfileCacheService
{ {
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
/// <summary> /// <summary>
/// The comms manager holds the reference to this service /// The comms manager holds references to services (user, grid, inventory, etc.)
/// </summary> /// </summary>
private readonly CommunicationsManager m_commsManager; private readonly CommunicationsManager m_commsManager;
@ -68,12 +71,12 @@ namespace OpenSim.Framework.Communications.Cache
{ {
if (!m_userProfiles.ContainsKey(userID)) if (!m_userProfiles.ContainsKey(userID))
{ {
CachedUserInfo userInfo = new CachedUserInfo(m_commsManager); UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(userID);
userInfo.UserProfile = m_commsManager.UserService.GetUserProfile(userID); CachedUserInfo userInfo = new CachedUserInfo(m_commsManager, userProfile);
if (userInfo.UserProfile != null) if (userInfo.UserProfile != null)
{ {
// The inventory will be populated when the user actually enters the scene // The inventory for the user will be populated when they actually enter the scene
m_userProfiles.Add(userID, userInfo); m_userProfiles.Add(userID, userInfo);
} }
else else
@ -85,7 +88,7 @@ namespace OpenSim.Framework.Communications.Cache
} }
/// <summary> /// <summary>
/// Request the inventory data for the given user. This will occur asynchronous if running on a grid /// Request the inventory data for the given user. This will occur asynchronously if running on a grid
/// </summary> /// </summary>
/// <param name="userID"></param> /// <param name="userID"></param>
/// <param name="userInfo"></param> /// <param name="userInfo"></param>