aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/UserServer/Main.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Grid/UserServer/Main.cs')
-rw-r--r--OpenSim/Grid/UserServer/Main.cs64
1 files changed, 19 insertions, 45 deletions
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
56 public UserLoginService m_loginService; 56 public UserLoginService m_loginService;
57 public GridInfoService m_gridInfoService; 57 public GridInfoService m_gridInfoService;
58 public MessageServersConnector m_messagesService; 58 public MessageServersConnector m_messagesService;
59 protected IInterServiceInventoryServices m_interServiceInventoryService;
60 59
61 private UUID m_lastCreatedUser = UUID.Random(); 60 private UUID m_lastCreatedUser = UUID.Random();
62 61
@@ -94,17 +93,16 @@ namespace OpenSim.Grid.UserServer
94 93
95 m_stats = StatsManager.StartCollectingUserStats(); 94 m_stats = StatsManager.StartCollectingUserStats();
96 95
97 m_log.Info("[REGION]: Establishing data connection"); 96 m_log.Info("[STARTUP]: Establishing data connection");
98 97
99 StartupUserManager(); 98 IInterServiceInventoryServices inventoryService = new OGS1InterServiceInventoryService(Cfg.InventoryUrl);
100 99
100 StartupUserManager(inventoryService);
101 m_userManager.AddPlugin(Cfg.DatabaseProvider, Cfg.DatabaseConnect); 101 m_userManager.AddPlugin(Cfg.DatabaseProvider, Cfg.DatabaseConnect);
102 102
103 m_gridInfoService = new GridInfoService(); 103 m_gridInfoService = new GridInfoService();
104 104
105 m_interServiceInventoryService = new OGS1InterServiceInventoryService(Cfg.InventoryUrl); 105 StartupLoginService(inventoryService);
106
107 StartupLoginService();
108 106
109 m_messagesService = new MessageServersConnector(); 107 m_messagesService = new MessageServersConnector();
110 108
@@ -116,22 +114,30 @@ namespace OpenSim.Grid.UserServer
116 m_messagesService.OnRegionStartup += HandleRegionStartup; 114 m_messagesService.OnRegionStartup += HandleRegionStartup;
117 m_messagesService.OnRegionShutdown += HandleRegionShutdown; 115 m_messagesService.OnRegionShutdown += HandleRegionShutdown;
118 116
119 m_log.Info("[REGION]: Starting HTTP process"); 117 m_log.Info("[STARTUP]: Starting HTTP process");
120 118
121 m_httpServer = new BaseHttpServer(Cfg.HttpPort); 119 m_httpServer = new BaseHttpServer(Cfg.HttpPort);
122 AddHttpHandlers(); 120 AddHttpHandlers();
123 m_httpServer.Start(); 121 m_httpServer.Start();
124 } 122 }
125 123
126 protected virtual void StartupUserManager() 124 /// <summary>
125 /// Start up the user manager
126 /// </summary>
127 /// <param name="inventoryService"></param>
128 protected virtual void StartupUserManager(IInterServiceInventoryServices inventoryService)
127 { 129 {
128 m_userManager = new UserManager(); 130 m_userManager = new UserManager(new OGS1InterServiceInventoryService(Cfg.InventoryUrl));
129 } 131 }
130 132
131 protected virtual void StartupLoginService() 133 /// <summary>
134 /// Start up the login service
135 /// </summary>
136 /// <param name="inventoryService"></param>
137 protected virtual void StartupLoginService(IInterServiceInventoryServices inventoryService)
132 { 138 {
133 m_loginService = new UserLoginService( 139 m_loginService = new UserLoginService(
134 m_userManager, m_interServiceInventoryService, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg); 140 m_userManager, inventoryService, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg);
135 } 141 }
136 142
137 protected virtual void AddHttpHandlers() 143 protected virtual void AddHttpHandlers()
@@ -256,39 +262,7 @@ namespace OpenSim.Grid.UserServer
256 262
257 if (null == m_userManager.GetUserProfile(firstName, lastName)) 263 if (null == m_userManager.GetUserProfile(firstName, lastName))
258 { 264 {
259 password = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty); 265 m_lastCreatedUser = m_userManager.AddUser(firstName, lastName, password, email, regX, regY);
260
261 UUID userID = new UUID();
262
263 try
264 {
265 userID = m_userManager.AddUserProfile(firstName, lastName, password, email, regX, regY);
266 }
267 catch (Exception ex)
268 {
269 m_log.ErrorFormat("[USERS]: Error creating user: {0}", ex.ToString());
270 }
271
272 try
273 {
274 if (!m_interServiceInventoryService.CreateNewUserInventory(userID))
275 {
276 throw new Exception(
277 String.Format("The inventory creation request for user {0} did not succeed."
278 + " Please contact your inventory service provider for more information.", userID));
279 }
280 }
281 catch (WebException)
282 {
283 m_log.ErrorFormat("[USERS]: Could not contact the inventory service at {0} to create an inventory for {1}",
284 Cfg.InventoryUrl + "CreateInventory/", userID);
285 }
286 catch (Exception e)
287 {
288 m_log.ErrorFormat("[USERS]: Error creating inventory for user: {0}", e);
289 }
290
291 m_lastCreatedUser = userID;
292 } 266 }
293 else 267 else
294 { 268 {