From 7fd63d9dc84cce5a6e6b177ff3b62598b08978f4 Mon Sep 17 00:00:00 2001
From: Charles Krinke
Date: Thu, 10 Jul 2008 13:45:46 +0000
Subject: Mantis#1682. Thank you kindly, Sempuki for a patch that: Move control
of Mono.Addins from source attributes to external XML files. This removes a
lot of coupling of the source with Mono.Addins
---
.../LoadRegions/LoadRegionsPlugin.cs | 5 --
.../RemoteController/RemoteAdminPlugin.cs | 5 --
.../Rest/Inventory/RestHandler.cs | 7 ---
.../ApplicationPlugins/Rest/Regions/GETHandler.cs | 1 -
.../ApplicationPlugins/Rest/Regions/POSTHandler.cs | 1 -
.../Rest/Regions/RestRegionPlugin.cs | 6 ---
OpenSim/ApplicationPlugins/Rest/RestPlugin.cs | 6 ---
OpenSim/Framework/PluginLoader.cs | 59 +++++++++++++---------
OpenSim/Grid/GridServer/GridServerBase.cs | 3 +-
OpenSim/Grid/GridServer/IGridPlugin.cs | 4 --
OpenSim/Region/Application/IApplicationPlugin.cs | 4 --
OpenSim/Region/Application/OpenSimBase.cs | 4 +-
bin/addins/LoadRegionsPlugin.addin.xml | 11 ++++
bin/addins/OpenSim.Grid.GridServer.host.addins | 3 ++
bin/addins/OpenSim.Grid.Gridserver.addin.xml | 8 +++
bin/addins/OpenSim.addin.xml | 8 +++
bin/addins/OpenSim.host.addins | 6 +++
bin/addins/RemoteAdminPlugin.addin.xml | 11 ++++
bin/addins/RemoteAdminPlugin.xml | 11 ++++
bin/addins/RestHandler.addin.xml | 11 ++++
bin/addins/RestRegionPlugin.addin.xml | 11 ++++
21 files changed, 118 insertions(+), 67 deletions(-)
create mode 100644 bin/addins/LoadRegionsPlugin.addin.xml
create mode 100644 bin/addins/OpenSim.Grid.GridServer.host.addins
create mode 100644 bin/addins/OpenSim.Grid.Gridserver.addin.xml
create mode 100644 bin/addins/OpenSim.addin.xml
create mode 100644 bin/addins/OpenSim.host.addins
create mode 100644 bin/addins/RemoteAdminPlugin.addin.xml
create mode 100644 bin/addins/RemoteAdminPlugin.xml
create mode 100644 bin/addins/RestHandler.addin.xml
create mode 100644 bin/addins/RestRegionPlugin.addin.xml
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
index 6743fb4..523f9fc 100644
--- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
+++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
@@ -28,18 +28,13 @@
using System.Reflection;
using System.Threading;
using log4net;
-using Mono.Addins;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Framework.RegionLoader.Filesystem;
using OpenSim.Framework.RegionLoader.Web;
-[assembly : Addin]
-[assembly : AddinDependency("OpenSim", "0.5")]
-
namespace OpenSim.ApplicationPlugins.LoadRegions
{
- [Extension("/OpenSim/Startup")]
public class LoadRegionsPlugin : IApplicationPlugin
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index e3a0321..3f6869e 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -33,19 +33,14 @@ using System.Reflection;
using System.Timers;
using libsecondlife;
using log4net;
-using Mono.Addins;
using Nwc.XmlRpc;
using OpenSim.Framework;
using OpenSim.Framework.Servers;
using OpenSim.Region.Environment.Modules.World.Terrain;
using OpenSim.Region.Environment.Scenes;
-[assembly : Addin]
-[assembly : AddinDependency("OpenSim", "0.5")]
-
namespace OpenSim.ApplicationPlugins.RemoteController
{
- [Extension("/OpenSim/Startup")]
public class RemoteAdminPlugin : IApplicationPlugin
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs
index c351272..1ec3567 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs
@@ -32,16 +32,9 @@ using System.Reflection;
using OpenSim.Framework;
using OpenSim.Framework.Servers;
using OpenSim.ApplicationPlugins.Rest;
-using Mono.Addins;
-
-[assembly : Addin]
-[assembly : AddinDependency("OpenSim", "0.5")]
namespace OpenSim.ApplicationPlugins.Rest.Inventory
{
-
- [Extension("/OpenSim/Startup")]
-
public class RestHandler : RestPlugin, IHttpAgentHandler
{
diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs b/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs
index a605d09..2734c77 100644
--- a/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs
@@ -37,7 +37,6 @@ using System.Timers;
using System.Xml;
using System.Xml.Serialization;
using libsecondlife;
-using Mono.Addins;
using Nwc.XmlRpc;
using Nini.Config;
using OpenSim.Framework;
diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs b/OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs
index e6131f1..a40af29 100644
--- a/OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs
@@ -37,7 +37,6 @@ using System.Timers;
using System.Xml;
using System.Xml.Serialization;
using libsecondlife;
-using Mono.Addins;
using Nwc.XmlRpc;
using Nini.Config;
using OpenSim.Framework;
diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/RestRegionPlugin.cs b/OpenSim/ApplicationPlugins/Rest/Regions/RestRegionPlugin.cs
index 9d68225..5ec2526 100644
--- a/OpenSim/ApplicationPlugins/Rest/Regions/RestRegionPlugin.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Regions/RestRegionPlugin.cs
@@ -37,7 +37,6 @@ using System.Timers;
using System.Xml;
using System.Xml.Serialization;
using libsecondlife;
-using Mono.Addins;
using Nwc.XmlRpc;
using Nini.Config;
using OpenSim.Framework;
@@ -47,13 +46,8 @@ using OpenSim.Framework.Communications;
using OpenSim.Region.Environment.Scenes;
using OpenSim.ApplicationPlugins.Rest;
-[assembly : Addin]
-[assembly : AddinDependency("OpenSim", "0.5")]
-
namespace OpenSim.ApplicationPlugins.Rest.Regions
{
-
- [Extension("/OpenSim/Startup")]
public partial class RestRegionPlugin : RestPlugin
{
private static XmlSerializerNamespaces _xmlNs;
diff --git a/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs b/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs
index 78e0e66..1f633d5 100644
--- a/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs
+++ b/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs
@@ -35,7 +35,6 @@ using System.Reflection;
using System.Timers;
using System.Xml;
using libsecondlife;
-using Mono.Addins;
using Nwc.XmlRpc;
using Nini.Config;
using OpenSim.Framework;
@@ -44,13 +43,8 @@ using OpenSim.Framework.Servers;
using OpenSim.Framework.Communications;
using OpenSim.Region.Environment.Scenes;
-// [assembly : Addin]
-// [assembly : AddinDependency("OpenSim", "0.5")]
-
namespace OpenSim.ApplicationPlugins.Rest
{
-
- // [Extension("/OpenSim/Startup")]
public abstract class RestPlugin : IApplicationPlugin
{
#region properties
diff --git a/OpenSim/Framework/PluginLoader.cs b/OpenSim/Framework/PluginLoader.cs
index 9104958..cfc1d7c 100644
--- a/OpenSim/Framework/PluginLoader.cs
+++ b/OpenSim/Framework/PluginLoader.cs
@@ -55,6 +55,7 @@ namespace OpenSim.Framework
}
///
+
/// Generic Plugin Loader
///
public class PluginLoader : IDisposable where T : IPlugin
@@ -66,16 +67,17 @@ namespace OpenSim.Framework
private PluginInitialiserBase initialiser;
private Dictionary constraints
= new Dictionary();
-
+
+ private static bool runonce = false;
private static readonly ILog log
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
+
public PluginInitialiserBase Initialiser
{
set { initialiser = value; }
get { return initialiser; }
}
-
+
public List Plugins
{
get { return loaded; }
@@ -84,25 +86,19 @@ namespace OpenSim.Framework
public PluginLoader ()
{
Initialiser = new PluginInitialiserBase();
+ initialise_plugin_dir_ (".");
}
public PluginLoader (PluginInitialiserBase init)
{
- Initialiser = init;
+ Initialiser = init;
+ initialise_plugin_dir_ (".");
}
public PluginLoader (PluginInitialiserBase init, string dir)
{
- Initialiser = init;
- AddPluginDir (dir);
- }
-
- public void AddPluginDir (string dir)
- {
- suppress_console_output_ (true);
- AddinManager.Initialize (dir);
- AddinManager.Registry.Update (null);
- suppress_console_output_ (false);
+ Initialiser = init;
+ initialise_plugin_dir_ (dir);
}
public void AddExtensionPoint (string extpoint)
@@ -114,22 +110,21 @@ namespace OpenSim.Framework
{
constraints.Add (extpoint, cons);
}
-
- public void Load (string extpoint, string dir)
+
+ public void Load (string extpoint)
{
- AddPluginDir (dir);
AddExtensionPoint (extpoint);
Load();
}
public void Load ()
{
- suppress_console_output_ (true);
- AddinManager.Registry.Update (null);
- suppress_console_output_ (false);
+ log.Info("[PLUGINS]: Begin Loading " + AddinManager.Registry.RegistryPath);
foreach (string ext in extpoints)
{
+ log.Info("[PLUGINS]: Loading extension point " + ext);
+
if (constraints.ContainsKey (ext))
{
IPluginConstraint cons = constraints [ext];
@@ -155,9 +150,25 @@ namespace OpenSim.Framework
p.Dispose ();
}
- public void ClearCache()
+ private void initialise_plugin_dir_ (string dir)
+ {
+ if (runonce == true)
+ return;
+
+ log.Info("[PLUGINS]: Initialzing " + dir);
+
+ clear_registry_();
+ suppress_console_output_ (true);
+ AddinManager.Initialize (dir);
+ AddinManager.Registry.Update (null);
+ suppress_console_output_ (false);
+ runonce = true;
+ }
+
+ private void clear_registry_ ()
{
- // The Mono addin manager (in Mono.Addins.dll version 0.2.0.0) occasionally seems to corrupt its addin cache
+ // The Mono addin manager (in Mono.Addins.dll version 0.2.0.0)
+ // occasionally seems to corrupt its addin cache
// Hence, as a temporary solution we'll remove it before each startup
if (Directory.Exists("addin-db-000"))
Directory.Delete("addin-db-000", true);
@@ -225,7 +236,7 @@ namespace OpenSim.Framework
public PluginFilenameConstraint (string name)
{
filename = name;
-
+
}
public string Message
@@ -245,7 +256,7 @@ namespace OpenSim.Framework
string[] path = ns[0].Path.Split('/');
if (path [path.Length-1] == filename)
return false;
-
+
return true;
}
}
diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs
index 3cd7489..a8ebd27 100644
--- a/OpenSim/Grid/GridServer/GridServerBase.cs
+++ b/OpenSim/Grid/GridServer/GridServerBase.cs
@@ -31,7 +31,6 @@ using System.IO;
using System.Reflection;
using System.Timers;
using log4net;
-using Mono.Addins;
using OpenSim.Framework;
using OpenSim.Framework.Console;
using OpenSim.Framework.Servers;
@@ -121,7 +120,7 @@ namespace OpenSim.Grid.GridServer
PluginLoader loader =
new PluginLoader (new GridPluginInitialiser (this));
- loader.Load ("/OpenSim/GridServer", ".");
+ loader.Load ("/OpenSim/GridServer");
m_plugins = loader.Plugins;
}
diff --git a/OpenSim/Grid/GridServer/IGridPlugin.cs b/OpenSim/Grid/GridServer/IGridPlugin.cs
index 6593962..b8ac611 100644
--- a/OpenSim/Grid/GridServer/IGridPlugin.cs
+++ b/OpenSim/Grid/GridServer/IGridPlugin.cs
@@ -26,14 +26,10 @@
*
*/
-using Mono.Addins;
using OpenSim.Framework;
-[assembly : AddinRoot("OpenSim", "0.5")]
-
namespace OpenSim.Grid.GridServer
{
- [TypeExtensionPoint("/OpenSim/GridServer")]
public interface IGridPlugin : IPlugin
{
void Initialise(GridServerBase gridServer);
diff --git a/OpenSim/Region/Application/IApplicationPlugin.cs b/OpenSim/Region/Application/IApplicationPlugin.cs
index f122925..2e3122f 100644
--- a/OpenSim/Region/Application/IApplicationPlugin.cs
+++ b/OpenSim/Region/Application/IApplicationPlugin.cs
@@ -25,14 +25,10 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-using Mono.Addins;
using OpenSim.Framework;
-[assembly : AddinRoot("OpenSim", "0.5")]
-
namespace OpenSim
{
- [TypeExtensionPoint("/OpenSim/Startup")]
public interface IApplicationPlugin : IPlugin
{
void Initialise(OpenSimBase openSim);
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 37daf88..065d2f2 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -34,7 +34,6 @@ using System.Text;
using System.Threading;
using libsecondlife;
using log4net;
-using Mono.Addins;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Framework.Communications.Cache;
@@ -337,7 +336,7 @@ namespace OpenSim
PluginLoader loader =
new PluginLoader (new ApplicationPluginInitialiser (this));
- loader.Load ("/OpenSim/Startup", ".");
+ loader.Load ("/OpenSim/Startup");
m_plugins = loader.Plugins;
}
@@ -730,3 +729,4 @@ namespace OpenSim
+
diff --git a/bin/addins/LoadRegionsPlugin.addin.xml b/bin/addins/LoadRegionsPlugin.addin.xml
new file mode 100644
index 0000000..25fb4f7
--- /dev/null
+++ b/bin/addins/LoadRegionsPlugin.addin.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bin/addins/OpenSim.Grid.GridServer.host.addins b/bin/addins/OpenSim.Grid.GridServer.host.addins
new file mode 100644
index 0000000..c78dfc1
--- /dev/null
+++ b/bin/addins/OpenSim.Grid.GridServer.host.addins
@@ -0,0 +1,3 @@
+
+ /home/ryanm/Code/opensim/bin
+
diff --git a/bin/addins/OpenSim.Grid.Gridserver.addin.xml b/bin/addins/OpenSim.Grid.Gridserver.addin.xml
new file mode 100644
index 0000000..8168bb7
--- /dev/null
+++ b/bin/addins/OpenSim.Grid.Gridserver.addin.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/bin/addins/OpenSim.addin.xml b/bin/addins/OpenSim.addin.xml
new file mode 100644
index 0000000..04ddbf2
--- /dev/null
+++ b/bin/addins/OpenSim.addin.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/bin/addins/OpenSim.host.addins b/bin/addins/OpenSim.host.addins
new file mode 100644
index 0000000..6465d3c
--- /dev/null
+++ b/bin/addins/OpenSim.host.addins
@@ -0,0 +1,6 @@
+
+ /home/ryanm/Code/opensim/bin
+
+
+ C:\cfk2007\svnsugi\bin
+
diff --git a/bin/addins/RemoteAdminPlugin.addin.xml b/bin/addins/RemoteAdminPlugin.addin.xml
new file mode 100644
index 0000000..707859e
--- /dev/null
+++ b/bin/addins/RemoteAdminPlugin.addin.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bin/addins/RemoteAdminPlugin.xml b/bin/addins/RemoteAdminPlugin.xml
new file mode 100644
index 0000000..707859e
--- /dev/null
+++ b/bin/addins/RemoteAdminPlugin.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bin/addins/RestHandler.addin.xml b/bin/addins/RestHandler.addin.xml
new file mode 100644
index 0000000..9be870c
--- /dev/null
+++ b/bin/addins/RestHandler.addin.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bin/addins/RestRegionPlugin.addin.xml b/bin/addins/RestRegionPlugin.addin.xml
new file mode 100644
index 0000000..2520d4e
--- /dev/null
+++ b/bin/addins/RestRegionPlugin.addin.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
--
cgit v1.1