diff options
author | Adam Frisby | 2008-05-01 18:04:42 +0000 |
---|---|---|
committer | Adam Frisby | 2008-05-01 18:04:42 +0000 |
commit | 20a9bf08f51351e1e0a9de94f184ff56cd572665 (patch) | |
tree | 52da64dab26353b903c8e4befed0178fa72a188b /OpenSim/Grid/UserServer/Main.cs | |
parent | More config cleanup in LaunchSLClient. (diff) | |
download | opensim-SC-20a9bf08f51351e1e0a9de94f184ff56cd572665.zip opensim-SC-20a9bf08f51351e1e0a9de94f184ff56cd572665.tar.gz opensim-SC-20a9bf08f51351e1e0a9de94f184ff56cd572665.tar.bz2 opensim-SC-20a9bf08f51351e1e0a9de94f184ff56cd572665.tar.xz |
* Rolled back a few changes.
Diffstat (limited to 'OpenSim/Grid/UserServer/Main.cs')
-rw-r--r-- | OpenSim/Grid/UserServer/Main.cs | 145 |
1 files changed, 72 insertions, 73 deletions
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index 25e1585..0534e3b 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs | |||
@@ -48,61 +48,12 @@ namespace OpenSim.Grid.UserServer | |||
48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
49 | 49 | ||
50 | private UserConfig Cfg; | 50 | private UserConfig Cfg; |
51 | private LLUUID m_lastCreatedUser = LLUUID.Random(); | 51 | |
52 | |||
53 | public UserLoginService m_loginService; | ||
54 | public MessageServersConnector m_messagesService; | ||
55 | public UserManager m_userManager; | 52 | public UserManager m_userManager; |
53 | public UserLoginService m_loginService; | ||
54 | public MessageServersConnector m_messagesService; | ||
56 | 55 | ||
57 | private OpenUser_Main() | 56 | private LLUUID m_lastCreatedUser = LLUUID.Random(); |
58 | { | ||
59 | m_console = new ConsoleBase("OpenUser", this); | ||
60 | MainConsole.Instance = m_console; | ||
61 | } | ||
62 | |||
63 | #region conscmd_callback Members | ||
64 | |||
65 | public override void RunCmd(string cmd, string[] cmdparams) | ||
66 | { | ||
67 | base.RunCmd(cmd, cmdparams); | ||
68 | |||
69 | switch (cmd) | ||
70 | { | ||
71 | case "help": | ||
72 | m_console.Notice("create user - create a new user"); | ||
73 | m_console.Notice("stats - statistical information for this server"); | ||
74 | m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); | ||
75 | break; | ||
76 | |||
77 | case "create": | ||
78 | do_create(cmdparams[0]); | ||
79 | break; | ||
80 | |||
81 | case "shutdown": | ||
82 | m_loginService.OnUserLoggedInAtLocation -= NotifyMessageServersUserLoggedInToLocation; | ||
83 | m_console.Close(); | ||
84 | Environment.Exit(0); | ||
85 | break; | ||
86 | |||
87 | case "stats": | ||
88 | m_console.Notice(StatsManager.UserStats.Report()); | ||
89 | break; | ||
90 | |||
91 | case "test-inventory": | ||
92 | // RestObjectPosterResponse<List<InventoryFolderBase>> requester = new RestObjectPosterResponse<List<InventoryFolderBase>>(); | ||
93 | // requester.ReturnResponseVal = TestResponse; | ||
94 | // requester.BeginPostObject<LLUUID>(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser); | ||
95 | SynchronousRestObjectPoster.BeginPostObject<LLUUID, List<InventoryFolderBase>>("POST", | ||
96 | m_userManager. | ||
97 | _config. | ||
98 | InventoryUrl + | ||
99 | "RootFolders/", | ||
100 | m_lastCreatedUser); | ||
101 | break; | ||
102 | } | ||
103 | } | ||
104 | |||
105 | #endregion | ||
106 | 57 | ||
107 | [STAThread] | 58 | [STAThread] |
108 | public static void Main(string[] args) | 59 | public static void Main(string[] args) |
@@ -117,6 +68,12 @@ namespace OpenSim.Grid.UserServer | |||
117 | userserver.Work(); | 68 | userserver.Work(); |
118 | } | 69 | } |
119 | 70 | ||
71 | private OpenUser_Main() | ||
72 | { | ||
73 | m_console = new ConsoleBase("OpenUser", this); | ||
74 | MainConsole.Instance = m_console; | ||
75 | } | ||
76 | |||
120 | private void Work() | 77 | private void Work() |
121 | { | 78 | { |
122 | m_console.Notice("Enter help for a list of commands\n"); | 79 | m_console.Notice("Enter help for a list of commands\n"); |
@@ -130,16 +87,16 @@ namespace OpenSim.Grid.UserServer | |||
130 | public void Startup() | 87 | public void Startup() |
131 | { | 88 | { |
132 | Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml"))); | 89 | Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml"))); |
133 | 90 | ||
134 | StatsManager.StartCollectingUserStats(); | 91 | StatsManager.StartCollectingUserStats(); |
135 | 92 | ||
136 | m_log.Info("[REGION]: Establishing data connection"); | 93 | m_log.Info("[REGION]: Establishing data connection"); |
137 | m_userManager = new UserManager(); | 94 | m_userManager = new UserManager(); |
138 | m_userManager._config = Cfg; | 95 | m_userManager._config = Cfg; |
139 | m_userManager.AddPlugin(Cfg.DatabaseProvider); | 96 | m_userManager.AddPlugin(Cfg.DatabaseProvider); |
140 | 97 | ||
141 | m_loginService = new UserLoginService( | 98 | m_loginService = new UserLoginService( |
142 | m_userManager, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg); | 99 | m_userManager, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg); |
143 | 100 | ||
144 | m_messagesService = new MessageServersConnector(); | 101 | m_messagesService = new MessageServersConnector(); |
145 | 102 | ||
@@ -147,7 +104,7 @@ namespace OpenSim.Grid.UserServer | |||
147 | m_userManager.OnLogOffUser += NotifyMessageServersUserLoggOff; | 104 | m_userManager.OnLogOffUser += NotifyMessageServersUserLoggOff; |
148 | 105 | ||
149 | m_log.Info("[REGION]: Starting HTTP process"); | 106 | m_log.Info("[REGION]: Starting HTTP process"); |
150 | 107 | ||
151 | m_httpServer = new BaseHttpServer(Cfg.HttpPort); | 108 | m_httpServer = new BaseHttpServer(Cfg.HttpPort); |
152 | AddHttpHandlers(); | 109 | AddHttpHandlers(); |
153 | m_httpServer.Start(); | 110 | m_httpServer.Start(); |
@@ -160,7 +117,7 @@ namespace OpenSim.Grid.UserServer | |||
160 | m_httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod); | 117 | m_httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod); |
161 | 118 | ||
162 | m_httpServer.AddHTTPHandler("login", m_loginService.ProcessHTMLLogin); | 119 | m_httpServer.AddHTTPHandler("login", m_loginService.ProcessHTMLLogin); |
163 | 120 | ||
164 | m_httpServer.SetLLSDHandler(m_loginService.LLSDLoginMethod); | 121 | m_httpServer.SetLLSDHandler(m_loginService.LLSDLoginMethod); |
165 | 122 | ||
166 | m_httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName); | 123 | m_httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName); |
@@ -171,7 +128,7 @@ namespace OpenSim.Grid.UserServer | |||
171 | m_httpServer.AddXmlRPCHandler("update_user_friend_perms", m_userManager.XmlRpcResponseXmlRPCUpdateUserFriendPerms); | 128 | m_httpServer.AddXmlRPCHandler("update_user_friend_perms", m_userManager.XmlRpcResponseXmlRPCUpdateUserFriendPerms); |
172 | m_httpServer.AddXmlRPCHandler("get_user_friend_list", m_userManager.XmlRpcResponseXmlRPCGetUserFriendList); | 129 | m_httpServer.AddXmlRPCHandler("get_user_friend_list", m_userManager.XmlRpcResponseXmlRPCGetUserFriendList); |
173 | m_httpServer.AddXmlRPCHandler("logout_of_simulator", m_userManager.XmlRPCLogOffUserMethodUUID); | 130 | m_httpServer.AddXmlRPCHandler("logout_of_simulator", m_userManager.XmlRPCLogOffUserMethodUUID); |
174 | 131 | ||
175 | // Message Server ---> User Server | 132 | // Message Server ---> User Server |
176 | m_httpServer.AddXmlRPCHandler("register_messageserver", m_messagesService.XmlRPCRegisterMessageServer); | 133 | m_httpServer.AddXmlRPCHandler("register_messageserver", m_messagesService.XmlRPCRegisterMessageServer); |
177 | m_httpServer.AddXmlRPCHandler("agent_change_region", m_messagesService.XmlRPCUserMovedtoRegion); | 134 | m_httpServer.AddXmlRPCHandler("agent_change_region", m_messagesService.XmlRPCUserMovedtoRegion); |
@@ -206,17 +163,17 @@ namespace OpenSim.Grid.UserServer | |||
206 | { | 163 | { |
207 | m_log.ErrorFormat( | 164 | m_log.ErrorFormat( |
208 | "[USERS]: A user with the name {0} {1} already exists!", tempfirstname, templastname); | 165 | "[USERS]: A user with the name {0} {1} already exists!", tempfirstname, templastname); |
209 | 166 | ||
210 | break; | 167 | break; |
211 | } | 168 | } |
212 | 169 | ||
213 | tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + String.Empty); | 170 | tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + String.Empty); |
214 | 171 | ||
215 | LLUUID userID = new LLUUID(); | 172 | LLUUID userID = new LLUUID(); |
216 | try | 173 | try |
217 | { | 174 | { |
218 | userID = m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); | 175 | userID = m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); |
219 | } | 176 | } |
220 | catch (Exception ex) | 177 | catch (Exception ex) |
221 | { | 178 | { |
222 | m_log.ErrorFormat("[USERS]: Error creating user: {0}", ex.ToString()); | 179 | m_log.ErrorFormat("[USERS]: Error creating user: {0}", ex.ToString()); |
@@ -224,35 +181,76 @@ namespace OpenSim.Grid.UserServer | |||
224 | 181 | ||
225 | try | 182 | try |
226 | { | 183 | { |
227 | bool created | 184 | bool created |
228 | = SynchronousRestObjectPoster.BeginPostObject<Guid, bool>( | 185 | = SynchronousRestObjectPoster.BeginPostObject<Guid, bool>( |
229 | "POST", m_userManager._config.InventoryUrl + "CreateInventory/", userID.UUID); | 186 | "POST", m_userManager._config.InventoryUrl + "CreateInventory/", userID.UUID); |
230 | 187 | ||
231 | if (!created) | 188 | if (!created) |
232 | { | 189 | { |
233 | throw new Exception( | 190 | throw new Exception( |
234 | String.Format( | 191 | String.Format( |
235 | "The inventory creation request for user {0} did not succeed." | 192 | "The inventory creation request for user {0} did not succeed." |
236 | + " Please contact your inventory service provider for more information.", | 193 | + " Please contact your inventory service provider for more information.", |
237 | userID)); | 194 | userID)); |
238 | } | 195 | } |
196 | |||
239 | } | 197 | } |
240 | catch (WebException e) | 198 | catch (WebException e) |
241 | { | 199 | { |
242 | m_log.ErrorFormat( | 200 | m_log.ErrorFormat( |
243 | "[USERS]: Could not contact the inventory service at {0} to create an inventory for {1}", | 201 | "[USERS]: Could not contact the inventory service at {0} to create an inventory for {1}", |
244 | m_userManager._config.InventoryUrl + "CreateInventory/", userID.UUID); | 202 | m_userManager._config.InventoryUrl + "CreateInventory/", userID.UUID); |
245 | } | 203 | } |
246 | catch (Exception e) | 204 | catch (Exception e) |
247 | { | 205 | { |
248 | m_log.ErrorFormat("[USERS]: Error creating inventory for user: {0}", e); | 206 | m_log.ErrorFormat("[USERS]: Error creating inventory for user: {0}", e); |
249 | } | 207 | } |
250 | 208 | ||
251 | m_lastCreatedUser = userID; | 209 | m_lastCreatedUser = userID; |
252 | break; | 210 | break; |
253 | } | 211 | } |
254 | } | 212 | } |
255 | 213 | ||
214 | public override void RunCmd(string cmd, string[] cmdparams) | ||
215 | { | ||
216 | base.RunCmd(cmd, cmdparams); | ||
217 | |||
218 | switch (cmd) | ||
219 | { | ||
220 | case "help": | ||
221 | m_console.Notice("create user - create a new user"); | ||
222 | m_console.Notice("stats - statistical information for this server"); | ||
223 | m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); | ||
224 | break; | ||
225 | |||
226 | case "create": | ||
227 | do_create(cmdparams[0]); | ||
228 | break; | ||
229 | |||
230 | case "shutdown": | ||
231 | m_loginService.OnUserLoggedInAtLocation -= NotifyMessageServersUserLoggedInToLocation; | ||
232 | m_console.Close(); | ||
233 | Environment.Exit(0); | ||
234 | break; | ||
235 | |||
236 | case "stats": | ||
237 | m_console.Notice(StatsManager.UserStats.Report()); | ||
238 | break; | ||
239 | |||
240 | case "test-inventory": | ||
241 | // RestObjectPosterResponse<List<InventoryFolderBase>> requester = new RestObjectPosterResponse<List<InventoryFolderBase>>(); | ||
242 | // requester.ReturnResponseVal = TestResponse; | ||
243 | // requester.BeginPostObject<LLUUID>(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser); | ||
244 | SynchronousRestObjectPoster.BeginPostObject<LLUUID, List<InventoryFolderBase>>("POST", | ||
245 | m_userManager. | ||
246 | _config. | ||
247 | InventoryUrl + | ||
248 | "RootFolders/", | ||
249 | m_lastCreatedUser); | ||
250 | break; | ||
251 | } | ||
252 | } | ||
253 | |||
256 | public void TestResponse(List<InventoryFolderBase> resp) | 254 | public void TestResponse(List<InventoryFolderBase> resp) |
257 | { | 255 | { |
258 | m_console.Notice("response got"); | 256 | m_console.Notice("response got"); |
@@ -264,11 +262,12 @@ namespace OpenSim.Grid.UserServer | |||
264 | } | 262 | } |
265 | 263 | ||
266 | public void NotifyMessageServersUserLoggedInToLocation(LLUUID agentID, LLUUID sessionID, LLUUID RegionID, | 264 | public void NotifyMessageServersUserLoggedInToLocation(LLUUID agentID, LLUUID sessionID, LLUUID RegionID, |
267 | ulong regionhandle, float positionX, float positionY, | 265 | ulong regionhandle, float positionX, float positionY, |
268 | float positionZ, string firstname, string lastname) | 266 | float positionZ, string firstname, string lastname) |
269 | { | 267 | { |
270 | m_messagesService.TellMessageServersAboutUser(agentID, sessionID, RegionID, regionhandle, positionX, | 268 | |
271 | positionY, positionZ, firstname, lastname); | 269 | m_messagesService.TellMessageServersAboutUser( agentID, sessionID, RegionID, regionhandle, positionX, |
270 | positionY, positionZ, firstname, lastname); | ||
272 | } | 271 | } |
273 | } | 272 | } |
274 | } \ No newline at end of file | 273 | } |