aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenGridServices-Source/OpenGridServices.GridServer
diff options
context:
space:
mode:
authorMW2007-05-24 12:35:32 +0000
committerMW2007-05-24 12:35:32 +0000
commitf95b6081cba084d1b067acea99c0effa2b3bf42c (patch)
tree7a7ab4aa037f75afa54f403c701a735acb101575 /OpenGridServices-Source/OpenGridServices.GridServer
parentDie ServiceManager! (Not really Gareth, just the old directory, new directory... (diff)
downloadopensim-SC_OLD-f95b6081cba084d1b067acea99c0effa2b3bf42c.zip
opensim-SC_OLD-f95b6081cba084d1b067acea99c0effa2b3bf42c.tar.gz
opensim-SC_OLD-f95b6081cba084d1b067acea99c0effa2b3bf42c.tar.bz2
opensim-SC_OLD-f95b6081cba084d1b067acea99c0effa2b3bf42c.tar.xz
Renamed the new Directories. (removed the "-Source" from the end of them)
Diffstat (limited to 'OpenGridServices-Source/OpenGridServices.GridServer')
-rw-r--r--OpenGridServices-Source/OpenGridServices.GridServer/GridManager.cs474
-rw-r--r--OpenGridServices-Source/OpenGridServices.GridServer/Main.cs239
-rw-r--r--OpenGridServices-Source/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj138
-rw-r--r--OpenGridServices-Source/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj.user12
-rw-r--r--OpenGridServices-Source/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build51
-rw-r--r--OpenGridServices-Source/OpenGridServices.GridServer/Properties/AssemblyInfo.cs33
6 files changed, 0 insertions, 947 deletions
diff --git a/OpenGridServices-Source/OpenGridServices.GridServer/GridManager.cs b/OpenGridServices-Source/OpenGridServices.GridServer/GridManager.cs
deleted file mode 100644
index 54e4bb7..0000000
--- a/OpenGridServices-Source/OpenGridServices.GridServer/GridManager.cs
+++ /dev/null
@@ -1,474 +0,0 @@
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using System.Text;
5using System.Reflection;
6using OpenGrid.Framework.Data;
7using OpenSim.Framework.Utilities;
8using OpenSim.Framework.Console;
9using OpenSim.Framework.Sims;
10using libsecondlife;
11using Nwc.XmlRpc;
12using System.Xml;
13
14namespace OpenGridServices.GridServer
15{
16 class GridManager
17 {
18 Dictionary<string, IGridData> _plugins = new Dictionary<string, IGridData>();
19 public OpenSim.Framework.Interfaces.GridConfig config;
20
21 /// <summary>
22 /// Adds a new grid server plugin - grid servers will be requested in the order they were loaded.
23 /// </summary>
24 /// <param name="FileName">The filename to the grid server plugin DLL</param>
25 public void AddPlugin(string FileName)
26 {
27 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Storage: Attempting to load " + FileName);
28 Assembly pluginAssembly = Assembly.LoadFrom(FileName);
29
30 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Storage: Found " + pluginAssembly.GetTypes().Length + " interfaces.");
31 foreach (Type pluginType in pluginAssembly.GetTypes())
32 {
33 if (!pluginType.IsAbstract)
34 {
35 Type typeInterface = pluginType.GetInterface("IGridData", true);
36
37 if (typeInterface != null)
38 {
39 IGridData plug = (IGridData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
40 plug.Initialise();
41 this._plugins.Add(plug.getName(), plug);
42 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Storage: Added IGridData Interface");
43 }
44
45 typeInterface = null;
46 }
47 }
48
49 pluginAssembly = null;
50 }
51
52 /// <summary>
53 /// Returns a region by argument
54 /// </summary>
55 /// <param name="uuid">A UUID key of the region to return</param>
56 /// <returns>A SimProfileData for the region</returns>
57 public SimProfileData getRegion(libsecondlife.LLUUID uuid)
58 {
59 foreach(KeyValuePair<string,IGridData> kvp in _plugins) {
60 try
61 {
62 return kvp.Value.GetProfileByLLUUID(uuid);
63 }
64 catch (Exception e)
65 {
66 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.NORMAL,"Storage: Unable to find region " + uuid.ToStringHyphenated() + " via " + kvp.Key);
67 }
68 }
69 return null;
70 }
71
72 /// <summary>
73 /// Returns a region by argument
74 /// </summary>
75 /// <param name="uuid">A regionHandle of the region to return</param>
76 /// <returns>A SimProfileData for the region</returns>
77 public SimProfileData getRegion(ulong handle)
78 {
79 foreach (KeyValuePair<string, IGridData> kvp in _plugins)
80 {
81 try
82 {
83 return kvp.Value.GetProfileByHandle(handle);
84 }
85 catch (Exception e)
86 {
87 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.NORMAL,"Storage: Unable to find region " + handle.ToString() + " via " + kvp.Key);
88 }
89 }
90 return null;
91 }
92
93 public Dictionary<ulong, SimProfileData> getRegions(uint xmin, uint ymin, uint xmax, uint ymax)
94 {
95 Dictionary<ulong, SimProfileData> regions = new Dictionary<ulong, SimProfileData>();
96
97 SimProfileData[] neighbours;
98
99 foreach (KeyValuePair<string, IGridData> kvp in _plugins)
100 {
101 try
102 {
103 neighbours = kvp.Value.GetProfilesInRange(xmin, ymin, xmax, ymax);
104 foreach (SimProfileData neighbour in neighbours)
105 {
106 regions[neighbour.regionHandle] = neighbour;
107 }
108 }
109 catch (Exception e)
110 {
111 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.NORMAL, "Storage: Unable to query regionblock via " + kvp.Key);
112 }
113 }
114
115 return regions;
116 }
117
118 /// <summary>
119 /// Returns a XML String containing a list of the neighbouring regions
120 /// </summary>
121 /// <param name="reqhandle">The regionhandle for the center sim</param>
122 /// <returns>An XML string containing neighbour entities</returns>
123 public string GetXMLNeighbours(ulong reqhandle)
124 {
125 string response = "";
126 SimProfileData central_region = getRegion(reqhandle);
127 SimProfileData neighbour;
128 for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++)
129 {
130 if (getRegion(Util.UIntsToLong((uint)((central_region.regionLocX + x) * 256), (uint)(central_region.regionLocY + y) * 256)) != null)
131 {
132 neighbour = getRegion(Util.UIntsToLong((uint)((central_region.regionLocX + x) * 256), (uint)(central_region.regionLocY + y) * 256));
133 response += "<neighbour>";
134 response += "<sim_ip>" + neighbour.serverIP + "</sim_ip>";
135 response += "<sim_port>" + neighbour.serverPort.ToString() + "</sim_port>";
136 response += "<locx>" + neighbour.regionLocX.ToString() + "</locx>";
137 response += "<locy>" + neighbour.regionLocY.ToString() + "</locy>";
138 response += "<regionhandle>" + neighbour.regionHandle.ToString() + "</regionhandle>";
139 response += "</neighbour>";
140
141 }
142 }
143 return response;
144 }
145
146 /// <summary>
147 /// Performed when a region connects to the grid server initially.
148 /// </summary>
149 /// <param name="request">The XMLRPC Request</param>
150 /// <returns>Startup parameters</returns>
151 public XmlRpcResponse XmlRpcLoginToSimulatorMethod(XmlRpcRequest request)
152 {
153 XmlRpcResponse response = new XmlRpcResponse();
154 Hashtable responseData = new Hashtable();
155 response.Value = responseData;
156
157 SimProfileData TheSim = null;
158 Hashtable requestData = (Hashtable)request.Params[0];
159
160 if (requestData.ContainsKey("UUID"))
161 {
162 TheSim = getRegion(new LLUUID((string)requestData["UUID"]));
163 }
164 else if (requestData.ContainsKey("region_handle"))
165 {
166 TheSim = getRegion((ulong)Convert.ToUInt64(requestData["region_handle"]));
167 }
168
169 if (TheSim == null)
170 {
171 responseData["error"] = "sim not found";
172 }
173 else
174 {
175
176 ArrayList SimNeighboursData = new ArrayList();
177
178 SimProfileData neighbour;
179 Hashtable NeighbourBlock;
180
181 bool fastMode = false; // Only compatible with MySQL right now
182
183 if (fastMode)
184 {
185 Dictionary<ulong, SimProfileData> neighbours = getRegions(TheSim.regionLocX - 1, TheSim.regionLocY - 1, TheSim.regionLocX + 1, TheSim.regionLocY + 1);
186
187 foreach (KeyValuePair<ulong, SimProfileData> aSim in neighbours)
188 {
189 NeighbourBlock = new Hashtable();
190 NeighbourBlock["sim_ip"] = aSim.Value.serverIP.ToString();
191 NeighbourBlock["sim_port"] = aSim.Value.serverPort.ToString();
192 NeighbourBlock["region_locx"] = aSim.Value.regionLocX.ToString();
193 NeighbourBlock["region_locy"] = aSim.Value.regionLocY.ToString();
194 NeighbourBlock["UUID"] = aSim.Value.UUID.ToString();
195
196 if (aSim.Value.UUID != TheSim.UUID)
197 SimNeighboursData.Add(NeighbourBlock);
198 }
199 }
200 else
201 {
202 for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++)
203 {
204 if (getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256)) != null)
205 {
206 neighbour = getRegion(Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), (uint)(TheSim.regionLocY + y) * 256));
207
208 NeighbourBlock = new Hashtable();
209 NeighbourBlock["sim_ip"] = neighbour.serverIP;
210 NeighbourBlock["sim_port"] = neighbour.serverPort.ToString();
211 NeighbourBlock["region_locx"] = neighbour.regionLocX.ToString();
212 NeighbourBlock["region_locy"] = neighbour.regionLocY.ToString();
213 NeighbourBlock["UUID"] = neighbour.UUID.ToString();
214
215 if (neighbour.UUID != TheSim.UUID) SimNeighboursData.Add(NeighbourBlock);
216 }
217 }
218 }
219
220 responseData["UUID"] = TheSim.UUID.ToString();
221 responseData["region_locx"] = TheSim.regionLocX.ToString();
222 responseData["region_locy"] = TheSim.regionLocY.ToString();
223 responseData["regionname"] = TheSim.regionName;
224 responseData["estate_id"] = "1";
225 responseData["neighbours"] = SimNeighboursData;
226
227 responseData["sim_ip"] = TheSim.serverIP;
228 responseData["sim_port"] = TheSim.serverPort.ToString();
229 responseData["asset_url"] = TheSim.regionAssetURI;
230 responseData["asset_sendkey"] = TheSim.regionAssetSendKey;
231 responseData["asset_recvkey"] = TheSim.regionAssetRecvKey;
232 responseData["user_url"] = TheSim.regionUserURI;
233 responseData["user_sendkey"] = TheSim.regionUserSendKey;
234 responseData["user_recvkey"] = TheSim.regionUserRecvKey;
235 responseData["authkey"] = TheSim.regionSecret;
236
237 // New! If set, use as URL to local sim storage (ie http://remotehost/region.yap)
238 responseData["data_uri"] = TheSim.regionDataURI;
239 }
240
241 return response;
242 }
243
244 public XmlRpcResponse XmlRpcMapBlockMethod(XmlRpcRequest request)
245 {
246 int xmin=980, ymin=980, xmax=1020, ymax=1020;
247
248 Hashtable requestData = (Hashtable)request.Params[0];
249 if (requestData.ContainsKey("xmin"))
250 {
251 xmin = (Int32)requestData["xmin"];
252 }
253 if (requestData.ContainsKey("ymin"))
254 {
255 ymin = (Int32)requestData["ymin"];
256 }
257 if (requestData.ContainsKey("xmax"))
258 {
259 xmax = (Int32)requestData["xmax"];
260 }
261 if (requestData.ContainsKey("ymax"))
262 {
263 ymax = (Int32)requestData["ymax"];
264 }
265
266 XmlRpcResponse response = new XmlRpcResponse();
267 Hashtable responseData = new Hashtable();
268 response.Value = responseData;
269 IList simProfileList = new ArrayList();
270
271 SimProfileData simProfile;
272 for (int x = xmin; x < xmax; x++)
273 {
274 for (int y = ymin; y < ymax; y++)
275 {
276 simProfile = getRegion(Helpers.UIntsToLong((uint)(x * 256), (uint)(y * 256)));
277 if (simProfile != null)
278 {
279 Hashtable simProfileBlock = new Hashtable();
280 simProfileBlock["x"] = x;
281 simProfileBlock["y"] = y;
282 simProfileBlock["name"] = simProfile.regionName;
283 simProfileBlock["access"] = 0;
284 simProfileBlock["region-flags"] = 0;
285 simProfileBlock["water-height"] = 20;
286 simProfileBlock["agents"] = 1;
287 simProfileBlock["map-image-id"] = simProfile.regionMapTextureID.ToString();
288
289 simProfileList.Add(simProfileBlock);
290 }
291 }
292 }
293
294 responseData["sim-profiles"] = simProfileList;
295
296 return response;
297 }
298
299
300
301 /// <summary>
302 /// Performs a REST Get Operation
303 /// </summary>
304 /// <param name="request"></param>
305 /// <param name="path"></param>
306 /// <param name="param"></param>
307 /// <returns></returns>
308 public string RestGetRegionMethod(string request, string path, string param)
309 {
310 return RestGetSimMethod("", "/sims/", param);
311 }
312
313 /// <summary>
314 /// Performs a REST Set Operation
315 /// </summary>
316 /// <param name="request"></param>
317 /// <param name="path"></param>
318 /// <param name="param"></param>
319 /// <returns></returns>
320 public string RestSetRegionMethod(string request, string path, string param)
321 {
322 return RestSetSimMethod("", "/sims/", param);
323 }
324
325 /// <summary>
326 /// Returns information about a sim via a REST Request
327 /// </summary>
328 /// <param name="request"></param>
329 /// <param name="path"></param>
330 /// <param name="param"></param>
331 /// <returns>Information about the sim in XML</returns>
332 public string RestGetSimMethod(string request, string path, string param)
333 {
334 string respstring = String.Empty;
335
336 SimProfileData TheSim;
337 LLUUID UUID = new LLUUID(param);
338 TheSim = getRegion(UUID);
339
340 if (!(TheSim == null))
341 {
342 respstring = "<Root>";
343 respstring += "<authkey>" + TheSim.regionSendKey + "</authkey>";
344 respstring += "<sim>";
345 respstring += "<uuid>" + TheSim.UUID.ToString() + "</uuid>";
346 respstring += "<regionname>" + TheSim.regionName + "</regionname>";
347 respstring += "<sim_ip>" + TheSim.serverIP + "</sim_ip>";
348 respstring += "<sim_port>" + TheSim.serverPort.ToString() + "</sim_port>";
349 respstring += "<region_locx>" + TheSim.regionLocX.ToString() + "</region_locx>";
350 respstring += "<region_locy>" + TheSim.regionLocY.ToString() + "</region_locy>";
351 respstring += "<estate_id>1</estate_id>";
352 respstring += "</sim>";
353 respstring += "</Root>";
354 }
355
356 return respstring;
357 }
358
359 /// <summary>
360 /// Creates or updates a sim via a REST Method Request
361 /// BROKEN with SQL Update
362 /// </summary>
363 /// <param name="request"></param>
364 /// <param name="path"></param>
365 /// <param name="param"></param>
366 /// <returns>"OK" or an error</returns>
367 public string RestSetSimMethod(string request, string path, string param)
368 {
369 Console.WriteLine("SimProfiles.cs:RestSetSimMethod() - processing request......");
370 SimProfileData TheSim;
371 TheSim = getRegion(new LLUUID(param));
372 if ((TheSim) == null)
373 {
374 TheSim = new SimProfileData();
375 LLUUID UUID = new LLUUID(param);
376 TheSim.UUID = UUID;
377 TheSim.regionRecvKey = config.SimRecvKey;
378 }
379
380 XmlDocument doc = new XmlDocument();
381 doc.LoadXml(request);
382 XmlNode rootnode = doc.FirstChild;
383 XmlNode authkeynode = rootnode.ChildNodes[0];
384 if (authkeynode.Name != "authkey")
385 {
386 return "ERROR! bad XML - expected authkey tag";
387 }
388
389 XmlNode simnode = rootnode.ChildNodes[1];
390 if (simnode.Name != "sim")
391 {
392 return "ERROR! bad XML - expected sim tag";
393 }
394
395 if (authkeynode.InnerText != TheSim.regionRecvKey)
396 {
397 return "ERROR! invalid key";
398 }
399
400 //TheSim.regionSendKey = Cfg;
401 TheSim.regionRecvKey = config.SimRecvKey;
402 TheSim.regionSendKey = config.SimSendKey;
403 TheSim.regionSecret = config.SimRecvKey;
404 TheSim.regionDataURI = "";
405 TheSim.regionAssetURI = config.DefaultAssetServer;
406 TheSim.regionAssetRecvKey = config.AssetRecvKey;
407 TheSim.regionAssetSendKey = config.AssetSendKey;
408 TheSim.regionUserURI = config.DefaultUserServer;
409 TheSim.regionUserSendKey = config.UserSendKey;
410 TheSim.regionUserRecvKey = config.UserRecvKey;
411
412
413 for (int i = 0; i < simnode.ChildNodes.Count; i++)
414 {
415 switch (simnode.ChildNodes[i].Name)
416 {
417 case "regionname":
418 TheSim.regionName = simnode.ChildNodes[i].InnerText;
419 break;
420
421 case "sim_ip":
422 TheSim.serverIP = simnode.ChildNodes[i].InnerText;
423 break;
424
425 case "sim_port":
426 TheSim.serverPort = Convert.ToUInt32(simnode.ChildNodes[i].InnerText);
427 break;
428
429 case "region_locx":
430 TheSim.regionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText);
431 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256));
432 break;
433
434 case "region_locy":
435 TheSim.regionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText);
436 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256));
437 break;
438 }
439 }
440
441 TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/";
442
443 bool requirePublic = false;
444
445 if (requirePublic && (TheSim.serverIP.StartsWith("172.16") || TheSim.serverIP.StartsWith("192.168") || TheSim.serverIP.StartsWith("10.") || TheSim.serverIP.StartsWith("0.") || TheSim.serverIP.StartsWith("255.")))
446 {
447 return "ERROR! Servers must register with public addresses.";
448 }
449
450 try
451 {
452 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Attempting to add a new region to the grid - " + _plugins.Count + " storage provider(s) registered.");
453 foreach (KeyValuePair<string, IGridData> kvp in _plugins)
454 {
455 try
456 {
457 kvp.Value.AddProfile(TheSim);
458 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"New sim added to grid (" + TheSim.regionName + ")");
459 }
460 catch (Exception e)
461 {
462 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"getRegionPlugin Handle " + kvp.Key + " unable to add new sim: " + e.ToString());
463 }
464 }
465 return "OK";
466 }
467 catch (Exception e)
468 {
469 return "ERROR! Could not save to database! (" + e.ToString() + ")";
470 }
471 }
472
473 }
474}
diff --git a/OpenGridServices-Source/OpenGridServices.GridServer/Main.cs b/OpenGridServices-Source/OpenGridServices.GridServer/Main.cs
deleted file mode 100644
index cad5fae..0000000
--- a/OpenGridServices-Source/OpenGridServices.GridServer/Main.cs
+++ /dev/null
@@ -1,239 +0,0 @@
1/*
2Copyright (c) OpenSim project, http://osgrid.org/
3
4
5* All rights reserved.
6*
7* Redistribution and use in source and binary forms, with or without
8* modification, are permitted provided that the following conditions are met:
9* * Redistributions of source code must retain the above copyright
10* notice, this list of conditions and the following disclaimer.
11* * Redistributions in binary form must reproduce the above copyright
12* notice, this list of conditions and the following disclaimer in the
13* documentation and/or other materials provided with the distribution.
14* * Neither the name of the <organization> nor the
15* names of its contributors may be used to endorse or promote products
16* derived from this software without specific prior written permission.
17*
18* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
19* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
22* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28*/
29
30using System;
31using System.IO;
32using System.Text;
33using System.Timers;
34using System.Net;
35using System.Threading;
36using System.Reflection;
37using libsecondlife;
38using OpenGrid.Framework.Manager;
39using OpenSim.Framework;
40using OpenSim.Framework.Sims;
41using OpenSim.Framework.Console;
42using OpenSim.Framework.Interfaces;
43using OpenSim.Servers;
44
45namespace OpenGridServices.GridServer
46{
47 /// <summary>
48 /// </summary>
49 public class OpenGrid_Main : BaseServer, conscmd_callback
50 {
51 private string ConfigDll = "OpenGrid.Config.GridConfigDb4o.dll";
52 private string GridDll = "OpenGrid.Framework.Data.MySQL.dll";
53 public GridConfig Cfg;
54
55 public static OpenGrid_Main thegrid;
56 public static bool setuponly;
57
58 //public LLUUID highestUUID;
59
60// private SimProfileManager m_simProfileManager;
61
62 private GridManager m_gridManager;
63
64 private ConsoleBase m_console;
65
66 [STAThread]
67 public static void Main(string[] args)
68 {
69 if (args.Length > 0)
70 {
71 if (args[0] == "-setuponly") setuponly = true;
72 }
73 Console.WriteLine("Starting...\n");
74
75 thegrid = new OpenGrid_Main();
76 thegrid.Startup();
77
78 thegrid.Work();
79 }
80
81 private void Work()
82 {
83 while (true)
84 {
85 Thread.Sleep(5000);
86 // should flush the DB etc here
87 }
88 }
89
90 private OpenGrid_Main()
91 {
92 m_console = new ConsoleBase("opengrid-gridserver-console.log", "OpenGrid", this, false);
93 MainConsole.Instance = m_console;
94
95
96 }
97
98 public void managercallback(string cmd) {
99 switch(cmd) {
100 case "shutdown":
101 RunCmd("shutdown",new string[0]);
102 break;
103 }
104 }
105
106
107 public void Startup()
108 {
109 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Loading configuration");
110 Cfg = this.LoadConfigDll(this.ConfigDll);
111 Cfg.InitConfig();
112 if(setuponly) Environment.Exit(0);
113
114 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Connecting to Storage Server");
115 m_gridManager = new GridManager();
116 m_gridManager.AddPlugin(GridDll); // Made of win
117 m_gridManager.config = Cfg;
118
119 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Starting HTTP process");
120 BaseHttpServer httpServer = new BaseHttpServer(8001);
121 GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer,"gridserver",Cfg.SimSendKey,Cfg.SimRecvKey,managercallback);
122
123 httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcLoginToSimulatorMethod);
124 httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod);
125
126 httpServer.AddRestHandler("GET", "/sims/", m_gridManager.RestGetSimMethod);
127 httpServer.AddRestHandler("POST", "/sims/", m_gridManager.RestSetSimMethod);
128 httpServer.AddRestHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod);
129 httpServer.AddRestHandler("POST", "/regions/", m_gridManager.RestSetRegionMethod);
130
131
132 // lbsa71 : This code snippet taken from old http server.
133 // I have no idea what this was supposed to do - looks like an infinite recursion to me.
134 // case "regions":
135 //// DIRTY HACK ALERT
136 //Console.WriteLine("/regions/ accessed");
137 //TheSim = OpenGrid_Main.thegrid._regionmanager.GetProfileByHandle((ulong)Convert.ToUInt64(rest_params[1]));
138 //respstring = ParseREST("/regions/" + rest_params[1], requestBody, HTTPmethod);
139 //break;
140
141 // lbsa71 : I guess these were never used?
142 //Listener.Prefixes.Add("http://+:8001/gods/");
143 //Listener.Prefixes.Add("http://+:8001/highestuuid/");
144 //Listener.Prefixes.Add("http://+:8001/uuidblocks/");
145
146 httpServer.Start();
147
148 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Starting sim status checker");
149
150 System.Timers.Timer simCheckTimer = new System.Timers.Timer( 300000 ); // 5 minutes
151 simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims);
152 simCheckTimer.Enabled = true;
153 }
154
155 private GridConfig LoadConfigDll(string dllName)
156 {
157 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
158 GridConfig config = null;
159
160 foreach (Type pluginType in pluginAssembly.GetTypes())
161 {
162 if (pluginType.IsPublic)
163 {
164 if (!pluginType.IsAbstract)
165 {
166 Type typeInterface = pluginType.GetInterface("IGridConfig", true);
167
168 if (typeInterface != null)
169 {
170 IGridConfig plug = (IGridConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
171 config = plug.GetConfigObject();
172 break;
173 }
174
175 typeInterface = null;
176 }
177 }
178 }
179 pluginAssembly = null;
180 return config;
181 }
182
183 public void CheckSims(object sender, ElapsedEventArgs e)
184 {
185 /*
186 foreach (SimProfileBase sim in m_simProfileManager.SimProfiles.Values)
187 {
188 string SimResponse = "";
189 try
190 {
191 WebRequest CheckSim = WebRequest.Create("http://" + sim.sim_ip + ":" + sim.sim_port.ToString() + "/checkstatus/");
192 CheckSim.Method = "GET";
193 CheckSim.ContentType = "text/plaintext";
194 CheckSim.ContentLength = 0;
195
196 StreamWriter stOut = new StreamWriter(CheckSim.GetRequestStream(), System.Text.Encoding.ASCII);
197 stOut.Write("");
198 stOut.Close();
199
200 StreamReader stIn = new StreamReader(CheckSim.GetResponse().GetResponseStream());
201 SimResponse = stIn.ReadToEnd();
202 stIn.Close();
203 }
204 catch
205 {
206 }
207
208 if (SimResponse == "OK")
209 {
210 m_simProfileManager.SimProfiles[sim.UUID].online = true;
211 }
212 else
213 {
214 m_simProfileManager.SimProfiles[sim.UUID].online = false;
215 }
216 }
217 */
218 }
219
220 public void RunCmd(string cmd, string[] cmdparams)
221 {
222 switch (cmd)
223 {
224 case "help":
225 m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,"shutdown - shutdown the grid (USE CAUTION!)");
226 break;
227
228 case "shutdown":
229 m_console.Close();
230 Environment.Exit(0);
231 break;
232 }
233 }
234
235 public void Show(string ShowWhat)
236 {
237 }
238 }
239}
diff --git a/OpenGridServices-Source/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj b/OpenGridServices-Source/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj
deleted file mode 100644
index 5f3fc6f..0000000
--- a/OpenGridServices-Source/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj
+++ /dev/null
@@ -1,138 +0,0 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{21BFC8E2-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenGridServices.GridServer</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Exe</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenGridServices.GridServer</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>System.dll</HintPath>
63 <Private>False</Private>
64 </Reference>
65 <Reference Include="System.Data" >
66 <HintPath>System.Data.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 <Reference Include="System.Xml" >
70 <HintPath>System.Xml.dll</HintPath>
71 <Private>False</Private>
72 </Reference>
73 <Reference Include="libsecondlife.dll" >
74 <HintPath>..\bin\libsecondlife.dll</HintPath>
75 <Private>False</Private>
76 </Reference>
77 <Reference Include="Db4objects.Db4o.dll" >
78 <HintPath>..\bin\Db4objects.Db4o.dll</HintPath>
79 <Private>False</Private>
80 </Reference>
81 </ItemGroup>
82 <ItemGroup>
83 <ProjectReference Include="..\OpenSim.Framework\OpenSim.Framework.csproj">
84 <Name>OpenSim.Framework</Name>
85 <Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 <Private>False</Private>
88 </ProjectReference>
89 <ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
90 <Name>OpenSim.Framework.Console</Name>
91 <Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
92 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
93 <Private>False</Private>
94 </ProjectReference>
95 <ProjectReference Include="..\OpenSim.Servers\OpenSim.Servers.csproj">
96 <Name>OpenSim.Servers</Name>
97 <Project>{8BB20F0A-0000-0000-0000-000000000000}</Project>
98 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
99 <Private>False</Private>
100 </ProjectReference>
101 <ProjectReference Include="..\OpenGrid.Framework.Data\OpenGrid.Framework.Data.csproj">
102 <Name>OpenGrid.Framework.Data</Name>
103 <Project>{62CDF671-0000-0000-0000-000000000000}</Project>
104 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
105 <Private>False</Private>
106 </ProjectReference>
107 <ProjectReference Include="..\OpenGrid.Framework.Manager\OpenGrid.Framework.Manager.csproj">
108 <Name>OpenGrid.Framework.Manager</Name>
109 <Project>{7924FD35-0000-0000-0000-000000000000}</Project>
110 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
111 <Private>False</Private>
112 </ProjectReference>
113 <ProjectReference Include="..\XmlRpcCS\XMLRPC.csproj">
114 <Name>XMLRPC</Name>
115 <Project>{8E81D43C-0000-0000-0000-000000000000}</Project>
116 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
117 <Private>False</Private>
118 </ProjectReference>
119 </ItemGroup>
120 <ItemGroup>
121 <Compile Include="GridManager.cs">
122 <SubType>Code</SubType>
123 </Compile>
124 <Compile Include="Main.cs">
125 <SubType>Code</SubType>
126 </Compile>
127 <Compile Include="Properties\AssemblyInfo.cs">
128 <SubType>Code</SubType>
129 </Compile>
130 </ItemGroup>
131 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
132 <PropertyGroup>
133 <PreBuildEvent>
134 </PreBuildEvent>
135 <PostBuildEvent>
136 </PostBuildEvent>
137 </PropertyGroup>
138</Project>
diff --git a/OpenGridServices-Source/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj.user b/OpenGridServices-Source/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj.user
deleted file mode 100644
index d47d65d..0000000
--- a/OpenGridServices-Source/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj.user
+++ /dev/null
@@ -1,12 +0,0 @@
1<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ReferencePath>C:\New Folder\second-life-viewer\opensim-dailys2\opensim15-07\bin\</ReferencePath>
6 <LastOpenVersion>8.0.50727</LastOpenVersion>
7 <ProjectView>ProjectFiles</ProjectView>
8 <ProjectTrust>0</ProjectTrust>
9 </PropertyGroup>
10 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
11 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
12</Project>
diff --git a/OpenGridServices-Source/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build b/OpenGridServices-Source/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build
deleted file mode 100644
index 9ca4d4b..0000000
--- a/OpenGridServices-Source/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build
+++ /dev/null
@@ -1,51 +0,0 @@
1<?xml version="1.0" ?>
2<project name="OpenGridServices.GridServer" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="exe" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.exe">
11 <resources prefix="OpenGridServices.GridServer" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="GridManager.cs" />
15 <include name="Main.cs" />
16 <include name="Properties/AssemblyInfo.cs" />
17 </sources>
18 <references basedir="${project::get-base-directory()}">
19 <lib>
20 <include name="${project::get-base-directory()}" />
21 <include name="${project::get-base-directory()}/${build.dir}" />
22 </lib>
23 <include name="System.dll" />
24 <include name="System.Data.dll" />
25 <include name="System.Xml.dll" />
26 <include name="../bin/OpenSim.Framework.dll" />
27 <include name="../bin/OpenSim.Framework.Console.dll" />
28 <include name="../bin/OpenSim.Servers.dll" />
29 <include name="../bin/OpenGrid.Framework.Data.dll" />
30 <include name="../bin/OpenGrid.Framework.Manager.dll" />
31 <include name="../bin/libsecondlife.dll" />
32 <include name="../bin/Db4objects.Db4o.dll" />
33 <include name="../bin/XMLRPC.dll" />
34 </references>
35 </csc>
36 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" />
37 <mkdir dir="${project::get-base-directory()}/../bin/"/>
38 <copy todir="${project::get-base-directory()}/../bin/">
39 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
40 <include name="*.dll"/>
41 <include name="*.exe"/>
42 </fileset>
43 </copy>
44 </target>
45 <target name="clean">
46 <delete dir="${bin.dir}" failonerror="false" />
47 <delete dir="${obj.dir}" failonerror="false" />
48 </target>
49 <target name="doc" description="Creates documentation.">
50 </target>
51</project>
diff --git a/OpenGridServices-Source/OpenGridServices.GridServer/Properties/AssemblyInfo.cs b/OpenGridServices-Source/OpenGridServices.GridServer/Properties/AssemblyInfo.cs
deleted file mode 100644
index 8471e6b..0000000
--- a/OpenGridServices-Source/OpenGridServices.GridServer/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,33 +0,0 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OGS-GridServer")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("")]
12[assembly: AssemblyProduct("OGS-GridServer")]
13[assembly: AssemblyCopyright("Copyright © 2007")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("b541b244-3d1d-4625-9003-bc2a3a6a39a4")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("1.0.0.0")]
33[assembly: AssemblyFileVersion("1.0.0.0")]