diff options
author | Justin Clarke Casey | 2009-04-22 22:19:43 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-04-22 22:19:43 +0000 |
commit | 342126b7b9ca386f9160daecb51ecc14487a5f9f (patch) | |
tree | a485a50aebead411fa2f38528b4c0b7ba19e91db /OpenSim/Framework/Communications | |
parent | * Resolve http://opensimulator.org/mantis/view.php?id=3509 by passing up the ... (diff) | |
download | opensim-SC_OLD-342126b7b9ca386f9160daecb51ecc14487a5f9f.zip opensim-SC_OLD-342126b7b9ca386f9160daecb51ecc14487a5f9f.tar.gz opensim-SC_OLD-342126b7b9ca386f9160daecb51ecc14487a5f9f.tar.bz2 opensim-SC_OLD-342126b7b9ca386f9160daecb51ecc14487a5f9f.tar.xz |
* 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
Diffstat (limited to 'OpenSim/Framework/Communications')
-rw-r--r-- | OpenSim/Framework/Communications/CommunicationsManager.cs | 6 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/IUserService.cs | 7 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/UserManagerBase.cs | 45 |
3 files changed, 37 insertions, 21 deletions
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 | |||
36 | /// <summary> | 36 | /// <summary> |
37 | /// This class manages references to OpenSim non-region services (asset, inventory, user, etc.) | 37 | /// This class manages references to OpenSim non-region services (asset, inventory, user, etc.) |
38 | /// </summary> | 38 | /// </summary> |
39 | /// | ||
40 | /// TODO: Service retrieval needs to be managed via plugin and interfaces requests, as happens for region | ||
41 | /// modules from scene. Among other things, this will allow this class to be used in many different contexts | ||
42 | /// (from a grid service executable, to provide services on a region) without lots of messy nulls and confusion. | ||
43 | /// Also, a post initialize step on the plugins will be needed so that we don't get tortuous problems with | ||
44 | /// circular dependencies between plugins. | ||
39 | public class CommunicationsManager | 45 | public class CommunicationsManager |
40 | { | 46 | { |
41 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | //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 | |||
117 | /// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship | 117 | /// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship |
118 | /// for UUID friendslistowner | 118 | /// for UUID friendslistowner |
119 | /// </summary> | 119 | /// </summary> |
120 | /// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param> | 120 | /// |
121 | /// <param name="friendlistowner">The agent for whom we're retreiving the friends Data.</param> | ||
122 | /// <returns> | ||
123 | /// A List of FriendListItems that contains info about the user's friends. | ||
124 | /// Always returns a list even if the user has no friends | ||
125 | /// </returns> | ||
121 | List<FriendListItem> GetUserFriendList(UUID friendlistowner); | 126 | List<FriendListItem> GetUserFriendList(UUID friendlistowner); |
122 | 127 | ||
123 | // This probably shouldn't be here, it belongs to IAuthentication | 128 | // 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; | |||
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenMetaverse.StructuredData; | 36 | using OpenMetaverse.StructuredData; |
37 | using OpenSim.Data; | 37 | using OpenSim.Data; |
38 | using OpenSim.Framework.Communications; | ||
38 | using OpenSim.Framework.Statistics; | 39 | using OpenSim.Framework.Statistics; |
39 | 40 | ||
40 | namespace OpenSim.Framework.Communications | 41 | namespace OpenSim.Framework.Communications |
@@ -52,15 +53,15 @@ namespace OpenSim.Framework.Communications | |||
52 | /// </value> | 53 | /// </value> |
53 | private List<IUserDataPlugin> m_plugins = new List<IUserDataPlugin>(); | 54 | private List<IUserDataPlugin> m_plugins = new List<IUserDataPlugin>(); |
54 | 55 | ||
55 | protected IInterServiceInventoryServices m_interServiceInventoryService; | 56 | protected CommunicationsManager m_commsManager; |
56 | 57 | ||
57 | /// <summary> | 58 | /// <summary> |
58 | /// Constructor | 59 | /// Constructor |
59 | /// </summary> | 60 | /// </summary> |
60 | /// <param name="interServiceInventoryService"></param> | 61 | /// <param name="commsManager"></param> |
61 | public UserManagerBase(IInterServiceInventoryServices interServiceInventoryService) | 62 | public UserManagerBase(CommunicationsManager commsManager) |
62 | { | 63 | { |
63 | m_interServiceInventoryService = interServiceInventoryService; | 64 | m_commsManager = commsManager; |
64 | } | 65 | } |
65 | 66 | ||
66 | /// <summary> | 67 | /// <summary> |
@@ -296,48 +297,48 @@ namespace OpenSim.Framework.Communications | |||
296 | return null; | 297 | return null; |
297 | } | 298 | } |
298 | 299 | ||
299 | /// <summary> | ||
300 | /// Loads a user's friend list | ||
301 | /// </summary> | ||
302 | /// <param name="name">the UUID of the friend list owner</param> | ||
303 | /// <returns>A List of FriendListItems that contains info about the user's friends</returns> | ||
304 | public virtual List<FriendListItem> GetUserFriendList(UUID ownerID) | 300 | public virtual List<FriendListItem> GetUserFriendList(UUID ownerID) |
305 | { | 301 | { |
302 | List<FriendListItem> allFriends = new List<FriendListItem>(); | ||
303 | |||
306 | foreach (IUserDataPlugin plugin in m_plugins) | 304 | foreach (IUserDataPlugin plugin in m_plugins) |
307 | { | 305 | { |
308 | try | 306 | try |
309 | { | 307 | { |
310 | List<FriendListItem> result = plugin.GetUserFriendList(ownerID); | 308 | List<FriendListItem> friends = plugin.GetUserFriendList(ownerID); |
311 | 309 | ||
312 | if (result != null) | 310 | if (friends != null) |
313 | return result; | 311 | allFriends.AddRange(friends); |
314 | } | 312 | } |
315 | catch (Exception e) | 313 | catch (Exception e) |
316 | { | 314 | { |
317 | m_log.Info("[USERSTORAGE]: Unable to GetUserFriendList via " + plugin.Name + "(" + e.ToString() + ")"); | 315 | m_log.Error("[USERSTORAGE]: Unable to GetUserFriendList via " + plugin.Name + "(" + e.ToString() + ")"); |
318 | } | 316 | } |
319 | } | 317 | } |
320 | 318 | ||
321 | return null; | 319 | return allFriends; |
322 | } | 320 | } |
323 | 321 | ||
324 | public virtual Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos (List<UUID> uuids) | 322 | public virtual Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos (List<UUID> uuids) |
325 | { | 323 | { |
324 | //Dictionary<UUID, FriendRegionInfo> allFriendRegions = new Dictionary<UUID, FriendRegionInfo>(); | ||
325 | |||
326 | foreach (IUserDataPlugin plugin in m_plugins) | 326 | foreach (IUserDataPlugin plugin in m_plugins) |
327 | { | 327 | { |
328 | try | 328 | try |
329 | { | 329 | { |
330 | Dictionary<UUID, FriendRegionInfo> result = plugin.GetFriendRegionInfos(uuids); | 330 | Dictionary<UUID, FriendRegionInfo> friendRegions = plugin.GetFriendRegionInfos(uuids); |
331 | 331 | ||
332 | if (result != null) | 332 | if (friendRegions != null) |
333 | return result; | 333 | return friendRegions; |
334 | } | 334 | } |
335 | catch (Exception e) | 335 | catch (Exception e) |
336 | { | 336 | { |
337 | m_log.Info("[USERSTORAGE]: Unable to GetFriendRegionInfos via " + plugin.Name + "(" + e.ToString() + ")"); | 337 | m_log.Info("[USERSTORAGE]: Unable to GetFriendRegionInfos via " + plugin.Name + "(" + e.ToString() + ")"); |
338 | } | 338 | } |
339 | } | 339 | } |
340 | return null; | 340 | |
341 | return new Dictionary<UUID, FriendRegionInfo>(); | ||
341 | } | 342 | } |
342 | 343 | ||
343 | public void StoreWebLoginKey(UUID agentID, UUID webLoginKey) | 344 | public void StoreWebLoginKey(UUID agentID, UUID webLoginKey) |
@@ -662,7 +663,7 @@ namespace OpenSim.Framework.Communications | |||
662 | } | 663 | } |
663 | else | 664 | else |
664 | { | 665 | { |
665 | m_interServiceInventoryService.CreateNewUserInventory(userProf.ID); | 666 | m_commsManager.InterServiceInventoryService.CreateNewUserInventory(userProf.ID); |
666 | 667 | ||
667 | return userProf.ID; | 668 | return userProf.ID; |
668 | } | 669 | } |
@@ -731,13 +732,17 @@ namespace OpenSim.Framework.Communications | |||
731 | { | 732 | { |
732 | try | 733 | try |
733 | { | 734 | { |
734 | return plugin.GetUserAppearance(user); | 735 | AvatarAppearance appearance = plugin.GetUserAppearance(user); |
736 | |||
737 | if (appearance != null) | ||
738 | return appearance; | ||
735 | } | 739 | } |
736 | catch (Exception e) | 740 | catch (Exception e) |
737 | { | 741 | { |
738 | m_log.InfoFormat("[USERSTORAGE]: Unable to find user appearance {0} via {1} ({2})", user.ToString(), plugin.Name, e.ToString()); | 742 | m_log.InfoFormat("[USERSTORAGE]: Unable to find user appearance {0} via {1} ({2})", user.ToString(), plugin.Name, e.ToString()); |
739 | } | 743 | } |
740 | } | 744 | } |
745 | |||
741 | return null; | 746 | return null; |
742 | } | 747 | } |
743 | 748 | ||