aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
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
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 'OpenSim')
-rw-r--r--OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs17
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs17
-rw-r--r--OpenSim/ApplicationPlugins/Rest/RestPlugin.cs16
-rw-r--r--OpenSim/Data/AssetDataBase.cs1
-rw-r--r--OpenSim/Data/MSSQL/MSSQLAssetData.cs2
-rw-r--r--OpenSim/Data/MySQL/MySQLAssetData.cs4
-rw-r--r--OpenSim/Data/NHibernate/NHibernateAssetData.cs8
-rw-r--r--OpenSim/Data/SQLite/SQLiteAssetData.cs2
-rw-r--r--OpenSim/Framework/IAssetProvider.cs2
-rw-r--r--OpenSim/Framework/IPlugin.cs18
-rw-r--r--OpenSim/Framework/PluginLoader.cs115
-rw-r--r--OpenSim/Framework/Servers/OSHttpRequestPump.cs2
-rw-r--r--OpenSim/Grid/GridServer/GridServerBase.cs27
-rw-r--r--OpenSim/Grid/GridServer/IGridPlugin.cs3
-rw-r--r--OpenSim/Region/Application/IApplicationPlugin.cs4
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs41
16 files changed, 217 insertions, 62 deletions
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
index 4b11fd4..6743fb4 100644
--- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
+++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
@@ -46,6 +46,19 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
46 46
47 #region IApplicationPlugin Members 47 #region IApplicationPlugin Members
48 48
49 // TODO: required by IPlugin, but likely not at all right
50 string m_name = "LoadRegionsPlugin";
51 string m_version = "0.0";
52
53 public string Version { get { return m_version; } }
54 public string Name { get { return m_name; } }
55
56 public void Initialise()
57 {
58 m_log.Info("[LOADREGIONS]: " + Name + " cannot be default-initialized!");
59 throw new PluginNotInitialisedException (Name);
60 }
61
49 public void Initialise(OpenSimBase openSim) 62 public void Initialise(OpenSimBase openSim)
50 { 63 {
51 m_log.Info("[LOADREGIONS]: Load Regions addin being initialised"); 64 m_log.Info("[LOADREGIONS]: Load Regions addin being initialised");
@@ -78,7 +91,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
78 openSim.ModuleLoader.ClearCache(); 91 openSim.ModuleLoader.ClearCache();
79 } 92 }
80 93
81 public void Close() 94 public void Dispose()
82 { 95 {
83 } 96 }
84 97
@@ -113,4 +126,4 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
113 } 126 }
114 } 127 }
115 } 128 }
116} \ No newline at end of file 129}
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 5063375..d3fe0e0 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -54,6 +54,19 @@ namespace OpenSim.ApplicationPlugins.RemoteController
54 private BaseHttpServer m_httpd; 54 private BaseHttpServer m_httpd;
55 private string requiredPassword = String.Empty; 55 private string requiredPassword = String.Empty;
56 56
57 // TODO: required by IPlugin, but likely not at all right
58 string m_name = "RemoteAdminPlugin";
59 string m_version = "0.0";
60
61 public string Version { get { return m_version; } }
62 public string Name { get { return m_name; } }
63
64 public void Initialise()
65 {
66 m_log.Info("[RADMIN]: " + Name + " cannot be default-initialized!");
67 throw new PluginNotInitialisedException (Name);
68 }
69
57 public void Initialise(OpenSimBase openSim) 70 public void Initialise(OpenSimBase openSim)
58 { 71 {
59 try 72 try
@@ -607,8 +620,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
607 return response; 620 return response;
608 } 621 }
609 622
610 public void Close() 623 public void Dispose()
611 { 624 {
612 } 625 }
613 } 626 }
614} \ No newline at end of file 627}
diff --git a/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs b/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs
index 4558d4d..78e0e66 100644
--- a/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs
+++ b/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs
@@ -188,6 +188,17 @@ namespace OpenSim.ApplicationPlugins.Rest
188 188
189 189
190 #region methods 190 #region methods
191 // TODO: required by IPlugin, but likely not at all right
192 string m_version = "0.0";
193
194 public string Version { get { return m_version; } }
195
196 public void Initialise()
197 {
198 m_log.Info("[RESTPLUGIN]: " + Name + " cannot be default-initialized!");
199 throw new PluginNotInitialisedException (Name);
200 }
201
191 /// <summary> 202 /// <summary>
192 /// This method is called by OpenSimMain immediately after loading the 203 /// This method is called by OpenSimMain immediately after loading the
193 /// plugin and after basic server setup, but before running any server commands. 204 /// plugin and after basic server setup, but before running any server commands.
@@ -357,6 +368,11 @@ namespace OpenSim.ApplicationPlugins.Rest
357 _agents = null; 368 _agents = null;
358 } 369 }
359 370
371 public virtual void Dispose()
372 {
373 Close();
374 }
375
360 /// <summary> 376 /// <summary>
361 /// Return a failure message. 377 /// Return a failure message.
362 /// </summary> 378 /// </summary>
diff --git a/OpenSim/Data/AssetDataBase.cs b/OpenSim/Data/AssetDataBase.cs
index e3b5c25..ca1de5a 100644
--- a/OpenSim/Data/AssetDataBase.cs
+++ b/OpenSim/Data/AssetDataBase.cs
@@ -42,5 +42,6 @@ namespace OpenSim.Data
42 public abstract string Name { get; } 42 public abstract string Name { get; }
43 public abstract void Initialise(string connect); 43 public abstract void Initialise(string connect);
44 public abstract void Initialise(); 44 public abstract void Initialise();
45 public abstract void Dispose();
45 } 46 }
46} 47}
diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs
index 50e2e3a..44d78ed 100644
--- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs
@@ -218,6 +218,8 @@ namespace OpenSim.Data.MSSQL
218 218
219 #region IPlugin Members 219 #region IPlugin Members
220 220
221 override public void Dispose() { }
222
221 /// <summary> 223 /// <summary>
222 /// <para>Initialises asset interface</para> 224 /// <para>Initialises asset interface</para>
223 /// <para> 225 /// <para>
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs
index a64a256..ac7fa1d 100644
--- a/OpenSim/Data/MySQL/MySQLAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLAssetData.cs
@@ -39,7 +39,7 @@ namespace OpenSim.Data.MySQL
39 /// <summary> 39 /// <summary>
40 /// A MySQL Interface for the Asset Server 40 /// A MySQL Interface for the Asset Server
41 /// </summary> 41 /// </summary>
42 internal class MySQLAssetData : AssetDataBase, IPlugin 42 internal class MySQLAssetData : AssetDataBase
43 { 43 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 45
@@ -109,6 +109,8 @@ namespace OpenSim.Data.MySQL
109 109
110 } 110 }
111 111
112 override public void Dispose() { }
113
112 #region IAssetProvider Members 114 #region IAssetProvider Members
113 115
114 /// <summary> 116 /// <summary>
diff --git a/OpenSim/Data/NHibernate/NHibernateAssetData.cs b/OpenSim/Data/NHibernate/NHibernateAssetData.cs
index 89f907f..a339ee3 100644
--- a/OpenSim/Data/NHibernate/NHibernateAssetData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateAssetData.cs
@@ -43,7 +43,7 @@ namespace OpenSim.Data.NHibernate
43 /// <summary> 43 /// <summary>
44 /// A User storage interface for the DB4o database system 44 /// A User storage interface for the DB4o database system
45 /// </summary> 45 /// </summary>
46 public class NHibernateAssetData : AssetDataBase, IDisposable 46 public class NHibernateAssetData : AssetDataBase
47 { 47 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 49
@@ -51,6 +51,8 @@ namespace OpenSim.Data.NHibernate
51 private ISessionFactory factory; 51 private ISessionFactory factory;
52 private ISession session; 52 private ISession session;
53 53
54 override public void Dispose() { }
55
54 public override void Initialise() 56 public override void Initialise()
55 { 57 {
56 Initialise("SQLiteDialect;SqliteClientDriver;URI=file:Asset.db,version=3"); 58 Initialise("SQLiteDialect;SqliteClientDriver;URI=file:Asset.db,version=3");
@@ -173,9 +175,5 @@ namespace OpenSim.Data.NHibernate
173 get { return "0.1"; } 175 get { return "0.1"; }
174 } 176 }
175 177
176 public void Dispose()
177 {
178
179 }
180 } 178 }
181} 179}
diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs
index f560b9e..018501f 100644
--- a/OpenSim/Data/SQLite/SQLiteAssetData.cs
+++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs
@@ -56,6 +56,8 @@ namespace OpenSim.Data.SQLite
56 56
57 private SqliteConnection m_conn; 57 private SqliteConnection m_conn;
58 58
59 override public void Dispose() { }
60
59 /// <summary> 61 /// <summary>
60 /// <list type="bullet"> 62 /// <list type="bullet">
61 /// <item>Initialises AssetData interface</item> 63 /// <item>Initialises AssetData interface</item>
diff --git a/OpenSim/Framework/IAssetProvider.cs b/OpenSim/Framework/IAssetProvider.cs
index 5c02ff1..dcb79ea 100644
--- a/OpenSim/Framework/IAssetProvider.cs
+++ b/OpenSim/Framework/IAssetProvider.cs
@@ -38,4 +38,4 @@ namespace OpenSim.Framework
38 void CommitAssets(); // force a sync to the database 38 void CommitAssets(); // force a sync to the database
39 void Initialise(string connect); 39 void Initialise(string connect);
40 } 40 }
41} \ No newline at end of file 41}
diff --git a/OpenSim/Framework/IPlugin.cs b/OpenSim/Framework/IPlugin.cs
index 8a0b2b1..342918c 100644
--- a/OpenSim/Framework/IPlugin.cs
+++ b/OpenSim/Framework/IPlugin.cs
@@ -25,12 +25,24 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
29
28namespace OpenSim.Framework 30namespace OpenSim.Framework
29{ 31{
30 /// <summary> 32 /// <summary>
33 /// Exception thrown if Initialise has been called, but failed.
34 /// </summary>
35 public class PluginNotInitialisedException : Exception
36 {
37 public PluginNotInitialisedException () : base() {}
38 public PluginNotInitialisedException (string msg) : base(msg) {}
39 public PluginNotInitialisedException (string msg, Exception e) : base(msg, e) {}
40 }
41
42 /// <summary>
31 /// This interface, describes a generic plugin 43 /// This interface, describes a generic plugin
32 /// </summary> 44 /// </summary>
33 public interface IPlugin 45 public interface IPlugin : System.IDisposable
34 { 46 {
35 /// <summary> 47 /// <summary>
36 /// Returns the plugin version 48 /// Returns the plugin version
@@ -45,8 +57,8 @@ namespace OpenSim.Framework
45 string Name { get; } 57 string Name { get; }
46 58
47 /// <summary> 59 /// <summary>
48 /// Initialises the plugin (artificial constructor) 60 /// Default-initialises the plugin
49 /// </summary> 61 /// </summary>
50 void Initialise(); 62 void Initialise();
51 } 63 }
52} \ No newline at end of file 64}
diff --git a/OpenSim/Framework/PluginLoader.cs b/OpenSim/Framework/PluginLoader.cs
new file mode 100644
index 0000000..26df3d1
--- /dev/null
+++ b/OpenSim/Framework/PluginLoader.cs
@@ -0,0 +1,115 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.IO;
30using System.Collections.Generic;
31using System.Reflection;
32using log4net;
33using Mono.Addins;
34
35namespace OpenSim.Framework
36{
37 public class PluginLoader <T> : IDisposable where T : IPlugin
38 {
39 private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
40 private List<T> loaded = new List<T>();
41
42 public PluginLoader (string dir)
43 {
44 AddPluginDir (dir);
45 }
46
47 public void AddPluginDir (string dir)
48 {
49 suppress_console_output_ (true);
50 AddinManager.Initialize (dir);
51 suppress_console_output_ (false);
52 }
53
54 public delegate void Initialiser (IPlugin p);
55 private void default_initialiser_ (IPlugin p) { p.Initialise(); }
56
57 public void Load (string extpoint)
58 {
59 Load (extpoint, default_initialiser_);
60 }
61
62 public void Load (string extpoint, Initialiser initialize)
63 {
64 AddinManager.Registry.Update (null);
65
66 ExtensionNodeList ns = AddinManager.GetExtensionNodes(extpoint);
67 foreach (TypeExtensionNode n in ns)
68 {
69 T p = (T) n.CreateInstance();
70 initialize (p);
71 Plugins.Add (p);
72
73 log.Info("[PLUGINS]: Loading plugin " + n.Path + "/" + p.Name);
74 }
75 }
76
77 public List<T> Plugins
78 {
79 get { return loaded; }
80 }
81
82 public void Dispose ()
83 {
84 foreach (T p in Plugins)
85 p.Dispose ();
86 }
87
88 public void ClearCache()
89 {
90 // The Mono addin manager (in Mono.Addins.dll version 0.2.0.0) occasionally seems to corrupt its addin cache
91 // Hence, as a temporary solution we'll remove it before each startup
92 if (Directory.Exists("addin-db-000"))
93 Directory.Delete("addin-db-000", true);
94
95 if (Directory.Exists("addin-db-001"))
96 Directory.Delete("addin-db-001", true);
97 }
98
99 private static TextWriter prev_console_;
100 public void suppress_console_output_ (bool save)
101 {
102 if (save)
103 {
104 prev_console_ = System.Console.Out;
105 System.Console.SetOut(new StreamWriter(Stream.Null));
106 }
107 else
108 {
109 if (prev_console_ != null)
110 System.Console.SetOut(prev_console_);
111 }
112 }
113
114 }
115}
diff --git a/OpenSim/Framework/Servers/OSHttpRequestPump.cs b/OpenSim/Framework/Servers/OSHttpRequestPump.cs
index 06e41e4..6214ab0 100644
--- a/OpenSim/Framework/Servers/OSHttpRequestPump.cs
+++ b/OpenSim/Framework/Servers/OSHttpRequestPump.cs
@@ -58,4 +58,4 @@ namespace OpenSim.Framework.Servers
58 return pumps; 58 return pumps;
59 } 59 }
60 } 60 }
61} \ No newline at end of file 61}
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();
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