Defaults to DB4o grid provider, loads storage engines correctly now. Tested and stable.

0.1-prestable
Adam Frisby 2007-05-06 23:41:50 +00:00
parent 284a3b49a9
commit 1b7f74bc7e
2 changed files with 23 additions and 20 deletions

View File

@ -23,27 +23,26 @@ namespace OpenGridServices.GridServer
/// <param name="FileName">The filename to the grid server plugin DLL</param> /// <param name="FileName">The filename to the grid server plugin DLL</param>
public void AddPlugin(string FileName) public void AddPlugin(string FileName)
{ {
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Storage: Attempting to load " + FileName);
Assembly pluginAssembly = Assembly.LoadFrom(FileName); Assembly pluginAssembly = Assembly.LoadFrom(FileName);
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Storage: Found " + pluginAssembly.GetTypes().Length + " interfaces.");
foreach (Type pluginType in pluginAssembly.GetTypes()) foreach (Type pluginType in pluginAssembly.GetTypes())
{ {
if (pluginType.IsPublic) if (!pluginType.IsAbstract)
{ {
if (!pluginType.IsAbstract) Type typeInterface = pluginType.GetInterface("IGridData", true);
{
Type typeInterface = pluginType.GetInterface("IGridData", true); if (typeInterface != null)
{
if (typeInterface != null) IGridData plug = (IGridData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
{ plug.Initialise();
IGridData plug = (IGridData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); this._plugins.Add(plug.getName(), plug);
plug.Initialise(); OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Storage: Added IGridData Interface");
this._plugins.Add(plug.getName(),plug); }
} typeInterface = null;
}
typeInterface = null;
}
}
} }
pluginAssembly = null; pluginAssembly = null;
@ -269,6 +268,7 @@ namespace OpenGridServices.GridServer
TheSim = new SimProfileData(); TheSim = new SimProfileData();
LLUUID UUID = new LLUUID(param); LLUUID UUID = new LLUUID(param);
TheSim.UUID = UUID; TheSim.UUID = UUID;
TheSim.regionRecvKey = "badger";// MAJORFIX
} }
XmlDocument doc = new XmlDocument(); XmlDocument doc = new XmlDocument();
@ -320,11 +320,13 @@ namespace OpenGridServices.GridServer
try try
{ {
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Attempting to add a new region to the grid - " + _plugins.Count + " storage provider(s) registered.");
foreach (KeyValuePair<string, IGridData> kvp in _plugins) foreach (KeyValuePair<string, IGridData> kvp in _plugins)
{ {
try try
{ {
kvp.Value.AddProfile(TheSim); kvp.Value.AddProfile(TheSim);
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("New sim added to grid (" + TheSim.regionName + ")");
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -47,6 +47,7 @@ namespace OpenGridServices.GridServer
public class OpenGrid_Main : BaseServer, conscmd_callback public class OpenGrid_Main : BaseServer, conscmd_callback
{ {
private string ConfigDll = "OpenGrid.Config.GridConfigDb4o.dll"; private string ConfigDll = "OpenGrid.Config.GridConfigDb4o.dll";
private string GridDll = "OpenGrid.Framework.Data.DB4o.dll";
public GridConfig Cfg; public GridConfig Cfg;
public static OpenGrid_Main thegrid; public static OpenGrid_Main thegrid;
@ -94,9 +95,9 @@ namespace OpenGridServices.GridServer
Cfg = this.LoadConfigDll(this.ConfigDll); Cfg = this.LoadConfigDll(this.ConfigDll);
Cfg.InitConfig(); Cfg.InitConfig();
m_console.WriteLine("Main.cs:Startup() - Connecting to MySql Server"); m_console.WriteLine("Main.cs:Startup() - Connecting to Storage Server");
m_gridManager = new GridManager(); m_gridManager = new GridManager();
m_gridManager.AddPlugin("OpenGrid.Framework.Data.MySQL.dll"); // Made of win m_gridManager.AddPlugin(GridDll); // Made of win
m_console.WriteLine("Main.cs:Startup() - Starting HTTP process"); m_console.WriteLine("Main.cs:Startup() - Starting HTTP process");
BaseHttpServer httpServer = new BaseHttpServer(8001); BaseHttpServer httpServer = new BaseHttpServer(8001);