diff options
Diffstat (limited to 'OpenSim/Grid')
-rw-r--r-- | OpenSim/Grid/MessagingServer/Main.cs | 450 |
1 files changed, 225 insertions, 225 deletions
diff --git a/OpenSim/Grid/MessagingServer/Main.cs b/OpenSim/Grid/MessagingServer/Main.cs index a340ce8..a69cef3 100644 --- a/OpenSim/Grid/MessagingServer/Main.cs +++ b/OpenSim/Grid/MessagingServer/Main.cs | |||
@@ -1,226 +1,226 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.IO; | 31 | using System.IO; |
32 | using libsecondlife; | 32 | using libsecondlife; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Communications.Cache; | 34 | using OpenSim.Framework.Communications.Cache; |
35 | using OpenSim.Framework.Console; | 35 | using OpenSim.Framework.Console; |
36 | using OpenSim.Framework.Servers; | 36 | using OpenSim.Framework.Servers; |
37 | 37 | ||
38 | namespace OpenSim.Grid.MessagingServer | 38 | namespace OpenSim.Grid.MessagingServer |
39 | { | 39 | { |
40 | /// <summary> | 40 | /// <summary> |
41 | /// </summary> | 41 | /// </summary> |
42 | public class OpenUser_Main : conscmd_callback | 42 | public class OpenUser_Main : conscmd_callback |
43 | { | 43 | { |
44 | private UserConfig Cfg; | 44 | private UserConfig Cfg; |
45 | 45 | ||
46 | //public UserManager m_userManager; | 46 | //public UserManager m_userManager; |
47 | //public UserLoginService m_loginService; | 47 | //public UserLoginService m_loginService; |
48 | 48 | ||
49 | private LogBase m_console; | 49 | private LogBase m_console; |
50 | private LLUUID m_lastCreatedUser = LLUUID.Random(); | 50 | private LLUUID m_lastCreatedUser = LLUUID.Random(); |
51 | 51 | ||
52 | [STAThread] | 52 | [STAThread] |
53 | public static void Main(string[] args) | 53 | public static void Main(string[] args) |
54 | { | 54 | { |
55 | Console.WriteLine("Launching UserServer..."); | 55 | Console.WriteLine("Launching UserServer..."); |
56 | 56 | ||
57 | OpenUser_Main userserver = new OpenUser_Main(); | 57 | OpenUser_Main userserver = new OpenUser_Main(); |
58 | 58 | ||
59 | userserver.Startup(); | 59 | userserver.Startup(); |
60 | userserver.Work(); | 60 | userserver.Work(); |
61 | } | 61 | } |
62 | 62 | ||
63 | private OpenUser_Main() | 63 | private OpenUser_Main() |
64 | { | 64 | { |
65 | if (!Directory.Exists(Util.logDir())) | 65 | if (!Directory.Exists(Util.logDir())) |
66 | { | 66 | { |
67 | Directory.CreateDirectory(Util.logDir()); | 67 | Directory.CreateDirectory(Util.logDir()); |
68 | } | 68 | } |
69 | m_console = | 69 | m_console = |
70 | new LogBase((Path.Combine(Util.logDir(), "opengrid-messagingserver-console.log")), "OpenUser", this, true); | 70 | new LogBase((Path.Combine(Util.logDir(), "opengrid-messagingserver-console.log")), "OpenUser", this, true); |
71 | MainLog.Instance = m_console; | 71 | MainLog.Instance = m_console; |
72 | } | 72 | } |
73 | 73 | ||
74 | private void Work() | 74 | private void Work() |
75 | { | 75 | { |
76 | m_console.Notice("Enter help for a list of commands\n"); | 76 | m_console.Notice("Enter help for a list of commands\n"); |
77 | 77 | ||
78 | while (true) | 78 | while (true) |
79 | { | 79 | { |
80 | m_console.MainLogPrompt(); | 80 | m_console.MainLogPrompt(); |
81 | } | 81 | } |
82 | } | 82 | } |
83 | 83 | ||
84 | public void Startup() | 84 | public void Startup() |
85 | { | 85 | { |
86 | Cfg = new UserConfig("MESSAGING SERVER", (Path.Combine(Util.configDir(), "MessagingServer_Config.xml"))); | 86 | Cfg = new UserConfig("MESSAGING SERVER", (Path.Combine(Util.configDir(), "MessagingServer_Config.xml"))); |
87 | 87 | ||
88 | MainLog.Instance.Verbose("REGION", "Establishing data connection"); | 88 | MainLog.Instance.Verbose("REGION", "Establishing data connection"); |
89 | //m_userManager = new UserManager(); | 89 | //m_userManager = new UserManager(); |
90 | //m_userManager._config = Cfg; | 90 | //m_userManager._config = Cfg; |
91 | //m_userManager.AddPlugin(Cfg.DatabaseProvider); | 91 | //m_userManager.AddPlugin(Cfg.DatabaseProvider); |
92 | 92 | ||
93 | //m_loginService = new UserLoginService( | 93 | //m_loginService = new UserLoginService( |
94 | //m_userManager, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg); | 94 | //m_userManager, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg); |
95 | 95 | ||
96 | MainLog.Instance.Verbose("REGION", "Starting HTTP process"); | 96 | MainLog.Instance.Verbose("REGION", "Starting HTTP process"); |
97 | BaseHttpServer httpServer = new BaseHttpServer(Cfg.HttpPort); | 97 | BaseHttpServer httpServer = new BaseHttpServer(Cfg.HttpPort); |
98 | 98 | ||
99 | //httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod); | 99 | //httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod); |
100 | 100 | ||
101 | //httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName); | 101 | //httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName); |
102 | //httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID); | 102 | //httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID); |
103 | //httpServer.AddXmlRPCHandler("get_avatar_picker_avatar", m_userManager.XmlRPCGetAvatarPickerAvatar); | 103 | //httpServer.AddXmlRPCHandler("get_avatar_picker_avatar", m_userManager.XmlRPCGetAvatarPickerAvatar); |
104 | //httpServer.AddXmlRPCHandler("add_new_user_friend", m_userManager.XmlRpcResponseXmlRPCAddUserFriend); | 104 | //httpServer.AddXmlRPCHandler("add_new_user_friend", m_userManager.XmlRpcResponseXmlRPCAddUserFriend); |
105 | //httpServer.AddXmlRPCHandler("remove_user_friend", m_userManager.XmlRpcResponseXmlRPCRemoveUserFriend); | 105 | //httpServer.AddXmlRPCHandler("remove_user_friend", m_userManager.XmlRpcResponseXmlRPCRemoveUserFriend); |
106 | //httpServer.AddXmlRPCHandler("update_user_friend_perms", m_userManager.XmlRpcResponseXmlRPCUpdateUserFriendPerms); | 106 | //httpServer.AddXmlRPCHandler("update_user_friend_perms", m_userManager.XmlRpcResponseXmlRPCUpdateUserFriendPerms); |
107 | //httpServer.AddXmlRPCHandler("get_user_friend_list", m_userManager.XmlRpcResponseXmlRPCGetUserFriendList); | 107 | //httpServer.AddXmlRPCHandler("get_user_friend_list", m_userManager.XmlRpcResponseXmlRPCGetUserFriendList); |
108 | 108 | ||
109 | 109 | ||
110 | //httpServer.AddStreamHandler( | 110 | //httpServer.AddStreamHandler( |
111 | //new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod)); | 111 | //new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod)); |
112 | 112 | ||
113 | httpServer.Start(); | 113 | httpServer.Start(); |
114 | m_console.Status("SERVER", "Messageserver 0.4 - Startup complete"); | 114 | m_console.Status("SERVER", "Messageserver 0.4 - Startup complete"); |
115 | } | 115 | } |
116 | 116 | ||
117 | 117 | ||
118 | public void do_create(string what) | 118 | public void do_create(string what) |
119 | { | 119 | { |
120 | switch (what) | 120 | switch (what) |
121 | { | 121 | { |
122 | case "user": | 122 | case "user": |
123 | string tempfirstname; | 123 | string tempfirstname; |
124 | string templastname; | 124 | string templastname; |
125 | string tempMD5Passwd; | 125 | string tempMD5Passwd; |
126 | uint regX = 1000; | 126 | uint regX = 1000; |
127 | uint regY = 1000; | 127 | uint regY = 1000; |
128 | 128 | ||
129 | tempfirstname = m_console.CmdPrompt("First name"); | 129 | tempfirstname = m_console.CmdPrompt("First name"); |
130 | templastname = m_console.CmdPrompt("Last name"); | 130 | templastname = m_console.CmdPrompt("Last name"); |
131 | tempMD5Passwd = m_console.PasswdPrompt("Password"); | 131 | tempMD5Passwd = m_console.PasswdPrompt("Password"); |
132 | regX = Convert.ToUInt32(m_console.CmdPrompt("Start Region X")); | 132 | regX = Convert.ToUInt32(m_console.CmdPrompt("Start Region X")); |
133 | regY = Convert.ToUInt32(m_console.CmdPrompt("Start Region Y")); | 133 | regY = Convert.ToUInt32(m_console.CmdPrompt("Start Region Y")); |
134 | 134 | ||
135 | tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); | 135 | tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); |
136 | 136 | ||
137 | LLUUID userID = new LLUUID(); | 137 | LLUUID userID = new LLUUID(); |
138 | try | 138 | try |
139 | { | 139 | { |
140 | //userID = | 140 | //userID = |
141 | //m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); | 141 | //m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); |
142 | } catch (Exception ex) | 142 | } catch (Exception ex) |
143 | { | 143 | { |
144 | m_console.Error("SERVER", "Error creating user: {0}", ex.ToString()); | 144 | m_console.Error("SERVER", "Error creating user: {0}", ex.ToString()); |
145 | } | 145 | } |
146 | 146 | ||
147 | try | 147 | try |
148 | { | 148 | { |
149 | //RestObjectPoster.BeginPostObject<Guid>(m_userManager._config.InventoryUrl + "CreateInventory/", | 149 | //RestObjectPoster.BeginPostObject<Guid>(m_userManager._config.InventoryUrl + "CreateInventory/", |
150 | //userID.UUID); | 150 | //userID.UUID); |
151 | } | 151 | } |
152 | catch (Exception ex) | 152 | catch (Exception ex) |
153 | { | 153 | { |
154 | m_console.Error("SERVER", "Error creating inventory for user: {0}", ex.ToString()); | 154 | m_console.Error("SERVER", "Error creating inventory for user: {0}", ex.ToString()); |
155 | } | 155 | } |
156 | m_lastCreatedUser = userID; | 156 | m_lastCreatedUser = userID; |
157 | break; | 157 | break; |
158 | } | 158 | } |
159 | } | 159 | } |
160 | 160 | ||
161 | public void RunCmd(string cmd, string[] cmdparams) | 161 | public void RunCmd(string cmd, string[] cmdparams) |
162 | { | 162 | { |
163 | switch (cmd) | 163 | switch (cmd) |
164 | { | 164 | { |
165 | case "help": | 165 | case "help": |
166 | m_console.Notice("create user - create a new user"); | 166 | m_console.Notice("create user - create a new user"); |
167 | m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); | 167 | m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); |
168 | break; | 168 | break; |
169 | 169 | ||
170 | case "create": | 170 | case "create": |
171 | do_create(cmdparams[0]); | 171 | do_create(cmdparams[0]); |
172 | break; | 172 | break; |
173 | 173 | ||
174 | case "shutdown": | 174 | case "shutdown": |
175 | m_console.Close(); | 175 | m_console.Close(); |
176 | Environment.Exit(0); | 176 | Environment.Exit(0); |
177 | break; | 177 | break; |
178 | 178 | ||
179 | case "test-inventory": | 179 | case "test-inventory": |
180 | // RestObjectPosterResponse<List<InventoryFolderBase>> requester = new RestObjectPosterResponse<List<InventoryFolderBase>>(); | 180 | // RestObjectPosterResponse<List<InventoryFolderBase>> requester = new RestObjectPosterResponse<List<InventoryFolderBase>>(); |
181 | // requester.ReturnResponseVal = TestResponse; | 181 | // requester.ReturnResponseVal = TestResponse; |
182 | // requester.BeginPostObject<LLUUID>(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser); | 182 | // requester.BeginPostObject<LLUUID>(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser); |
183 | //List<InventoryFolderBase> folders = | 183 | //List<InventoryFolderBase> folders = |
184 | //SynchronousRestObjectPoster.BeginPostObject<LLUUID, List<InventoryFolderBase>>("POST", | 184 | //SynchronousRestObjectPoster.BeginPostObject<LLUUID, List<InventoryFolderBase>>("POST", |
185 | //m_userManager. | 185 | //m_userManager. |
186 | //_config. | 186 | //_config. |
187 | //InventoryUrl + | 187 | //InventoryUrl + |
188 | //"RootFolders/", | 188 | //"RootFolders/", |
189 | //m_lastCreatedUser); | 189 | //m_lastCreatedUser); |
190 | break; | 190 | break; |
191 | } | 191 | } |
192 | } | 192 | } |
193 | 193 | ||
194 | public void TestResponse(List<InventoryFolderBase> resp) | 194 | public void TestResponse(List<InventoryFolderBase> resp) |
195 | { | 195 | { |
196 | Console.WriteLine("response got"); | 196 | Console.WriteLine("response got"); |
197 | } | 197 | } |
198 | 198 | ||
199 | /*private void ConfigDB(IGenericConfig configData) | 199 | /*private void ConfigDB(IGenericConfig configData) |
200 | { | 200 | { |
201 | try | 201 | try |
202 | { | 202 | { |
203 | string attri = ""; | 203 | string attri = ""; |
204 | attri = configData.GetAttribute("DataBaseProvider"); | 204 | attri = configData.GetAttribute("DataBaseProvider"); |
205 | if (attri == "") | 205 | if (attri == "") |
206 | { | 206 | { |
207 | StorageDll = "OpenSim.Framework.Data.DB4o.dll"; | 207 | StorageDll = "OpenSim.Framework.Data.DB4o.dll"; |
208 | configData.SetAttribute("DataBaseProvider", "OpenSim.Framework.Data.DB4o.dll"); | 208 | configData.SetAttribute("DataBaseProvider", "OpenSim.Framework.Data.DB4o.dll"); |
209 | } | 209 | } |
210 | else | 210 | else |
211 | { | 211 | { |
212 | StorageDll = attri; | 212 | StorageDll = attri; |
213 | } | 213 | } |
214 | configData.Commit(); | 214 | configData.Commit(); |
215 | } | 215 | } |
216 | catch | 216 | catch |
217 | { | 217 | { |
218 | 218 | ||
219 | } | 219 | } |
220 | }*/ | 220 | }*/ |
221 | 221 | ||
222 | public void Show(string ShowWhat) | 222 | public void Show(string ShowWhat) |
223 | { | 223 | { |
224 | } | 224 | } |
225 | } | 225 | } |
226 | } \ No newline at end of file | 226 | } \ No newline at end of file |