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

View File

@ -47,6 +47,7 @@ namespace OpenGridServices.GridServer
public class OpenGrid_Main : BaseServer, conscmd_callback
{
private string ConfigDll = "OpenGrid.Config.GridConfigDb4o.dll";
private string GridDll = "OpenGrid.Framework.Data.DB4o.dll";
public GridConfig Cfg;
public static OpenGrid_Main thegrid;
@ -94,9 +95,9 @@ namespace OpenGridServices.GridServer
Cfg = this.LoadConfigDll(this.ConfigDll);
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.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");
BaseHttpServer httpServer = new BaseHttpServer(8001);