Mantis#1682. Revert temporarily, Sempuki's mono addins patch

while he studies the issues in Windows a little bit.
0.6.0-stable
Charles Krinke 2008-07-11 02:04:02 +00:00
parent 14a6656948
commit cda5269391
21 changed files with 67 additions and 118 deletions

View File

@ -28,13 +28,18 @@
using System.Reflection; using System.Reflection;
using System.Threading; using System.Threading;
using log4net; using log4net;
using Mono.Addins;
using Nini.Config; using Nini.Config;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.RegionLoader.Filesystem; using OpenSim.Framework.RegionLoader.Filesystem;
using OpenSim.Framework.RegionLoader.Web; using OpenSim.Framework.RegionLoader.Web;
[assembly : Addin]
[assembly : AddinDependency("OpenSim", "0.5")]
namespace OpenSim.ApplicationPlugins.LoadRegions namespace OpenSim.ApplicationPlugins.LoadRegions
{ {
[Extension("/OpenSim/Startup")]
public class LoadRegionsPlugin : IApplicationPlugin public class LoadRegionsPlugin : IApplicationPlugin
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

View File

@ -33,14 +33,19 @@ using System.Reflection;
using System.Timers; using System.Timers;
using libsecondlife; using libsecondlife;
using log4net; using log4net;
using Mono.Addins;
using Nwc.XmlRpc; using Nwc.XmlRpc;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
using OpenSim.Region.Environment.Modules.World.Terrain; using OpenSim.Region.Environment.Modules.World.Terrain;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
[assembly : Addin]
[assembly : AddinDependency("OpenSim", "0.5")]
namespace OpenSim.ApplicationPlugins.RemoteController namespace OpenSim.ApplicationPlugins.RemoteController
{ {
[Extension("/OpenSim/Startup")]
public class RemoteAdminPlugin : IApplicationPlugin public class RemoteAdminPlugin : IApplicationPlugin
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

View File

@ -32,9 +32,16 @@ using System.Reflection;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
using OpenSim.ApplicationPlugins.Rest; using OpenSim.ApplicationPlugins.Rest;
using Mono.Addins;
[assembly : Addin]
[assembly : AddinDependency("OpenSim", "0.5")]
namespace OpenSim.ApplicationPlugins.Rest.Inventory namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
[Extension("/OpenSim/Startup")]
public class RestHandler : RestPlugin, IHttpAgentHandler public class RestHandler : RestPlugin, IHttpAgentHandler
{ {

View File

@ -37,6 +37,7 @@ using System.Timers;
using System.Xml; using System.Xml;
using System.Xml.Serialization; using System.Xml.Serialization;
using libsecondlife; using libsecondlife;
using Mono.Addins;
using Nwc.XmlRpc; using Nwc.XmlRpc;
using Nini.Config; using Nini.Config;
using OpenSim.Framework; using OpenSim.Framework;

View File

@ -37,6 +37,7 @@ using System.Timers;
using System.Xml; using System.Xml;
using System.Xml.Serialization; using System.Xml.Serialization;
using libsecondlife; using libsecondlife;
using Mono.Addins;
using Nwc.XmlRpc; using Nwc.XmlRpc;
using Nini.Config; using Nini.Config;
using OpenSim.Framework; using OpenSim.Framework;

View File

@ -37,6 +37,7 @@ using System.Timers;
using System.Xml; using System.Xml;
using System.Xml.Serialization; using System.Xml.Serialization;
using libsecondlife; using libsecondlife;
using Mono.Addins;
using Nwc.XmlRpc; using Nwc.XmlRpc;
using Nini.Config; using Nini.Config;
using OpenSim.Framework; using OpenSim.Framework;
@ -46,8 +47,13 @@ using OpenSim.Framework.Communications;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using OpenSim.ApplicationPlugins.Rest; using OpenSim.ApplicationPlugins.Rest;
[assembly : Addin]
[assembly : AddinDependency("OpenSim", "0.5")]
namespace OpenSim.ApplicationPlugins.Rest.Regions namespace OpenSim.ApplicationPlugins.Rest.Regions
{ {
[Extension("/OpenSim/Startup")]
public partial class RestRegionPlugin : RestPlugin public partial class RestRegionPlugin : RestPlugin
{ {
private static XmlSerializerNamespaces _xmlNs; private static XmlSerializerNamespaces _xmlNs;

View File

@ -35,6 +35,7 @@ using System.Reflection;
using System.Timers; using System.Timers;
using System.Xml; using System.Xml;
using libsecondlife; using libsecondlife;
using Mono.Addins;
using Nwc.XmlRpc; using Nwc.XmlRpc;
using Nini.Config; using Nini.Config;
using OpenSim.Framework; using OpenSim.Framework;
@ -43,8 +44,13 @@ using OpenSim.Framework.Servers;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
// [assembly : Addin]
// [assembly : AddinDependency("OpenSim", "0.5")]
namespace OpenSim.ApplicationPlugins.Rest namespace OpenSim.ApplicationPlugins.Rest
{ {
// [Extension("/OpenSim/Startup")]
public abstract class RestPlugin : IApplicationPlugin public abstract class RestPlugin : IApplicationPlugin
{ {
#region properties #region properties

View File

@ -55,7 +55,6 @@ namespace OpenSim.Framework
} }
/// <summary> /// <summary>
/// Generic Plugin Loader /// Generic Plugin Loader
/// </summary> /// </summary>
public class PluginLoader <T> : IDisposable where T : IPlugin public class PluginLoader <T> : IDisposable where T : IPlugin
@ -67,17 +66,16 @@ namespace OpenSim.Framework
private PluginInitialiserBase initialiser; private PluginInitialiserBase initialiser;
private Dictionary<string,IPluginConstraint> constraints private Dictionary<string,IPluginConstraint> constraints
= new Dictionary<string,IPluginConstraint>(); = new Dictionary<string,IPluginConstraint>();
private static bool runonce = false;
private static readonly ILog log private static readonly ILog log
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public PluginInitialiserBase Initialiser public PluginInitialiserBase Initialiser
{ {
set { initialiser = value; } set { initialiser = value; }
get { return initialiser; } get { return initialiser; }
} }
public List<T> Plugins public List<T> Plugins
{ {
get { return loaded; } get { return loaded; }
@ -86,19 +84,25 @@ namespace OpenSim.Framework
public PluginLoader () public PluginLoader ()
{ {
Initialiser = new PluginInitialiserBase(); Initialiser = new PluginInitialiserBase();
initialise_plugin_dir_ (".");
} }
public PluginLoader (PluginInitialiserBase init) public PluginLoader (PluginInitialiserBase init)
{ {
Initialiser = init; Initialiser = init;
initialise_plugin_dir_ (".");
} }
public PluginLoader (PluginInitialiserBase init, string dir) public PluginLoader (PluginInitialiserBase init, string dir)
{ {
Initialiser = init; Initialiser = init;
initialise_plugin_dir_ (dir); AddPluginDir (dir);
}
public void AddPluginDir (string dir)
{
suppress_console_output_ (true);
AddinManager.Initialize (dir);
AddinManager.Registry.Update (null);
suppress_console_output_ (false);
} }
public void AddExtensionPoint (string extpoint) public void AddExtensionPoint (string extpoint)
@ -110,21 +114,22 @@ namespace OpenSim.Framework
{ {
constraints.Add (extpoint, cons); constraints.Add (extpoint, cons);
} }
public void Load (string extpoint) public void Load (string extpoint, string dir)
{ {
AddPluginDir (dir);
AddExtensionPoint (extpoint); AddExtensionPoint (extpoint);
Load(); Load();
} }
public void Load () public void Load ()
{ {
log.Info("[PLUGINS]: Begin Loading " + AddinManager.Registry.RegistryPath); suppress_console_output_ (true);
AddinManager.Registry.Update (null);
suppress_console_output_ (false);
foreach (string ext in extpoints) foreach (string ext in extpoints)
{ {
log.Info("[PLUGINS]: Loading extension point " + ext);
if (constraints.ContainsKey (ext)) if (constraints.ContainsKey (ext))
{ {
IPluginConstraint cons = constraints [ext]; IPluginConstraint cons = constraints [ext];
@ -150,25 +155,9 @@ namespace OpenSim.Framework
p.Dispose (); p.Dispose ();
} }
private void initialise_plugin_dir_ (string dir) public void ClearCache()
{ {
if (runonce == true) // The Mono addin manager (in Mono.Addins.dll version 0.2.0.0) occasionally seems to corrupt its addin cache
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 // Hence, as a temporary solution we'll remove it before each startup
if (Directory.Exists("addin-db-000")) if (Directory.Exists("addin-db-000"))
Directory.Delete("addin-db-000", true); Directory.Delete("addin-db-000", true);
@ -236,7 +225,7 @@ namespace OpenSim.Framework
public PluginFilenameConstraint (string name) public PluginFilenameConstraint (string name)
{ {
filename = name; filename = name;
} }
public string Message public string Message
@ -256,7 +245,7 @@ namespace OpenSim.Framework
string[] path = ns[0].Path.Split('/'); string[] path = ns[0].Path.Split('/');
if (path [path.Length-1] == filename) if (path [path.Length-1] == filename)
return false; return false;
return true; return true;
} }
} }

View File

@ -31,6 +31,7 @@ using System.IO;
using System.Reflection; using System.Reflection;
using System.Timers; using System.Timers;
using log4net; using log4net;
using Mono.Addins;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
@ -120,7 +121,7 @@ namespace OpenSim.Grid.GridServer
PluginLoader<IGridPlugin> loader = PluginLoader<IGridPlugin> loader =
new PluginLoader<IGridPlugin> (new GridPluginInitialiser (this)); new PluginLoader<IGridPlugin> (new GridPluginInitialiser (this));
loader.Load ("/OpenSim/GridServer"); loader.Load ("/OpenSim/GridServer", ".");
m_plugins = loader.Plugins; m_plugins = loader.Plugins;
} }

View File

@ -26,10 +26,14 @@
* *
*/ */
using Mono.Addins;
using OpenSim.Framework; using OpenSim.Framework;
[assembly : AddinRoot("OpenSim", "0.5")]
namespace OpenSim.Grid.GridServer namespace OpenSim.Grid.GridServer
{ {
[TypeExtensionPoint("/OpenSim/GridServer")]
public interface IGridPlugin : IPlugin public interface IGridPlugin : IPlugin
{ {
void Initialise(GridServerBase gridServer); void Initialise(GridServerBase gridServer);

View File

@ -25,10 +25,14 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using Mono.Addins;
using OpenSim.Framework; using OpenSim.Framework;
[assembly : AddinRoot("OpenSim", "0.5")]
namespace OpenSim namespace OpenSim
{ {
[TypeExtensionPoint("/OpenSim/Startup")]
public interface IApplicationPlugin : IPlugin public interface IApplicationPlugin : IPlugin
{ {
void Initialise(OpenSimBase openSim); void Initialise(OpenSimBase openSim);

View File

@ -34,6 +34,7 @@ using System.Text;
using System.Threading; using System.Threading;
using libsecondlife; using libsecondlife;
using log4net; using log4net;
using Mono.Addins;
using Nini.Config; using Nini.Config;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Cache;
@ -336,7 +337,7 @@ namespace OpenSim
PluginLoader<IApplicationPlugin> loader = PluginLoader<IApplicationPlugin> loader =
new PluginLoader<IApplicationPlugin> (new ApplicationPluginInitialiser (this)); new PluginLoader<IApplicationPlugin> (new ApplicationPluginInitialiser (this));
loader.Load ("/OpenSim/Startup"); loader.Load ("/OpenSim/Startup", ".");
m_plugins = loader.Plugins; m_plugins = loader.Plugins;
} }
@ -729,4 +730,3 @@ namespace OpenSim

View File

@ -1,11 +0,0 @@
<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>

View File

@ -1,3 +0,0 @@
<Addins host-reference="/home/ryanm/Code/opensim/bin/OpenSim.Grid.GridServer.exe">
<Directory>/home/ryanm/Code/opensim/bin</Directory>
</Addins>

View File

@ -1,8 +0,0 @@
<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>

View File

@ -1,8 +0,0 @@
<Addin id="OpenSim" version="0.5" isroot="true">
<Runtime>
<Import assembly="../OpenSim.exe"/>
</Runtime>
<ExtensionPoint path = "/OpenSim/Startup">
<ExtensionNode objectType="IApplicationPlugin"/>
</ExtensionPoint>
</Addin>

View File

@ -1,6 +0,0 @@
<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>

View File

@ -1,11 +0,0 @@
<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>

View File

@ -1,11 +0,0 @@
<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>

View File

@ -1,11 +0,0 @@
<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>

View File

@ -1,11 +0,0 @@
<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>