From 134f86e8d5c414409631b25b8c6f0ee45fbd8631 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Thu, 3 Nov 2016 21:44:39 +1000 Subject: Initial update to OpenSim 0.8.2.1 source code. --- .../Properties/AssemblyInfo.cs | 7 +- .../RegionModulesControllerPlugin.cs | 95 +++++++++++++++++----- .../RegionModulesControllerPlugin.addin.xml | 13 --- 3 files changed, 78 insertions(+), 37 deletions(-) delete mode 100644 OpenSim/ApplicationPlugins/RegionModulesController/Resources/RegionModulesControllerPlugin.addin.xml (limited to 'OpenSim/ApplicationPlugins/RegionModulesController') diff --git a/OpenSim/ApplicationPlugins/RegionModulesController/Properties/AssemblyInfo.cs b/OpenSim/ApplicationPlugins/RegionModulesController/Properties/AssemblyInfo.cs index 14527d9..acbdc3a 100644 --- a/OpenSim/ApplicationPlugins/RegionModulesController/Properties/AssemblyInfo.cs +++ b/OpenSim/ApplicationPlugins/RegionModulesController/Properties/AssemblyInfo.cs @@ -1,6 +1,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using Mono.Addins; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information @@ -29,5 +30,7 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.7.5.*")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("0.8.3.*")] + +[assembly: Addin("OpenSim.ApplicationPlugins.RegionModulesController", OpenSim.VersionInfo.VersionNumber)] +[assembly: AddinDependency("OpenSim", OpenSim.VersionInfo.VersionNumber)] diff --git a/OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs b/OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs index 633d005..8f38a29 100644 --- a/OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs +++ b/OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs @@ -32,11 +32,13 @@ using log4net; using Mono.Addins; using Nini.Config; using OpenSim; +using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; namespace OpenSim.ApplicationPlugins.RegionModulesController { + [Extension(Path = "/OpenSim/Startup", Id = "LoadRegions", NodeName = "Plugin")] public class RegionModulesControllerPlugin : IRegionModulesController, IApplicationPlugin { @@ -45,6 +47,12 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); + /// + /// Controls whether we load modules from Mono.Addins. + /// + /// For debug purposes. Defaults to true. + public bool LoadModulesFromAddins { get; set; } + // Config access private OpenSimBase m_openSim; @@ -61,6 +69,11 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController private List m_sharedInstances = new List(); + public RegionModulesControllerPlugin() + { + LoadModulesFromAddins = true; + } + #region IApplicationPlugin implementation public void Initialise (OpenSimBase openSim) @@ -69,6 +82,9 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController m_openSim.ApplicationRegistry.RegisterInterface(this); m_log.DebugFormat("[REGIONMODULES]: Initializing..."); + if (!LoadModulesFromAddins) + return; + // Who we are string id = AddinManager.CurrentAddin.Id; @@ -85,30 +101,20 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController if (modulesConfig == null) modulesConfig = m_openSim.ConfigSource.Source.AddConfig("Modules"); + Dictionary> loadedModules = new Dictionary>(); + // Scan modules and load all that aren't disabled - foreach (TypeExtensionNode node in - AddinManager.GetExtensionNodes("/OpenSim/RegionModules")) + foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes("/OpenSim/RegionModules")) + AddNode(node, modulesConfig, loadedModules); + + foreach (KeyValuePair> loadedModuleData in loadedModules) { - if (node.Type.GetInterface(typeof(ISharedRegionModule).ToString()) != null) - { - if (CheckModuleEnabled(node, modulesConfig)) - { - m_log.DebugFormat("[REGIONMODULES]: Found shared region module {0}, class {1}", node.Id, node.Type); - m_sharedModules.Add(node); - } - } - else if (node.Type.GetInterface(typeof(INonSharedRegionModule).ToString()) != null) - { - if (CheckModuleEnabled(node, modulesConfig)) - { - m_log.DebugFormat("[REGIONMODULES]: Found non-shared region module {0}, class {1}", node.Id, node.Type); - m_nonSharedModules.Add(node); - } - } - else - { - m_log.DebugFormat("[REGIONMODULES]: Found unknown type of module {0}, class {1}", node.Id, node.Type); - } + m_log.InfoFormat( + "[REGIONMODULES]: From plugin {0}, (version {1}), loaded {2} modules, {3} shared, {4} non-shared {5} unknown", + loadedModuleData.Key.Id, + loadedModuleData.Key.Version, + loadedModuleData.Value[0] + loadedModuleData.Value[1] + loadedModuleData.Value[2], + loadedModuleData.Value[0], loadedModuleData.Value[1], loadedModuleData.Value[2]); } // Load and init the module. We try a constructor with a port @@ -125,6 +131,9 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController // Read the config again string moduleString = modulesConfig.GetString("Setup_" + node.Id, String.Empty); + // Test to see if we want this module + if (moduleString == "disabled") + continue; // Get the port number, if there is one if (moduleString != String.Empty) @@ -172,6 +181,41 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController #region IPlugin implementation + private void AddNode( + TypeExtensionNode node, IConfig modulesConfig, Dictionary> loadedModules) + { + IList loadedModuleData; + + if (!loadedModules.ContainsKey(node.Addin)) + loadedModules.Add(node.Addin, new List { 0, 0, 0 }); + + loadedModuleData = loadedModules[node.Addin]; + + if (node.Type.GetInterface(typeof(ISharedRegionModule).ToString()) != null) + { + if (CheckModuleEnabled(node, modulesConfig)) + { + m_log.DebugFormat("[REGIONMODULES]: Found shared region module {0}, class {1}", node.Id, node.Type); + m_sharedModules.Add(node); + loadedModuleData[0]++; + } + } + else if (node.Type.GetInterface(typeof(INonSharedRegionModule).ToString()) != null) + { + if (CheckModuleEnabled(node, modulesConfig)) + { + m_log.DebugFormat("[REGIONMODULES]: Found non-shared region module {0}, class {1}", node.Id, node.Type); + m_nonSharedModules.Add(node); + loadedModuleData[1]++; + } + } + else + { + m_log.WarnFormat("[REGIONMODULES]: Found unknown type of module {0}, class {1}", node.Id, node.Type); + loadedModuleData[2]++; + } + } + // We don't do that here // public void Initialise () @@ -193,6 +237,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController m_sharedInstances[0].Close(); m_sharedInstances.RemoveAt(0); } + m_sharedModules.Clear(); m_nonSharedModules.Clear(); } @@ -323,6 +368,10 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController string moduleString = modulesConfig.GetString("Setup_" + node.Id, String.Empty); + // We may not want to load this at all + if (moduleString == "disabled") + continue; + // Get the port number, if there is one if (moduleString != String.Empty) { @@ -460,6 +509,8 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController { module.RegionLoaded(scene); } + + scene.AllModulesLoaded(); } public void RemoveRegionFromModules (Scene scene) diff --git a/OpenSim/ApplicationPlugins/RegionModulesController/Resources/RegionModulesControllerPlugin.addin.xml b/OpenSim/ApplicationPlugins/RegionModulesController/Resources/RegionModulesControllerPlugin.addin.xml deleted file mode 100644 index a92713b..0000000 --- a/OpenSim/ApplicationPlugins/RegionModulesController/Resources/RegionModulesControllerPlugin.addin.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - -- cgit v1.1