aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-04-11 16:30:58 +0000
committerJustin Clarke Casey2008-04-11 16:30:58 +0000
commit576db5b72a2fcd08598a435054f8455966b263fd (patch)
treee10e9250a3535a18ef18db8330cec94b85c318f8 /OpenSim/Framework
parentrefactor: eliminate method in UserProfileCacheService (diff)
downloadopensim-SC_OLD-576db5b72a2fcd08598a435054f8455966b263fd.zip
opensim-SC_OLD-576db5b72a2fcd08598a435054f8455966b263fd.tar.gz
opensim-SC_OLD-576db5b72a2fcd08598a435054f8455966b263fd.tar.bz2
opensim-SC_OLD-576db5b72a2fcd08598a435054f8455966b263fd.tar.xz
* documenting and minor refactoring in UserProfileCacheService
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs38
1 files changed, 24 insertions, 14 deletions
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
index 873070a..7178d2c 100644
--- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
+++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
@@ -39,21 +39,26 @@ namespace OpenSim.Framework.Communications.Cache
39 { 39 {
40 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 40 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
41 41
42 // Fields 42 /// <summary>
43 private readonly CommunicationsManager m_parent; 43 /// The comms manager holds the reference to this service
44 /// </summary>
45 private readonly CommunicationsManager m_commsManager;
46
47 /// <summary>
48 /// Each user has a cached profile.
49 /// </summary>
44 private readonly Dictionary<LLUUID, CachedUserInfo> m_userProfiles = new Dictionary<LLUUID, CachedUserInfo>(); 50 private readonly Dictionary<LLUUID, CachedUserInfo> m_userProfiles = new Dictionary<LLUUID, CachedUserInfo>();
45 51
46 public LibraryRootFolder libraryRoot = new LibraryRootFolder(); 52 public readonly LibraryRootFolder libraryRoot = new LibraryRootFolder();
47 53
48 // Methods 54 // Methods
49 public UserProfileCacheService(CommunicationsManager parent) 55 public UserProfileCacheService(CommunicationsManager commsManager)
50 { 56 {
51 m_parent = parent; 57 m_commsManager = commsManager;
52 } 58 }
53 59
54 /// <summary> 60 /// <summary>
55 /// A new user has moved into a region in this instance 61 /// A new user has moved into a region in this instance so retrieve their profile from the user service.
56 /// so get info from servers
57 /// </summary> 62 /// </summary>
58 /// <param name="userID"></param> 63 /// <param name="userID"></param>
59 public void AddNewUser(LLUUID userID) 64 public void AddNewUser(LLUUID userID)
@@ -63,8 +68,8 @@ namespace OpenSim.Framework.Communications.Cache
63 { 68 {
64 if (!m_userProfiles.ContainsKey(userID)) 69 if (!m_userProfiles.ContainsKey(userID))
65 { 70 {
66 CachedUserInfo userInfo = new CachedUserInfo(m_parent); 71 CachedUserInfo userInfo = new CachedUserInfo(m_commsManager);
67 userInfo.UserProfile = m_parent.UserService.GetUserProfile(userID); 72 userInfo.UserProfile = m_commsManager.UserService.GetUserProfile(userID);
68 73
69 if (userInfo.UserProfile != null) 74 if (userInfo.UserProfile != null)
70 { 75 {
@@ -73,7 +78,7 @@ namespace OpenSim.Framework.Communications.Cache
73 } 78 }
74 else 79 else
75 { 80 {
76 m_log.ErrorFormat("[USER CACHE]: User profile for user {0} not found", userID); 81 m_log.ErrorFormat("[USER CACHE]: User profile for user {0} not found.", userID);
77 } 82 }
78 } 83 }
79 } 84 }
@@ -89,7 +94,7 @@ namespace OpenSim.Framework.Communications.Cache
89 CachedUserInfo userInfo = GetUserDetails(userID); 94 CachedUserInfo userInfo = GetUserDetails(userID);
90 if (userInfo != null) 95 if (userInfo != null)
91 { 96 {
92 m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive); 97 m_commsManager.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive);
93 } 98 }
94 else 99 else
95 { 100 {
@@ -97,6 +102,11 @@ namespace OpenSim.Framework.Communications.Cache
97 } 102 }
98 } 103 }
99 104
105 /// <summary>
106 /// Get the details of the given user.
107 /// </summary>
108 /// <param name="userID"></param>
109 /// <returns>null if no user details are found</returns>
100 public CachedUserInfo GetUserDetails(LLUUID userID) 110 public CachedUserInfo GetUserDetails(LLUUID userID)
101 { 111 {
102 if (m_userProfiles.ContainsKey(userID)) 112 if (m_userProfiles.ContainsKey(userID))
@@ -128,7 +138,7 @@ namespace OpenSim.Framework.Communications.Cache
128 createdBaseFolder.ParentID = createdFolder.ParentID; 138 createdBaseFolder.ParentID = createdFolder.ParentID;
129 createdBaseFolder.Type = createdFolder.Type; 139 createdBaseFolder.Type = createdFolder.Type;
130 createdBaseFolder.Version = createdFolder.Version; 140 createdBaseFolder.Version = createdFolder.Version;
131 m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdBaseFolder); 141 m_commsManager.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdBaseFolder);
132 } 142 }
133 } 143 }
134 else 144 else
@@ -171,7 +181,7 @@ namespace OpenSim.Framework.Communications.Cache
171 baseFolder.ParentID = parentID; 181 baseFolder.ParentID = parentID;
172 baseFolder.Type = (short) type; 182 baseFolder.Type = (short) type;
173 baseFolder.Version = userProfile.RootFolder.Version; 183 baseFolder.Version = userProfile.RootFolder.Version;
174 m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, baseFolder); 184 m_commsManager.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, baseFolder);
175 } 185 }
176 } 186 }
177 } 187 }
@@ -188,7 +198,7 @@ namespace OpenSim.Framework.Communications.Cache
188 baseFolder.Owner = remoteClient.AgentId; 198 baseFolder.Owner = remoteClient.AgentId;
189 baseFolder.ID = folderID; 199 baseFolder.ID = folderID;
190 baseFolder.ParentID = parentID; 200 baseFolder.ParentID = parentID;
191 m_parent.InventoryService.MoveInventoryFolder(remoteClient.AgentId, baseFolder); 201 m_commsManager.InventoryService.MoveInventoryFolder(remoteClient.AgentId, baseFolder);
192 } 202 }
193 } 203 }
194 } 204 }