Merge branch 'master' into careminster
Conflicts: OpenSim/Region/Application/OpenSimBase.cs OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs OpenSim/Region/Framework/ModuleLoader.cs OpenSim/Region/Framework/Scenes/SceneManager.csavinationmerge
commit
2e0ce70e63
|
@ -136,9 +136,6 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_openSim.ModuleLoader.PostInitialise();
|
||||
m_openSim.ModuleLoader.ClearCache();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
|
|
@ -215,7 +215,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
|
|||
}
|
||||
}
|
||||
|
||||
#region IRegionModulesController implementation
|
||||
#region Region Module interfacesController implementation
|
||||
|
||||
/// <summary>
|
||||
/// Check that the given module is no disabled in the [Modules] section of the config files.
|
||||
|
|
|
@ -757,33 +757,13 @@ namespace OpenSim
|
|||
switch (cmdparams[0].ToLower())
|
||||
{
|
||||
case "list":
|
||||
foreach (IRegionModule irm in m_moduleLoader.GetLoadedSharedModules)
|
||||
{
|
||||
MainConsole.Instance.Output(String.Format("Shared region module: {0}", irm.Name));
|
||||
}
|
||||
//TODO: Convert to new region modules
|
||||
break;
|
||||
case "unload":
|
||||
if (cmdparams.Length > 1)
|
||||
{
|
||||
foreach (IRegionModule rm in new ArrayList(m_moduleLoader.GetLoadedSharedModules))
|
||||
{
|
||||
if (rm.Name.ToLower() == cmdparams[1].ToLower())
|
||||
{
|
||||
MainConsole.Instance.Output(String.Format("Unloading module: {0}", rm.Name));
|
||||
m_moduleLoader.UnloadModule(rm);
|
||||
}
|
||||
}
|
||||
}
|
||||
//TODO: Convert to new region modules
|
||||
break;
|
||||
case "load":
|
||||
if (cmdparams.Length > 1)
|
||||
{
|
||||
foreach (Scene s in new ArrayList(SceneManager.Scenes))
|
||||
{
|
||||
MainConsole.Instance.Output(String.Format("Loading module: {0}", cmdparams[1]));
|
||||
m_moduleLoader.LoadRegionModules(cmdparams[1], s);
|
||||
}
|
||||
}
|
||||
//TODO: Convert to new region modules
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1018,28 +998,9 @@ namespace OpenSim
|
|||
break;
|
||||
|
||||
case "modules":
|
||||
MainConsole.Instance.Output("The currently loaded shared modules are:");
|
||||
foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules)
|
||||
{
|
||||
MainConsole.Instance.Output("Shared Module: " + module.Name);
|
||||
}
|
||||
|
||||
SceneManager.ForEachScene(
|
||||
delegate(Scene scene) {
|
||||
m_log.Error("The currently loaded modules in " + scene.RegionInfo.RegionName + " are:");
|
||||
foreach (IRegionModule module in scene.Modules.Values)
|
||||
{
|
||||
if (!module.IsSharedModule)
|
||||
{
|
||||
m_log.Error("Region Module: " + module.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
SceneManager.ForEachScene(
|
||||
delegate(Scene scene) {
|
||||
MainConsole.Instance.Output("Loaded new region modules in" + scene.RegionInfo.RegionName + " are:");
|
||||
MainConsole.Instance.Output("Loaded region modules in" + scene.RegionInfo.RegionName + " are:");
|
||||
foreach (IRegionModuleBase module in scene.RegionModules.Values)
|
||||
{
|
||||
Type type = module.GetType().GetInterface("ISharedRegionModule");
|
||||
|
|
|
@ -131,14 +131,6 @@ namespace OpenSim
|
|||
get { return m_httpServerPort; }
|
||||
}
|
||||
|
||||
public ModuleLoader ModuleLoader
|
||||
{
|
||||
get { return m_moduleLoader; }
|
||||
set { m_moduleLoader = value; }
|
||||
}
|
||||
|
||||
protected ModuleLoader m_moduleLoader;
|
||||
|
||||
protected IRegistryCore m_applicationRegistry = new RegistryCore();
|
||||
|
||||
public IRegistryCore ApplicationRegistry
|
||||
|
@ -232,9 +224,6 @@ namespace OpenSim
|
|||
|
||||
base.StartupSpecific();
|
||||
|
||||
// Create a ModuleLoader instance
|
||||
m_moduleLoader = new ModuleLoader(m_config.Source);
|
||||
|
||||
LoadPlugins();
|
||||
|
||||
if (m_plugins.Count == 0) // We failed to load any modules. Mono Addins glitch!
|
||||
|
@ -385,12 +374,6 @@ namespace OpenSim
|
|||
|
||||
m_log.Info("[MODULES]: Loading Region's modules (old style)");
|
||||
|
||||
List<IRegionModule> modules = m_moduleLoader.PickupModules(scene, ".");
|
||||
|
||||
// This needs to be ahead of the script engine load, so the
|
||||
// script module can pick up events exposed by a module
|
||||
m_moduleLoader.InitialiseSharedModules(scene);
|
||||
|
||||
// Use this in the future, the line above will be deprecated soon
|
||||
m_log.Info("[REGIONMODULES]: Loading Region's modules (new style)");
|
||||
IRegionModulesController controller;
|
||||
|
@ -400,28 +383,29 @@ namespace OpenSim
|
|||
}
|
||||
else m_log.Error("[REGIONMODULES]: The new RegionModulesController is missing...");
|
||||
|
||||
if (m_securePermissionsLoading)
|
||||
{
|
||||
foreach (string s in m_permsModules)
|
||||
{
|
||||
if (!scene.RegionModules.ContainsKey(s))
|
||||
{
|
||||
bool found = false;
|
||||
foreach (IRegionModule m in modules)
|
||||
{
|
||||
if (m.Name == s)
|
||||
{
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
m_log.Fatal("[MODULES]: Required module " + s + " not found.");
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// XPTO: Fix this
|
||||
// if (m_securePermissionsLoading)
|
||||
// {
|
||||
// foreach (string s in m_permsModules)
|
||||
// {
|
||||
// if (!scene.RegionModules.ContainsKey(s))
|
||||
// {
|
||||
// bool found = false;
|
||||
// foreach (IRegionModule m in modules)
|
||||
// {
|
||||
// if (m.Name == s)
|
||||
// {
|
||||
// found = true;
|
||||
// }
|
||||
// }
|
||||
// if (!found)
|
||||
// {
|
||||
// m_log.Fatal("[MODULES]: Required module " + s + " not found.");
|
||||
// Environment.Exit(0);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
scene.SetModuleInterfaces();
|
||||
// First Step of bootreport sequence
|
||||
|
@ -498,13 +482,6 @@ namespace OpenSim
|
|||
{
|
||||
scene.SnmpService.BootInfo("Initializing region modules", scene);
|
||||
}
|
||||
if (do_post_init)
|
||||
{
|
||||
foreach (IRegionModule module in modules)
|
||||
{
|
||||
module.PostInitialise();
|
||||
}
|
||||
}
|
||||
scene.EventManager.OnShutdown += delegate() { ShutdownRegion(scene); };
|
||||
|
||||
mscene = scene;
|
||||
|
@ -805,7 +782,7 @@ namespace OpenSim
|
|||
|
||||
return new Scene(
|
||||
regionInfo, circuitManager, sceneGridService,
|
||||
simDataService, estateDataService, m_moduleLoader, false,
|
||||
simDataService, estateDataService, false,
|
||||
m_config.Source, m_version);
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
private bool m_Enabled = true;
|
||||
private string m_URL;
|
||||
|
||||
#region IRegionModuleBase Members
|
||||
#region Region Module interfaceBase Members
|
||||
|
||||
public Type ReplaceableInterface
|
||||
{
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private Scene m_scene;
|
||||
|
||||
#region IRegionModuleBase Members
|
||||
#region Region Module interfaceBase Members
|
||||
|
||||
|
||||
public Type ReplaceableInterface
|
||||
|
@ -92,7 +92,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
#endregion
|
||||
|
||||
|
||||
#region IRegionModule Members
|
||||
#region Region Module interface
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
|||
private Dictionary<UUID, AgentAssetTransactions> AgentTransactions =
|
||||
new Dictionary<UUID, AgentAssetTransactions>();
|
||||
|
||||
#region IRegionModule Members
|
||||
#region Region Module interface
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
|
|
|
@ -123,7 +123,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
|
|||
get { return null; }
|
||||
}
|
||||
|
||||
#endregion IRegionModule
|
||||
#endregion Region Module interface
|
||||
|
||||
#region IJ2KDecoder
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
|
||||
private object m_setAppearanceLock = new object();
|
||||
|
||||
#region IRegionModule
|
||||
#region Region Module interface
|
||||
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
|||
|
||||
private readonly List<Scene> m_scenes = new List<Scene>();
|
||||
|
||||
#region IRegionModule Members
|
||||
#region Region Module interface
|
||||
|
||||
private IMessageTransferModule m_TransferModule = null;
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
private IMessageTransferModule m_TransferModule = null;
|
||||
private bool m_Enabled = true;
|
||||
|
||||
#region IRegionModule Members
|
||||
#region Region Module interface
|
||||
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Asset
|
|||
private IConfigSource m_Config;
|
||||
bool m_Registered = false;
|
||||
|
||||
#region IRegionModule interface
|
||||
#region Region Module interface
|
||||
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Authentication
|
|||
private IConfigSource m_Config;
|
||||
bool m_Registered = false;
|
||||
|
||||
#region IRegionModule interface
|
||||
#region Region Module interface
|
||||
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid
|
|||
private IConfigSource m_Config;
|
||||
bool m_Registered = false;
|
||||
|
||||
#region IRegionModule interface
|
||||
#region Region Module interface
|
||||
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid
|
|||
private GatekeeperServiceInConnector m_HypergridHandler;
|
||||
private UserAgentServerConnector m_UASHandler;
|
||||
|
||||
#region IRegionModule interface
|
||||
#region Region Module interface
|
||||
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory
|
|||
private IConfigSource m_Config;
|
||||
bool m_Registered = false;
|
||||
|
||||
#region IRegionModule interface
|
||||
#region Region Module interface
|
||||
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land
|
|||
private IConfigSource m_Config;
|
||||
private List<Scene> m_Scenes = new List<Scene>();
|
||||
|
||||
#region IRegionModule interface
|
||||
#region Region Module interface
|
||||
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Login
|
|||
private IConfigSource m_Config;
|
||||
private List<Scene> m_Scenes = new List<Scene>();
|
||||
|
||||
#region IRegionModule interface
|
||||
#region Region Module interface
|
||||
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.MapImage
|
|||
|
||||
private IConfigSource m_Config;
|
||||
|
||||
#region IRegionModule interface
|
||||
#region Region Module interface
|
||||
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Neighbour
|
|||
private IConfigSource m_Config;
|
||||
private List<Scene> m_Scenes = new List<Scene>();
|
||||
|
||||
#region IRegionModule interface
|
||||
#region Region Module interface
|
||||
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Simulation
|
|||
private IConfigSource m_Config;
|
||||
bool m_Registered = false;
|
||||
|
||||
#region IRegionModule interface
|
||||
#region Region Module interface
|
||||
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
|||
/// </summary>
|
||||
private bool m_ModuleEnabled = false;
|
||||
|
||||
#region IRegionModule
|
||||
#region Region Module interface
|
||||
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
|
@ -156,7 +156,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
|||
}
|
||||
}
|
||||
|
||||
#endregion /* IRegionModule */
|
||||
#endregion
|
||||
|
||||
#region ISimulation
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
|||
protected bool m_safemode;
|
||||
protected IPAddress m_thisIP;
|
||||
|
||||
#region IRegionModule
|
||||
#region Region Module interface
|
||||
|
||||
public virtual void Initialise(IConfigSource config)
|
||||
{
|
||||
|
@ -147,7 +147,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
|||
m_thisIP = Util.GetHostFromDNS(scene.RegionInfo.ExternalHostName);
|
||||
}
|
||||
|
||||
#endregion /* IRegionModule */
|
||||
#endregion
|
||||
|
||||
#region IInterregionComms
|
||||
|
||||
|
@ -317,4 +317,4 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
|||
|
||||
#endregion /* IInterregionComms */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1109,7 +1109,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
|||
|
||||
#endregion
|
||||
|
||||
#region IRegionModule Members
|
||||
#region Region Module interface
|
||||
|
||||
public string Name { get { return "EstateManagementModule"; } }
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
|
|||
|
||||
#endregion
|
||||
|
||||
#region IRegionModule Members
|
||||
#region Region Module interface
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
|
|||
private Bitmap lastImage = null;
|
||||
private DateTime lastImageTime = DateTime.MinValue;
|
||||
|
||||
#region IRegionModule Members
|
||||
#region Region Module interface
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
|
|
|
@ -99,7 +99,7 @@ namespace OpenSim.Region.DataSnapshot
|
|||
|
||||
#endregion
|
||||
|
||||
#region IRegionModule
|
||||
#region Region Module interface
|
||||
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
using System;
|
||||
|
||||
using Nini.Config;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
namespace OpenSim.Region.Framework.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// DEPRECATED! Use INonSharedRegionModule or ISharedRegionModule instead
|
||||
/// </summary>
|
||||
[Obsolete("Use INonSharedRegionModule or ISharedRegionModule instead", false)]
|
||||
public interface IRegionModule
|
||||
{
|
||||
/// <summary>
|
||||
/// Initialize the module.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// For a shared module this can be called multiple times - once per scene.
|
||||
/// </remarks>
|
||||
/// <param name="scene"></param>
|
||||
/// <param name="source">Configuration information. For a shared module this will be identical on every scene call</param>
|
||||
void Initialise(Scene scene, IConfigSource source);
|
||||
|
||||
void PostInitialise();
|
||||
void Close();
|
||||
string Name { get; }
|
||||
bool IsSharedModule { get; }
|
||||
}
|
||||
}
|
|
@ -1,263 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
namespace OpenSim.Region.Framework
|
||||
{
|
||||
public class ModuleLoader
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>();
|
||||
|
||||
private readonly List<IRegionModule> m_loadedModules = new List<IRegionModule>();
|
||||
private readonly Dictionary<string, IRegionModule> m_loadedSharedModules = new Dictionary<string, IRegionModule>();
|
||||
private readonly IConfigSource m_config;
|
||||
|
||||
public ModuleLoader(IConfigSource config)
|
||||
{
|
||||
m_config = config;
|
||||
}
|
||||
|
||||
public IRegionModule[] GetLoadedSharedModules
|
||||
{
|
||||
get
|
||||
{
|
||||
IRegionModule[] regionModules = new IRegionModule[m_loadedSharedModules.Count];
|
||||
m_loadedSharedModules.Values.CopyTo(regionModules, 0);
|
||||
return regionModules;
|
||||
}
|
||||
}
|
||||
|
||||
public List<IRegionModule> PickupModules(Scene scene, string moduleDir)
|
||||
{
|
||||
DirectoryInfo dir = new DirectoryInfo(moduleDir);
|
||||
List<IRegionModule> modules = new List<IRegionModule>();
|
||||
|
||||
foreach (FileInfo fileInfo in dir.GetFiles("*.dll"))
|
||||
{
|
||||
modules.AddRange(LoadRegionModules(fileInfo.FullName, scene));
|
||||
}
|
||||
return modules;
|
||||
}
|
||||
|
||||
public void LoadDefaultSharedModule(IRegionModule module)
|
||||
{
|
||||
if (m_loadedSharedModules.ContainsKey(module.Name))
|
||||
{
|
||||
m_log.ErrorFormat("[MODULES]: Module name \"{0}\" already exists in module list. Module not added!", module.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_loadedSharedModules.Add(module.Name, module);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void InitialiseSharedModules(Scene scene)
|
||||
{
|
||||
foreach (IRegionModule module in m_loadedSharedModules.Values)
|
||||
{
|
||||
module.Initialise(scene, m_config);
|
||||
scene.AddModule(module.Name, module); //should be doing this?
|
||||
}
|
||||
}
|
||||
|
||||
public void InitializeModule(IRegionModule module, Scene scene)
|
||||
{
|
||||
module.Initialise(scene, m_config);
|
||||
scene.AddModule(module.Name, module);
|
||||
m_loadedModules.Add(module);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads/initialises a Module instance that can be used by multiple Regions
|
||||
/// </summary>
|
||||
/// <param name="dllName"></param>
|
||||
/// <param name="moduleName"></param>
|
||||
public void LoadSharedModule(string dllName, string moduleName)
|
||||
{
|
||||
IRegionModule module = LoadModule(dllName, moduleName);
|
||||
|
||||
if (module != null)
|
||||
LoadSharedModule(module);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads/initialises a Module instance that can be used by multiple Regions
|
||||
/// </summary>
|
||||
/// <param name="module"></param>
|
||||
public void LoadSharedModule(IRegionModule module)
|
||||
{
|
||||
if (!m_loadedSharedModules.ContainsKey(module.Name))
|
||||
{
|
||||
m_loadedSharedModules.Add(module.Name, module);
|
||||
}
|
||||
}
|
||||
|
||||
public List<IRegionModule> LoadRegionModules(string dllName, Scene scene)
|
||||
{
|
||||
IRegionModule[] modules = LoadModules(dllName);
|
||||
List<IRegionModule> initializedModules = new List<IRegionModule>();
|
||||
|
||||
if (modules.Length > 0)
|
||||
{
|
||||
m_log.InfoFormat("[MODULES]: Found Module Library [{0}]", dllName);
|
||||
foreach (IRegionModule module in modules)
|
||||
{
|
||||
if (!module.IsSharedModule)
|
||||
{
|
||||
m_log.InfoFormat("[MODULES]: [{0}]: Initializing.", module.Name);
|
||||
InitializeModule(module, scene);
|
||||
initializedModules.Add(module);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.InfoFormat("[MODULES]: [{0}]: Loading Shared Module.", module.Name);
|
||||
LoadSharedModule(module);
|
||||
}
|
||||
}
|
||||
}
|
||||
return initializedModules;
|
||||
}
|
||||
|
||||
public void LoadRegionModule(string dllName, string moduleName, Scene scene)
|
||||
{
|
||||
IRegionModule module = LoadModule(dllName, moduleName);
|
||||
if (module != null)
|
||||
{
|
||||
InitializeModule(module, scene);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads a external Module (if not already loaded) and creates a new instance of it.
|
||||
/// </summary>
|
||||
/// <param name="dllName"></param>
|
||||
/// <param name="moduleName"></param>
|
||||
public IRegionModule LoadModule(string dllName, string moduleName)
|
||||
{
|
||||
IRegionModule[] modules = LoadModules(dllName);
|
||||
|
||||
foreach (IRegionModule module in modules)
|
||||
{
|
||||
if ((module != null) && (module.Name == moduleName))
|
||||
{
|
||||
return module;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public IRegionModule[] LoadModules(string dllName)
|
||||
{
|
||||
//m_log.DebugFormat("[MODULES]: Looking for modules in {0}", dllName);
|
||||
|
||||
List<IRegionModule> modules = new List<IRegionModule>();
|
||||
|
||||
Assembly pluginAssembly;
|
||||
if (!LoadedAssemblys.TryGetValue(dllName, out pluginAssembly))
|
||||
{
|
||||
try
|
||||
{
|
||||
pluginAssembly = Assembly.LoadFrom(dllName);
|
||||
LoadedAssemblys.Add(dllName, pluginAssembly);
|
||||
}
|
||||
catch (BadImageFormatException)
|
||||
{
|
||||
//m_log.InfoFormat("[MODULES]: The file [{0}] is not a module assembly.", e.FileName);
|
||||
}
|
||||
}
|
||||
|
||||
if (pluginAssembly != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (Type pluginType in pluginAssembly.GetTypes())
|
||||
{
|
||||
if (pluginType.IsPublic)
|
||||
{
|
||||
if (!pluginType.IsAbstract)
|
||||
{
|
||||
if (pluginType.GetInterface("IRegionModule") != null)
|
||||
{
|
||||
modules.Add((IRegionModule)Activator.CreateInstance(pluginType));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[MODULES]: Could not load types for plugin DLL {0}. Exception {1} {2}",
|
||||
pluginAssembly.FullName, e.Message, e.StackTrace);
|
||||
|
||||
// justincc: Right now this is fatal to really get the user's attention
|
||||
// TomMeta: WTF? No, how about we /don't/ throw a fatal exception when there's no need to?
|
||||
//throw e;
|
||||
}
|
||||
}
|
||||
|
||||
return modules.ToArray();
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
foreach (IRegionModule module in m_loadedSharedModules.Values)
|
||||
{
|
||||
module.PostInitialise();
|
||||
}
|
||||
|
||||
foreach (IRegionModule module in m_loadedModules)
|
||||
{
|
||||
module.PostInitialise();
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearCache()
|
||||
{
|
||||
LoadedAssemblys.Clear();
|
||||
}
|
||||
|
||||
public void UnloadModule(IRegionModule rm)
|
||||
{
|
||||
rm.Close();
|
||||
|
||||
m_loadedModules.Remove(rm);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -177,7 +177,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>();
|
||||
protected List<RegionInfo> m_neighbours = new List<RegionInfo>();
|
||||
protected string m_simulatorVersion = "OpenSimulator Server";
|
||||
protected ModuleLoader m_moduleLoader;
|
||||
protected AgentCircuitManager m_authenticateHandler;
|
||||
protected SceneCommunicationService m_sceneGridService;
|
||||
protected ISnmpModule m_snmpService = null;
|
||||
|
@ -679,7 +678,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public Scene(RegionInfo regInfo, AgentCircuitManager authen,
|
||||
SceneCommunicationService sceneGridService,
|
||||
ISimulationDataService simDataService, IEstateDataService estateDataService,
|
||||
ModuleLoader moduleLoader, bool dumpAssetsToFile,
|
||||
bool dumpAssetsToFile,
|
||||
IConfigSource config, string simulatorVersion)
|
||||
: this(regInfo)
|
||||
{
|
||||
|
@ -690,7 +689,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
Random random = new Random();
|
||||
|
||||
m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue / 2)) + (uint)(uint.MaxValue / 4);
|
||||
m_moduleLoader = moduleLoader;
|
||||
m_authenticateHandler = authen;
|
||||
m_sceneGridService = sceneGridService;
|
||||
m_SimulationDataService = simDataService;
|
||||
|
|
|
@ -67,12 +67,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <value>
|
||||
/// All the region modules attached to this scene.
|
||||
/// </value>
|
||||
public Dictionary<string, IRegionModule> Modules
|
||||
{
|
||||
get { return m_modules; }
|
||||
}
|
||||
protected Dictionary<string, IRegionModule> m_modules = new Dictionary<string, IRegionModule>();
|
||||
|
||||
public Dictionary<string, IRegionModuleBase> RegionModules
|
||||
{
|
||||
get { return m_regionModules; }
|
||||
|
@ -273,16 +267,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// </summary>
|
||||
public virtual void Close()
|
||||
{
|
||||
// Shut down all non shared modules.
|
||||
foreach (IRegionModule module in Modules.Values)
|
||||
{
|
||||
if (!module.IsSharedModule)
|
||||
{
|
||||
module.Close();
|
||||
}
|
||||
}
|
||||
Modules.Clear();
|
||||
|
||||
try
|
||||
{
|
||||
EventManager.TriggerShutdown();
|
||||
|
@ -312,19 +296,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
#region Module Methods
|
||||
|
||||
/// <summary>
|
||||
/// Add a module to this scene.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="module"></param>
|
||||
public void AddModule(string name, IRegionModule module)
|
||||
{
|
||||
if (!Modules.ContainsKey(name))
|
||||
{
|
||||
Modules.Add(name, module);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a region-module to this scene. TODO: This will replace AddModule in the future.
|
||||
/// </summary>
|
||||
|
@ -509,9 +480,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <param name="shorthelp"></param>
|
||||
/// <param name="longhelp"></param>
|
||||
/// <param name="callback"></param>
|
||||
public void AddCommand(object mod, string command, string shorthelp, string longhelp, CommandDelegate callback)
|
||||
public void AddCommand(IRegionModuleBase module, string command, string shorthelp, string longhelp, CommandDelegate callback)
|
||||
{
|
||||
AddCommand(mod, command, shorthelp, longhelp, string.Empty, callback);
|
||||
AddCommand(module, command, shorthelp, longhelp, string.Empty, callback);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -529,9 +500,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <param name="longhelp"></param>
|
||||
/// <param name="callback"></param>
|
||||
public void AddCommand(
|
||||
string category, object mod, string command, string shorthelp, string longhelp, CommandDelegate callback)
|
||||
string category, IRegionModuleBase module, string command, string shorthelp, string longhelp, CommandDelegate callback)
|
||||
{
|
||||
AddCommand(category, mod, command, shorthelp, longhelp, string.Empty, callback);
|
||||
AddCommand(category, module, command, shorthelp, longhelp, string.Empty, callback);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -543,29 +514,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <param name="longhelp"></param>
|
||||
/// <param name="descriptivehelp"></param>
|
||||
/// <param name="callback"></param>
|
||||
public void AddCommand(object mod, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback)
|
||||
public void AddCommand(IRegionModuleBase module, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback)
|
||||
{
|
||||
string moduleName = "";
|
||||
|
||||
if (mod != null)
|
||||
{
|
||||
if (mod is IRegionModule)
|
||||
{
|
||||
IRegionModule module = (IRegionModule)mod;
|
||||
moduleName = module.Name;
|
||||
}
|
||||
else if (mod is IRegionModuleBase)
|
||||
{
|
||||
IRegionModuleBase module = (IRegionModuleBase)mod;
|
||||
moduleName = module.Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase");
|
||||
}
|
||||
}
|
||||
if (module != null)
|
||||
moduleName = module.Name;
|
||||
|
||||
AddCommand(moduleName, mod, command, shorthelp, longhelp, descriptivehelp, callback);
|
||||
AddCommand(moduleName, module, command, shorthelp, longhelp, descriptivehelp, callback);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -581,7 +537,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <param name="descriptivehelp"></param>
|
||||
/// <param name="callback"></param>
|
||||
public void AddCommand(
|
||||
string category, object mod, string command,
|
||||
string category, IRegionModuleBase module, string command,
|
||||
string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback)
|
||||
{
|
||||
if (MainConsole.Instance == null)
|
||||
|
@ -589,22 +545,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
bool shared = false;
|
||||
|
||||
if (mod != null)
|
||||
{
|
||||
if (mod is IRegionModule)
|
||||
{
|
||||
IRegionModule module = (IRegionModule)mod;
|
||||
shared = module.IsSharedModule;
|
||||
}
|
||||
else if (mod is IRegionModuleBase)
|
||||
{
|
||||
shared = mod is ISharedRegionModule;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase");
|
||||
}
|
||||
}
|
||||
if (module != null)
|
||||
shared = module is ISharedRegionModule;
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
category, shared, command, shorthelp, longhelp, descriptivehelp, callback);
|
||||
|
|
|
@ -138,31 +138,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public void Close()
|
||||
{
|
||||
// collect known shared modules in sharedModules
|
||||
Dictionary<string, IRegionModule> sharedModules = new Dictionary<string, IRegionModule>();
|
||||
|
||||
List<Scene> sceneList = Scenes;
|
||||
for (int i = 0; i < sceneList.Count; i++)
|
||||
{
|
||||
// extract known shared modules from scene
|
||||
foreach (string k in sceneList[i].Modules.Keys)
|
||||
{
|
||||
if (sceneList[i].Modules[k].IsSharedModule &&
|
||||
!sharedModules.ContainsKey(k))
|
||||
sharedModules[k] = sceneList[i].Modules[k];
|
||||
}
|
||||
// close scene/region
|
||||
sceneList[i].Close();
|
||||
}
|
||||
|
||||
// all regions/scenes are now closed, we can now safely
|
||||
// close all shared modules
|
||||
foreach (IRegionModule mod in sharedModules.Values)
|
||||
{
|
||||
mod.Close();
|
||||
}
|
||||
|
||||
m_localScenes.Clear();
|
||||
}
|
||||
|
||||
public void Close(Scene cscene)
|
||||
|
|
|
@ -79,7 +79,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
|
||||
private int m_usersOnlineCacheExpirySeconds = 20;
|
||||
|
||||
#region IRegionModuleBase Members
|
||||
#region Region Module interfaceBase Members
|
||||
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
|
|
|
@ -86,7 +86,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
private bool m_debugEnabled = false;
|
||||
private int m_levelGroupCreate = 0;
|
||||
|
||||
#region IRegionModuleBase Members
|
||||
#region Region Module interfaceBase Members
|
||||
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
|
|
|
@ -176,7 +176,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
// private IUserAccountService m_accountService = null;
|
||||
|
||||
|
||||
#region IRegionModuleBase Members
|
||||
#region Region Module interfaceBase Members
|
||||
|
||||
public string Name
|
||||
{
|
||||
|
|
|
@ -83,7 +83,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
|||
private Dictionary<UUID, List<UUID>> m_groupsAgentsDroppedFromChatSession = new Dictionary<UUID, List<UUID>>();
|
||||
private Dictionary<UUID, List<UUID>> m_groupsAgentsInvitedToChatSession = new Dictionary<UUID, List<UUID>>();
|
||||
|
||||
#region IRegionModuleBase Members
|
||||
#region Region Module interfaceBase Members
|
||||
|
||||
public string Name
|
||||
{
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
|||
private Dictionary<UUID,JsonStore> m_JsonValueStore;
|
||||
private UUID m_sharedStore;
|
||||
|
||||
#region IRegionModule Members
|
||||
#region Region Module interface
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
|||
private IScriptModuleComms m_comms;
|
||||
private IJsonStoreModule m_store;
|
||||
|
||||
#region IRegionModule Members
|
||||
#region Region Module interface
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Freeswitch
|
|||
private IConfigSource m_Config;
|
||||
bool m_Registered = false;
|
||||
|
||||
#region IRegionModule interface
|
||||
#region Region Module interface
|
||||
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
|
|
|
@ -168,7 +168,7 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
|
|||
|
||||
#endregion
|
||||
|
||||
#region IRegionModule Members
|
||||
#region Region Module interface
|
||||
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
|
@ -200,7 +200,6 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
|
|||
public void AddRegion(Scene scene)
|
||||
{
|
||||
m_scene = scene;
|
||||
//m_scene.RegisterModuleInterface<IRegionModule>(this);
|
||||
m_scene.RegisterModuleCommander(m_commander);
|
||||
m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ namespace OpenSim.Tests.Common
|
|||
SceneCommunicationService scs = new SceneCommunicationService();
|
||||
|
||||
TestScene testScene = new TestScene(
|
||||
regInfo, m_acm, scs, m_simDataService, m_estateDataService, null, false, configSource, null);
|
||||
regInfo, m_acm, scs, m_simDataService, m_estateDataService, false, configSource, null);
|
||||
|
||||
INonSharedRegionModule godsModule = new GodsModule();
|
||||
godsModule.Initialise(new IniConfigSource());
|
||||
|
@ -359,28 +359,10 @@ namespace OpenSim.Tests.Common
|
|||
List<IRegionModuleBase> newModules = new List<IRegionModuleBase>();
|
||||
foreach (object module in modules)
|
||||
{
|
||||
// Console.WriteLine("MODULE RAW {0}", module);
|
||||
if (module is IRegionModule)
|
||||
{
|
||||
IRegionModule m = (IRegionModule)module;
|
||||
|
||||
foreach (Scene scene in scenes)
|
||||
{
|
||||
m.Initialise(scene, config);
|
||||
scene.AddModule(m.Name, m);
|
||||
}
|
||||
|
||||
m.PostInitialise();
|
||||
}
|
||||
else if (module is IRegionModuleBase)
|
||||
{
|
||||
// for the new system, everything has to be initialised first,
|
||||
// shared modules have to be post-initialised, then all get an AddRegion with the scene
|
||||
IRegionModuleBase m = (IRegionModuleBase)module;
|
||||
// Console.WriteLine("MODULE {0}", m.Name);
|
||||
m.Initialise(config);
|
||||
newModules.Add(m);
|
||||
}
|
||||
IRegionModuleBase m = (IRegionModuleBase)module;
|
||||
// Console.WriteLine("MODULE {0}", m.Name);
|
||||
m.Initialise(config);
|
||||
newModules.Add(m);
|
||||
}
|
||||
|
||||
foreach (IRegionModuleBase module in newModules)
|
||||
|
@ -709,4 +691,4 @@ namespace OpenSim.Tests.Common
|
|||
return sog;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,9 +41,9 @@ namespace OpenSim.Tests.Common.Mock
|
|||
public TestScene(
|
||||
RegionInfo regInfo, AgentCircuitManager authen,
|
||||
SceneCommunicationService sceneGridService, ISimulationDataService simDataService, IEstateDataService estateDataService,
|
||||
ModuleLoader moduleLoader, bool dumpAssetsToFile,
|
||||
bool dumpAssetsToFile,
|
||||
IConfigSource config, string simulatorVersion)
|
||||
: base(regInfo, authen, sceneGridService, simDataService, estateDataService, moduleLoader,
|
||||
: base(regInfo, authen, sceneGridService, simDataService, estateDataService,
|
||||
dumpAssetsToFile, config, simulatorVersion)
|
||||
{
|
||||
}
|
||||
|
@ -73,4 +73,4 @@ namespace OpenSim.Tests.Common.Mock
|
|||
get { return m_asyncSceneObjectDeleter; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue