From 342126b7b9ca386f9160daecb51ecc14487a5f9f Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Wed, 22 Apr 2009 22:19:43 +0000 Subject: * Resolve http://opensimulator.org/mantis/view.php?id=3509 by putting some service initialization into CommsManager * What is really needed is a plugin and interface request system as being done for region modules --- .../Communications/CommunicationsManager.cs | 6 +++ OpenSim/Framework/Communications/IUserService.cs | 7 +++- .../Framework/Communications/UserManagerBase.cs | 45 ++++++++++++---------- 3 files changed, 37 insertions(+), 21 deletions(-) (limited to 'OpenSim/Framework/Communications') diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index b4078fd..1df1f48 100644 --- a/OpenSim/Framework/Communications/CommunicationsManager.cs +++ b/OpenSim/Framework/Communications/CommunicationsManager.cs @@ -36,6 +36,12 @@ namespace OpenSim.Framework.Communications /// /// This class manages references to OpenSim non-region services (asset, inventory, user, etc.) /// + /// + /// TODO: Service retrieval needs to be managed via plugin and interfaces requests, as happens for region + /// modules from scene. Among other things, this will allow this class to be used in many different contexts + /// (from a grid service executable, to provide services on a region) without lots of messy nulls and confusion. + /// Also, a post initialize step on the plugins will be needed so that we don't get tortuous problems with + /// circular dependencies between plugins. public class CommunicationsManager { //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Framework/Communications/IUserService.cs b/OpenSim/Framework/Communications/IUserService.cs index 3a56d35..fb24c15 100644 --- a/OpenSim/Framework/Communications/IUserService.cs +++ b/OpenSim/Framework/Communications/IUserService.cs @@ -117,7 +117,12 @@ namespace OpenSim.Framework.Communications /// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship /// for UUID friendslistowner /// - /// The agent that we're retreiving the friends Data. + /// + /// The agent for whom we're retreiving the friends Data. + /// + /// A List of FriendListItems that contains info about the user's friends. + /// Always returns a list even if the user has no friends + /// List GetUserFriendList(UUID friendlistowner); // This probably shouldn't be here, it belongs to IAuthentication diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index a269b59..2d0bf63 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs @@ -35,6 +35,7 @@ using Nwc.XmlRpc; using OpenMetaverse; using OpenMetaverse.StructuredData; using OpenSim.Data; +using OpenSim.Framework.Communications; using OpenSim.Framework.Statistics; namespace OpenSim.Framework.Communications @@ -52,15 +53,15 @@ namespace OpenSim.Framework.Communications /// private List m_plugins = new List(); - protected IInterServiceInventoryServices m_interServiceInventoryService; + protected CommunicationsManager m_commsManager; /// /// Constructor /// - /// - public UserManagerBase(IInterServiceInventoryServices interServiceInventoryService) + /// + public UserManagerBase(CommunicationsManager commsManager) { - m_interServiceInventoryService = interServiceInventoryService; + m_commsManager = commsManager; } /// @@ -296,48 +297,48 @@ namespace OpenSim.Framework.Communications return null; } - /// - /// Loads a user's friend list - /// - /// the UUID of the friend list owner - /// A List of FriendListItems that contains info about the user's friends public virtual List GetUserFriendList(UUID ownerID) { + List allFriends = new List(); + foreach (IUserDataPlugin plugin in m_plugins) { try { - List result = plugin.GetUserFriendList(ownerID); + List friends = plugin.GetUserFriendList(ownerID); - if (result != null) - return result; + if (friends != null) + allFriends.AddRange(friends); } catch (Exception e) { - m_log.Info("[USERSTORAGE]: Unable to GetUserFriendList via " + plugin.Name + "(" + e.ToString() + ")"); + m_log.Error("[USERSTORAGE]: Unable to GetUserFriendList via " + plugin.Name + "(" + e.ToString() + ")"); } } - return null; + return allFriends; } public virtual Dictionary GetFriendRegionInfos (List uuids) { + //Dictionary allFriendRegions = new Dictionary(); + foreach (IUserDataPlugin plugin in m_plugins) { try { - Dictionary result = plugin.GetFriendRegionInfos(uuids); + Dictionary friendRegions = plugin.GetFriendRegionInfos(uuids); - if (result != null) - return result; + if (friendRegions != null) + return friendRegions; } catch (Exception e) { m_log.Info("[USERSTORAGE]: Unable to GetFriendRegionInfos via " + plugin.Name + "(" + e.ToString() + ")"); } } - return null; + + return new Dictionary(); } public void StoreWebLoginKey(UUID agentID, UUID webLoginKey) @@ -662,7 +663,7 @@ namespace OpenSim.Framework.Communications } else { - m_interServiceInventoryService.CreateNewUserInventory(userProf.ID); + m_commsManager.InterServiceInventoryService.CreateNewUserInventory(userProf.ID); return userProf.ID; } @@ -731,13 +732,17 @@ namespace OpenSim.Framework.Communications { try { - return plugin.GetUserAppearance(user); + AvatarAppearance appearance = plugin.GetUserAppearance(user); + + if (appearance != null) + return appearance; } catch (Exception e) { m_log.InfoFormat("[USERSTORAGE]: Unable to find user appearance {0} via {1} ({2})", user.ToString(), plugin.Name, e.ToString()); } } + return null; } -- cgit v1.1