From 23ec21e44a2d7227ca56c31622e9b9b754e52879 Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Fri, 4 Jul 2008 03:11:53 +0000 Subject: Mantis#1647. Thank you very much, Sempuki for a patch that: Updates the previous module loader work. --- OpenSim/Grid/GridServer/GridServerBase.cs | 16 ++++++---------- OpenSim/Grid/GridServer/IGridPlugin.cs | 11 +++++++++++ 2 files changed, 17 insertions(+), 10 deletions(-) (limited to 'OpenSim/Grid') diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs index 010c250..3cd7489 100644 --- a/OpenSim/Grid/GridServer/GridServerBase.cs +++ b/OpenSim/Grid/GridServer/GridServerBase.cs @@ -87,7 +87,7 @@ namespace OpenSim.Grid.GridServer AddHttpHandlers(); - LoadGridPlugins(); + LoadPlugins(); m_httpServer.Start(); @@ -116,16 +116,12 @@ namespace OpenSim.Grid.GridServer m_httpServer.AddStreamHandler(new RestStreamHandler("POST", "/regions/", m_gridManager.RestSetRegionMethod)); } - protected void grid_plugin_initialiser_ (IPlugin plugin) + protected void LoadPlugins() { - IGridPlugin p = plugin as IGridPlugin; - p.Initialise (this); - } + PluginLoader loader = + new PluginLoader (new GridPluginInitialiser (this)); - protected void LoadGridPlugins() - { - PluginLoader loader = new PluginLoader ("."); - loader.Load ("/OpenSim/GridServer", grid_plugin_initialiser_); + loader.Load ("/OpenSim/GridServer", "."); m_plugins = loader.Plugins; } @@ -181,7 +177,7 @@ namespace OpenSim.Grid.GridServer public override void Shutdown() { - foreach (IGridPlugin plugin in m_plugins) plugin.Close(); + foreach (IGridPlugin plugin in m_plugins) plugin.Dispose(); base.Shutdown(); } diff --git a/OpenSim/Grid/GridServer/IGridPlugin.cs b/OpenSim/Grid/GridServer/IGridPlugin.cs index d51deb3..6593962 100644 --- a/OpenSim/Grid/GridServer/IGridPlugin.cs +++ b/OpenSim/Grid/GridServer/IGridPlugin.cs @@ -39,4 +39,15 @@ namespace OpenSim.Grid.GridServer void Initialise(GridServerBase gridServer); void Close(); } + + public class GridPluginInitialiser : PluginInitialiserBase + { + private GridServerBase server; + public GridPluginInitialiser (GridServerBase s) { server = s; } + public override void Initialise (IPlugin plugin) + { + IGridPlugin p = plugin as IGridPlugin; + p.Initialise (server); + } + } } -- cgit v1.1