From 0862627b341641ec0223bb4191dfee8d85724c9e Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Fri, 28 Nov 2008 15:34:30 +0000
Subject: * refactor: move CreateUser into UserServiceAdmin
---
OpenSim/Grid/UserServer/Main.cs | 64 ++++++++++++-----------------------------
1 file changed, 19 insertions(+), 45 deletions(-)
(limited to 'OpenSim/Grid/UserServer/Main.cs')
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index 9c8fe23..cab5860 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -56,7 +56,6 @@ namespace OpenSim.Grid.UserServer
public UserLoginService m_loginService;
public GridInfoService m_gridInfoService;
public MessageServersConnector m_messagesService;
- protected IInterServiceInventoryServices m_interServiceInventoryService;
private UUID m_lastCreatedUser = UUID.Random();
@@ -94,17 +93,16 @@ namespace OpenSim.Grid.UserServer
m_stats = StatsManager.StartCollectingUserStats();
- m_log.Info("[REGION]: Establishing data connection");
-
- StartupUserManager();
+ m_log.Info("[STARTUP]: Establishing data connection");
+
+ IInterServiceInventoryServices inventoryService = new OGS1InterServiceInventoryService(Cfg.InventoryUrl);
+ StartupUserManager(inventoryService);
m_userManager.AddPlugin(Cfg.DatabaseProvider, Cfg.DatabaseConnect);
m_gridInfoService = new GridInfoService();
- m_interServiceInventoryService = new OGS1InterServiceInventoryService(Cfg.InventoryUrl);
-
- StartupLoginService();
+ StartupLoginService(inventoryService);
m_messagesService = new MessageServersConnector();
@@ -116,22 +114,30 @@ namespace OpenSim.Grid.UserServer
m_messagesService.OnRegionStartup += HandleRegionStartup;
m_messagesService.OnRegionShutdown += HandleRegionShutdown;
- m_log.Info("[REGION]: Starting HTTP process");
+ m_log.Info("[STARTUP]: Starting HTTP process");
m_httpServer = new BaseHttpServer(Cfg.HttpPort);
AddHttpHandlers();
m_httpServer.Start();
}
- protected virtual void StartupUserManager()
+ ///
+ /// Start up the user manager
+ ///
+ ///
+ protected virtual void StartupUserManager(IInterServiceInventoryServices inventoryService)
{
- m_userManager = new UserManager();
+ m_userManager = new UserManager(new OGS1InterServiceInventoryService(Cfg.InventoryUrl));
}
- protected virtual void StartupLoginService()
+ ///
+ /// Start up the login service
+ ///
+ ///
+ protected virtual void StartupLoginService(IInterServiceInventoryServices inventoryService)
{
m_loginService = new UserLoginService(
- m_userManager, m_interServiceInventoryService, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg);
+ m_userManager, inventoryService, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg);
}
protected virtual void AddHttpHandlers()
@@ -256,39 +262,7 @@ namespace OpenSim.Grid.UserServer
if (null == m_userManager.GetUserProfile(firstName, lastName))
{
- password = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty);
-
- UUID userID = new UUID();
-
- try
- {
- userID = m_userManager.AddUserProfile(firstName, lastName, password, email, regX, regY);
- }
- catch (Exception ex)
- {
- m_log.ErrorFormat("[USERS]: Error creating user: {0}", ex.ToString());
- }
-
- try
- {
- if (!m_interServiceInventoryService.CreateNewUserInventory(userID))
- {
- throw new Exception(
- String.Format("The inventory creation request for user {0} did not succeed."
- + " Please contact your inventory service provider for more information.", userID));
- }
- }
- catch (WebException)
- {
- m_log.ErrorFormat("[USERS]: Could not contact the inventory service at {0} to create an inventory for {1}",
- Cfg.InventoryUrl + "CreateInventory/", userID);
- }
- catch (Exception e)
- {
- m_log.ErrorFormat("[USERS]: Error creating inventory for user: {0}", e);
- }
-
- m_lastCreatedUser = userID;
+ m_lastCreatedUser = m_userManager.AddUser(firstName, lastName, password, email, regX, regY);
}
else
{
--
cgit v1.1