aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid
diff options
context:
space:
mode:
authorCharles Krinke2008-06-27 02:15:57 +0000
committerCharles Krinke2008-06-27 02:15:57 +0000
commitca8d1d57e1bbf49cb52abe81b3a7246dacbe9b03 (patch)
tree97f8cce96ea2e98b96b36e523c59361bf00f63b8 /OpenSim/Grid
parentMantis#1610. Thank you, Melanie for a patch that: (diff)
downloadopensim-SC-ca8d1d57e1bbf49cb52abe81b3a7246dacbe9b03.zip
opensim-SC-ca8d1d57e1bbf49cb52abe81b3a7246dacbe9b03.tar.gz
opensim-SC-ca8d1d57e1bbf49cb52abe81b3a7246dacbe9b03.tar.bz2
opensim-SC-ca8d1d57e1bbf49cb52abe81b3a7246dacbe9b03.tar.xz
Mantis#1591. Thank you graciously, Sempuki for a patch that:
Currently module loading is done ad-hoc. I propose creating a simple loader class that leverages Mono.Addins (and perhaps the new .NET addins when they become available in mono). Attached is a basic patch for review that compiles into HEAD, but doesn't yet replace any existing ad-hoc loaders.
Diffstat (limited to '')
-rw-r--r--OpenSim/Grid/GridServer/GridServerBase.cs27
-rw-r--r--OpenSim/Grid/GridServer/IGridPlugin.cs3
2 files changed, 11 insertions, 19 deletions
diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs
index 7891c29..010c250 100644
--- a/OpenSim/Grid/GridServer/GridServerBase.cs
+++ b/OpenSim/Grid/GridServer/GridServerBase.cs
@@ -116,26 +116,17 @@ namespace OpenSim.Grid.GridServer
116 m_httpServer.AddStreamHandler(new RestStreamHandler("POST", "/regions/", m_gridManager.RestSetRegionMethod)); 116 m_httpServer.AddStreamHandler(new RestStreamHandler("POST", "/regions/", m_gridManager.RestSetRegionMethod));
117 } 117 }
118 118
119 protected void LoadGridPlugins() 119 protected void grid_plugin_initialiser_ (IPlugin plugin)
120 { 120 {
121 // Temporary hack to stop mono-addins scanning warnings from coming out on the console 121 IGridPlugin p = plugin as IGridPlugin;
122 TextWriter oldOutput = Console.Out; 122 p.Initialise (this);
123 Console.SetOut(new StreamWriter(Stream.Null)); 123 }
124
125 AddinManager.Initialize(".");
126 AddinManager.Registry.Update(null);
127
128 // Returns the console.writelines back to the console's stream
129 Console.SetOut(oldOutput);
130 124
131 ExtensionNodeList nodes = AddinManager.GetExtensionNodes("/OpenSim/GridServer"); 125 protected void LoadGridPlugins()
132 foreach (TypeExtensionNode node in nodes) 126 {
133 { 127 PluginLoader<IGridPlugin> loader = new PluginLoader<IGridPlugin> (".");
134 m_log.Info("[GRID PLUGINS]: Loading OpenSim plugin " + node.Path); 128 loader.Load ("/OpenSim/GridServer", grid_plugin_initialiser_);
135 IGridPlugin plugin = (IGridPlugin)node.CreateInstance(); 129 m_plugins = loader.Plugins;
136 plugin.Initialise(this);
137 m_plugins.Add(plugin);
138 }
139 } 130 }
140 131
141 protected virtual void SetupGridManager() 132 protected virtual void SetupGridManager()
diff --git a/OpenSim/Grid/GridServer/IGridPlugin.cs b/OpenSim/Grid/GridServer/IGridPlugin.cs
index 47273a2..d51deb3 100644
--- a/OpenSim/Grid/GridServer/IGridPlugin.cs
+++ b/OpenSim/Grid/GridServer/IGridPlugin.cs
@@ -27,13 +27,14 @@
27*/ 27*/
28 28
29using Mono.Addins; 29using Mono.Addins;
30using OpenSim.Framework;
30 31
31[assembly : AddinRoot("OpenSim", "0.5")] 32[assembly : AddinRoot("OpenSim", "0.5")]
32 33
33namespace OpenSim.Grid.GridServer 34namespace OpenSim.Grid.GridServer
34{ 35{
35 [TypeExtensionPoint("/OpenSim/GridServer")] 36 [TypeExtensionPoint("/OpenSim/GridServer")]
36 public interface IGridPlugin 37 public interface IGridPlugin : IPlugin
37 { 38 {
38 void Initialise(GridServerBase gridServer); 39 void Initialise(GridServerBase gridServer);
39 void Close(); 40 void Close();