How to create a dynamic plugin

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(New page: == Current state of Plugin loading == The .NET runtime system has always made reflecting and introspecting of assemblies at runtime very easy to do, making dynamic loading of modules poss...)
 
(Current state of Plugin loading)
Line 26: Line 26:
  
 
Mono.Addins offers features outside of being upstream maintained by the Mono project:
 
Mono.Addins offers features outside of being upstream maintained by the Mono project:
- logically splits up module interfaces from implementations in a cross platform way through the use of text-based "extension points" and "addin manifests"
+
* logically splits up module interfaces from implementations in a cross platform way through the use of text-based "extension points" and "addin manifests"
- automatically handles module sharing across application domains
+
* automatically handles module sharing across application domains
- provides support for downloading assemblies from remote repositories
+
* provides support for downloading assemblies from remote repositories

Revision as of 20:57, 22 July 2008

Current state of Plugin loading

The .NET runtime system has always made reflecting and introspecting of assemblies at runtime very easy to do, making dynamic loading of modules possible with very little effort.

This has unfortunately lead to a situation in OpenSim where historically module loading was hard-coded and done by hand, using copy-and-paste code. Clearly this is a suboptimal situation.

Effort was made to find a reusable, cross-platform dynamic assembly loader that could be used as-is, instead of reinventing our own. The only current candidate is Mono.Addins. MS's .NET runtime has its own Addin class, however it is not yet implemented in Mono.

A class called PluginLoader has been created to thinly wrap Mono.Addins, and the assemblies loaded by this class have been standardized on the IPlugin interface hierarchy. With the exception of RegionModules, all dynamically loaded assemblies should be called Plugins, and inherit from this base class.

Currently the following interfaces have been converted to IPlugin:

  1. OpenSim.Region.Application.IApplicationPlugin
  2. OpenSim.Grid.GridServer.IGridPlugin
  3. OpenSim.Data.IGridDataPlugin
  4. OpenSim.Data.ILogDataPlugin

And the following Assemblies are being loaded by PluginLoader:

  1. OpenSim.ApplicationPlugins.LoadRegions.LoadRegionsPlugin
  2. OpenSim.ApplicationPlugins.Rest.Regions.RestRegionPlugin
  3. OpenSim.ApplicationPlugins.Rest.Inventory.RestHandler
  4. OpenSim.ApplicationPlugins.RemoteController.RemoteAdminPlugin
  5. OpenSim.Data.MySQL.MySQLGridData
  6. OpenSim.Data.MySQL.MySQLLogData


Mono.Addins offers features outside of being upstream maintained by the Mono project:

  • logically splits up module interfaces from implementations in a cross platform way through the use of text-based "extension points" and "addin manifests"
  • automatically handles module sharing across application domains
  • provides support for downloading assemblies from remote repositories
Personal tools
General
About This Wiki