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.Addins0.6.0-stable
parent
501f3ebd5d
commit
7fd63d9dc8
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -55,6 +55,7 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
/// Generic Plugin Loader
|
||||
/// </summary>
|
||||
public class PluginLoader <T> : IDisposable where T : IPlugin
|
||||
|
@ -67,6 +68,7 @@ namespace OpenSim.Framework
|
|||
private Dictionary<string,IPluginConstraint> constraints
|
||||
= new Dictionary<string,IPluginConstraint>();
|
||||
|
||||
private static bool runonce = false;
|
||||
private static readonly ILog log
|
||||
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
|
@ -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)
|
||||
|
@ -115,21 +111,20 @@ 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)
|
||||
{
|
||||
// The Mono addin manager (in Mono.Addins.dll version 0.2.0.0) occasionally seems to corrupt its addin cache
|
||||
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
|
||||
// Hence, as a temporary solution we'll remove it before each startup
|
||||
if (Directory.Exists("addin-db-000"))
|
||||
Directory.Delete("addin-db-000", true);
|
||||
|
|
|
@ -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<IGridPlugin> loader =
|
||||
new PluginLoader<IGridPlugin> (new GridPluginInitialiser (this));
|
||||
|
||||
loader.Load ("/OpenSim/GridServer", ".");
|
||||
loader.Load ("/OpenSim/GridServer");
|
||||
m_plugins = loader.Plugins;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<IApplicationPlugin> loader =
|
||||
new PluginLoader<IApplicationPlugin> (new ApplicationPluginInitialiser (this));
|
||||
|
||||
loader.Load ("/OpenSim/Startup", ".");
|
||||
loader.Load ("/OpenSim/Startup");
|
||||
m_plugins = loader.Plugins;
|
||||
}
|
||||
|
||||
|
@ -730,3 +729,4 @@ namespace OpenSim
|
|||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<Addin>
|
||||
<Runtime>
|
||||
<Import assembly="../OpenSim.ApplicationPlugins.LoadRegions.dll"/>
|
||||
</Runtime>
|
||||
<Dependencies>
|
||||
<Addin id="OpenSim" version="0.5" />
|
||||
</Dependencies>
|
||||
<Extension path = "/OpenSim/Startup">
|
||||
<Type type="OpenSim.ApplicationPlugins.LoadRegions.LoadRegionsPlugin" />
|
||||
</Extension>
|
||||
</Addin>
|
|
@ -0,0 +1,3 @@
|
|||
<Addins host-reference="/home/ryanm/Code/opensim/bin/OpenSim.Grid.GridServer.exe">
|
||||
<Directory>/home/ryanm/Code/opensim/bin</Directory>
|
||||
</Addins>
|
|
@ -0,0 +1,8 @@
|
|||
<Addin id="OpenSim" version="0.5" isroot="true">
|
||||
<Runtime>
|
||||
<Import assembly="../OpenSim.Grid.GridServer.exe"/>
|
||||
</Runtime>
|
||||
<ExtensionPoint path = "/OpenSim/GridServer">
|
||||
<ExtensionNode objectType="IGridPlugin"/>
|
||||
</ExtensionPoint>
|
||||
</Addin>
|
|
@ -0,0 +1,8 @@
|
|||
<Addin id="OpenSim" version="0.5" isroot="true">
|
||||
<Runtime>
|
||||
<Import assembly="../OpenSim.exe"/>
|
||||
</Runtime>
|
||||
<ExtensionPoint path = "/OpenSim/Startup">
|
||||
<ExtensionNode objectType="IApplicationPlugin"/>
|
||||
</ExtensionPoint>
|
||||
</Addin>
|
|
@ -0,0 +1,6 @@
|
|||
<Addins host-reference="/home/ryanm/Code/opensim/bin/OpenSim.exe">
|
||||
<Directory>/home/ryanm/Code/opensim/bin</Directory>
|
||||
</Addins>
|
||||
<Addins host-reference="C:\cfk2007\svnsugi\bin\OpenSim.exe">
|
||||
<Directory>C:\cfk2007\svnsugi\bin</Directory>
|
||||
</Addins>
|
|
@ -0,0 +1,11 @@
|
|||
<Addin>
|
||||
<Runtime>
|
||||
<Import assembly="../OpenSim.ApplicationPlugins.RemoteController.dll"/>
|
||||
</Runtime>
|
||||
<Dependencies>
|
||||
<Addin id="OpenSim" version="0.5" />
|
||||
</Dependencies>
|
||||
<Extension path = "/OpenSim/Startup">
|
||||
<Type type="OpenSim.ApplicationPlugins.RemoteController.RemoteAdminPlugin" />
|
||||
</Extension>
|
||||
</Addin>
|
|
@ -0,0 +1,11 @@
|
|||
<Addin>
|
||||
<Runtime>
|
||||
<Import assembly="../OpenSim.ApplicationPlugins.RemoteController.dll"/>
|
||||
</Runtime>
|
||||
<Dependencies>
|
||||
<Addin id="OpenSim" version="0.5" />
|
||||
</Dependencies>
|
||||
<Extension path = "/OpenSim/Startup">
|
||||
<Type type="OpenSim.ApplicationPlugins.RemoteController.RemoteAdminPlugin" />
|
||||
</Extension>
|
||||
</Addin>
|
|
@ -0,0 +1,11 @@
|
|||
<Addin>
|
||||
<Runtime>
|
||||
<Import assembly="../OpenSim.ApplicationPlugins.Rest.Inventory.dll"/>
|
||||
</Runtime>
|
||||
<Dependencies>
|
||||
<Addin id="OpenSim" version="0.5" />
|
||||
</Dependencies>
|
||||
<Extension path = "/OpenSim/Startup">
|
||||
<Type type="OpenSim.ApplicationPlugins.Rest.Inventory.RestHandler" />
|
||||
</Extension>
|
||||
</Addin>
|
|
@ -0,0 +1,11 @@
|
|||
<Addin>
|
||||
<Runtime>
|
||||
<Import assembly="../OpenSim.ApplicationPlugins.Rest.Regions.dll"/>
|
||||
</Runtime>
|
||||
<Dependencies>
|
||||
<Addin id="OpenSim" version="0.5" />
|
||||
</Dependencies>
|
||||
<Extension path = "/OpenSim/Startup">
|
||||
<Type type="OpenSim.ApplicationPlugins.Rest.Regions.RestRegionPlugin" />
|
||||
</Extension>
|
||||
</Addin>
|
Loading…
Reference in New Issue