aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Application/OpenSimBase.cs
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/Region/Application/OpenSimBase.cs
parentMantis#1610. Thank you, Melanie for a patch that: (diff)
downloadopensim-SC_OLD-ca8d1d57e1bbf49cb52abe81b3a7246dacbe9b03.zip
opensim-SC_OLD-ca8d1d57e1bbf49cb52abe81b3a7246dacbe9b03.tar.gz
opensim-SC_OLD-ca8d1d57e1bbf49cb52abe81b3a7246dacbe9b03.tar.bz2
opensim-SC_OLD-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/Region/Application/OpenSimBase.cs41
1 files changed, 15 insertions, 26 deletions
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