aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/UserServer/Main.cs
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-02-04 18:52:24 +0000
committerJustin Clarke Casey2008-02-04 18:52:24 +0000
commitbaefa05b575b28e1ed08670e9c937ca307f09269 (patch)
tree8f9703391fe86df4ecc1008a140e1ea760c1ae1b /OpenSim/Grid/UserServer/Main.cs
parentChange sim command from "stats" to "show stats" for consistency (diff)
downloadopensim-SC-baefa05b575b28e1ed08670e9c937ca307f09269.zip
opensim-SC-baefa05b575b28e1ed08670e9c937ca307f09269.tar.gz
opensim-SC-baefa05b575b28e1ed08670e9c937ca307f09269.tar.bz2
opensim-SC-baefa05b575b28e1ed08670e9c937ca307f09269.tar.xz
* Rebase all current servers on common abstract BaseOpenSimServer class
* The immediate upshot is that "show uptime" from the console will now show uptime on all server types (user, asset, grid, etc) * DEV: This refactoring is far from complete - only just enough to makes the "show uptime" command common accross the servers. More is needed, but in this case it's somewhat like eating cabbage, which I prefer not to do all at once
Diffstat (limited to '')
-rw-r--r--OpenSim/Grid/UserServer/Main.cs43
1 files changed, 20 insertions, 23 deletions
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index 20828ba..32cefc1 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -40,7 +40,7 @@ namespace OpenSim.Grid.UserServer
40{ 40{
41 /// <summary> 41 /// <summary>
42 /// </summary> 42 /// </summary>
43 public class OpenUser_Main : conscmd_callback 43 public class OpenUser_Main : BaseOpenSimServer, conscmd_callback
44 { 44 {
45 private UserConfig Cfg; 45 private UserConfig Cfg;
46 46
@@ -48,7 +48,6 @@ namespace OpenSim.Grid.UserServer
48 public UserLoginService m_loginService; 48 public UserLoginService m_loginService;
49 public MessageServersConnector m_messagesService; 49 public MessageServersConnector m_messagesService;
50 50
51 private LogBase m_console;
52 private LLUUID m_lastCreatedUser = LLUUID.Random(); 51 private LLUUID m_lastCreatedUser = LLUUID.Random();
53 52
54 [STAThread] 53 [STAThread]
@@ -68,18 +67,18 @@ namespace OpenSim.Grid.UserServer
68 { 67 {
69 Directory.CreateDirectory(Util.logDir()); 68 Directory.CreateDirectory(Util.logDir());
70 } 69 }
71 m_console = 70 m_log =
72 new LogBase((Path.Combine(Util.logDir(), "opengrid-userserver-console.log")), "OpenUser", this, true); 71 new LogBase((Path.Combine(Util.logDir(), "opengrid-userserver-console.log")), "OpenUser", this, true);
73 MainLog.Instance = m_console; 72 MainLog.Instance = m_log;
74 } 73 }
75 74
76 private void Work() 75 private void Work()
77 { 76 {
78 m_console.Notice("Enter help for a list of commands\n"); 77 m_log.Notice("Enter help for a list of commands\n");
79 78
80 while (true) 79 while (true)
81 { 80 {
82 m_console.MainLogPrompt(); 81 m_log.MainLogPrompt();
83 } 82 }
84 } 83 }
85 84
@@ -129,7 +128,7 @@ namespace OpenSim.Grid.UserServer
129 new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod)); 128 new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod));
130 129
131 httpServer.Start(); 130 httpServer.Start();
132 m_console.Status("SERVER", "Userserver 0.4 - Startup complete"); 131 m_log.Status("SERVER", "Userserver 0.4 - Startup complete");
133 } 132 }
134 133
135 134
@@ -144,11 +143,11 @@ namespace OpenSim.Grid.UserServer
144 uint regX = 1000; 143 uint regX = 1000;
145 uint regY = 1000; 144 uint regY = 1000;
146 145
147 tempfirstname = m_console.CmdPrompt("First name"); 146 tempfirstname = m_log.CmdPrompt("First name");
148 templastname = m_console.CmdPrompt("Last name"); 147 templastname = m_log.CmdPrompt("Last name");
149 tempMD5Passwd = m_console.PasswdPrompt("Password"); 148 tempMD5Passwd = m_log.PasswdPrompt("Password");
150 regX = Convert.ToUInt32(m_console.CmdPrompt("Start Region X")); 149 regX = Convert.ToUInt32(m_log.CmdPrompt("Start Region X"));
151 regY = Convert.ToUInt32(m_console.CmdPrompt("Start Region Y")); 150 regY = Convert.ToUInt32(m_log.CmdPrompt("Start Region Y"));
152 151
153 tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + String.Empty); 152 tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + String.Empty);
154 153
@@ -159,7 +158,7 @@ namespace OpenSim.Grid.UserServer
159 m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); 158 m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
160 } catch (Exception ex) 159 } catch (Exception ex)
161 { 160 {
162 m_console.Error("SERVER", "Error creating user: {0}", ex.ToString()); 161 m_log.Error("SERVER", "Error creating user: {0}", ex.ToString());
163 } 162 }
164 163
165 try 164 try
@@ -169,21 +168,23 @@ namespace OpenSim.Grid.UserServer
169 } 168 }
170 catch (Exception ex) 169 catch (Exception ex)
171 { 170 {
172 m_console.Error("SERVER", "Error creating inventory for user: {0}", ex.ToString()); 171 m_log.Error("SERVER", "Error creating inventory for user: {0}", ex.ToString());
173 } 172 }
174 m_lastCreatedUser = userID; 173 m_lastCreatedUser = userID;
175 break; 174 break;
176 } 175 }
177 } 176 }
178 177
179 public void RunCmd(string cmd, string[] cmdparams) 178 public override void RunCmd(string cmd, string[] cmdparams)
180 { 179 {
180 base.RunCmd(cmd, cmdparams);
181
181 switch (cmd) 182 switch (cmd)
182 { 183 {
183 case "help": 184 case "help":
184 m_console.Notice("create user - create a new user"); 185 m_log.Notice("create user - create a new user");
185 m_console.Notice("stats - statistical information for this server"); 186 m_log.Notice("stats - statistical information for this server");
186 m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); 187 m_log.Notice("shutdown - shutdown the grid (USE CAUTION!)");
187 break; 188 break;
188 189
189 case "create": 190 case "create":
@@ -192,7 +193,7 @@ namespace OpenSim.Grid.UserServer
192 193
193 case "shutdown": 194 case "shutdown":
194 m_loginService.OnUserLoggedInAtLocation -= NotifyMessageServersUserLoggedInToLocation; 195 m_loginService.OnUserLoggedInAtLocation -= NotifyMessageServersUserLoggedInToLocation;
195 m_console.Close(); 196 m_log.Close();
196 Environment.Exit(0); 197 Environment.Exit(0);
197 break; 198 break;
198 199
@@ -246,9 +247,5 @@ namespace OpenSim.Grid.UserServer
246 247
247 } 248 }
248 }*/ 249 }*/
249
250 public void Show(string ShowWhat)
251 {
252 }
253 } 250 }
254} 251}