aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Application
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Application')
-rw-r--r--OpenSim/Region/Application/IApplicationPlugin.cs4
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs41
2 files changed, 17 insertions, 28 deletions
diff --git a/OpenSim/Region/Application/IApplicationPlugin.cs b/OpenSim/Region/Application/IApplicationPlugin.cs
index 7ca4383..e1187ae 100644
--- a/OpenSim/Region/Application/IApplicationPlugin.cs
+++ b/OpenSim/Region/Application/IApplicationPlugin.cs
@@ -26,15 +26,15 @@
26 */ 26 */
27 27
28using Mono.Addins; 28using Mono.Addins;
29using OpenSim.Framework;
29 30
30[assembly : AddinRoot("OpenSim", "0.5")] 31[assembly : AddinRoot("OpenSim", "0.5")]
31 32
32namespace OpenSim 33namespace OpenSim
33{ 34{
34 [TypeExtensionPoint("/OpenSim/Startup")] 35 [TypeExtensionPoint("/OpenSim/Startup")]
35 public interface IApplicationPlugin 36 public interface IApplicationPlugin : IPlugin
36 { 37 {
37 void Initialise(OpenSimBase openSim); 38 void Initialise(OpenSimBase openSim);
38 void Close();
39 } 39 }
40} 40}
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 49e1da3..d0d5378 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -149,24 +149,6 @@ namespace OpenSim
149 { 149 {
150 IConfig startupConfig = configSource.Configs["Startup"]; 150 IConfig startupConfig = configSource.Configs["Startup"];
151 151
152 // The Mono addin manager (in Mono.Addins.dll version 0.2.0.0) occasionally seems to corrupt its addin cache
153 // Hence, as a temporary solution we'll remove it before each startup
154 if (Directory.Exists("addin-db-000"))
155 Directory.Delete("addin-db-000", true);
156
157 if (Directory.Exists("addin-db-001"))
158 Directory.Delete("addin-db-001", true);
159
160 // This blocks the scanning warnings from outputing to the console.
161 TextWriter oldOutput = Console.Out;
162 Console.SetOut(new StreamWriter(Stream.Null));
163
164 AddinManager.Initialize(".");
165 AddinManager.Registry.Update(null);
166
167 // Returns the console.writelines back to the console's stream
168 Console.SetOut(oldOutput);
169
170 Application.iniFilePath = startupConfig.GetString("inifile", "OpenSim.ini"); 152 Application.iniFilePath = startupConfig.GetString("inifile", "OpenSim.ini");
171 153
172 m_config = new OpenSimConfigSource(); 154 m_config = new OpenSimConfigSource();
@@ -347,6 +329,19 @@ namespace OpenSim
347 m_networkServersInfo.loadFromConfiguration(m_config.Source); 329 m_networkServersInfo.loadFromConfiguration(m_config.Source);
348 } 330 }
349 331
332 protected void plugin_initialiser_ (IPlugin plugin)
333 {
334 IApplicationPlugin p = plugin as IApplicationPlugin;
335 p.Initialise (this);
336 }
337
338 protected void LoadPlugins()
339 {
340 PluginLoader<IApplicationPlugin> loader = new PluginLoader<IApplicationPlugin> (".");
341 loader.Load ("/OpenSim/Startup", plugin_initialiser_);
342 m_plugins = loader.Plugins;
343 }
344
350 /// <summary> 345 /// <summary>
351 /// Performs initialisation of the scene, such as loading configuration from disk. 346 /// Performs initialisation of the scene, such as loading configuration from disk.
352 /// </summary> 347 /// </summary>
@@ -403,14 +398,7 @@ namespace OpenSim
403 // Create a ModuleLoader instance 398 // Create a ModuleLoader instance
404 m_moduleLoader = new ModuleLoader(m_config.Source); 399 m_moduleLoader = new ModuleLoader(m_config.Source);
405 400
406 ExtensionNodeList nodes = AddinManager.GetExtensionNodes("/OpenSim/Startup"); 401 LoadPlugins();
407 foreach (TypeExtensionNode node in nodes)
408 {
409 m_log.InfoFormat("[PLUGINS]: Loading OpenSim application plugin {0}", node.Path);
410 IApplicationPlugin plugin = (IApplicationPlugin)node.CreateInstance();
411 plugin.Initialise(this);
412 m_plugins.Add(plugin);
413 }
414 } 402 }
415 403
416 protected override void Initialize() 404 protected override void Initialize()
@@ -740,3 +728,4 @@ namespace OpenSim
740 } 728 }
741} 729}
742 730
731