Move PluginManager

Move PluginManager out to OpenSimFramework for general use
connector_plugin
BlueWall 2012-10-19 07:38:36 -04:00
parent c8393dd0be
commit 99bb6c9304
5 changed files with 25 additions and 12 deletions

View File

@ -38,13 +38,17 @@ using Mono.Addins.Setup;
using Mono.Addins.Description; using Mono.Addins.Description;
using OpenSim.Framework; using OpenSim.Framework;
namespace OpenSim.Server.Base
namespace OpenSim.Framework
{ {
/// <summary>
/// Manager for registries and plugins
/// </summary>
public class PluginManager : SetupService public class PluginManager : SetupService
{ {
protected AddinRegistry PluginRegistry; public AddinRegistry PluginRegistry;
internal PluginManager(AddinRegistry registry): base (registry) public PluginManager(AddinRegistry registry): base (registry)
{ {
PluginRegistry = registry; PluginRegistry = registry;

View File

@ -33,15 +33,21 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using Mono.Addins; using Mono.Addins;
using Mono.Addins.Setup; // using Mono.Addins.Setup;
using Mono.Addins.Description; using Mono.Addins.Description;
using OpenSim.Framework; using OpenSim.Framework;
namespace OpenSim.Server.Base namespace OpenSim.Server.Base
{ {
/// <summary>
/// Command manager -
/// Wrapper for OpenSim.Framework.PluginManager to allow
/// us to add commands to the console to perform operations
/// on our repos and plugins
/// </summary>
public class CommandManager public class CommandManager
{ {
protected AddinRegistry PluginRegistry; public AddinRegistry PluginRegistry;
protected PluginManager PluginManager; protected PluginManager PluginManager;
public CommandManager(AddinRegistry registry) public CommandManager(AddinRegistry registry)

View File

@ -111,17 +111,18 @@ namespace OpenSim.Server.Base
case ExtensionChange.Add: case ExtensionChange.Add:
if (a.AddinFile.Contains(Registry.DefaultAddinsFolder)) if (a.AddinFile.Contains(Registry.DefaultAddinsFolder))
{ {
m_log.InfoFormat("[SERVER]: Adding {0}", a.Name); m_log.InfoFormat("[SERVER]: Adding {0} from registry", a.Name);
connector.PluginPath = String.Format("{0}/{1}", Registry.DefaultAddinsFolder, a.Name.Replace(',', '.')); connector.PluginPath = String.Format("{0}/{1}", Registry.DefaultAddinsFolder, a.Name.Replace(',', '.'));
} }
else else
{ {
m_log.InfoFormat("[SERVER]: Removing {0}", a.Name); m_log.InfoFormat("[SERVER]: Adding {0} from ./bin", a.Name);
connector.PluginPath = a.AddinFile; connector.PluginPath = a.AddinFile;
} }
LoadPlugin(connector); LoadPlugin(connector);
break; break;
case ExtensionChange.Remove: case ExtensionChange.Remove:
m_log.InfoFormat("[SERVER]: Removing {0}", a.Name);
UnloadPlugin(connector); UnloadPlugin(connector);
break; break;
} }

View File

@ -41,8 +41,7 @@ namespace OpenSim.Server.Handlers.Base
{ {
public virtual string ConfigURL public virtual string ConfigURL
{ {
get; get { return String.Empty; }
protected set;
} }
public virtual string ConfigName public virtual string ConfigName
@ -95,7 +94,10 @@ namespace OpenSim.Server.Handlers.Base
return config; return config;
} }
// We get our remote initial configuration for bootstrapping // We get our remote initial configuration for bootstrapping in case
// we have no configuration in our main file or in an existing
// modular config file. This is the last resort to bootstrap the
// configuration, likely a new plugin loading for the first time.
private IConfigSource GetConfigSource() private IConfigSource GetConfigSource()
{ {
IConfigSource source = null; IConfigSource source = null;

View File

@ -105,6 +105,7 @@
<Reference name="Nini" path="../../bin/"/> <Reference name="Nini" path="../../bin/"/>
<Reference name="log4net" path="../../bin/"/> <Reference name="log4net" path="../../bin/"/>
<Reference name="Mono.Addins" path="../../bin/"/> <Reference name="Mono.Addins" path="../../bin/"/>
<Reference name="Mono.Addins.Setup" path="../../bin/"/>
<Reference name="SmartThreadPool"/> <Reference name="SmartThreadPool"/>
<Files> <Files>
<Match pattern="*.cs" recurse="false"/> <Match pattern="*.cs" recurse="false"/>
@ -737,7 +738,6 @@
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/> <Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
<Reference name="OpenMetaverse" path="../../../bin/"/> <Reference name="OpenMetaverse" path="../../../bin/"/>
<Reference name="Mono.Addins" path="../../../bin/"/> <Reference name="Mono.Addins" path="../../../bin/"/>
<Reference name="Mono.Addins.Setup" path="../../../bin/"/>
<Reference name="OpenSim.Framework"/> <Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Console"/> <Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.Servers"/> <Reference name="OpenSim.Framework.Servers"/>