diff options
author | MW | 2009-02-22 11:01:26 +0000 |
---|---|---|
committer | MW | 2009-02-22 11:01:26 +0000 |
commit | 9b0b0b5e28065155b2662a9c275f2236f3db3a26 (patch) | |
tree | 29102e0bec1414fc36dc1be012ac5b13ac81c5ec /OpenSim/Grid/UserServer/UserManager.cs | |
parent | * And a little more (diff) | |
download | opensim-SC-9b0b0b5e28065155b2662a9c275f2236f3db3a26.zip opensim-SC-9b0b0b5e28065155b2662a9c275f2236f3db3a26.tar.gz opensim-SC-9b0b0b5e28065155b2662a9c275f2236f3db3a26.tar.bz2 opensim-SC-9b0b0b5e28065155b2662a9c275f2236f3db3a26.tar.xz |
Part 1 of refactoring the userserver. Changed it so instead of subclassing the User dataBase access class (UserManagerBase) and then adding the http handlers to that. There is now a UserDataBaseService that is passed to the other classes so they can access the db. This should make it easier to have multiple "modules" that can register http handlers and access the db.
Diffstat (limited to 'OpenSim/Grid/UserServer/UserManager.cs')
-rw-r--r-- | OpenSim/Grid/UserServer/UserManager.cs | 69 |
1 files changed, 29 insertions, 40 deletions
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs index 0a60eff..f3e9884 100644 --- a/OpenSim/Grid/UserServer/UserManager.cs +++ b/OpenSim/Grid/UserServer/UserManager.cs | |||
@@ -40,20 +40,23 @@ namespace OpenSim.Grid.UserServer | |||
40 | { | 40 | { |
41 | public delegate void logOffUser(UUID AgentID); | 41 | public delegate void logOffUser(UUID AgentID); |
42 | 42 | ||
43 | public class UserManager : UserManagerBase | 43 | public class UserManager |
44 | { | 44 | { |
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 46 | ||
47 | public event logOffUser OnLogOffUser; | 47 | public event logOffUser OnLogOffUser; |
48 | private logOffUser handlerLogOffUser; | 48 | private logOffUser handlerLogOffUser; |
49 | |||
50 | private UserDataBaseService m_userDataBaseService; | ||
49 | 51 | ||
50 | /// <summary> | 52 | /// <summary> |
51 | /// Constructor | 53 | /// Constructor |
52 | /// </summary> | 54 | /// </summary> |
53 | /// <param name="interServiceInventoryService"></param> | 55 | /// <param name="interServiceInventoryService"></param> |
54 | public UserManager(IInterServiceInventoryServices interServiceInventoryService) | 56 | public UserManager(IInterServiceInventoryServices interServiceInventoryService, UserDataBaseService userDataBaseService) |
55 | : base(interServiceInventoryService) | 57 | { |
56 | {} | 58 | m_userDataBaseService = userDataBaseService; |
59 | } | ||
57 | 60 | ||
58 | /// <summary> | 61 | /// <summary> |
59 | /// Deletes an active agent session | 62 | /// Deletes an active agent session |
@@ -185,7 +188,7 @@ namespace OpenSim.Grid.UserServer | |||
185 | if (requestData.Contains("avquery") && requestData.Contains("queryid")) | 188 | if (requestData.Contains("avquery") && requestData.Contains("queryid")) |
186 | { | 189 | { |
187 | queryID = new UUID((string) requestData["queryid"]); | 190 | queryID = new UUID((string) requestData["queryid"]); |
188 | returnAvatar = GenerateAgentPickerRequestResponse(queryID, (string) requestData["avquery"]); | 191 | returnAvatar = m_userDataBaseService.GenerateAgentPickerRequestResponse(queryID, (string) requestData["avquery"]); |
189 | } | 192 | } |
190 | 193 | ||
191 | m_log.InfoFormat("[AVATARINFO]: Servicing Avatar Query: " + (string) requestData["avquery"]); | 194 | m_log.InfoFormat("[AVATARINFO]: Servicing Avatar Query: " + (string) requestData["avquery"]); |
@@ -211,11 +214,11 @@ namespace OpenSim.Grid.UserServer | |||
211 | 214 | ||
212 | if (avatarUUID != UUID.Zero) | 215 | if (avatarUUID != UUID.Zero) |
213 | { | 216 | { |
214 | UserProfileData userProfile = GetUserProfile(avatarUUID); | 217 | UserProfileData userProfile = m_userDataBaseService.GetUserProfile(avatarUUID); |
215 | userProfile.CurrentAgent.Region = regionUUID; | 218 | userProfile.CurrentAgent.Region = regionUUID; |
216 | userProfile.CurrentAgent.Handle = (ulong) Convert.ToInt64((string) requestData["region_handle"]); | 219 | userProfile.CurrentAgent.Handle = (ulong) Convert.ToInt64((string) requestData["region_handle"]); |
217 | //userProfile.CurrentAgent. | 220 | //userProfile.CurrentAgent. |
218 | CommitAgent(ref userProfile); | 221 | m_userDataBaseService.CommitAgent(ref userProfile); |
219 | //setUserProfile(userProfile); | 222 | //setUserProfile(userProfile); |
220 | 223 | ||
221 | 224 | ||
@@ -239,7 +242,7 @@ namespace OpenSim.Grid.UserServer | |||
239 | requestData.Contains("friendPerms")) | 242 | requestData.Contains("friendPerms")) |
240 | { | 243 | { |
241 | // UserManagerBase.AddNewuserFriend | 244 | // UserManagerBase.AddNewuserFriend |
242 | AddNewUserFriend(new UUID((string) requestData["ownerID"]), | 245 | m_userDataBaseService.AddNewUserFriend(new UUID((string)requestData["ownerID"]), |
243 | new UUID((string) requestData["friendID"]), | 246 | new UUID((string) requestData["friendID"]), |
244 | (uint) Convert.ToInt32((string) requestData["friendPerms"])); | 247 | (uint) Convert.ToInt32((string) requestData["friendPerms"])); |
245 | returnString = "TRUE"; | 248 | returnString = "TRUE"; |
@@ -260,7 +263,7 @@ namespace OpenSim.Grid.UserServer | |||
260 | if (requestData.Contains("ownerID") && requestData.Contains("friendID")) | 263 | if (requestData.Contains("ownerID") && requestData.Contains("friendID")) |
261 | { | 264 | { |
262 | // UserManagerBase.AddNewuserFriend | 265 | // UserManagerBase.AddNewuserFriend |
263 | RemoveUserFriend(new UUID((string) requestData["ownerID"]), | 266 | m_userDataBaseService.RemoveUserFriend(new UUID((string)requestData["ownerID"]), |
264 | new UUID((string) requestData["friendID"])); | 267 | new UUID((string) requestData["friendID"])); |
265 | returnString = "TRUE"; | 268 | returnString = "TRUE"; |
266 | } | 269 | } |
@@ -279,7 +282,7 @@ namespace OpenSim.Grid.UserServer | |||
279 | if (requestData.Contains("ownerID") && requestData.Contains("friendID") && | 282 | if (requestData.Contains("ownerID") && requestData.Contains("friendID") && |
280 | requestData.Contains("friendPerms")) | 283 | requestData.Contains("friendPerms")) |
281 | { | 284 | { |
282 | UpdateUserFriendPerms(new UUID((string) requestData["ownerID"]), | 285 | m_userDataBaseService.UpdateUserFriendPerms(new UUID((string)requestData["ownerID"]), |
283 | new UUID((string) requestData["friendID"]), | 286 | new UUID((string) requestData["friendID"]), |
284 | (uint) Convert.ToInt32((string) requestData["friendPerms"])); | 287 | (uint) Convert.ToInt32((string) requestData["friendPerms"])); |
285 | // UserManagerBase. | 288 | // UserManagerBase. |
@@ -300,7 +303,7 @@ namespace OpenSim.Grid.UserServer | |||
300 | 303 | ||
301 | if (requestData.Contains("ownerID")) | 304 | if (requestData.Contains("ownerID")) |
302 | { | 305 | { |
303 | returndata = GetUserFriendList(new UUID((string) requestData["ownerID"])); | 306 | returndata = m_userDataBaseService.GetUserFriendList(new UUID((string)requestData["ownerID"])); |
304 | } | 307 | } |
305 | 308 | ||
306 | return FriendListItemListtoXmlRPCResponse(returndata); | 309 | return FriendListItemListtoXmlRPCResponse(returndata); |
@@ -314,7 +317,7 @@ namespace OpenSim.Grid.UserServer | |||
314 | Hashtable responseData; | 317 | Hashtable responseData; |
315 | if (requestData.Contains("owner")) | 318 | if (requestData.Contains("owner")) |
316 | { | 319 | { |
317 | appearance = GetUserAppearance(new UUID((string) requestData["owner"])); | 320 | appearance = m_userDataBaseService.GetUserAppearance(new UUID((string)requestData["owner"])); |
318 | if (appearance == null) | 321 | if (appearance == null) |
319 | { | 322 | { |
320 | responseData = new Hashtable(); | 323 | responseData = new Hashtable(); |
@@ -345,7 +348,7 @@ namespace OpenSim.Grid.UserServer | |||
345 | if (requestData.Contains("owner")) | 348 | if (requestData.Contains("owner")) |
346 | { | 349 | { |
347 | AvatarAppearance appearance = new AvatarAppearance(requestData); | 350 | AvatarAppearance appearance = new AvatarAppearance(requestData); |
348 | UpdateUserAppearance(new UUID((string) requestData["owner"]), appearance); | 351 | m_userDataBaseService.UpdateUserAppearance(new UUID((string)requestData["owner"]), appearance); |
349 | responseData = new Hashtable(); | 352 | responseData = new Hashtable(); |
350 | responseData["returnString"] = "TRUE"; | 353 | responseData["returnString"] = "TRUE"; |
351 | } | 354 | } |
@@ -374,7 +377,7 @@ namespace OpenSim.Grid.UserServer | |||
374 | 377 | ||
375 | if (querysplit.Length == 2) | 378 | if (querysplit.Length == 2) |
376 | { | 379 | { |
377 | userProfile = GetUserProfile(querysplit[0], querysplit[1]); | 380 | userProfile = m_userDataBaseService.GetUserProfile(querysplit[0], querysplit[1]); |
378 | if (userProfile == null) | 381 | if (userProfile == null) |
379 | { | 382 | { |
380 | return CreateUnknownUserErrorResponse(); | 383 | return CreateUnknownUserErrorResponse(); |
@@ -406,7 +409,7 @@ namespace OpenSim.Grid.UserServer | |||
406 | { | 409 | { |
407 | UUID guess = new UUID((string) requestData["avatar_uuid"]); | 410 | UUID guess = new UUID((string) requestData["avatar_uuid"]); |
408 | 411 | ||
409 | userProfile = GetUserProfile(guess); | 412 | userProfile = m_userDataBaseService.GetUserProfile(guess); |
410 | } | 413 | } |
411 | catch (FormatException) | 414 | catch (FormatException) |
412 | { | 415 | { |
@@ -444,7 +447,7 @@ namespace OpenSim.Grid.UserServer | |||
444 | return CreateUnknownUserErrorResponse(); | 447 | return CreateUnknownUserErrorResponse(); |
445 | } | 448 | } |
446 | 449 | ||
447 | userProfile = GetUserProfile(guess); | 450 | userProfile = m_userDataBaseService.GetUserProfile(guess); |
448 | 451 | ||
449 | if (userProfile == null) | 452 | if (userProfile == null) |
450 | { | 453 | { |
@@ -497,7 +500,7 @@ namespace OpenSim.Grid.UserServer | |||
497 | { | 500 | { |
498 | return CreateUnknownUserErrorResponse(); | 501 | return CreateUnknownUserErrorResponse(); |
499 | } | 502 | } |
500 | userProfile = GetUserProfile(guess_aid); | 503 | userProfile = m_userDataBaseService.GetUserProfile(guess_aid); |
501 | if (userProfile != null && userProfile.CurrentAgent != null && | 504 | if (userProfile != null && userProfile.CurrentAgent != null && |
502 | userProfile.CurrentAgent.SessionID == guess_sid) | 505 | userProfile.CurrentAgent.SessionID == guess_sid) |
503 | { | 506 | { |
@@ -529,7 +532,7 @@ namespace OpenSim.Grid.UserServer | |||
529 | } | 532 | } |
530 | 533 | ||
531 | UUID UserUUID = new UUID((string) requestData["avatar_uuid"]); | 534 | UUID UserUUID = new UUID((string) requestData["avatar_uuid"]); |
532 | UserProfileData userProfile = GetUserProfile(UserUUID); | 535 | UserProfileData userProfile = m_userDataBaseService.GetUserProfile(UserUUID); |
533 | if (null == userProfile) | 536 | if (null == userProfile) |
534 | { | 537 | { |
535 | return CreateUnknownUserErrorResponse(); | 538 | return CreateUnknownUserErrorResponse(); |
@@ -703,7 +706,7 @@ namespace OpenSim.Grid.UserServer | |||
703 | } | 706 | } |
704 | 707 | ||
705 | // call plugin! | 708 | // call plugin! |
706 | bool ret = UpdateUserProfile(userProfile); | 709 | bool ret = m_userDataBaseService.UpdateUserProfile(userProfile); |
707 | responseData["returnString"] = ret.ToString(); | 710 | responseData["returnString"] = ret.ToString(); |
708 | response.Value = responseData; | 711 | response.Value = responseData; |
709 | return response; | 712 | return response; |
@@ -734,7 +737,7 @@ namespace OpenSim.Grid.UserServer | |||
734 | if (handlerLogOffUser != null) | 737 | if (handlerLogOffUser != null) |
735 | handlerLogOffUser(userUUID); | 738 | handlerLogOffUser(userUUID); |
736 | 739 | ||
737 | LogOffUser(userUUID, RegionID, regionhandle, position, lookat); | 740 | m_userDataBaseService.LogOffUser(userUUID, RegionID, regionhandle, position, lookat); |
738 | } | 741 | } |
739 | catch (FormatException) | 742 | catch (FormatException) |
740 | { | 743 | { |
@@ -752,35 +755,21 @@ namespace OpenSim.Grid.UserServer | |||
752 | 755 | ||
753 | #endregion | 756 | #endregion |
754 | 757 | ||
755 | public override UserProfileData SetupMasterUser(string firstName, string lastName) | ||
756 | { | ||
757 | throw new Exception("The method or operation is not implemented."); | ||
758 | } | ||
759 | |||
760 | public override UserProfileData SetupMasterUser(string firstName, string lastName, string password) | ||
761 | { | ||
762 | throw new Exception("The method or operation is not implemented."); | ||
763 | } | ||
764 | |||
765 | public override UserProfileData SetupMasterUser(UUID uuid) | ||
766 | { | ||
767 | throw new Exception("The method or operation is not implemented."); | ||
768 | } | ||
769 | 758 | ||
770 | public void HandleAgentLocation(UUID agentID, UUID regionID, ulong regionHandle) | 759 | public void HandleAgentLocation(UUID agentID, UUID regionID, ulong regionHandle) |
771 | { | 760 | { |
772 | UserProfileData userProfile = GetUserProfile(agentID); | 761 | UserProfileData userProfile = m_userDataBaseService.GetUserProfile(agentID); |
773 | if (userProfile != null) | 762 | if (userProfile != null) |
774 | { | 763 | { |
775 | userProfile.CurrentAgent.Region = regionID; | 764 | userProfile.CurrentAgent.Region = regionID; |
776 | userProfile.CurrentAgent.Handle = regionHandle; | 765 | userProfile.CurrentAgent.Handle = regionHandle; |
777 | CommitAgent(ref userProfile); | 766 | m_userDataBaseService.CommitAgent(ref userProfile); |
778 | } | 767 | } |
779 | } | 768 | } |
780 | 769 | ||
781 | public void HandleAgentLeaving(UUID agentID, UUID regionID, ulong regionHandle) | 770 | public void HandleAgentLeaving(UUID agentID, UUID regionID, ulong regionHandle) |
782 | { | 771 | { |
783 | UserProfileData userProfile = GetUserProfile(agentID); | 772 | UserProfileData userProfile = m_userDataBaseService.GetUserProfile(agentID); |
784 | if (userProfile != null) | 773 | if (userProfile != null) |
785 | { | 774 | { |
786 | if (userProfile.CurrentAgent.Region == regionID) | 775 | if (userProfile.CurrentAgent.Region == regionID) |
@@ -797,7 +786,7 @@ namespace OpenSim.Grid.UserServer | |||
797 | userAgent.Handle = regionHandle; | 786 | userAgent.Handle = regionHandle; |
798 | userProfile.LastLogin = userAgent.LogoutTime; | 787 | userProfile.LastLogin = userAgent.LogoutTime; |
799 | 788 | ||
800 | CommitAgent(ref userProfile); | 789 | m_userDataBaseService.CommitAgent(ref userProfile); |
801 | 790 | ||
802 | handlerLogOffUser = OnLogOffUser; | 791 | handlerLogOffUser = OnLogOffUser; |
803 | if (handlerLogOffUser != null) | 792 | if (handlerLogOffUser != null) |
@@ -809,12 +798,12 @@ namespace OpenSim.Grid.UserServer | |||
809 | 798 | ||
810 | public void HandleRegionStartup(UUID regionID) | 799 | public void HandleRegionStartup(UUID regionID) |
811 | { | 800 | { |
812 | LogoutUsers(regionID); | 801 | m_userDataBaseService.LogoutUsers(regionID); |
813 | } | 802 | } |
814 | 803 | ||
815 | public void HandleRegionShutdown(UUID regionID) | 804 | public void HandleRegionShutdown(UUID regionID) |
816 | { | 805 | { |
817 | LogoutUsers(regionID); | 806 | m_userDataBaseService.LogoutUsers(regionID); |
818 | } | 807 | } |
819 | } | 808 | } |
820 | } | 809 | } |