diff options
Diffstat (limited to 'OpenSim/Grid')
18 files changed, 2811 insertions, 2811 deletions
diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs index 4126ff4..5093f4d 100644 --- a/OpenSim/Grid/AssetServer/Main.cs +++ b/OpenSim/Grid/AssetServer/Main.cs | |||
@@ -1,406 +1,406 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.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.IO; | 30 | using System.IO; |
31 | using System.Text; | 31 | using System.Text; |
32 | using Db4objects.Db4o; | 32 | using Db4objects.Db4o; |
33 | using libsecondlife; | 33 | using libsecondlife; |
34 | using OpenSim.Framework.Console; | 34 | using OpenSim.Framework.Console; |
35 | using OpenSim.Framework.Types; | 35 | using OpenSim.Framework.Types; |
36 | using OpenSim.Framework.Servers; | 36 | using OpenSim.Framework.Servers; |
37 | 37 | ||
38 | namespace OpenSim.Grid.AssetServer | 38 | namespace OpenSim.Grid.AssetServer |
39 | { | 39 | { |
40 | /// <summary> | 40 | /// <summary> |
41 | /// An asset server | 41 | /// An asset server |
42 | /// </summary> | 42 | /// </summary> |
43 | public class OpenAsset_Main : conscmd_callback | 43 | public class OpenAsset_Main : conscmd_callback |
44 | { | 44 | { |
45 | private IObjectContainer db; | 45 | private IObjectContainer db; |
46 | 46 | ||
47 | public static OpenAsset_Main assetserver; | 47 | public static OpenAsset_Main assetserver; |
48 | 48 | ||
49 | private LogBase m_console; | 49 | private LogBase m_console; |
50 | 50 | ||
51 | [STAThread] | 51 | [STAThread] |
52 | public static void Main(string[] args) | 52 | public static void Main(string[] args) |
53 | { | 53 | { |
54 | Console.WriteLine("Starting...\n"); | 54 | Console.WriteLine("Starting...\n"); |
55 | 55 | ||
56 | assetserver = new OpenAsset_Main(); | 56 | assetserver = new OpenAsset_Main(); |
57 | assetserver.Startup(); | 57 | assetserver.Startup(); |
58 | 58 | ||
59 | assetserver.Work(); | 59 | assetserver.Work(); |
60 | } | 60 | } |
61 | 61 | ||
62 | private void Work() | 62 | private void Work() |
63 | { | 63 | { |
64 | m_console.Notice("Enter help for a list of commands"); | 64 | m_console.Notice("Enter help for a list of commands"); |
65 | 65 | ||
66 | while (true) | 66 | while (true) |
67 | { | 67 | { |
68 | m_console.MainLogPrompt(); | 68 | m_console.MainLogPrompt(); |
69 | } | 69 | } |
70 | } | 70 | } |
71 | 71 | ||
72 | private OpenAsset_Main() | 72 | private OpenAsset_Main() |
73 | { | 73 | { |
74 | m_console = new LogBase("opengrid-AssetServer-console.log", "OpenAsset", this, false); | 74 | m_console = new LogBase("opengrid-AssetServer-console.log", "OpenAsset", this, false); |
75 | MainLog.Instance = m_console; | 75 | MainLog.Instance = m_console; |
76 | } | 76 | } |
77 | 77 | ||
78 | public void Startup() | 78 | public void Startup() |
79 | { | 79 | { |
80 | m_console.Verbose("Main.cs:Startup() - Setting up asset DB"); | 80 | m_console.Verbose("Main.cs:Startup() - Setting up asset DB"); |
81 | setupDB(); | 81 | setupDB(); |
82 | 82 | ||
83 | m_console.Verbose("Main.cs:Startup() - Starting HTTP process"); | 83 | m_console.Verbose("Main.cs:Startup() - Starting HTTP process"); |
84 | BaseHttpServer httpServer = new BaseHttpServer(8003); | 84 | BaseHttpServer httpServer = new BaseHttpServer(8003); |
85 | 85 | ||
86 | httpServer.AddStreamHandler( new GetAssetStreamHandler(this)); | 86 | httpServer.AddStreamHandler( new GetAssetStreamHandler(this)); |
87 | httpServer.AddStreamHandler(new PostAssetStreamHandler( this )); | 87 | httpServer.AddStreamHandler(new PostAssetStreamHandler( this )); |
88 | 88 | ||
89 | //httpServer.AddRestHandler("GET", "/assets/", this.assetGetMethod); | 89 | //httpServer.AddRestHandler("GET", "/assets/", this.assetGetMethod); |
90 | //httpServer.AddRestHandler("POST", "/assets/", this.assetPostMethod); | 90 | //httpServer.AddRestHandler("POST", "/assets/", this.assetPostMethod); |
91 | 91 | ||
92 | httpServer.Start(); | 92 | httpServer.Start(); |
93 | 93 | ||
94 | } | 94 | } |
95 | 95 | ||
96 | //public string AssetPostMethod(string requestBody, string path, string param) | 96 | //public string AssetPostMethod(string requestBody, string path, string param) |
97 | //{ | 97 | //{ |
98 | // AssetBase asset = new AssetBase(); | 98 | // AssetBase asset = new AssetBase(); |
99 | // asset.Name = ""; | 99 | // asset.Name = ""; |
100 | // asset.FullID = new LLUUID(param); | 100 | // asset.FullID = new LLUUID(param); |
101 | // Encoding Windows1252Encoding = Encoding.GetEncoding(1252); | 101 | // Encoding Windows1252Encoding = Encoding.GetEncoding(1252); |
102 | // byte[] buffer = Windows1252Encoding.GetBytes(requestBody); | 102 | // byte[] buffer = Windows1252Encoding.GetBytes(requestBody); |
103 | // asset.Data = buffer; | 103 | // asset.Data = buffer; |
104 | // AssetStorage store = new AssetStorage(); | 104 | // AssetStorage store = new AssetStorage(); |
105 | // store.Data = asset.Data; | 105 | // store.Data = asset.Data; |
106 | // store.Name = asset.Name; | 106 | // store.Name = asset.Name; |
107 | // store.UUID = asset.FullID; | 107 | // store.UUID = asset.FullID; |
108 | // db.Set(store); | 108 | // db.Set(store); |
109 | // db.Commit(); | 109 | // db.Commit(); |
110 | // return ""; | 110 | // return ""; |
111 | //} | 111 | //} |
112 | 112 | ||
113 | //public string AssetGetMethod(string request, string path, string param) | 113 | //public string AssetGetMethod(string request, string path, string param) |
114 | //{ | 114 | //{ |
115 | // Console.WriteLine("got a request " + param); | 115 | // Console.WriteLine("got a request " + param); |
116 | // byte[] assetdata = GetAssetData(new LLUUID(param), false); | 116 | // byte[] assetdata = GetAssetData(new LLUUID(param), false); |
117 | // if (assetdata != null) | 117 | // if (assetdata != null) |
118 | // { | 118 | // { |
119 | // Encoding Windows1252Encoding = Encoding.GetEncoding(1252); | 119 | // Encoding Windows1252Encoding = Encoding.GetEncoding(1252); |
120 | // string ret = Windows1252Encoding.GetString(assetdata); | 120 | // string ret = Windows1252Encoding.GetString(assetdata); |
121 | // //string ret = System.Text.Encoding.Unicode.GetString(assetdata); | 121 | // //string ret = System.Text.Encoding.Unicode.GetString(assetdata); |
122 | 122 | ||
123 | // return ret; | 123 | // return ret; |
124 | 124 | ||
125 | // } | 125 | // } |
126 | // else | 126 | // else |
127 | // { | 127 | // { |
128 | // return ""; | 128 | // return ""; |
129 | // } | 129 | // } |
130 | 130 | ||
131 | //} | 131 | //} |
132 | 132 | ||
133 | public byte[] GetAssetData(LLUUID assetID, bool isTexture) | 133 | public byte[] GetAssetData(LLUUID assetID, bool isTexture) |
134 | { | 134 | { |
135 | bool found = false; | 135 | bool found = false; |
136 | AssetStorage foundAsset = null; | 136 | AssetStorage foundAsset = null; |
137 | 137 | ||
138 | IObjectSet result = db.Get(new AssetStorage(assetID)); | 138 | IObjectSet result = db.Get(new AssetStorage(assetID)); |
139 | if (result.Count > 0) | 139 | if (result.Count > 0) |
140 | { | 140 | { |
141 | foundAsset = (AssetStorage)result.Next(); | 141 | foundAsset = (AssetStorage)result.Next(); |
142 | found = true; | 142 | found = true; |
143 | } | 143 | } |
144 | 144 | ||
145 | if (found) | 145 | if (found) |
146 | { | 146 | { |
147 | return foundAsset.Data; | 147 | return foundAsset.Data; |
148 | } | 148 | } |
149 | else | 149 | else |
150 | { | 150 | { |
151 | return null; | 151 | return null; |
152 | } | 152 | } |
153 | } | 153 | } |
154 | 154 | ||
155 | public void setupDB() | 155 | public void setupDB() |
156 | { | 156 | { |
157 | bool yapfile = File.Exists("gridassets.yap"); | 157 | bool yapfile = File.Exists("gridassets.yap"); |
158 | try | 158 | try |
159 | { | 159 | { |
160 | db = Db4oFactory.OpenFile("gridassets.yap"); | 160 | db = Db4oFactory.OpenFile("gridassets.yap"); |
161 | MainLog.Instance.Verbose("Main.cs:setupDB() - creation"); | 161 | MainLog.Instance.Verbose("Main.cs:setupDB() - creation"); |
162 | } | 162 | } |
163 | catch (Exception e) | 163 | catch (Exception e) |
164 | { | 164 | { |
165 | db.Close(); | 165 | db.Close(); |
166 | MainLog.Instance.Warn("Main.cs:setupDB() - Exception occured"); | 166 | MainLog.Instance.Warn("Main.cs:setupDB() - Exception occured"); |
167 | MainLog.Instance.Warn(e.ToString()); | 167 | MainLog.Instance.Warn(e.ToString()); |
168 | } | 168 | } |
169 | if (!yapfile) | 169 | if (!yapfile) |
170 | { | 170 | { |
171 | this.LoadDB(); | 171 | this.LoadDB(); |
172 | } | 172 | } |
173 | } | 173 | } |
174 | 174 | ||
175 | public void LoadDB() | 175 | public void LoadDB() |
176 | { | 176 | { |
177 | try | 177 | try |
178 | { | 178 | { |
179 | 179 | ||
180 | Console.WriteLine("setting up Asset database"); | 180 | Console.WriteLine("setting up Asset database"); |
181 | 181 | ||
182 | AssetBase Image = new AssetBase(); | 182 | AssetBase Image = new AssetBase(); |
183 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001"); | 183 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001"); |
184 | Image.Name = "Bricks"; | 184 | Image.Name = "Bricks"; |
185 | this.LoadAsset(Image, true, "bricks.jp2"); | 185 | this.LoadAsset(Image, true, "bricks.jp2"); |
186 | AssetStorage store = new AssetStorage(); | 186 | AssetStorage store = new AssetStorage(); |
187 | store.Data = Image.Data; | 187 | store.Data = Image.Data; |
188 | store.Name = Image.Name; | 188 | store.Name = Image.Name; |
189 | store.UUID = Image.FullID; | 189 | store.UUID = Image.FullID; |
190 | db.Set(store); | 190 | db.Set(store); |
191 | db.Commit(); | 191 | db.Commit(); |
192 | 192 | ||
193 | Image = new AssetBase(); | 193 | Image = new AssetBase(); |
194 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002"); | 194 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002"); |
195 | Image.Name = "Plywood"; | 195 | Image.Name = "Plywood"; |
196 | this.LoadAsset(Image, true, "plywood.jp2"); | 196 | this.LoadAsset(Image, true, "plywood.jp2"); |
197 | store = new AssetStorage(); | 197 | store = new AssetStorage(); |
198 | store.Data = Image.Data; | 198 | store.Data = Image.Data; |
199 | store.Name = Image.Name; | 199 | store.Name = Image.Name; |
200 | store.UUID = Image.FullID; | 200 | store.UUID = Image.FullID; |
201 | db.Set(store); | 201 | db.Set(store); |
202 | db.Commit(); | 202 | db.Commit(); |
203 | 203 | ||
204 | Image = new AssetBase(); | 204 | Image = new AssetBase(); |
205 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003"); | 205 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003"); |
206 | Image.Name = "Rocks"; | 206 | Image.Name = "Rocks"; |
207 | this.LoadAsset(Image, true, "rocks.jp2"); | 207 | this.LoadAsset(Image, true, "rocks.jp2"); |
208 | store = new AssetStorage(); | 208 | store = new AssetStorage(); |
209 | store.Data = Image.Data; | 209 | store.Data = Image.Data; |
210 | store.Name = Image.Name; | 210 | store.Name = Image.Name; |
211 | store.UUID = Image.FullID; | 211 | store.UUID = Image.FullID; |
212 | db.Set(store); | 212 | db.Set(store); |
213 | db.Commit(); | 213 | db.Commit(); |
214 | 214 | ||
215 | Image = new AssetBase(); | 215 | Image = new AssetBase(); |
216 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004"); | 216 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004"); |
217 | Image.Name = "Granite"; | 217 | Image.Name = "Granite"; |
218 | this.LoadAsset(Image, true, "granite.jp2"); | 218 | this.LoadAsset(Image, true, "granite.jp2"); |
219 | store = new AssetStorage(); | 219 | store = new AssetStorage(); |
220 | store.Data = Image.Data; | 220 | store.Data = Image.Data; |
221 | store.Name = Image.Name; | 221 | store.Name = Image.Name; |
222 | store.UUID = Image.FullID; | 222 | store.UUID = Image.FullID; |
223 | db.Set(store); | 223 | db.Set(store); |
224 | db.Commit(); | 224 | db.Commit(); |
225 | 225 | ||
226 | Image = new AssetBase(); | 226 | Image = new AssetBase(); |
227 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005"); | 227 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005"); |
228 | Image.Name = "Hardwood"; | 228 | Image.Name = "Hardwood"; |
229 | this.LoadAsset(Image, true, "hardwood.jp2"); | 229 | this.LoadAsset(Image, true, "hardwood.jp2"); |
230 | store = new AssetStorage(); | 230 | store = new AssetStorage(); |
231 | store.Data = Image.Data; | 231 | store.Data = Image.Data; |
232 | store.Name = Image.Name; | 232 | store.Name = Image.Name; |
233 | store.UUID = Image.FullID; | 233 | store.UUID = Image.FullID; |
234 | db.Set(store); | 234 | db.Set(store); |
235 | db.Commit(); | 235 | db.Commit(); |
236 | 236 | ||
237 | Image = new AssetBase(); | 237 | Image = new AssetBase(); |
238 | Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005"); | 238 | Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005"); |
239 | Image.Name = "Prim Base Texture"; | 239 | Image.Name = "Prim Base Texture"; |
240 | this.LoadAsset(Image, true, "plywood.jp2"); | 240 | this.LoadAsset(Image, true, "plywood.jp2"); |
241 | store = new AssetStorage(); | 241 | store = new AssetStorage(); |
242 | store.Data = Image.Data; | 242 | store.Data = Image.Data; |
243 | store.Name = Image.Name; | 243 | store.Name = Image.Name; |
244 | store.UUID = Image.FullID; | 244 | store.UUID = Image.FullID; |
245 | db.Set(store); | 245 | db.Set(store); |
246 | db.Commit(); | 246 | db.Commit(); |
247 | 247 | ||
248 | Image = new AssetBase(); | 248 | Image = new AssetBase(); |
249 | Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); | 249 | Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); |
250 | Image.Name = "Shape"; | 250 | Image.Name = "Shape"; |
251 | this.LoadAsset(Image, false, "base_shape.dat"); | 251 | this.LoadAsset(Image, false, "base_shape.dat"); |
252 | store = new AssetStorage(); | 252 | store = new AssetStorage(); |
253 | store.Data = Image.Data; | 253 | store.Data = Image.Data; |
254 | store.Name = Image.Name; | 254 | store.Name = Image.Name; |
255 | store.UUID = Image.FullID; | 255 | store.UUID = Image.FullID; |
256 | db.Set(store); | 256 | db.Set(store); |
257 | db.Commit(); | 257 | db.Commit(); |
258 | } | 258 | } |
259 | catch (Exception e) | 259 | catch (Exception e) |
260 | { | 260 | { |
261 | Console.WriteLine(e.Message); | 261 | Console.WriteLine(e.Message); |
262 | } | 262 | } |
263 | } | 263 | } |
264 | 264 | ||
265 | private void LoadAsset(AssetBase info, bool image, string filename) | 265 | private void LoadAsset(AssetBase info, bool image, string filename) |
266 | { | 266 | { |
267 | 267 | ||
268 | 268 | ||
269 | string dataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder; | 269 | string dataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder; |
270 | string fileName = Path.Combine(dataPath, filename); | 270 | string fileName = Path.Combine(dataPath, filename); |
271 | FileInfo fInfo = new FileInfo(fileName); | 271 | FileInfo fInfo = new FileInfo(fileName); |
272 | long numBytes = fInfo.Length; | 272 | long numBytes = fInfo.Length; |
273 | FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read); | 273 | FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read); |
274 | byte[] idata = new byte[numBytes]; | 274 | byte[] idata = new byte[numBytes]; |
275 | BinaryReader br = new BinaryReader(fStream); | 275 | BinaryReader br = new BinaryReader(fStream); |
276 | idata = br.ReadBytes((int)numBytes); | 276 | idata = br.ReadBytes((int)numBytes); |
277 | br.Close(); | 277 | br.Close(); |
278 | fStream.Close(); | 278 | fStream.Close(); |
279 | info.Data = idata; | 279 | info.Data = idata; |
280 | //info.loaded=true; | 280 | //info.loaded=true; |
281 | } | 281 | } |
282 | 282 | ||
283 | /*private GridConfig LoadConfigDll(string dllName) | 283 | /*private GridConfig LoadConfigDll(string dllName) |
284 | { | 284 | { |
285 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | 285 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); |
286 | GridConfig config = null; | 286 | GridConfig config = null; |
287 | 287 | ||
288 | foreach (Type pluginType in pluginAssembly.GetTypes()) | 288 | foreach (Type pluginType in pluginAssembly.GetTypes()) |
289 | { | 289 | { |
290 | if (pluginType.IsPublic) | 290 | if (pluginType.IsPublic) |
291 | { | 291 | { |
292 | if (!pluginType.IsAbstract) | 292 | if (!pluginType.IsAbstract) |
293 | { | 293 | { |
294 | Type typeInterface = pluginType.GetInterface("IGridConfig", true); | 294 | Type typeInterface = pluginType.GetInterface("IGridConfig", true); |
295 | 295 | ||
296 | if (typeInterface != null) | 296 | if (typeInterface != null) |
297 | { | 297 | { |
298 | IGridConfig plug = (IGridConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | 298 | IGridConfig plug = (IGridConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); |
299 | config = plug.GetConfigObject(); | 299 | config = plug.GetConfigObject(); |
300 | break; | 300 | break; |
301 | } | 301 | } |
302 | 302 | ||
303 | typeInterface = null; | 303 | typeInterface = null; |
304 | } | 304 | } |
305 | } | 305 | } |
306 | } | 306 | } |
307 | pluginAssembly = null; | 307 | pluginAssembly = null; |
308 | return config; | 308 | return config; |
309 | }*/ | 309 | }*/ |
310 | 310 | ||
311 | public void CreateAsset(LLUUID assetId, byte[] assetData) | 311 | public void CreateAsset(LLUUID assetId, byte[] assetData) |
312 | { | 312 | { |
313 | AssetBase asset = new AssetBase(); | 313 | AssetBase asset = new AssetBase(); |
314 | asset.Name = ""; | 314 | asset.Name = ""; |
315 | asset.FullID = assetId; | 315 | asset.FullID = assetId; |
316 | asset.Data = assetData; | 316 | asset.Data = assetData; |
317 | 317 | ||
318 | AssetStorage store = new AssetStorage(); | 318 | AssetStorage store = new AssetStorage(); |
319 | store.Data = asset.Data; | 319 | store.Data = asset.Data; |
320 | store.Name = asset.Name; | 320 | store.Name = asset.Name; |
321 | store.UUID = asset.FullID; | 321 | store.UUID = asset.FullID; |
322 | db.Set(store); | 322 | db.Set(store); |
323 | db.Commit(); | 323 | db.Commit(); |
324 | } | 324 | } |
325 | 325 | ||
326 | public void RunCmd(string cmd, string[] cmdparams) | 326 | public void RunCmd(string cmd, string[] cmdparams) |
327 | { | 327 | { |
328 | switch (cmd) | 328 | switch (cmd) |
329 | { | 329 | { |
330 | case "help": | 330 | case "help": |
331 | m_console.Notice("shutdown - shutdown this asset server (USE CAUTION!)"); | 331 | m_console.Notice("shutdown - shutdown this asset server (USE CAUTION!)"); |
332 | break; | 332 | break; |
333 | 333 | ||
334 | case "shutdown": | 334 | case "shutdown": |
335 | m_console.Close(); | 335 | m_console.Close(); |
336 | Environment.Exit(0); | 336 | Environment.Exit(0); |
337 | break; | 337 | break; |
338 | } | 338 | } |
339 | } | 339 | } |
340 | 340 | ||
341 | public void Show(string ShowWhat) | 341 | public void Show(string ShowWhat) |
342 | { | 342 | { |
343 | } | 343 | } |
344 | } | 344 | } |
345 | 345 | ||
346 | public class GetAssetStreamHandler : BaseStreamHandler | 346 | public class GetAssetStreamHandler : BaseStreamHandler |
347 | { | 347 | { |
348 | OpenAsset_Main m_assetManager; | 348 | OpenAsset_Main m_assetManager; |
349 | 349 | ||
350 | override public byte[] Handle(string path, Stream request) | 350 | override public byte[] Handle(string path, Stream request) |
351 | { | 351 | { |
352 | string param = GetParam(path); | 352 | string param = GetParam(path); |
353 | 353 | ||
354 | byte[] assetdata = m_assetManager.GetAssetData(new LLUUID(param), false); | 354 | byte[] assetdata = m_assetManager.GetAssetData(new LLUUID(param), false); |
355 | if (assetdata != null) | 355 | if (assetdata != null) |
356 | { | 356 | { |
357 | return assetdata; | 357 | return assetdata; |
358 | } | 358 | } |
359 | else | 359 | else |
360 | { | 360 | { |
361 | return new byte[]{}; | 361 | return new byte[]{}; |
362 | } | 362 | } |
363 | } | 363 | } |
364 | 364 | ||
365 | public GetAssetStreamHandler(OpenAsset_Main assetManager):base( "/assets/", "GET") | 365 | public GetAssetStreamHandler(OpenAsset_Main assetManager):base( "/assets/", "GET") |
366 | { | 366 | { |
367 | m_assetManager = assetManager; | 367 | m_assetManager = assetManager; |
368 | } | 368 | } |
369 | } | 369 | } |
370 | 370 | ||
371 | public class PostAssetStreamHandler : BaseStreamHandler | 371 | public class PostAssetStreamHandler : BaseStreamHandler |
372 | { | 372 | { |
373 | OpenAsset_Main m_assetManager; | 373 | OpenAsset_Main m_assetManager; |
374 | 374 | ||
375 | override public byte[] Handle(string path, Stream request) | 375 | override public byte[] Handle(string path, Stream request) |
376 | { | 376 | { |
377 | string param = GetParam(path); | 377 | string param = GetParam(path); |
378 | LLUUID assetId = new LLUUID(param); | 378 | LLUUID assetId = new LLUUID(param); |
379 | byte[] txBuffer = new byte[4096]; | 379 | byte[] txBuffer = new byte[4096]; |
380 | 380 | ||
381 | using( BinaryReader binReader = new BinaryReader( request ) ) | 381 | using( BinaryReader binReader = new BinaryReader( request ) ) |
382 | { | 382 | { |
383 | using (MemoryStream memoryStream = new MemoryStream(4096)) | 383 | using (MemoryStream memoryStream = new MemoryStream(4096)) |
384 | { | 384 | { |
385 | int count; | 385 | int count; |
386 | while ((count = binReader.Read(txBuffer, 0, 4096)) > 0) | 386 | while ((count = binReader.Read(txBuffer, 0, 4096)) > 0) |
387 | { | 387 | { |
388 | memoryStream.Write(txBuffer, 0, count); | 388 | memoryStream.Write(txBuffer, 0, count); |
389 | } | 389 | } |
390 | 390 | ||
391 | byte[] assetData = memoryStream.ToArray(); | 391 | byte[] assetData = memoryStream.ToArray(); |
392 | 392 | ||
393 | m_assetManager.CreateAsset(assetId, assetData); | 393 | m_assetManager.CreateAsset(assetId, assetData); |
394 | } | 394 | } |
395 | } | 395 | } |
396 | 396 | ||
397 | return new byte[]{}; | 397 | return new byte[]{}; |
398 | } | 398 | } |
399 | 399 | ||
400 | public PostAssetStreamHandler( OpenAsset_Main assetManager ) | 400 | public PostAssetStreamHandler( OpenAsset_Main assetManager ) |
401 | : base("/assets/", "POST") | 401 | : base("/assets/", "POST") |
402 | { | 402 | { |
403 | m_assetManager = assetManager; | 403 | m_assetManager = assetManager; |
404 | } | 404 | } |
405 | } | 405 | } |
406 | } | 406 | } |
diff --git a/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs index dc39ce2..f9b48d5 100644 --- a/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs +++ b/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs | |||
@@ -1,58 +1,58 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.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 | using System.Reflection; | 28 | using System.Reflection; |
29 | using System.Runtime.InteropServices; | 29 | using System.Runtime.InteropServices; |
30 | // General Information about an assembly is controlled through the following | 30 | // General Information about an assembly is controlled through the following |
31 | // set of attributes. Change these attribute values to modify the information | 31 | // set of attributes. Change these attribute values to modify the information |
32 | // associated with an assembly. | 32 | // associated with an assembly. |
33 | [assembly: AssemblyTitle("OGS-AssetServer")] | 33 | [assembly: AssemblyTitle("OGS-AssetServer")] |
34 | [assembly: AssemblyDescription("")] | 34 | [assembly: AssemblyDescription("")] |
35 | [assembly: AssemblyConfiguration("")] | 35 | [assembly: AssemblyConfiguration("")] |
36 | [assembly: AssemblyCompany("")] | 36 | [assembly: AssemblyCompany("")] |
37 | [assembly: AssemblyProduct("OGS-AssetServer")] | 37 | [assembly: AssemblyProduct("OGS-AssetServer")] |
38 | [assembly: AssemblyCopyright("Copyright © 2007")] | 38 | [assembly: AssemblyCopyright("Copyright © 2007")] |
39 | [assembly: AssemblyTrademark("")] | 39 | [assembly: AssemblyTrademark("")] |
40 | [assembly: AssemblyCulture("")] | 40 | [assembly: AssemblyCulture("")] |
41 | 41 | ||
42 | // Setting ComVisible to false makes the types in this assembly not visible | 42 | // Setting ComVisible to false makes the types in this assembly not visible |
43 | // to COM components. If you need to access a type in this assembly from | 43 | // to COM components. If you need to access a type in this assembly from |
44 | // COM, set the ComVisible attribute to true on that type. | 44 | // COM, set the ComVisible attribute to true on that type. |
45 | [assembly: ComVisible(false)] | 45 | [assembly: ComVisible(false)] |
46 | 46 | ||
47 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 47 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
48 | [assembly: Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")] | 48 | [assembly: Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")] |
49 | 49 | ||
50 | // Version information for an assembly consists of the following four values: | 50 | // Version information for an assembly consists of the following four values: |
51 | // | 51 | // |
52 | // Major Version | 52 | // Major Version |
53 | // Minor Version | 53 | // Minor Version |
54 | // Build Number | 54 | // Build Number |
55 | // Revision | 55 | // Revision |
56 | // | 56 | // |
57 | [assembly: AssemblyVersion("1.0.0.0")] | 57 | [assembly: AssemblyVersion("1.0.0.0")] |
58 | [assembly: AssemblyFileVersion("1.0.0.0")] | 58 | [assembly: AssemblyFileVersion("1.0.0.0")] |
diff --git a/OpenSim/Grid/Framework.Manager/GridManagementAgent.cs b/OpenSim/Grid/Framework.Manager/GridManagementAgent.cs index 6c916a2..989df26 100644 --- a/OpenSim/Grid/Framework.Manager/GridManagementAgent.cs +++ b/OpenSim/Grid/Framework.Manager/GridManagementAgent.cs | |||
@@ -1,138 +1,138 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.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 | using System.Collections; | 28 | using System.Collections; |
29 | using libsecondlife; | 29 | using libsecondlife; |
30 | using Nwc.XmlRpc; | 30 | using Nwc.XmlRpc; |
31 | using OpenSim.Framework.Servers; | 31 | using OpenSim.Framework.Servers; |
32 | 32 | ||
33 | namespace OpenSim.Framework.Manager | 33 | namespace OpenSim.Framework.Manager |
34 | { | 34 | { |
35 | /// <summary> | 35 | /// <summary> |
36 | /// Used to pass messages to the gridserver | 36 | /// Used to pass messages to the gridserver |
37 | /// </summary> | 37 | /// </summary> |
38 | /// <param name="param">Pass this argument</param> | 38 | /// <param name="param">Pass this argument</param> |
39 | public delegate void GridManagerCallback(string param); | 39 | public delegate void GridManagerCallback(string param); |
40 | 40 | ||
41 | /// <summary> | 41 | /// <summary> |
42 | /// Serverside listener for grid commands | 42 | /// Serverside listener for grid commands |
43 | /// </summary> | 43 | /// </summary> |
44 | public class GridManagementAgent | 44 | public class GridManagementAgent |
45 | { | 45 | { |
46 | /// <summary> | 46 | /// <summary> |
47 | /// Passes grid server messages | 47 | /// Passes grid server messages |
48 | /// </summary> | 48 | /// </summary> |
49 | private GridManagerCallback thecallback; | 49 | private GridManagerCallback thecallback; |
50 | 50 | ||
51 | /// <summary> | 51 | /// <summary> |
52 | /// Security keys | 52 | /// Security keys |
53 | /// </summary> | 53 | /// </summary> |
54 | private string sendkey; | 54 | private string sendkey; |
55 | private string recvkey; | 55 | private string recvkey; |
56 | 56 | ||
57 | /// <summary> | 57 | /// <summary> |
58 | /// Our component type | 58 | /// Our component type |
59 | /// </summary> | 59 | /// </summary> |
60 | private string component_type; | 60 | private string component_type; |
61 | 61 | ||
62 | /// <summary> | 62 | /// <summary> |
63 | /// List of active sessions | 63 | /// List of active sessions |
64 | /// </summary> | 64 | /// </summary> |
65 | private static ArrayList Sessions; | 65 | private static ArrayList Sessions; |
66 | 66 | ||
67 | /// <summary> | 67 | /// <summary> |
68 | /// Initialises a new GridManagementAgent | 68 | /// Initialises a new GridManagementAgent |
69 | /// </summary> | 69 | /// </summary> |
70 | /// <param name="app_httpd">HTTP Daemon for this server</param> | 70 | /// <param name="app_httpd">HTTP Daemon for this server</param> |
71 | /// <param name="component_type">What component type are we?</param> | 71 | /// <param name="component_type">What component type are we?</param> |
72 | /// <param name="sendkey">Security send key</param> | 72 | /// <param name="sendkey">Security send key</param> |
73 | /// <param name="recvkey">Security recieve key</param> | 73 | /// <param name="recvkey">Security recieve key</param> |
74 | /// <param name="thecallback">Message callback</param> | 74 | /// <param name="thecallback">Message callback</param> |
75 | public GridManagementAgent(BaseHttpServer app_httpd, string component_type, string sendkey, string recvkey, GridManagerCallback thecallback) | 75 | public GridManagementAgent(BaseHttpServer app_httpd, string component_type, string sendkey, string recvkey, GridManagerCallback thecallback) |
76 | { | 76 | { |
77 | this.sendkey = sendkey; | 77 | this.sendkey = sendkey; |
78 | this.recvkey = recvkey; | 78 | this.recvkey = recvkey; |
79 | this.component_type = component_type; | 79 | this.component_type = component_type; |
80 | this.thecallback = thecallback; | 80 | this.thecallback = thecallback; |
81 | Sessions = new ArrayList(); | 81 | Sessions = new ArrayList(); |
82 | 82 | ||
83 | app_httpd.AddXmlRPCHandler("manager_login", XmlRpcLoginMethod); | 83 | app_httpd.AddXmlRPCHandler("manager_login", XmlRpcLoginMethod); |
84 | 84 | ||
85 | switch (component_type) | 85 | switch (component_type) |
86 | { | 86 | { |
87 | case "gridserver": | 87 | case "gridserver": |
88 | GridServerManager.sendkey = this.sendkey; | 88 | GridServerManager.sendkey = this.sendkey; |
89 | GridServerManager.recvkey = this.recvkey; | 89 | GridServerManager.recvkey = this.recvkey; |
90 | GridServerManager.thecallback = thecallback; | 90 | GridServerManager.thecallback = thecallback; |
91 | app_httpd.AddXmlRPCHandler("shutdown", GridServerManager.XmlRpcShutdownMethod); | 91 | app_httpd.AddXmlRPCHandler("shutdown", GridServerManager.XmlRpcShutdownMethod); |
92 | break; | 92 | break; |
93 | } | 93 | } |
94 | } | 94 | } |
95 | 95 | ||
96 | /// <summary> | 96 | /// <summary> |
97 | /// Checks if a session exists | 97 | /// Checks if a session exists |
98 | /// </summary> | 98 | /// </summary> |
99 | /// <param name="sessionID">The session ID</param> | 99 | /// <param name="sessionID">The session ID</param> |
100 | /// <returns>Exists?</returns> | 100 | /// <returns>Exists?</returns> |
101 | public static bool SessionExists(LLUUID sessionID) | 101 | public static bool SessionExists(LLUUID sessionID) |
102 | { | 102 | { |
103 | return Sessions.Contains(sessionID); | 103 | return Sessions.Contains(sessionID); |
104 | } | 104 | } |
105 | 105 | ||
106 | /// <summary> | 106 | /// <summary> |
107 | /// Logs a new session to the grid manager | 107 | /// Logs a new session to the grid manager |
108 | /// </summary> | 108 | /// </summary> |
109 | /// <param name="request">the XMLRPC request</param> | 109 | /// <param name="request">the XMLRPC request</param> |
110 | /// <returns>An XMLRPC reply</returns> | 110 | /// <returns>An XMLRPC reply</returns> |
111 | public static XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) | 111 | public static XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) |
112 | { | 112 | { |
113 | XmlRpcResponse response = new XmlRpcResponse(); | 113 | XmlRpcResponse response = new XmlRpcResponse(); |
114 | Hashtable requestData = (Hashtable)request.Params[0]; | 114 | Hashtable requestData = (Hashtable)request.Params[0]; |
115 | Hashtable responseData = new Hashtable(); | 115 | Hashtable responseData = new Hashtable(); |
116 | 116 | ||
117 | // TODO: Switch this over to using OpenSim.Framework.Data | 117 | // TODO: Switch this over to using OpenSim.Framework.Data |
118 | if (requestData["username"].Equals("admin") && requestData["password"].Equals("supersecret")) | 118 | if (requestData["username"].Equals("admin") && requestData["password"].Equals("supersecret")) |
119 | { | 119 | { |
120 | response.IsFault = false; | 120 | response.IsFault = false; |
121 | LLUUID new_session = LLUUID.Random(); | 121 | LLUUID new_session = LLUUID.Random(); |
122 | Sessions.Add(new_session); | 122 | Sessions.Add(new_session); |
123 | responseData["session_id"] = new_session.ToString(); | 123 | responseData["session_id"] = new_session.ToString(); |
124 | responseData["msg"] = "Login OK"; | 124 | responseData["msg"] = "Login OK"; |
125 | } | 125 | } |
126 | else | 126 | else |
127 | { | 127 | { |
128 | response.IsFault = true; | 128 | response.IsFault = true; |
129 | responseData["error"] = "Invalid username or password"; | 129 | responseData["error"] = "Invalid username or password"; |
130 | } | 130 | } |
131 | 131 | ||
132 | response.Value = responseData; | 132 | response.Value = responseData; |
133 | return response; | 133 | return response; |
134 | 134 | ||
135 | } | 135 | } |
136 | 136 | ||
137 | } | 137 | } |
138 | } | 138 | } |
diff --git a/OpenSim/Grid/Framework.Manager/GridServerManager.cs b/OpenSim/Grid/Framework.Manager/GridServerManager.cs index 67cd35d..729e42b 100644 --- a/OpenSim/Grid/Framework.Manager/GridServerManager.cs +++ b/OpenSim/Grid/Framework.Manager/GridServerManager.cs | |||
@@ -1,93 +1,93 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.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; | 30 | using System.Collections; |
31 | using System.Threading; | 31 | using System.Threading; |
32 | using libsecondlife; | 32 | using libsecondlife; |
33 | using Nwc.XmlRpc; | 33 | using Nwc.XmlRpc; |
34 | 34 | ||
35 | namespace OpenSim.Framework.Manager { | 35 | namespace OpenSim.Framework.Manager { |
36 | 36 | ||
37 | /// <summary> | 37 | /// <summary> |
38 | /// A remote management system for the grid server | 38 | /// A remote management system for the grid server |
39 | /// </summary> | 39 | /// </summary> |
40 | public class GridServerManager | 40 | public class GridServerManager |
41 | { | 41 | { |
42 | /// <summary> | 42 | /// <summary> |
43 | /// Triggers events from the grid manager | 43 | /// Triggers events from the grid manager |
44 | /// </summary> | 44 | /// </summary> |
45 | public static GridManagerCallback thecallback; | 45 | public static GridManagerCallback thecallback; |
46 | 46 | ||
47 | /// <summary> | 47 | /// <summary> |
48 | /// Security keys | 48 | /// Security keys |
49 | /// </summary> | 49 | /// </summary> |
50 | public static string sendkey; | 50 | public static string sendkey; |
51 | public static string recvkey; | 51 | public static string recvkey; |
52 | 52 | ||
53 | /// <summary> | 53 | /// <summary> |
54 | /// Disconnects the grid server and shuts it down | 54 | /// Disconnects the grid server and shuts it down |
55 | /// </summary> | 55 | /// </summary> |
56 | /// <param name="request">XmlRpc Request</param> | 56 | /// <param name="request">XmlRpc Request</param> |
57 | /// <returns>An XmlRpc response containing either a "msg" or an "error"</returns> | 57 | /// <returns>An XmlRpc response containing either a "msg" or an "error"</returns> |
58 | public static XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request) | 58 | public static XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request) |
59 | { | 59 | { |
60 | XmlRpcResponse response = new XmlRpcResponse(); | 60 | XmlRpcResponse response = new XmlRpcResponse(); |
61 | Hashtable requestData = (Hashtable)request.Params[0]; | 61 | Hashtable requestData = (Hashtable)request.Params[0]; |
62 | Hashtable responseData = new Hashtable(); | 62 | Hashtable responseData = new Hashtable(); |
63 | 63 | ||
64 | if(requestData.ContainsKey("session_id")) { | 64 | if(requestData.ContainsKey("session_id")) { |
65 | if(GridManagementAgent.SessionExists(new LLUUID((string)requestData["session_id"]))) { | 65 | if(GridManagementAgent.SessionExists(new LLUUID((string)requestData["session_id"]))) { |
66 | responseData["msg"]="Shutdown command accepted"; | 66 | responseData["msg"]="Shutdown command accepted"; |
67 | (new Thread(new ThreadStart(ShutdownServer))).Start(); | 67 | (new Thread(new ThreadStart(ShutdownServer))).Start(); |
68 | } else { | 68 | } else { |
69 | response.IsFault=true; | 69 | response.IsFault=true; |
70 | responseData["error"]="bad session ID"; | 70 | responseData["error"]="bad session ID"; |
71 | } | 71 | } |
72 | } else { | 72 | } else { |
73 | response.IsFault=true; | 73 | response.IsFault=true; |
74 | responseData["error"]="no session ID"; | 74 | responseData["error"]="no session ID"; |
75 | } | 75 | } |
76 | 76 | ||
77 | response.Value = responseData; | 77 | response.Value = responseData; |
78 | return response; | 78 | return response; |
79 | } | 79 | } |
80 | 80 | ||
81 | /// <summary> | 81 | /// <summary> |
82 | /// Shuts down the grid server | 82 | /// Shuts down the grid server |
83 | /// </summary> | 83 | /// </summary> |
84 | public static void ShutdownServer() | 84 | public static void ShutdownServer() |
85 | { | 85 | { |
86 | Console.WriteLine("Shutting down the grid server - recieved a grid manager request"); | 86 | Console.WriteLine("Shutting down the grid server - recieved a grid manager request"); |
87 | Console.WriteLine("Terminating in three seconds..."); | 87 | Console.WriteLine("Terminating in three seconds..."); |
88 | Thread.Sleep(3000); | 88 | Thread.Sleep(3000); |
89 | thecallback("shutdown"); | 89 | thecallback("shutdown"); |
90 | } | 90 | } |
91 | } | 91 | } |
92 | } | 92 | } |
93 | 93 | ||
diff --git a/OpenSim/Grid/GridServer.Config/AssemblyInfo.cs b/OpenSim/Grid/GridServer.Config/AssemblyInfo.cs index 39c9e8f..4aa58f8 100644 --- a/OpenSim/Grid/GridServer.Config/AssemblyInfo.cs +++ b/OpenSim/Grid/GridServer.Config/AssemblyInfo.cs | |||
@@ -1,56 +1,56 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.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 | using System.Reflection; | 28 | using System.Reflection; |
29 | using System.Runtime.InteropServices; | 29 | using System.Runtime.InteropServices; |
30 | // Information about this assembly is defined by the following | 30 | // Information about this assembly is defined by the following |
31 | // attributes. | 31 | // attributes. |
32 | // | 32 | // |
33 | // change them to the information which is associated with the assembly | 33 | // change them to the information which is associated with the assembly |
34 | // you compile. | 34 | // you compile. |
35 | 35 | ||
36 | [assembly: AssemblyTitle("GridConfig")] | 36 | [assembly: AssemblyTitle("GridConfig")] |
37 | [assembly: AssemblyDescription("")] | 37 | [assembly: AssemblyDescription("")] |
38 | [assembly: AssemblyConfiguration("")] | 38 | [assembly: AssemblyConfiguration("")] |
39 | [assembly: AssemblyCompany("")] | 39 | [assembly: AssemblyCompany("")] |
40 | [assembly: AssemblyProduct("GridConfig")] | 40 | [assembly: AssemblyProduct("GridConfig")] |
41 | [assembly: AssemblyCopyright("")] | 41 | [assembly: AssemblyCopyright("")] |
42 | [assembly: AssemblyTrademark("")] | 42 | [assembly: AssemblyTrademark("")] |
43 | [assembly: AssemblyCulture("")] | 43 | [assembly: AssemblyCulture("")] |
44 | 44 | ||
45 | // This sets the default COM visibility of types in the assembly to invisible. | 45 | // This sets the default COM visibility of types in the assembly to invisible. |
46 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. | 46 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. |
47 | [assembly: ComVisible(false)] | 47 | [assembly: ComVisible(false)] |
48 | 48 | ||
49 | // The assembly version has following format : | 49 | // The assembly version has following format : |
50 | // | 50 | // |
51 | // Major.Minor.Build.Revision | 51 | // Major.Minor.Build.Revision |
52 | // | 52 | // |
53 | // You can specify all values by your own or you can build default build and revision | 53 | // You can specify all values by your own or you can build default build and revision |
54 | // numbers with the '*' character (the default): | 54 | // numbers with the '*' character (the default): |
55 | 55 | ||
56 | [assembly: AssemblyVersion("1.0.*")] | 56 | [assembly: AssemblyVersion("1.0.*")] |
diff --git a/OpenSim/Grid/GridServer.Config/DbGridConfig.cs b/OpenSim/Grid/GridServer.Config/DbGridConfig.cs index 4acf81d..7d7690b 100644 --- a/OpenSim/Grid/GridServer.Config/DbGridConfig.cs +++ b/OpenSim/Grid/GridServer.Config/DbGridConfig.cs | |||
@@ -1,160 +1,160 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.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 | using System; | 28 | using System; |
29 | using Db4objects.Db4o; | 29 | using Db4objects.Db4o; |
30 | using OpenSim.Framework.Console; | 30 | using OpenSim.Framework.Console; |
31 | using OpenSim.Framework.Interfaces; | 31 | using OpenSim.Framework.Interfaces; |
32 | 32 | ||
33 | namespace OpenGrid.Config.GridConfigDb4o | 33 | namespace OpenGrid.Config.GridConfigDb4o |
34 | { | 34 | { |
35 | /// <summary> | 35 | /// <summary> |
36 | /// A grid configuration interface for returning the DB4o Config Provider | 36 | /// A grid configuration interface for returning the DB4o Config Provider |
37 | /// </summary> | 37 | /// </summary> |
38 | public class Db40ConfigPlugin: IGridConfig | 38 | public class Db40ConfigPlugin: IGridConfig |
39 | { | 39 | { |
40 | /// <summary> | 40 | /// <summary> |
41 | /// Loads and returns a configuration objeect | 41 | /// Loads and returns a configuration objeect |
42 | /// </summary> | 42 | /// </summary> |
43 | /// <returns>A grid configuration object</returns> | 43 | /// <returns>A grid configuration object</returns> |
44 | public GridConfig GetConfigObject() | 44 | public GridConfig GetConfigObject() |
45 | { | 45 | { |
46 | MainLog.Instance.Verbose("Loading Db40Config dll"); | 46 | MainLog.Instance.Verbose("Loading Db40Config dll"); |
47 | return ( new DbGridConfig()); | 47 | return ( new DbGridConfig()); |
48 | } | 48 | } |
49 | } | 49 | } |
50 | 50 | ||
51 | /// <summary> | 51 | /// <summary> |
52 | /// A DB4o based Gridserver configuration object | 52 | /// A DB4o based Gridserver configuration object |
53 | /// </summary> | 53 | /// </summary> |
54 | public class DbGridConfig : GridConfig | 54 | public class DbGridConfig : GridConfig |
55 | { | 55 | { |
56 | /// <summary> | 56 | /// <summary> |
57 | /// The DB4o Database | 57 | /// The DB4o Database |
58 | /// </summary> | 58 | /// </summary> |
59 | private IObjectContainer db; | 59 | private IObjectContainer db; |
60 | 60 | ||
61 | /// <summary> | 61 | /// <summary> |
62 | /// User configuration for the Grid Config interfaces | 62 | /// User configuration for the Grid Config interfaces |
63 | /// </summary> | 63 | /// </summary> |
64 | public void LoadDefaults() { | 64 | public void LoadDefaults() { |
65 | MainLog.Instance.Notice("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings"); | 65 | MainLog.Instance.Notice("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings"); |
66 | 66 | ||
67 | // About the grid options | 67 | // About the grid options |
68 | this.GridOwner = MainLog.Instance.CmdPrompt("Grid owner", "OGS development team"); | 68 | this.GridOwner = MainLog.Instance.CmdPrompt("Grid owner", "OGS development team"); |
69 | 69 | ||
70 | // Asset Options | 70 | // Asset Options |
71 | this.DefaultAssetServer = MainLog.Instance.CmdPrompt("Default asset server","http://127.0.0.1:8003/"); | 71 | this.DefaultAssetServer = MainLog.Instance.CmdPrompt("Default asset server","http://127.0.0.1:8003/"); |
72 | this.AssetSendKey = MainLog.Instance.CmdPrompt("Key to send to asset server","null"); | 72 | this.AssetSendKey = MainLog.Instance.CmdPrompt("Key to send to asset server","null"); |
73 | this.AssetRecvKey = MainLog.Instance.CmdPrompt("Key to expect from asset server","null"); | 73 | this.AssetRecvKey = MainLog.Instance.CmdPrompt("Key to expect from asset server","null"); |
74 | 74 | ||
75 | // User Server Options | 75 | // User Server Options |
76 | this.DefaultUserServer = MainLog.Instance.CmdPrompt("Default user server","http://127.0.0.1:8002/"); | 76 | this.DefaultUserServer = MainLog.Instance.CmdPrompt("Default user server","http://127.0.0.1:8002/"); |
77 | this.UserSendKey = MainLog.Instance.CmdPrompt("Key to send to user server","null"); | 77 | this.UserSendKey = MainLog.Instance.CmdPrompt("Key to send to user server","null"); |
78 | this.UserRecvKey = MainLog.Instance.CmdPrompt("Key to expect from user server","null"); | 78 | this.UserRecvKey = MainLog.Instance.CmdPrompt("Key to expect from user server","null"); |
79 | 79 | ||
80 | // Region Server Options | 80 | // Region Server Options |
81 | this.SimSendKey = MainLog.Instance.CmdPrompt("Key to send to sims","null"); | 81 | this.SimSendKey = MainLog.Instance.CmdPrompt("Key to send to sims","null"); |
82 | this.SimRecvKey = MainLog.Instance.CmdPrompt("Key to expect from sims","null"); | 82 | this.SimRecvKey = MainLog.Instance.CmdPrompt("Key to expect from sims","null"); |
83 | } | 83 | } |
84 | 84 | ||
85 | /// <summary> | 85 | /// <summary> |
86 | /// Initialises a new configuration object | 86 | /// Initialises a new configuration object |
87 | /// </summary> | 87 | /// </summary> |
88 | public override void InitConfig() { | 88 | public override void InitConfig() { |
89 | try { | 89 | try { |
90 | // Perform Db4o initialisation | 90 | // Perform Db4o initialisation |
91 | db = Db4oFactory.OpenFile("opengrid.yap"); | 91 | db = Db4oFactory.OpenFile("opengrid.yap"); |
92 | 92 | ||
93 | // Locate the grid configuration object | 93 | // Locate the grid configuration object |
94 | IObjectSet result = db.Get(typeof(DbGridConfig)); | 94 | IObjectSet result = db.Get(typeof(DbGridConfig)); |
95 | // Found? | 95 | // Found? |
96 | if(result.Count==1) { | 96 | if(result.Count==1) { |
97 | MainLog.Instance.Verbose("Config.cs:InitConfig() - Found a GridConfig object in the local database, loading"); | 97 | MainLog.Instance.Verbose("Config.cs:InitConfig() - Found a GridConfig object in the local database, loading"); |
98 | foreach (DbGridConfig cfg in result) { | 98 | foreach (DbGridConfig cfg in result) { |
99 | // Import each setting into this class | 99 | // Import each setting into this class |
100 | // Grid Settings | 100 | // Grid Settings |
101 | this.GridOwner=cfg.GridOwner; | 101 | this.GridOwner=cfg.GridOwner; |
102 | // Asset Settings | 102 | // Asset Settings |
103 | this.DefaultAssetServer=cfg.DefaultAssetServer; | 103 | this.DefaultAssetServer=cfg.DefaultAssetServer; |
104 | this.AssetSendKey=cfg.AssetSendKey; | 104 | this.AssetSendKey=cfg.AssetSendKey; |
105 | this.AssetRecvKey=cfg.AssetRecvKey; | 105 | this.AssetRecvKey=cfg.AssetRecvKey; |
106 | // User Settings | 106 | // User Settings |
107 | this.DefaultUserServer=cfg.DefaultUserServer; | 107 | this.DefaultUserServer=cfg.DefaultUserServer; |
108 | this.UserSendKey=cfg.UserSendKey; | 108 | this.UserSendKey=cfg.UserSendKey; |
109 | this.UserRecvKey=cfg.UserRecvKey; | 109 | this.UserRecvKey=cfg.UserRecvKey; |
110 | // Region Settings | 110 | // Region Settings |
111 | this.SimSendKey=cfg.SimSendKey; | 111 | this.SimSendKey=cfg.SimSendKey; |
112 | this.SimRecvKey=cfg.SimRecvKey; | 112 | this.SimRecvKey=cfg.SimRecvKey; |
113 | } | 113 | } |
114 | // Create a new configuration object from this class | 114 | // Create a new configuration object from this class |
115 | } else { | 115 | } else { |
116 | MainLog.Instance.Verbose("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults"); | 116 | MainLog.Instance.Verbose("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults"); |
117 | 117 | ||
118 | // Load default settings into this class | 118 | // Load default settings into this class |
119 | LoadDefaults(); | 119 | LoadDefaults(); |
120 | 120 | ||
121 | // Saves to the database file... | 121 | // Saves to the database file... |
122 | MainLog.Instance.Verbose( "Writing out default settings to local database"); | 122 | MainLog.Instance.Verbose( "Writing out default settings to local database"); |
123 | db.Set(this); | 123 | db.Set(this); |
124 | 124 | ||
125 | // Closes file locks | 125 | // Closes file locks |
126 | db.Close(); | 126 | db.Close(); |
127 | } | 127 | } |
128 | } catch(Exception e) { | 128 | } catch(Exception e) { |
129 | MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured"); | 129 | MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured"); |
130 | MainLog.Instance.Warn(e.ToString()); | 130 | MainLog.Instance.Warn(e.ToString()); |
131 | } | 131 | } |
132 | 132 | ||
133 | // Grid Settings | 133 | // Grid Settings |
134 | MainLog.Instance.Verbose("Grid settings loaded:"); | 134 | MainLog.Instance.Verbose("Grid settings loaded:"); |
135 | MainLog.Instance.Verbose("Grid owner: " + this.GridOwner); | 135 | MainLog.Instance.Verbose("Grid owner: " + this.GridOwner); |
136 | 136 | ||
137 | // Asset Settings | 137 | // Asset Settings |
138 | MainLog.Instance.Verbose("Default asset server: " + this.DefaultAssetServer); | 138 | MainLog.Instance.Verbose("Default asset server: " + this.DefaultAssetServer); |
139 | MainLog.Instance.Verbose("Key to send to asset server: " + this.AssetSendKey); | 139 | MainLog.Instance.Verbose("Key to send to asset server: " + this.AssetSendKey); |
140 | MainLog.Instance.Verbose("Key to expect from asset server: " + this.AssetRecvKey); | 140 | MainLog.Instance.Verbose("Key to expect from asset server: " + this.AssetRecvKey); |
141 | 141 | ||
142 | // User Settings | 142 | // User Settings |
143 | MainLog.Instance.Verbose("Default user server: " + this.DefaultUserServer); | 143 | MainLog.Instance.Verbose("Default user server: " + this.DefaultUserServer); |
144 | MainLog.Instance.Verbose("Key to send to user server: " + this.UserSendKey); | 144 | MainLog.Instance.Verbose("Key to send to user server: " + this.UserSendKey); |
145 | MainLog.Instance.Verbose("Key to expect from user server: " + this.UserRecvKey); | 145 | MainLog.Instance.Verbose("Key to expect from user server: " + this.UserRecvKey); |
146 | 146 | ||
147 | // Region Settings | 147 | // Region Settings |
148 | MainLog.Instance.Verbose("Key to send to sims: " + this.SimSendKey); | 148 | MainLog.Instance.Verbose("Key to send to sims: " + this.SimSendKey); |
149 | MainLog.Instance.Verbose("Key to expect from sims: " + this.SimRecvKey); | 149 | MainLog.Instance.Verbose("Key to expect from sims: " + this.SimRecvKey); |
150 | } | 150 | } |
151 | 151 | ||
152 | /// <summary> | 152 | /// <summary> |
153 | /// Closes down the database and releases filesystem locks | 153 | /// Closes down the database and releases filesystem locks |
154 | /// </summary> | 154 | /// </summary> |
155 | public void Shutdown() { | 155 | public void Shutdown() { |
156 | db.Close(); | 156 | db.Close(); |
157 | } | 157 | } |
158 | } | 158 | } |
159 | 159 | ||
160 | } | 160 | } |
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs index 64b51b4..22bffa0 100644 --- a/OpenSim/Grid/GridServer/GridManager.cs +++ b/OpenSim/Grid/GridServer/GridManager.cs | |||
@@ -1,710 +1,710 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.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 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Xml; | 32 | using System.Xml; |
33 | using libsecondlife; | 33 | using libsecondlife; |
34 | using Nwc.XmlRpc; | 34 | using Nwc.XmlRpc; |
35 | using OpenSim.Framework.Console; | 35 | using OpenSim.Framework.Console; |
36 | using OpenSim.Framework.Data; | 36 | using OpenSim.Framework.Data; |
37 | using OpenSim.Framework.Interfaces; | 37 | using OpenSim.Framework.Interfaces; |
38 | using OpenSim.Framework.Utilities; | 38 | using OpenSim.Framework.Utilities; |
39 | 39 | ||
40 | namespace OpenSim.Grid.GridServer | 40 | namespace OpenSim.Grid.GridServer |
41 | { | 41 | { |
42 | class GridManager | 42 | class GridManager |
43 | { | 43 | { |
44 | Dictionary<string, IGridData> _plugins = new Dictionary<string, IGridData>(); | 44 | Dictionary<string, IGridData> _plugins = new Dictionary<string, IGridData>(); |
45 | Dictionary<string, ILogData> _logplugins = new Dictionary<string, ILogData>(); | 45 | Dictionary<string, ILogData> _logplugins = new Dictionary<string, ILogData>(); |
46 | 46 | ||
47 | public GridConfig config; | 47 | public GridConfig config; |
48 | 48 | ||
49 | /// <summary> | 49 | /// <summary> |
50 | /// Adds a new grid server plugin - grid servers will be requested in the order they were loaded. | 50 | /// Adds a new grid server plugin - grid servers will be requested in the order they were loaded. |
51 | /// </summary> | 51 | /// </summary> |
52 | /// <param name="FileName">The filename to the grid server plugin DLL</param> | 52 | /// <param name="FileName">The filename to the grid server plugin DLL</param> |
53 | public void AddPlugin(string FileName) | 53 | public void AddPlugin(string FileName) |
54 | { | 54 | { |
55 | MainLog.Instance.Verbose("Storage: Attempting to load " + FileName); | 55 | MainLog.Instance.Verbose("Storage: Attempting to load " + FileName); |
56 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); | 56 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); |
57 | 57 | ||
58 | MainLog.Instance.Verbose("Storage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); | 58 | MainLog.Instance.Verbose("Storage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); |
59 | foreach (Type pluginType in pluginAssembly.GetTypes()) | 59 | foreach (Type pluginType in pluginAssembly.GetTypes()) |
60 | { | 60 | { |
61 | if (!pluginType.IsAbstract) | 61 | if (!pluginType.IsAbstract) |
62 | { | 62 | { |
63 | // Regions go here | 63 | // Regions go here |
64 | Type typeInterface = pluginType.GetInterface("IGridData", true); | 64 | Type typeInterface = pluginType.GetInterface("IGridData", true); |
65 | 65 | ||
66 | if (typeInterface != null) | 66 | if (typeInterface != null) |
67 | { | 67 | { |
68 | IGridData plug = (IGridData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | 68 | IGridData plug = (IGridData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); |
69 | plug.Initialise(); | 69 | plug.Initialise(); |
70 | this._plugins.Add(plug.getName(), plug); | 70 | this._plugins.Add(plug.getName(), plug); |
71 | MainLog.Instance.Verbose("Storage: Added IGridData Interface"); | 71 | MainLog.Instance.Verbose("Storage: Added IGridData Interface"); |
72 | } | 72 | } |
73 | 73 | ||
74 | typeInterface = null; | 74 | typeInterface = null; |
75 | 75 | ||
76 | // Logs go here | 76 | // Logs go here |
77 | typeInterface = pluginType.GetInterface("ILogData", true); | 77 | typeInterface = pluginType.GetInterface("ILogData", true); |
78 | 78 | ||
79 | if (typeInterface != null) | 79 | if (typeInterface != null) |
80 | { | 80 | { |
81 | ILogData plug = (ILogData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | 81 | ILogData plug = (ILogData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); |
82 | plug.Initialise(); | 82 | plug.Initialise(); |
83 | this._logplugins.Add(plug.getName(), plug); | 83 | this._logplugins.Add(plug.getName(), plug); |
84 | MainLog.Instance.Verbose( "Storage: Added ILogData Interface"); | 84 | MainLog.Instance.Verbose( "Storage: Added ILogData Interface"); |
85 | } | 85 | } |
86 | 86 | ||
87 | typeInterface = null; | 87 | typeInterface = null; |
88 | } | 88 | } |
89 | } | 89 | } |
90 | 90 | ||
91 | pluginAssembly = null; | 91 | pluginAssembly = null; |
92 | } | 92 | } |
93 | 93 | ||
94 | /// <summary> | 94 | /// <summary> |
95 | /// Logs a piece of information to the database | 95 | /// Logs a piece of information to the database |
96 | /// </summary> | 96 | /// </summary> |
97 | /// <param name="target">What you were operating on (in grid server, this will likely be the region UUIDs)</param> | 97 | /// <param name="target">What you were operating on (in grid server, this will likely be the region UUIDs)</param> |
98 | /// <param name="method">Which method is being called?</param> | 98 | /// <param name="method">Which method is being called?</param> |
99 | /// <param name="args">What arguments are being passed?</param> | 99 | /// <param name="args">What arguments are being passed?</param> |
100 | /// <param name="priority">How high priority is this? 1 = Max, 6 = Verbose</param> | 100 | /// <param name="priority">How high priority is this? 1 = Max, 6 = Verbose</param> |
101 | /// <param name="message">The message to log</param> | 101 | /// <param name="message">The message to log</param> |
102 | private void logToDB(string target, string method, string args, int priority, string message) | 102 | private void logToDB(string target, string method, string args, int priority, string message) |
103 | { | 103 | { |
104 | foreach (KeyValuePair<string, ILogData> kvp in _logplugins) | 104 | foreach (KeyValuePair<string, ILogData> kvp in _logplugins) |
105 | { | 105 | { |
106 | try | 106 | try |
107 | { | 107 | { |
108 | kvp.Value.saveLog("Gridserver", target, method, args, priority, message); | 108 | kvp.Value.saveLog("Gridserver", target, method, args, priority, message); |
109 | } | 109 | } |
110 | catch (Exception) | 110 | catch (Exception) |
111 | { | 111 | { |
112 | MainLog.Instance.Warn("Storage: unable to write log via " + kvp.Key); | 112 | MainLog.Instance.Warn("Storage: unable to write log via " + kvp.Key); |
113 | } | 113 | } |
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
117 | /// <summary> | 117 | /// <summary> |
118 | /// Returns a region by argument | 118 | /// Returns a region by argument |
119 | /// </summary> | 119 | /// </summary> |
120 | /// <param name="uuid">A UUID key of the region to return</param> | 120 | /// <param name="uuid">A UUID key of the region to return</param> |
121 | /// <returns>A SimProfileData for the region</returns> | 121 | /// <returns>A SimProfileData for the region</returns> |
122 | public SimProfileData getRegion(LLUUID uuid) | 122 | public SimProfileData getRegion(LLUUID uuid) |
123 | { | 123 | { |
124 | foreach(KeyValuePair<string,IGridData> kvp in _plugins) { | 124 | foreach(KeyValuePair<string,IGridData> kvp in _plugins) { |
125 | try | 125 | try |
126 | { | 126 | { |
127 | return kvp.Value.GetProfileByLLUUID(uuid); | 127 | return kvp.Value.GetProfileByLLUUID(uuid); |
128 | } | 128 | } |
129 | catch (Exception e) | 129 | catch (Exception e) |
130 | { | 130 | { |
131 | MainLog.Instance.Warn("Message from Storage: " + e.Message); | 131 | MainLog.Instance.Warn("Message from Storage: " + e.Message); |
132 | } | 132 | } |
133 | } | 133 | } |
134 | return null; | 134 | return null; |
135 | } | 135 | } |
136 | 136 | ||
137 | /// <summary> | 137 | /// <summary> |
138 | /// Returns a region by argument | 138 | /// Returns a region by argument |
139 | /// </summary> | 139 | /// </summary> |
140 | /// <param name="uuid">A regionHandle of the region to return</param> | 140 | /// <param name="uuid">A regionHandle of the region to return</param> |
141 | /// <returns>A SimProfileData for the region</returns> | 141 | /// <returns>A SimProfileData for the region</returns> |
142 | public SimProfileData getRegion(ulong handle) | 142 | public SimProfileData getRegion(ulong handle) |
143 | { | 143 | { |
144 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) | 144 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) |
145 | { | 145 | { |
146 | try | 146 | try |
147 | { | 147 | { |
148 | return kvp.Value.GetProfileByHandle(handle); | 148 | return kvp.Value.GetProfileByHandle(handle); |
149 | } | 149 | } |
150 | catch | 150 | catch |
151 | { | 151 | { |
152 | MainLog.Instance.Warn("Storage: Unable to find region " + handle.ToString() + " via " + kvp.Key); | 152 | MainLog.Instance.Warn("Storage: Unable to find region " + handle.ToString() + " via " + kvp.Key); |
153 | } | 153 | } |
154 | } | 154 | } |
155 | return null; | 155 | return null; |
156 | } | 156 | } |
157 | 157 | ||
158 | public Dictionary<ulong, SimProfileData> getRegions(uint xmin, uint ymin, uint xmax, uint ymax) | 158 | public Dictionary<ulong, SimProfileData> getRegions(uint xmin, uint ymin, uint xmax, uint ymax) |
159 | { | 159 | { |
160 | Dictionary<ulong, SimProfileData> regions = new Dictionary<ulong, SimProfileData>(); | 160 | Dictionary<ulong, SimProfileData> regions = new Dictionary<ulong, SimProfileData>(); |
161 | 161 | ||
162 | SimProfileData[] neighbours; | 162 | SimProfileData[] neighbours; |
163 | 163 | ||
164 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) | 164 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) |
165 | { | 165 | { |
166 | try | 166 | try |
167 | { | 167 | { |
168 | neighbours = kvp.Value.GetProfilesInRange(xmin, ymin, xmax, ymax); | 168 | neighbours = kvp.Value.GetProfilesInRange(xmin, ymin, xmax, ymax); |
169 | foreach (SimProfileData neighbour in neighbours) | 169 | foreach (SimProfileData neighbour in neighbours) |
170 | { | 170 | { |
171 | regions[neighbour.regionHandle] = neighbour; | 171 | regions[neighbour.regionHandle] = neighbour; |
172 | } | 172 | } |
173 | } | 173 | } |
174 | catch | 174 | catch |
175 | { | 175 | { |
176 | MainLog.Instance.Warn("Storage: Unable to query regionblock via " + kvp.Key); | 176 | MainLog.Instance.Warn("Storage: Unable to query regionblock via " + kvp.Key); |
177 | } | 177 | } |
178 | } | 178 | } |
179 | 179 | ||
180 | return regions; | 180 | return regions; |
181 | } | 181 | } |
182 | 182 | ||
183 | 183 | ||
184 | 184 | ||
185 | /// <summary> | 185 | /// <summary> |
186 | /// Returns a XML String containing a list of the neighbouring regions | 186 | /// Returns a XML String containing a list of the neighbouring regions |
187 | /// </summary> | 187 | /// </summary> |
188 | /// <param name="reqhandle">The regionhandle for the center sim</param> | 188 | /// <param name="reqhandle">The regionhandle for the center sim</param> |
189 | /// <returns>An XML string containing neighbour entities</returns> | 189 | /// <returns>An XML string containing neighbour entities</returns> |
190 | public string GetXMLNeighbours(ulong reqhandle) | 190 | public string GetXMLNeighbours(ulong reqhandle) |
191 | { | 191 | { |
192 | string response = ""; | 192 | string response = ""; |
193 | SimProfileData central_region = getRegion(reqhandle); | 193 | SimProfileData central_region = getRegion(reqhandle); |
194 | SimProfileData neighbour; | 194 | SimProfileData neighbour; |
195 | for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++) | 195 | for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++) |
196 | { | 196 | { |
197 | if (getRegion(Util.UIntsToLong((uint)((central_region.regionLocX + x) * 256), (uint)(central_region.regionLocY + y) * 256)) != null) | 197 | if (getRegion(Util.UIntsToLong((uint)((central_region.regionLocX + x) * 256), (uint)(central_region.regionLocY + y) * 256)) != null) |
198 | { | 198 | { |
199 | neighbour = getRegion(Util.UIntsToLong((uint)((central_region.regionLocX + x) * 256), (uint)(central_region.regionLocY + y) * 256)); | 199 | neighbour = getRegion(Util.UIntsToLong((uint)((central_region.regionLocX + x) * 256), (uint)(central_region.regionLocY + y) * 256)); |
200 | response += "<neighbour>"; | 200 | response += "<neighbour>"; |
201 | response += "<sim_ip>" + neighbour.serverIP + "</sim_ip>"; | 201 | response += "<sim_ip>" + neighbour.serverIP + "</sim_ip>"; |
202 | response += "<sim_port>" + neighbour.serverPort.ToString() + "</sim_port>"; | 202 | response += "<sim_port>" + neighbour.serverPort.ToString() + "</sim_port>"; |
203 | response += "<locx>" + neighbour.regionLocX.ToString() + "</locx>"; | 203 | response += "<locx>" + neighbour.regionLocX.ToString() + "</locx>"; |
204 | response += "<locy>" + neighbour.regionLocY.ToString() + "</locy>"; | 204 | response += "<locy>" + neighbour.regionLocY.ToString() + "</locy>"; |
205 | response += "<regionhandle>" + neighbour.regionHandle.ToString() + "</regionhandle>"; | 205 | response += "<regionhandle>" + neighbour.regionHandle.ToString() + "</regionhandle>"; |
206 | response += "</neighbour>"; | 206 | response += "</neighbour>"; |
207 | 207 | ||
208 | } | 208 | } |
209 | } | 209 | } |
210 | return response; | 210 | return response; |
211 | } | 211 | } |
212 | 212 | ||
213 | /// <summary> | 213 | /// <summary> |
214 | /// Performed when a region connects to the grid server initially. | 214 | /// Performed when a region connects to the grid server initially. |
215 | /// </summary> | 215 | /// </summary> |
216 | /// <param name="request">The XMLRPC Request</param> | 216 | /// <param name="request">The XMLRPC Request</param> |
217 | /// <returns>Startup parameters</returns> | 217 | /// <returns>Startup parameters</returns> |
218 | public XmlRpcResponse XmlRpcSimulatorLoginMethod(XmlRpcRequest request) | 218 | public XmlRpcResponse XmlRpcSimulatorLoginMethod(XmlRpcRequest request) |
219 | { | 219 | { |
220 | 220 | ||
221 | XmlRpcResponse response = new XmlRpcResponse(); | 221 | XmlRpcResponse response = new XmlRpcResponse(); |
222 | Hashtable responseData = new Hashtable(); | 222 | Hashtable responseData = new Hashtable(); |
223 | response.Value = responseData; | 223 | response.Value = responseData; |
224 | 224 | ||
225 | SimProfileData TheSim = null; | 225 | SimProfileData TheSim = null; |
226 | Hashtable requestData = (Hashtable)request.Params[0]; | 226 | Hashtable requestData = (Hashtable)request.Params[0]; |
227 | 227 | ||
228 | if (requestData.ContainsKey("UUID")) | 228 | if (requestData.ContainsKey("UUID")) |
229 | { | 229 | { |
230 | TheSim = getRegion(new LLUUID((string)requestData["UUID"])); | 230 | TheSim = getRegion(new LLUUID((string)requestData["UUID"])); |
231 | 231 | ||
232 | logToDB((new LLUUID((string)requestData["UUID"])).ToStringHyphenated(),"XmlRpcSimulatorLoginMethod","", 5,"Region attempting login with UUID."); | 232 | logToDB((new LLUUID((string)requestData["UUID"])).ToStringHyphenated(),"XmlRpcSimulatorLoginMethod","", 5,"Region attempting login with UUID."); |
233 | } | 233 | } |
234 | else if (requestData.ContainsKey("region_handle")) | 234 | else if (requestData.ContainsKey("region_handle")) |
235 | { | 235 | { |
236 | 236 | ||
237 | TheSim = getRegion((ulong)Convert.ToUInt64(requestData["region_handle"])); | 237 | TheSim = getRegion((ulong)Convert.ToUInt64(requestData["region_handle"])); |
238 | logToDB((string)requestData["region_handle"], "XmlRpcSimulatorLoginMethod", "", 5, "Region attempting login with regionHandle."); | 238 | logToDB((string)requestData["region_handle"], "XmlRpcSimulatorLoginMethod", "", 5, "Region attempting login with regionHandle."); |
239 | } | 239 | } |
240 | else | 240 | else |
241 | { | 241 | { |
242 | responseData["error"] = "No UUID or region_handle passed to grid server - unable to connect you"; | 242 | responseData["error"] = "No UUID or region_handle passed to grid server - unable to connect you"; |
243 | return response; | 243 | return response; |
244 | } | 244 | } |
245 | 245 | ||
246 | if (TheSim == null) // Shouldnt this be in the REST Simulator Set method? | 246 | if (TheSim == null) // Shouldnt this be in the REST Simulator Set method? |
247 | { | 247 | { |
248 | //NEW REGION | 248 | //NEW REGION |
249 | TheSim = new SimProfileData(); | 249 | TheSim = new SimProfileData(); |
250 | 250 | ||
251 | TheSim.regionRecvKey = config.SimRecvKey; | 251 | TheSim.regionRecvKey = config.SimRecvKey; |
252 | TheSim.regionSendKey = config.SimSendKey; | 252 | TheSim.regionSendKey = config.SimSendKey; |
253 | TheSim.regionSecret = config.SimRecvKey; | 253 | TheSim.regionSecret = config.SimRecvKey; |
254 | TheSim.regionDataURI = ""; | 254 | TheSim.regionDataURI = ""; |
255 | TheSim.regionAssetURI = config.DefaultAssetServer; | 255 | TheSim.regionAssetURI = config.DefaultAssetServer; |
256 | TheSim.regionAssetRecvKey = config.AssetRecvKey; | 256 | TheSim.regionAssetRecvKey = config.AssetRecvKey; |
257 | TheSim.regionAssetSendKey = config.AssetSendKey; | 257 | TheSim.regionAssetSendKey = config.AssetSendKey; |
258 | TheSim.regionUserURI = config.DefaultUserServer; | 258 | TheSim.regionUserURI = config.DefaultUserServer; |
259 | TheSim.regionUserSendKey = config.UserSendKey; | 259 | TheSim.regionUserSendKey = config.UserSendKey; |
260 | TheSim.regionUserRecvKey = config.UserRecvKey; | 260 | TheSim.regionUserRecvKey = config.UserRecvKey; |
261 | 261 | ||
262 | TheSim.serverIP = (string)requestData["sim_ip"]; | 262 | TheSim.serverIP = (string)requestData["sim_ip"]; |
263 | TheSim.serverPort = Convert.ToUInt32((string)requestData["sim_port"]); | 263 | TheSim.serverPort = Convert.ToUInt32((string)requestData["sim_port"]); |
264 | TheSim.httpPort = Convert.ToUInt32((string)requestData["http_port"]); | 264 | TheSim.httpPort = Convert.ToUInt32((string)requestData["http_port"]); |
265 | TheSim.remotingPort = Convert.ToUInt32((string)requestData["remoting_port"]); | 265 | TheSim.remotingPort = Convert.ToUInt32((string)requestData["remoting_port"]); |
266 | TheSim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]); | 266 | TheSim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]); |
267 | TheSim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]); | 267 | TheSim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]); |
268 | TheSim.regionLocZ = 0; | 268 | TheSim.regionLocZ = 0; |
269 | TheSim.regionMapTextureID = new LLUUID((string)requestData["map-image-id"]); | 269 | TheSim.regionMapTextureID = new LLUUID((string)requestData["map-image-id"]); |
270 | 270 | ||
271 | TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256)); | 271 | TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256)); |
272 | System.Console.WriteLine("adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " + TheSim.regionHandle); | 272 | System.Console.WriteLine("adding region " + TheSim.regionLocX + " , " + TheSim.regionLocY + " , " + TheSim.regionHandle); |
273 | TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/"; | 273 | TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/"; |
274 | TheSim.httpServerURI = "http://" + TheSim.serverIP + ":" + TheSim.httpPort + "/"; | 274 | TheSim.httpServerURI = "http://" + TheSim.serverIP + ":" + TheSim.httpPort + "/"; |
275 | 275 | ||
276 | Console.WriteLine("NEW SIM: " + TheSim.serverURI); | 276 | Console.WriteLine("NEW SIM: " + TheSim.serverURI); |
277 | TheSim.regionName = (string)requestData["sim_name"]; | 277 | TheSim.regionName = (string)requestData["sim_name"]; |
278 | TheSim.UUID = new LLUUID((string)requestData["UUID"]); | 278 | TheSim.UUID = new LLUUID((string)requestData["UUID"]); |
279 | 279 | ||
280 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) | 280 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) |
281 | { | 281 | { |
282 | try | 282 | try |
283 | { | 283 | { |
284 | DataResponse insertResponse = kvp.Value.AddProfile(TheSim); | 284 | DataResponse insertResponse = kvp.Value.AddProfile(TheSim); |
285 | switch(insertResponse) | 285 | switch(insertResponse) |
286 | { | 286 | { |
287 | case DataResponse.RESPONSE_OK: | 287 | case DataResponse.RESPONSE_OK: |
288 | OpenSim.Framework.Console.MainLog.Instance.Verbose("New sim creation successful: " + TheSim.regionName); | 288 | OpenSim.Framework.Console.MainLog.Instance.Verbose("New sim creation successful: " + TheSim.regionName); |
289 | break; | 289 | break; |
290 | case DataResponse.RESPONSE_ERROR: | 290 | case DataResponse.RESPONSE_ERROR: |
291 | OpenSim.Framework.Console.MainLog.Instance.Warn("New sim creation failed (Error): " + TheSim.regionName); | 291 | OpenSim.Framework.Console.MainLog.Instance.Warn("New sim creation failed (Error): " + TheSim.regionName); |
292 | break; | 292 | break; |
293 | case DataResponse.RESPONSE_INVALIDCREDENTIALS: | 293 | case DataResponse.RESPONSE_INVALIDCREDENTIALS: |
294 | OpenSim.Framework.Console.MainLog.Instance.Warn("New sim creation failed (Invalid Credentials): " + TheSim.regionName); | 294 | OpenSim.Framework.Console.MainLog.Instance.Warn("New sim creation failed (Invalid Credentials): " + TheSim.regionName); |
295 | break; | 295 | break; |
296 | case DataResponse.RESPONSE_AUTHREQUIRED: | 296 | case DataResponse.RESPONSE_AUTHREQUIRED: |
297 | OpenSim.Framework.Console.MainLog.Instance.Warn("New sim creation failed (Authentication Required): " + TheSim.regionName); | 297 | OpenSim.Framework.Console.MainLog.Instance.Warn("New sim creation failed (Authentication Required): " + TheSim.regionName); |
298 | break; | 298 | break; |
299 | } | 299 | } |
300 | 300 | ||
301 | } | 301 | } |
302 | catch (Exception e) | 302 | catch (Exception e) |
303 | { | 303 | { |
304 | OpenSim.Framework.Console.MainLog.Instance.Warn("Storage: Unable to add region " + TheSim.UUID.ToStringHyphenated() + " via " + kvp.Key); | 304 | OpenSim.Framework.Console.MainLog.Instance.Warn("Storage: Unable to add region " + TheSim.UUID.ToStringHyphenated() + " via " + kvp.Key); |
305 | OpenSim.Framework.Console.MainLog.Instance.Warn(e.ToString()); | 305 | OpenSim.Framework.Console.MainLog.Instance.Warn(e.ToString()); |
306 | } | 306 | } |
307 | } | 307 | } |
308 | 308 | ||
309 | 309 | ||
310 | if (getRegion(TheSim.regionHandle) == null) | 310 | if (getRegion(TheSim.regionHandle) == null) |
311 | { | 311 | { |
312 | responseData["error"] = "Unable to add new region"; | 312 | responseData["error"] = "Unable to add new region"; |
313 | return response; | 313 | return response; |
314 | } | 314 | } |
315 | } | 315 | } |
316 | 316 | ||
317 | 317 | ||
318 | ArrayList SimNeighboursData = new ArrayList(); | 318 | ArrayList SimNeighboursData = new ArrayList(); |
319 | 319 | ||
320 | SimProfileData neighbour; | 320 | SimProfileData neighbour; |
321 | Hashtable NeighbourBlock; | 321 | Hashtable NeighbourBlock; |
322 | 322 | ||
323 | bool fastMode = false; // Only compatible with MySQL right now | 323 | bool fastMode = false; // Only compatible with MySQL right now |
324 | 324 | ||
325 | if (fastMode) | 325 | if (fastMode) |
326 | { | 326 | { |
327 | Dictionary<ulong, SimProfileData> neighbours = getRegions(TheSim.regionLocX - 1, TheSim.regionLocY - 1, TheSim.regionLocX + 1, TheSim.regionLocY + 1); | 327 | Dictionary<ulong, SimProfileData> neighbours = getRegions(TheSim.regionLocX - 1, TheSim.regionLocY - 1, TheSim.regionLocX + 1, TheSim.regionLocY + 1); |
328 | 328 | ||
329 | foreach (KeyValuePair<ulong, SimProfileData> aSim in neighbours) | 329 | foreach (KeyValuePair<ulong, SimProfileData> aSim in neighbours) |
330 | { | 330 | { |
331 | NeighbourBlock = new Hashtable(); | 331 | NeighbourBlock = new Hashtable(); |
332 | NeighbourBlock["sim_ip"] = aSim.Value.serverIP.ToString(); | 332 | NeighbourBlock["sim_ip"] = aSim.Value.serverIP.ToString(); |
333 | NeighbourBlock["sim_port"] = aSim.Value.serverPort.ToString(); | 333 | NeighbourBlock["sim_port"] = aSim.Value.serverPort.ToString(); |
334 | NeighbourBlock["region_locx"] = aSim.Value.regionLocX.ToString(); | 334 | NeighbourBlock["region_locx"] = aSim.Value.regionLocX.ToString(); |
335 | NeighbourBlock["region_locy"] = aSim.Value.regionLocY.ToString(); | 335 | NeighbourBlock["region_locy"] = aSim.Value.regionLocY.ToString(); |
336 | NeighbourBlock["UUID"] = aSim.Value.UUID.ToString(); | 336 | NeighbourBlock["UUID"] = aSim.Value.UUID.ToString(); |
337 | 337 | ||
338 | if (aSim.Value.UUID != TheSim.UUID) | 338 | if (aSim.Value.UUID != TheSim.UUID) |
339 | SimNeighboursData.Add(NeighbourBlock); | 339 | SimNeighboursData.Add(NeighbourBlock); |
340 | } | 340 | } |
341 | } | 341 | } |
342 | else | 342 | else |
343 | { | 343 | { |
344 | for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++) | 344 | for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++) |
345 | { | 345 | { |
346 | if (getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256)) != null) | 346 | if (getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256)) != null) |
347 | { | 347 | { |
348 | neighbour = getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256)); | 348 | neighbour = getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256)); |
349 | 349 | ||
350 | NeighbourBlock = new Hashtable(); | 350 | NeighbourBlock = new Hashtable(); |
351 | NeighbourBlock["sim_ip"] = neighbour.serverIP; | 351 | NeighbourBlock["sim_ip"] = neighbour.serverIP; |
352 | NeighbourBlock["sim_port"] = neighbour.serverPort.ToString(); | 352 | NeighbourBlock["sim_port"] = neighbour.serverPort.ToString(); |
353 | NeighbourBlock["region_locx"] = neighbour.regionLocX.ToString(); | 353 | NeighbourBlock["region_locx"] = neighbour.regionLocX.ToString(); |
354 | NeighbourBlock["region_locy"] = neighbour.regionLocY.ToString(); | 354 | NeighbourBlock["region_locy"] = neighbour.regionLocY.ToString(); |
355 | NeighbourBlock["UUID"] = neighbour.UUID.ToString(); | 355 | NeighbourBlock["UUID"] = neighbour.UUID.ToString(); |
356 | 356 | ||
357 | if (neighbour.UUID != TheSim.UUID) SimNeighboursData.Add(NeighbourBlock); | 357 | if (neighbour.UUID != TheSim.UUID) SimNeighboursData.Add(NeighbourBlock); |
358 | } | 358 | } |
359 | } | 359 | } |
360 | } | 360 | } |
361 | 361 | ||
362 | responseData["UUID"] = TheSim.UUID.ToString(); | 362 | responseData["UUID"] = TheSim.UUID.ToString(); |
363 | responseData["region_locx"] = TheSim.regionLocX.ToString(); | 363 | responseData["region_locx"] = TheSim.regionLocX.ToString(); |
364 | responseData["region_locy"] = TheSim.regionLocY.ToString(); | 364 | responseData["region_locy"] = TheSim.regionLocY.ToString(); |
365 | responseData["regionname"] = TheSim.regionName; | 365 | responseData["regionname"] = TheSim.regionName; |
366 | responseData["estate_id"] = "1"; | 366 | responseData["estate_id"] = "1"; |
367 | responseData["neighbours"] = SimNeighboursData; | 367 | responseData["neighbours"] = SimNeighboursData; |
368 | 368 | ||
369 | responseData["sim_ip"] = TheSim.serverIP; | 369 | responseData["sim_ip"] = TheSim.serverIP; |
370 | responseData["sim_port"] = TheSim.serverPort.ToString(); | 370 | responseData["sim_port"] = TheSim.serverPort.ToString(); |
371 | responseData["asset_url"] = TheSim.regionAssetURI; | 371 | responseData["asset_url"] = TheSim.regionAssetURI; |
372 | responseData["asset_sendkey"] = TheSim.regionAssetSendKey; | 372 | responseData["asset_sendkey"] = TheSim.regionAssetSendKey; |
373 | responseData["asset_recvkey"] = TheSim.regionAssetRecvKey; | 373 | responseData["asset_recvkey"] = TheSim.regionAssetRecvKey; |
374 | responseData["user_url"] = TheSim.regionUserURI; | 374 | responseData["user_url"] = TheSim.regionUserURI; |
375 | responseData["user_sendkey"] = TheSim.regionUserSendKey; | 375 | responseData["user_sendkey"] = TheSim.regionUserSendKey; |
376 | responseData["user_recvkey"] = TheSim.regionUserRecvKey; | 376 | responseData["user_recvkey"] = TheSim.regionUserRecvKey; |
377 | responseData["authkey"] = TheSim.regionSecret; | 377 | responseData["authkey"] = TheSim.regionSecret; |
378 | 378 | ||
379 | // New! If set, use as URL to local sim storage (ie http://remotehost/region.yap) | 379 | // New! If set, use as URL to local sim storage (ie http://remotehost/region.yap) |
380 | responseData["data_uri"] = TheSim.regionDataURI; | 380 | responseData["data_uri"] = TheSim.regionDataURI; |
381 | 381 | ||
382 | 382 | ||
383 | return response; | 383 | return response; |
384 | } | 384 | } |
385 | 385 | ||
386 | public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request) | 386 | public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request) |
387 | { | 387 | { |
388 | Hashtable requestData = (Hashtable)request.Params[0]; | 388 | Hashtable requestData = (Hashtable)request.Params[0]; |
389 | Hashtable responseData = new Hashtable(); | 389 | Hashtable responseData = new Hashtable(); |
390 | SimProfileData simData = null; | 390 | SimProfileData simData = null; |
391 | if (requestData.ContainsKey("region_UUID")) | 391 | if (requestData.ContainsKey("region_UUID")) |
392 | { | 392 | { |
393 | simData = getRegion(new LLUUID((string)requestData["region_UUID"])); | 393 | simData = getRegion(new LLUUID((string)requestData["region_UUID"])); |
394 | } | 394 | } |
395 | else if (requestData.ContainsKey("region_handle")) | 395 | else if (requestData.ContainsKey("region_handle")) |
396 | { | 396 | { |
397 | Console.WriteLine("requesting data for region " + (string)requestData["region_handle"]); | 397 | Console.WriteLine("requesting data for region " + (string)requestData["region_handle"]); |
398 | simData = getRegion(Convert.ToUInt64((string)requestData["region_handle"])); | 398 | simData = getRegion(Convert.ToUInt64((string)requestData["region_handle"])); |
399 | } | 399 | } |
400 | 400 | ||
401 | if (simData == null) | 401 | if (simData == null) |
402 | { | 402 | { |
403 | //Sim does not exist | 403 | //Sim does not exist |
404 | Console.WriteLine("region not found"); | 404 | Console.WriteLine("region not found"); |
405 | responseData["error"] = "Sim does not exist"; | 405 | responseData["error"] = "Sim does not exist"; |
406 | } | 406 | } |
407 | else | 407 | else |
408 | { | 408 | { |
409 | Console.WriteLine("found region"); | 409 | Console.WriteLine("found region"); |
410 | responseData["sim_ip"] = simData.serverIP; | 410 | responseData["sim_ip"] = simData.serverIP; |
411 | responseData["sim_port"] = simData.serverPort.ToString(); | 411 | responseData["sim_port"] = simData.serverPort.ToString(); |
412 | responseData["http_port"] = simData.httpPort.ToString(); | 412 | responseData["http_port"] = simData.httpPort.ToString(); |
413 | responseData["remoting_port"] = simData.remotingPort.ToString(); | 413 | responseData["remoting_port"] = simData.remotingPort.ToString(); |
414 | responseData["region_locx"] = simData.regionLocX.ToString() ; | 414 | responseData["region_locx"] = simData.regionLocX.ToString() ; |
415 | responseData["region_locy"] = simData.regionLocY.ToString(); | 415 | responseData["region_locy"] = simData.regionLocY.ToString(); |
416 | responseData["region_UUID"] = simData.UUID.UUID.ToString(); | 416 | responseData["region_UUID"] = simData.UUID.UUID.ToString(); |
417 | responseData["region_name"] = simData.regionName; | 417 | responseData["region_name"] = simData.regionName; |
418 | } | 418 | } |
419 | 419 | ||
420 | XmlRpcResponse response = new XmlRpcResponse(); | 420 | XmlRpcResponse response = new XmlRpcResponse(); |
421 | response.Value = responseData; | 421 | response.Value = responseData; |
422 | return response; | 422 | return response; |
423 | } | 423 | } |
424 | 424 | ||
425 | public XmlRpcResponse XmlRpcMapBlockMethod(XmlRpcRequest request) | 425 | public XmlRpcResponse XmlRpcMapBlockMethod(XmlRpcRequest request) |
426 | { | 426 | { |
427 | int xmin=980, ymin=980, xmax=1020, ymax=1020; | 427 | int xmin=980, ymin=980, xmax=1020, ymax=1020; |
428 | 428 | ||
429 | Hashtable requestData = (Hashtable)request.Params[0]; | 429 | Hashtable requestData = (Hashtable)request.Params[0]; |
430 | if (requestData.ContainsKey("xmin")) | 430 | if (requestData.ContainsKey("xmin")) |
431 | { | 431 | { |
432 | xmin = (Int32)requestData["xmin"]; | 432 | xmin = (Int32)requestData["xmin"]; |
433 | } | 433 | } |
434 | if (requestData.ContainsKey("ymin")) | 434 | if (requestData.ContainsKey("ymin")) |
435 | { | 435 | { |
436 | ymin = (Int32)requestData["ymin"]; | 436 | ymin = (Int32)requestData["ymin"]; |
437 | } | 437 | } |
438 | if (requestData.ContainsKey("xmax")) | 438 | if (requestData.ContainsKey("xmax")) |
439 | { | 439 | { |
440 | xmax = (Int32)requestData["xmax"]; | 440 | xmax = (Int32)requestData["xmax"]; |
441 | } | 441 | } |
442 | if (requestData.ContainsKey("ymax")) | 442 | if (requestData.ContainsKey("ymax")) |
443 | { | 443 | { |
444 | ymax = (Int32)requestData["ymax"]; | 444 | ymax = (Int32)requestData["ymax"]; |
445 | } | 445 | } |
446 | 446 | ||
447 | XmlRpcResponse response = new XmlRpcResponse(); | 447 | XmlRpcResponse response = new XmlRpcResponse(); |
448 | Hashtable responseData = new Hashtable(); | 448 | Hashtable responseData = new Hashtable(); |
449 | response.Value = responseData; | 449 | response.Value = responseData; |
450 | IList simProfileList = new ArrayList(); | 450 | IList simProfileList = new ArrayList(); |
451 | 451 | ||
452 | bool fastMode = false; // MySQL Only | 452 | bool fastMode = false; // MySQL Only |
453 | 453 | ||
454 | if (fastMode) | 454 | if (fastMode) |
455 | { | 455 | { |
456 | Dictionary<ulong, SimProfileData> neighbours = getRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax); | 456 | Dictionary<ulong, SimProfileData> neighbours = getRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax); |
457 | 457 | ||
458 | foreach (KeyValuePair<ulong, SimProfileData> aSim in neighbours) | 458 | foreach (KeyValuePair<ulong, SimProfileData> aSim in neighbours) |
459 | { | 459 | { |
460 | Hashtable simProfileBlock = new Hashtable(); | 460 | Hashtable simProfileBlock = new Hashtable(); |
461 | simProfileBlock["x"] = aSim.Value.regionLocX.ToString(); | 461 | simProfileBlock["x"] = aSim.Value.regionLocX.ToString(); |
462 | simProfileBlock["y"] = aSim.Value.regionLocY.ToString(); | 462 | simProfileBlock["y"] = aSim.Value.regionLocY.ToString(); |
463 | System.Console.WriteLine("send neighbour info for " + aSim.Value.regionLocX.ToString() + " , " + aSim.Value.regionLocY.ToString()); | 463 | System.Console.WriteLine("send neighbour info for " + aSim.Value.regionLocX.ToString() + " , " + aSim.Value.regionLocY.ToString()); |
464 | simProfileBlock["name"] = aSim.Value.regionName; | 464 | simProfileBlock["name"] = aSim.Value.regionName; |
465 | simProfileBlock["access"] = 21; | 465 | simProfileBlock["access"] = 21; |
466 | simProfileBlock["region-flags"] = 512; | 466 | simProfileBlock["region-flags"] = 512; |
467 | simProfileBlock["water-height"] = 0; | 467 | simProfileBlock["water-height"] = 0; |
468 | simProfileBlock["agents"] = 1; | 468 | simProfileBlock["agents"] = 1; |
469 | simProfileBlock["map-image-id"] = aSim.Value.regionMapTextureID.ToString(); | 469 | simProfileBlock["map-image-id"] = aSim.Value.regionMapTextureID.ToString(); |
470 | 470 | ||
471 | // For Sugilite compatibility | 471 | // For Sugilite compatibility |
472 | simProfileBlock["regionhandle"] = aSim.Value.regionHandle.ToString(); | 472 | simProfileBlock["regionhandle"] = aSim.Value.regionHandle.ToString(); |
473 | simProfileBlock["sim_ip"] = aSim.Value.serverIP.ToString(); | 473 | simProfileBlock["sim_ip"] = aSim.Value.serverIP.ToString(); |
474 | simProfileBlock["sim_port"] = aSim.Value.serverPort.ToString(); | 474 | simProfileBlock["sim_port"] = aSim.Value.serverPort.ToString(); |
475 | simProfileBlock["sim_uri"] = aSim.Value.serverURI.ToString(); | 475 | simProfileBlock["sim_uri"] = aSim.Value.serverURI.ToString(); |
476 | simProfileBlock["uuid"] = aSim.Value.UUID.ToStringHyphenated(); | 476 | simProfileBlock["uuid"] = aSim.Value.UUID.ToStringHyphenated(); |
477 | 477 | ||
478 | simProfileList.Add(simProfileBlock); | 478 | simProfileList.Add(simProfileBlock); |
479 | } | 479 | } |
480 | MainLog.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() + " region(s) in range via FastMode"); | 480 | MainLog.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() + " region(s) in range via FastMode"); |
481 | } | 481 | } |
482 | else | 482 | else |
483 | { | 483 | { |
484 | SimProfileData simProfile; | 484 | SimProfileData simProfile; |
485 | for (int x = xmin; x < xmax+1; x++) | 485 | for (int x = xmin; x < xmax+1; x++) |
486 | { | 486 | { |
487 | for (int y = ymin; y < ymax+1; y++) | 487 | for (int y = ymin; y < ymax+1; y++) |
488 | { | 488 | { |
489 | ulong regHandle = Helpers.UIntsToLong((uint)(x * 256), (uint)(y * 256)); | 489 | ulong regHandle = Helpers.UIntsToLong((uint)(x * 256), (uint)(y * 256)); |
490 | simProfile = getRegion(regHandle); | 490 | simProfile = getRegion(regHandle); |
491 | if (simProfile != null) | 491 | if (simProfile != null) |
492 | { | 492 | { |
493 | Hashtable simProfileBlock = new Hashtable(); | 493 | Hashtable simProfileBlock = new Hashtable(); |
494 | simProfileBlock["x"] = x; | 494 | simProfileBlock["x"] = x; |
495 | simProfileBlock["y"] = y; | 495 | simProfileBlock["y"] = y; |
496 | simProfileBlock["name"] = simProfile.regionName; | 496 | simProfileBlock["name"] = simProfile.regionName; |
497 | simProfileBlock["access"] = 0; | 497 | simProfileBlock["access"] = 0; |
498 | simProfileBlock["region-flags"] = 0; | 498 | simProfileBlock["region-flags"] = 0; |
499 | simProfileBlock["water-height"] = 20; | 499 | simProfileBlock["water-height"] = 20; |
500 | simProfileBlock["agents"] = 1; | 500 | simProfileBlock["agents"] = 1; |
501 | simProfileBlock["map-image-id"] = simProfile.regionMapTextureID.ToStringHyphenated(); | 501 | simProfileBlock["map-image-id"] = simProfile.regionMapTextureID.ToStringHyphenated(); |
502 | 502 | ||
503 | // For Sugilite compatibility | 503 | // For Sugilite compatibility |
504 | simProfileBlock["regionhandle"] = simProfile.regionHandle.ToString(); | 504 | simProfileBlock["regionhandle"] = simProfile.regionHandle.ToString(); |
505 | simProfileBlock["sim_ip"] = simProfile.serverIP.ToString(); | 505 | simProfileBlock["sim_ip"] = simProfile.serverIP.ToString(); |
506 | simProfileBlock["sim_port"] = simProfile.serverPort.ToString(); | 506 | simProfileBlock["sim_port"] = simProfile.serverPort.ToString(); |
507 | simProfileBlock["sim_uri"] = simProfile.serverURI.ToString(); | 507 | simProfileBlock["sim_uri"] = simProfile.serverURI.ToString(); |
508 | simProfileBlock["uuid"] = simProfile.UUID.ToStringHyphenated(); | 508 | simProfileBlock["uuid"] = simProfile.UUID.ToStringHyphenated(); |
509 | 509 | ||
510 | simProfileList.Add(simProfileBlock); | 510 | simProfileList.Add(simProfileBlock); |
511 | } | 511 | } |
512 | } | 512 | } |
513 | } | 513 | } |
514 | MainLog.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() + " region(s) in range via Standard Mode"); | 514 | MainLog.Instance.Verbose("World map request processed, returned " + simProfileList.Count.ToString() + " region(s) in range via Standard Mode"); |
515 | } | 515 | } |
516 | 516 | ||
517 | responseData["sim-profiles"] = simProfileList; | 517 | responseData["sim-profiles"] = simProfileList; |
518 | 518 | ||
519 | return response; | 519 | return response; |
520 | } | 520 | } |
521 | 521 | ||
522 | 522 | ||
523 | 523 | ||
524 | /// <summary> | 524 | /// <summary> |
525 | /// Performs a REST Get Operation | 525 | /// Performs a REST Get Operation |
526 | /// </summary> | 526 | /// </summary> |
527 | /// <param name="request"></param> | 527 | /// <param name="request"></param> |
528 | /// <param name="path"></param> | 528 | /// <param name="path"></param> |
529 | /// <param name="param"></param> | 529 | /// <param name="param"></param> |
530 | /// <returns></returns> | 530 | /// <returns></returns> |
531 | public string RestGetRegionMethod(string request, string path, string param) | 531 | public string RestGetRegionMethod(string request, string path, string param) |
532 | { | 532 | { |
533 | return RestGetSimMethod("", "/sims/", param); | 533 | return RestGetSimMethod("", "/sims/", param); |
534 | } | 534 | } |
535 | 535 | ||
536 | /// <summary> | 536 | /// <summary> |
537 | /// Performs a REST Set Operation | 537 | /// Performs a REST Set Operation |
538 | /// </summary> | 538 | /// </summary> |
539 | /// <param name="request"></param> | 539 | /// <param name="request"></param> |
540 | /// <param name="path"></param> | 540 | /// <param name="path"></param> |
541 | /// <param name="param"></param> | 541 | /// <param name="param"></param> |
542 | /// <returns></returns> | 542 | /// <returns></returns> |
543 | public string RestSetRegionMethod(string request, string path, string param) | 543 | public string RestSetRegionMethod(string request, string path, string param) |
544 | { | 544 | { |
545 | return RestSetSimMethod("", "/sims/", param); | 545 | return RestSetSimMethod("", "/sims/", param); |
546 | } | 546 | } |
547 | 547 | ||
548 | /// <summary> | 548 | /// <summary> |
549 | /// Returns information about a sim via a REST Request | 549 | /// Returns information about a sim via a REST Request |
550 | /// </summary> | 550 | /// </summary> |
551 | /// <param name="request"></param> | 551 | /// <param name="request"></param> |
552 | /// <param name="path"></param> | 552 | /// <param name="path"></param> |
553 | /// <param name="param"></param> | 553 | /// <param name="param"></param> |
554 | /// <returns>Information about the sim in XML</returns> | 554 | /// <returns>Information about the sim in XML</returns> |
555 | public string RestGetSimMethod(string request, string path, string param) | 555 | public string RestGetSimMethod(string request, string path, string param) |
556 | { | 556 | { |
557 | string respstring = String.Empty; | 557 | string respstring = String.Empty; |
558 | 558 | ||
559 | SimProfileData TheSim; | 559 | SimProfileData TheSim; |
560 | LLUUID UUID = new LLUUID(param); | 560 | LLUUID UUID = new LLUUID(param); |
561 | TheSim = getRegion(UUID); | 561 | TheSim = getRegion(UUID); |
562 | 562 | ||
563 | if (!(TheSim == null)) | 563 | if (!(TheSim == null)) |
564 | { | 564 | { |
565 | respstring = "<Root>"; | 565 | respstring = "<Root>"; |
566 | respstring += "<authkey>" + TheSim.regionSendKey + "</authkey>"; | 566 | respstring += "<authkey>" + TheSim.regionSendKey + "</authkey>"; |
567 | respstring += "<sim>"; | 567 | respstring += "<sim>"; |
568 | respstring += "<uuid>" + TheSim.UUID.ToString() + "</uuid>"; | 568 | respstring += "<uuid>" + TheSim.UUID.ToString() + "</uuid>"; |
569 | respstring += "<regionname>" + TheSim.regionName + "</regionname>"; | 569 | respstring += "<regionname>" + TheSim.regionName + "</regionname>"; |
570 | respstring += "<sim_ip>" + TheSim.serverIP + "</sim_ip>"; | 570 | respstring += "<sim_ip>" + TheSim.serverIP + "</sim_ip>"; |
571 | respstring += "<sim_port>" + TheSim.serverPort.ToString() + "</sim_port>"; | 571 | respstring += "<sim_port>" + TheSim.serverPort.ToString() + "</sim_port>"; |
572 | respstring += "<region_locx>" + TheSim.regionLocX.ToString() + "</region_locx>"; | 572 | respstring += "<region_locx>" + TheSim.regionLocX.ToString() + "</region_locx>"; |
573 | respstring += "<region_locy>" + TheSim.regionLocY.ToString() + "</region_locy>"; | 573 | respstring += "<region_locy>" + TheSim.regionLocY.ToString() + "</region_locy>"; |
574 | respstring += "<estate_id>1</estate_id>"; | 574 | respstring += "<estate_id>1</estate_id>"; |
575 | respstring += "</sim>"; | 575 | respstring += "</sim>"; |
576 | respstring += "</Root>"; | 576 | respstring += "</Root>"; |
577 | } | 577 | } |
578 | 578 | ||
579 | return respstring; | 579 | return respstring; |
580 | } | 580 | } |
581 | 581 | ||
582 | /// <summary> | 582 | /// <summary> |
583 | /// Creates or updates a sim via a REST Method Request | 583 | /// Creates or updates a sim via a REST Method Request |
584 | /// BROKEN with SQL Update | 584 | /// BROKEN with SQL Update |
585 | /// </summary> | 585 | /// </summary> |
586 | /// <param name="request"></param> | 586 | /// <param name="request"></param> |
587 | /// <param name="path"></param> | 587 | /// <param name="path"></param> |
588 | /// <param name="param"></param> | 588 | /// <param name="param"></param> |
589 | /// <returns>"OK" or an error</returns> | 589 | /// <returns>"OK" or an error</returns> |
590 | public string RestSetSimMethod(string request, string path, string param) | 590 | public string RestSetSimMethod(string request, string path, string param) |
591 | { | 591 | { |
592 | Console.WriteLine("Processing region update via REST method"); | 592 | Console.WriteLine("Processing region update via REST method"); |
593 | SimProfileData TheSim; | 593 | SimProfileData TheSim; |
594 | TheSim = getRegion(new LLUUID(param)); | 594 | TheSim = getRegion(new LLUUID(param)); |
595 | if ((TheSim) == null) | 595 | if ((TheSim) == null) |
596 | { | 596 | { |
597 | TheSim = new SimProfileData(); | 597 | TheSim = new SimProfileData(); |
598 | LLUUID UUID = new LLUUID(param); | 598 | LLUUID UUID = new LLUUID(param); |
599 | TheSim.UUID = UUID; | 599 | TheSim.UUID = UUID; |
600 | TheSim.regionRecvKey = config.SimRecvKey; | 600 | TheSim.regionRecvKey = config.SimRecvKey; |
601 | } | 601 | } |
602 | 602 | ||
603 | XmlDocument doc = new XmlDocument(); | 603 | XmlDocument doc = new XmlDocument(); |
604 | doc.LoadXml(request); | 604 | doc.LoadXml(request); |
605 | XmlNode rootnode = doc.FirstChild; | 605 | XmlNode rootnode = doc.FirstChild; |
606 | XmlNode authkeynode = rootnode.ChildNodes[0]; | 606 | XmlNode authkeynode = rootnode.ChildNodes[0]; |
607 | if (authkeynode.Name != "authkey") | 607 | if (authkeynode.Name != "authkey") |
608 | { | 608 | { |
609 | return "ERROR! bad XML - expected authkey tag"; | 609 | return "ERROR! bad XML - expected authkey tag"; |
610 | } | 610 | } |
611 | 611 | ||
612 | XmlNode simnode = rootnode.ChildNodes[1]; | 612 | XmlNode simnode = rootnode.ChildNodes[1]; |
613 | if (simnode.Name != "sim") | 613 | if (simnode.Name != "sim") |
614 | { | 614 | { |
615 | return "ERROR! bad XML - expected sim tag"; | 615 | return "ERROR! bad XML - expected sim tag"; |
616 | } | 616 | } |
617 | 617 | ||
618 | //TheSim.regionSendKey = Cfg; | 618 | //TheSim.regionSendKey = Cfg; |
619 | TheSim.regionRecvKey = config.SimRecvKey; | 619 | TheSim.regionRecvKey = config.SimRecvKey; |
620 | TheSim.regionSendKey = config.SimSendKey; | 620 | TheSim.regionSendKey = config.SimSendKey; |
621 | TheSim.regionSecret = config.SimRecvKey; | 621 | TheSim.regionSecret = config.SimRecvKey; |
622 | TheSim.regionDataURI = ""; | 622 | TheSim.regionDataURI = ""; |
623 | TheSim.regionAssetURI = config.DefaultAssetServer; | 623 | TheSim.regionAssetURI = config.DefaultAssetServer; |
624 | TheSim.regionAssetRecvKey = config.AssetRecvKey; | 624 | TheSim.regionAssetRecvKey = config.AssetRecvKey; |
625 | TheSim.regionAssetSendKey = config.AssetSendKey; | 625 | TheSim.regionAssetSendKey = config.AssetSendKey; |
626 | TheSim.regionUserURI = config.DefaultUserServer; | 626 | TheSim.regionUserURI = config.DefaultUserServer; |
627 | TheSim.regionUserSendKey = config.UserSendKey; | 627 | TheSim.regionUserSendKey = config.UserSendKey; |
628 | TheSim.regionUserRecvKey = config.UserRecvKey; | 628 | TheSim.regionUserRecvKey = config.UserRecvKey; |
629 | 629 | ||
630 | 630 | ||
631 | for (int i = 0; i < simnode.ChildNodes.Count; i++) | 631 | for (int i = 0; i < simnode.ChildNodes.Count; i++) |
632 | { | 632 | { |
633 | switch (simnode.ChildNodes[i].Name) | 633 | switch (simnode.ChildNodes[i].Name) |
634 | { | 634 | { |
635 | case "regionname": | 635 | case "regionname": |
636 | TheSim.regionName = simnode.ChildNodes[i].InnerText; | 636 | TheSim.regionName = simnode.ChildNodes[i].InnerText; |
637 | break; | 637 | break; |
638 | 638 | ||
639 | case "sim_ip": | 639 | case "sim_ip": |
640 | TheSim.serverIP = simnode.ChildNodes[i].InnerText; | 640 | TheSim.serverIP = simnode.ChildNodes[i].InnerText; |
641 | break; | 641 | break; |
642 | 642 | ||
643 | case "sim_port": | 643 | case "sim_port": |
644 | TheSim.serverPort = Convert.ToUInt32(simnode.ChildNodes[i].InnerText); | 644 | TheSim.serverPort = Convert.ToUInt32(simnode.ChildNodes[i].InnerText); |
645 | break; | 645 | break; |
646 | 646 | ||
647 | case "region_locx": | 647 | case "region_locx": |
648 | TheSim.regionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); | 648 | TheSim.regionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); |
649 | TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256)); | 649 | TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256)); |
650 | break; | 650 | break; |
651 | 651 | ||
652 | case "region_locy": | 652 | case "region_locy": |
653 | TheSim.regionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); | 653 | TheSim.regionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); |
654 | TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256)); | 654 | TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256)); |
655 | break; | 655 | break; |
656 | } | 656 | } |
657 | } | 657 | } |
658 | 658 | ||
659 | TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/"; | 659 | TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/"; |
660 | 660 | ||
661 | bool requirePublic = false; | 661 | bool requirePublic = false; |
662 | bool requireValid = true; | 662 | bool requireValid = true; |
663 | 663 | ||
664 | if (requirePublic && (TheSim.serverIP.StartsWith("172.16") || TheSim.serverIP.StartsWith("192.168") || TheSim.serverIP.StartsWith("10.") || TheSim.serverIP.StartsWith("0.") || TheSim.serverIP.StartsWith("255."))) | 664 | if (requirePublic && (TheSim.serverIP.StartsWith("172.16") || TheSim.serverIP.StartsWith("192.168") || TheSim.serverIP.StartsWith("10.") || TheSim.serverIP.StartsWith("0.") || TheSim.serverIP.StartsWith("255."))) |
665 | { | 665 | { |
666 | return "ERROR! Servers must register with public addresses."; | 666 | return "ERROR! Servers must register with public addresses."; |
667 | } | 667 | } |
668 | 668 | ||
669 | if (requireValid && (TheSim.serverIP.StartsWith("0."))) | 669 | if (requireValid && (TheSim.serverIP.StartsWith("0."))) |
670 | { | 670 | { |
671 | return "ERROR! 0.*.*.* Addresses are invalid, please check your server config and try again"; | 671 | return "ERROR! 0.*.*.* Addresses are invalid, please check your server config and try again"; |
672 | } | 672 | } |
673 | 673 | ||
674 | 674 | ||
675 | try | 675 | try |
676 | { | 676 | { |
677 | MainLog.Instance.Verbose("Updating / adding via " + _plugins.Count + " storage provider(s) registered."); | 677 | MainLog.Instance.Verbose("Updating / adding via " + _plugins.Count + " storage provider(s) registered."); |
678 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) | 678 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) |
679 | { | 679 | { |
680 | try | 680 | try |
681 | { | 681 | { |
682 | //Check reservations | 682 | //Check reservations |
683 | ReservationData reserveData = kvp.Value.GetReservationAtPoint(TheSim.regionLocX, TheSim.regionLocY); | 683 | ReservationData reserveData = kvp.Value.GetReservationAtPoint(TheSim.regionLocX, TheSim.regionLocY); |
684 | if ((reserveData != null && reserveData.gridRecvKey == TheSim.regionRecvKey) || (reserveData == null && authkeynode.InnerText != TheSim.regionRecvKey)) | 684 | if ((reserveData != null && reserveData.gridRecvKey == TheSim.regionRecvKey) || (reserveData == null && authkeynode.InnerText != TheSim.regionRecvKey)) |
685 | { | 685 | { |
686 | kvp.Value.AddProfile(TheSim); | 686 | kvp.Value.AddProfile(TheSim); |
687 | MainLog.Instance.Verbose("New sim added to grid (" + TheSim.regionName + ")"); | 687 | MainLog.Instance.Verbose("New sim added to grid (" + TheSim.regionName + ")"); |
688 | logToDB(TheSim.UUID.ToStringHyphenated(), "RestSetSimMethod", "", 5, "Region successfully updated and connected to grid."); | 688 | logToDB(TheSim.UUID.ToStringHyphenated(), "RestSetSimMethod", "", 5, "Region successfully updated and connected to grid."); |
689 | } | 689 | } |
690 | else | 690 | else |
691 | { | 691 | { |
692 | MainLog.Instance.Warn("Unable to update region (RestSetSimMethod): Incorrect reservation auth key.");// Wanted: " + reserveData.gridRecvKey + ", Got: " + TheSim.regionRecvKey + "."); | 692 | MainLog.Instance.Warn("Unable to update region (RestSetSimMethod): Incorrect reservation auth key.");// Wanted: " + reserveData.gridRecvKey + ", Got: " + TheSim.regionRecvKey + "."); |
693 | return "Unable to update region (RestSetSimMethod): Incorrect auth key."; | 693 | return "Unable to update region (RestSetSimMethod): Incorrect auth key."; |
694 | } | 694 | } |
695 | } | 695 | } |
696 | catch (Exception e) | 696 | catch (Exception e) |
697 | { | 697 | { |
698 | MainLog.Instance.Verbose("getRegionPlugin Handle " + kvp.Key + " unable to add new sim: " + e.ToString()); | 698 | MainLog.Instance.Verbose("getRegionPlugin Handle " + kvp.Key + " unable to add new sim: " + e.ToString()); |
699 | } | 699 | } |
700 | } | 700 | } |
701 | return "OK"; | 701 | return "OK"; |
702 | } | 702 | } |
703 | catch (Exception e) | 703 | catch (Exception e) |
704 | { | 704 | { |
705 | return "ERROR! Could not save to database! (" + e.ToString() + ")"; | 705 | return "ERROR! Could not save to database! (" + e.ToString() + ")"; |
706 | } | 706 | } |
707 | } | 707 | } |
708 | 708 | ||
709 | } | 709 | } |
710 | } | 710 | } |
diff --git a/OpenSim/Grid/GridServer/Main.cs b/OpenSim/Grid/GridServer/Main.cs index dc5e4fa..09aeab5 100644 --- a/OpenSim/Grid/GridServer/Main.cs +++ b/OpenSim/Grid/GridServer/Main.cs | |||
@@ -1,258 +1,258 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.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.Reflection; | 30 | using System.Reflection; |
31 | using System.Threading; | 31 | using System.Threading; |
32 | using System.Timers; | 32 | using System.Timers; |
33 | using OpenSim.Framework.Console; | 33 | using OpenSim.Framework.Console; |
34 | using OpenSim.Framework.Interfaces; | 34 | using OpenSim.Framework.Interfaces; |
35 | using OpenSim.Framework.Servers; | 35 | using OpenSim.Framework.Servers; |
36 | using OpenSim.GenericConfig; | 36 | using OpenSim.GenericConfig; |
37 | using Timer=System.Timers.Timer; | 37 | using Timer=System.Timers.Timer; |
38 | 38 | ||
39 | namespace OpenSim.Grid.GridServer | 39 | namespace OpenSim.Grid.GridServer |
40 | { | 40 | { |
41 | /// <summary> | 41 | /// <summary> |
42 | /// </summary> | 42 | /// </summary> |
43 | public class OpenGrid_Main : conscmd_callback | 43 | public class OpenGrid_Main : conscmd_callback |
44 | { | 44 | { |
45 | private string ConfigDll = "OpenSim.Grid.GridServer.Config.dll"; | 45 | private string ConfigDll = "OpenSim.Grid.GridServer.Config.dll"; |
46 | private string GridDll = "OpenSim.Framework.Data.MySQL.dll"; | 46 | private string GridDll = "OpenSim.Framework.Data.MySQL.dll"; |
47 | public GridConfig Cfg; | 47 | public GridConfig Cfg; |
48 | 48 | ||
49 | public static OpenGrid_Main thegrid; | 49 | public static OpenGrid_Main thegrid; |
50 | protected IGenericConfig localXMLConfig; | 50 | protected IGenericConfig localXMLConfig; |
51 | 51 | ||
52 | public static bool setuponly; | 52 | public static bool setuponly; |
53 | 53 | ||
54 | //public LLUUID highestUUID; | 54 | //public LLUUID highestUUID; |
55 | 55 | ||
56 | // private SimProfileManager m_simProfileManager; | 56 | // private SimProfileManager m_simProfileManager; |
57 | 57 | ||
58 | private GridManager m_gridManager; | 58 | private GridManager m_gridManager; |
59 | 59 | ||
60 | private LogBase m_console; | 60 | private LogBase m_console; |
61 | 61 | ||
62 | [STAThread] | 62 | [STAThread] |
63 | public static void Main(string[] args) | 63 | public static void Main(string[] args) |
64 | { | 64 | { |
65 | if (args.Length > 0) | 65 | if (args.Length > 0) |
66 | { | 66 | { |
67 | if (args[0] == "-setuponly") setuponly = true; | 67 | if (args[0] == "-setuponly") setuponly = true; |
68 | } | 68 | } |
69 | Console.WriteLine("Starting...\n"); | 69 | Console.WriteLine("Starting...\n"); |
70 | 70 | ||
71 | thegrid = new OpenGrid_Main(); | 71 | thegrid = new OpenGrid_Main(); |
72 | thegrid.Startup(); | 72 | thegrid.Startup(); |
73 | 73 | ||
74 | thegrid.Work(); | 74 | thegrid.Work(); |
75 | } | 75 | } |
76 | 76 | ||
77 | private void Work() | 77 | private void Work() |
78 | { | 78 | { |
79 | m_console.Notice("Enter help for a list of commands\n"); | 79 | m_console.Notice("Enter help for a list of commands\n"); |
80 | 80 | ||
81 | while (true) | 81 | while (true) |
82 | { | 82 | { |
83 | m_console.MainLogPrompt(); | 83 | m_console.MainLogPrompt(); |
84 | } | 84 | } |
85 | } | 85 | } |
86 | 86 | ||
87 | private OpenGrid_Main() | 87 | private OpenGrid_Main() |
88 | { | 88 | { |
89 | m_console = new LogBase("opengrid-gridserver-console.log", "OpenGrid", this, false); | 89 | m_console = new LogBase("opengrid-gridserver-console.log", "OpenGrid", this, false); |
90 | MainLog.Instance = m_console; | 90 | MainLog.Instance = m_console; |
91 | 91 | ||
92 | 92 | ||
93 | } | 93 | } |
94 | 94 | ||
95 | public void managercallback(string cmd) | 95 | public void managercallback(string cmd) |
96 | { | 96 | { |
97 | switch (cmd) | 97 | switch (cmd) |
98 | { | 98 | { |
99 | case "shutdown": | 99 | case "shutdown": |
100 | RunCmd("shutdown", new string[0]); | 100 | RunCmd("shutdown", new string[0]); |
101 | break; | 101 | break; |
102 | } | 102 | } |
103 | } | 103 | } |
104 | 104 | ||
105 | 105 | ||
106 | public void Startup() | 106 | public void Startup() |
107 | { | 107 | { |
108 | this.localXMLConfig = new XmlConfig("GridServerConfig.xml"); | 108 | this.localXMLConfig = new XmlConfig("GridServerConfig.xml"); |
109 | this.localXMLConfig.LoadData(); | 109 | this.localXMLConfig.LoadData(); |
110 | this.ConfigDB(this.localXMLConfig); | 110 | this.ConfigDB(this.localXMLConfig); |
111 | this.localXMLConfig.Close(); | 111 | this.localXMLConfig.Close(); |
112 | 112 | ||
113 | m_console.Verbose( "Main.cs:Startup() - Loading configuration"); | 113 | m_console.Verbose( "Main.cs:Startup() - Loading configuration"); |
114 | Cfg = this.LoadConfigDll(this.ConfigDll); | 114 | Cfg = this.LoadConfigDll(this.ConfigDll); |
115 | Cfg.InitConfig(); | 115 | Cfg.InitConfig(); |
116 | if (setuponly) Environment.Exit(0); | 116 | if (setuponly) Environment.Exit(0); |
117 | 117 | ||
118 | m_console.Verbose( "Main.cs:Startup() - Connecting to Storage Server"); | 118 | m_console.Verbose( "Main.cs:Startup() - Connecting to Storage Server"); |
119 | m_gridManager = new GridManager(); | 119 | m_gridManager = new GridManager(); |
120 | m_gridManager.AddPlugin(GridDll); // Made of win | 120 | m_gridManager.AddPlugin(GridDll); // Made of win |
121 | m_gridManager.config = Cfg; | 121 | m_gridManager.config = Cfg; |
122 | 122 | ||
123 | m_console.Verbose( "Main.cs:Startup() - Starting HTTP process"); | 123 | m_console.Verbose( "Main.cs:Startup() - Starting HTTP process"); |
124 | BaseHttpServer httpServer = new BaseHttpServer(8001); | 124 | BaseHttpServer httpServer = new BaseHttpServer(8001); |
125 | //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", Cfg.SimSendKey, Cfg.SimRecvKey, managercallback); | 125 | //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", Cfg.SimSendKey, Cfg.SimRecvKey, managercallback); |
126 | 126 | ||
127 | httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcSimulatorLoginMethod); | 127 | httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcSimulatorLoginMethod); |
128 | httpServer.AddXmlRPCHandler("simulator_data_request", m_gridManager.XmlRpcSimulatorDataRequestMethod); | 128 | httpServer.AddXmlRPCHandler("simulator_data_request", m_gridManager.XmlRpcSimulatorDataRequestMethod); |
129 | httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod); | 129 | httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod); |
130 | 130 | ||
131 | httpServer.AddStreamHandler(new RestStreamHandler("GET", "/sims/", m_gridManager.RestGetSimMethod )); | 131 | httpServer.AddStreamHandler(new RestStreamHandler("GET", "/sims/", m_gridManager.RestGetSimMethod )); |
132 | httpServer.AddStreamHandler(new RestStreamHandler("POST", "/sims/", m_gridManager.RestSetSimMethod )); | 132 | httpServer.AddStreamHandler(new RestStreamHandler("POST", "/sims/", m_gridManager.RestSetSimMethod )); |
133 | 133 | ||
134 | httpServer.AddStreamHandler( new RestStreamHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod )); | 134 | httpServer.AddStreamHandler( new RestStreamHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod )); |
135 | httpServer.AddStreamHandler( new RestStreamHandler("POST","/regions/", m_gridManager.RestSetRegionMethod )); | 135 | httpServer.AddStreamHandler( new RestStreamHandler("POST","/regions/", m_gridManager.RestSetRegionMethod )); |
136 | 136 | ||
137 | //httpServer.AddRestHandler("GET", "/sims/", m_gridManager.RestGetSimMethod); | 137 | //httpServer.AddRestHandler("GET", "/sims/", m_gridManager.RestGetSimMethod); |
138 | //httpServer.AddRestHandler("POST", "/sims/", m_gridManager.RestSetSimMethod); | 138 | //httpServer.AddRestHandler("POST", "/sims/", m_gridManager.RestSetSimMethod); |
139 | //httpServer.AddRestHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod); | 139 | //httpServer.AddRestHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod); |
140 | //httpServer.AddRestHandler("POST", "/regions/", m_gridManager.RestSetRegionMethod); | 140 | //httpServer.AddRestHandler("POST", "/regions/", m_gridManager.RestSetRegionMethod); |
141 | 141 | ||
142 | httpServer.Start(); | 142 | httpServer.Start(); |
143 | 143 | ||
144 | m_console.Verbose( "Main.cs:Startup() - Starting sim status checker"); | 144 | m_console.Verbose( "Main.cs:Startup() - Starting sim status checker"); |
145 | 145 | ||
146 | Timer simCheckTimer = new Timer(3600000 * 3); // 3 Hours between updates. | 146 | Timer simCheckTimer = new Timer(3600000 * 3); // 3 Hours between updates. |
147 | simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims); | 147 | simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims); |
148 | simCheckTimer.Enabled = true; | 148 | simCheckTimer.Enabled = true; |
149 | } | 149 | } |
150 | 150 | ||
151 | private GridConfig LoadConfigDll(string dllName) | 151 | private GridConfig LoadConfigDll(string dllName) |
152 | { | 152 | { |
153 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | 153 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); |
154 | GridConfig config = null; | 154 | GridConfig config = null; |
155 | 155 | ||
156 | foreach (Type pluginType in pluginAssembly.GetTypes()) | 156 | foreach (Type pluginType in pluginAssembly.GetTypes()) |
157 | { | 157 | { |
158 | if (pluginType.IsPublic) | 158 | if (pluginType.IsPublic) |
159 | { | 159 | { |
160 | if (!pluginType.IsAbstract) | 160 | if (!pluginType.IsAbstract) |
161 | { | 161 | { |
162 | Type typeInterface = pluginType.GetInterface("IGridConfig", true); | 162 | Type typeInterface = pluginType.GetInterface("IGridConfig", true); |
163 | 163 | ||
164 | if (typeInterface != null) | 164 | if (typeInterface != null) |
165 | { | 165 | { |
166 | IGridConfig plug = (IGridConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | 166 | IGridConfig plug = (IGridConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); |
167 | config = plug.GetConfigObject(); | 167 | config = plug.GetConfigObject(); |
168 | break; | 168 | break; |
169 | } | 169 | } |
170 | 170 | ||
171 | typeInterface = null; | 171 | typeInterface = null; |
172 | } | 172 | } |
173 | } | 173 | } |
174 | } | 174 | } |
175 | pluginAssembly = null; | 175 | pluginAssembly = null; |
176 | return config; | 176 | return config; |
177 | } | 177 | } |
178 | 178 | ||
179 | public void CheckSims(object sender, ElapsedEventArgs e) | 179 | public void CheckSims(object sender, ElapsedEventArgs e) |
180 | { | 180 | { |
181 | /* | 181 | /* |
182 | foreach (SimProfileBase sim in m_simProfileManager.SimProfiles.Values) | 182 | foreach (SimProfileBase sim in m_simProfileManager.SimProfiles.Values) |
183 | { | 183 | { |
184 | string SimResponse = ""; | 184 | string SimResponse = ""; |
185 | try | 185 | try |
186 | { | 186 | { |
187 | WebRequest CheckSim = WebRequest.Create("http://" + sim.sim_ip + ":" + sim.sim_port.ToString() + "/checkstatus/"); | 187 | WebRequest CheckSim = WebRequest.Create("http://" + sim.sim_ip + ":" + sim.sim_port.ToString() + "/checkstatus/"); |
188 | CheckSim.Method = "GET"; | 188 | CheckSim.Method = "GET"; |
189 | CheckSim.ContentType = "text/plaintext"; | 189 | CheckSim.ContentType = "text/plaintext"; |
190 | CheckSim.ContentLength = 0; | 190 | CheckSim.ContentLength = 0; |
191 | 191 | ||
192 | StreamWriter stOut = new StreamWriter(CheckSim.GetRequestStream(), System.Text.Encoding.ASCII); | 192 | StreamWriter stOut = new StreamWriter(CheckSim.GetRequestStream(), System.Text.Encoding.ASCII); |
193 | stOut.Write(""); | 193 | stOut.Write(""); |
194 | stOut.Close(); | 194 | stOut.Close(); |
195 | 195 | ||
196 | StreamReader stIn = new StreamReader(CheckSim.GetResponse().GetResponseStream()); | 196 | StreamReader stIn = new StreamReader(CheckSim.GetResponse().GetResponseStream()); |
197 | SimResponse = stIn.ReadToEnd(); | 197 | SimResponse = stIn.ReadToEnd(); |
198 | stIn.Close(); | 198 | stIn.Close(); |
199 | } | 199 | } |
200 | catch | 200 | catch |
201 | { | 201 | { |
202 | } | 202 | } |
203 | 203 | ||
204 | if (SimResponse == "OK") | 204 | if (SimResponse == "OK") |
205 | { | 205 | { |
206 | m_simProfileManager.SimProfiles[sim.UUID].online = true; | 206 | m_simProfileManager.SimProfiles[sim.UUID].online = true; |
207 | } | 207 | } |
208 | else | 208 | else |
209 | { | 209 | { |
210 | m_simProfileManager.SimProfiles[sim.UUID].online = false; | 210 | m_simProfileManager.SimProfiles[sim.UUID].online = false; |
211 | } | 211 | } |
212 | } | 212 | } |
213 | */ | 213 | */ |
214 | } | 214 | } |
215 | 215 | ||
216 | public void RunCmd(string cmd, string[] cmdparams) | 216 | public void RunCmd(string cmd, string[] cmdparams) |
217 | { | 217 | { |
218 | switch (cmd) | 218 | switch (cmd) |
219 | { | 219 | { |
220 | case "help": | 220 | case "help": |
221 | m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); | 221 | m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); |
222 | break; | 222 | break; |
223 | 223 | ||
224 | case "shutdown": | 224 | case "shutdown": |
225 | m_console.Close(); | 225 | m_console.Close(); |
226 | Environment.Exit(0); | 226 | Environment.Exit(0); |
227 | break; | 227 | break; |
228 | } | 228 | } |
229 | } | 229 | } |
230 | 230 | ||
231 | public void Show(string ShowWhat) | 231 | public void Show(string ShowWhat) |
232 | { | 232 | { |
233 | } | 233 | } |
234 | 234 | ||
235 | private void ConfigDB(IGenericConfig configData) | 235 | private void ConfigDB(IGenericConfig configData) |
236 | { | 236 | { |
237 | try | 237 | try |
238 | { | 238 | { |
239 | string attri = ""; | 239 | string attri = ""; |
240 | attri = configData.GetAttribute("DataBaseProvider"); | 240 | attri = configData.GetAttribute("DataBaseProvider"); |
241 | if (attri == "") | 241 | if (attri == "") |
242 | { | 242 | { |
243 | GridDll = "OpenSim.Framework.Data.DB4o.dll"; | 243 | GridDll = "OpenSim.Framework.Data.DB4o.dll"; |
244 | configData.SetAttribute("DataBaseProvider", "OpenSim.Framework.Data.DB4o.dll"); | 244 | configData.SetAttribute("DataBaseProvider", "OpenSim.Framework.Data.DB4o.dll"); |
245 | } | 245 | } |
246 | else | 246 | else |
247 | { | 247 | { |
248 | GridDll = attri; | 248 | GridDll = attri; |
249 | } | 249 | } |
250 | configData.Commit(); | 250 | configData.Commit(); |
251 | } | 251 | } |
252 | catch | 252 | catch |
253 | { | 253 | { |
254 | 254 | ||
255 | } | 255 | } |
256 | } | 256 | } |
257 | } | 257 | } |
258 | } | 258 | } |
diff --git a/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs index 62a68a8..1eeac93 100644 --- a/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs +++ b/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs | |||
@@ -1,58 +1,58 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.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 | using System.Reflection; | 28 | using System.Reflection; |
29 | using System.Runtime.InteropServices; | 29 | using System.Runtime.InteropServices; |
30 | // General Information about an assembly is controlled through the following | 30 | // General Information about an assembly is controlled through the following |
31 | // set of attributes. Change these attribute values to modify the information | 31 | // set of attributes. Change these attribute values to modify the information |
32 | // associated with an assembly. | 32 | // associated with an assembly. |
33 | [assembly: AssemblyTitle("OGS-GridServer")] | 33 | [assembly: AssemblyTitle("OGS-GridServer")] |
34 | [assembly: AssemblyDescription("")] | 34 | [assembly: AssemblyDescription("")] |
35 | [assembly: AssemblyConfiguration("")] | 35 | [assembly: AssemblyConfiguration("")] |
36 | [assembly: AssemblyCompany("")] | 36 | [assembly: AssemblyCompany("")] |
37 | [assembly: AssemblyProduct("OGS-GridServer")] | 37 | [assembly: AssemblyProduct("OGS-GridServer")] |
38 | [assembly: AssemblyCopyright("Copyright © 2007")] | 38 | [assembly: AssemblyCopyright("Copyright © 2007")] |
39 | [assembly: AssemblyTrademark("")] | 39 | [assembly: AssemblyTrademark("")] |
40 | [assembly: AssemblyCulture("")] | 40 | [assembly: AssemblyCulture("")] |
41 | 41 | ||
42 | // Setting ComVisible to false makes the types in this assembly not visible | 42 | // Setting ComVisible to false makes the types in this assembly not visible |
43 | // to COM components. If you need to access a type in this assembly from | 43 | // to COM components. If you need to access a type in this assembly from |
44 | // COM, set the ComVisible attribute to true on that type. | 44 | // COM, set the ComVisible attribute to true on that type. |
45 | [assembly: ComVisible(false)] | 45 | [assembly: ComVisible(false)] |
46 | 46 | ||
47 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 47 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
48 | [assembly: Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")] | 48 | [assembly: Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")] |
49 | 49 | ||
50 | // Version information for an assembly consists of the following four values: | 50 | // Version information for an assembly consists of the following four values: |
51 | // | 51 | // |
52 | // Major Version | 52 | // Major Version |
53 | // Minor Version | 53 | // Minor Version |
54 | // Build Number | 54 | // Build Number |
55 | // Revision | 55 | // Revision |
56 | // | 56 | // |
57 | [assembly: AssemblyVersion("1.0.0.0")] | 57 | [assembly: AssemblyVersion("1.0.0.0")] |
58 | [assembly: AssemblyFileVersion("1.0.0.0")] | 58 | [assembly: AssemblyFileVersion("1.0.0.0")] |
diff --git a/OpenSim/Grid/InventoryServer/InventoryManager.cs b/OpenSim/Grid/InventoryServer/InventoryManager.cs index 9ca9b5e..0685088 100644 --- a/OpenSim/Grid/InventoryServer/InventoryManager.cs +++ b/OpenSim/Grid/InventoryServer/InventoryManager.cs | |||
@@ -1,125 +1,125 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.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 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Text; | 31 | using System.Text; |
32 | using OpenGrid.Framework.Data; | 32 | using OpenGrid.Framework.Data; |
33 | using libsecondlife; | 33 | using libsecondlife; |
34 | using System.Reflection; | 34 | using System.Reflection; |
35 | 35 | ||
36 | using System.Xml; | 36 | using System.Xml; |
37 | using Nwc.XmlRpc; | 37 | using Nwc.XmlRpc; |
38 | using OpenSim.Framework.Sims; | 38 | using OpenSim.Framework.Sims; |
39 | using OpenSim.Framework.Inventory; | 39 | using OpenSim.Framework.Inventory; |
40 | using OpenSim.Framework.Utilities; | 40 | using OpenSim.Framework.Utilities; |
41 | 41 | ||
42 | using System.Security.Cryptography; | 42 | using System.Security.Cryptography; |
43 | 43 | ||
44 | namespace OpenGridServices.InventoryServer | 44 | namespace OpenGridServices.InventoryServer |
45 | { | 45 | { |
46 | class InventoryManager | 46 | class InventoryManager |
47 | { | 47 | { |
48 | Dictionary<string, IInventoryData> _plugins = new Dictionary<string, IInventoryData>(); | 48 | Dictionary<string, IInventoryData> _plugins = new Dictionary<string, IInventoryData>(); |
49 | 49 | ||
50 | /// <summary> | 50 | /// <summary> |
51 | /// Adds a new inventory server plugin - user servers will be requested in the order they were loaded. | 51 | /// Adds a new inventory server plugin - user servers will be requested in the order they were loaded. |
52 | /// </summary> | 52 | /// </summary> |
53 | /// <param name="FileName">The filename to the inventory server plugin DLL</param> | 53 | /// <param name="FileName">The filename to the inventory server plugin DLL</param> |
54 | public void AddPlugin(string FileName) | 54 | public void AddPlugin(string FileName) |
55 | { | 55 | { |
56 | OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Attempting to load " + FileName); | 56 | OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Attempting to load " + FileName); |
57 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); | 57 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); |
58 | 58 | ||
59 | OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); | 59 | OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); |
60 | foreach (Type pluginType in pluginAssembly.GetTypes()) | 60 | foreach (Type pluginType in pluginAssembly.GetTypes()) |
61 | { | 61 | { |
62 | if (!pluginType.IsAbstract) | 62 | if (!pluginType.IsAbstract) |
63 | { | 63 | { |
64 | Type typeInterface = pluginType.GetInterface("IInventoryData", true); | 64 | Type typeInterface = pluginType.GetInterface("IInventoryData", true); |
65 | 65 | ||
66 | if (typeInterface != null) | 66 | if (typeInterface != null) |
67 | { | 67 | { |
68 | IInventoryData plug = (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | 68 | IInventoryData plug = (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); |
69 | plug.Initialise(); | 69 | plug.Initialise(); |
70 | this._plugins.Add(plug.getName(), plug); | 70 | this._plugins.Add(plug.getName(), plug); |
71 | OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Added IUserData Interface"); | 71 | OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Added IUserData Interface"); |
72 | } | 72 | } |
73 | 73 | ||
74 | typeInterface = null; | 74 | typeInterface = null; |
75 | } | 75 | } |
76 | } | 76 | } |
77 | 77 | ||
78 | pluginAssembly = null; | 78 | pluginAssembly = null; |
79 | } | 79 | } |
80 | 80 | ||
81 | public List<InventoryFolderBase> getRootFolders(LLUUID user) | 81 | public List<InventoryFolderBase> getRootFolders(LLUUID user) |
82 | { | 82 | { |
83 | foreach (KeyValuePair<string, IInventoryData> kvp in _plugins) | 83 | foreach (KeyValuePair<string, IInventoryData> kvp in _plugins) |
84 | { | 84 | { |
85 | try | 85 | try |
86 | { | 86 | { |
87 | return kvp.Value.getUserRootFolders(user); | 87 | return kvp.Value.getUserRootFolders(user); |
88 | } | 88 | } |
89 | catch (Exception e) | 89 | catch (Exception e) |
90 | { | 90 | { |
91 | OpenSim.Framework.Console.MainConsole.Instance.Notice("Unable to get root folders via " + kvp.Key + " (" + e.ToString() + ")"); | 91 | OpenSim.Framework.Console.MainConsole.Instance.Notice("Unable to get root folders via " + kvp.Key + " (" + e.ToString() + ")"); |
92 | } | 92 | } |
93 | } | 93 | } |
94 | return null; | 94 | return null; |
95 | } | 95 | } |
96 | 96 | ||
97 | public XmlRpcResponse XmlRpcInventoryRequest(XmlRpcRequest request) | 97 | public XmlRpcResponse XmlRpcInventoryRequest(XmlRpcRequest request) |
98 | { | 98 | { |
99 | XmlRpcResponse response = new XmlRpcResponse(); | 99 | XmlRpcResponse response = new XmlRpcResponse(); |
100 | Hashtable requestData = (Hashtable)request.Params[0]; | 100 | Hashtable requestData = (Hashtable)request.Params[0]; |
101 | 101 | ||
102 | Hashtable responseData = new Hashtable(); | 102 | Hashtable responseData = new Hashtable(); |
103 | 103 | ||
104 | // Stuff happens here | 104 | // Stuff happens here |
105 | 105 | ||
106 | if (requestData.ContainsKey("Access-type")) | 106 | if (requestData.ContainsKey("Access-type")) |
107 | { | 107 | { |
108 | if (requestData["access-type"] == "rootfolders") | 108 | if (requestData["access-type"] == "rootfolders") |
109 | { | 109 | { |
110 | // responseData["rootfolders"] = | 110 | // responseData["rootfolders"] = |
111 | } | 111 | } |
112 | } | 112 | } |
113 | else | 113 | else |
114 | { | 114 | { |
115 | responseData["error"] = "No access-type specified."; | 115 | responseData["error"] = "No access-type specified."; |
116 | } | 116 | } |
117 | 117 | ||
118 | 118 | ||
119 | // Stuff stops happening here | 119 | // Stuff stops happening here |
120 | 120 | ||
121 | response.Value = responseData; | 121 | response.Value = responseData; |
122 | return response; | 122 | return response; |
123 | } | 123 | } |
124 | } | 124 | } |
125 | } | 125 | } |
diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs index f479a79..e1276a9 100644 --- a/OpenSim/Grid/InventoryServer/Main.cs +++ b/OpenSim/Grid/InventoryServer/Main.cs | |||
@@ -1,87 +1,87 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.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 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.IO; | 32 | using System.IO; |
33 | using System.Text; | 33 | using System.Text; |
34 | using libsecondlife; | 34 | using libsecondlife; |
35 | using OpenSim.Framework.User; | 35 | using OpenSim.Framework.User; |
36 | using OpenSim.Framework.Sims; | 36 | using OpenSim.Framework.Sims; |
37 | using OpenSim.Framework.Inventory; | 37 | using OpenSim.Framework.Inventory; |
38 | using OpenSim.Framework.Interfaces; | 38 | using OpenSim.Framework.Interfaces; |
39 | using OpenSim.Framework.Console; | 39 | using OpenSim.Framework.Console; |
40 | using OpenSim.Servers; | 40 | using OpenSim.Servers; |
41 | using OpenSim.Framework.Utilities; | 41 | using OpenSim.Framework.Utilities; |
42 | 42 | ||
43 | namespace OpenGridServices.InventoryServer | 43 | namespace OpenGridServices.InventoryServer |
44 | { | 44 | { |
45 | public class OpenInventory_Main : BaseServer, conscmd_callback | 45 | public class OpenInventory_Main : BaseServer, conscmd_callback |
46 | { | 46 | { |
47 | ConsoleBase m_console; | 47 | ConsoleBase m_console; |
48 | InventoryManager m_inventoryManager; | 48 | InventoryManager m_inventoryManager; |
49 | 49 | ||
50 | public static void Main(string[] args) | 50 | public static void Main(string[] args) |
51 | { | 51 | { |
52 | } | 52 | } |
53 | 53 | ||
54 | public OpenInventory_Main() | 54 | public OpenInventory_Main() |
55 | { | 55 | { |
56 | m_console = new ConsoleBase("opengrid-inventory-console.log", "OpenInventory", this, false); | 56 | m_console = new ConsoleBase("opengrid-inventory-console.log", "OpenInventory", this, false); |
57 | MainConsole.Instance = m_console; | 57 | MainConsole.Instance = m_console; |
58 | } | 58 | } |
59 | 59 | ||
60 | public void Startup() | 60 | public void Startup() |
61 | { | 61 | { |
62 | MainConsole.Instance.Notice("Initialising inventory manager..."); | 62 | MainConsole.Instance.Notice("Initialising inventory manager..."); |
63 | m_inventoryManager = new InventoryManager(); | 63 | m_inventoryManager = new InventoryManager(); |
64 | 64 | ||
65 | MainConsole.Instance.Notice("Starting HTTP server"); | 65 | MainConsole.Instance.Notice("Starting HTTP server"); |
66 | BaseHttpServer httpServer = new BaseHttpServer(8004); | 66 | BaseHttpServer httpServer = new BaseHttpServer(8004); |
67 | 67 | ||
68 | httpServer.AddXmlRPCHandler("rootfolders", m_inventoryManager.XmlRpcInventoryRequest); | 68 | httpServer.AddXmlRPCHandler("rootfolders", m_inventoryManager.XmlRpcInventoryRequest); |
69 | //httpServer.AddRestHandler("GET","/rootfolders/",Rest | 69 | //httpServer.AddRestHandler("GET","/rootfolders/",Rest |
70 | } | 70 | } |
71 | 71 | ||
72 | public void RunCmd(string cmd, string[] cmdparams) | 72 | public void RunCmd(string cmd, string[] cmdparams) |
73 | { | 73 | { |
74 | switch (cmd) | 74 | switch (cmd) |
75 | { | 75 | { |
76 | case "shutdown": | 76 | case "shutdown": |
77 | m_console.Close(); | 77 | m_console.Close(); |
78 | Environment.Exit(0); | 78 | Environment.Exit(0); |
79 | break; | 79 | break; |
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
83 | public void Show(string ShowWhat) | 83 | public void Show(string ShowWhat) |
84 | { | 84 | { |
85 | } | 85 | } |
86 | } | 86 | } |
87 | } | 87 | } |
diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/BlockingQueue.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/BlockingQueue.cs index 83685fc..be47385 100644 --- a/OpenSim/Grid/Manager/OpenGridServices.Manager/BlockingQueue.cs +++ b/OpenSim/Grid/Manager/OpenGridServices.Manager/BlockingQueue.cs | |||
@@ -1,33 +1,33 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Threading; | 2 | using System.Threading; |
3 | using System.Collections.Generic; | 3 | using System.Collections.Generic; |
4 | using System.Text; | 4 | using System.Text; |
5 | 5 | ||
6 | namespace OpenGridServices.Manager | 6 | namespace OpenGridServices.Manager |
7 | { | 7 | { |
8 | public class BlockingQueue<T> | 8 | public class BlockingQueue<T> |
9 | { | 9 | { |
10 | private Queue<T> _queue = new Queue<T>(); | 10 | private Queue<T> _queue = new Queue<T>(); |
11 | private object _queueSync = new object(); | 11 | private object _queueSync = new object(); |
12 | 12 | ||
13 | public void Enqueue(T value) | 13 | public void Enqueue(T value) |
14 | { | 14 | { |
15 | lock (_queueSync) | 15 | lock (_queueSync) |
16 | { | 16 | { |
17 | _queue.Enqueue(value); | 17 | _queue.Enqueue(value); |
18 | Monitor.Pulse(_queueSync); | 18 | Monitor.Pulse(_queueSync); |
19 | } | 19 | } |
20 | } | 20 | } |
21 | 21 | ||
22 | public T Dequeue() | 22 | public T Dequeue() |
23 | { | 23 | { |
24 | lock (_queueSync) | 24 | lock (_queueSync) |
25 | { | 25 | { |
26 | if (_queue.Count < 1) | 26 | if (_queue.Count < 1) |
27 | Monitor.Wait(_queueSync); | 27 | Monitor.Wait(_queueSync); |
28 | 28 | ||
29 | return _queue.Dequeue(); | 29 | return _queue.Dequeue(); |
30 | } | 30 | } |
31 | } | 31 | } |
32 | } | 32 | } |
33 | } | 33 | } |
diff --git a/OpenSim/Grid/Manager/OpenGridServices.Manager/Util.cs b/OpenSim/Grid/Manager/OpenGridServices.Manager/Util.cs index 5bf7ff9..5646be4 100644 --- a/OpenSim/Grid/Manager/OpenGridServices.Manager/Util.cs +++ b/OpenSim/Grid/Manager/OpenGridServices.Manager/Util.cs | |||
@@ -1,133 +1,133 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | using libsecondlife.Packets; | 5 | using libsecondlife.Packets; |
6 | 6 | ||
7 | namespace OpenSim.Framework.Utilities | 7 | namespace OpenSim.Framework.Utilities |
8 | { | 8 | { |
9 | public class Util | 9 | public class Util |
10 | { | 10 | { |
11 | private static Random randomClass = new Random(); | 11 | private static Random randomClass = new Random(); |
12 | private static uint nextXferID = 5000; | 12 | private static uint nextXferID = 5000; |
13 | private static object XferLock = new object(); | 13 | private static object XferLock = new object(); |
14 | 14 | ||
15 | public static ulong UIntsToLong(uint X, uint Y) | 15 | public static ulong UIntsToLong(uint X, uint Y) |
16 | { | 16 | { |
17 | return Helpers.UIntsToLong(X, Y); | 17 | return Helpers.UIntsToLong(X, Y); |
18 | } | 18 | } |
19 | 19 | ||
20 | public static Random RandomClass | 20 | public static Random RandomClass |
21 | { | 21 | { |
22 | get | 22 | get |
23 | { | 23 | { |
24 | return randomClass; | 24 | return randomClass; |
25 | } | 25 | } |
26 | } | 26 | } |
27 | 27 | ||
28 | public static uint GetNextXferID() | 28 | public static uint GetNextXferID() |
29 | { | 29 | { |
30 | uint id = 0; | 30 | uint id = 0; |
31 | lock(XferLock) | 31 | lock(XferLock) |
32 | { | 32 | { |
33 | id = nextXferID; | 33 | id = nextXferID; |
34 | nextXferID++; | 34 | nextXferID++; |
35 | } | 35 | } |
36 | return id; | 36 | return id; |
37 | } | 37 | } |
38 | 38 | ||
39 | //public static int fast_distance2d(int x, int y) | 39 | //public static int fast_distance2d(int x, int y) |
40 | //{ | 40 | //{ |
41 | // x = System.Math.Abs(x); | 41 | // x = System.Math.Abs(x); |
42 | // y = System.Math.Abs(y); | 42 | // y = System.Math.Abs(y); |
43 | 43 | ||
44 | // int min = System.Math.Min(x, y); | 44 | // int min = System.Math.Min(x, y); |
45 | 45 | ||
46 | // return (x + y - (min >> 1) - (min >> 2) + (min >> 4)); | 46 | // return (x + y - (min >> 1) - (min >> 2) + (min >> 4)); |
47 | //} | 47 | //} |
48 | 48 | ||
49 | public static string FieldToString(byte[] bytes) | 49 | public static string FieldToString(byte[] bytes) |
50 | { | 50 | { |
51 | return FieldToString(bytes, String.Empty); | 51 | return FieldToString(bytes, String.Empty); |
52 | } | 52 | } |
53 | 53 | ||
54 | /// <summary> | 54 | /// <summary> |
55 | /// Convert a variable length field (byte array) to a string, with a | 55 | /// Convert a variable length field (byte array) to a string, with a |
56 | /// field name prepended to each line of the output | 56 | /// field name prepended to each line of the output |
57 | /// </summary> | 57 | /// </summary> |
58 | /// <remarks>If the byte array has unprintable characters in it, a | 58 | /// <remarks>If the byte array has unprintable characters in it, a |
59 | /// hex dump will be put in the string instead</remarks> | 59 | /// hex dump will be put in the string instead</remarks> |
60 | /// <param name="bytes">The byte array to convert to a string</param> | 60 | /// <param name="bytes">The byte array to convert to a string</param> |
61 | /// <param name="fieldName">A field name to prepend to each line of output</param> | 61 | /// <param name="fieldName">A field name to prepend to each line of output</param> |
62 | /// <returns>An ASCII string or a string containing a hex dump, minus | 62 | /// <returns>An ASCII string or a string containing a hex dump, minus |
63 | /// the null terminator</returns> | 63 | /// the null terminator</returns> |
64 | public static string FieldToString(byte[] bytes, string fieldName) | 64 | public static string FieldToString(byte[] bytes, string fieldName) |
65 | { | 65 | { |
66 | // Check for a common case | 66 | // Check for a common case |
67 | if (bytes.Length == 0) return String.Empty; | 67 | if (bytes.Length == 0) return String.Empty; |
68 | 68 | ||
69 | StringBuilder output = new StringBuilder(); | 69 | StringBuilder output = new StringBuilder(); |
70 | bool printable = true; | 70 | bool printable = true; |
71 | 71 | ||
72 | for (int i = 0; i < bytes.Length; ++i) | 72 | for (int i = 0; i < bytes.Length; ++i) |
73 | { | 73 | { |
74 | // Check if there are any unprintable characters in the array | 74 | // Check if there are any unprintable characters in the array |
75 | if ((bytes[i] < 0x20 || bytes[i] > 0x7E) && bytes[i] != 0x09 | 75 | if ((bytes[i] < 0x20 || bytes[i] > 0x7E) && bytes[i] != 0x09 |
76 | && bytes[i] != 0x0D && bytes[i] != 0x0A && bytes[i] != 0x00) | 76 | && bytes[i] != 0x0D && bytes[i] != 0x0A && bytes[i] != 0x00) |
77 | { | 77 | { |
78 | printable = false; | 78 | printable = false; |
79 | break; | 79 | break; |
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
83 | if (printable) | 83 | if (printable) |
84 | { | 84 | { |
85 | if (fieldName.Length > 0) | 85 | if (fieldName.Length > 0) |
86 | { | 86 | { |
87 | output.Append(fieldName); | 87 | output.Append(fieldName); |
88 | output.Append(": "); | 88 | output.Append(": "); |
89 | } | 89 | } |
90 | 90 | ||
91 | if (bytes[bytes.Length - 1] == 0x00) | 91 | if (bytes[bytes.Length - 1] == 0x00) |
92 | output.Append(UTF8Encoding.UTF8.GetString(bytes, 0, bytes.Length - 1)); | 92 | output.Append(UTF8Encoding.UTF8.GetString(bytes, 0, bytes.Length - 1)); |
93 | else | 93 | else |
94 | output.Append(UTF8Encoding.UTF8.GetString(bytes)); | 94 | output.Append(UTF8Encoding.UTF8.GetString(bytes)); |
95 | } | 95 | } |
96 | else | 96 | else |
97 | { | 97 | { |
98 | for (int i = 0; i < bytes.Length; i += 16) | 98 | for (int i = 0; i < bytes.Length; i += 16) |
99 | { | 99 | { |
100 | if (i != 0) | 100 | if (i != 0) |
101 | output.Append(Environment.NewLine); | 101 | output.Append(Environment.NewLine); |
102 | if (fieldName.Length > 0) | 102 | if (fieldName.Length > 0) |
103 | { | 103 | { |
104 | output.Append(fieldName); | 104 | output.Append(fieldName); |
105 | output.Append(": "); | 105 | output.Append(": "); |
106 | } | 106 | } |
107 | 107 | ||
108 | for (int j = 0; j < 16; j++) | 108 | for (int j = 0; j < 16; j++) |
109 | { | 109 | { |
110 | if ((i + j) < bytes.Length) | 110 | if ((i + j) < bytes.Length) |
111 | output.Append(String.Format("{0:X2} ", bytes[i + j])); | 111 | output.Append(String.Format("{0:X2} ", bytes[i + j])); |
112 | else | 112 | else |
113 | output.Append(" "); | 113 | output.Append(" "); |
114 | } | 114 | } |
115 | 115 | ||
116 | for (int j = 0; j < 16 && (i + j) < bytes.Length; j++) | 116 | for (int j = 0; j < 16 && (i + j) < bytes.Length; j++) |
117 | { | 117 | { |
118 | if (bytes[i + j] >= 0x20 && bytes[i + j] < 0x7E) | 118 | if (bytes[i + j] >= 0x20 && bytes[i + j] < 0x7E) |
119 | output.Append((char)bytes[i + j]); | 119 | output.Append((char)bytes[i + j]); |
120 | else | 120 | else |
121 | output.Append("."); | 121 | output.Append("."); |
122 | } | 122 | } |
123 | } | 123 | } |
124 | } | 124 | } |
125 | 125 | ||
126 | return output.ToString(); | 126 | return output.ToString(); |
127 | } | 127 | } |
128 | public Util() | 128 | public Util() |
129 | { | 129 | { |
130 | 130 | ||
131 | } | 131 | } |
132 | } | 132 | } |
133 | } | 133 | } |
diff --git a/OpenSim/Grid/UserServer.Config/AssemblyInfo.cs b/OpenSim/Grid/UserServer.Config/AssemblyInfo.cs index 15298e8..885bada 100644 --- a/OpenSim/Grid/UserServer.Config/AssemblyInfo.cs +++ b/OpenSim/Grid/UserServer.Config/AssemblyInfo.cs | |||
@@ -1,56 +1,56 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.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 | using System.Reflection; | 28 | using System.Reflection; |
29 | using System.Runtime.InteropServices; | 29 | using System.Runtime.InteropServices; |
30 | // Information about this assembly is defined by the following | 30 | // Information about this assembly is defined by the following |
31 | // attributes. | 31 | // attributes. |
32 | // | 32 | // |
33 | // change them to the information which is associated with the assembly | 33 | // change them to the information which is associated with the assembly |
34 | // you compile. | 34 | // you compile. |
35 | 35 | ||
36 | [assembly: AssemblyTitle("UserConfig")] | 36 | [assembly: AssemblyTitle("UserConfig")] |
37 | [assembly: AssemblyDescription("")] | 37 | [assembly: AssemblyDescription("")] |
38 | [assembly: AssemblyConfiguration("")] | 38 | [assembly: AssemblyConfiguration("")] |
39 | [assembly: AssemblyCompany("")] | 39 | [assembly: AssemblyCompany("")] |
40 | [assembly: AssemblyProduct("UserConfig")] | 40 | [assembly: AssemblyProduct("UserConfig")] |
41 | [assembly: AssemblyCopyright("")] | 41 | [assembly: AssemblyCopyright("")] |
42 | [assembly: AssemblyTrademark("")] | 42 | [assembly: AssemblyTrademark("")] |
43 | [assembly: AssemblyCulture("")] | 43 | [assembly: AssemblyCulture("")] |
44 | 44 | ||
45 | // This sets the default COM visibility of types in the assembly to invisible. | 45 | // This sets the default COM visibility of types in the assembly to invisible. |
46 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. | 46 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. |
47 | [assembly: ComVisible(false)] | 47 | [assembly: ComVisible(false)] |
48 | 48 | ||
49 | // The assembly version has following format : | 49 | // The assembly version has following format : |
50 | // | 50 | // |
51 | // Major.Minor.Build.Revision | 51 | // Major.Minor.Build.Revision |
52 | // | 52 | // |
53 | // You can specify all values by your own or you can build default build and revision | 53 | // You can specify all values by your own or you can build default build and revision |
54 | // numbers with the '*' character (the default): | 54 | // numbers with the '*' character (the default): |
55 | 55 | ||
56 | [assembly: AssemblyVersion("1.0.*")] | 56 | [assembly: AssemblyVersion("1.0.*")] |
diff --git a/OpenSim/Grid/UserServer.Config/DbUserConfig.cs b/OpenSim/Grid/UserServer.Config/DbUserConfig.cs index c7f8255..170f34b 100644 --- a/OpenSim/Grid/UserServer.Config/DbUserConfig.cs +++ b/OpenSim/Grid/UserServer.Config/DbUserConfig.cs | |||
@@ -1,95 +1,95 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.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 | using System; | 28 | using System; |
29 | using Db4objects.Db4o; | 29 | using Db4objects.Db4o; |
30 | using OpenSim.Framework.Console; | 30 | using OpenSim.Framework.Console; |
31 | using OpenSim.Framework.Interfaces; | 31 | using OpenSim.Framework.Interfaces; |
32 | 32 | ||
33 | namespace OpenUser.Config.UserConfigDb4o | 33 | namespace OpenUser.Config.UserConfigDb4o |
34 | { | 34 | { |
35 | public class Db4oConfigPlugin: IUserConfig | 35 | public class Db4oConfigPlugin: IUserConfig |
36 | { | 36 | { |
37 | public UserConfig GetConfigObject() | 37 | public UserConfig GetConfigObject() |
38 | { | 38 | { |
39 | MainLog.Instance.Verbose("Loading Db40Config dll"); | 39 | MainLog.Instance.Verbose("Loading Db40Config dll"); |
40 | return ( new DbUserConfig()); | 40 | return ( new DbUserConfig()); |
41 | } | 41 | } |
42 | } | 42 | } |
43 | 43 | ||
44 | public class DbUserConfig : UserConfig | 44 | public class DbUserConfig : UserConfig |
45 | { | 45 | { |
46 | private IObjectContainer db; | 46 | private IObjectContainer db; |
47 | 47 | ||
48 | public void LoadDefaults() { | 48 | public void LoadDefaults() { |
49 | MainLog.Instance.Notice("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings"); | 49 | MainLog.Instance.Notice("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings"); |
50 | 50 | ||
51 | this.DefaultStartupMsg = MainLog.Instance.CmdPrompt("Default startup message", "Welcome to OGS"); | 51 | this.DefaultStartupMsg = MainLog.Instance.CmdPrompt("Default startup message", "Welcome to OGS"); |
52 | 52 | ||
53 | this.GridServerURL = MainLog.Instance.CmdPrompt("Grid server URL","http://127.0.0.1:8001/"); | 53 | this.GridServerURL = MainLog.Instance.CmdPrompt("Grid server URL","http://127.0.0.1:8001/"); |
54 | this.GridSendKey = MainLog.Instance.CmdPrompt("Key to send to grid server","null"); | 54 | this.GridSendKey = MainLog.Instance.CmdPrompt("Key to send to grid server","null"); |
55 | this.GridRecvKey = MainLog.Instance.CmdPrompt("Key to expect from grid server","null"); | 55 | this.GridRecvKey = MainLog.Instance.CmdPrompt("Key to expect from grid server","null"); |
56 | } | 56 | } |
57 | 57 | ||
58 | public override void InitConfig() { | 58 | public override void InitConfig() { |
59 | try { | 59 | try { |
60 | db = Db4oFactory.OpenFile("openuser.yap"); | 60 | db = Db4oFactory.OpenFile("openuser.yap"); |
61 | IObjectSet result = db.Get(typeof(DbUserConfig)); | 61 | IObjectSet result = db.Get(typeof(DbUserConfig)); |
62 | if(result.Count==1) { | 62 | if(result.Count==1) { |
63 | MainLog.Instance.Verbose("Config.cs:InitConfig() - Found a UserConfig object in the local database, loading"); | 63 | MainLog.Instance.Verbose("Config.cs:InitConfig() - Found a UserConfig object in the local database, loading"); |
64 | foreach (DbUserConfig cfg in result) { | 64 | foreach (DbUserConfig cfg in result) { |
65 | this.GridServerURL=cfg.GridServerURL; | 65 | this.GridServerURL=cfg.GridServerURL; |
66 | this.GridSendKey=cfg.GridSendKey; | 66 | this.GridSendKey=cfg.GridSendKey; |
67 | this.GridRecvKey=cfg.GridRecvKey; | 67 | this.GridRecvKey=cfg.GridRecvKey; |
68 | this.DefaultStartupMsg=cfg.DefaultStartupMsg; | 68 | this.DefaultStartupMsg=cfg.DefaultStartupMsg; |
69 | } | 69 | } |
70 | } else { | 70 | } else { |
71 | MainLog.Instance.Verbose("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults"); | 71 | MainLog.Instance.Verbose("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults"); |
72 | LoadDefaults(); | 72 | LoadDefaults(); |
73 | MainLog.Instance.Verbose("Writing out default settings to local database"); | 73 | MainLog.Instance.Verbose("Writing out default settings to local database"); |
74 | db.Set(this); | 74 | db.Set(this); |
75 | db.Close(); | 75 | db.Close(); |
76 | } | 76 | } |
77 | } catch(Exception e) { | 77 | } catch(Exception e) { |
78 | MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured"); | 78 | MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured"); |
79 | MainLog.Instance.Warn(e.ToString()); | 79 | MainLog.Instance.Warn(e.ToString()); |
80 | } | 80 | } |
81 | 81 | ||
82 | MainLog.Instance.Verbose("User settings loaded:"); | 82 | MainLog.Instance.Verbose("User settings loaded:"); |
83 | MainLog.Instance.Verbose("Default startup message: " + this.DefaultStartupMsg); | 83 | MainLog.Instance.Verbose("Default startup message: " + this.DefaultStartupMsg); |
84 | MainLog.Instance.Verbose("Grid server URL: " + this.GridServerURL); | 84 | MainLog.Instance.Verbose("Grid server URL: " + this.GridServerURL); |
85 | MainLog.Instance.Verbose("Key to send to grid: " + this.GridSendKey); | 85 | MainLog.Instance.Verbose("Key to send to grid: " + this.GridSendKey); |
86 | MainLog.Instance.Verbose("Key to expect from grid: " + this.GridRecvKey); | 86 | MainLog.Instance.Verbose("Key to expect from grid: " + this.GridRecvKey); |
87 | } | 87 | } |
88 | 88 | ||
89 | 89 | ||
90 | public void Shutdown() { | 90 | public void Shutdown() { |
91 | db.Close(); | 91 | db.Close(); |
92 | } | 92 | } |
93 | } | 93 | } |
94 | 94 | ||
95 | } | 95 | } |
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index c792918..9bdf8d7 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs | |||
@@ -1,214 +1,214 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.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.Reflection; | 31 | using System.Reflection; |
32 | using libsecondlife; | 32 | using libsecondlife; |
33 | using OpenSim.Framework.Console; | 33 | using OpenSim.Framework.Console; |
34 | using OpenSim.Framework.Interfaces; | 34 | using OpenSim.Framework.Interfaces; |
35 | using OpenSim.Framework.Servers; | 35 | using OpenSim.Framework.Servers; |
36 | using OpenSim.Framework.User; | 36 | using OpenSim.Framework.User; |
37 | using OpenSim.Framework.Utilities; | 37 | using OpenSim.Framework.Utilities; |
38 | using OpenSim.GenericConfig; | 38 | using OpenSim.GenericConfig; |
39 | 39 | ||
40 | namespace OpenSim.Grid.UserServer | 40 | namespace OpenSim.Grid.UserServer |
41 | { | 41 | { |
42 | /// <summary> | 42 | /// <summary> |
43 | /// </summary> | 43 | /// </summary> |
44 | public class OpenUser_Main : conscmd_callback | 44 | public class OpenUser_Main : conscmd_callback |
45 | { | 45 | { |
46 | private string ConfigDll = "OpenSim.Grid.UserServer.Config.dll"; | 46 | private string ConfigDll = "OpenSim.Grid.UserServer.Config.dll"; |
47 | private string StorageDll = "OpenSim.Framework.Data.MySQL.dll"; | 47 | private string StorageDll = "OpenSim.Framework.Data.MySQL.dll"; |
48 | private UserConfig Cfg; | 48 | private UserConfig Cfg; |
49 | protected IGenericConfig localXMLConfig; | 49 | protected IGenericConfig localXMLConfig; |
50 | 50 | ||
51 | public UserManager m_userManager; | 51 | public UserManager m_userManager; |
52 | 52 | ||
53 | public Dictionary<LLUUID, UserProfile> UserSessions = new Dictionary<LLUUID, UserProfile>(); | 53 | public Dictionary<LLUUID, UserProfile> UserSessions = new Dictionary<LLUUID, UserProfile>(); |
54 | 54 | ||
55 | LogBase m_console; | 55 | LogBase m_console; |
56 | 56 | ||
57 | [STAThread] | 57 | [STAThread] |
58 | public static void Main(string[] args) | 58 | public static void Main(string[] args) |
59 | { | 59 | { |
60 | Console.WriteLine("Launching UserServer..."); | 60 | Console.WriteLine("Launching UserServer..."); |
61 | 61 | ||
62 | OpenUser_Main userserver = new OpenUser_Main(); | 62 | OpenUser_Main userserver = new OpenUser_Main(); |
63 | 63 | ||
64 | userserver.Startup(); | 64 | userserver.Startup(); |
65 | userserver.Work(); | 65 | userserver.Work(); |
66 | } | 66 | } |
67 | 67 | ||
68 | private OpenUser_Main() | 68 | private OpenUser_Main() |
69 | { | 69 | { |
70 | m_console = new LogBase("opengrid-userserver-console.log", "OpenUser", this , false); | 70 | m_console = new LogBase("opengrid-userserver-console.log", "OpenUser", this , false); |
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 | this.localXMLConfig = new XmlConfig("UserServerConfig.xml"); | 86 | this.localXMLConfig = new XmlConfig("UserServerConfig.xml"); |
87 | this.localXMLConfig.LoadData(); | 87 | this.localXMLConfig.LoadData(); |
88 | this.ConfigDB(this.localXMLConfig); | 88 | this.ConfigDB(this.localXMLConfig); |
89 | this.localXMLConfig.Close(); | 89 | this.localXMLConfig.Close(); |
90 | 90 | ||
91 | MainLog.Instance.Verbose("Main.cs:Startup() - Loading configuration"); | 91 | MainLog.Instance.Verbose("Main.cs:Startup() - Loading configuration"); |
92 | Cfg = this.LoadConfigDll(this.ConfigDll); | 92 | Cfg = this.LoadConfigDll(this.ConfigDll); |
93 | Cfg.InitConfig(); | 93 | Cfg.InitConfig(); |
94 | 94 | ||
95 | MainLog.Instance.Verbose("Main.cs:Startup() - Establishing data connection"); | 95 | MainLog.Instance.Verbose("Main.cs:Startup() - Establishing data connection"); |
96 | m_userManager = new UserManager(); | 96 | m_userManager = new UserManager(); |
97 | m_userManager._config = Cfg; | 97 | m_userManager._config = Cfg; |
98 | m_userManager.AddPlugin(StorageDll); | 98 | m_userManager.AddPlugin(StorageDll); |
99 | 99 | ||
100 | MainLog.Instance.Verbose("Main.cs:Startup() - Starting HTTP process"); | 100 | MainLog.Instance.Verbose("Main.cs:Startup() - Starting HTTP process"); |
101 | BaseHttpServer httpServer = new BaseHttpServer(8002); | 101 | BaseHttpServer httpServer = new BaseHttpServer(8002); |
102 | 102 | ||
103 | httpServer.AddXmlRPCHandler("login_to_simulator", m_userManager.XmlRpcLoginMethod); | 103 | httpServer.AddXmlRPCHandler("login_to_simulator", m_userManager.XmlRpcLoginMethod); |
104 | 104 | ||
105 | httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName); | 105 | httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName); |
106 | httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID); | 106 | httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID); |
107 | 107 | ||
108 | httpServer.AddStreamHandler( new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod )); | 108 | httpServer.AddStreamHandler( new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod )); |
109 | 109 | ||
110 | httpServer.Start(); | 110 | httpServer.Start(); |
111 | m_console.Status("Userserver 0.3 - Startup complete"); | 111 | m_console.Status("Userserver 0.3 - Startup complete"); |
112 | } | 112 | } |
113 | 113 | ||
114 | 114 | ||
115 | public void do_create(string what) | 115 | public void do_create(string what) |
116 | { | 116 | { |
117 | switch (what) | 117 | switch (what) |
118 | { | 118 | { |
119 | case "user": | 119 | case "user": |
120 | string tempfirstname; | 120 | string tempfirstname; |
121 | string templastname; | 121 | string templastname; |
122 | string tempMD5Passwd; | 122 | string tempMD5Passwd; |
123 | uint regX = 1000; | 123 | uint regX = 1000; |
124 | uint regY = 1000; | 124 | uint regY = 1000; |
125 | 125 | ||
126 | tempfirstname = m_console.CmdPrompt("First name"); | 126 | tempfirstname = m_console.CmdPrompt("First name"); |
127 | templastname = m_console.CmdPrompt("Last name"); | 127 | templastname = m_console.CmdPrompt("Last name"); |
128 | tempMD5Passwd = m_console.PasswdPrompt("Password"); | 128 | tempMD5Passwd = m_console.PasswdPrompt("Password"); |
129 | regX = Convert.ToUInt32(m_console.CmdPrompt("Start Region X")); | 129 | regX = Convert.ToUInt32(m_console.CmdPrompt("Start Region X")); |
130 | regY = Convert.ToUInt32(m_console.CmdPrompt("Start Region Y")); | 130 | regY = Convert.ToUInt32(m_console.CmdPrompt("Start Region Y")); |
131 | 131 | ||
132 | tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); | 132 | tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); |
133 | 133 | ||
134 | m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); | 134 | m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); |
135 | break; | 135 | break; |
136 | } | 136 | } |
137 | } | 137 | } |
138 | 138 | ||
139 | public void RunCmd(string cmd, string[] cmdparams) | 139 | public void RunCmd(string cmd, string[] cmdparams) |
140 | { | 140 | { |
141 | switch (cmd) | 141 | switch (cmd) |
142 | { | 142 | { |
143 | case "help": | 143 | case "help": |
144 | m_console.Notice("create user - create a new user"); | 144 | m_console.Notice("create user - create a new user"); |
145 | m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); | 145 | m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); |
146 | break; | 146 | break; |
147 | 147 | ||
148 | case "create": | 148 | case "create": |
149 | do_create(cmdparams[0]); | 149 | do_create(cmdparams[0]); |
150 | break; | 150 | break; |
151 | 151 | ||
152 | case "shutdown": | 152 | case "shutdown": |
153 | m_console.Close(); | 153 | m_console.Close(); |
154 | Environment.Exit(0); | 154 | Environment.Exit(0); |
155 | break; | 155 | break; |
156 | } | 156 | } |
157 | } | 157 | } |
158 | 158 | ||
159 | private void ConfigDB(IGenericConfig configData) | 159 | private void ConfigDB(IGenericConfig configData) |
160 | { | 160 | { |
161 | try | 161 | try |
162 | { | 162 | { |
163 | string attri = ""; | 163 | string attri = ""; |
164 | attri = configData.GetAttribute("DataBaseProvider"); | 164 | attri = configData.GetAttribute("DataBaseProvider"); |
165 | if (attri == "") | 165 | if (attri == "") |
166 | { | 166 | { |
167 | StorageDll = "OpenSim.Framework.Data.DB4o.dll"; | 167 | StorageDll = "OpenSim.Framework.Data.DB4o.dll"; |
168 | configData.SetAttribute("DataBaseProvider", "OpenSim.Framework.Data.DB4o.dll"); | 168 | configData.SetAttribute("DataBaseProvider", "OpenSim.Framework.Data.DB4o.dll"); |
169 | } | 169 | } |
170 | else | 170 | else |
171 | { | 171 | { |
172 | StorageDll = attri; | 172 | StorageDll = attri; |
173 | } | 173 | } |
174 | configData.Commit(); | 174 | configData.Commit(); |
175 | } | 175 | } |
176 | catch | 176 | catch |
177 | { | 177 | { |
178 | 178 | ||
179 | } | 179 | } |
180 | } | 180 | } |
181 | 181 | ||
182 | private UserConfig LoadConfigDll(string dllName) | 182 | private UserConfig LoadConfigDll(string dllName) |
183 | { | 183 | { |
184 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | 184 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); |
185 | UserConfig config = null; | 185 | UserConfig config = null; |
186 | 186 | ||
187 | foreach (Type pluginType in pluginAssembly.GetTypes()) | 187 | foreach (Type pluginType in pluginAssembly.GetTypes()) |
188 | { | 188 | { |
189 | if (pluginType.IsPublic) | 189 | if (pluginType.IsPublic) |
190 | { | 190 | { |
191 | if (!pluginType.IsAbstract) | 191 | if (!pluginType.IsAbstract) |
192 | { | 192 | { |
193 | Type typeInterface = pluginType.GetInterface("IUserConfig", true); | 193 | Type typeInterface = pluginType.GetInterface("IUserConfig", true); |
194 | 194 | ||
195 | if (typeInterface != null) | 195 | if (typeInterface != null) |
196 | { | 196 | { |
197 | IUserConfig plug = (IUserConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | 197 | IUserConfig plug = (IUserConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); |
198 | config = plug.GetConfigObject(); | 198 | config = plug.GetConfigObject(); |
199 | break; | 199 | break; |
200 | } | 200 | } |
201 | 201 | ||
202 | typeInterface = null; | 202 | typeInterface = null; |
203 | } | 203 | } |
204 | } | 204 | } |
205 | } | 205 | } |
206 | pluginAssembly = null; | 206 | pluginAssembly = null; |
207 | return config; | 207 | return config; |
208 | } | 208 | } |
209 | 209 | ||
210 | public void Show(string ShowWhat) | 210 | public void Show(string ShowWhat) |
211 | { | 211 | { |
212 | } | 212 | } |
213 | } | 213 | } |
214 | } | 214 | } |
diff --git a/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs index a0a6f3c..877f02f 100644 --- a/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs +++ b/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs | |||
@@ -1,31 +1,31 @@ | |||
1 | using System.Reflection; | 1 | using System.Reflection; |
2 | using System.Runtime.InteropServices; | 2 | using System.Runtime.InteropServices; |
3 | // General Information about an assembly is controlled through the following | 3 | // General Information about an assembly is controlled through the following |
4 | // set of attributes. Change these attribute values to modify the information | 4 | // set of attributes. Change these attribute values to modify the information |
5 | // associated with an assembly. | 5 | // associated with an assembly. |
6 | [assembly: AssemblyTitle("OGS-UserServer")] | 6 | [assembly: AssemblyTitle("OGS-UserServer")] |
7 | [assembly: AssemblyDescription("")] | 7 | [assembly: AssemblyDescription("")] |
8 | [assembly: AssemblyConfiguration("")] | 8 | [assembly: AssemblyConfiguration("")] |
9 | [assembly: AssemblyCompany("")] | 9 | [assembly: AssemblyCompany("")] |
10 | [assembly: AssemblyProduct("OGS-UserServer")] | 10 | [assembly: AssemblyProduct("OGS-UserServer")] |
11 | [assembly: AssemblyCopyright("Copyright © 2007")] | 11 | [assembly: AssemblyCopyright("Copyright © 2007")] |
12 | [assembly: AssemblyTrademark("")] | 12 | [assembly: AssemblyTrademark("")] |
13 | [assembly: AssemblyCulture("")] | 13 | [assembly: AssemblyCulture("")] |
14 | 14 | ||
15 | // Setting ComVisible to false makes the types in this assembly not visible | 15 | // Setting ComVisible to false makes the types in this assembly not visible |
16 | // to COM components. If you need to access a type in this assembly from | 16 | // to COM components. If you need to access a type in this assembly from |
17 | // COM, set the ComVisible attribute to true on that type. | 17 | // COM, set the ComVisible attribute to true on that type. |
18 | [assembly: ComVisible(false)] | 18 | [assembly: ComVisible(false)] |
19 | 19 | ||
20 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 20 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
21 | [assembly: Guid("e266513a-090b-4d38-80f6-8599eef68c8c")] | 21 | [assembly: Guid("e266513a-090b-4d38-80f6-8599eef68c8c")] |
22 | 22 | ||
23 | // Version information for an assembly consists of the following four values: | 23 | // Version information for an assembly consists of the following four values: |
24 | // | 24 | // |
25 | // Major Version | 25 | // Major Version |
26 | // Minor Version | 26 | // Minor Version |
27 | // Build Number | 27 | // Build Number |
28 | // Revision | 28 | // Revision |
29 | // | 29 | // |
30 | [assembly: AssemblyVersion("1.0.0.0")] | 30 | [assembly: AssemblyVersion("1.0.0.0")] |
31 | [assembly: AssemblyFileVersion("1.0.0.0")] | 31 | [assembly: AssemblyFileVersion("1.0.0.0")] |
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs index f5275e2..bb7d673 100644 --- a/OpenSim/Grid/UserServer/UserManager.cs +++ b/OpenSim/Grid/UserServer/UserManager.cs | |||
@@ -1,100 +1,100 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.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 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using Nwc.XmlRpc; | 30 | using Nwc.XmlRpc; |
31 | using OpenSim.Framework.Data; | 31 | using OpenSim.Framework.Data; |
32 | using OpenSim.Framework.UserManagement; | 32 | using OpenSim.Framework.UserManagement; |
33 | using OpenSim.Framework.Utilities; | 33 | using OpenSim.Framework.Utilities; |
34 | 34 | ||
35 | namespace OpenSim.Grid.UserServer | 35 | namespace OpenSim.Grid.UserServer |
36 | { | 36 | { |
37 | public class UserManager : UserManagerBase | 37 | public class UserManager : UserManagerBase |
38 | { | 38 | { |
39 | public UserManager() | 39 | public UserManager() |
40 | { | 40 | { |
41 | } | 41 | } |
42 | 42 | ||
43 | /// <summary> | 43 | /// <summary> |
44 | /// Customises the login response and fills in missing values. | 44 | /// Customises the login response and fills in missing values. |
45 | /// </summary> | 45 | /// </summary> |
46 | /// <param name="response">The existing response</param> | 46 | /// <param name="response">The existing response</param> |
47 | /// <param name="theUser">The user profile</param> | 47 | /// <param name="theUser">The user profile</param> |
48 | public override void CustomiseResponse( LoginResponse response, UserProfileData theUser) | 48 | public override void CustomiseResponse( LoginResponse response, UserProfileData theUser) |
49 | { | 49 | { |
50 | // Load information from the gridserver | 50 | // Load information from the gridserver |
51 | SimProfileData SimInfo = new SimProfileData(); | 51 | SimProfileData SimInfo = new SimProfileData(); |
52 | SimInfo = SimInfo.RequestSimProfileData(theUser.currentAgent.currentHandle, _config.GridServerURL, _config.GridSendKey, _config.GridRecvKey); | 52 | SimInfo = SimInfo.RequestSimProfileData(theUser.currentAgent.currentHandle, _config.GridServerURL, _config.GridSendKey, _config.GridRecvKey); |
53 | 53 | ||
54 | // Customise the response | 54 | // Customise the response |
55 | // Home Location | 55 | // Home Location |
56 | response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * 256).ToString() + ",r" + (SimInfo.regionLocY * 256).ToString() + "], " + | 56 | response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * 256).ToString() + ",r" + (SimInfo.regionLocY * 256).ToString() + "], " + |
57 | "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + | 57 | "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + |
58 | "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; | 58 | "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; |
59 | 59 | ||
60 | // Destination | 60 | // Destination |
61 | Console.WriteLine("CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + SimInfo.regionLocY); | 61 | Console.WriteLine("CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + SimInfo.regionLocY); |
62 | response.SimAddress = SimInfo.serverIP; | 62 | response.SimAddress = SimInfo.serverIP; |
63 | response.SimPort = (Int32)SimInfo.serverPort; | 63 | response.SimPort = (Int32)SimInfo.serverPort; |
64 | response.RegionX = SimInfo.regionLocX; | 64 | response.RegionX = SimInfo.regionLocX; |
65 | response.RegionY = SimInfo.regionLocY; | 65 | response.RegionY = SimInfo.regionLocY; |
66 | 66 | ||
67 | //Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI | 67 | //Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI |
68 | string capsPath = Util.GetRandomCapsPath(); | 68 | string capsPath = Util.GetRandomCapsPath(); |
69 | response.SeedCapability = SimInfo.httpServerURI + "CAPS/" + capsPath + "0000/"; | 69 | response.SeedCapability = SimInfo.httpServerURI + "CAPS/" + capsPath + "0000/"; |
70 | 70 | ||
71 | // Notify the target of an incoming user | 71 | // Notify the target of an incoming user |
72 | Console.WriteLine("Notifying " + SimInfo.regionName + " (" + SimInfo.serverURI+ ")"); | 72 | Console.WriteLine("Notifying " + SimInfo.regionName + " (" + SimInfo.serverURI+ ")"); |
73 | 73 | ||
74 | // Prepare notification | 74 | // Prepare notification |
75 | Hashtable SimParams = new Hashtable(); | 75 | Hashtable SimParams = new Hashtable(); |
76 | SimParams["session_id"] = theUser.currentAgent.sessionID.ToString(); | 76 | SimParams["session_id"] = theUser.currentAgent.sessionID.ToString(); |
77 | SimParams["secure_session_id"] = theUser.currentAgent.secureSessionID.ToString(); | 77 | SimParams["secure_session_id"] = theUser.currentAgent.secureSessionID.ToString(); |
78 | SimParams["firstname"] = theUser.username; | 78 | SimParams["firstname"] = theUser.username; |
79 | SimParams["lastname"] = theUser.surname; | 79 | SimParams["lastname"] = theUser.surname; |
80 | SimParams["agent_id"] = theUser.UUID.ToString(); | 80 | SimParams["agent_id"] = theUser.UUID.ToString(); |
81 | SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode); | 81 | SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode); |
82 | SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString(); | 82 | SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString(); |
83 | SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString(); | 83 | SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString(); |
84 | SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString(); | 84 | SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString(); |
85 | SimParams["regionhandle"] = theUser.currentAgent.currentHandle.ToString(); | 85 | SimParams["regionhandle"] = theUser.currentAgent.currentHandle.ToString(); |
86 | SimParams["caps_path"] = capsPath; | 86 | SimParams["caps_path"] = capsPath; |
87 | ArrayList SendParams = new ArrayList(); | 87 | ArrayList SendParams = new ArrayList(); |
88 | SendParams.Add(SimParams); | 88 | SendParams.Add(SimParams); |
89 | 89 | ||
90 | // Update agent with target sim | 90 | // Update agent with target sim |
91 | theUser.currentAgent.currentRegion = SimInfo.UUID; | 91 | theUser.currentAgent.currentRegion = SimInfo.UUID; |
92 | theUser.currentAgent.currentHandle = SimInfo.regionHandle; | 92 | theUser.currentAgent.currentHandle = SimInfo.regionHandle; |
93 | 93 | ||
94 | System.Console.WriteLine("Informing region --> " + SimInfo.httpServerURI); | 94 | System.Console.WriteLine("Informing region --> " + SimInfo.httpServerURI); |
95 | // Send | 95 | // Send |
96 | XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); | 96 | XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); |
97 | XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 3000); | 97 | XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 3000); |
98 | } | 98 | } |
99 | } | 99 | } |
100 | } | 100 | } |