aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenGridServices.GridServer
diff options
context:
space:
mode:
Diffstat (limited to 'OpenGridServices.GridServer')
-rw-r--r--OpenGridServices.GridServer/GridManager.cs43
-rw-r--r--OpenGridServices.GridServer/Main.cs6
2 files changed, 27 insertions, 22 deletions
diff --git a/OpenGridServices.GridServer/GridManager.cs b/OpenGridServices.GridServer/GridManager.cs
index 8cff0d3..e41f3d5 100644
--- a/OpenGridServices.GridServer/GridManager.cs
+++ b/OpenGridServices.GridServer/GridManager.cs
@@ -16,6 +16,7 @@ namespace OpenGridServices.GridServer
16 class GridManager 16 class GridManager
17 { 17 {
18 Dictionary<string, IGridData> _plugins = new Dictionary<string, IGridData>(); 18 Dictionary<string, IGridData> _plugins = new Dictionary<string, IGridData>();
19 public string defaultRecvKey;
19 20
20 /// <summary> 21 /// <summary>
21 /// Adds a new grid server plugin - grid servers will be requested in the order they were loaded. 22 /// Adds a new grid server plugin - grid servers will be requested in the order they were loaded.
@@ -23,27 +24,26 @@ namespace OpenGridServices.GridServer
23 /// <param name="FileName">The filename to the grid server plugin DLL</param> 24 /// <param name="FileName">The filename to the grid server plugin DLL</param>
24 public void AddPlugin(string FileName) 25 public void AddPlugin(string FileName)
25 { 26 {
27 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Storage: Attempting to load " + FileName);
26 Assembly pluginAssembly = Assembly.LoadFrom(FileName); 28 Assembly pluginAssembly = Assembly.LoadFrom(FileName);
27 29
30 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Storage: Found " + pluginAssembly.GetTypes().Length + " interfaces.");
28 foreach (Type pluginType in pluginAssembly.GetTypes()) 31 foreach (Type pluginType in pluginAssembly.GetTypes())
29 { 32 {
30 if (pluginType.IsPublic) 33 if (!pluginType.IsAbstract)
31 { 34 {
32 if (!pluginType.IsAbstract) 35 Type typeInterface = pluginType.GetInterface("IGridData", true);
33 { 36
34 Type typeInterface = pluginType.GetInterface("IGridData", true); 37 if (typeInterface != null)
35 38 {
36 if (typeInterface != null) 39 IGridData plug = (IGridData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
37 { 40 plug.Initialise();
38 IGridData plug = (IGridData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 41 this._plugins.Add(plug.getName(), plug);
39 plug.Initialise(); 42 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Storage: Added IGridData Interface");
40 this._plugins.Add(plug.getName(),plug); 43 }
41 44
42 } 45 typeInterface = null;
43 46 }
44 typeInterface = null;
45 }
46 }
47 } 47 }
48 48
49 pluginAssembly = null; 49 pluginAssembly = null;
@@ -63,7 +63,7 @@ namespace OpenGridServices.GridServer
63 } 63 }
64 catch (Exception e) 64 catch (Exception e)
65 { 65 {
66 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("getRegionPlugin UUID " + kvp.Key + " is made of fail: " + e.ToString()); 66 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Storage: Unable to find region " + uuid.ToStringHyphenated() + " via " + kvp.Key);
67 } 67 }
68 } 68 }
69 return null; 69 return null;
@@ -84,7 +84,7 @@ namespace OpenGridServices.GridServer
84 } 84 }
85 catch (Exception e) 85 catch (Exception e)
86 { 86 {
87 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("getRegionPlugin Handle " + kvp.Key + " is made of fail: " + e.ToString()); 87 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Storage: Unable to find region " + handle.ToString() + " via " + kvp.Key);
88 } 88 }
89 } 89 }
90 return null; 90 return null;
@@ -269,6 +269,7 @@ namespace OpenGridServices.GridServer
269 TheSim = new SimProfileData(); 269 TheSim = new SimProfileData();
270 LLUUID UUID = new LLUUID(param); 270 LLUUID UUID = new LLUUID(param);
271 TheSim.UUID = UUID; 271 TheSim.UUID = UUID;
272 TheSim.regionRecvKey = defaultRecvKey;
272 } 273 }
273 274
274 XmlDocument doc = new XmlDocument(); 275 XmlDocument doc = new XmlDocument();
@@ -320,11 +321,13 @@ namespace OpenGridServices.GridServer
320 321
321 try 322 try
322 { 323 {
324 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Attempting to add a new region to the grid - " + _plugins.Count + " storage provider(s) registered.");
323 foreach (KeyValuePair<string, IGridData> kvp in _plugins) 325 foreach (KeyValuePair<string, IGridData> kvp in _plugins)
324 { 326 {
325 try 327 try
326 { 328 {
327 kvp.Value.AddProfile(TheSim); 329 kvp.Value.AddProfile(TheSim);
330 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("New sim added to grid (" + TheSim.regionName + ")");
328 } 331 }
329 catch (Exception e) 332 catch (Exception e)
330 { 333 {
diff --git a/OpenGridServices.GridServer/Main.cs b/OpenGridServices.GridServer/Main.cs
index f7cfe71..ba6c60d 100644
--- a/OpenGridServices.GridServer/Main.cs
+++ b/OpenGridServices.GridServer/Main.cs
@@ -47,6 +47,7 @@ namespace OpenGridServices.GridServer
47 public class OpenGrid_Main : BaseServer, conscmd_callback 47 public class OpenGrid_Main : BaseServer, conscmd_callback
48 { 48 {
49 private string ConfigDll = "OpenGrid.Config.GridConfigDb4o.dll"; 49 private string ConfigDll = "OpenGrid.Config.GridConfigDb4o.dll";
50 private string GridDll = "OpenGrid.Framework.Data.DB4o.dll";
50 public GridConfig Cfg; 51 public GridConfig Cfg;
51 52
52 public static OpenGrid_Main thegrid; 53 public static OpenGrid_Main thegrid;
@@ -94,9 +95,10 @@ namespace OpenGridServices.GridServer
94 Cfg = this.LoadConfigDll(this.ConfigDll); 95 Cfg = this.LoadConfigDll(this.ConfigDll);
95 Cfg.InitConfig(); 96 Cfg.InitConfig();
96 97
97 m_console.WriteLine("Main.cs:Startup() - Connecting to MySql Server"); 98 m_console.WriteLine("Main.cs:Startup() - Connecting to Storage Server");
98 m_gridManager = new GridManager(); 99 m_gridManager = new GridManager();
99 m_gridManager.AddPlugin("OpenGrid.Framework.Data.MySQL.dll"); // Made of win 100 m_gridManager.AddPlugin(GridDll); // Made of win
101 m_gridManager.defaultRecvKey = Cfg.SimRecvKey;
100 102
101 m_console.WriteLine("Main.cs:Startup() - Starting HTTP process"); 103 m_console.WriteLine("Main.cs:Startup() - Starting HTTP process");
102 BaseHttpServer httpServer = new BaseHttpServer(8001); 104 BaseHttpServer httpServer = new BaseHttpServer(8001);